宴席2.0
This commit is contained in:
parent
5ba9a3eb76
commit
dfc54ea015
@ -1,29 +1,29 @@
|
|||||||
<style lang='scss'>
|
<style lang='scss'>
|
||||||
.custom-count-down {
|
.custom-count-down {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 22px;
|
width: 22px;
|
||||||
color: #ff3232;
|
color: #ff3232;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
background-color: #ff404021;
|
background-color: #ff404021;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.custom-count-down-colon {
|
.custom-count-down-colon {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin: 0 4px;
|
margin: 0 4px;
|
||||||
color: #ff4040;
|
color: #ff4040;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cell-icon {
|
.cell-icon {
|
||||||
display: block;
|
display: block;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
width: 16px;
|
width: 16px;
|
||||||
height: 16px;
|
height: 16px;
|
||||||
margin-right: 4px;
|
margin-right: 4px;
|
||||||
background: url('https://img10.360buyimg.com/jmadvertisement/jfs/t1/71075/7/3762/1820/5d1f26d1E0d600b9e/a264c901943080ac.png') no-repeat;
|
background: url('https://img10.360buyimg.com/jmadvertisement/jfs/t1/71075/7/3762/1820/5d1f26d1E0d600b9e/a264c901943080ac.png') no-repeat;
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
@ -39,7 +39,7 @@
|
|||||||
<u-cell class="" style="line-height: 60rpx;" :border="true">
|
<u-cell class="" style="line-height: 60rpx;" :border="true">
|
||||||
<template #title>
|
<template #title>
|
||||||
<view class="h-50 p-2 align-center font-blod" @click="close">
|
<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>
|
||||||
<view class="h-50 p-2 align-center">
|
<view class="h-50 p-2 align-center">
|
||||||
剩余时间
|
剩余时间
|
||||||
@ -68,7 +68,7 @@
|
|||||||
</up-text>
|
</up-text>
|
||||||
<!-- <u-icon size="48rpx" slot="right" label-color="red" :label="`¥2000.00元`"></u-icon> -->
|
<!-- <u-icon size="48rpx" slot="right" label-color="red" :label="`¥2000.00元`"></u-icon> -->
|
||||||
<view style="display: inline-block; float:right">
|
<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>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
@ -93,7 +93,7 @@
|
|||||||
<!-- <text class="font-size-32 color-red font-bold ">¥213213.00元</text> -->
|
<!-- <text class="font-size-32 color-red font-bold ">¥213213.00元</text> -->
|
||||||
</view>
|
</view>
|
||||||
</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>做宴时段:{{ matchedItems[0].banquet_date }}</view>
|
||||||
<view class="title-tip font-size-28">
|
<view class="title-tip font-size-28">
|
||||||
做宴时段:{{ matchedItems[0].banquet_time }}
|
做宴时段:{{ matchedItems[0].banquet_time }}
|
||||||
@ -147,7 +147,7 @@
|
|||||||
<view class="title font-size-32">
|
<view class="title font-size-32">
|
||||||
<view>费用合计:</view>
|
<view>费用合计:</view>
|
||||||
<view class="title-tip ">
|
<view class="title-tip ">
|
||||||
<text class="font-size-32 font-bold color-red" >¥{{ totalPrice }}元</text>
|
<text class="font-size-32 font-bold color-red">¥{{ totalPrice }}元</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@ -187,9 +187,9 @@
|
|||||||
<wd-input label="联系电话" prop="phone" clearable v-model="orderInfo.phone" placeholder="请填写联系电话"
|
<wd-input label="联系电话" prop="phone" clearable v-model="orderInfo.phone" placeholder="请填写联系电话"
|
||||||
:rules="[{ required: false, pattern: /^1[3-9]\d{9}$/, message: '请输入有效手机号码' }]" />
|
:rules="[{ required: false, pattern: /^1[3-9]\d{9}$/, message: '请输入有效手机号码' }]" />
|
||||||
|
|
||||||
<wd-select-picker label="宴席类型" prop="banquet_type" v-model="orderInfo.banquet_type" :columns="banquetType"
|
<wd-select-picker label="宴席类型" prop="banquet_type" v-model="orderInfo.banquet_type" :columns="banquetType"
|
||||||
type="radio"
|
type="radio"
|
||||||
:rules="[
|
:rules="[
|
||||||
{
|
{
|
||||||
required: false,
|
required: false,
|
||||||
validator: (value: string) => {
|
validator: (value: string) => {
|
||||||
@ -197,10 +197,19 @@
|
|||||||
},
|
},
|
||||||
message: '请选择宴席类型'
|
message: '请选择宴席类型'
|
||||||
}
|
}
|
||||||
]"
|
]"></wd-select-picker>
|
||||||
></wd-select-picker>
|
|
||||||
|
|
||||||
<wd-col-picker label="做宴地址" v-model="orderInfo.district_name" prop="district_name" :columns="area"
|
|
||||||
|
<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="[
|
:column-change="columnChange" placeholder="请填写做宴地址" @confirm="handleConfirm" :rules="[
|
||||||
{
|
{
|
||||||
required: false,
|
required: false,
|
||||||
@ -215,6 +224,9 @@
|
|||||||
}
|
}
|
||||||
]"></wd-col-picker>
|
]"></wd-col-picker>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<wd-input label="详细地址" prop="street_name" clearable v-model="orderInfo.street_name" placeholder="请填写详细地址"
|
<wd-input label="详细地址" prop="street_name" clearable v-model="orderInfo.street_name" placeholder="请填写详细地址"
|
||||||
:rules="[
|
:rules="[
|
||||||
{
|
{
|
||||||
@ -226,7 +238,7 @@
|
|||||||
}
|
}
|
||||||
]" />
|
]" />
|
||||||
<wd-textarea label="备注" auto-height v-model="orderInfo.remark" placeholder="请填写备注" />
|
<wd-textarea label="备注" auto-height v-model="orderInfo.remark" placeholder="请填写备注" />
|
||||||
<view class="pb-4" />
|
<view class="pb-4" />
|
||||||
<wd-button plain hairline custom-style="width: calc(100vw - 100rpx);"
|
<wd-button plain hairline custom-style="width: calc(100vw - 100rpx);"
|
||||||
@click="handleSubmit(1)">确定预定(做席后再支付)</wd-button>
|
@click="handleSubmit(1)">确定预定(做席后再支付)</wd-button>
|
||||||
<wd-button hairline custom-style="width: calc(100vw - 100rpx);" @click="handleSubmit(1)">付定金锁定订单</wd-button>
|
<wd-button hairline custom-style="width: calc(100vw - 100rpx);" @click="handleSubmit(1)">付定金锁定订单</wd-button>
|
||||||
@ -243,167 +255,196 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { useColPickerData, useModal } from '@/hooks'
|
import {
|
||||||
import { defineComponent } from "vue";
|
useColPickerData,
|
||||||
import { CommonApi, UserApi } from "@/api";
|
useModal
|
||||||
// import { setToken, getToken, isLogin } from '@/utils/auth';
|
} from '@/hooks'
|
||||||
const { colPickerData, findChildrenByCode } = useColPickerData()
|
import {
|
||||||
export default defineComponent({
|
defineComponent
|
||||||
data () {
|
} from "vue";
|
||||||
return {
|
import {
|
||||||
totalPrice: 0,
|
CommonApi,
|
||||||
server_user: {
|
UserApi
|
||||||
phone: '',
|
} from "@/api";
|
||||||
public_name: '',
|
// import { setToken, getToken, isLogin } from '@/utils/auth';
|
||||||
},
|
const {
|
||||||
server_user_id: 0,
|
colPickerData,
|
||||||
|
findChildrenByCode
|
||||||
address_string: '',
|
} = useColPickerData()
|
||||||
banquetType: this.getBanquetType(),
|
export default defineComponent({
|
||||||
propShowOrder: false,
|
data() {
|
||||||
area: [],
|
return {
|
||||||
value: [],
|
totalPrice: 0,
|
||||||
orderInfo: {
|
pre_price: 0,
|
||||||
district_name: [],
|
server_user: {
|
||||||
street_name: '',
|
phone: '',
|
||||||
// cart_ids: [], 酒店
|
public_name: '',
|
||||||
customer_name: '',
|
},
|
||||||
phone: '',
|
|
||||||
address: '',
|
|
||||||
remark: '',
|
|
||||||
banquet_type: '1',
|
|
||||||
reservation_type: 1,
|
|
||||||
server_user_id: 0,
|
server_user_id: 0,
|
||||||
// table_number: 0, 酒店
|
|
||||||
// banquet_date: '', 酒店
|
address_string: '',
|
||||||
|
banquetType: this.getBanquetType(),
|
||||||
|
propShowOrder: false,
|
||||||
|
area: [],
|
||||||
|
value: [],
|
||||||
|
order_type: 1, //厨师 2 酒店
|
||||||
|
orderInfo: {
|
||||||
|
district_name: [],
|
||||||
|
street_name: '',
|
||||||
|
cart_ids: 0, //酒店
|
||||||
|
customer_name: '',
|
||||||
|
phone: '',
|
||||||
|
address: '',
|
||||||
|
remark: '',
|
||||||
|
banquet_type: '1',
|
||||||
|
reservation_type: 1,
|
||||||
|
server_user_id: 0,
|
||||||
|
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()
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
close() {
|
||||||
|
this.propShowOrder = false;
|
||||||
},
|
},
|
||||||
matchedItems_sp: [],
|
//表单验证
|
||||||
|
handleSubmit(reservation_type) {
|
||||||
};
|
|
||||||
},
|
|
||||||
onLoad (option) {
|
|
||||||
this.server_user_id = option.id;;
|
|
||||||
this.orderInfo.server_user_id = option.id;
|
|
||||||
this.getCartCheck()
|
|
||||||
this.getArea()
|
|
||||||
},
|
|
||||||
created () {
|
|
||||||
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
close () {
|
|
||||||
this.propShowOrder = false;
|
|
||||||
},
|
|
||||||
//表单验证
|
|
||||||
handleSubmit (reservation_type) {
|
|
||||||
// console.log(this.orderInfo);
|
|
||||||
this.orderInfo.reservation_type = reservation_type; //付款类型
|
|
||||||
this.$refs.form.validate()
|
|
||||||
.then(({ valid, errors }) => {
|
|
||||||
if (valid) {
|
|
||||||
this.orderInfo.address = this.address_string+this.orderInfo.street_name;
|
|
||||||
console.log(this.orderInfo);
|
|
||||||
this.addOrder();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
console.log(error, 'error')
|
|
||||||
})
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
//提交订单
|
|
||||||
addOrder () {
|
|
||||||
CommonApi.commonPost('/api/banquet/order/createOrder', this.orderInfo).catch((res) => {
|
|
||||||
if (res.code === 1) {
|
|
||||||
this.propShowOrder = true;
|
|
||||||
} else {
|
|
||||||
uni.$u.toast(res.msg);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
// 微信支付
|
|
||||||
payOrder (order_id) {
|
|
||||||
|
|
||||||
CommonApi.commonPost('/api/banquet/order/pay', {order_id:order_id}).catch((res) => {
|
|
||||||
if (res.code === 1) {
|
|
||||||
// this.payOrder(res.data.order_id);
|
|
||||||
|
|
||||||
// this.propShowOrder = true;
|
// this.propShowOrder = true;
|
||||||
|
// console.log(this.orderInfo);
|
||||||
|
this.orderInfo.reservation_type = reservation_type; //付款类型
|
||||||
|
this.$refs.form.validate()
|
||||||
|
.then(({
|
||||||
|
valid,
|
||||||
|
errors
|
||||||
|
}) => {
|
||||||
|
if (valid) {
|
||||||
|
this.orderInfo.address = this.address_string + this.orderInfo.street_name;
|
||||||
|
// console.log(this.orderInfo);
|
||||||
|
this.addOrder();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.log(error, 'error')
|
||||||
|
})
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
//提交订单
|
||||||
|
addOrder() {
|
||||||
|
CommonApi.commonPost('/api/banquet/order/createOrder', this.orderInfo).catch((res) => {
|
||||||
|
if (res.code === 1) {
|
||||||
|
this.propShowOrder = true;
|
||||||
|
} else {
|
||||||
|
uni.$u.toast(res.msg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
// 微信支付
|
||||||
|
payOrder(order_id) {
|
||||||
|
|
||||||
|
CommonApi.commonPost('/api/banquet/order/pay', {
|
||||||
|
order_id: order_id
|
||||||
|
}).catch((res) => {
|
||||||
|
if (res.code === 1) {
|
||||||
|
// this.payOrder(res.data.order_id);
|
||||||
|
|
||||||
|
// this.propShowOrder = true;
|
||||||
|
|
||||||
console.log(res.data);
|
console.log(res.data);
|
||||||
// this.close();
|
// this.close();
|
||||||
} else {
|
} else {
|
||||||
uni.$u.toast(res.msg);
|
uni.$u.toast(res.msg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
//获取地址
|
||||||
|
getArea() {
|
||||||
|
this.area = [colPickerData.map(item => ({
|
||||||
|
value: item.value,
|
||||||
|
label: item.text
|
||||||
|
}))];
|
||||||
|
},
|
||||||
|
//选择地址后--记录地址字符串
|
||||||
|
handleConfirm(value) {
|
||||||
|
this.address_string = value.selectedItems.map(item => item.label).join('')
|
||||||
|
},
|
||||||
|
//地址改版事件
|
||||||
|
columnChange({
|
||||||
|
selectedItem,
|
||||||
|
resolve,
|
||||||
|
finish
|
||||||
|
}) {
|
||||||
|
try {
|
||||||
|
const areaData = findChildrenByCode(colPickerData, selectedItem.value);
|
||||||
|
if (areaData && areaData.length) {
|
||||||
|
resolve(areaData.map(item => ({
|
||||||
|
value: item.value,
|
||||||
|
label: item.text
|
||||||
|
})));
|
||||||
|
} else {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('处理列变更时出错:', error);
|
||||||
|
finish(); // 确保在发生错误时也能完成操作以避免卡顿
|
||||||
}
|
}
|
||||||
});
|
},
|
||||||
|
//宴席类型
|
||||||
|
getBanquetType() {
|
||||||
|
CommonApi.commonGet('/api/banquet/dishes/banquetType').catch((res) => {
|
||||||
|
if (res.code === 1) {
|
||||||
|
|
||||||
|
res.data.forEach(item => {
|
||||||
|
item.label = item.name;
|
||||||
|
|
||||||
|
});
|
||||||
|
this.banquetType = res.data;
|
||||||
|
} else {
|
||||||
|
uni.$u.toast(res.msg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// //购物车验证
|
||||||
|
getCartCheck() {
|
||||||
|
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);
|
||||||
|
// console.log(res);
|
||||||
|
} else {
|
||||||
|
uni.$u.toast(res.msg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
//获取地址
|
|
||||||
getArea () {
|
|
||||||
this.area = [colPickerData.map(item => ({
|
|
||||||
value: item.value,
|
|
||||||
label: item.text
|
|
||||||
}))];
|
|
||||||
},
|
|
||||||
//选择地址后--记录地址字符串
|
|
||||||
handleConfirm (value) {
|
|
||||||
this.address_string = value.selectedItems.map(item => item.label).join('')
|
|
||||||
},
|
|
||||||
//地址改版事件
|
|
||||||
columnChange ({ selectedItem, resolve, finish }) {
|
|
||||||
try {
|
|
||||||
const areaData = findChildrenByCode(colPickerData, selectedItem.value);
|
|
||||||
if (areaData && areaData.length) {
|
|
||||||
resolve(areaData.map(item => ({
|
|
||||||
value: item.value,
|
|
||||||
label: item.text
|
|
||||||
})));
|
|
||||||
} else {
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error('处理列变更时出错:', error);
|
|
||||||
finish(); // 确保在发生错误时也能完成操作以避免卡顿
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//宴席类型
|
|
||||||
getBanquetType () {
|
|
||||||
CommonApi.commonGet('/api/banquet/dishes/banquetType').catch((res) => {
|
|
||||||
if (res.code === 1) {
|
|
||||||
|
|
||||||
res.data.forEach(item => {
|
|
||||||
item.label = item.name;
|
|
||||||
|
|
||||||
});
|
|
||||||
this.banquetType = res.data;
|
|
||||||
} else {
|
|
||||||
uni.$u.toast(res.msg);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
// //购物车验证
|
|
||||||
getCartCheck () {
|
|
||||||
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.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);
|
|
||||||
// console.log(res);
|
|
||||||
} else {
|
|
||||||
uni.$u.toast(res.msg);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
},
|
});
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
@ -400,9 +400,15 @@ export default defineComponent({
|
|||||||
|
|
||||||
//提交订单
|
//提交订单
|
||||||
handleConfirm () {
|
handleConfirm () {
|
||||||
uni.navigateTo({
|
|
||||||
url: `/pages/banquet/combo/detail?id=${this.search.server_user_id}`
|
if(this.set_num===0){
|
||||||
});
|
this.$u.toast('未添加购物车');
|
||||||
|
}else{
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages/banquet/combo/detail?id=${this.search.server_user_id}`
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
formatter (day) {
|
formatter (day) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user