shopList.vue 12 KB

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