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

View File

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

View File

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

View File

@@ -39,7 +39,7 @@
<!-- web.douhuotest.douhuofalv dev=0是线上 dev=1是线下 --> <!-- web.douhuotest.douhuofalv dev=0是线上 dev=1是线下 -->
<wx-open-launch-weapp <wx-open-launch-weapp
username="gh_918c81628d6f" 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"> <script type="text/wxtag-template">
<style> <style>
@@ -92,11 +92,11 @@
<script> <script>
const jweixin = require('jweixin-module'); const jweixin = require('jweixin-module');
import { Apply, Wechat, authFollow } from '@/apis/interfaces/index' 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 { export default {
data() { data() {
return { return {
tradeId : '', tradeId : '20230712115651357160000028',
token : this.$store.getters.getToken, token : this.$store.getters.getToken,
orderNo : '', orderNo : '',
orderId : '', orderId : '',
@@ -108,11 +108,12 @@
} }
}, },
onShow() { onShow() {
if(this.tradeId != ''){
this.onGetOrderPayState()
}
},
created() {
let { orderId, orderType } = this.$Route.query let { orderId, orderType } = this.$Route.query
uni.showLoading({
title: '加载中...',
mask : true
})
payInfo({ payInfo({
order_type : orderType, order_type : orderType,
order_id : orderId order_id : orderId
@@ -131,6 +132,38 @@
}) })
}, },
methods: { 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) { payType(type) {
if(this.Payment === type) return if(this.Payment === type) return
@@ -146,8 +179,7 @@
order_id : this.orderId, order_id : this.orderId,
openid : openId, openid : openId,
use_fire : 0, use_fire : 0,
fire : 0, fire : 0
type : payType
}).then(res => { }).then(res => {
let wxConfig = JSON.parse(res.wechat) let wxConfig = JSON.parse(res.wechat)
jweixin.config({ jweixin.config({
@@ -176,6 +208,11 @@
} }
}); });
}); });
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
}) })
} }
// 获取微信授权信息-获取oppid // 获取微信授权信息-获取oppid
@@ -205,10 +242,10 @@
this.tradeId = trade_id this.tradeId = trade_id
switch (payType){ switch (payType){
case 'mp': case 'mp':
this.tradeId = res.trade_id this.tradeId = trade_id
break; break;
case 'mp_alipay': case 'mp_alipay':
this.tradeId = res.trade_id this.tradeId = trade_id
window.location.href = res.alipay window.location.href = res.alipay
break; break;
} }