ckshopList.vue 12 KB

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