处理新增订单的套餐问题
This commit is contained in:
@@ -3,44 +3,122 @@
|
||||
<view style=" padding: 10rpx;">
|
||||
<view class="title">基础台费 </view>
|
||||
<nut-form>
|
||||
<!-- <nut-form-item>
|
||||
<template v-slot:label>房间</template>
|
||||
<template v-slot:default>
|
||||
<view style="color: black;" @click="visibleRoomsPopup = true">
|
||||
<text>{{form.room_name}}</text>
|
||||
</view>
|
||||
</template>
|
||||
</nut-form-item> -->
|
||||
<nut-form-item label="结算方式">
|
||||
<nut-radio-group v-model="form.fee_type" direction="horizontal">
|
||||
<nut-radio label="1">团购</nut-radio>
|
||||
<nut-radio label="2">线下</nut-radio>
|
||||
</nut-radio-group>
|
||||
</nut-form-item>
|
||||
</nut-form>
|
||||
|
||||
|
||||
|
||||
|
||||
<nut-form v-if="form.fee_type==1">
|
||||
<view class="inline-combo-form" v-for="(item, index) in orderCombos" :key="index">
|
||||
<view class="form-row">
|
||||
|
||||
<nut-form-item label-position="top">
|
||||
<template v-slot:label>平台</template>
|
||||
<template v-slot:default>
|
||||
<view style="color: black;" @click="visibleComboTypePopup = true">
|
||||
<text v-if="item.combo_type_name">{{item.combo_type_name}}</text>
|
||||
<text v-else>选择平台</text>
|
||||
</view>
|
||||
</template>
|
||||
</nut-form-item>
|
||||
|
||||
<nut-form-item label-position="top">
|
||||
<template v-slot:label>套餐</template>
|
||||
<template v-slot:default>
|
||||
<view style="color: black;" @click="visibleCombosPopup = true">
|
||||
<text v-if="item.combo_name">{{item.combo_name}}</text>
|
||||
<text v-else>选择套餐</text>
|
||||
</view>
|
||||
</template>
|
||||
</nut-form-item>
|
||||
|
||||
<nut-form-item label-position="top">
|
||||
<template v-slot:label>售价</template>
|
||||
<template v-slot:default>
|
||||
<view style="color: black;">
|
||||
<text>{{item.combo_price}}</text>
|
||||
</view>
|
||||
</template>
|
||||
</nut-form-item>
|
||||
|
||||
</view>
|
||||
|
||||
<view class="form-row">
|
||||
<nut-form-item label-position="top">
|
||||
<template v-slot:label>支付状态</template>
|
||||
<template v-slot:default>
|
||||
<view style="color: black;" @click="openPayStatusPopup('combo',index)">
|
||||
<text>{{item.combo_pay_status_txt}}</text>
|
||||
</view>
|
||||
</template>
|
||||
</nut-form-item>
|
||||
<nut-form-item label-position="top">
|
||||
<template v-slot:label> </template>
|
||||
<template v-slot:default>
|
||||
<view>
|
||||
<nut-button type="danger" size="mini" @click="removeCombos(index)">删除套餐</nut-button>
|
||||
</view>
|
||||
</template>
|
||||
</nut-form-item>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- 台费类型、套餐、支付状态 三者在同一行布局 -->
|
||||
<view class="inline-form">
|
||||
<!-- 台费类型选择 -->
|
||||
<nut-form-item label-position="top">
|
||||
<template v-slot:label>结算方式</template>
|
||||
<!-- <view class="inline-form" v-for="(item, index) in orderCombos" :key="index"> -->
|
||||
<!-- 台费类型选择 -->
|
||||
<!-- <nut-form-item label-position="top">
|
||||
<template v-slot:label>套餐平台</template>
|
||||
<template v-slot:default>
|
||||
<view style="color: black;" @click="visibleFeeTypePopup = true">
|
||||
<text>{{form.fee_type_name}}</text>
|
||||
<view style="color: black;" @click="visibleComboTypePopup = true">
|
||||
<text>{{form.combo_type_name}}</text>
|
||||
</view>
|
||||
</template>
|
||||
</nut-form-item>
|
||||
<!-- 套餐选择 -->
|
||||
<nut-form-item label-position="top" v-if="form.fee_type === 1 || form.fee_type === 2">
|
||||
</nut-form-item> -->
|
||||
<!-- 套餐选择 -->
|
||||
<!-- <nut-form-item label-position="top" v-if="form.fee_type === 1 || form.fee_type === 2">
|
||||
<template v-slot:label>选择团购</template>
|
||||
<template v-slot:default>
|
||||
<view style="color: black;" @click="visibleCombosPopup = true">
|
||||
<text>{{form.fee_combo_name}}</text>
|
||||
</view>
|
||||
</template>
|
||||
</nut-form-item> -->
|
||||
<!-- 金额输入框 -->
|
||||
<!-- <nut-form-item label-position="top" v-else>
|
||||
<template v-slot:label>线下收款</template>
|
||||
<template v-slot:default>
|
||||
<nut-input v-model="form.fee_amount" placeholder="请输入金额" type="number" />
|
||||
</template>
|
||||
</nut-form-item> -->
|
||||
<!-- 支付状态选择 -->
|
||||
<!-- <nut-form-item label-position="top">
|
||||
<template v-slot:label>支付状态</template>
|
||||
<template v-slot:default>
|
||||
<view style="color: black;" @click="openPayStatusPopup('fee')">
|
||||
<text>{{form.fee_pay_status_txt}}</text>
|
||||
</view>
|
||||
</template>
|
||||
</nut-form-item>
|
||||
<!-- 金额输入框 -->
|
||||
<nut-form-item label-position="top" v-else>
|
||||
</view> -->
|
||||
<view class="top-bar">
|
||||
<nut-button type="primary" plain size="small" @click="addCombos">新增套餐</nut-button>
|
||||
</view>
|
||||
</nut-form>
|
||||
<nut-form v-else>
|
||||
<view class="inline-form">
|
||||
<nut-form-item label-position="top">
|
||||
<template v-slot:label>线下收款</template>
|
||||
<template v-slot:default>
|
||||
<nut-input v-model="form.fee_amount" placeholder="请输入金额" type="number" />
|
||||
</template>
|
||||
</nut-form-item>
|
||||
<!-- 支付状态选择 -->
|
||||
<nut-form-item label-position="top">
|
||||
<template v-slot:label>支付状态</template>
|
||||
<template v-slot:default>
|
||||
@@ -53,15 +131,49 @@
|
||||
</nut-form>
|
||||
|
||||
|
||||
<!-- 台费类型、套餐、支付状态 三者在同一行布局 -->
|
||||
<!-- <view class="inline-form"> -->
|
||||
<!-- 台费类型选择 -->
|
||||
<!-- <nut-form-item label-position="top">
|
||||
<template v-slot:label>结算方式</template>
|
||||
<template v-slot:default>
|
||||
<view style="color: black;" @click="visibleFeeTypePopup = true">
|
||||
<text>{{form.fee_type_name}}</text>
|
||||
</view>
|
||||
</template>
|
||||
</nut-form-item> -->
|
||||
<!-- 套餐选择 -->
|
||||
<!-- <nut-form-item label-position="top" v-if="form.fee_type === 1 || form.fee_type === 2">
|
||||
<template v-slot:label>选择团购</template>
|
||||
<template v-slot:default>
|
||||
<view style="color: black;" @click="visibleCombosPopup = true">
|
||||
<text>{{form.fee_combo_name}}</text>
|
||||
</view>
|
||||
</template>
|
||||
</nut-form-item> -->
|
||||
<!-- 金额输入框 -->
|
||||
<!-- <nut-form-item label-position="top" v-else>
|
||||
<template v-slot:label>线下收款</template>
|
||||
<template v-slot:default>
|
||||
<nut-input v-model="form.fee_amount" placeholder="请输入金额" type="number" />
|
||||
</template>
|
||||
</nut-form-item> -->
|
||||
<!-- 支付状态选择 -->
|
||||
<!-- <nut-form-item label-position="top">
|
||||
<template v-slot:label>支付状态</template>
|
||||
<template v-slot:default>
|
||||
<view style="color: black;" @click="openPayStatusPopup('fee')">
|
||||
<text>{{form.fee_pay_status_txt}}</text>
|
||||
</view>
|
||||
</template>
|
||||
</nut-form-item>
|
||||
</view> -->
|
||||
|
||||
|
||||
|
||||
|
||||
<view class="title" v-if="form.fee_type==1 || form.fee_type==2 ">超时收费 </view>
|
||||
<nut-form v-if="form.fee_type==1 || form.fee_type==2 ">
|
||||
<!-- 台费类型、套餐、支付状态 三者在同一行布局 -->
|
||||
<view class="title" v-if="form.fee_type==1">超时收费</view>
|
||||
<nut-form v-if="form.fee_type==1 ">
|
||||
<view class="inline-form">
|
||||
<!-- 台费类型选择 -->
|
||||
<nut-form-item label-position="top">
|
||||
<template v-slot:label>时长(小时)</template>
|
||||
<template v-slot:default>
|
||||
@@ -69,7 +181,6 @@
|
||||
</template>
|
||||
</nut-form-item>
|
||||
|
||||
<!-- 金额输入框 -->
|
||||
<nut-form-item label-position="top">
|
||||
<template v-slot:label>超时金额</template>
|
||||
<template v-slot:default>
|
||||
@@ -77,7 +188,6 @@
|
||||
</template>
|
||||
</nut-form-item>
|
||||
|
||||
<!-- 支付状态选择 -->
|
||||
<nut-form-item label-position="top">
|
||||
<template v-slot:label>支付状态</template>
|
||||
<template v-slot:default>
|
||||
@@ -182,10 +292,12 @@
|
||||
title="选择团购套餐" @confirm="onConfirmCombos" @cancel="visibleCombosPopup = false">
|
||||
</nut-picker>
|
||||
</nut-popup>
|
||||
|
||||
|
||||
<!-- v-model="popupFeeTypeVal" -->
|
||||
<nut-popup v-model:visible="visibleFeeTypePopup" position="bottom" safe-area-inset-bottom>
|
||||
<nut-picker :columns="feeTypes" :field-names="{text:'label',value:'value'}" title="选择结算方式"
|
||||
@confirm="onConfirmFeeType" @cancel="visibleFeeTypePopup = false">
|
||||
<nut-popup v-model:visible="visibleComboTypePopup" position="bottom" safe-area-inset-bottom>
|
||||
<nut-picker :columns="comboTypes" :field-names="{text:'label',value:'value'}" title="选择套餐平台"
|
||||
@confirm="onConfirmComboType" @cancel="visibleComboTypePopup = false">
|
||||
</nut-picker>
|
||||
</nut-popup>
|
||||
|
||||
@@ -228,13 +340,42 @@
|
||||
})
|
||||
|
||||
|
||||
|
||||
// 选择房间弹窗
|
||||
const visibleFeeTypePopup = ref(false);
|
||||
// 台费结算类型
|
||||
// const popupFeeTypeVal = ref([])
|
||||
// 台费类型选择列表
|
||||
const feeTypes = [{
|
||||
// 订单套餐
|
||||
const orderCombos = ref([
|
||||
// {
|
||||
// combo_type_name: null,
|
||||
// combo_type_id: null,
|
||||
// combo_name: null,
|
||||
// goods_id: null,
|
||||
// goods_price: null,
|
||||
// goods_pay_status: 0,
|
||||
// goods_pay_status_txt: "请选择",
|
||||
// cascader_val: []
|
||||
// },
|
||||
])
|
||||
// 新增套餐
|
||||
const addCombos = () => {
|
||||
console.log(orderCombos.value);
|
||||
orderCombos.value.push({
|
||||
combo_type_name: null,
|
||||
combo_type_id: null,
|
||||
combo_id: null,
|
||||
combo_name: null,
|
||||
combo_price: null,
|
||||
combo_pay_status: 0,
|
||||
combo_pay_status_txt: "请选择",
|
||||
// goods_price: null,
|
||||
// cascader_val: []
|
||||
})
|
||||
}
|
||||
// 删除套餐
|
||||
const removeCombos = (index) => {
|
||||
orderCombos.value.splice(index, 1)
|
||||
}
|
||||
// 选择套餐平台弹窗
|
||||
const visibleComboTypePopup = ref(false);
|
||||
// 套餐平台
|
||||
const comboTypes = [{
|
||||
value: 1,
|
||||
label: '美团'
|
||||
},
|
||||
@@ -242,25 +383,20 @@
|
||||
value: 2,
|
||||
label: '抖音'
|
||||
},
|
||||
{
|
||||
value: 3,
|
||||
label: '线下'
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
// 选择房间
|
||||
const onConfirmFeeType = (selectedValue) => {
|
||||
// 选择套餐平台
|
||||
const onConfirmComboType = (selectedValue) => {
|
||||
console.log(selectedValue);
|
||||
form.fee_type_name = selectedValue.selectedOptions[0].label
|
||||
form.fee_type = selectedValue.selectedOptions[0].value
|
||||
console.log(form);
|
||||
if (form.fee_type !== 3) {
|
||||
getCombos();
|
||||
}
|
||||
visibleFeeTypePopup.value = false
|
||||
getCombos();
|
||||
visibleComboTypePopup.value = false // 关闭选择套餐弹窗
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const getCombos = () => {
|
||||
console.log("获取套餐");
|
||||
fetchCombos({
|
||||
@@ -281,9 +417,9 @@
|
||||
const combos = ref([]);
|
||||
// 选择套餐
|
||||
const onConfirmCombos = (selectedValue) => {
|
||||
console.log('selectedValue',selectedValue);
|
||||
console.log('selectedValue', selectedValue);
|
||||
form.fee_combo_name = selectedValue.selectedOptions[0].label
|
||||
form.fee_combo_id = selectedValue.selectedOptions[0].value
|
||||
form.fee_combo_id = selectedValue.selectedOptions[0].value
|
||||
form.fee_combo_price = selectedValue.selectedOptions[0].combo_price
|
||||
console.log(form);
|
||||
visibleCombosPopup.value = false
|
||||
@@ -432,12 +568,15 @@
|
||||
|
||||
const form = reactive({
|
||||
order_type: 1, // 开台订单
|
||||
room_id: 0,
|
||||
fee_type: 0,
|
||||
fee_type_name: '请选择',
|
||||
fee_combo_id: 0, // 套餐ID
|
||||
fee_combo_name: '请选择', // 套餐名称
|
||||
fee_combo_price: null,
|
||||
room_id: 0, // 房间ID
|
||||
fee_type: "1", // 默认是团购
|
||||
|
||||
|
||||
|
||||
|
||||
// fee_combo_id: 0, // 套餐ID
|
||||
// fee_combo_name: '请选择', // 套餐名称
|
||||
// fee_combo_price: null,
|
||||
fee_amount: null, // 线下支付费用
|
||||
fee_pay_status: 0, // 费用支付状态
|
||||
fee_pay_status_txt: '请选择', // 费用支付状态
|
||||
@@ -454,6 +593,7 @@
|
||||
|
||||
// 商品列表
|
||||
const selectGoods = ref([])
|
||||
|
||||
onMounted(() => {
|
||||
fetchGoods().then(res => {
|
||||
selectGoods.value = res;
|
||||
@@ -470,21 +610,21 @@
|
||||
}
|
||||
console.log('提交的订单数据:', data);
|
||||
// console.log('提交的订单数据:', form);
|
||||
fetchAddOrder(data).then(res => {
|
||||
console.log(res);
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '开台成功'
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.switchTab({
|
||||
url: '/pages/index/index'
|
||||
});
|
||||
// uni.navigateBack({
|
||||
// delta: 1 // 返回上一页
|
||||
// });
|
||||
}, 500)
|
||||
})
|
||||
// fetchAddOrder(data).then(res => {
|
||||
// console.log(res);
|
||||
// uni.showToast({
|
||||
// icon: 'none',
|
||||
// title: '开台成功'
|
||||
// })
|
||||
// setTimeout(() => {
|
||||
// uni.switchTab({
|
||||
// url: '/pages/index/index'
|
||||
// });
|
||||
// // uni.navigateBack({
|
||||
// // delta: 1 // 返回上一页
|
||||
// // });
|
||||
// }, 500)
|
||||
// })
|
||||
|
||||
};
|
||||
</script>
|
||||
@@ -525,6 +665,8 @@
|
||||
// z-index: 999;
|
||||
}
|
||||
|
||||
.inline-combo-form {}
|
||||
|
||||
/* 每个商品项容器 */
|
||||
.inline-goods-form {
|
||||
// box-sizing: border-box;
|
||||
|
||||
Reference in New Issue
Block a user