ckshopList.vue 12 KB

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