From a2ebb1b342ac1dc16dfddd4504e157b77c264257 Mon Sep 17 00:00:00 2001 From: "liujw155@outlook.com" Date: Tue, 20 Jun 2023 18:00:43 +0800 Subject: [PATCH] add api --- src/components/site/order_modal/order_modal.vue | 11 +++-- src/pages/site/confirm/confirm.vue | 53 +++++++++---------------- src/pages/site/manage/manage.vue | 37 +++++++++++++---- src/store/index.js | 1 + 4 files changed, 57 insertions(+), 45 deletions(-) diff --git a/src/components/site/order_modal/order_modal.vue b/src/components/site/order_modal/order_modal.vue index 6967c9f..239eddc 100644 --- a/src/components/site/order_modal/order_modal.vue +++ b/src/components/site/order_modal/order_modal.vue @@ -124,11 +124,11 @@ 取消订场 - - + + 分享给朋友 取消占用 - 收款 + 收款 @@ -168,6 +168,9 @@ export default { this.getOrderInfo(); }, methods: { + toCollections(){ + this.$emit('btn:toCollections', this.orderInfo); + }, releaseBtn(){ util.showModal({ title: '是否确认释放场地', @@ -300,6 +303,8 @@ export default { return '约玩占用' case 'fixed_venue': return '固定场锁定' + case 'take_up_venue_bboc': + return '挂账占用' default: return '-' } }, diff --git a/src/pages/site/confirm/confirm.vue b/src/pages/site/confirm/confirm.vue index b770ad4..8b4a543 100644 --- a/src/pages/site/confirm/confirm.vue +++ b/src/pages/site/confirm/confirm.vue @@ -24,7 +24,7 @@ 预定场次: - {{e.parentObj.venue_name || '-'}} {{e.durations || '-'}} (¥{{e.price || '-'}}) + {{e.venue_name || '-'}} {{e.duration || '-'}} (¥{{e.price || '-'}}) @@ -34,13 +34,20 @@ - *是否联动开灯 + + *是否联动开灯 + + 联动开灯开启后,会根据占用时间自动开灯 * 收取金额 - + @@ -52,19 +59,6 @@ - 注:占用用途如选择“散客”,用户端次卡列表将会显示该占用场次为散客时间 @@ -72,7 +66,7 @@ 占用原因 - + @@ -101,14 +95,17 @@ export default { } }, computed: { + isOrder(){ + return !!this?.occupyInfo?.orderInfo?.order_no; + }, ...mapState([ 'occupyInfo' ]), totalPrice(){ let { occupyInfo } = this; + if(occupyInfo?.orderInfo?.amount)return occupyInfo.orderInfo.amount; let _list = occupyInfo.venueList || []; if(!_list.length)return 0; let _price = 0; _list.forEach(e=>_price += +e.price); - console.warn(_price) return _price.toFixed(2); } }, @@ -116,8 +113,8 @@ export default { console.log(this.occupyInfo) }, methods: { - switchChange(e){ - this.light_up = e.detail.value + initOrderPage(){ + let { occupyInfo, isOrder }= this; }, confirmOccupy: util.debounce(function(){ let { storeInfo, dateInfo, venueList, typeInfo} = this.occupyInfo; @@ -132,14 +129,7 @@ export default { group: storeInfo.id, date: dateInfo.dateStr, take_up_use: ocUsage, - items: venueList.map(el=>{ - return { - venue_id: el.parentObj.venue_id, - venue_name: el.parentObj.venue_name, - duration: el.durations, - price: el.price, - } - }), + items: venueList, light_up, }, isDefaultGet: false @@ -152,13 +142,6 @@ export default { let _res = res.data.data || {}; let _qrStr = `?brand_id=${_res.brand_id}&order_no=${_res.order_no}` util.routeTo(`/pages/site/occupy_success/occupy_success${_qrStr}`, 'rT'); - // setTimeout(_=>{ - // util.routeTo(); - // util.previousPageFunction({ // 刷新占用列表 - // fnName: 'refreshList', - // query: null - // }) - // }, 1200) }else{ util.showNone(res.data.message || '操作失败!'); } diff --git a/src/pages/site/manage/manage.vue b/src/pages/site/manage/manage.vue index 2be72cf..39302c0 100644 --- a/src/pages/site/manage/manage.vue +++ b/src/pages/site/manage/manage.vue @@ -125,7 +125,7 @@ ¥{{totalPrice || '0.00'}} - + {{selectedVenueList.length?'提交订单':'请选择场地'}} @@ -133,7 +133,13 @@ {{occupyTip || '-'}} - + @@ -244,6 +250,8 @@ export default { return { zh_text: info.message || '约玩占用', type: info.type, className: 'black', } case 'fixed_venue': return { zh_text: info.message || '固定场锁定', type: info.type, className: 'blue', } + case 'take_up_venue_bboc': + return { zh_text: info.message || '挂账占用', type: info.type, className: 'red', } default: return {} @@ -534,17 +542,32 @@ export default { this.curTypeInfo = typeList[e.detail.value]; this.$nextTick(_=>this.refreshVenues()); }, - toOrderConfirm(){ - let { curStoreInfo, curTypeInfo, curDateInfo, selectedVenueList } = this; + subOrder(){ + let { selectedVenueList } = this; if(!selectedVenueList.length)return; - + this.toOrderConfirm({ + venueList: selectedVenueList.map(el =>({ + venue_id: el.parentObj.venue_id, + venue_name: el.parentObj.venue_name, + duration: el.durations, + price: el.price, + })), + }); + }, + toConfirmPage(orderInfo){ + this.toOrderConfirm({ + venueList: orderInfo.sessions || [], + orderInfo, + }); + }, + toOrderConfirm(extraObj){ + let { curStoreInfo, curTypeInfo, curDateInfo } = this; this.$store.commit('setOccupyInfo', { storeInfo: curStoreInfo, dateInfo: curDateInfo, typeInfo: curTypeInfo, - venueList: selectedVenueList, + ...extraObj, }) - util.routeTo(`/pages/site/confirm/confirm`, 'rT'); }, // 场馆列表 diff --git a/src/store/index.js b/src/store/index.js index 885237a..cdc5dcc 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -50,6 +50,7 @@ export default new Vuex.Store({ dateInfo: {}, // 时间信息 typeInfo: {}, // 球场类型 venueList: [], // 选择场地列表 + orderInfo: {}, // 订单信息 // 20230620 新增挂账需求,用于回显确认订单 } }, mutations,