onlineBooking.vue 14 KB

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