onlineBooking.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628
  1. <template>
  2. <view class="box">
  3. <view class="top">
  4. <view class="shopTop">
  5. <swiper class="swiper" circular :autoplay="false" :interval="interval"
  6. :duration="duration" v-if="shopInfo.imgs">
  7. <swiper-item v-for="(item,index) in shopInfo.imgs.split(',')">
  8. <view class="swiper-item">
  9. <img mode="aspectFit" :src="item" alt="">
  10. </view>
  11. </swiper-item>
  12. </swiper>
  13. </view>
  14. <!-- 门店详情 -->
  15. <view class="newshopNames" v-if="shopInfo">
  16. <view class="newshopDstop">
  17. <view class="newshopDname">{{shopInfo.shopName}}</view>
  18. <view class="newshopDtime">
  19. 营业时间: <span>{{shopInfo.startTime}} - {{shopInfo.endTime}}</span>
  20. </view>
  21. <view class="newshopDbqbox" v-if="shopInfo.brands">
  22. <view class="newshopDbqline" v-for="(item,index) in shopInfo.brands.split(',')">{{item}}</view>
  23. </view>
  24. </view>
  25. <view class="newshopDadressBpx">
  26. <view class="newshopDaleft">
  27. <view class="newshopDaleftTop">
  28. <img src="../../static/timg/icon_coordinate@2x.png" alt="" class="shopaddressIcon">
  29. <!-- <span class="shopDdistance" v-if="Number(shopInfo.distance)>1">距离{{shopInfo.distance}}km</span>
  30. <span class="shopDdistance" v-else-if="Number(shopInfo.distance)">距离{{shopInfo.distance*1000}}m</span>
  31. <span class="shopDdistance" v-else>距离--km</span> -->
  32. </view>
  33. <view class="newshopDadressName">{{shopInfo.address?shopInfo.address:'--'}}</view>
  34. </view>
  35. <view class="newshopDaright">
  36. <view class="newshopDrline" @click="goLocation()">
  37. <img src="../../static/timg/icon_map@2x.png" alt="" class="newshopDrlineimg">
  38. <view class="newshopDrlineTxt">地图</view>
  39. </view>
  40. <view class="newshopDRsx"></view>
  41. <view class="newshopDrline" @click="phones()">
  42. <img src="../../static/timg/icon_phone@2x.png" alt="" class="newshopDrlineimg">
  43. <view class="newshopDrlineTxt">电话</view>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. <!-- 预约详情-->
  50. <view class="yuyue-container">
  51. <view class="yuyueLeft">
  52. <view class="yuyueleftLine" v-for="(item,index) in leftData" @click="listItemWxInfo(item,index)" :class="{leftActive:leftIndex==index}">{{item.Name}}</view>
  53. </view>
  54. <view class="yuyueRight">
  55. <view class="yuyueRightTitle">{{rightTitle}}</view>
  56. <view v-for="(item,index) in rightData" @click="checkItem(item)" style="padding-top: 10rpx;padding-left: 24rpx;padding-right: 24rpx;">
  57. <view class="yrTop">
  58. <view class="ItemName">{{item.ItemName}}</view>
  59. <image src="../../static/timg/ickno.png" v-if="selectedItems.findIndex(i=>i.ID===item.ID)==-1" mode="" class="yrTopImg"></image>
  60. <image src="../../static/timg/icon_checked@2x.png" v-if="selectedItems.findIndex(i=>i.ID===item.ID)!=-1" mode="" class="yrTopImg"></image>
  61. </view>
  62. <view class="itemSm">
  63. {{item.Comment}}
  64. </view>
  65. <view class="Price">
  66. <view class="yuyue-price"> <span class="qianhaospan">¥</span> {{item.Price||'--'}} </view>
  67. </view>
  68. </view>
  69. <view class="nodataBox" v-if="rightData.length==0">
  70. <image src="http://dmsphoto.66km.com.cn/thFiles/3C95A4C5-73F8-4B34-902B-703B8A0825C9.png" mode="widthFix" class="nodataImg"></image>
  71. <view class="noTxt">暂无数据</view>
  72. </view>
  73. </view>
  74. </view>
  75. <view class="bottom-container newbottom-container">
  76. <view class="newyyBox" @click="yuyueDetail">
  77. <view class="yyBleft">
  78. <img src="../../static/timg/icon_qingdan@2x.png" alt="" class="yyBleftimg">
  79. </view>
  80. <view>
  81. <view class="totalPriceBox"><span>预估总额:</span > <span class="totalPrice"><span class="qianhaospan">¥</span>{{totalPrice}}</span> </view>
  82. <span class="hejishul">合计数量: {{selectedItems.length}}</span>
  83. </view>
  84. </view>
  85. <view href="javascript:;" class=" newbottom-container-button" @click="yuyue">立即预约</view>
  86. </view>
  87. <view class="yydetailBox" v-if="yydetailShow" @click="yydetailShow=false">
  88. <view class="yyDetailTop" @click.stop="">
  89. <view class="yyDetailTopleft">清单</view>
  90. <view class="yyDetailTopRight">
  91. <view class="yydetalqk" @click="yyqingk">清空</view>
  92. <view class="yydetailx" @click="yydetailShow=false">X</view>
  93. </view>
  94. </view>
  95. <view class="yydetailCont" @click.stop="">
  96. <view class="yydetailContLine" v-for="(item,index) in selectedItems">
  97. <view class="yydlineName">{{item.ItemName}}</view>
  98. <view class="yydlineCommnt" v-if="true">{{item.Comment}}</view>
  99. <view class="yydPrice">¥{{item.Price}}</view>
  100. </view>
  101. </view>
  102. </view>
  103. </view>
  104. </template>
  105. <script>
  106. export default {
  107. data() {
  108. return {
  109. interval:2000,
  110. distance:0.05,
  111. leftIndex:0,
  112. yydetailShow:false,
  113. userInfo:'',
  114. bizTagId:'',
  115. leftData:'',
  116. rightData:'',
  117. rightTitle:'',
  118. selectedItems: [],
  119. location: {
  120. lng: '',
  121. lat: '',
  122. },
  123. shopInfo:'',
  124. naShopId:'',
  125. }
  126. },
  127. onLoad(opt) {
  128. this.userInfo = uni.getStorageSync("userInfo");
  129. this.naShopId=opt.naShopId;
  130. if(this.naShopId == null ||this.naShopId == 'null' ){
  131. this.naShopId=''
  132. }
  133. console.log(this.naShopId)
  134. var that = this;
  135. uni.getLocation({
  136. type: 'gcj02',
  137. success: function(res) {
  138. console.log(res)
  139. that.location.lat = res.latitude
  140. that.location.lng = res.longitude
  141. that.getInfo()
  142. },
  143. fail(err) {
  144. that.getInfo()
  145. }
  146. });
  147. //this.listBigTags()
  148. },
  149. computed: {
  150. totalPrice () {
  151. return this.selectedItems.reduce((i, k) => {
  152. return Number(i) + Number(k.Price)
  153. }, 0).toFixed(2)
  154. }
  155. },
  156. methods: {
  157. getInfo(){
  158. uni.showLoading({
  159. title: '加载中'
  160. })
  161. var that=this;
  162. this.$http('openreservation/getInfo', {
  163. lat: this.location.lat ? this.location.lat : '',
  164. lng: this.location.lng ? this.location.lng : '',
  165. shopId:this.naShopId,
  166. }, 'GET').then(res => {
  167. this.shopInfo = res.data.shopInfo;
  168. uni.setStorage({
  169. key: 'yyshopInfo',
  170. data:that.shopInfo,
  171. success: function () {
  172. }
  173. });
  174. this.listBigTags()
  175. })
  176. },
  177. listBigTags(){
  178. uni.showLoading({
  179. title: '加载中'
  180. });
  181. this.$http('openreservation/listBigTags', {
  182. shopId:this.shopInfo.id,
  183. unionId:this.userInfo.unionId
  184. }, 'GET').then(res => {
  185. uni.hideLoading();
  186. this.bizTagId=res.data[0].ID
  187. this.rightTitle=res.data[0].Name
  188. this.leftData=res.data;
  189. this.GetlistItemWxInfo()
  190. })
  191. },
  192. GetlistItemWxInfo(){
  193. //console.log("listItemWxInfo")
  194. uni.showLoading({
  195. title: '加载中'
  196. });
  197. console.log("bizTagId"+this.bizTagId)
  198. this.$http('openreservation/listItemWxInfo', {
  199. shopId:this.shopInfo.id,
  200. bizTagId:this.bizTagId
  201. }, 'GET').then(res => {
  202. //console.log(res)
  203. uni.hideLoading();
  204. // es.data.forEach(mode => {
  205. // mode.ck=false
  206. // })
  207. this.rightData=res.data
  208. console.log(this.rightData)
  209. })
  210. },
  211. checkItem (item) {
  212. let index = this.selectedItems.findIndex(i => i.ID === item.ID)
  213. if (index !== -1) {
  214. this.selectedItems.splice(index, 1)
  215. } else {
  216. this.selectedItems.push(item)
  217. }
  218. },
  219. goLocation(){
  220. var that = this;
  221. if (!that.shopInfo.lat || !that.shopInfo.lng) {
  222. uni.showToast({
  223. title: '该店铺未设置定位',
  224. icon: 'none',
  225. duration: 3000
  226. });
  227. } else {
  228. uni.openLocation({
  229. latitude: Number(that.shopInfo.lat),
  230. longitude: Number(that.shopInfo.lng),
  231. name: that.shopInfo.shopName,
  232. address: that.shopInfo.provinceName+that.shopInfo.cityName+that.shopInfo.areaName+that.shopInfo.address,
  233. success: function() {
  234. console.log('success');
  235. },
  236. fail(err) {
  237. console.log(err)
  238. }
  239. });
  240. }
  241. },
  242. phones(){
  243. uni.makePhoneCall({
  244. phoneNumber: this.shopInfo.contactorPhone
  245. });
  246. },
  247. listItemWxInfo(item,index){
  248. console.log(item)
  249. this.leftIndex=index;
  250. this.bizTagId=item.ID
  251. if(item.ID==''){
  252. this.bizTagId=''
  253. }
  254. this.rightTitle=item.Name;
  255. this.GetlistItemWxInfo()
  256. },
  257. yuyueDetail(){
  258. this.yydetailShow=true;
  259. },
  260. yyqingk(){
  261. this.selectedItems = []
  262. },
  263. yuyue(){
  264. if (!this.selectedItems.length) {
  265. uni.showToast({
  266. title: '请选择预约项目',
  267. icon: 'none',
  268. duration: 3000
  269. });
  270. } else {
  271. this.$store.commit('mutationsyuyueData', this.selectedItems)
  272. uni.navigateTo({
  273. url:'confirmYuyue'
  274. })
  275. }
  276. }
  277. }
  278. }
  279. </script>
  280. <style scoped lang="less">
  281. .nodataBox{
  282. text-align: center;
  283. }
  284. .nodataImg{
  285. width: 400rpx;
  286. padding-top: 100rpx;
  287. }
  288. .noTxt{
  289. font-size: 32rpx;
  290. color: #999999;
  291. padding-top: 50rpx;
  292. }
  293. .box{
  294. background: #F4F5F7;
  295. min-height: 100vh;
  296. }
  297. .swiper-item img{
  298. width: 750rpx;
  299. height: 500rpx;
  300. }
  301. .swiper-item{
  302. height: 500rpx;
  303. }
  304. .swiper{
  305. height: 500rpx;
  306. }
  307. .newshopNames{
  308. width: 702rpx;
  309. margin-left: 24rpx;
  310. background: #FFFFFF;
  311. border-radius: 10rpx;
  312. margin-top: -60rpx;
  313. position: relative;
  314. }
  315. .newshopDname{
  316. color: #333333;font-size: 30rpx;
  317. padding-left: 20rpx;
  318. padding-top: 23rpx;
  319. font-weight: 500;
  320. }
  321. .newshopDtime{
  322. color: #999999;
  323. font-size: 24rpx;
  324. padding-left: 20rpx;
  325. padding-top: 10rpx;
  326. font-weight: 400;
  327. }
  328. .newshopDstop{
  329. padding-bottom: 21rpx;
  330. border-bottom: 1px solid #EEEEEE;
  331. }
  332. .newshopDetailtop{
  333. margin-bottom: 20rpx;
  334. }
  335. .newshopDbqbox{
  336. display: flex;
  337. flex-wrap: wrap;
  338. padding-left: 20rpx;
  339. }
  340. .newshopDbqline{
  341. line-height: 30rpx;
  342. height: 30rpx;
  343. border-radius: 4rpx;
  344. border: 1px solid #F19D01;
  345. color: #f19D01;
  346. font-size: 24rpx;
  347. padding: 0 8rpx;
  348. margin-right: 16rpx;
  349. margin-top: 10rpx;
  350. }
  351. .newshopDbqbox{
  352. padding-top: 5rpx;
  353. }
  354. .shopaddressIcon{
  355. width: 22rpx;
  356. height: 30rpx;
  357. }
  358. .shopDdistance{
  359. color: #3C3C3C;font-size: 24rpx;line-height: 30rpx;padding-left: 16rpx;
  360. font-weight: 500;
  361. }
  362. .newshopDaleftTop{
  363. display: flex;
  364. }
  365. .newshopDadressBpx{
  366. display: flex;
  367. padding: 30rpx 20rpx;
  368. background: url(http://dmsphoto.66km.com.cn/thFiles/010748B7-5678-46C3-941B-60B3CD4D10CB.png) no-repeat;
  369. background-size: 100% 100%;
  370. }
  371. .newshopDadressName{
  372. color: #999999;padding-top: 16rpx;
  373. font-size: 24rpx;line-height: 24rpx;
  374. width: 480rpx;font-weight: 400;
  375. }
  376. .newshopDrlineimg{
  377. width: 44rpx;
  378. height: 44rpx;
  379. }
  380. .newshopDrlineTxt{
  381. color: #999999;
  382. font-size: 24rpx;
  383. text-align: center;
  384. padding-top: 7rpx;
  385. font-weight: 400;
  386. }
  387. .newright-item .yuyue-item{
  388. padding-top: 20rpx;
  389. }
  390. .newshopDRsx{
  391. width: 2rpx;
  392. height: 71rpx;
  393. background: #EEEEEE;
  394. }
  395. .newshopDaright{
  396. display: flex;
  397. justify-content: space-between;
  398. width: 150rpx;
  399. padding-left: 20rpx;
  400. }
  401. .yrTopImg{
  402. width: 36rpx;
  403. height: 36rpx;
  404. }
  405. .yuyue-container{
  406. display: flex;
  407. margin-top: 20rpx;
  408. padding-bottom: 120rpx;
  409. min-height: 40vh;
  410. }
  411. .yuyueLeft{
  412. background: #F5F5F5;
  413. width: 154rpx;
  414. }
  415. .yuyueRight{
  416. width: 596rpx;
  417. background: #FFFFFF;
  418. }
  419. .yuyueleftLine{
  420. font-size: 26rpx;
  421. padding:30rpx 24rpx;
  422. color: #3C3C3C;
  423. font-weight: 400;
  424. }
  425. .leftActive{
  426. background: #FFFFFF;
  427. font-weight: 500;
  428. }
  429. .yuyueRightTitle{
  430. color: #999999;font-size: 26rpx;
  431. background: #F9F9F9;
  432. padding-left: 24rpx;
  433. line-height: 62rpx;
  434. }
  435. .yrTop{
  436. display: flex;
  437. justify-content: space-between;
  438. }
  439. .ItemName{
  440. color: #3C3C3C;
  441. font-size: 28rpx;
  442. width: 480rpx;
  443. }
  444. .itemSm{
  445. color: #999999;
  446. line-height: 33rpx;
  447. font-size: 24rpx;
  448. text-overflow: -o-ellipsis-lastline;
  449. overflow: hidden;
  450. text-overflow: ellipsis;
  451. display: -webkit-box;
  452. -webkit-line-clamp: 2;
  453. line-clamp: 2;
  454. -webkit-box-orient: vertical;
  455. }
  456. .qianhaospan{
  457. font-size: 22rpx;
  458. }
  459. .yuyue-price{
  460. color: #FF3B30;
  461. font-size: 32rpx;
  462. padding-top: 8rpx;
  463. border-bottom: 1px solid #EEEEEE;
  464. padding-bottom: 19rpx;
  465. }
  466. .newbottom-container-button{
  467. width: 203rpx;
  468. height: 74rpx;
  469. background: #D53533;
  470. border-radius: 37rpx;
  471. color: #FEFFFE;
  472. font-size: 30rpx;
  473. line-height: 74rpx;
  474. text-align: center;
  475. }
  476. .newbottom-container{
  477. display: flex;
  478. justify-content: space-between;
  479. padding-left: 32rpx !important;
  480. width: 696rpx !important;
  481. z-index: 66;
  482. padding: 23rpx 32rpx !important;
  483. height: 76rpx !important;
  484. position: fixed;
  485. left: 0;
  486. bottom: 0;
  487. background: #FFFFFF;
  488. box-shadow: 0px -2px 10px 0px rgba(153,153,153,0.1000);
  489. }
  490. .yuyue-main .newright-item{
  491. padding-bottom: 19rpx;
  492. }
  493. .yyBleftimg{
  494. width: 45rpx;
  495. height: 35rpx;
  496. margin-top: 2rpx;
  497. }
  498. .yyBleft{
  499. display: flex;
  500. align-items: center;
  501. padding-right: 33rpx;
  502. }
  503. .newyyBox{
  504. display: flex;
  505. }
  506. .newyyBox .totalPriceBox{
  507. line-height: 45rpx;
  508. color: #666666;
  509. font-size: 24rpx;
  510. font-weight: 500;
  511. }
  512. .newyyBox .totalPrice{
  513. color: #FF0000;
  514. font-size: 32rpx;
  515. }
  516. .hejishul{
  517. color: #999999;
  518. font-size: 24rpx;
  519. font-weight: 400;
  520. }
  521. .yydetailBox{
  522. position: fixed;
  523. bottom: 0;
  524. left: 0;
  525. height: 100vh;
  526. width: 100vw;
  527. background: rgba(0, 0, 0, 0.4);
  528. z-index: 6;
  529. }
  530. .yydetailCont{
  531. width: 100vw;
  532. height: calc(50vh + 2rpx) ;
  533. overflow-y: scroll;
  534. background: #F0F0F0;
  535. position: absolute;
  536. left: 0;
  537. bottom: 119rpx;
  538. }
  539. .yyDetailTop{
  540. width: 750rpx;
  541. height: 90rpx;
  542. background: #FFFFFF;
  543. border-radius: 24rpx 24rpx 0px 0px;
  544. position: absolute;
  545. left: 0;
  546. bottom: calc( 50vh + 120rpx);
  547. display: flex;
  548. justify-content: space-between;
  549. }
  550. .yyDetailTopleft{
  551. color: #3C3C3C;
  552. font-size: 30rpx;
  553. line-height: 90rpx;
  554. padding-left: 24rpx;
  555. font-weight: 500;
  556. }
  557. .yyDetailTopRight{
  558. display: flex;
  559. padding-right: 24rpx;
  560. }
  561. .yydetailx{
  562. line-height: 90rpx;
  563. color: #999999;
  564. font-size: 30rpx;
  565. }
  566. .yydetalqk{
  567. width: 86rpx;
  568. height: 41rpx;
  569. background: #F4F5F7;
  570. border-radius: 21rpx;
  571. text-align: center;
  572. line-height: 41rpx;
  573. color: #666666;
  574. font-size: 24rpx;
  575. margin-top: 25rpx;
  576. margin-right: 38rpx;
  577. }
  578. .yydetailContLine{
  579. width: 702rpx;
  580. background: #FFFFFF;
  581. border-radius: 10rpx;
  582. margin-top: 20rpx;
  583. margin-left: 24rpx;
  584. padding: 24rpx 0px;
  585. }
  586. .yydlineName{
  587. color: #3C3C3C;
  588. font-size: 26rpx;
  589. padding-left: 24rpx;
  590. }
  591. .yydlineCommnt{
  592. color: #999999;
  593. font-size: 26rpx;
  594. padding-left: 22rpx;
  595. line-height: 30rpx;
  596. padding-top: 10rpx;
  597. }
  598. .yydPrice{
  599. padding-left: 22rpx;
  600. padding-top: 10rpx;
  601. color: #FF3B30;
  602. font-size: 32rpx;
  603. }
  604. </style>