ckshopList.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585
  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. lat: this.location.lat ? this.location.lat : '',
  174. lng: this.location.lng ? this.location.lng : '',
  175. }
  176. }
  177. else{
  178. var url='openMall/openStoreList'
  179. var params = {
  180. goodsId:this.goodsId,
  181. id:this.goodsId,
  182. lat: this.location.lat ? this.location.lat : '',
  183. lng: this.location.lng ? this.location.lng : '',
  184. city:this.cityCode,
  185. area:this.area
  186. }
  187. }
  188. this.$http(url,params, 'GET').then(res => {
  189. uni.hideLoading();
  190. this.queryShopList = res.data
  191. //console.log('list+=', this.queryShopList);
  192. })
  193. },
  194. getAreaList(){
  195. if(this.type==4){
  196. var url='openIntegralMall/shop-area-list'
  197. var params = {
  198. city:this.cityCode,
  199. id:this.goodsId,
  200. }
  201. }else if(this.type==5){
  202. //集客
  203. var url='openHome/shop-area-list'
  204. var params = {
  205. city:this.cityCode,
  206. collectingID:this.goodsId,
  207. }
  208. }
  209. else{
  210. var url='openMall/shop-area-list'
  211. var params = {
  212. city:this.cityCode,
  213. id:this.goodsId,
  214. }
  215. }
  216. this.$http(url, params, 'GET').then(res => {
  217. this.areaList=res.data
  218. })
  219. },
  220. getAdress(){
  221. var that=this;
  222. var location = this.location.lng + ',' + this.location.lat
  223. console.log('location'+location)
  224. uni.request({
  225. url: 'https://restapi.amap.com/v3/geocode/regeo',
  226. data: {
  227. key: '389a059efa3f499d9145eb84b1c3248d',
  228. location: location,
  229. },
  230. dataType: "json",
  231. success: (res) => {
  232. console.log('定位城市', res);
  233. if(res.data.regeocode){
  234. console.log("城市名称")
  235. console.log(res.data.regeocode.addressComponent.city)
  236. // console.log(res.data.pois[0].cityname)
  237. //let cityname = res.data.regeocode.addressComponent.city;
  238. if(res.data.regeocode.addressComponent.city.length!=0){
  239. var cityname = res.data.regeocode.addressComponent.city;
  240. }else{
  241. var cityname = res.data.regeocode.addressComponent.province;
  242. }
  243. var cityCode = res.data.regeocode.addressComponent.adcode
  244. cityCode = cityCode.slice(0, -2)
  245. cityCode = cityCode + '00'
  246. this.cityName = cityname
  247. this.cityCode = cityCode
  248. that.getqueryShopList() //获取全部门店列表
  249. that.getAreaList()
  250. }else{
  251. console.log("接口获取失败")
  252. that.cityCode = ''
  253. that.getqueryShopList() //获取全部门店列表
  254. }
  255. }
  256. });
  257. },
  258. goDetail(item) {
  259. this.$store.commit('mutationsckshopInfo', item)
  260. uni.navigateBack({
  261. delta:-1
  262. })
  263. // uni.navigateTo({
  264. // url: '../shop/shopDetail?id=' + item.shopId
  265. // })
  266. }
  267. },
  268. // 下拉刷新
  269. onPullDownRefresh() {
  270. this.getqueryShopList()
  271. setTimeout(function() {
  272. uni.stopPullDownRefresh();
  273. }, 1000);
  274. },
  275. }
  276. </script>
  277. <style scoped>
  278. .box {
  279. min-height: 100vh;
  280. background-color: #F4F5F7;
  281. /* padding-top: 20rpx; */
  282. padding-bottom: 60rpx;
  283. }
  284. .shopline {
  285. margin: 0rpx 24rpx 20rpx;
  286. padding: 20rpx;
  287. background-color: #FFFFFF;
  288. border-radius: 10rpx;
  289. display: flex;
  290. }
  291. .nodataImg {
  292. width: 400rpx;
  293. padding-top: 100rpx;
  294. }
  295. .noTxt {
  296. font-size: 36rpx;
  297. color: #999999;
  298. padding-top: 50rpx;
  299. }
  300. .nodataBox {
  301. text-align: center;
  302. }
  303. .shopImg {
  304. width: 146rpx;
  305. height: 146rpx;
  306. border-radius: 6rpx;
  307. }
  308. .shopBox {
  309. padding-top: 30rpx;
  310. display: flex;
  311. }
  312. .flex {
  313. display: flex;
  314. justify-content: space-between;
  315. }
  316. .shopCont {
  317. padding-left: 22rpx;
  318. width: 520rpx;
  319. }
  320. .shopName {
  321. color: #333333;
  322. font-size: 26rpx;
  323. font-weight: 600;
  324. }
  325. .span1 {
  326. color: #FF4F00;
  327. font-size: 36rpx;
  328. }
  329. .span2 {
  330. color: #FF4F00;
  331. font-size: 22rpx;
  332. }
  333. .span3 {
  334. color: #333333;
  335. font-size: 22rpx;
  336. padding-left: 22rpx;
  337. }
  338. .shopBq {
  339. color: #FF4F00;
  340. font-size: 22rpx;
  341. border-radius: 4rpx;
  342. border: 1px solid #FF4F00;
  343. line-height: 30rpx;
  344. height: 30rpx;
  345. padding: 0rpx 5rpx;
  346. margin-top: 10rpx;
  347. }
  348. .brandsBg {
  349. display: flex;
  350. height: 38rpx;
  351. flex-wrap: wrap;
  352. align-items: center;
  353. overflow: hidden;
  354. padding: 5rpx 0rpx;
  355. }
  356. .brands {
  357. border-radius: 4rpx;
  358. padding: 0 5rpx;
  359. color: #F19D01;
  360. height: 28rpx;
  361. border: 1px solid #F19D01;
  362. font-size: 20rpx;
  363. line-height: 28rpx;
  364. margin: 5rpx 10rpx 5rpx 0rpx;
  365. }
  366. .timeBg {
  367. display: flex;
  368. }
  369. .shopTime {
  370. color: #666666;
  371. font-size: 22rpx;
  372. }
  373. .addressBox {
  374. color: #666666;
  375. font-size: 22rpx;
  376. }
  377. .shopNameSearchInput {
  378. width: 500rpx;
  379. }
  380. .colorCS {
  381. color: #FF4F00;
  382. }
  383. .shopbox {
  384. padding: 0 16rpx;
  385. }
  386. .shopImg {
  387. width: 146rpx;
  388. height: 146rpx;
  389. border-radius: 10rpx;
  390. }
  391. .shopCallImg {
  392. width: 38rpx;
  393. height: 46rpx;
  394. }
  395. .shopTop {
  396. display: flex;
  397. justify-content: space-between;
  398. width: 510rpx;
  399. }
  400. .shopright {
  401. padding-left: 20rpx;
  402. }
  403. .shopName {
  404. font-size: 26rpx;
  405. color: #333333;
  406. line-height: 37rpx;
  407. width: 450rpx;
  408. white-space: nowrap;
  409. overflow: hidden;
  410. text-overflow: ellipsis;
  411. }
  412. .shopScore1 {
  413. font-size: 36rpx;
  414. font-weight: bold;
  415. color: #FF4F00;
  416. height: 50rpx;
  417. line-height: 50rpx;
  418. }
  419. .shopScore11 {
  420. font-size: 22rpx;
  421. color: #FF4F00;
  422. margin-right: 14rpx;
  423. }
  424. .shopScore2 {
  425. font-size: 22rpx;
  426. color: #666666;
  427. margin-right: 14rpx;
  428. padding: 8rpx 0;
  429. }
  430. .shopScore3 {
  431. font-size: 22rpx;
  432. color: #333333;
  433. padding-left: 20rpx;
  434. }
  435. .Btn {
  436. width: 104rpx;
  437. height: 56rpx;
  438. background: #FF2400 linear-gradient(135deg, #FD5300 0%, #FF270A 100%);
  439. border-radius: 6rpx;
  440. font-size: 26rpx;
  441. text-align: center;
  442. color: #FFFFFF;
  443. line-height: 56rpx;
  444. }
  445. .shopBottom {
  446. display: flex;
  447. }
  448. .shopBottomLeft {
  449. font-size: 25rpx;
  450. color: #666666;
  451. line-height: 30rpx;
  452. padding-top: 10rpx;
  453. display: flex;
  454. justify-content: space-between;
  455. padding-right: 10rpx;
  456. }
  457. .shopaddress {
  458. width: 400rpx;
  459. /* 隐藏文字显示 ...不换行 */
  460. overflow: hidden;
  461. text-overflow: ellipsis;
  462. white-space: nowrap;
  463. }
  464. .noMore {
  465. text-align: center;
  466. line-height: 50rpx;
  467. color: #999999;
  468. font-size: 28rpx;
  469. }
  470. .regionSx{
  471. width: 2rpx;height: 33rpx;background:#EEEEEE;
  472. }
  473. .regionLine{
  474. display: flex;justify-content: center;font-size: 26rpx;
  475. width: 370rpx;line-height: 33rpx;color: #3C3C3C;
  476. }
  477. .regionBox{
  478. display: flex;
  479. justify-content: center;
  480. background: #FFFFFF;
  481. padding: 20rpx 0;
  482. margin-bottom: 20rpx;
  483. position: fixed;
  484. width: 100vw;
  485. top: 0;left: 0;
  486. }
  487. .jtbelow{
  488. width: 14rpx;height: 7rpx;
  489. margin-left: 10rpx;margin-top: 10rpx;
  490. }
  491. .popup-content{
  492. width: 590rpx;
  493. background: #FFFFFF;
  494. height: 100vh;
  495. }
  496. .brandList{
  497. height:99vh;
  498. }
  499. .areaListLine{
  500. padding:30rpx 24rpx;
  501. color: #666666;
  502. font-size: 28rpx;
  503. border-bottom: 1px solid #eaeaea;
  504. display: flex;
  505. justify-content: space-between;
  506. line-height: 28rpx;
  507. }
  508. .areaActvie{
  509. background: #F19D01;
  510. color: #FFFFFF;
  511. }
  512. .areaCkIcon{
  513. width: 38rpx;height: 28rpx;
  514. }
  515. </style>