调试订单支付
Some checks are pending
deploy / deploy (push) Waiting to run

This commit is contained in:
lewis 2025-08-15 16:12:17 +08:00
parent c5b11daed3
commit dd3e5e53fc
2 changed files with 140 additions and 255 deletions

View File

@ -132,12 +132,6 @@
</up-cell-group>
</view>
<!-- <template #footer>
<view>
<wd-button size="small" style="margin-right: 8px;">评价</wd-button>
<wd-button size="small" plain>立即使用</wd-button>
</view>
</template> -->
</wd-card>
</view>
@ -223,10 +217,6 @@
message: '做宴地址不能为空,请填写'
}
]"></wd-col-picker>
<wd-input label="详细地址" prop="street_name" clearable v-model="orderInfo.street_name" placeholder="请填写详细地址"
:rules="[
{
@ -241,7 +231,7 @@
<view class="pb-4" />
<wd-button plain 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>
<wd-button hairline custom-style="width: calc(100vw - 100rpx);" @click="handleSubmit(2)">付定金锁定订单</wd-button>
</wd-cell-group>
</wd-form>
@ -324,8 +314,6 @@
},
//
handleSubmit(reservation_type) {
// this.propShowOrder = true;
// console.log(this.orderInfo);
this.orderInfo.reservation_type = reservation_type; //
this.$refs.form.validate()
.then(({
@ -334,7 +322,6 @@
}) => {
if (valid) {
this.orderInfo.address = this.address_string + this.orderInfo.street_name;
// console.log(this.orderInfo);
this.addOrder();
}
})
@ -349,7 +336,9 @@
CommonApi.commonPost('/api/banquet/order/createOrder', this.orderInfo).catch((res) => {
if (res.code === 1) {
this.order_id = res.data.order_id;
this.propShowOrder = true;
uni.navigateTo({
url: `/pages/banquet/order/detail?order_id=${res.data.order_id}`
});
} else {
uni.$u.toast(res.msg);
}

View File

@ -1,29 +1,29 @@
<style lang='scss'>
.custom-count-down {
display: inline-block;
width: 22px;
color: #ff3232;
font-size: 12px;
text-align: center;
background-color: #ff404021;
border-radius: 2px;
}
.custom-count-down {
display: inline-block;
width: 22px;
color: #ff3232;
font-size: 12px;
text-align: center;
background-color: #ff404021;
border-radius: 2px;
}
.custom-count-down-colon {
display: inline-block;
margin: 0 4px;
color: #ff4040;
}
.custom-count-down-colon {
display: inline-block;
margin: 0 4px;
color: #ff4040;
}
.cell-icon {
display: block;
box-sizing: border-box;
width: 16px;
height: 16px;
margin-right: 4px;
background: url('https://img10.360buyimg.com/jmadvertisement/jfs/t1/71075/7/3762/1820/5d1f26d1E0d600b9e/a264c901943080ac.png') no-repeat;
background-size: cover;
}
.cell-icon {
display: block;
box-sizing: border-box;
width: 16px;
height: 16px;
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>
@ -56,7 +56,6 @@
</wd-count-down>
</view>
</view>
</template>
</u-cell>
@ -73,8 +72,6 @@
</view>
</u-radio-group>
</view>
<view class="prop-flex-bottom">
<up-button class="" style="" text="确认支付" type="primary" color="#59CB56" shape="circle" size="normal"
@ -82,11 +79,8 @@
</up-button>
</view>
</wd-cell-group>
</u-popup>
<view v-for="(matchedItems, index) in matchedItems_sp" :key="index">
<wd-card>
<template #title>
@ -114,8 +108,8 @@
</template>
<template #title>
<view class="h-60 flex">
<up-text size="28rpx" :text="`${item.dishes_info.name}`" :flex1="true" align="left" wordWrap="normal"
:show="true" prefixIcon="" customStyle="font-weight:bold"
<up-text size="28rpx" :text="`${item.dishes_info.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>
<u-icon slot="right" label-color="red" readonly :label="`¥${item.dishes_info.price}元`"></u-icon>
@ -123,8 +117,8 @@
</template>
<template #label>
<view class="h-60 flex color-gray">
<up-text size="26rpx" :text="`${item.dishes_info.intro}`" :flex1="true" align="left" wordWrap="normal"
:show="true" prefixIcon="" customStyle=""
<up-text size="26rpx" :text="`${item.dishes_info.intro}`" :flex1="true" align="left"
wordWrap="normal" :show="true" prefixIcon="" customStyle=""
iconStyle="font-size:28rpx;color:#59CB56;margin-right:10rpx;" lines="1" decoration="none">
</up-text>
<u-icon slot="right" label-color="red" readonly :label="`X${item.number}`"></u-icon>
@ -136,16 +130,12 @@
</view>
<template #footer>
<!-- <view>
<wd-button size="small" style="margin-right: 8px;">评价</wd-button>
<wd-button size="small" plain>立即使用</wd-button>
</view> -->
<view class="title font-size-32">
<view>费用合计</view>
<view class="title-tip">
<text class="font-size-32 color-red ">{{ orderInfo.final_price }}</text>
<view class="title font-size-32">
<view>费用合计</view>
<view class="title-tip">
<text class="font-size-32 color-red ">{{ orderInfo.final_price }}</text>
</view>
</view>
</view>
</template>
</wd-card>
@ -180,16 +170,6 @@
<wd-form ref="form" :model="orderInfo" errorType="message">
<wd-cell-group border>
<!--
<view class="pb-4" />
<wd-input readonly label="联系姓名" prop="customer_name" clearable v-model="orderInfo.customer_name"
placeholder="请填写联系姓名" />
<wd-input readonly label="联系电话" prop="phone" clearable v-model="orderInfo.phone" placeholder="请填写联系电话" />
<wd-input readonly label="宴席类型" prop="banquet_type" clearable v-model="orderInfo.banquet_type"
placeholder="请填写详细地址" />
<wd-textarea readonly auto-height label="详细地址" prop="address" clearable v-model="orderInfo.address"
placeholder="请填写详细地址" />
<wd-textarea readonly auto-height label="备注" v-model="orderInfo.remark" placeholder="请填写备注" /> -->
<view class="pb-4" />
<wd-button plain hairline custom-style="width: calc(100vw - 100rpx);" @click="payOrder(1)">确定支付</wd-button>
<view class="pb-2" />
@ -204,193 +184,109 @@
</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 () {
return {
totalPrice: 0,
server_user: {
id: 0,
phone: '',
public_name: '',
import { useColPickerData, useModal } from '@/hooks'
import { defineComponent } from "vue";
import { CommonApi, UserApi } from "@/api";
const { colPickerData, findChildrenByCode } = useColPickerData()
export default defineComponent({
data() {
return {
totalPrice: 0,
server_user: {
id: 0,
phone: '',
public_name: '',
},
order_id: 0,
address_string: '',
banquetType: this.getBanquetType(),
propShowOrder: false,
orderInfo: [],
matchedItems_sp: [],
};
},
onLoad(option) {
this.order_id = option.order_id;;
this.orderInfo.order_id = option.order_id;
this.getOrderDetail()
},
methods: {
close() {
this.propShowOrder = false;
},
order_id: 0,
address_string: '',
banquetType: this.getBanquetType(),
propShowOrder: false,
// area: [],
// value: [],
orderInfo: [],
// orderInfo: {
// district_name: [],
// street_name: '',
// // cart_ids: [],
// customer_name: '',
// phone: '',
// address: '',
// remark: '',
// banquet_type: '1',
// reservation_type: 1,
// order_id: 0,
// // table_number: 0,
// // banquet_date: '',
// },
matchedItems_sp: [],
};
},
onLoad (option) {
this.order_id = option.id;;
this.orderInfo.order_id = option.id;
this.getOrderDetail()
// 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')
// })
// },
//
payOrder (type) {
if (type === 1) {
//
CommonApi.commonPost('/api/banquet/order/pay', { order_id: this.order_id }).catch((res) => {
if (res.code === 1) {
// this.payOrder(res.data.order_id);
// this.propShowOrder = true;
console.log(res.data);
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));
}
})
// this.close();
} else {
uni.$u.toast(res.msg);
}
});
} else {
//
CommonApi.commonPost('/api/banquet/order/cancel', { order_id: this.order_id }).catch((res) => {
if (res.code === 1) {
uni.$u.toast(res.msg);
} 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;
//
payOrder(type) {
if (type === 1) {
//
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));
}
})
} else {
uni.$u.toast(res.msg);
}
});
this.banquetType = res.data;
} else {
uni.$u.toast(res.msg);
//
CommonApi.commonPost('/api/banquet/order/cancel', { order_id: this.order_id }).catch((res) => {
if (res.code === 1) {
uni.$u.toast(res.msg);
} else {
uni.$u.toast(res.msg);
}
});
}
});
},
//
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);
}
});
},
// //
getOrderDetail() {
CommonApi.commonGet('/api/banquet/order/detail', { order_id: this.order_id }).catch((res) => {
if (res.code === 1) {
this.matchedItems_sp = res.data.order_info;
this.orderInfo = res.data.order;
this.server_user.phone = res.data.server_info.certification.phone;
this.server_user.public_name = res.data.server_info.certification.public_name;
this.server_user.id = res.data.server_info.id;
} else {
uni.$u.toast(res.msg);
}
});
},
//
cookDetail(id : number) {
uni.navigateTo({
url: `/pages/banquet/cook/detail?id=${id}`
});
},
},
// //
getOrderDetail () {
CommonApi.commonGet('/api/banquet/order/detail', { order_id: this.order_id }).catch((res) => {
if (res.code === 1) {
console.log(res)
this.matchedItems_sp = res.data.order_info;
// this.totalPrice = res.data.total_price;
this.orderInfo = res.data.order;
this.server_user.phone = res.data.server_info.certification.phone;
this.server_user.public_name = res.data.server_info.certification.public_name;
this.server_user.id = res.data.server_info.id;
// this.$refs.pagingRefSP?.complete(res.data);
// console.log(res);
} else {
uni.$u.toast(res.msg);
}
});
},
//
cookDetail (id: number) {
// console.log(id);
uni.navigateTo({
url: `/pages/banquet/cook/detail?id=${id}`
});
},
},
});
});
</script>