onlineBooking.vue 14 KB

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