宴席2.0

This commit is contained in:
sjeam 2025-08-15 14:16:03 +08:00
parent 5ba9a3eb76
commit dfc54ea015
2 changed files with 237 additions and 190 deletions

View File

@ -39,7 +39,7 @@
<u-cell class="" style="line-height: 60rpx;" :border="true">
<template #title>
<view class="h-50 p-2 align-center font-blod" @click="close">
支付金额 <wd-text size="36rpx" bold text="16354.156" mode="price" type="error" prefix="¥" suffix="元" />
支付金额 <wd-text size="36rpx" bold :text="`${pre_price}`" mode="price" type="error" prefix="¥" suffix="元" />
</view>
<view class="h-50 p-2 align-center">
剩余时间
@ -68,7 +68,7 @@
</up-text>
<!-- <u-icon size="48rpx" slot="right" label-color="red" :label="`¥2000.00元`"></u-icon> -->
<view style="display: inline-block; float:right">
<u-radio iconSize="36rpx" size="36rpx" activeColor="#59CB56" label=""></u-radio>
<u-radio checked iconSize="36rpx" size="36rpx" activeColor="#59CB56" label=""></u-radio>
</view>
</view>
@ -93,7 +93,7 @@
<!-- <text class="font-size-32 color-red font-bold ">213213.00</text> -->
</view>
</view>
<view class="title font-size-28 pt-4">
<view class="title font-size-28 pt-4" v-if="order_type===1">
<view>做宴时段{{ matchedItems[0].banquet_date }}</view>
<view class="title-tip font-size-28">
做宴时段{{ matchedItems[0].banquet_time }}
@ -197,8 +197,17 @@
},
message: '请选择宴席类型'
}
]"
></wd-select-picker>
]"></wd-select-picker>
<wd-calendar v-if="order_type===2" label="做宴日期" placeholder="请选择日期" prop="banquet_date" :formatter="formatter" :min-date="min_data"
v-model="orderInfo.banquet_date" :rules="[{ required: false, pattern: /^\d{13}$/, message: '请选择日期' }]"
@confirm="handleTimeConfirm" />
<wd-input v-if="order_type===2" label="做宴桌数" placeholder="请输做宴桌数" prop="table_number" type="number" clearable
v-model="orderInfo.table_number" :rules="[{ required: false, pattern: /^[1-9]\d*$/, message: '请输入有效的桌数' }]"
placeholder-style="color: #999999; font-size: 14px;" />
<wd-col-picker label="做宴地址" v-model="orderInfo.district_name" prop="district_name" :columns="area"
:column-change="columnChange" placeholder="请填写做宴地址" @confirm="handleConfirm" :rules="[
@ -215,6 +224,9 @@
}
]"></wd-col-picker>
<wd-input label="详细地址" prop="street_name" clearable v-model="orderInfo.street_name" placeholder="请填写详细地址"
:rules="[
{
@ -243,15 +255,27 @@
</template>
<script lang="ts">
import { useColPickerData, useModal } from '@/hooks'
import { defineComponent } from "vue";
import { CommonApi, UserApi } from "@/api";
import {
useColPickerData,
useModal
} from '@/hooks'
import {
defineComponent
} from "vue";
import {
CommonApi,
UserApi
} from "@/api";
// import { setToken, getToken, isLogin } from '@/utils/auth';
const { colPickerData, findChildrenByCode } = useColPickerData()
const {
colPickerData,
findChildrenByCode
} = useColPickerData()
export default defineComponent({
data() {
return {
totalPrice: 0,
pre_price: 0,
server_user: {
phone: '',
public_name: '',
@ -263,10 +287,11 @@ export default defineComponent({
propShowOrder: false,
area: [],
value: [],
order_type: 1, // 2
orderInfo: {
district_name: [],
street_name: '',
// cart_ids: [],
cart_ids: 0, //
customer_name: '',
phone: '',
address: '',
@ -274,15 +299,18 @@ export default defineComponent({
banquet_type: '1',
reservation_type: 1,
server_user_id: 0,
// table_number: 0,
// banquet_date: '',
table_number: 1, //
banquet_date: [], //
},
matchedItems_sp: [],
};
},
onLoad(option) {
this.server_user_id = option.id;;
this.orderInfo.cart_ids = option.cart_ids || 0;
if (this.orderInfo.cart_ids) {
this.order_type = 2; //
}
this.orderInfo.server_user_id = option.id;
this.getCartCheck()
this.getArea()
@ -296,13 +324,17 @@ export default defineComponent({
},
//
handleSubmit(reservation_type) {
// this.propShowOrder = true;
// console.log(this.orderInfo);
this.orderInfo.reservation_type = reservation_type; //
this.$refs.form.validate()
.then(({ valid, errors }) => {
.then(({
valid,
errors
}) => {
if (valid) {
this.orderInfo.address = this.address_string + this.orderInfo.street_name;
console.log(this.orderInfo);
// console.log(this.orderInfo);
this.addOrder();
}
})
@ -326,7 +358,9 @@ export default defineComponent({
//
payOrder(order_id) {
CommonApi.commonPost('/api/banquet/order/pay', {order_id:order_id}).catch((res) => {
CommonApi.commonPost('/api/banquet/order/pay', {
order_id: order_id
}).catch((res) => {
if (res.code === 1) {
// this.payOrder(res.data.order_id);
@ -354,7 +388,11 @@ export default defineComponent({
this.address_string = value.selectedItems.map(item => item.label).join('')
},
//
columnChange ({ selectedItem, resolve, finish }) {
columnChange({
selectedItem,
resolve,
finish
}) {
try {
const areaData = findChildrenByCode(colPickerData, selectedItem.value);
if (areaData && areaData.length) {
@ -387,10 +425,13 @@ export default defineComponent({
},
// //
getCartCheck() {
CommonApi.commonPost('/api/banquet/order/check', { server_user_id: this.server_user_id }).catch((res) => {
CommonApi.commonPost('/api/banquet/order/check', {
server_user_id: this.server_user_id
}).catch((res) => {
if (res.code === 1) {
this.matchedItems_sp = res.data.cart_list;
this.totalPrice = res.data.total_price;
this.pre_price = this.totalPrice>=1000?1000:this.totalPrice;
this.server_user.phone = res.data.server_user.certification.phone;
this.server_user.public_name = res.data.server_user.certification.public_name;
this.$refs.pagingRefSP?.complete(res.data);

View File

@ -400,9 +400,15 @@ export default defineComponent({
//
handleConfirm () {
if(this.set_num===0){
this.$u.toast('未添加购物车');
}else{
uni.navigateTo({
url: `/pages/banquet/combo/detail?id=${this.search.server_user_id}`
});
}
},
formatter (day) {