Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
杨炀
/
ztx_wx_gzt
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
7d6c26f4
authored
2026-04-15 14:03:15 +0800
by
张猛
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
道馆个人,级位缴费
1 parent
c1b557f6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
231 additions
and
200 deletions
common/api.js
common/pay.js
level/apply.vue
level/paymentDetail.vue
myCenter/goPay.vue
myCenter/payOrder.vue
common/api.js
View file @
7d6c26f
...
...
@@ -1429,11 +1429,10 @@ export function checkBusinessLicense(data) {
}
// 生成单位订单renewYear
export
function
certifiedNew
(
data
)
{
export
function
certifiedNew
(
renewYear
)
{
return
request
({
url
:
`/system/certifiedNew/commit
`
,
url
:
`/system/certifiedNew/commit?renewYear=
${
renewYear
}
`
,
method
:
'post'
,
params
:
data
})
}
...
...
@@ -1519,9 +1518,9 @@ export function getMyStatus() {
}
// 个人会员缴费支付
export
function
goPay
(
id
)
{
export
function
goPay
(
id
,
payType
)
{
return
request
({
url
:
`/person/paymentRangeNew/pay/
${
id
}
`
,
url
:
`/person/paymentRangeNew/pay/
${
id
}
/
${
payType
}
`
,
method
:
'post'
})
}
...
...
@@ -1728,11 +1727,11 @@ export function confirmExam(examId) {
}
// 提交级位考试订单
export
function
commitJiExam
(
data
)
{
export
function
commitJiExam
(
params
)
{
return
request
({
url
:
`/exam/
person/commitJi
`
,
url
:
`/exam/
info/commitJi/
${
params
.
id
}
/
${
params
.
addresId
}
/
${
params
.
payType
}
`
,
method
:
'post'
,
data
params
})
}
...
...
common/pay.js
View file @
7d6c26f
...
...
@@ -23,7 +23,7 @@ const ERROR_MESSAGES = {
* @async
* @param {string} orderId - 订单ID,用于错误处理和取消订单
* @param {string} encryptedData - 加密数据
* @returns {Promise<
void
>}
* @returns {Promise<
string
>}
* @throws {Error} 支付过程中发生的错误
*/
async
function
minShengPay
(
orderId
,
encryptedData
)
{
...
...
@@ -86,14 +86,13 @@ async function minShengPay(orderId, encryptedData) {
uni
.
hideLoading
()
// 8. 调起微信支付
const
[
payErr
]
=
await
to
(
invokeWechatPayment
(
payParams
,
orderId
))
const
[
payErr
,
paySuccess
]
=
await
to
(
invokeWechatPayment
(
payParams
,
orderId
))
if
(
payErr
)
{
handlePaymentError
(
payErr
,
orderId
)
}
//
if (paySuccess) {
// return paySuccess
//
}
if
(
paySuccess
)
{
return
'OK'
}
}
/**
...
...
@@ -213,10 +212,10 @@ function invokeWechatPayment(payParams, orderId) {
signType
:
payParams
.
signType
,
paySign
:
payParams
.
paySign
,
success
:
(
res
)
=>
{
resolve
(
res
)
uni
.
showToast
({
title
:
'支付成功'
,
duration
:
2000
,
complete
:
()
=>
resolve
(
res
)
})
},
fail
:
async
(
err
)
=>
{
...
...
level/apply.vue
View file @
7d6c26f
<
template
>
<view>
<view
class=
"searchbar"
>
<uni-easyinput
placeholderStyle=
"font-size:30rpx"
:input-border=
"false"
prefixIcon=
"search
"
v-model=
"queryParams.name"
placeholder=
"搜索考级名称
"
@
blur=
"getList"
@
clear=
"getList"
>
<uni-easyinput
v-model=
"queryParams.name"
:input-border=
"false"
placeholder=
"搜索考级名称
"
placeholderStyle=
"font-size:30rpx"
prefixIcon=
"search
"
@
blur=
"getList"
@
clear=
"getList"
>
</uni-easyinput>
<view
class=
"invertedbtn-red"
v-if=
"isExam=='0'
"
@
click=
"goAdd"
>
+ 添加级位考试
</view>
<view
v-if=
"isExam=='0'"
class=
"invertedbtn-red
"
@
click=
"goAdd"
>
+ 添加级位考试
</view>
</view>
<view
class=
"appList"
>
<view
class=
"appItem"
v-for=
"(item,index) in list"
:key=
"item.examId || index
"
>
<view
v-for=
"(item,index) in list"
:key=
"item.examId || index"
class=
"appItem
"
>
<view
class=
"status"
@
click=
"goDetail(item)"
>
<text
v-if=
"item.status=='0'"
class=
"text-primary"
>
{{
item
.
statusStr
}}
</text>
<text
v-if=
"item.status=='1'"
class=
"text-primary"
>
{{
item
.
statusStr
}}
</text>
...
...
@@ -15,69 +15,77 @@
<text
v-if=
"item.status=='3'"
class=
"text-danger"
>
{{
item
.
statusStr
}}
</text>
<text
v-if=
"item.status=='4'"
class=
"text-warning"
>
{{
item
.
statusStr
}}
</text>
</view>
<view
class=
"date"
v-if=
"item.status!='0'&&item.submitTime"
>
提交时间:
{{
item
.
submitTime
}}
</view>
<view
class=
"mt0"
@
click=
"goDetail(item)"
><text
class=
"text-primary"
>
{{
item
.
examCode
}}
</text></view>
<view
class=
"name mt0"
@
click=
"goDetail(item)"
>
{{
item
.
name
}}
</view>
<view
class=
"pp esp"
>
申请单位:
{{
item
.
memberName
}}
</view>
<view
class=
"pp esp"
>
考级日期:
{{
item
.
startTime
.
substring
(
0
,
16
)
}}
至
{{
item
.
endTime
.
substring
(
0
,
16
)
}}
</view>
<view
v-if=
"item.status!='0'&&item.submitTime"
class=
"date"
>
提交时间:
{{
item
.
submitTime
}}
</view>
<view
class=
"mt0"
@
click=
"goDetail(item)"
>
<text
class=
"text-primary"
>
{{
item
.
examCode
}}
</text>
</view>
<view
class=
"name mt0"
@
click=
"goDetail(item)"
>
{{
item
.
name
}}
</view>
<view
class=
"pp esp"
>
申请单位:
{{
item
.
memberName
}}
</view>
<view
class=
"pp esp"
>
考级日期:
{{
item
.
startTime
?.
substring
(
0
,
16
)
}}
至
{{
item
.
endTime
?.
substring
(
0
,
16
)
}}
</view>
<view
class=
"flexbox"
@
click=
"goDetail(item)"
>
<view>
申请日期
<view>
{{
item
.
applyTime
.
substring
(
0
,
10
)
}}
</view>
<view>
{{
item
.
applyTime
?.
substring
(
0
,
10
)
}}
</view>
</view>
<view>
考官
<view>
{{
item
.
examinerNames
}}
</view>
<view>
{{
item
.
examinerNames
}}
</view>
</view>
<view>
通过人数
<view>
{{
item
.
pass
}}
</view>
<view>
{{
item
.
pass
}}
</view>
</view>
</view>
<view
class=
"func"
v-if=
"item.status=='0'||item.status=='3'||item.status=='4'"
>
<button
@
click=
"handleDelete(item)"
>
删除
</button>
<button
@
click=
"editThis(item)"
>
编辑
</button>
<button
:disabled=
"!(item.totalNum?item.totalNum:(item.pass+item.noPass))"
@
click=
"handleSubmit(item)"
>
提交审核
</button>
<view
v-if=
"item.status=='0'||item.status=='3'||item.status=='4'||item.status=='9'"
class=
"func"
>
<button
:disabled=
"item.status=='1'||item.status=='2'||item.status=='3'"
@
click=
"handleDelete(item)"
>
删除
</button>
<button
:disabled=
"!(item.status=='0')"
@
click=
"editThis(item)"
>
编辑
</button>
<button
:disabled=
"item.status!='0'&&item.status!='9'||item.totalNum==0||item.pass==0"
@
click=
"handleSubmit(item)"
>
提交审核
</button>
</view>
</view>
</view>
<view
class=
"nodata"
v-if=
"list.length==0"
>
<image
mode=
"aspectFit"
:src=
"config.baseUrl_api + '/fs/static/nodata.png'"
></image>
<view
v-if=
"list.length==0"
class=
"nodata"
>
<image
:src=
"config.baseUrl_api + '/fs/static/nodata.png'"
mode=
"aspectFit"
></image>
<text>
暂无数据
</text>
</view>
</view>
</
template
>
<
script
setup
>
import
*
as
api
from
'@/common/api.js'
import
config
from
'@/config.js'
import
{
import
*
as
api
from
'@/common/api.js'
import
config
from
'@/config.js'
import
{
onMounted
,
ref
}
from
'vue'
import
{
}
from
'vue'
import
{
onLoad
,
onShow
}
from
'@dcloudio/uni-app'
const
app
=
getApp
();
const
queryParams
=
ref
({
}
from
'@dcloudio/uni-app'
const
app
=
getApp
();
const
queryParams
=
ref
({
// pageNum: 1,
// pageSize: 10
type
:
'1'
,
rankStatus
:
'0'
})
const
navs
=
ref
([
'未提交'
,
'审核中'
,
'审核通过'
,
'审核拒绝'
])
const
current
=
ref
()
const
list
=
ref
([])
const
total
=
ref
(
0
)
const
deptType
=
ref
(
''
)
const
userType
=
ref
(
''
)
const
isExam
=
ref
(
'1'
)
onShow
(()
=>
{
})
const
navs
=
ref
([
'未提交'
,
'审核中'
,
'审核通过'
,
'审核拒绝'
])
const
current
=
ref
()
const
list
=
ref
([])
const
total
=
ref
(
0
)
const
deptType
=
ref
(
''
)
const
userType
=
ref
(
''
)
const
isExam
=
ref
(
'1'
)
onShow
(()
=>
{
if
(
app
.
globalData
.
isLogin
)
{
init
()
}
else
{
...
...
@@ -86,9 +94,9 @@
init
()
};
}
})
})
function
init
()
{
function
init
()
{
uni
.
showLoading
({
title
:
'加载中'
,
mask
:
true
...
...
@@ -97,36 +105,36 @@
userType
.
value
=
app
.
globalData
.
userType
isExam
.
value
=
app
.
globalData
.
isExam
getList
()
}
}
function
getList
()
{
function
getList
()
{
api
.
getLevelList
(
queryParams
.
value
).
then
(
res
=>
{
uni
.
hideLoading
()
list
.
value
=
res
.
rows
total
.
value
=
res
.
total
})
}
}
function
goAdd
()
{
function
goAdd
()
{
let
path
=
`/level/addApply`
uni
.
navigateTo
({
url
:
path
});
}
}
function
editThis
(
item
)
{
function
editThis
(
item
)
{
let
path
=
`/level/addApply?examId=
${
item
.
examId
}
`
uni
.
navigateTo
({
url
:
path
});
}
}
function
handleSubmit
(
item
)
{
function
handleSubmit
(
item
)
{
uni
.
showModal
({
title
:
'提示'
,
content
:
`请确认人员照片是否已更新`
,
success
:
function
(
res
)
{
success
:
function
(
res
)
{
if
(
res
.
confirm
)
{
// 跳转到付款详情页面
uni
.
navigateTo
({
...
...
@@ -135,20 +143,21 @@
}
}
})
}
function
handleDelete
(
row
)
{
}
function
handleDelete
(
row
)
{
uni
.
showModal
({
title
:
'提示'
,
content
:
`确定删除
${
row
.
name
}
吗`
,
success
:
function
(
res
)
{
success
:
function
(
res
)
{
if
(
res
.
confirm
)
{
uni
.
showLoading
({
title
:
`删除中`
})
api
.
delLevel
(
row
.
examId
).
then
(
res
=>
{
api
.
delLevel
(
row
.
examId
).
then
(
res
=>
{
uni
.
showToast
({
title
:
'操作成功!'
,
icon
:
'none'
title
:
'操作成功!'
,
icon
:
'none'
})
uni
.
hideLoading
()
getList
()
...
...
@@ -156,9 +165,9 @@
}
}
})
}
}
function
upApply
(
id
)
{
function
upApply
(
id
)
{
api
.
submitVerity
(
id
).
then
(
res
=>
{
uni
.
hideLoading
()
getList
()
...
...
@@ -166,10 +175,10 @@
title
:
`提交成功`
})
})
}
}
function
goDetail
(
item
)
{
function
goDetail
(
item
)
{
if
(
item
.
status
!=
'0'
)
{
let
path
=
`/level/applyDetail?examId=
${
item
.
examId
}
`
uni
.
navigateTo
({
...
...
@@ -180,12 +189,12 @@
editThis
(
item
)
}
}
}
</
script
>
<
style
scoped
lang=
"scss"
>
.searchbar
{
<
style
lang=
"scss"
scoped
>
.searchbar
{
display
:
flex
;
align-items
:
center
;
padding
:
25
rpx
;
...
...
@@ -208,14 +217,14 @@
font-size
:
30
rpx
;
padding
:
10
rpx
20
rpx
;
}
}
}
.mt0
{
.mt0
{
margin-top
:
0
!important
;
}
}
.appList
.appItem
.name
{
.appList
.appItem
.name
{
width
:
80%
;
word-break
:
break-all
;
}
}
</
style
>
...
...
level/paymentDetail.vue
View file @
7d6c26f
<
template
>
<view
class=
"payment-page"
>
<!-- 加载状态 -->
<view
class=
"loading-wrap"
v-if=
"loading
"
>
<view
v-if=
"loading"
class=
"loading-wrap
"
>
<text>
加载中...
</text>
</view>
...
...
@@ -24,7 +24,7 @@
<text
class=
"manage-btn"
@
click=
"goAddressManage"
>
管理地址
</text>
</view>
<view
class=
"address-content"
v-if=
"selectedAddress.id
"
@
click=
"goAddressManage"
>
<view
v-if=
"selectedAddress.id"
class=
"address-content
"
@
click=
"goAddressManage"
>
<view
class=
"address-region"
>
{{
selectedAddress
.
province
}}
{{
selectedAddress
.
city
}}
{{
selectedAddress
.
area
}}
</view>
...
...
@@ -33,11 +33,11 @@
</view>
<view
class=
"address-contact"
>
{{
selectedAddress
.
name
}}
{{
selectedAddress
.
phone
}}
<view
class=
"default-tag"
v-if=
"selectedAddress.defaultFlag == 1
"
>
默认
</view>
<view
v-if=
"selectedAddress.defaultFlag == 1"
class=
"default-tag
"
>
默认
</view>
</view>
</view>
<view
class=
"empty-address"
v-else
@
click=
"goAddressManage"
>
<view
v-else
class=
"empty-address"
@
click=
"goAddressManage"
>
<text
class=
"empty-tip"
>
请添加收货地址
</text>
<text
class=
"arrow"
>
›
</text>
</view>
...
...
@@ -55,10 +55,10 @@
<text
class=
"value"
>
{{
examData
.
allCount
||
0
}}
人
</text>
</view>
<view
class=
"info-row level-row"
v-if=
"levelTags.length > 0
"
>
<view
v-if=
"levelTags.length > 0"
class=
"info-row level-row
"
>
<text
class=
"label"
>
级别分布
</text>
<view
class=
"level-tags"
>
<view
class=
"level-tag"
v-for=
"tag in levelTags"
:key=
"tag.level
"
>
<view
v-for=
"tag in levelTags"
:key=
"tag.level"
class=
"level-tag
"
>
{{
tag
.
name
}}
级
{{
tag
.
count
}}
人
</view>
</view>
...
...
@@ -76,7 +76,7 @@
<view
class=
"section-title"
>
支付方式
</view>
<view
class=
"payment-methods"
>
<view
class=
"payment-item selected"
>
<image
class=
"icon"
:src=
"config.baseUrl_api + '/fs/static/min.png'
"
mode=
"widthFix"
></image>
<image
:src=
"config.baseUrl_api + '/fs/static/min.png'"
class=
"icon
"
mode=
"widthFix"
></image>
<text
class=
"payment-name"
>
民生付
</text>
<view
class=
"check-icon"
>
✓
</view>
</view>
...
...
@@ -91,23 +91,24 @@
<text
class=
"total-price"
>
¥
{{
(
Number
(
examData
.
allFee
)
||
0
).
toFixed
(
2
)
}}
</text>
</view>
<view
class=
"submit-btn"
:class=
"
{ disabled: !selectedAddress.id }"
class="submit-btn"
@click="handleSubmit"
>
提交订单
</view>
</view>
<view
class=
"tip-text"
v-if=
"!selectedAddress.id
"
>
请先选择邮寄地址
</view>
<view
v-if=
"!selectedAddress.id"
class=
"tip-text
"
>
请先选择邮寄地址
</view>
</view>
</
template
>
<
script
setup
>
import
{
ref
,
computed
,
onMounted
}
from
'vue'
;
import
{
onLoad
,
onShow
}
from
'@dcloudio/uni-app'
;
import
{
ref
,
computed
,
onMounted
}
from
'vue'
;
import
{
onLoad
,
onShow
}
from
'@dcloudio/uni-app'
;
import
*
as
api
from
'@/common/api.js'
;
import
config
from
'@/config.js'
import
{
minShengPay
}
from
'@/common/pay.js'
;
const
examId
=
ref
(
''
);
const
loading
=
ref
(
true
);
...
...
@@ -179,7 +180,7 @@ const initData = async () => {
}
}
catch
(
e
)
{
console
.
error
(
'获取考试信息失败'
,
e
);
uni
.
showToast
({
title
:
'加载失败'
,
icon
:
'none'
});
uni
.
showToast
({
title
:
'加载失败'
,
icon
:
'none'
});
}
finally
{
loading
.
value
=
false
;
}
...
...
@@ -204,7 +205,7 @@ const goAddressManage = () => {
const
handleSubmit
=
async
()
=>
{
if
(
!
selectedAddress
.
value
.
id
)
{
return
uni
.
showToast
({
title
:
'请先选择地址'
,
icon
:
'none'
});
return
uni
.
showToast
({
title
:
'请先选择地址'
,
icon
:
'none'
});
}
uni
.
showModal
({
...
...
@@ -212,55 +213,65 @@ const handleSubmit = async () => {
content
:
`确定提交订单吗?`
,
success
:
async
(
res
)
=>
{
if
(
res
.
confirm
)
{
uni
.
showLoading
({
title
:
'提交中...'
});
uni
.
showLoading
({
title
:
'提交中...'
});
try
{
const
commitRes
=
await
api
.
commitJiExam
({
addresId
:
selectedAddress
.
value
.
id
,
id
:
examId
.
value
});
if
(
commitRes
.
data
&&
commitRes
.
data
.
orderId
)
{
// 有支付流程,调用支付
const
payRes
=
await
api
.
payJiExam
(
commitRes
.
data
.
orderId
);
uni
.
hideLoading
();
if
(
payRes
.
data
&&
payRes
.
data
.
payResult
&&
payRes
.
data
.
payResult
.
encryptedData
)
{
// 调用支付
uni
.
requestPayment
({
provider
:
'wxpay'
,
timeStamp
:
payRes
.
data
.
payResult
.
timeStamp
,
nonceStr
:
payRes
.
data
.
payResult
.
nonceStr
,
package
:
payRes
.
data
.
payResult
.
package
,
signType
:
payRes
.
data
.
payResult
.
signType
,
paySign
:
payRes
.
data
.
payResult
.
paySign
,
success
:
()
=>
{
uni
.
showToast
({
title
:
'支付成功'
,
icon
:
'success'
});
setTimeout
(()
=>
{
uni
.
navigateBack
();
},
1500
);
},
fail
:
()
=>
{
uni
.
showToast
({
title
:
'支付失败'
,
icon
:
'none'
});
}
id
:
examId
.
value
,
payType
:
'2'
});
}
else
{
// 无需支付,直接成功
uni
.
showToast
({
title
:
'提交成功'
,
icon
:
'success'
});
if
(
commitRes
.
data
&&
commitRes
.
data
.
payResult
.
encryptedData
)
{
const
res
=
await
minShengPay
(
commitRes
.
data
.
orderId
,
commitRes
.
data
.
payResult
.
encryptedData
)
if
(
res
==
'OK'
)
{
uni
.
showToast
({
title
:
'支付成功'
,
icon
:
'success'
});
setTimeout
(()
=>
{
uni
.
navigateBack
();
},
1500
);
}
}
else
{
uni
.
hideLoading
();
uni
.
showToast
({
title
:
'提交成功'
,
icon
:
'success'
});
setTimeout
(()
=>
{
uni
.
navigateBack
();
},
1500
);
}
},
1500
)
}
}
// if (commitRes.data && commitRes.data.orderId) {
// // 有支付流程,调用支付
// const payRes = await api.payJiExam(commitRes.data.orderId);
// uni.hideLoading();
//
// if (payRes.data && payRes.data.payResult && payRes.data.payResult.encryptedData) {
// // 调用支付
// uni.requestPayment({
// provider: 'wxpay',
// timeStamp: payRes.data.payResult.timeStamp,
// nonceStr: payRes.data.payResult.nonceStr,
// package: payRes.data.payResult.package,
// signType: payRes.data.payResult.signType,
// paySign: payRes.data.payResult.paySign,
// success: () => {
// uni.showToast({title: '支付成功', icon: 'success'});
// setTimeout(() => {
// uni.navigateBack();
// }, 1500);
// },
// fail: () => {
// uni.showToast({title: '支付失败', icon: 'none'});
// }
// });
// } else {
// // 无需支付,直接成功
// uni.showToast({title: '提交成功', icon: 'success'});
// setTimeout(() => {
// uni.navigateBack();
// }, 1500);
// }
// } else {
// uni.hideLoading();
// uni.showToast({title: '提交成功', icon: 'success'});
// setTimeout(() => {
// uni.navigateBack();
// }, 1500);
// }
}
catch
(
e
)
{
uni
.
hideLoading
();
console
.
error
(
'提交失败'
,
e
);
uni
.
showToast
({
title
:
'提交失败'
,
icon
:
'none'
});
uni
.
showToast
({
title
:
'提交失败'
,
icon
:
'none'
});
}
}
}
...
...
@@ -573,11 +584,13 @@ const handleSubmit = async () => {
}
}
}
.icon
{
width
:
40
rpx
;
height
:
40
rpx
;
margin-right
:
10
rpx
;
}
}
.tip-text
{
position
:
fixed
;
bottom
:
130
rpx
;
...
...
myCenter/goPay.vue
View file @
7d6c26f
...
...
@@ -7,7 +7,7 @@
<text
class=
"info-label"
>
缴费单位
</text>
<text
class=
"info-value"
>
{{
payName
||
'-'
}}
</text>
</view>
<view
class=
"info-row"
v-if=
"assoName
"
>
<view
v-if=
"assoName"
class=
"info-row
"
>
<text
class=
"info-label"
>
所属协会
</text>
<text
class=
"info-value"
>
{{
assoName
||
'-'
}}
</text>
</view>
...
...
@@ -17,13 +17,15 @@
<view
class=
"yearRow"
>
<view
class=
"label"
>
缴费年限
</view>
<view
class=
"control"
>
<image
v-if=
"form.renewYear > 1"
class=
"icon"
mode=
"widthFix"
:src=
"config.baseUrl_api + '/fs/static/dd_02.png'"
<image
v-if=
"form.renewYear > 1"
:src=
"config.loginImage_api + '/fs/static/dd_02.png'"
class=
"icon"
mode=
"widthFix"
@
click=
"minusYear"
></image>
<image
v-else
class=
"icon"
mode=
"widthFix"
:src=
"config.baseUrl_api + '/fs/static/dd_02_g.png'
"
></image>
<image
v-else
:src=
"config.loginImage_api + '/fs/static/dd_02_g.png'"
class=
"icon"
mode=
"widthFix
"
></image>
<text
class=
"num"
>
{{
form
.
renewYear
}}
年
</text>
<image
v-if=
"form.renewYear
< 5
"
class=
"icon"
mode=
"widthFix"
:src=
"config.baseUrl_api + '/fs/static/btn_03.png'"
<image
v-if=
"form.renewYear
< 5
"
:src=
"config.loginImage_api + '/fs/static/btn_03.png'"
class=
"icon"
mode=
"widthFix"
@
click=
"plusYear"
></image>
<image
v-else
class=
"icon"
mode=
"widthFix"
:src=
"config.baseUrl_api + '/fs/static/btn_03_g.png'
"
></image>
<image
v-else
:src=
"config.loginImage_api + '/fs/static/btn_03_g.png'"
class=
"icon"
mode=
"widthFix
"
></image>
</view>
</view>
</view>
...
...
@@ -47,7 +49,7 @@
<label
class=
"radioItem"
>
<radio
:checked=
"payType === '1'"
class=
"custom-radio"
value=
"1"
/>
<view
class=
"payInfo"
>
<image
class=
"icon"
mode=
"widthFix"
:src=
"config.baseUrl_api + '/fs/static/min.png'
"
></image>
<image
:src=
"config.baseUrl_api + '/fs/static/min.png'"
class=
"icon"
mode=
"widthFix
"
></image>
<text>
民生付
</text>
</view>
</label>
...
...
@@ -84,6 +86,7 @@ import to from 'await-to-js'
import
*
as
api
from
'@/common/api.js'
import
{
minShengPay
}
from
'@/common/pay.js'
import
config
from
'@/config.js'
const
form
=
ref
({
renewYear
:
1
})
...
...
@@ -138,14 +141,10 @@ const handelPay = async () => {
title
:
'支付中...'
,
mask
:
true
})
if
(
isPaying
.
value
)
return
isPaying
.
value
=
true
// 创建订单 - 参考PC端逻辑
const
[
orderErr
,
orderRes
]
=
await
to
(
api
.
certifiedNew
({
renewYear
:
form
.
value
.
renewYear
,
type
:
'1'
,
url
:
''
}))
const
[
orderErr
,
orderRes
]
=
await
to
(
api
.
certifiedNew
(
form
.
value
.
renewYear
))
if
(
orderErr
)
{
uni
.
hideLoading
()
isPaying
.
value
=
false
...
...
@@ -168,11 +167,14 @@ const handelPay = async () => {
}
if
(
data
.
payResult
&&
data
.
payResult
.
encryptedData
)
{
try
{
await
minShengPay
(
data
.
orderId
,
data
.
payResult
.
encryptedData
)
const
res
=
await
minShengPay
(
data
.
orderId
,
data
.
payResult
.
encryptedData
)
if
(
res
==
'OK'
)
{
isPaying
.
value
=
false
// 支付成功,跳转到成功页面
uni
.
redirectTo
({
url
:
`/myCenter/sucPay?orderId=
${
data
.
orderId
}
`
})
}
}
catch
(
e
)
{
console
.
error
(
'支付失败'
,
e
)
uni
.
hideLoading
()
...
...
@@ -185,12 +187,12 @@ const handelPay = async () => {
}
onLoad
((
option
)
=>
{
console
.
log
(
66
,
option
)
console
.
log
(
66
,
option
)
// 接收年限
form
.
value
.
renewYear
=
Number
(
option
.
renewYear
||
1
)
// 接收缴费单位和所属协会
payName
.
value
=
decodeURIComponent
(
option
.
payName
||
''
)
console
.
log
(
77
,
payName
.
value
)
console
.
log
(
77
,
payName
.
value
)
assoName
.
value
=
decodeURIComponent
(
option
.
assoName
||
''
)
// 初始化获取费用和优惠
init
()
...
...
@@ -237,7 +239,7 @@ async function getZtxDiscountPolicyApi() {
}
</
script
>
<
style
scoped
lang=
"scss"
>
<
style
lang=
"scss"
scoped
>
/* 整体容器 */
.container
{
min-height
:
100vh
;
...
...
myCenter/payOrder.vue
View file @
7d6c26f
...
...
@@ -32,9 +32,9 @@
<radio-group
:value=
"payType"
@
change=
"handlePayTypeChange"
>
<label
class=
"radio-item"
>
<!-- checked属性实现默认勾选 -->
<radio
value=
"0"
color=
"#E60012"
:checked=
"payType === '0'"
/>
<radio
:checked=
"payType === '0'"
color=
"#E60012"
value=
"0"
/>
<view
class=
"pay-method"
>
<image
class=
"icon"
:src=
"config.baseUrl_api + '/fs/static/min.png'
"
mode=
"widthFix"
></image>
<image
:src=
"config.baseUrl_api + '/fs/static/min.png'"
class=
"icon
"
mode=
"widthFix"
></image>
<text
class=
"pay-name"
>
民生付
</text>
</view>
</label>
...
...
@@ -43,36 +43,38 @@
<!-- 底部支付按钮 -->
<view
class=
"fixed-bottom"
>
<button
class=
"pay-btn red-bg"
:loading=
"payLoadin
g"
@
click=
"handlePay"
>
立即支付
</button>
<button
:loading=
"payLoading"
class=
"pay-btn red-b
g"
@
click=
"handlePay"
>
立即支付
</button>
</view>
</view>
</
template
>
<
script
setup
>
import
{
import
{
ref
}
from
'vue'
import
{
}
from
'vue'
import
{
onLoad
}
from
'@dcloudio/uni-app'
;
import
*
as
api
from
'@/common/api.js'
import
config
from
'@/config.js'
// 核心数据
const
formData
=
ref
({})
// 订单统计数据
const
rangeId
=
ref
(
''
)
// 核心业务ID
const
payType
=
ref
(
'0'
)
// 支付方式(默认0=民生付)
const
payLoading
=
ref
(
false
)
// 支付按钮加载状态
// 页面加载接收参数
onLoad
(
async
(
options
)
=>
{
}
from
'@dcloudio/uni-app'
;
import
*
as
api
from
'@/common/api.js'
import
config
from
'@/config.js'
import
{
minShengPay
}
from
"@/common/pay"
;
// 核心数据
const
formData
=
ref
({})
// 订单统计数据
const
rangeId
=
ref
(
''
)
// 核心业务ID
const
payType
=
ref
(
'0'
)
// 支付方式(默认0=民生付)
const
payLoading
=
ref
(
false
)
// 支付按钮加载状态
// 页面加载接收参数
onLoad
(
async
(
options
)
=>
{
console
.
log
(
'订单ID:'
,
options
.
rangeId
)
if
(
options
.
rangeId
)
{
rangeId
.
value
=
options
.
rangeId
await
getCount
()
}
})
})
async
function
getCount
()
{
async
function
getCount
()
{
try
{
const
res
=
await
api
.
getNewCountByRangeId
(
rangeId
.
value
)
formData
.
value
=
res
.
data
||
{
...
...
@@ -87,15 +89,15 @@
old
:
0
}
}
}
}
// 支付方式切换
function
handlePayTypeChange
(
e
)
{
// 支付方式切换
function
handlePayTypeChange
(
e
)
{
payType
.
value
=
e
.
detail
.
value
}
}
// 立即支付核心逻辑
async
function
handlePay
()
{
// 立即支付核心逻辑
async
function
handlePay
()
{
// 基础校验
if
(
!
rangeId
.
value
||
rangeId
.
value
===
'-1'
)
{
return
uni
.
showToast
({
...
...
@@ -106,13 +108,20 @@
try
{
payLoading
.
value
=
true
const
res
=
await
api
.
goPay
(
rangeId
.
value
)
if
(
res
.
data
?.
orderId
)
{
await
api
.
pcallBack2
(
res
.
data
.
orderId
)
uni
.
redirectTo
({
url
:
`/myCenter/sucPay?rangeId=
${
rangeId
.
value
}
from=payOrder`
})
const
res
=
await
api
.
goPay
(
rangeId
.
value
,
'2'
)
if
(
res
.
data
.
payResult
&&
res
.
data
.
payResult
.
encryptedData
)
{
const
reason
=
await
minShengPay
(
res
.
data
.
orderId
,
res
.
data
.
payResult
.
encryptedData
)
if
(
reason
==
'OK'
)
{
// // 支付成功,跳转到成功页面
// uni.redirectTo({
// url: `/myCenter/sucPay?orderId=${res.data.orderId}`
// })
uni
.
showToast
({
title
:
'支付成功'
,
icon
:
'success'
});
setTimeout
(()
=>
{
uni
.
navigateBack
();
},
1500
)
}
}
// 跳转到支付成功页
...
...
@@ -126,23 +135,23 @@
}
finally
{
payLoading
.
value
=
false
}
}
}
</
script
>
<
style
scoped
lang=
"scss"
>
.pay-order-container
{
<
style
lang=
"scss"
scoped
>
.pay-order-container
{
padding
:
30
rpx
;
background-color
:
#fff
;
min-height
:
100vh
;
box-sizing
:
border-box
;
}
}
.icon
{
.icon
{
width
:
30px
;
}
}
//
页面头部
.page-header
{
//
页面头部
.page-header
{
text-align
:
center
;
padding
:
20
rpx
0
;
border-bottom
:
1px
solid
#eee
;
...
...
@@ -153,10 +162,10 @@
font-weight
:
600
;
color
:
#333
;
}
}
}
//
订单信息区域
.order-info
{
//
订单信息区域
.order-info
{
margin-bottom
:
60
rpx
;
.info-item
{
...
...
@@ -194,10 +203,10 @@
font-size
:
38
rpx
;
}
}
}
}
//
支付方式区域
.pay-type-section
{
//
支付方式区域
.pay-type-section
{
margin-bottom
:
80
rpx
;
.section-title
{
...
...
@@ -225,10 +234,10 @@
}
}
}
}
}
//
底部支付按钮
.fixed-bottom
{
//
底部支付按钮
.fixed-bottom
{
position
:
fixed
;
bottom
:
0
;
left
:
0
;
...
...
@@ -250,5 +259,5 @@
background-color
:
#E60012
;
color
:
#fff
;
}
}
}
</
style
>
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment