paintShopList.vue 12 KB

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