Commit ce7bdd86 authored by caimeng's avatar caimeng

支付调通

parent 3ff054ee
......@@ -5,7 +5,7 @@
// 开发环境
const BASE = {
development: {
common: "http://192.168.0.92:8080",
common: "http://192.168.0.61:8080",
event: 'http://118.31.124.88:21111',
h5: 'http://ddang-hhym-h5-s.rockstect.cn/index.html'
},
......
......@@ -61,6 +61,20 @@ export default {
console.log(err, '初始化订单详情')
}
},
// 处理支付报错
appPayFail(err) {
const a = { "errMsg": "requestPayment:fail [payment支付宝:62001]用户中途取消支付操作", "errCode": -100, "code": -100 }
const { errMsg } = err;
const lastIndexNum = errMsg.indexOf(']');
let message = errMsg.substring(lastIndexNum + 1)
if (message === '未知错误') message = '请检查您的手机是否安装了支付宝~'
uni.showToast({
icon: 'none',
title: message,
duration: 2000
});
},
// 支付
handlePay() {
......@@ -75,6 +89,7 @@ export default {
*/
service: 'payment',
success: (res) => {
console.log(res,'日111')
/*
* @ res.service 获取服务供应商 ==> 'payment'
* @ res.provider 这里选择的是支付类型,所以包含["alipay","wxpay"]
......@@ -90,23 +105,29 @@ export default {
};
//发起后台支付接口请求
that.$request('/app/payment/pay', 'POST', data).then(res => {
console.log('支付宝订单数据', res);
console.log('支付宝订单数据', JSON.stringify(res));
//调用uniapp API uni.requestPayment 支付接口
uni.requestPayment({
//服务提供商 通过uni.getProvider获取
provider: 'alipay',
//后台返回的订单数据
orderInfo: res.data.result,
orderInfo: res.result,
//调用成功的回调
success(res) {
// console.log('success:' + res);
console.log('success:' + res);
uni.showToast({
icon: 'none',
title: '支付成功,即将返回,请耐心等待!',
duration: 3000
});
setTimeout(() => {
}, 500)
uni.navigateBack();
}, 3000)
},
//调用失败的回调
fail(err) {
console.log('fail:' + err);
that.appPayFail(err)
console.log('fail:' + JSON.stringify(err));
}
})
})
......
......@@ -136,7 +136,8 @@ export default {
if (res.success) {
const { id } = res.result;
uni.showToast({
title: '下单成功',
icon:'none',
title: '订单提交成功',
duration: 1200
});
TimeOut = setTimeout(() => {
......
iosProfile=/Users/admin/Desktop/ermo/uni-app-ddh-shop/app/dev.mobileprovision
ioscertFile=/Users/admin/Desktop/hhym_dev.p12
ioscertPassword=zlUOIlsvWaGaS9DZgwBUlQ==
ioscertFile=/Users/admin/Desktop/ermo/uni-app-ddh-shop/app/dev.p12
ioscertPassword=HfmgbKS6hY8nrLPDa+l0Vw==
{"dir":"/Users/seaman/srv/bdserver.dcloud.net.cn/service/storage/app/package/IOS/queue/56689380-e91e-11ef-93ef-630e667f743a/wgtRoot/__UNI__670BD78/"}
\ No newline at end of file
{"dir":"/Users/seaman/srv/bdserver.dcloud.net.cn/service/storage/app/package/IOS/queue/35a59fa0-ecfd-11ef-8b7c-77cf250462a2/wgtRoot/__UNI__670BD78/"}
\ No newline at end of file
No preview for this file type
This source diff could not be displayed because it is too large. You can view the blob instead.
No preview for this file type
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment