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
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
473 additions
and
346 deletions
+473
-346
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
+327
-327
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
<
template
>
<
template
>
<div
class=
"app-container shopping-cart"
>
<!--
<div
class=
"app-container shopping-cart"
>
--
>
<div
class=
"page-title"
>
<!--
<div
class=
"page-title"
>
--
>
<div>
购物车 (总共
{{
tableData
.
length
}}
)
</div
>
<!--
<div>
购物车 (总共
{{
tableData
.
length
}}
)
</div>
--
>
</div
>
<!--
</div>
--
>
<div
class=
"page-main"
>
<!--
<div
class=
"page-main"
>
--
>
<div
class=
"detail-info"
>
<!--
<div
class=
"detail-info"
>
--
>
<el-table
:data=
"tableData"
v-if=
"tableData.length !== 0"
row-key=
"id"
@
selection-change=
"tableSelectionChange"
align=
"center"
>
<!--
<el-table
:data=
"tableData"
v-if=
"tableData.length !== 0"
row-key=
"id"
@
selection-change=
"tableSelectionChange"
align=
"center"
>
--
>
<el-table-column
type=
"selection"
reserve-selection
/
>
<!--
<el-table-column
type=
"selection"
reserve-selection
/>
--
>
<el-table-column
label=
"资源型号"
prop=
"model"
/
>
<!--
<el-table-column
label=
"资源型号"
prop=
"model"
/>
--
>
<el-table-column
label=
"配置详情"
width=
"210px"
>
<!--
<el-table-column
label=
"配置详情"
width=
"210px"
>
--
>
<template
#
default=
"
{row}"
>
<!--
<template
#
default=
"
{row}">--
>
<p>
CPU:
{{
row
.
cpu
}}
</p
>
<!--
<p>
CPU:
{{
row
.
cpu
}}
</p>
--
>
<p>
GPU:
{{
row
.
gpu
}}
</p
>
<!--
<p>
GPU:
{{
row
.
gpu
}}
</p>
--
>
<p>
内存:
{{
row
.
memory
}}
</p
>
<!--
<p>
内存:
{{
row
.
memory
}}
</p>
--
>
<p>
存储:
{{
row
.
storage
}}
</p
>
<!--
<p>
存储:
{{
row
.
storage
}}
</p>
--
>
</
template
>
<!--
</
template
>
--
>
</el-table-column
>
<!-- </el-table-column>--
>
<!-- <el-table-column v-for="(item,index) in params[0]" :key="item.id" :label="item.name"
-->
<!-- <!– <el-table-column v-for="(item,index) in params[0]" :key="item.id" :label="item.name"–>
-->
<!-- :width="item?.name?.length >= 8 ? '150px':''">
-->
<!-- <!– :width="item?.name?.length >= 8 ? '150px':''">–>
-->
<!-- <template #default="scope">
-->
<!-- <!– <template #default="scope">–>
-->
<!-- {{ param[scope.$index][index]['valueName'] }}
-->
<!-- <!– {{ param[scope.$index][index]['valueName'] }}–>
-->
<!-- </template>
-->
<!-- <!– </template>–>
-->
<!-- </el-table-column>
-->
<!-- <!– </el-table-column>–>
-->
<!-- <el-table-column v-for="(i, index) in headers" :key="index" :label="i.name" :prop="i.name"
-->
<!-- <!– <el-table-column v-for="(i, index) in headers" :key="index" :label="i.name" :prop="i.name"–>
-->
<!-- :width="i?.name?.length >= 8 ? '150px':''">
-->
<!-- <!– :width="i?.name?.length >= 8 ? '150px':''">–>
-->
<!-- <template v-slot="scope">
-->
<!-- <!– <template v-slot="scope">–>
-->
<!-- {{ getCellValue(scope.row.param, i.name) || '-' }}
-->
<!-- <!– {{ getCellValue(scope.row.param, i.name) || '-' }}–>
-->
<!-- </template>
-->
<!-- <!– </template>–>
-->
<!-- </el-table-column>
-->
<!-- <!– </el-table-column>–>
-->
<el-table-column
label=
"配置参数"
width=
"300px"
>
<!-- <el-table-column label="配置参数" width="300px">--
>
<
template
v-slot=
"scope"
>
<!-- <template v-slot="scope">--
>
<div
v-for=
"(item, index) in JSON.parse(scope.row.param)"
:key=
"index"
>
<!-- <div v-for="(item, index) in JSON.parse(scope.row.param)" :key="index">--
>
{{
item
.
name
}}
:
{{
item
.
valueName
}}
<!-- {{ item.name }}:{{ item.valueName }}-->
</div
>
<!-- </div>--
>
</
template
>
<!-- </template>--
>
</el-table-column
>
<!-- </el-table-column>--
>
<el-table-column
label=
"申请数量"
prop=
"useNum"
>
<!-- <el-table-column label="申请数量" prop="useNum">--
>
<
template
#
default=
"{row}"
>
<!-- <template #default="{row}">--
>
<el-input-number
<!-- <el-input-number-->
v-model=
"row.useNum"
<!-- v-model="row.useNum"-->
:min=
"1"
<!-- :min="1"-->
controls-position=
"right"
<!-- controls-position="right"-->
@
change=
"editNum(row)"
<!-- @change="editNum(row)"-->
style=
"width: 80px"
/
>
<!-- style="width: 80px"/>--
>
</
template
>
<!-- </template>--
>
</el-table-column
>
<!-- </el-table-column>--
>
<el-table-column
label=
"配置费用"
prop=
"publicTotalPrice"
/
>
<!-- <el-table-column label="配置费用" prop="publicTotalPrice"/>--
>
<el-table-column
align=
"center"
label=
"操作"
>
<!-- <el-table-column align="center" label="操作">--
>
<
template
#
default=
"{row}"
>
<!-- <template #default="{row}">--
>
<el-popconfirm
title=
"确认删除当前订单吗"
width=
"180px"
@
confirm=
"confirmDel(row)"
>
<!-- <el-popconfirm title="确认删除当前订单吗" width="180px" @confirm="confirmDel(row)">--
>
<template
#
reference
>
<!-- <template #reference>--
>
<el-button
link
>
删除
</el-button
>
<!-- <el-button link>删除</el-button>--
>
</
template
>
<!-- </template>--
>
</el-popconfirm
>
<!-- </el-popconfirm>--
>
</template
>
<!-- </template>--
>
</el-table-column
>
<!-- </el-table-column>--
>
</el-table
>
<!-- </el-table>--
>
<pagination
<!-- <pagination-->
v-show=
"total > 0"
<!-- v-show="total > 0"-->
:total=
"total"
<!-- :total="total"-->
v-model:page=
"pageNum"
<!-- v-model:page="pageNum"-->
v-model:limit=
"pageSize"
<!-- v-model:limit="pageSize"-->
@
pagination=
"getList"
/
>
<!-- @pagination="getList"/>--
>
<div
v-if=
"tableData.length === 0"
class=
"empty-box"
>
<!-- <div v-if="tableData.length === 0" class="empty-box">--
>
<el-empty
description=
"暂无数据"
/
>
<!-- <el-empty description="暂无数据"/>--
>
</div
>
<!-- </div>--
>
</div
>
<!-- </div>--
>
</div
>
<!-- </div>--
>
<div
class=
"footer-bar"
>
<!-- <div class="footer-bar">--
>
<div
class=
"content flex-space-between flex-align-center"
>
<!-- <div class="content flex-space-between flex-align-center">--
>
<div
class=
"flex-align-center"
style=
"font-size: 16px"
>
<!-- <div class="flex-align-center" style="font-size: 16px">--
>
<span>
已选 ({{ ids.length }})
</span
>
<!-- <span>已选 ({{ ids.length }})</span>--
>
<el-popconfirm
title=
"确认删除当前订单吗"
width=
"180px"
@
confirm=
"confirmDel()"
>
<!-- <el-popconfirm title="确认删除当前订单吗" width="180px" @confirm="confirmDel()">--
>
<
template
#
reference
>
<!-- <template #reference>--
>
<div
>
<!-- <div>--
>
<el-button
<!-- <el-button-->
:disabled=
"!ids.length"
<!-- :disabled="!ids.length"-->
link
<!-- link-->
style=
"margin-left: 40px;margin-top:2px;font-size: 16px"
>
<!-- style="margin-left: 40px;margin-top:2px;font-size: 16px">--
>
删除
<!-- 删除-->
</el-button
>
<!-- </el-button>--
>
</div
>
<!-- </div>--
>
</
template
>
<!-- </template>--
>
</el-popconfirm
>
<!-- </el-popconfirm>--
>
</div
>
<!-- </div>--
>
<div
class=
"flex-align-center right"
>
<!-- <div class="flex-align-center right">--
>
<div
class=
"mr20"
>
<!-- <div class="mr20">--
>
<div
class=
"price"
>
¥{{ totalPrice }}
</div
>
<!-- <div class="price">¥{{ totalPrice }}</div>--
>
</div
>
<!-- </div>--
>
<el-button
:disabled=
"!ids.length"
type=
"primary"
@
click=
"submit"
>
提交
</el-button
>
<!-- <el-button :disabled="!ids.length" type="primary" @click="submit">提交</el-button>--
>
</div
>
<!-- </div>--
>
</div
>
<!-- </div>--
>
</div
>
<!-- </div>--
>
</div
>
<!-- </div>--
>
</template>
</template>
<
script
name=
"ConfirmOrder"
setup
>
<
!--<script name="ConfirmOrder" setup>--
>
import
{
<!--import {-->
shoppingList
,
<!-- shoppingList,-->
shoppingEdit
,
<!-- shoppingEdit,-->
shoppingDelete
,
<!-- shoppingDelete,-->
shoppingSubmit
,
<!-- shoppingSubmit,-->
shoppingComputerVo
<!-- shoppingComputerVo-->
}
from
'@/api/computingResource.js'
<!--} from '@/api/computingResource.js'-->
import
{
ref
,
computed
}
from
'vue'
<!--import {ref, computed} from 'vue'-->
import
{
ElMessageBox
}
from
'element-plus'
<!--import {ElMessageBox} from 'element-plus'-->
import
{
useRouter
}
from
'vue-router'
<!--import {useRouter} from 'vue-router'-->
const
router
=
useRouter
()
<!--const router = useRouter()-->
const
total
=
ref
(
0
)
<!--const total = ref(0)-->
const
pageNum
=
ref
(
1
)
<!--const pageNum = ref(1)-->
const
pageSize
=
ref
(
10
)
<!--const pageSize = ref(10)-->
const
tableData
=
ref
([])
<!--const tableData = ref([])-->
const
params
=
ref
([])
<!--const params = ref([])-->
function
getList
()
{
<!--function getList() {-->
shoppingList
({
pageNum
:
pageNum
.
value
,
pageSize
:
pageSize
.
value
}).
then
(
res
=>
{
<!-- shoppingList({pageNum: pageNum.value, pageSize: pageSize.value}).then(res => {-->
tableData
.
value
=
res
.
rows
<!-- tableData.value = res.rows-->
total
.
value
=
res
.
total
<!-- total.value = res.total-->
})
<!-- })-->
}
<!--}-->
const
handler
=
{
<!--const handler = {-->
get
(
target
,
propKey
)
{
<!-- get(target, propKey) {-->
return
target
[
propKey
];
<!-- return target[propKey];-->
}
<!-- }-->
};
<!--};-->
getList
()
<!--getList()-->
const
ids
=
ref
([])
<!--const ids = ref([])-->
function
tableSelectionChange
(
value
)
{
<!--function tableSelectionChange(value) {-->
ids
.
value
=
value
.
map
(
row
=>
row
.
id
)
<!-- ids.value = value.map(row => row.id)-->
shoppingComputer
()
<!-- shoppingComputer()-->
}
<!--}-->
const
headers
=
computed
(()
=>
{
<!--const headers = computed(() => {-->
if
(
tableData
.
value
.
length
>
0
&&
tableData
.
value
[
0
].
param
)
{
<!-- if (tableData.value.length > 0 && tableData.value[0].param) {-->
const
param
=
JSON
.
parse
(
tableData
.
value
[
0
].
param
)
<!-- const param = JSON.parse(tableData.value[0].param)-->
return
param
.
map
(
item
=>
({
<!-- return param.map(item => ({-->
name
:
item
.
name
<!-- name: item.name-->
}));
<!-- }));-->
}
<!-- }-->
return
[];
<!-- return [];-->
});
<!--});-->
const
getCellValue
=
(
params
,
headerName
)
=>
{
<!--const getCellValue = (params, headerName) => {-->
const
paramsCopy
=
JSON
.
parse
(
params
)
<!-- const paramsCopy = JSON.parse(params)-->
const
param
=
paramsCopy
.
find
(
item
=>
item
.
name
===
headerName
);
<!-- const param = paramsCopy.find(item => item.name === headerName);-->
return
param
?
param
.
valueName
:
''
;
<!-- return param ? param.valueName : '';-->
};
<!--};-->
// const totalPrice = computed(() => {
<!--// const totalPrice = computed(() => {-->
// const list = tableData.value.filter(item => {
<!--// const list = tableData.value.filter(item => {-->
// return ids.value.includes(item.id)
<!--// return ids.value.includes(item.id)-->
// })
<!--// })-->
// let price = 0
<!--// let price = 0-->
// list.forEach(i => price += parseFloat(i.publicTotalPrice))
<!--// list.forEach(i => price += parseFloat(i.publicTotalPrice))-->
// return price
<!--// return price-->
// })
<!--// })-->
function
editNum
(
row
)
{
<!--function editNum(row) {-->
shoppingEdit
({
id
:
row
.
id
,
useNum
:
row
.
useNum
}).
then
(
res
=>
{
<!-- shoppingEdit({id: row.id, useNum: row.useNum}).then(res => {-->
shoppingComputer
()
<!-- shoppingComputer()-->
getList
()
<!-- getList()-->
})
<!-- })-->
}
<!--}-->
const
totalPrice
=
ref
(
0
)
<!--const totalPrice = ref(0)-->
function
shoppingComputer
()
{
<!--function shoppingComputer() {-->
if
(
!
ids
.
value
.
length
)
{
<!-- if (!ids.value.length) {-->
totalPrice
.
value
=
0
<!-- totalPrice.value = 0-->
return
<!-- return-->
}
<!-- }-->
shoppingComputerVo
(
ids
.
value
).
then
(
res
=>
{
<!-- shoppingComputerVo(ids.value).then(res => {-->
totalPrice
.
value
=
res
.
data
.
totalPulicPrice
<!-- totalPrice.value = res.data.totalPulicPrice-->
})
<!-- })-->
}
<!--}-->
function
confirmDel
(
row
)
{
<!--function confirmDel(row) {-->
const
idsValue
=
row
?.
id
?
row
.
id
:
ids
.
value
<!-- const idsValue = row?.id ? row.id : ids.value-->
shoppingDelete
(
idsValue
).
then
(
res
=>
{
<!-- shoppingDelete(idsValue).then(res => {-->
getList
()
<!-- getList()-->
})
<!-- })-->
}
<!--}-->
function
submit
()
{
<!--function submit() {-->
ElMessageBox
.
confirm
(
<!-- ElMessageBox.confirm(-->
'确认提交订单吗'
,
<!-- '确认提交订单吗',-->
'提示'
,
<!-- '提示',-->
{
<!-- {-->
confirmButtonText
:
'确认提交'
,
<!-- confirmButtonText: '确认提交',-->
cancelButtonText
:
'关闭'
,
<!-- cancelButtonText: '关闭',-->
icon
:
'QuestionFilled'
<!-- icon: 'QuestionFilled'-->
}
<!-- }-->
).
then
(()
=>
{
<!-- ).then(() => {-->
shoppingSubmit
(
ids
.
value
).
then
(
res
=>
{
<!-- shoppingSubmit(ids.value).then(res => {-->
router
.
push
(
'/computingResource/orderResult'
)
<!-- router.push('/computingResource/orderResult')-->
})
<!-- })-->
}).
catch
(()
=>
{
<!-- }).catch(() => {-->
})
<!-- })-->
}
<!--}-->
<
/
script
>
<
!--</script>--
>
<
style
scoped
lang=
"scss"
>
<
!--<style scoped lang="scss">--
>
.app-container
{
<!--.app-container {-->
background-color
:
#F7F8F9
;
<!-- background-color: #F7F8F9;-->
padding
:
0
0
90px
;
<!-- padding: 0 0 90px;-->
min-height
:
100%
;
<!-- min-height: 100%;-->
}
<!--}-->
.page-title
{
<!--.page-title {-->
font-weight
:
bold
;
<!-- font-weight: bold;-->
font-size
:
22px
;
<!-- font-size: 22px;-->
color
:
#303233
;
<!-- color: #303233;-->
padding
:
12px
80px
;
<!-- padding: 12px 80px;-->
background-color
:
#FFFFFF
;
<!-- background-color: #FFFFFF;-->
>
div
{
<!-- > div {-->
width
:
1280px
;
<!-- width: 1280px;-->
margin
:
0
auto
;
<!-- margin: 0 auto;-->
}
<!-- }-->
}
<!--}-->
.page-main
{
<!--.page-main {-->
padding
:
30px
80px
;
<!-- padding: 30px 80px;-->
}
<!--}-->
.detail-info
{
<!--.detail-info {-->
width
:
1280px
;
<!-- width: 1280px;-->
margin
:
0
auto
;
<!-- margin: 0 auto;-->
padding
:
0
24px
24px
24px
;
<!-- padding: 0 24px 24px 24px;-->
background-color
:
#FFFFFF
;
<!-- background-color: #FFFFFF;-->
.el-table
{
<!-- .el-table {-->
:deep(.el-table__header-wrapper
)
th
{
<!-- :deep(.el-table__header-wrapper ) th {-->
background-color
:
#FFFFFF
!important
;
<!-- background-color: #FFFFFF !important;-->
font-size
:
14px
;
<!-- font-size: 14px;-->
}
<!-- }-->
:deep
(
td
.el-table__cell
)
{
<!-- :deep(td.el-table__cell) {-->
background-color
:
#F7F8F9
!important
;
<!-- background-color: #F7F8F9 !important;-->
}
<!-- }-->
}
<!-- }-->
//
table
{
<!-- //table {-->
//
border-collapse
:
collapse
;
<!-- // border-collapse: collapse;-->
//
}
<!-- //}-->
//
<!-- //-->
//
tbody
tr
:not
(
:last-child
)
td
{
<!-- //tbody tr:not(:last-child) td {-->
//
border-bottom
:
1px
solid
#d7d7d7
;
<!-- // border-bottom: 1px solid #d7d7d7;-->
//
}
<!-- //}-->
//
<!-- //-->
//
th
{
<!-- //th {-->
//
font-weight
:
500
;
<!-- // font-weight: 500;-->
//
font-size
:
14px
;
<!-- // font-size: 14px;-->
//
color
:
#303233
;
<!-- // color: #303233;-->
//
text-align
:
left
;
<!-- // text-align: left;-->
//
padding
:
16px
20px
;
<!-- // padding: 16px 20px;-->
//
}
<!-- //}-->
//
<!-- //-->
//
td
{
<!-- //td {-->
//
font-weight
:
400
;
<!-- // font-weight: 400;-->
//
font-size
:
14px
;
<!-- // font-size: 14px;-->
//
color
:
#303233
;
<!-- // color: #303233;-->
//
text-align
:
left
;
<!-- // text-align: left;-->
//
padding
:
16px
20px
;
<!-- // padding: 16px 20px;-->
//
background-color
:
#F7F8F9
;
<!-- // background-color: #F7F8F9;-->
//
}
<!-- //}-->
}
<!--}-->
.empty-box
{
<!--.empty-box {-->
display
:
flex
;
<!-- display: flex;-->
justify-content
:
center
;
<!-- justify-content: center;-->
align-items
:
center
;
<!-- align-items: center;-->
min-height
:
650px
;
<!-- min-height: 650px;-->
}
<!--}-->
.footer-bar
{
<!--.footer-bar {-->
padding
:
18px
;
<!-- padding: 18px;-->
background-color
:
#FFFFFF
;
<!-- background-color: #FFFFFF;-->
position
:
fixed
;
<!-- position: fixed;-->
z-index
:
99
;
<!-- z-index: 99;-->
bottom
:
0
;
<!-- bottom: 0;-->
width
:
100%
;
<!-- width: 100%;-->
-webkit-box-shadow
:
2px
0
6px
rgba
(
0
,
21
,
41
,
0.25
);
<!-- -webkit-box-shadow: 2px 0 6px rgba(0, 21, 41, 0.25);-->
.content
{
<!-- .content {-->
margin
:
0
auto
;
<!-- margin: 0 auto;-->
width
:
1280px
;
<!-- width: 1280px;-->
}
<!-- }-->
.price
{
<!-- .price {-->
font-weight
:
bold
;
<!-- font-weight: bold;-->
font-size
:
24px
;
<!-- font-size: 24px;-->
color
:
#FF9811
;
<!-- color: #FF9811;-->
&
+
div
{
<!-- & + div {-->
font-weight
:
400
;
<!-- font-weight: 400;-->
font-size
:
14px
;
<!-- font-size: 14px;-->
color
:
#949899
;
<!-- color: #949899;-->
text-align
:
right
;
<!-- text-align: right;-->
}
<!-- }-->
}
<!-- }-->
.right
.el-button
{
<!-- .right .el-button {-->
width
:
180px
;
<!-- width: 180px;-->
height
:
46px
;
<!-- height: 46px;-->
font-size
:
20px
;
<!-- font-size: 20px;-->
border-radius
:
2px
2px
2px
2px
;
<!-- border-radius: 2px 2px 2px 2px;-->
}
<!-- }-->
}
<!--}-->
<
/
style
>
<
!--</style>--
>
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