Compare commits

...

3 Commits

Author SHA1 Message Date
唐明明
04fd83c21e 调整支付功能 2023-07-12 13:47:37 +08:00
唐明明
51297be16e Merge branch 'master' of https://git.yuzhankeji.cn/zhangjing/douhuo-h5 2023-07-12 10:38:57 +08:00
唐明明
a1e1e1d67e 调试支付 2023-07-12 10:38:55 +08:00
4 changed files with 57 additions and 16 deletions

View File

@@ -34,7 +34,7 @@ const request = (parameter, hideLoding) => {
// 加载提示
if(!hideLoding) uni.showLoading({
title: '加载中',
title: '加载中...',
mask : true
});
@@ -47,11 +47,11 @@ const request = (parameter, hideLoding) => {
data : parameter.data || {},
method : parameter.method || 'GET',
success : res => {
uni.hideLoading()
if (res.header.Authorization){
updateToken('token', res.header.Authorization)
}
if(res.statusCode === 200){
uni.hideLoading()
const resolveData = res.data
if(resolveData.status_code === 200) {
resolve(resolveData.data)

View File

@@ -34,7 +34,7 @@ const umsDiff = (diffPriceId, data) =>{
const umsState = (trade_id) => {
return request({
url : 'payments/query/' + trade_id,
})
}, false)
}
// 斗拱支付 - 咨询单
@@ -164,6 +164,9 @@ const payInfo = data => {
}
const payWechat = data => {
console.log('111')
return request({
url : "pay/cashier_desk/wechat",
method : 'POST',

View File

@@ -84,7 +84,8 @@
"aliasPath": "/login/login",
"name": "Login",
"style": {
"navigationBarTitleText": "抖火法律-登录"
"navigationBarTitleText": "抖火法律-登录",
"navigationStyle": "custom"
}
}, {
"path": "pages/login/agreement",

View File

@@ -39,7 +39,7 @@
<!-- web.douhuotest.douhuofalv dev=0是线上 dev=1是线下 -->
<wx-open-launch-weapp
username="gh_918c81628d6f"
:path="'pages/pay/pay?type=h5&dev=0&trade_id=' + tradeId + '&token=' + token"
:path="'pages/pay/pay?type=h5&dev=1&trade_id=' + tradeId + '&token=' + token"
>
<script type="text/wxtag-template">
<style>
@@ -92,11 +92,11 @@
<script>
const jweixin = require('jweixin-module');
import { Apply, Wechat, authFollow } from '@/apis/interfaces/index'
import { payInfo, payWechat, payUms } from '@/apis/interfaces/pay'
import { payInfo, payWechat, payUms, umsState } from '@/apis/interfaces/pay'
export default {
data() {
return {
tradeId : '',
tradeId : '20230712115651357160000028',
token : this.$store.getters.getToken,
orderNo : '',
orderId : '',
@@ -108,11 +108,12 @@
}
},
onShow() {
if(this.tradeId != ''){
this.onGetOrderPayState()
}
},
created() {
let { orderId, orderType } = this.$Route.query
uni.showLoading({
title: '加载中...',
mask : true
})
payInfo({
order_type : orderType,
order_id : orderId
@@ -131,6 +132,38 @@
})
},
methods: {
// 查询订单状态
onGetOrderPayState(){
uni.showLoading({
title: '查询支付',
mask : true
})
let outTime;
let resNumb = 0;
outTime = setInterval(() => {
if(resNumb >= 3){
clearInterval(outTime)
uni.showToast({
title: '暂未查询到你的支付订单',
icon : 'none'
})
return
}
umsState(this.tradeId).then(res => {
resNumb++
if(res.state === 'success'){
clearInterval(outTime)
this.payMakePop = true
}
}).catch(err => {
clearInterval(outTime)
uni.showToast({
title: err.message,
icon : 'none'
})
})
}, 2000)
},
// 选择支付方式
payType(type) {
if(this.Payment === type) return
@@ -146,8 +179,7 @@
order_id : this.orderId,
openid : openId,
use_fire : 0,
fire : 0,
type : payType
fire : 0
}).then(res => {
let wxConfig = JSON.parse(res.wechat)
jweixin.config({
@@ -176,6 +208,11 @@
}
});
});
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
})
}
// 获取微信授权信息-获取oppid
@@ -202,13 +239,13 @@
type : payType
}).then(res => {
let { trade_id } = res;
this.tradeId = trade_id
this.tradeId = trade_id
switch (payType){
case 'mp':
this.tradeId = res.trade_id
this.tradeId = trade_id
break;
case 'mp_alipay':
this.tradeId = res.trade_id
this.tradeId = trade_id
window.location.href = res.alipay
break;
}