paintShopList.vue 11 KB

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