commit
d8ce026f1d
@ -111,9 +111,12 @@
|
||||
},
|
||||
"needLogin": true
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
|
||||
|
||||
|
||||
=======
|
||||
>>>>>>> 6e2f3666d3e85e49f3f8dd0aef942f01cb3f8e2b
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -39,7 +39,8 @@
|
||||
<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="`${pre_price}`" 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">
|
||||
剩余时间
|
||||
@ -142,9 +143,10 @@
|
||||
<template #title>
|
||||
<view class="title font-size-32">
|
||||
<view>费用合计:</view>
|
||||
<view class="title-tip " >
|
||||
<view class="title-tip ">
|
||||
<text v-if="oder_type===1" class="font-size-32 font-bold color-red">¥{{ totalPrice }}元</text>
|
||||
<text v-else class="font-size-32 font-bold color-red">¥{{ matchedItems_sp[0][0].dishes.price *orderInfo.table_number }}元</text>
|
||||
<text v-else
|
||||
class="font-size-32 font-bold color-red">¥{{ matchedItems_sp[0][0].dishes.price *orderInfo.table_number }}元</text>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
@ -186,8 +188,7 @@
|
||||
:rules="[{ required: false, pattern: /^1[3-9]\d{9}$/, message: '请输入有效手机号码' }]" />
|
||||
|
||||
<wd-select-picker label="宴席类型" prop="banquet_type" v-model="orderInfo.banquet_type" :columns="banquetType"
|
||||
type="radio"
|
||||
:rules="[
|
||||
type="radio" :rules="[
|
||||
{
|
||||
required: false,
|
||||
validator: (value: string) => {
|
||||
@ -196,18 +197,15 @@
|
||||
message: '请选择宴席类型'
|
||||
}
|
||||
]"></wd-select-picker>
|
||||
<wd-input v-if="order_type===2" label="做宴日期" placeholder="请选择日期" prop="banquet_date"
|
||||
v-model="orderInfo.banquet_date" readonly @click="showDatePicker = true" />
|
||||
|
||||
|
||||
<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
|
||||
<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"
|
||||
<wd-col-picker label="做宴地址" v-model="orderInfo.district_name" prop="district_name" :columns="area"
|
||||
:column-change="columnChange" placeholder="请填写做宴地址" @confirm="handleConfirm" :rules="[
|
||||
{
|
||||
required: false,
|
||||
@ -244,6 +242,8 @@
|
||||
<!-- <wd-button size="small" plain>查看详情</wd-button> -->
|
||||
</template>
|
||||
</wd-card>
|
||||
<up-calendar :show="showDatePicker" showLunar @confirm="pickDate"
|
||||
@close="showDatePicker = false" closeOnClickOverlay></up-calendar>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@ -296,7 +296,8 @@
|
||||
banquet_date: '', //酒店
|
||||
},
|
||||
matchedItems_sp: [],
|
||||
};
|
||||
showDatePicker: false
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
this.server_user_id = option.id;;
|
||||
@ -307,11 +308,12 @@
|
||||
this.orderInfo.server_user_id = option.id;
|
||||
this.getCartCheck()
|
||||
this.getArea()
|
||||
},
|
||||
created() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
pickDate(e) {
|
||||
this.orderInfo.banquet_date = e[0]
|
||||
this.showDatePicker = false
|
||||
},
|
||||
close() {
|
||||
this.propShowOrder = false;
|
||||
},
|
||||
@ -331,7 +333,6 @@
|
||||
.catch((error) => {
|
||||
console.log(error, 'error')
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
//提交订单
|
||||
@ -350,36 +351,30 @@
|
||||
|
||||
// 微信支付
|
||||
payOrder() {
|
||||
|
||||
CommonApi.commonPost('/api/banquet/order/pay', {
|
||||
order_id: this.order_id
|
||||
}).catch((res) => {
|
||||
if (res.code === 1) {
|
||||
wx.requestPayment({
|
||||
"timeStamp": res.data.timeStamp,
|
||||
"nonceStr": res.data.nonceStr,
|
||||
"package": res.data.package,
|
||||
"signType": res.data.signType,
|
||||
"paySign": res.data.paySign,
|
||||
"success": function (res) {
|
||||
console.log('success:' + JSON.stringify(res));
|
||||
},
|
||||
"fail": function (err) {
|
||||
console.log('fail:' + JSON.stringify(err));
|
||||
},
|
||||
"complete": function (res) {
|
||||
console.log('complete:' + JSON.stringify(res));
|
||||
}
|
||||
})
|
||||
console.log(res.data);
|
||||
// this.close();
|
||||
wx.requestPayment({
|
||||
"timeStamp": res.data.timeStamp,
|
||||
"nonceStr": res.data.nonceStr,
|
||||
"package": res.data.package,
|
||||
"signType": res.data.signType,
|
||||
"paySign": res.data.paySign,
|
||||
"success": function (res) {
|
||||
console.log('success:' + JSON.stringify(res));
|
||||
},
|
||||
"fail": function (err) {
|
||||
console.log('fail:' + JSON.stringify(err));
|
||||
},
|
||||
"complete": function (res) {
|
||||
console.log('complete:' + JSON.stringify(res));
|
||||
}
|
||||
})
|
||||
} else {
|
||||
uni.$u.toast(res.msg);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
},
|
||||
//获取地址
|
||||
getArea() {
|
||||
@ -430,13 +425,18 @@
|
||||
},
|
||||
// //购物车验证
|
||||
getCartCheck() {
|
||||
CommonApi.commonPost('/api/banquet/order/check', {
|
||||
server_user_id: this.server_user_id
|
||||
}).catch((res) => {
|
||||
let query = {
|
||||
server_user_id: this.server_user_id,
|
||||
cart_ids: 0
|
||||
}
|
||||
if (this.order_type == 2 && this.orderInfo.cart_ids > 0) {
|
||||
query.cart_ids = this.orderInfo.cart_ids
|
||||
}
|
||||
CommonApi.commonPost('/api/banquet/order/check', query).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.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);
|
||||
|
@ -1,8 +1,8 @@
|
||||
<style lang='scss'>
|
||||
html,
|
||||
body {
|
||||
height: 0px;
|
||||
}
|
||||
html,
|
||||
body {
|
||||
height: 0px;
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<view>
|
||||
@ -21,9 +21,8 @@ body {
|
||||
<scroll-view style="height: 1000rpx;" scroll-y="true">
|
||||
<u-alert :show-icon="true" title="温馨提示:确定前请检查日期时间段" type="" effect="dark" description=" "></u-alert>
|
||||
<view class="pb-4" />
|
||||
<wd-calendar label="做宴日期" placeholder="请选择日期" prop="date" :formatter="formatter" :min-date="min_data"
|
||||
v-model="orderInfo.date" :rules="[{ required: false, pattern: /^\d{13}$/, message: '请选择日期' }]"
|
||||
@confirm="handleTimeConfirm" />
|
||||
<wd-input label="做宴日期" placeholder="请选择日期" prop="date"
|
||||
v-model="orderInfo.date" readonly @click="showDatePicker = true" />
|
||||
<wd-select-picker label="做宴时段" v-model="orderInfo.columns" :columns="columns"
|
||||
type="radio"></wd-select-picker>
|
||||
|
||||
@ -53,8 +52,6 @@ body {
|
||||
searchIconColor="#909399" color="#606266" placeholderColor="#909399" searchIcon="search" margin="10rpx"
|
||||
maxlength="-1" height="60rpx" @change="searchSP()">
|
||||
</up-search>
|
||||
<!-- <view style="width: calc(100vw - 180rpx);display: inline-block;"> -->
|
||||
<!-- <view > -->
|
||||
<wd-tabs v-model="currentTab" @change="handleChange" auto-line-width color="#59CB56" lineWidth="80rpx">
|
||||
<block v-for="(item, index) in menu_list" :key="item">
|
||||
<wd-tab :title="`第${index + 1}餐`" :name="index" setActive="item.name"
|
||||
@ -140,480 +137,452 @@ body {
|
||||
<up-button class="" style="" text="选好了" type="primary" color="#59CB56" shape="circle" size="small"
|
||||
custom-style="width:200rpx;float:right;margin-right:0rpx;" @click="handleConfirm" />
|
||||
</view>
|
||||
<up-calendar :show="showDatePicker" showLunar @confirm="pickDate"
|
||||
@close="showDatePicker = false" closeOnClickOverlay></up-calendar>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
// useColPickerData可以参考本章节顶部的介绍
|
||||
// 导入路径根据自己实际情况调整,万不可一贴了之
|
||||
// useColPickerData可以参考本章节顶部的介绍
|
||||
// 导入路径根据自己实际情况调整,万不可一贴了之
|
||||
|
||||
import { useColPickerData, useModal } from '@/hooks'
|
||||
import { useColPickerData, useModal } from '@/hooks'
|
||||
|
||||
import { defineComponent } from "vue";
|
||||
import { CommonApi, UserApi } from "@/api";
|
||||
import { get } from 'http';
|
||||
// import { badgeProps } from '@/uni_modules/wot-design-uni/components/wd-badge/types';
|
||||
// import { setToken, getToken, isLogin } from '@/utils/auth';
|
||||
// const { colPickerData, findChildrenByCode } = useColPickerData()
|
||||
import { defineComponent } from "vue";
|
||||
import { CommonApi, UserApi } from "@/api";
|
||||
import { get } from 'http';
|
||||
// import { badgeProps } from '@/uni_modules/wot-design-uni/components/wd-badge/types';
|
||||
// import { setToken, getToken, isLogin } from '@/utils/auth';
|
||||
// const { colPickerData, findChildrenByCode } = useColPickerData()
|
||||
|
||||
export default defineComponent({
|
||||
data () {
|
||||
return {
|
||||
badgeProps: {
|
||||
title: '普通数值',
|
||||
export default defineComponent({
|
||||
data() {
|
||||
return {
|
||||
showDatePicker: false,
|
||||
badgeProps: {
|
||||
modelValue: 10,
|
||||
right: '-8px'
|
||||
}
|
||||
}, // 徽标
|
||||
search: {
|
||||
category_id: '',
|
||||
keyword: '',
|
||||
server_user_id: 0,
|
||||
index: 0, //第几餐
|
||||
page: 1,
|
||||
limit: 10,
|
||||
},
|
||||
tpl: '确定前检查日期时间段',
|
||||
propShowOrder: false,
|
||||
set_num: 0, //设置餐标数量
|
||||
value: [],
|
||||
totalNum: 0,
|
||||
orderInfo: {
|
||||
id: 0,
|
||||
is_set: 0,
|
||||
date: [],
|
||||
columns: '早上',
|
||||
number: 1,
|
||||
},
|
||||
newOrderInfo: {
|
||||
id: 0,
|
||||
is_set: 0,
|
||||
date: [],
|
||||
columns: '早上',
|
||||
number: 1,
|
||||
title: '普通数值',
|
||||
badgeProps: {
|
||||
modelValue: 10,
|
||||
right: '-8px'
|
||||
}
|
||||
}, // 徽标
|
||||
search: {
|
||||
category_id: '',
|
||||
keyword: '',
|
||||
server_user_id: 0,
|
||||
index: 0, //第几餐
|
||||
page: 1,
|
||||
limit: 10,
|
||||
},
|
||||
tpl: '确定前检查日期时间段',
|
||||
propShowOrder: false,
|
||||
set_num: 0, //设置餐标数量
|
||||
value: [],
|
||||
totalNum: 0,
|
||||
orderInfo: {
|
||||
id: 0,
|
||||
is_set: 0,
|
||||
date: '',
|
||||
columns: '早上',
|
||||
number: 1,
|
||||
},
|
||||
newOrderInfo: {
|
||||
id: 0,
|
||||
is_set: 0,
|
||||
date: '',
|
||||
columns: '早上',
|
||||
number: 1,
|
||||
|
||||
},
|
||||
totalPrice: 0,
|
||||
currentTab: 0, // tab索引
|
||||
min_data: new Date().getTime(),
|
||||
isDisabledDate: [1754755200000, 1754755200000],
|
||||
// time_list: [],
|
||||
menu_name: '第1餐',
|
||||
menu_list: [
|
||||
{
|
||||
name: '第1餐', orderInfo: {
|
||||
id: 0,
|
||||
is_set: 0,
|
||||
date: [],
|
||||
columns: '早上',
|
||||
number: 1,
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '第1餐', orderInfo: {
|
||||
id: 0,
|
||||
is_set: 0,
|
||||
date: [],
|
||||
columns: '早上',
|
||||
number: 1,
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '第1餐', orderInfo: {
|
||||
id: 0,
|
||||
is_set: 0,
|
||||
date: [],
|
||||
columns: '早上',
|
||||
number: 1,
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '第1餐', orderInfo: {
|
||||
id: 0,
|
||||
is_set: 0,
|
||||
date: [],
|
||||
columns: '早上',
|
||||
number: 1,
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '第1餐', orderInfo: {
|
||||
id: 0,
|
||||
is_set: 0,
|
||||
date: [],
|
||||
columns: '早上',
|
||||
number: 1,
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '第1餐', orderInfo: {
|
||||
id: 0,
|
||||
is_set: 0,
|
||||
date: [],
|
||||
columns: '早上',
|
||||
number: 1,
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '第1餐', orderInfo: {
|
||||
id: 0,
|
||||
is_set: 0,
|
||||
date: [],
|
||||
columns: '早上',
|
||||
number: 1,
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '第1餐', orderInfo: {
|
||||
id: 0,
|
||||
is_set: 0,
|
||||
date: [],
|
||||
columns: '早上',
|
||||
number: 1,
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '第1餐', orderInfo: {
|
||||
id: 0,
|
||||
is_set: 0,
|
||||
date: [],
|
||||
columns: '早上',
|
||||
number: 1,
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '第1餐', orderInfo: {
|
||||
id: 0,
|
||||
is_set: 0,
|
||||
date: [],
|
||||
columns: '早上',
|
||||
number: 1,
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '第1餐', orderInfo: {
|
||||
id: 0,
|
||||
is_set: 0,
|
||||
date: [],
|
||||
columns: '早上',
|
||||
number: 1,
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '第1餐', orderInfo: {
|
||||
id: 0,
|
||||
is_set: 0,
|
||||
date: [],
|
||||
columns: '早上',
|
||||
number: 1,
|
||||
}
|
||||
},
|
||||
],
|
||||
columns: [{ value: '早上', label: '早上' }, { value: '中午', label: '中午' }, { value: '晚上', label: '晚上' }],
|
||||
// keyword_sp: '',
|
||||
// categoryIndex: 0,
|
||||
childrenIndex: 0,
|
||||
// categoryList: [],
|
||||
tabList: [],
|
||||
good_list: [],
|
||||
matchedItems_sp: [],
|
||||
|
||||
};
|
||||
},
|
||||
onLoad (option) {
|
||||
// console.log(option);
|
||||
this.search.server_user_id = option.id;
|
||||
this.getCategoryList()
|
||||
|
||||
|
||||
},
|
||||
created () {
|
||||
|
||||
},
|
||||
methods: {
|
||||
addGoods () {
|
||||
// 插入数组
|
||||
var new_menu_name = '第' + parseInt(this.menu_list.length + 1) + '餐';
|
||||
this.menu_list.push({ name: new_menu_name, orderInfo: this.newOrderInfo });
|
||||
},
|
||||
|
||||
delGoods () {
|
||||
if (this.menu_list.length === 1) {
|
||||
return uni.$u.toast('至少要保留一个餐项');
|
||||
}
|
||||
useModal().showModal('success', {
|
||||
title: '删除提示',
|
||||
content: '确定删除' + this.menu_name + '吗?',
|
||||
showCancel: true,
|
||||
confirmText: '确定',
|
||||
cancelText: '取消',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
// 删除数组
|
||||
const index = this.currentTab; // 假设 currentTab 是您想要删除的餐项的索引
|
||||
if (index !== undefined && index >= 0 && index < this.menu_list.length) {
|
||||
this.menu_list.splice(index, 1);
|
||||
totalPrice: 0,
|
||||
currentTab: 0, // tab索引
|
||||
min_data: new Date().getTime(),
|
||||
isDisabledDate: [1754755200000, 1754755200000],
|
||||
// time_list: [],
|
||||
menu_name: '第1餐',
|
||||
menu_list: [
|
||||
{
|
||||
name: '第1餐', orderInfo: {
|
||||
id: 0,
|
||||
is_set: 0,
|
||||
date: '',
|
||||
columns: '早上',
|
||||
number: 1,
|
||||
}
|
||||
}
|
||||
else if (res.cancel) {
|
||||
// console.log('用户点击取消');
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
},
|
||||
{
|
||||
name: '第1餐', orderInfo: {
|
||||
id: 0,
|
||||
is_set: 0,
|
||||
date: '',
|
||||
columns: '早上',
|
||||
number: 1,
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '第1餐', orderInfo: {
|
||||
id: 0,
|
||||
is_set: 0,
|
||||
date: '',
|
||||
columns: '早上',
|
||||
number: 1,
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '第1餐', orderInfo: {
|
||||
id: 0,
|
||||
is_set: 0,
|
||||
date: '',
|
||||
columns: '早上',
|
||||
number: 1,
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '第1餐', orderInfo: {
|
||||
id: 0,
|
||||
is_set: 0,
|
||||
date: '',
|
||||
columns: '早上',
|
||||
number: 1,
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '第1餐', orderInfo: {
|
||||
id: 0,
|
||||
is_set: 0,
|
||||
date: '',
|
||||
columns: '早上',
|
||||
number: 1,
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '第1餐', orderInfo: {
|
||||
id: 0,
|
||||
is_set: 0,
|
||||
date: '',
|
||||
columns: '早上',
|
||||
number: 1,
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '第1餐', orderInfo: {
|
||||
id: 0,
|
||||
is_set: 0,
|
||||
date: '',
|
||||
columns: '早上',
|
||||
number: 1,
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '第1餐', orderInfo: {
|
||||
id: 0,
|
||||
is_set: 0,
|
||||
date: '',
|
||||
columns: '早上',
|
||||
number: 1,
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '第1餐', orderInfo: {
|
||||
id: 0,
|
||||
is_set: 0,
|
||||
date: '',
|
||||
columns: '早上',
|
||||
number: 1,
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '第1餐', orderInfo: {
|
||||
id: 0,
|
||||
is_set: 0,
|
||||
date: '',
|
||||
columns: '早上',
|
||||
number: 1,
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '第1餐', orderInfo: {
|
||||
id: 0,
|
||||
is_set: 0,
|
||||
date: '',
|
||||
columns: '早上',
|
||||
number: 1,
|
||||
}
|
||||
},
|
||||
],
|
||||
columns: [{ value: '早上', label: '早上' }, { value: '中午', label: '中午' }, { value: '晚上', label: '晚上' }],
|
||||
childrenIndex: 0,
|
||||
tabList: [],
|
||||
good_list: [],
|
||||
matchedItems_sp: [],
|
||||
|
||||
};
|
||||
},
|
||||
//切换餐次
|
||||
handleChange () {
|
||||
this.$nextTick(() => {
|
||||
this.handleClickCategory(this.currentTab)
|
||||
this.menu_name = this.menu_list[this.currentTab].name; // 更新 menu_name
|
||||
this.searchSP()
|
||||
// this.orderInfo = this.menu_list[this.currentTab].orderInfo; // 更新 orderInfo
|
||||
});
|
||||
onLoad(option) {
|
||||
this.search.server_user_id = option.id;
|
||||
this.getCategoryList()
|
||||
},
|
||||
|
||||
//确认当餐信息
|
||||
addOrder () {
|
||||
this.$refs.form.validate()
|
||||
.then(({ valid, errors }) => {
|
||||
if (valid) {
|
||||
this.menu_list[this.currentTab].is_set = 1;
|
||||
this.menu_list[this.currentTab].orderInfo = this.orderInfo;
|
||||
this.editCart()
|
||||
// this.menu_list[this.currentTab].orderInfo.columns = this.columns[this.currentTab].value;
|
||||
this.close();
|
||||
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error, 'error')
|
||||
})
|
||||
},
|
||||
close () {
|
||||
this.propShowOrder = false;
|
||||
},
|
||||
handleSubmit () {
|
||||
this.propShowOrder = true;
|
||||
},
|
||||
|
||||
//提交订单
|
||||
handleConfirm () {
|
||||
|
||||
if(this.set_num===0){
|
||||
this.$u.toast('未添加购物车');
|
||||
}else{
|
||||
uni.navigateTo({
|
||||
url: `/pages/banquet/combo/detail?id=${this.search.server_user_id}`
|
||||
methods: {
|
||||
pickDate(e) {
|
||||
this.orderInfo.date = e[0]
|
||||
this.showDatePicker = false
|
||||
},
|
||||
addGoods() {
|
||||
// 插入数组
|
||||
var new_menu_name = '第' + parseInt(this.menu_list.length + 1) + '餐';
|
||||
this.menu_list.push({ name: new_menu_name, orderInfo: this.newOrderInfo });
|
||||
},
|
||||
delGoods() {
|
||||
if (this.menu_list.length === 1) {
|
||||
return uni.$u.toast('至少要保留一个餐项');
|
||||
}
|
||||
useModal().showModal('success', {
|
||||
title: '删除提示',
|
||||
content: '确定删除' + this.menu_name + '吗?',
|
||||
showCancel: true,
|
||||
confirmText: '确定',
|
||||
cancelText: '取消',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
// 删除数组
|
||||
const index = this.currentTab; // 假设 currentTab 是您想要删除的餐项的索引
|
||||
if (index !== undefined && index >= 0 && index < this.menu_list.length) {
|
||||
this.menu_list.splice(index, 1);
|
||||
}
|
||||
}
|
||||
else if (res.cancel) {
|
||||
// console.log('用户点击取消');
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
//切换餐次
|
||||
handleChange() {
|
||||
this.$nextTick(() => {
|
||||
this.handleClickCategory(this.currentTab)
|
||||
this.menu_name = this.menu_list[this.currentTab].name; // 更新 menu_name
|
||||
this.searchSP()
|
||||
// this.orderInfo = this.menu_list[this.currentTab].orderInfo; // 更新 orderInfo
|
||||
});
|
||||
},
|
||||
|
||||
},
|
||||
//确认当餐信息
|
||||
addOrder() {
|
||||
this.$refs.form.validate()
|
||||
.then(({ valid, errors }) => {
|
||||
if (valid) {
|
||||
this.menu_list[this.currentTab].is_set = 1;
|
||||
this.menu_list[this.currentTab].orderInfo = this.orderInfo;
|
||||
this.editCart()
|
||||
// this.menu_list[this.currentTab].orderInfo.columns = this.columns[this.currentTab].value;
|
||||
this.close();
|
||||
|
||||
formatter (day) {
|
||||
const date = new Date(day.date)
|
||||
const now = new Date()
|
||||
const year = date.getFullYear()
|
||||
const month = date.getMonth()
|
||||
const da = date.getDate()
|
||||
const nowYear = now.getFullYear()
|
||||
const nowMonth = now.getMonth()
|
||||
const nowDa = now.getDate()
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error, 'error')
|
||||
})
|
||||
},
|
||||
close() {
|
||||
this.propShowOrder = false;
|
||||
},
|
||||
handleSubmit() {
|
||||
this.propShowOrder = true;
|
||||
},
|
||||
|
||||
if (year === nowYear && month === nowMonth && da === nowDa) {
|
||||
day.topInfo = '今天'
|
||||
}
|
||||
// const disabledDates = ['2025-08-05', '2023-08-15'];
|
||||
// const formattedDate = `${year}-${month}-${da}`;
|
||||
if (this.isDisabledDate.includes(day.date)) {
|
||||
day.topInfo = '已预定';
|
||||
day.disabled = true; // 禁用日期
|
||||
day.disabled_class = 'disabled-date'; // 添加自定义样式类
|
||||
}
|
||||
return day
|
||||
},
|
||||
//提交订单
|
||||
handleConfirm() {
|
||||
|
||||
handleTimeConfirm (res) {
|
||||
// console.log(res.value)
|
||||
this.orderInfo.date = res.value
|
||||
|
||||
},
|
||||
|
||||
//分类切换
|
||||
handleClickCategory (index: number) {
|
||||
this.getCategoryList();
|
||||
|
||||
},
|
||||
handleChildrenClick (index: number) {
|
||||
this.childrenIndex = index;
|
||||
this.$refs.pagingRefSP?.reload();
|
||||
},
|
||||
//购物车验证
|
||||
getCartCheck () {
|
||||
CommonApi.commonPost('/api/banquet/order/check', { server_user_id: this.search.server_user_id }).catch((res) => {
|
||||
var num = 0;
|
||||
// var index = -1;
|
||||
var is_set_cart = 0;
|
||||
var newCartList = [];
|
||||
this.set_num = 0;
|
||||
|
||||
for (let val in this.menu_list) { //遍历购物车
|
||||
this.menu_list[val].orderInfo.is_set = 0;
|
||||
if (this.set_num === 0) {
|
||||
this.$u.toast('未添加购物车');
|
||||
} else {
|
||||
uni.navigateTo({
|
||||
url: `/pages/banquet/combo/detail?id=${this.search.server_user_id}`
|
||||
});
|
||||
}
|
||||
//更新购物车餐标--获取已填数据
|
||||
if (res.code === 1) {
|
||||
for (let val in res.data.cart_list) {
|
||||
num++;
|
||||
// index++;
|
||||
is_set_cart = res.data.cart_list[val][0].banquet_date ? 1 : 0; // 餐标已设置 日期
|
||||
if (is_set_cart) {
|
||||
this.set_num += 1;
|
||||
}
|
||||
|
||||
this.menu_list[res.data.cart_list[val][0].index].orderInfo.is_set = is_set_cart;
|
||||
// 如果菜已存在
|
||||
if (this.currentTab === res.data.cart_list[val][0].index) {
|
||||
newCartList.push({
|
||||
name: '第' + num + '餐', orderInfo: {
|
||||
id: 0,
|
||||
is_set: is_set_cart,
|
||||
date: res.data.cart_list[val][0].banquet_date ? new Date(res.data.cart_list[val][0].banquet_date).getTime() : [],
|
||||
columns: res.data.cart_list[val][0].banquet_time ? res.data.cart_list[val][0].banquet_time : '早上',
|
||||
number: res.data.cart_list[val][0].table_number ? res.data.cart_list[val][0].table_number : 1,
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
formatter(day) {
|
||||
const date = new Date(day.date)
|
||||
const now = new Date()
|
||||
const year = date.getFullYear()
|
||||
const month = date.getMonth()
|
||||
const da = date.getDate()
|
||||
const nowYear = now.getFullYear()
|
||||
const nowMonth = now.getMonth()
|
||||
const nowDa = now.getDate()
|
||||
|
||||
if (year === nowYear && month === nowMonth && da === nowDa) {
|
||||
day.topInfo = '今天'
|
||||
}
|
||||
if (this.isDisabledDate.includes(day.date)) {
|
||||
day.topInfo = '已预定';
|
||||
day.disabled = true; // 禁用日期
|
||||
day.disabled_class = 'disabled-date'; // 添加自定义样式类
|
||||
}
|
||||
return day
|
||||
},
|
||||
|
||||
handleTimeConfirm(res) {
|
||||
this.orderInfo.date = res.value
|
||||
},
|
||||
|
||||
//分类切换
|
||||
handleClickCategory(index : number) {
|
||||
this.getCategoryList();
|
||||
},
|
||||
handleChildrenClick(index : number) {
|
||||
this.childrenIndex = index;
|
||||
this.$refs.pagingRefSP?.reload();
|
||||
},
|
||||
//购物车验证
|
||||
getCartCheck() {
|
||||
CommonApi.commonPost('/api/banquet/order/check', { server_user_id: this.search.server_user_id }).catch((res) => {
|
||||
var num = 0;
|
||||
// var index = -1;
|
||||
var is_set_cart = 0;
|
||||
var newCartList = [];
|
||||
this.set_num = 0;
|
||||
|
||||
for (let val in this.menu_list) { //遍历购物车
|
||||
this.menu_list[val].orderInfo.is_set = 0;
|
||||
}
|
||||
//更新购物车餐标--获取已填数据
|
||||
if (res.code === 1) {
|
||||
for (let val in res.data.cart_list) {
|
||||
num++;
|
||||
// index++;
|
||||
is_set_cart = res.data.cart_list[val][0].banquet_date ? 1 : 0; // 餐标已设置 日期
|
||||
if (is_set_cart) {
|
||||
this.set_num += 1;
|
||||
}
|
||||
|
||||
if (newCartList.length > 0) {
|
||||
this.orderInfo = newCartList[0].orderInfo; // 更新 orderInfo --默认值
|
||||
this.menu_list[res.data.cart_list[val][0].index].orderInfo.is_set = is_set_cart;
|
||||
// 如果菜已存在
|
||||
if (this.currentTab === res.data.cart_list[val][0].index) {
|
||||
newCartList.push({
|
||||
name: '第' + num + '餐', orderInfo: {
|
||||
id: 0,
|
||||
is_set: is_set_cart,
|
||||
date: res.data.cart_list[val][0].banquet_date ? res.data.cart_list[val][0].banquet_date : '',
|
||||
columns: res.data.cart_list[val][0].banquet_time ? res.data.cart_list[val][0].banquet_time : '早上',
|
||||
number: res.data.cart_list[val][0].table_number ? res.data.cart_list[val][0].table_number : 1,
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if (newCartList.length > 0) {
|
||||
this.orderInfo = newCartList[0].orderInfo; // 更新 orderInfo --默认值
|
||||
} else {
|
||||
this.orderInfo = this.menu_list[this.currentTab].orderInfo; // 更新 orderInfo --默认值
|
||||
}
|
||||
this.totalPrice = res.data.total_price;
|
||||
} else {
|
||||
this.orderInfo = this.menu_list[this.currentTab].orderInfo; // 更新 orderInfo --默认值
|
||||
// uni.$u.toast(res.msg);
|
||||
}
|
||||
// console.log(this.orderInfo);
|
||||
this.totalPrice = res.data.total_price;
|
||||
} else {
|
||||
// uni.$u.toast(res.msg);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
getCategoryList () {
|
||||
CommonApi.commonGet('/api/banquet/dishes/category', {
|
||||
server_user_id: this.search.server_user_id,
|
||||
index: this.currentTab
|
||||
}).catch((res) => {
|
||||
if (res.code === 1) {
|
||||
// this.categoryList = res.data;
|
||||
this.tabList = res.data;
|
||||
this.search.category_id = this.tabList[0].id;
|
||||
this.getCartCheck() // 检查购物车
|
||||
} else {
|
||||
uni.$u.toast(res.msg);
|
||||
}
|
||||
});
|
||||
},
|
||||
//搜索事件
|
||||
searchSP () {
|
||||
this.$refs.pagingRefSP?.reload();
|
||||
},
|
||||
//列表分页
|
||||
changeSP (pageNo: number) {
|
||||
this.search.category_id = this.tabList[this.childrenIndex] ? this.tabList[this.childrenIndex].id : 0;
|
||||
// console.log(pageNo);
|
||||
this.search.page = pageNo;
|
||||
this.search.index = this.currentTab;
|
||||
CommonApi.commonGet('/api/banquet/dishes/list', this.search).catch((res) => {
|
||||
if (res.code === 1) {
|
||||
// this.matchedItems_sp = res.data;
|
||||
this.$refs.pagingRefSP?.complete(res.data);
|
||||
// console.log(res);
|
||||
} else {
|
||||
uni.$u.toast(res.msg);
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
//点击详情
|
||||
dishesDetail (item) {
|
||||
console.log(item);
|
||||
if (item.type === 1) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/banquet/combo/dishes?id=${item.id}`
|
||||
});
|
||||
} else {
|
||||
uni.navigateTo({
|
||||
url: `/pages/banquet/combo/dishes_combo?id=${item.id}`
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
//加入购物车
|
||||
addCart (e) {
|
||||
console.log(e);
|
||||
CommonApi.commonPost('/api/banquet/cart/add', {
|
||||
server_user_id: this.search.server_user_id,
|
||||
index: this.currentTab,
|
||||
dishes_id: e.id,
|
||||
number: e.cart_count,
|
||||
}).catch((res) => {
|
||||
if (res.code === 1) {
|
||||
//等于0 删除商品
|
||||
if (e.cart_count === 0) {
|
||||
this.delCart(e.cart_id)
|
||||
getCategoryList() {
|
||||
CommonApi.commonGet('/api/banquet/dishes/category', {
|
||||
server_user_id: this.search.server_user_id,
|
||||
index: this.currentTab
|
||||
}).catch((res) => {
|
||||
if (res.code === 1) {
|
||||
this.tabList = res.data;
|
||||
this.search.category_id = this.tabList[0].id;
|
||||
this.getCartCheck() // 检查购物车
|
||||
} else {
|
||||
uni.$u.toast(res.msg);
|
||||
}
|
||||
this.getCategoryList() // 更新购物车
|
||||
this.searchSP() // 更新列表
|
||||
});
|
||||
},
|
||||
//搜索事件
|
||||
searchSP() {
|
||||
this.$refs.pagingRefSP?.reload();
|
||||
},
|
||||
//列表分页
|
||||
changeSP(pageNo : number) {
|
||||
this.search.category_id = this.tabList[this.childrenIndex] ? this.tabList[this.childrenIndex].id : 0;
|
||||
this.search.page = pageNo;
|
||||
this.search.index = this.currentTab;
|
||||
CommonApi.commonGet('/api/banquet/dishes/list', this.search).catch((res) => {
|
||||
if (res.code === 1) {
|
||||
this.$refs.pagingRefSP?.complete(res.data);
|
||||
} else {
|
||||
uni.$u.toast(res.msg);
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
//点击详情
|
||||
dishesDetail(item) {
|
||||
if (item.type === 1) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/banquet/combo/dishes?id=${item.id}`
|
||||
});
|
||||
} else {
|
||||
uni.$u.toast(res.msg);
|
||||
uni.navigateTo({
|
||||
url: `/pages/banquet/combo/dishes_combo?id=${item.id}`
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
delCart (id) {
|
||||
CommonApi.commonPost('/api/banquet/cart/delete', {
|
||||
id: id,
|
||||
}).catch((res) => {
|
||||
if (res.code === 1) {
|
||||
uni.$u.toast('删除成功');
|
||||
this.getCartCheck() // 检查购物车
|
||||
} else {
|
||||
uni.$u.toast(res.msg);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 编辑购物车--餐标信息
|
||||
editCart () {
|
||||
CommonApi.commonPost('/api/banquet/cart/edit', {
|
||||
server_user_id: this.search.server_user_id,
|
||||
index: this.currentTab,
|
||||
date: this.formatDate(this.orderInfo.date),
|
||||
time: this.orderInfo.columns,
|
||||
number: this.orderInfo.number,
|
||||
|
||||
}).catch((res) => {
|
||||
if (res.code === 1) {
|
||||
uni.$u.toast('设置餐标成功');
|
||||
this.getCartCheck() // 检查购物车
|
||||
} else {
|
||||
uni.$u.toast(res.msg);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 时间戳转换为 Y-m-d 格式
|
||||
formatDate (timestamp: number) {
|
||||
const date = new Date(timestamp);
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(date.getDate()).padStart(2, '0');
|
||||
const formattedDate = `${year}-${month}-${day}`;
|
||||
console.log('格式化后的日期:', formattedDate);
|
||||
return formattedDate;
|
||||
},
|
||||
|
||||
//加入购物车
|
||||
addCart(e) {
|
||||
CommonApi.commonPost('/api/banquet/cart/add', {
|
||||
server_user_id: this.search.server_user_id,
|
||||
index: this.currentTab,
|
||||
dishes_id: e.id,
|
||||
number: e.cart_count,
|
||||
}).catch((res) => {
|
||||
if (res.code === 1) {
|
||||
//等于0 删除商品
|
||||
if (e.cart_count === 0) {
|
||||
this.delCart(e.cart_id)
|
||||
}
|
||||
this.getCategoryList() // 更新购物车
|
||||
this.searchSP() // 更新列表
|
||||
} else {
|
||||
uni.$u.toast(res.msg);
|
||||
}
|
||||
});
|
||||
},
|
||||
delCart(id) {
|
||||
CommonApi.commonPost('/api/banquet/cart/delete', {
|
||||
id: id,
|
||||
}).catch((res) => {
|
||||
if (res.code === 1) {
|
||||
uni.$u.toast('删除成功');
|
||||
this.getCartCheck() // 检查购物车
|
||||
} else {
|
||||
uni.$u.toast(res.msg);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 编辑购物车--餐标信息
|
||||
editCart() {
|
||||
CommonApi.commonPost('/api/banquet/cart/edit', {
|
||||
server_user_id: this.search.server_user_id,
|
||||
index: this.currentTab,
|
||||
date: this.orderInfo.date,
|
||||
time: this.orderInfo.columns,
|
||||
number: this.orderInfo.number,
|
||||
|
||||
}).catch((res) => {
|
||||
if (res.code === 1) {
|
||||
uni.$u.toast('设置餐标成功');
|
||||
this.getCartCheck() // 检查购物车
|
||||
} else {
|
||||
uni.$u.toast(res.msg);
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
@ -107,14 +107,9 @@
|
||||
};
|
||||
},
|
||||
onLoad(option) {
|
||||
// console.log(option);
|
||||
this.search.id = option.id;
|
||||
this.is_add = option.is_add | 0;
|
||||
this.getChefDetail()
|
||||
// this.changeSP()
|
||||
},
|
||||
created() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
// 最多显示下个月档期
|
||||
|
@ -42,28 +42,25 @@
|
||||
<up-line color="#F2F2F2"></up-line>
|
||||
</view>
|
||||
<view class="p-[20rpx]">
|
||||
<view class="u-flex my-[20rpx]" v-for="(item, index) in dishesList" :key="index" @click="gotoDishesDetai(item.id)">
|
||||
<view class="u-flex my-[20rpx]" v-for="(item, index) in dishesList" :key="index"
|
||||
@click="gotoDishesDetai(item.id)">
|
||||
<view class="">
|
||||
<wd-img width="200rpx" height="200rpx" :src="item.images[0]" :enable-preview="false" :radius="8" :round=false
|
||||
custom-class="margin-right-24" />
|
||||
<wd-img width="200rpx" height="200rpx" :src="item.images[0]" :enable-preview="false" :radius="8"
|
||||
:round=false custom-class="margin-right-24" />
|
||||
</view>
|
||||
<view class="">
|
||||
<up-text size="32rpx" :text="`${item.name}`" :flex1="true" align="left" wordWrap="normal" :show="true"
|
||||
prefixIcon="" customStyle="font-weight:bold" iconStyle="font-size:28rpx;color:#59CB56;margin-right:10rpx;"
|
||||
lines="1" decoration="none">
|
||||
</up-text>
|
||||
<view class="h-50 u-flex color-gray">
|
||||
<up-text size="" :text="`${item.intro}`" :flex1="true" align="left" wordWrap="normal" :show="true"
|
||||
prefixIcon="" customStyle="font-size:24rpx"
|
||||
iconStyle="font-size:24rpx;color:#59CB56;margin-right:10rpx;" lines="3" decoration="none">
|
||||
</up-text>
|
||||
<view class="u-flex u-flex-items-baseline u-flex-wrap">
|
||||
<view class="font-bold text-[32rpx]">
|
||||
{{item.name}}
|
||||
</view>
|
||||
<view class="h-50 u-flex color-gray">
|
||||
<view class="text-[24rpx]">
|
||||
{{item.intro}}
|
||||
</view>
|
||||
<view class="text-[32rpx]">
|
||||
<wd-text :text="item.price" mode="price" type="error" prefix="¥" />
|
||||
</view>
|
||||
<view class="h-20 u-flex flex color-gray">
|
||||
<view class="u-flex w-full u-flex-items-center u-flex-between">
|
||||
<wd-text size="24rpx" :text="item.line_price" mode="price" decoration="line-through" prefix="¥" />
|
||||
<view style="margin-top: -20rpx;">
|
||||
<view class="mt-[-20rpx]">
|
||||
<wd-button size="small" @click="addCart(item.id)" @click.stop>下单预定</wd-button>
|
||||
</view>
|
||||
</view>
|
||||
@ -175,6 +172,7 @@
|
||||
background-color: white;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
|
||||
.title-align {
|
||||
height: 130rpx;
|
||||
line-height: 130rpx;
|
||||
|
@ -213,6 +213,7 @@ async function wechatLogin () {
|
||||
// }
|
||||
// });
|
||||
userStore.login({ account: account.value, code: event.code }).catch((res) => {
|
||||
console.log(res);
|
||||
if (res.code === 1) {
|
||||
// const token = res.data.token;
|
||||
// if (token) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user