shopList.vue 14 KB

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