1 Commits

Author SHA1 Message Date
GaoHao
919350c2c0 充值更新 2024-11-18 14:59:20 +08:00
4 changed files with 71 additions and 34 deletions

View File

@@ -8,8 +8,10 @@ const proxyApi = "/api"
// const proxyApiwws = 'ws://192.168.1.15:9888/netty' // 测试
// const proxyApi = 'https://wxcashiertest.sxczgkj.cn/cashierService' // 测试
// const proxyApiwws = 'wss://wxcashiertest.sxczgkj.cn/netty' // 测试
const proxyApi = 'https://pre-cashier.sxczgkj.cn/cashierService' // 预发布
const proxyApiwws = 'wss://pre-cashier.sxczgkj.cn/netty' // 预发布
// const proxyApi = 'https://pre-cashier.sxczgkj.cn/cashierService' // 预发布
// const proxyApiwws = 'wss://pre-cashier.sxczgkj.cn/netty' // 预发布
const proxyApi = 'https://cashier.sxczgkj.cn/cashierService' // 预发布
const proxyApiwws = 'wss://cashier.sxczgkj.cn/netty' // 预发布
// #endif
// #ifdef H5

View File

@@ -267,28 +267,28 @@ const getUserInfo = function (successCallback, failCallback) {
// #endif
// #ifdef MP-ALIPAY
return new Promise((resolve, reject) => {
my.getAuthCode({
scopes: 'auth_user',
success: (data) => {
console.log(data)
// 支付宝小程序环境
my.getAuthUserInfo({
success: async (infoRes) => {
let res = await Api.userwxlogin({
code: data.authCode, //临时登录凭证
rawData: JSON.stringify(infoRes),
source: 'alipay'
})
if (res.code == 0) {
resolve(res)
}
},
fail: (err) => {}
});
}
});
})
return new Promise((resolve, reject) => {
my.getAuthCode({
scopes: 'auth_base',
success: async (data) => {
console.log(data)
// 支付宝小程序环境
// my.getAuthUserInfo({
// success: async (infoRes) => {
let res = await Api.userwxlogin({
code: data.authCode, //临时登录凭证
// rawData: JSON.stringify(infoRes),
source: 'alipay'
})
if (res.code == 0) {
resolve(res)
}
// },
// fail: (err) => {}
// });
}
});
})
// #endif
}

View File

@@ -315,6 +315,7 @@
});
return false;
}
console.log(this.amount)
if (this.amount == null || this.amount == '') {
uni.showToast({
title: '金额不能为空',
@@ -331,15 +332,21 @@
}
let res = await this.api.paymemeberIn({
shopId: this.shopId, // 判断显示哪家的作品,
amount: this.amount // 判断显示哪家的作品,
amount: this.amount ,// 判断显示哪家的作品,
// #ifdef MP-WEIXIN
payType: 'wechatPay',
// #endif
// #ifdef MP-ALIPAY
payType: 'aliPay',
// #endif
})
if (res.code == 0) {
uni.showLoading({
title: '加载中',
mask: true
})
// #ifdef MP-WEIXIN
uni.requestPayment({
// #ifdef MP-WEIXIN
provider: 'wxpay', //支付类型-固定值
partnerid: res.data.appId, // 微信支付商户号
timeStamp: res.data.timeStamp, // 时间戳(单位:秒)
@@ -347,26 +354,53 @@
package: res.data.package, // 固定值
signType: res.data.signType, //固定值
paySign: res.data.paySign, //签名
// #endif
// #ifdef MP-ALIPAY
provider: 'alipay', //支付类型-固定值
orderInfo: res.data.tradeNo, // 微信支付商户号
// #endif
success: (res) => {
uni.showToast({
title: "支付成功"
})
uni.hideLoading()
let pages = getCurrentPages()
// #ifdef MP-WEIXIN
uni.requestSubscribeMessage({
tmplIds:["AV-KybUHaK3KtFVLqpy6PHccHBS7XeX__mOM4RbufnQ"],
complete() {
if ( pages.length > 1) {
_this.shopInfo()
if ( _this.type && _this.type == "topUpActivity") {
uni.pro.navigateBack()
} else {
setTimeout(res => {
uni.switchTab({
url: '/pages/index/index'
})
}, 500)
if ( pages.length > 1) {
_this.shopInfo()
} else {
setTimeout(res => {
uni.switchTab({
url: '/pages/index/index'
})
}, 500)
}
}
},
})
// #endif
// #ifdef MP-ALIPAY
if ( _this.type && _this.type == "topUpActivity") {
uni.pro.navigateBack()
} else {
if ( pages.length > 1) {
_this.shopInfo()
} else {
setTimeout(res => {
uni.switchTab({
url: '/pages/index/index'
})
}, 500)
}
}
// #endif
@@ -376,7 +410,6 @@
}
});
uni.hideLoading()
// #endif
}
},

View File

@@ -62,7 +62,9 @@ const store = new Vuex.Store({
},
actions: {
loginEvent: async () => {
console.log(2)
let res = await uni.utils.getUserInfo();
console.log(res)
uni.cache.set('token', res.data.token);
uni.cache.set('miniAppOpenId', res.data.userInfo
.miniAppOpenId)