ckshopList.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583
  1. <template>
  2. <view class="box">
  3. <view class="regionBox">
  4. <view class="regionLine" @click="gocity">
  5. <view class="regionTxt">{{cityName}}</view>
  6. <image src="../../static/timg/icon_arrow_def@2x.png" mode="" class="jtbelow"></image>
  7. </view>
  8. <view class="regionSx"></view>
  9. <view class="regionLine" @click="quCilck">
  10. <view class="regionTxt">{{areaName}}</view>
  11. <image src="../../static/timg/icon_arrow_def@2x.png" mode="" class="jtbelow"></image>
  12. </view>
  13. </view>
  14. <view style="height: 90rpx;"></view>
  15. <view class="shopline" v-for="(item,index) in queryShopList" @click="goDetail(item)">
  16. <view class="shoplineLeft">
  17. <image :src="item.photoPath" mode="" class="shopImg" v-if="item.photoPath"></image>
  18. <image src="../../static/timg/noimg.png" mode="" class="shopImg" v-else></image>
  19. </view>
  20. <view class="shopright">
  21. <view class="shopTop">
  22. <view class="shopName">{{item.shopName}}</view>
  23. </view>
  24. <view class="brandsBg" v-if="item.brands">
  25. <view class="brands" v-for="(v,index2) in item.brands.split(',')">{{v}}</view>
  26. </view>
  27. <view class="shopTime"><span v-if="item.startTime">{{item.startTime}}</span> - <span
  28. v-if="item.endTime">{{item.endTime}}</span> </view>
  29. <view class="shopBottomLeft">
  30. <span class="shopaddress"
  31. v-if="item.address">{{item.provinceName}}{{item.cityName}}{{item.areaName}}{{item.address}}</span>
  32. <span v-if="item.distance&&item.distance!= '0.00'">{{item.distance}}km</span>
  33. </view>
  34. </view>
  35. </view>
  36. <!-- 上拉 加载更多 -->
  37. <view class="noMore" v-if="noMoreShow && (queryShopList.length!=0)">没有更多数据</view>
  38. <!-- 无数据空白页 -->
  39. <nodata v-if="queryShopList.length==0"></nodata>
  40. <uni-popup ref="popup" type="right" :mask-click="true">
  41. <view class="popup-content">
  42. <scroll-view class="brandList" scroll-y="true">
  43. <!-- :class="{areaActvie:item.area==areaName}" -->
  44. <view v-for="item in areaList" class="areaListLine"
  45. @click="checkarea(item)">
  46. <span >{{item.area}}</span>
  47. <image v-if="item.code==area" class="areaCkIcon" src="http://dmsphoto.66km.com.cn/thFiles/0A1DADEA-1807-4ABC-B391-ECC8B1882DA4.png" mode=""></image>
  48. </view>
  49. </scroll-view>
  50. </view>
  51. </uni-popup>
  52. </view>
  53. </template>
  54. <script>
  55. import nodata from '../../components/nodata/nodata.vue'
  56. export default {
  57. components: {
  58. nodata,
  59. },
  60. data() {
  61. return {
  62. location: {
  63. lng: '',
  64. lat: '',
  65. },
  66. queryShopList: '',
  67. noMoreShow: false,
  68. goodsId:'',
  69. cityName:'城市',
  70. area:'',
  71. cityCode:'',
  72. areaName:'区域',
  73. loading:false,
  74. areaList:'',
  75. type:'',
  76. }
  77. },
  78. onLoad(opt) {
  79. var that = this;
  80. this.goodsId=opt.goodsId;
  81. this.type=opt.type
  82. uni.removeStorageSync('selectCity');
  83. uni.showLoading({
  84. title: '加载中'
  85. })
  86. uni.authorize({
  87. scope: 'scope.userLocation',
  88. success() {
  89. uni.getLocation({
  90. type: 'gcj02',
  91. success: function(res) {
  92. console.log(res)
  93. that.location.lat = res.latitude
  94. that.location.lng = res.longitude
  95. //that.getqueryShopList() //获取全部门店列表
  96. that.getAdress();
  97. //that.getqueryShopList() //获取全部门店列表
  98. },
  99. fail(err) {
  100. console.log(err)
  101. that.getqueryShopList() //获取全部门店列表
  102. }
  103. });
  104. },
  105. fail: (err) => {
  106. that.getqueryShopList();
  107. }})
  108. },
  109. onShow() {
  110. const selectCity = uni.getStorageSync('selectCity');
  111. //console.log("onShow")
  112. //console.log(selectCity)
  113. if(selectCity){
  114. this.cityName=selectCity.city
  115. this.cityCode=selectCity.code
  116. this.areaName='区域'
  117. this.area=''
  118. this.getAreaList()
  119. this.getqueryShopList() //获取门店列表
  120. }
  121. },
  122. methods: {
  123. quCilck(){
  124. this.$refs.popup.open("right")
  125. this.popupShow=true;
  126. },
  127. gocity(){
  128. if(this.type==4){
  129. uni.navigateTo({
  130. url:'/pages/subPack/chooseCity?type=4&id='+this.goodsId
  131. })
  132. }else if(this.type==5){
  133. uni.navigateTo({
  134. url:'/pages/subPack/chooseCity?type=5&id='+this.goodsId
  135. })
  136. }else{
  137. uni.navigateTo({
  138. url:'/pages/subPack/chooseCity?type=2&id='+this.goodsId
  139. })
  140. }
  141. },
  142. checkarea(item){
  143. if(this.area==item.code){
  144. this.areaName='区域'
  145. this.area=''
  146. this.getqueryShopList() //获取门店列表
  147. }else{
  148. this.areaName=item.area
  149. this.area=item.code
  150. this.getqueryShopList() //获取门店列表
  151. }
  152. this.$refs.popup.close()
  153. },
  154. getqueryShopList() {
  155. uni.showLoading({
  156. title: '加载中'
  157. })
  158. if(this.type==4){
  159. var url='openIntegralMall/getShopList'
  160. var params = {
  161. id:this.goodsId,
  162. lat: this.location.lat ? this.location.lat : '',
  163. lng: this.location.lng ? this.location.lng : '',
  164. city:this.cityCode,
  165. area:this.area
  166. }
  167. }else if(this.type==5){
  168. var url='openHome/queryShopList'
  169. var params = {
  170. collectingID:this.goodsId,
  171. city:this.cityCode,
  172. area:this.area
  173. }
  174. }
  175. else{
  176. var url='openMall/openStoreList'
  177. var params = {
  178. goodsId:this.goodsId,
  179. id:this.goodsId,
  180. lat: this.location.lat ? this.location.lat : '',
  181. lng: this.location.lng ? this.location.lng : '',
  182. city:this.cityCode,
  183. area:this.area
  184. }
  185. }
  186. this.$http(url,params, 'GET').then(res => {
  187. uni.hideLoading();
  188. this.queryShopList = res.data
  189. //console.log('list+=', this.queryShopList);
  190. })
  191. },
  192. getAreaList(){
  193. if(this.type==4){
  194. var url='openIntegralMall/shop-area-list'
  195. var params = {
  196. city:this.cityCode,
  197. id:this.goodsId,
  198. }
  199. }else if(this.type==5){
  200. //集客
  201. var url='openHome/shop-area-list'
  202. var params = {
  203. city:this.cityCode,
  204. collectingID:this.goodsId,
  205. }
  206. }
  207. else{
  208. var url='openMall/shop-area-list'
  209. var params = {
  210. city:this.cityCode,
  211. id:this.goodsId,
  212. }
  213. }
  214. this.$http(url, params, 'GET').then(res => {
  215. this.areaList=res.data
  216. })
  217. },
  218. getAdress(){
  219. var that=this;
  220. var location = this.location.lng + ',' + this.location.lat
  221. console.log('location'+location)
  222. uni.request({
  223. url: 'https://restapi.amap.com/v3/geocode/regeo',
  224. data: {
  225. key: '389a059efa3f499d9145eb84b1c3248d',
  226. location: location,
  227. },
  228. dataType: "json",
  229. success: (res) => {
  230. console.log('定位城市', res);
  231. if(res.data.regeocode){
  232. console.log("城市名称")
  233. console.log(res.data.regeocode.addressComponent.city)
  234. // console.log(res.data.pois[0].cityname)
  235. //let cityname = res.data.regeocode.addressComponent.city;
  236. if(res.data.regeocode.addressComponent.city.length!=0){
  237. var cityname = res.data.regeocode.addressComponent.city;
  238. }else{
  239. var cityname = res.data.regeocode.addressComponent.province;
  240. }
  241. var cityCode = res.data.regeocode.addressComponent.adcode
  242. cityCode = cityCode.slice(0, -2)
  243. cityCode = cityCode + '00'
  244. this.cityName = cityname
  245. this.cityCode = cityCode
  246. that.getqueryShopList() //获取全部门店列表
  247. that.getAreaList()
  248. }else{
  249. console.log("接口获取失败")
  250. that.cityCode = ''
  251. that.getqueryShopList() //获取全部门店列表
  252. }
  253. }
  254. });
  255. },
  256. goDetail(item) {
  257. this.$store.commit('mutationsckshopInfo', item)
  258. uni.navigateBack({
  259. delta:-1
  260. })
  261. // uni.navigateTo({
  262. // url: '../shop/shopDetail?id=' + item.shopId
  263. // })
  264. }
  265. },
  266. // 下拉刷新
  267. onPullDownRefresh() {
  268. this.getqueryShopList()
  269. setTimeout(function() {
  270. uni.stopPullDownRefresh();
  271. }, 1000);
  272. },
  273. }
  274. </script>
  275. <style scoped>
  276. .box {
  277. min-height: 100vh;
  278. background-color: #F4F5F7;
  279. /* padding-top: 20rpx; */
  280. padding-bottom: 60rpx;
  281. }
  282. .shopline {
  283. margin: 0rpx 24rpx 20rpx;
  284. padding: 20rpx;
  285. background-color: #FFFFFF;
  286. border-radius: 10rpx;
  287. display: flex;
  288. }
  289. .nodataImg {
  290. width: 400rpx;
  291. padding-top: 100rpx;
  292. }
  293. .noTxt {
  294. font-size: 36rpx;
  295. color: #999999;
  296. padding-top: 50rpx;
  297. }
  298. .nodataBox {
  299. text-align: center;
  300. }
  301. .shopImg {
  302. width: 146rpx;
  303. height: 146rpx;
  304. border-radius: 6rpx;
  305. }
  306. .shopBox {
  307. padding-top: 30rpx;
  308. display: flex;
  309. }
  310. .flex {
  311. display: flex;
  312. justify-content: space-between;
  313. }
  314. .shopCont {
  315. padding-left: 22rpx;
  316. width: 520rpx;
  317. }
  318. .shopName {
  319. color: #333333;
  320. font-size: 26rpx;
  321. font-weight: 600;
  322. }
  323. .span1 {
  324. color: #FF4F00;
  325. font-size: 36rpx;
  326. }
  327. .span2 {
  328. color: #FF4F00;
  329. font-size: 22rpx;
  330. }
  331. .span3 {
  332. color: #333333;
  333. font-size: 22rpx;
  334. padding-left: 22rpx;
  335. }
  336. .shopBq {
  337. color: #FF4F00;
  338. font-size: 22rpx;
  339. border-radius: 4rpx;
  340. border: 1px solid #FF4F00;
  341. line-height: 30rpx;
  342. height: 30rpx;
  343. padding: 0rpx 5rpx;
  344. margin-top: 10rpx;
  345. }
  346. .brandsBg {
  347. display: flex;
  348. height: 38rpx;
  349. flex-wrap: wrap;
  350. align-items: center;
  351. overflow: hidden;
  352. padding: 5rpx 0rpx;
  353. }
  354. .brands {
  355. border-radius: 4rpx;
  356. padding: 0 5rpx;
  357. color: #F19D01;
  358. height: 28rpx;
  359. border: 1px solid #F19D01;
  360. font-size: 20rpx;
  361. line-height: 28rpx;
  362. margin: 5rpx 10rpx 5rpx 0rpx;
  363. }
  364. .timeBg {
  365. display: flex;
  366. }
  367. .shopTime {
  368. color: #666666;
  369. font-size: 22rpx;
  370. }
  371. .addressBox {
  372. color: #666666;
  373. font-size: 22rpx;
  374. }
  375. .shopNameSearchInput {
  376. width: 500rpx;
  377. }
  378. .colorCS {
  379. color: #FF4F00;
  380. }
  381. .shopbox {
  382. padding: 0 16rpx;
  383. }
  384. .shopImg {
  385. width: 146rpx;
  386. height: 146rpx;
  387. border-radius: 10rpx;
  388. }
  389. .shopCallImg {
  390. width: 38rpx;
  391. height: 46rpx;
  392. }
  393. .shopTop {
  394. display: flex;
  395. justify-content: space-between;
  396. width: 510rpx;
  397. }
  398. .shopright {
  399. padding-left: 20rpx;
  400. }
  401. .shopName {
  402. font-size: 26rpx;
  403. color: #333333;
  404. line-height: 37rpx;
  405. width: 450rpx;
  406. white-space: nowrap;
  407. overflow: hidden;
  408. text-overflow: ellipsis;
  409. }
  410. .shopScore1 {
  411. font-size: 36rpx;
  412. font-weight: bold;
  413. color: #FF4F00;
  414. height: 50rpx;
  415. line-height: 50rpx;
  416. }
  417. .shopScore11 {
  418. font-size: 22rpx;
  419. color: #FF4F00;
  420. margin-right: 14rpx;
  421. }
  422. .shopScore2 {
  423. font-size: 22rpx;
  424. color: #666666;
  425. margin-right: 14rpx;
  426. padding: 8rpx 0;
  427. }
  428. .shopScore3 {
  429. font-size: 22rpx;
  430. color: #333333;
  431. padding-left: 20rpx;
  432. }
  433. .Btn {
  434. width: 104rpx;
  435. height: 56rpx;
  436. background: #FF2400 linear-gradient(135deg, #FD5300 0%, #FF270A 100%);
  437. border-radius: 6rpx;
  438. font-size: 26rpx;
  439. text-align: center;
  440. color: #FFFFFF;
  441. line-height: 56rpx;
  442. }
  443. .shopBottom {
  444. display: flex;
  445. }
  446. .shopBottomLeft {
  447. font-size: 25rpx;
  448. color: #666666;
  449. line-height: 30rpx;
  450. padding-top: 10rpx;
  451. display: flex;
  452. justify-content: space-between;
  453. padding-right: 10rpx;
  454. }
  455. .shopaddress {
  456. width: 400rpx;
  457. /* 隐藏文字显示 ...不换行 */
  458. overflow: hidden;
  459. text-overflow: ellipsis;
  460. white-space: nowrap;
  461. }
  462. .noMore {
  463. text-align: center;
  464. line-height: 50rpx;
  465. color: #999999;
  466. font-size: 28rpx;
  467. }
  468. .regionSx{
  469. width: 2rpx;height: 33rpx;background:#EEEEEE;
  470. }
  471. .regionLine{
  472. display: flex;justify-content: center;font-size: 26rpx;
  473. width: 370rpx;line-height: 33rpx;color: #3C3C3C;
  474. }
  475. .regionBox{
  476. display: flex;
  477. justify-content: center;
  478. background: #FFFFFF;
  479. padding: 20rpx 0;
  480. margin-bottom: 20rpx;
  481. position: fixed;
  482. width: 100vw;
  483. top: 0;left: 0;
  484. }
  485. .jtbelow{
  486. width: 14rpx;height: 7rpx;
  487. margin-left: 10rpx;margin-top: 10rpx;
  488. }
  489. .popup-content{
  490. width: 590rpx;
  491. background: #FFFFFF;
  492. height: 100vh;
  493. }
  494. .brandList{
  495. height:99vh;
  496. }
  497. .areaListLine{
  498. padding:30rpx 24rpx;
  499. color: #666666;
  500. font-size: 28rpx;
  501. border-bottom: 1px solid #eaeaea;
  502. display: flex;
  503. justify-content: space-between;
  504. line-height: 28rpx;
  505. }
  506. .areaActvie{
  507. background: #F19D01;
  508. color: #FFFFFF;
  509. }
  510. .areaCkIcon{
  511. width: 38rpx;height: 28rpx;
  512. }
  513. </style>