shopList.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736
  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. <!-- 手机号授权 -->
  73. <view class="authorizBox" v-if="authorizShow" @click="authorizShowno">
  74. <view class="authorizCont" @click.stop="">
  75. <view class="authorizName">{{wxOpenData.miniAppName}}</view>
  76. <view class="authorizMs">您好,欢迎访问本店,授权手机号登录能获取我们最新的促销活动哦~</view>
  77. <button class="authorizContbutton" type="default" open-type="getPhoneNumber" @getphonenumber="decryptPhoneNumber">授权</button>
  78. </view>
  79. <view style="text-align: center;padding-top: 56rpx;">
  80. <image src="../../static/timg/icon_guanbi@2x.png" @click="authorizShowno" mode="" class="authorizCloseImg"></image>
  81. </view>
  82. </view>
  83. </view>
  84. </template>
  85. <script>
  86. import nodata from '../../components/nodata/nodata.vue'
  87. export default {
  88. components: {
  89. nodata,
  90. },
  91. data() {
  92. return {
  93. location: {
  94. lng: '',
  95. lat: '',
  96. },
  97. queryShopList: '',
  98. noMoreShow: false,
  99. regionName:'',
  100. twoRegionName:'',
  101. cityName:'城市',
  102. area:'',
  103. cityCode:'',
  104. areaList:'',
  105. index:'',
  106. areaName:'区域',
  107. loading:false,
  108. ext:'',
  109. authorizShow:false,
  110. wxOpenData:'',
  111. userInfo: '',
  112. }
  113. },
  114. onLoad() {
  115. var that = this;
  116. uni.removeStorageSync('selectCity');
  117. this.userInfo = uni.getStorageSync("userInfo");
  118. this.ext=this.$common.getExtStoreId();
  119. if(this.userInfo){
  120. this.themeColor = uni.getStorageSync("themeColor");
  121. this.wxOpenData=this.$store.state.wxOpenData;
  122. this.init()
  123. }else{
  124. this.$common.automaticlogin().then(val => {
  125. this.themeColor = uni.getStorageSync("themeColor");
  126. this.userInfo=this.$store.state.userInfo;
  127. this.wxOpenData=this.$store.state.wxOpenData;
  128. this.init()
  129. if(!this.userInfo){
  130. uni.hideLoading();
  131. this.authorizShow=true
  132. }
  133. })
  134. }
  135. // that.getqueryShopList();
  136. },
  137. onShow() {
  138. const selectCity = uni.getStorageSync('selectCity');
  139. //console.log("onShow")
  140. //console.log(selectCity)
  141. if(selectCity){
  142. this.cityName=selectCity.city
  143. this.cityCode=selectCity.code
  144. this.areaName='区域'
  145. this.area=''
  146. this.getAreaList()
  147. this.getqueryShopList() //获取门店列表
  148. }
  149. },
  150. methods: {
  151. authorizShowno(){
  152. this.authorizShow=false
  153. },
  154. decryptPhoneNumber: function(e) {
  155. console.log(e);
  156. this.code=e.detail.code
  157. this.wxPhoneLogin()
  158. this.authorizShow=false;
  159. },
  160. wxPhoneLogin(){
  161. var that=this;
  162. this.$http('miniApp2/sys/wxPhoneLogin', {
  163. appId:this.ext.appId,
  164. unionId:this.ext.unionId,
  165. code:this.code,
  166. openId:this.wxOpenData.openid
  167. },'POST').then(res => {
  168. var data = res.data;
  169. if(data.loginInfo){
  170. this.userInfo=data.loginInfo.openUser;
  171. this.wxOpenData=data.loginInfo;
  172. this.$store.commit('mutationswxOpenData', data)
  173. this.$store.commit('mutationsuserInfo', this.userInfo)
  174. this.getInfo()
  175. }
  176. })
  177. },
  178. init(){
  179. var that = this;
  180. uni.authorize({
  181. scope: 'scope.userLocation',
  182. success() {
  183. uni.getLocation({
  184. type: 'gcj02',
  185. success: function(res) {
  186. console.log(res)
  187. that.location.lat = res.latitude
  188. that.location.lng = res.longitude
  189. that.getAdress();
  190. //that.getqueryShopList() //获取全部门店列表
  191. },
  192. fail(err) {
  193. console.log("定位失败")
  194. that.getqueryShopList();
  195. }
  196. });
  197. },
  198. fail: (err) => {
  199. that.getqueryShopList();
  200. }})
  201. },
  202. quCilck(){
  203. this.$refs.popup.open("right")
  204. this.popupShow=true;
  205. },
  206. gocity(){
  207. uni.navigateTo({
  208. url:'/pages/subPack/chooseCity'
  209. })
  210. },
  211. checkarea(item){
  212. if(this.area==item.code){
  213. this.areaName='区域'
  214. this.area=''
  215. this.getqueryShopList() //获取门店列表
  216. }else{
  217. this.areaName=item.area
  218. this.area=item.code
  219. this.getqueryShopList() //获取门店列表
  220. }
  221. this.$refs.popup.close()
  222. },
  223. bindPickerChange(e){
  224. //console.log(e)
  225. this.areaName=this.areaList[e.detail.value].area
  226. this.area=this.areaList[e.detail.value].code
  227. this.getqueryShopList() //获取门店列表
  228. },
  229. cancelHandling(){
  230. this.areaName='区域'
  231. this.area=''
  232. this.getqueryShopList() //获取门店列表
  233. },
  234. makePhoneCall(num){
  235. uni.makePhoneCall({
  236. phoneNumber:num
  237. });
  238. },
  239. goMap(item){
  240. var that = this;
  241. if (!item.lat || !item.lng) {
  242. uni.showToast({
  243. title: '该店铺未设置定位',
  244. icon: 'none',
  245. duration: 3000
  246. });
  247. } else {
  248. uni.openLocation({
  249. latitude: Number(item.lat),
  250. longitude: Number(item.lng),
  251. name: item.shopName,
  252. address: item.provinceName + item.cityName + item.areaName +
  253. item.address,
  254. success: function() {
  255. console.log('success');
  256. },
  257. fail(err) {
  258. console.log(err)
  259. }
  260. });
  261. }
  262. },
  263. getAdress(){
  264. var that=this;
  265. var location = this.location.lng + ',' + this.location.lat
  266. console.log('location'+location)
  267. uni.request({
  268. url: 'https://restapi.amap.com/v3/geocode/regeo',
  269. data: {
  270. key: '389a059efa3f499d9145eb84b1c3248d',
  271. location: location,
  272. },
  273. dataType: "json",
  274. success: (res) => {
  275. console.log('定位城市', res);
  276. if(res.data.regeocode){
  277. console.log("城市名称")
  278. console.log(res.data.regeocode.addressComponent.city)
  279. // console.log(res.data.pois[0].cityname)
  280. let cityname = res.data.regeocode.addressComponent.city;
  281. var cityCode = res.data.regeocode.addressComponent.adcode
  282. cityCode = cityCode.slice(0, -2)
  283. cityCode = cityCode + '00'
  284. this.cityName = cityname
  285. this.cityCode = cityCode
  286. that.getqueryShopList() //获取全部门店列表
  287. that.getAreaList()
  288. }else{
  289. console.log("接口获取失败")
  290. }
  291. }
  292. });
  293. },
  294. getAreaList(){
  295. this.$http('opencarOwnerHome/shop-area-list', {
  296. city:this.cityCode
  297. }, 'GET').then(res => {
  298. this.areaList=res.data
  299. })
  300. },
  301. getqueryShopList() {
  302. uni.showLoading({
  303. title: '加载中'
  304. })
  305. this.loading=false;
  306. this.$http('opencarOwnerHome/queryShopInfoList', {
  307. lat: this.location.lat ? this.location.lat : '',
  308. lng: this.location.lng ? this.location.lng : '',
  309. city:this.cityCode,
  310. area:this.area
  311. }, 'GET').then(res => {
  312. uni.hideLoading();
  313. this.queryShopList = res.data.shop;
  314. this.loading=true;
  315. //console.log('list+=', this.queryShopList);
  316. })
  317. },
  318. goDetail(item) {
  319. // uni.navigateTo({
  320. // url: '../shop/shopDetail?id=' + item.shopId
  321. // })
  322. if (this.userInfo) {
  323. uni.navigateTo({
  324. url:'onlineBooking?naShopId='+item.shopId
  325. })
  326. } else {
  327. this.authorizShow = true;
  328. return false;
  329. }
  330. }
  331. },
  332. // 下拉刷新
  333. onPullDownRefresh() {
  334. this.getqueryShopList()
  335. setTimeout(function() {
  336. uni.stopPullDownRefresh();
  337. }, 1000);
  338. },
  339. }
  340. </script>
  341. <style scoped>
  342. .areaCkIcon{
  343. width: 38rpx;height: 28rpx;
  344. }
  345. .popup-content{
  346. width: 590rpx;
  347. background: #FFFFFF;
  348. height: 100vh;
  349. }
  350. .brandList{
  351. height:99vh;
  352. }
  353. .areaListLine{
  354. padding:30rpx 24rpx;
  355. color: #666666;
  356. font-size: 28rpx;
  357. border-bottom: 1px solid #eaeaea;
  358. display: flex;
  359. justify-content: space-between;
  360. line-height: 28rpx;
  361. }
  362. .areaActvie{
  363. background: #F19D01;
  364. color: #FFFFFF;
  365. }
  366. .jtbelow{
  367. width: 14rpx;height: 7rpx;
  368. margin-left: 10rpx;margin-top: 10rpx;
  369. }
  370. .regionSx{
  371. width: 2rpx;height: 33rpx;background:#EEEEEE;
  372. }
  373. .regionLine{
  374. display: flex;justify-content: center;font-size: 26rpx;
  375. width: 370rpx;line-height: 33rpx;color: #3C3C3C;
  376. }
  377. .regionBox{
  378. display: flex;
  379. justify-content: center;
  380. background: #FFFFFF;
  381. padding: 20rpx 0;
  382. margin-bottom: 20rpx;
  383. position: fixed;
  384. width: 100vw;
  385. top: 0;left: 0;
  386. }
  387. .box {
  388. min-height: 100vh;
  389. background-color: #F4F5F7;
  390. padding-bottom: 60rpx;
  391. }
  392. .shopdhBox{
  393. display: flex;padding-top: 16rpx;
  394. }
  395. .shopcall{
  396. display: flex;
  397. }
  398. .shopcallIcon{
  399. width: 23rpx;height: 23rpx;margin-top: 5rpx;
  400. }
  401. .shopcallTxt{
  402. color: #3C3C3C;font-size: 24rpx;
  403. line-height: 33rpx;padding-left: 8rpx;
  404. }
  405. .yuyuBtnBox{
  406. display: flex;
  407. font-size: 24rpx;
  408. color: #FF8113;
  409. align-items: center;
  410. justify-items: center;
  411. /* border-left: 1px solid #EEEEEE;
  412. padding-left: 20rpx; */
  413. }
  414. .shopline {
  415. margin: 0rpx 24rpx 20rpx;
  416. padding: 20rpx;
  417. background-color: #FFFFFF;
  418. border-radius: 10rpx;
  419. display: flex;
  420. }
  421. .nodataImg {
  422. width: 400rpx;
  423. padding-top: 100rpx;
  424. }
  425. .noTxt {
  426. font-size: 36rpx;
  427. color: #999999;
  428. padding-top: 50rpx;
  429. }
  430. .nodataBox {
  431. text-align: center;
  432. }
  433. .shopImg {
  434. width: 154rpx;
  435. height: 154rpx;
  436. border-radius: 10rpx;
  437. }
  438. .shopBox {
  439. padding-top: 30rpx;
  440. display: flex;
  441. }
  442. .flex {
  443. display: flex;
  444. justify-content: space-between;
  445. }
  446. .shopCont {
  447. padding-left: 22rpx;
  448. width: 520rpx;
  449. }
  450. .span1 {
  451. color: #FF4F00;
  452. font-size: 36rpx;
  453. }
  454. .span2 {
  455. color: #FF4F00;
  456. font-size: 22rpx;
  457. }
  458. .span3 {
  459. color: #333333;
  460. font-size: 22rpx;
  461. padding-left: 22rpx;
  462. }
  463. .shopBq {
  464. color: #FF4F00;
  465. font-size: 22rpx;
  466. border-radius: 4rpx;
  467. border: 1px solid #FF4F00;
  468. line-height: 30rpx;
  469. height: 30rpx;
  470. padding: 0rpx 5rpx;
  471. margin-top: 10rpx;
  472. }
  473. .brandsBg {
  474. display: flex;
  475. align-items: center;
  476. padding: 5rpx 0rpx;
  477. flex-wrap: wrap;
  478. height: 36rpx;
  479. /* 隐藏文字显示 ...不换行 */
  480. overflow: hidden;
  481. text-overflow: ellipsis;
  482. white-space: nowrap;
  483. }
  484. .brands {
  485. border-radius: 4rpx;
  486. padding: 0 5rpx;
  487. color: #F19D01;
  488. height: 28rpx;
  489. border: 1px solid #F19D01;
  490. font-size: 20rpx;
  491. line-height: 28rpx;
  492. margin: 5rpx 10rpx 5rpx 0rpx;
  493. }
  494. .timeBg {
  495. display: flex;
  496. }
  497. .shopTime {
  498. color: #666666;
  499. font-size: 24rpx;
  500. }
  501. .addressBox {
  502. color: #666666;
  503. font-size: 22rpx;
  504. }
  505. .shopNameSearchInput {
  506. width: 500rpx;
  507. }
  508. .colorCS {
  509. color: #FF4F00;
  510. }
  511. .shopbox {
  512. padding: 0 16rpx;
  513. }
  514. .shopCallImg {
  515. width: 38rpx;
  516. height: 46rpx;
  517. }
  518. .shopTop {
  519. display: flex;
  520. justify-content: space-between;
  521. }
  522. .shopright {
  523. padding-left: 20rpx;
  524. width: 510rpx;
  525. }
  526. .shopName {
  527. font-size: 28rpx;
  528. font-weight: bold;
  529. color: #333333;
  530. line-height: 40rpx;
  531. width: 450rpx;
  532. white-space: nowrap;
  533. overflow: hidden;
  534. text-overflow: ellipsis;
  535. }
  536. .shopScore1 {
  537. font-size: 36rpx;
  538. font-weight: bold;
  539. color: #FF4F00;
  540. height: 50rpx;
  541. line-height: 50rpx;
  542. }
  543. .shopScore11 {
  544. font-size: 22rpx;
  545. color: #FF4F00;
  546. margin-right: 14rpx;
  547. }
  548. .shopScore2 {
  549. font-size: 22rpx;
  550. color: #666666;
  551. margin-right: 14rpx;
  552. padding: 8rpx 0;
  553. }
  554. .shopScore3 {
  555. font-size: 22rpx;
  556. color: #333333;
  557. padding-left: 20rpx;
  558. }
  559. .Btn {
  560. width: 104rpx;
  561. height: 56rpx;
  562. background: #FF2400 linear-gradient(135deg, #FD5300 0%, #FF270A 100%);
  563. border-radius: 6rpx;
  564. font-size: 26rpx;
  565. text-align: center;
  566. color: #FFFFFF;
  567. line-height: 56rpx;
  568. }
  569. .shopBottom {
  570. display: flex;
  571. }
  572. .shopBottomLeft {
  573. font-size: 25rpx;
  574. color: #666666;
  575. line-height: 30rpx;
  576. padding-top: 10rpx;
  577. display: flex;
  578. justify-content: space-between;
  579. padding-right: 10rpx;
  580. }
  581. .shopaddress {
  582. width: 400rpx;
  583. /* 隐藏文字显示 ...不换行 */
  584. overflow: hidden;
  585. text-overflow: ellipsis;
  586. white-space: nowrap;
  587. }
  588. .noMore {
  589. text-align: center;
  590. line-height: 50rpx;
  591. color: #999999;
  592. font-size: 28rpx;
  593. }
  594. .authorizBox{
  595. width: 100vw;
  596. height: 100vh;
  597. background: rgba(0, 0, 0, 0.5);
  598. position: fixed;
  599. top: 0;
  600. left: 0;
  601. }
  602. .authorizCont{
  603. margin-top: 30vh;
  604. width: 564rpx;
  605. height: 408rpx;
  606. background: #FFFFFF;
  607. border-radius: 24rpx;
  608. margin-left: 93rpx;
  609. position: relative;
  610. }
  611. .authorizCloseImg{
  612. width: 62rpx;
  613. height: 62rpx;
  614. }
  615. .sqLogoBox{
  616. width: 180rpx;
  617. height: 180rpx;
  618. background: #FFFFFF;
  619. border-radius: 90rpx;
  620. text-align: center;
  621. position: absolute;
  622. top: -50rpx;
  623. left: 192rpx;
  624. }
  625. .authorizName{
  626. color: #333333;
  627. line-height: 42rpx;
  628. font-size: 30rpx;
  629. text-align: center;
  630. padding-top: 58rpx;
  631. }
  632. .authorizMs{
  633. color: #999999;
  634. line-height: 36rpx;
  635. font-size: 26rpx;
  636. width: 452rpx;
  637. padding-top: 24rpx;
  638. text-align: center;
  639. margin-left: 56rpx;
  640. }
  641. .authorizContbutton{
  642. width: 422rpx;
  643. height: 88rpx;
  644. background: #D53533;
  645. border-radius: 44rpx;
  646. line-height: 88rpx;
  647. text-align: center;
  648. font-size:30rpx;
  649. color: #FFFFFF;
  650. margin-top: 62rpx;
  651. margin-left:71rpx;
  652. }
  653. </style>