宴席2.0
This commit is contained in:
parent
5ba9a3eb76
commit
dfc54ea015
@ -1,5 +1,5 @@
|
||||
<style lang='scss'>
|
||||
.custom-count-down {
|
||||
.custom-count-down {
|
||||
display: inline-block;
|
||||
width: 22px;
|
||||
color: #ff3232;
|
||||
@ -7,15 +7,15 @@
|
||||
text-align: center;
|
||||
background-color: #ff404021;
|
||||
border-radius: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
.custom-count-down-colon {
|
||||
.custom-count-down-colon {
|
||||
display: inline-block;
|
||||
margin: 0 4px;
|
||||
color: #ff4040;
|
||||
}
|
||||
}
|
||||
|
||||
.cell-icon {
|
||||
.cell-icon {
|
||||
display: block;
|
||||
box-sizing: border-box;
|
||||
width: 16px;
|
||||
@ -23,7 +23,7 @@
|
||||
margin-right: 4px;
|
||||
background: url('https://img10.360buyimg.com/jmadvertisement/jfs/t1/71075/7/3762/1820/5d1f26d1E0d600b9e/a264c901943080ac.png') no-repeat;
|
||||
background-size: cover;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<view>
|
||||
@ -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 }}
|
||||
@ -147,7 +147,7 @@
|
||||
<view class="title font-size-32">
|
||||
<view>费用合计:</view>
|
||||
<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>
|
||||
</template>
|
||||
@ -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 { setToken, getToken, isLogin } from '@/utils/auth';
|
||||
const { colPickerData, findChildrenByCode } = useColPickerData()
|
||||
export default defineComponent({
|
||||
data () {
|
||||
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()
|
||||
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,35 +299,42 @@ 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) {
|
||||
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 () {
|
||||
created() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
close () {
|
||||
close() {
|
||||
this.propShowOrder = false;
|
||||
},
|
||||
//表单验证
|
||||
handleSubmit (reservation_type) {
|
||||
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);
|
||||
this.orderInfo.address = this.address_string + this.orderInfo.street_name;
|
||||
// console.log(this.orderInfo);
|
||||
this.addOrder();
|
||||
}
|
||||
})
|
||||
@ -313,7 +345,7 @@ export default defineComponent({
|
||||
},
|
||||
|
||||
//提交订单
|
||||
addOrder () {
|
||||
addOrder() {
|
||||
CommonApi.commonPost('/api/banquet/order/createOrder', this.orderInfo).catch((res) => {
|
||||
if (res.code === 1) {
|
||||
this.propShowOrder = true;
|
||||
@ -324,9 +356,11 @@ export default defineComponent({
|
||||
},
|
||||
|
||||
// 微信支付
|
||||
payOrder (order_id) {
|
||||
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);
|
||||
|
||||
@ -343,18 +377,22 @@ export default defineComponent({
|
||||
|
||||
},
|
||||
//获取地址
|
||||
getArea () {
|
||||
getArea() {
|
||||
this.area = [colPickerData.map(item => ({
|
||||
value: item.value,
|
||||
label: item.text
|
||||
}))];
|
||||
},
|
||||
//选择地址后--记录地址字符串
|
||||
handleConfirm (value) {
|
||||
handleConfirm(value) {
|
||||
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) {
|
||||
@ -371,7 +409,7 @@ export default defineComponent({
|
||||
}
|
||||
},
|
||||
//宴席类型
|
||||
getBanquetType () {
|
||||
getBanquetType() {
|
||||
CommonApi.commonGet('/api/banquet/dishes/banquetType').catch((res) => {
|
||||
if (res.code === 1) {
|
||||
|
||||
@ -386,11 +424,14 @@ export default defineComponent({
|
||||
});
|
||||
},
|
||||
// //购物车验证
|
||||
getCartCheck () {
|
||||
CommonApi.commonPost('/api/banquet/order/check', { server_user_id: this.server_user_id }).catch((res) => {
|
||||
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);
|
||||
@ -405,5 +446,5 @@ export default defineComponent({
|
||||
},
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user