!166 feat(order): 支持通过支付订单号查询订单详情

pull/167/head
YunaiV 2025-11-24 20:08:09 +08:00
parent adf8e0c004
commit 50549b8064
1 changed files with 8 additions and 26 deletions

View File

@ -277,8 +277,6 @@
const state = reactive({ const state = reactive({
orderInfo: {}, orderInfo: {},
merchantTradeNo: '', //
comeinType: '', //
}); });
// ========== ========== // ========== ==========
@ -429,12 +427,8 @@
} }
onShow(async () => { onShow(async () => {
//onShow, // onShow,
await getOrderDetail(state.orderInfo.id);
//options.payOrderNo,onLoad
//state.orderInfo.idonShow await getOrderDetail
//watchstate.orderInfo.id await getOrderDetail
//await getOrderDetail(state.orderInfo.id);
}); });
onLoad(async (options) => { onLoad(async (options) => {
@ -442,30 +436,18 @@
if (options.id) { if (options.id) {
id = options.id; id = options.id;
} }
if (options.payOrderNo) { //
// https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/order_center/order_center.html
// pathpages/order/detail?payOrderNo=${} ${} out_trade_no payOrderNo
if (!id && options.payOrderNo) {
// payOrderNo merchantOrderId merchantOrderId tradeOrderId // payOrderNo merchantOrderId merchantOrderId tradeOrderId
// path const payOrder = await PayOrderApi.getOrder(undefined, undefined, options.payOrderNo);
// -- https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/order_center/order_center.html
// -- pages/order/detail?payOrderNo=${}
// -- ${} out_trade_no payOrderNo payOrderNo merchantOrderId merchantOrderId tradeOrderId
const payOrder = await PayOrderApi.getOrder(undefined,undefined, options.payOrderNo);
if (payOrder.code === 0) { if (payOrder.code === 0) {
id = payOrder.data?.merchantOrderId || id; id = payOrder.data?.merchantOrderId;
} }
} }
// TODO
state.comeinType = options.comein_type;
if (state.comeinType === 'wechat') {
state.merchantTradeNo = options.merchant_trade_no;
}
state.orderInfo.id = id; state.orderInfo.id = id;
}); });
watch(() => state.orderInfo.id, async (newId) => {
if (newId) {
await getOrderDetail(newId);
}
});
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>