paintShopList.vue 12 KB

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