shopList.vue 13 KB

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