ckshopList.vue 12 KB

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