feat(结算页): 添加微信小程序支付功能并完善类型定义
- 在结算页面实现微信小程序支付功能 - 添加页面导航栏标题配置 - 扩展订单提交接口类型,增加微信小程序标识字段
This commit is contained in:
parent
8100608f94
commit
d6311c6e6c
|
|
@ -78,7 +78,9 @@ export interface SubmitOrderRequestData {
|
||||||
cellId: number
|
cellId: number
|
||||||
/** 运行模式(0-支付模式 1-审批模式 2-借还模式 3-会员模式 4-耗材模式) */
|
/** 运行模式(0-支付模式 1-审批模式 2-借还模式 3-会员模式 4-耗材模式) */
|
||||||
mode: number;
|
mode: number;
|
||||||
}>
|
}>;
|
||||||
|
/** 是否微信小程序订单 0否 1是 */
|
||||||
|
isWxMp: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type SubmitOrderResponseData = {
|
export type SubmitOrderResponseData = {
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,10 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/index/checkout",
|
"path": "pages/index/checkout",
|
||||||
"type": "page"
|
"type": "page",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "结算购物车"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/login/login",
|
"path": "pages/login/login",
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,12 @@ import { useRentingCabinetStore } from "@/pinia/stores/rentingCabinet";
|
||||||
// 导入支付方式映射
|
// 导入支付方式映射
|
||||||
import { paymentMethodOptions, modeToPaymentMethodMap } from "@/utils/maps/payment";
|
import { paymentMethodOptions, modeToPaymentMethodMap } from "@/utils/maps/payment";
|
||||||
|
|
||||||
|
definePage({
|
||||||
|
style: {
|
||||||
|
navigationBarTitleText: '结算购物车',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
const cartStore = useCartStore();
|
const cartStore = useCartStore();
|
||||||
const { cartItems, totalPrice } = storeToRefs(cartStore);
|
const { cartItems, totalPrice } = storeToRefs(cartStore);
|
||||||
|
|
||||||
|
|
@ -71,7 +77,7 @@ const paymentValueToType: Record<string, 'wechat' | 'balance' | 'approval'> = {
|
||||||
async function callUniPay(paymentInfo: any) {
|
async function callUniPay(paymentInfo: any) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
// uni-app支付API
|
// uni-app支付API
|
||||||
/* uni.requestPayment({
|
wx.requestPayment({
|
||||||
provider: 'wxpay',
|
provider: 'wxpay',
|
||||||
timeStamp: paymentInfo.timeStamp,
|
timeStamp: paymentInfo.timeStamp,
|
||||||
nonceStr: paymentInfo.nonceStr,
|
nonceStr: paymentInfo.nonceStr,
|
||||||
|
|
@ -86,7 +92,7 @@ async function callUniPay(paymentInfo: any) {
|
||||||
fail: (err) => {
|
fail: (err) => {
|
||||||
reject(new Error(err.errMsg || '支付未完成'));
|
reject(new Error(err.errMsg || '支付未完成'));
|
||||||
}
|
}
|
||||||
}); */
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -160,7 +166,8 @@ async function handleSubmit() {
|
||||||
applyRemark: applyRemark.value,
|
applyRemark: applyRemark.value,
|
||||||
qyUserid: wxStore.userid,
|
qyUserid: wxStore.userid,
|
||||||
mode: productStore.selectedShop?.mode || 0,
|
mode: productStore.selectedShop?.mode || 0,
|
||||||
isInternal: isInternal
|
isInternal: isInternal,
|
||||||
|
isWxMp: 1
|
||||||
};
|
};
|
||||||
|
|
||||||
const { code, data } = await submitOrderApi(requestData);
|
const { code, data } = await submitOrderApi(requestData);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue