Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
client
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
cc0b44ae
authored
Oct 31, 2025
by
Jony.L
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新支付功能-api模块支付重构
parent
5a8990ae
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
146 additions
and
19 deletions
+146
-19
src/api/computingResource.js
+1
-0
src/api/marketplace.js
+22
-0
src/views/computingResource/confirmOrder.vue
+14
-14
src/views/computingResource/resourceList.vue
+1
-1
src/views/computingResource/shoppingCart.vue
+0
-0
src/views/marketplace/AIMarketplaceDetail.vue
+108
-4
No files found.
src/api/computingResource.js
View file @
cc0b44ae
...
@@ -48,6 +48,7 @@ export function createOrderSubmitWpgj(query){
...
@@ -48,6 +48,7 @@ export function createOrderSubmitWpgj(query){
})
})
}
}
export
function
createPay
(
query
){
export
function
createPay
(
query
){
return
request
({
return
request
({
url
:
'/pay/order/submit'
,
url
:
'/pay/order/submit'
,
...
...
src/api/marketplace.js
View file @
cc0b44ae
...
@@ -54,6 +54,7 @@ export function createApiOrderSubmit(query){
...
@@ -54,6 +54,7 @@ export function createApiOrderSubmit(query){
})
})
}
}
// === 老的微信支付接口(保留以便回退) ===
export
function
createPay
(
query
){
export
function
createPay
(
query
){
return
request
({
return
request
({
url
:
'/pay/order/submit'
,
url
:
'/pay/order/submit'
,
...
@@ -61,3 +62,24 @@ export function createPay(query){
...
@@ -61,3 +62,24 @@ export function createPay(query){
data
:
query
data
:
query
})
})
}
}
// === 新的WPGJ支付接口 ===
// 创建API订单(旺铺聚合支付)
export
function
createApiOrderSubmitWpgj
(
query
){
return
request
({
url
:
'/apihub/api-order/create-wpgj'
,
method
:
'post'
,
data
:
query
})
}
// WPGJ旺铺聚合支付订单查询(与算力资源模块共用)
export
function
getWpgjOrder
(
id
)
{
return
request
({
url
:
'/pay/order/wpgj-get'
,
method
:
'get'
,
params
:
{
id
}
})
}
src/views/computingResource/confirmOrder.vue
View file @
cc0b44ae
...
@@ -95,7 +95,7 @@
...
@@ -95,7 +95,7 @@
</template>
</template>
<
script
name=
"ConfirmOrder"
setup
>
<
script
name=
"ConfirmOrder"
setup
>
import
{
confirmOrderInfo
,
orderSubmit
}
from
'@/api/computingResource.js'
//
import { confirmOrderInfo, orderSubmit } from '@/api/computingResource.js'
import
{
useRoute
,
useRouter
}
from
'vue-router'
import
{
useRoute
,
useRouter
}
from
'vue-router'
import
{
ref
}
from
'vue'
import
{
ref
}
from
'vue'
...
@@ -104,19 +104,19 @@ const router = useRouter()
...
@@ -104,19 +104,19 @@ const router = useRouter()
const
tableData
=
ref
([])
const
tableData
=
ref
([])
const
totalPrice
=
ref
(
0
)
const
totalPrice
=
ref
(
0
)
const
params
=
ref
([])
const
params
=
ref
([])
confirmOrderInfo
({
id
:
route
.
query
.
id
}).
then
(
res
=>
{
//
confirmOrderInfo({id: route.query.id}).then(res => {
totalPrice
.
value
=
res
.
data
.
publicTotalPrice
//
totalPrice.value = res.data.publicTotalPrice
params
.
value
=
JSON
.
parse
(
res
.
data
.
param
)
//
params.value = JSON.parse(res.data.param)
tableData
.
value
=
[
res
.
data
]
//
tableData.value = [res.data]
})
//
})
function
submit
()
{
//
function submit () {
orderSubmit
({
id
:
route
.
query
.
id
}).
then
(
res
=>
{
//
orderSubmit({id: route.query.id}).then(res => {
if
(
res
.
data
===
1
)
{
//
if (res.data === 1) {
router
.
replace
(
'/computingResource/orderResult'
)
//
router.replace('/computingResource/orderResult')
}
//
}
})
//
})
}
//
}
</
script
>
</
script
>
...
...
src/views/computingResource/resourceList.vue
View file @
cc0b44ae
...
@@ -435,7 +435,7 @@ function create() {
...
@@ -435,7 +435,7 @@ function create() {
// WPGJ聚合支付处理 - 后端现在直接返回AppPayOrderSubmitRespVO
// WPGJ聚合支付处理 - 后端现在直接返回AppPayOrderSubmitRespVO
if
(
res
.
data
.
displayContent
)
{
if
(
res
.
data
.
displayContent
)
{
// 使用displayContent字段生成二维码,使用WPGJ订单ID进行轮询
// 使用displayContent字段生成二维码,使用WPGJ订单ID进行轮询
getCode
(
res
.
data
.
displayContent
,
res
.
data
.
wpgjOrderI
d
);
getCode
(
res
.
data
.
displayContent
,
res
.
data
.
i
d
);
}
else
{
}
else
{
ElMessage
.
error
(
'获取支付信息失败'
);
ElMessage
.
error
(
'获取支付信息失败'
);
}
}
...
...
src/views/computingResource/shoppingCart.vue
View file @
cc0b44ae
This diff is collapsed.
Click to expand it.
src/views/marketplace/AIMarketplaceDetail.vue
View file @
cc0b44ae
...
@@ -259,7 +259,7 @@ import {
...
@@ -259,7 +259,7 @@ import {
//getMerchantInfo,
//getMerchantInfo,
getAppRecommendList
,
getAppRecommendList
,
//getAppCategoryList,
//getAppCategoryList,
getAppInfoDetail
,
createApiOrderSubmit
,
createPay
getAppInfoDetail
,
createApiOrderSubmit
,
createPay
,
createApiOrderSubmitWpgj
,
getWpgjOrder
}
from
"../../api/marketplace"
;
}
from
"../../api/marketplace"
;
import
{
ElMessage
,
ElMessageBox
}
from
"element-plus"
;
import
{
ElMessage
,
ElMessageBox
}
from
"element-plus"
;
import
{
OfficeBuilding
,
Phone
}
from
'@element-plus/icons-vue'
import
{
OfficeBuilding
,
Phone
}
from
'@element-plus/icons-vue'
...
@@ -537,8 +537,56 @@ function getCreateData(){
...
@@ -537,8 +537,56 @@ function getCreateData(){
}
}
function
create
()
{
function
create
()
{
// 用户点击
“确认”
时执行
// 用户点击
"确认"
时执行
const
createData
=
getCreateData
();
const
createData
=
getCreateData
();
// === 新的WPGJ支付流程 ===
// 创建API订单(旺铺聚合支付)
createApiOrderSubmitWpgj
({
apiId
:
productData
.
value
.
id
,
packageId
:
currentPackageId
.
value
,
}).
then
(
res
=>
{
console
.
log
(
'API WPGJ支付响应数据:'
,
res
.
data
);
// 弹出确认对话框
ElMessageBox
.
confirm
(
'确定购买吗?'
,
// 对话框提示文字
'购买确认'
,
// 对话框标题
{
confirmButtonText
:
'确认'
,
// 确认按钮文字
cancelButtonText
:
'取消'
,
// 取消按钮文字
type
:
'warning'
// 对话框类型(警告样式)
}
)
.
then
(()
=>
{
// WPGJ聚合支付处理 - 后端现在直接返回支付信息
if
(
res
.
data
.
displayContent
)
{
// 使用displayContent字段生成二维码,使用WPGJ订单ID进行轮询
getCodeWpgj
(
res
.
data
.
displayContent
,
res
.
data
.
id
);
}
else
{
ElMessage
.
error
(
'获取支付信息失败'
);
}
showDrawer
.
value
=
false
;
})
.
catch
(()
=>
{
ElMessageBox
.
confirm
(
'订单已创建,请前往控制台-api订单查看'
,
'提示'
,
{
confirmButtonText
:
'确认'
,
showCancelButton
:
false
,
type
:
'success'
}
).
then
(()
=>
{
showDrawer
.
value
=
false
;
})
});
}).
catch
(
err
=>
{
console
.
error
(
'创建API订单失败:'
,
err
);
ElMessage
.
error
(
'创建订单失败,请重试'
);
});
// === 老的支付流程代码(注释掉以便回退) ===
/*
//创建订单
//创建订单
createApiOrderSubmit(
createApiOrderSubmit(
{
{
...
@@ -581,25 +629,77 @@ function create() {
...
@@ -581,25 +629,77 @@ function create() {
}).catch(err => {
}).catch(err => {
// 接口调用失败的处理(如提示错误)
// 接口调用失败的处理(如提示错误)
});
});
*/
}
}
// === 新的WPGJ支付函数 ===
function
getCodeWpgj
(
value
,
wpgjOrderId
)
{
QRCode
.
toDataURL
(
value
,
{
errorCorrectionLevel
:
'L'
,
margin
:
2
,
width
:
350
},
(
err
,
url
)
=>
{
if
(
err
)
throw
err
qrCode
.
value
=
{
url
:
url
,
title
:
'请使用微信或支付宝扫码支付'
,
visible
:
true
}
}
)
createQueryIntervalWpgj
(
wpgjOrderId
)
}
// === 老的支付函数(注释掉以便回退) ===
/*
function getCode(value, payOrderId) {
function getCode(value, payOrderId) {
QRCode.toDataURL(value, {errorCorrectionLevel: 'L', margin: 2, width: 350}, (err, url) => {
QRCode.toDataURL(value, {errorCorrectionLevel: 'L', margin: 2, width: 350}, (err, url) => {
if (err) throw err
if (err) throw err
qrCode.value = {
qrCode.value = {
url: url,
url: url,
title
:
'请使用微信
“扫一扫”
扫码支付'
,
title: '请使用微信
"扫一扫"
扫码支付',
visible: true
visible: true
}
}
}
}
)
)
createQueryInterval(payOrderId)
createQueryInterval(payOrderId)
}
}
*/
// === 新的WPGJ轮询查询任务 ===
const
createQueryIntervalWpgj
=
(
id
)
=>
{
if
(
interval
.
value
)
{
return
}
interval
.
value
=
setInterval
(
async
()
=>
{
try
{
const
res
=
await
getWpgjOrder
(
id
)
console
.
log
(
res
,
'API WPGJ轮询结果'
)
// 已支付
if
(
res
.
data
.
orderStatus
===
'1'
)
{
clearQueryInterval
()
ElMessageBox
.
confirm
(
'支付成功'
,
'请前往控制台-api订单查看'
,
{
confirmButtonText
:
'确认'
,
showCancelButton
:
false
,
type
:
'success'
}
).
then
(()
=>
{})
}
// 已取消或失败
if
(
res
.
data
.
orderStatus
===
'2'
)
{
clearQueryInterval
()
ElMessage
.
error
(
'支付已关闭!'
)
}
}
catch
(
e
)
{
// 静默捕获轮询异常
}
},
1000
*
2
)
}
/** 轮询查询任务 */
// === 老的轮询查询任务(注释掉以便回退) ===
/*
const createQueryInterval = (id) => {
const createQueryInterval = (id) => {
if (interval.value) {
if (interval.value) {
return
return
...
@@ -631,7 +731,10 @@ const createQueryInterval = (id) => {
...
@@ -631,7 +731,10 @@ const createQueryInterval = (id) => {
}
}
}, 1000 * 2)
}, 1000 * 2)
}
}
*/
// === 老的支付订单查询(注释掉以便回退) ===
/*
// 查询详情支付订单
// 查询详情支付订单
const getOrder = async (id, sync) => {
const getOrder = async (id, sync) => {
return await request({
return await request({
...
@@ -643,6 +746,7 @@ const getOrder = async (id, sync) => {
...
@@ -643,6 +746,7 @@ const getOrder = async (id, sync) => {
}
}
})
})
}
}
*/
/** 清空查询任务 */
/** 清空查询任务 */
const
clearQueryInterval
=
()
=>
{
const
clearQueryInterval
=
()
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment