onlineBooking.vue 14 KB

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