ckshopList.vue 13 KB

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