Pre Merge pull request !166 from wuKong/feat(order)-支持通过支付订单号查询订单详情

pull/166/MERGE
wuKong 2025-11-24 10:50:09 +00:00 committed by Gitee
commit fd7b2c3057
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 30 additions and 4 deletions

View File

@ -259,7 +259,7 @@
<script setup> <script setup>
import sheep from '@/sheep'; import sheep from '@/sheep';
import { onLoad, onShow } from '@dcloudio/uni-app'; import { onLoad, onShow } from '@dcloudio/uni-app';
import { reactive, ref } from 'vue'; import { reactive, ref, watch } from 'vue';
import { isEmpty } from 'lodash-es'; import { isEmpty } from 'lodash-es';
import { import {
fen2yuan, fen2yuan,
@ -269,6 +269,7 @@
} from '@/sheep/hooks/useGoods'; } from '@/sheep/hooks/useGoods';
import OrderApi from '@/sheep/api/trade/order'; import OrderApi from '@/sheep/api/trade/order';
import DeliveryApi from '@/sheep/api/trade/delivery'; import DeliveryApi from '@/sheep/api/trade/delivery';
import PayOrderApi from '@/sheep/api/pay/order';
import PickUpVerify from '@/pages/order/pickUpVerify.vue'; import PickUpVerify from '@/pages/order/pickUpVerify.vue';
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2; const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
@ -429,7 +430,11 @@
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) => {
@ -437,6 +442,17 @@
if (options.id) { if (options.id) {
id = options.id; id = options.id;
} }
if (options.payOrderNo) {
// payOrderNo merchantOrderId merchantOrderId tradeOrderId
// path
// -- 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) {
id = payOrder.data?.merchantOrderId || id;
}
}
// TODO // TODO
state.comeinType = options.comein_type; state.comeinType = options.comein_type;
if (state.comeinType === 'wechat') { if (state.comeinType === 'wechat') {
@ -444,6 +460,12 @@
} }
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>

View File

@ -2,11 +2,15 @@ import request from '@/sheep/request';
const PayOrderApi = { const PayOrderApi = {
// 获得支付订单 // 获得支付订单
getOrder: (id, sync) => { getOrder: (id, sync, no) => {
const params = {};
if (id) params.id = id;
if (no) params.no = no;
if (sync !== undefined) params.sync = sync;
return request({ return request({
url: '/pay/order/get', url: '/pay/order/get',
method: 'GET', method: 'GET',
params: { id, sync }, params,
}); });
}, },
// 提交支付订单 // 提交支付订单