shopList.vue 13 KB

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