ckshopList.vue 12 KB

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