paintShopList.vue 11 KB

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