shopList.vue 11 KB

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