|
|
@@ -46,7 +46,6 @@ |
|
|
|
let logo |
|
|
|
const scrollTop = ref(0); //滚动距离 |
|
|
|
var counter = 0; |
|
|
|
// var maxNum = 5; |
|
|
|
function myFunc() { |
|
|
|
counter++; |
|
|
|
console.log("====") |
|
|
@@ -66,135 +65,143 @@ |
|
|
|
} |
|
|
|
state.isclick = false |
|
|
|
console.log("state.isclick", state.isclick, val.payStatus) |
|
|
|
if (val.payStatus === 'UNPAY') { |
|
|
|
myFunc() |
|
|
|
// #ifdef MP-ALIPAY |
|
|
|
my.getAuthCode({ |
|
|
|
scopes: 'auth_base', |
|
|
|
success: res => { |
|
|
|
const optionsUser = { |
|
|
|
type: 2, |
|
|
|
data: { |
|
|
|
payConfigId: aliPayConfigIdTwo, |
|
|
|
code: res.authCode |
|
|
|
}, |
|
|
|
method: "POST", |
|
|
|
showLoading: true, |
|
|
|
}; |
|
|
|
console.log('支付宝用户编号请求:', optionsUser) |
|
|
|
requestNew(obtainUserId, optionsUser).then((res) => { |
|
|
|
console.log('支付宝用户编号返回:', res) |
|
|
|
const data = res; |
|
|
|
const optionsali = { |
|
|
|
type: 2, |
|
|
|
data: { |
|
|
|
orderId: state.orderId, |
|
|
|
wxOpenid: data.openId ? data.openId : data.alipayUserId, |
|
|
|
payType: val.payType |
|
|
|
}, |
|
|
|
method: "POST", |
|
|
|
showLoading: true, |
|
|
|
}; |
|
|
|
console.log('支付下单请求:', optionsali) |
|
|
|
requestNew(PAYMENTORDERAPPLY, optionsali).then((res) => { |
|
|
|
const data = res; |
|
|
|
console.log('支付下单返回:', data) |
|
|
|
my.tradePay({ |
|
|
|
// 调用统一收单交易创建接口(alipay.trade.create),获得返回字段支付宝交易号 trade_no |
|
|
|
tradeNO: data.tranPackage, |
|
|
|
success: res => { |
|
|
|
console.log("支付成功", res); |
|
|
|
refresh(); |
|
|
|
uni.getLocation({ |
|
|
|
type: 'gcj02', |
|
|
|
success: function (res) { |
|
|
|
console.log("经纬福",res) |
|
|
|
state.longitude = res.longitude; |
|
|
|
state.latitude = res.latitude; |
|
|
|
if (val.payStatus === 'UNPAY') { |
|
|
|
myFunc() |
|
|
|
// #ifdef MP-ALIPAY |
|
|
|
my.getAuthCode({ |
|
|
|
scopes: 'auth_base', |
|
|
|
success: res => { |
|
|
|
const optionsUser = { |
|
|
|
type: 2, |
|
|
|
data: { |
|
|
|
payConfigId: aliPayConfigIdTwo, |
|
|
|
code: res.authCode |
|
|
|
}, |
|
|
|
fail: res => { |
|
|
|
console.log("支付失败", res); |
|
|
|
method: "POST", |
|
|
|
showLoading: true, |
|
|
|
}; |
|
|
|
console.log('支付宝用户编号请求:', optionsUser) |
|
|
|
requestNew(obtainUserId, optionsUser).then((res) => { |
|
|
|
console.log('支付宝用户编号返回:', res) |
|
|
|
const data = res; |
|
|
|
const optionsali = { |
|
|
|
type: 2, |
|
|
|
data: { |
|
|
|
orderId: state.orderId, |
|
|
|
wxOpenid: data.openId ? data.openId : data.alipayUserId, |
|
|
|
payType: val.payType |
|
|
|
}, |
|
|
|
method: "POST", |
|
|
|
showLoading: true, |
|
|
|
}; |
|
|
|
console.log('支付下单请求:', optionsali) |
|
|
|
requestNew(PAYMENTORDERAPPLY, optionsali).then((res) => { |
|
|
|
const data = res; |
|
|
|
console.log('支付下单返回:', data) |
|
|
|
my.tradePay({ |
|
|
|
// 调用统一收单交易创建接口(alipay.trade.create),获得返回字段支付宝交易号 trade_no |
|
|
|
tradeNO: data.tranPackage, |
|
|
|
success: res => { |
|
|
|
console.log("支付成功", res); |
|
|
|
refresh(); |
|
|
|
}, |
|
|
|
fail: res => { |
|
|
|
console.log("支付失败", res); |
|
|
|
}, |
|
|
|
}); |
|
|
|
|
|
|
|
}, |
|
|
|
(err)=>{ |
|
|
|
state.isclick = true |
|
|
|
console.log("err") |
|
|
|
} |
|
|
|
); |
|
|
|
}); |
|
|
|
|
|
|
|
}, |
|
|
|
(err)=>{ |
|
|
|
fail: err => { |
|
|
|
console.log('my.getAuthCode 调用失败', err) |
|
|
|
state.isclick = true |
|
|
|
console.log("err") |
|
|
|
} |
|
|
|
); |
|
|
|
}); |
|
|
|
}, |
|
|
|
fail: err => { |
|
|
|
console.log('my.getAuthCode 调用失败', err) |
|
|
|
state.isclick = true |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
// #endif |
|
|
|
// #ifdef MP-WEIXIN |
|
|
|
uni.login({ |
|
|
|
provider: "weixin", |
|
|
|
success: function (e) { |
|
|
|
const options1 = { |
|
|
|
type: 2, |
|
|
|
data: { |
|
|
|
"jsCode": e.code |
|
|
|
}, |
|
|
|
method: "POST", |
|
|
|
showLoading: true, |
|
|
|
}; |
|
|
|
requestNew(getOpenId, options1).then((res) => { |
|
|
|
const result = res; |
|
|
|
const openidData = stringToJson(result.data); |
|
|
|
console.log("获取openId", openidData) |
|
|
|
const options = { |
|
|
|
type: 2, |
|
|
|
data: { |
|
|
|
orderId: state.orderId, |
|
|
|
wxOpenId: openidData.openid, |
|
|
|
payType: val.payType, |
|
|
|
longitude:state.longitude, //经度 |
|
|
|
latitude:state.latitude //纬度 |
|
|
|
}, |
|
|
|
method: "POST", |
|
|
|
showLoading: true, |
|
|
|
}; |
|
|
|
requestNew(payApply, options).then((res) => { |
|
|
|
const data = res; |
|
|
|
console.log("data======111", data) |
|
|
|
if (data) { |
|
|
|
console.log("进来了") |
|
|
|
uni.requestPayment({ |
|
|
|
provider: "wxpay", |
|
|
|
orderInfo: "", |
|
|
|
timeStamp: data.timestamp, |
|
|
|
nonceStr: data.noncestr, |
|
|
|
package: data.wxPackage ? data.wxPackage : "", |
|
|
|
signType: data.signType, |
|
|
|
paySign: data.sign, |
|
|
|
success: function (e) { |
|
|
|
console.log("支付成功", res); |
|
|
|
refresh(); |
|
|
|
|
|
|
|
// #endif |
|
|
|
// #ifdef MP-WEIXIN |
|
|
|
uni.login({ |
|
|
|
provider: "weixin", |
|
|
|
success: function (e) { |
|
|
|
const options1 = { |
|
|
|
type: 2, |
|
|
|
data: { |
|
|
|
"jsCode": e.code |
|
|
|
}, |
|
|
|
method: "POST", |
|
|
|
showLoading: true, |
|
|
|
}; |
|
|
|
requestNew(getOpenId, options1).then((res) => { |
|
|
|
const result = res; |
|
|
|
const openidData = stringToJson(result.data); |
|
|
|
console.log("获取openId", openidData) |
|
|
|
const options = { |
|
|
|
type: 2, |
|
|
|
data: { |
|
|
|
orderId: state.orderId, |
|
|
|
wxOpenId: openidData.openid, |
|
|
|
payType: val.payType, |
|
|
|
longitude:state.longitude, //经度 |
|
|
|
latitude:state.latitude //纬度 |
|
|
|
}, |
|
|
|
fail: function (err) { |
|
|
|
method: "POST", |
|
|
|
showLoading: true, |
|
|
|
}; |
|
|
|
requestNew(payApply, options).then((res) => { |
|
|
|
const data = res; |
|
|
|
console.log("data======111", data) |
|
|
|
if (data) { |
|
|
|
console.log("进来了") |
|
|
|
uni.requestPayment({ |
|
|
|
provider: "wxpay", |
|
|
|
orderInfo: "", |
|
|
|
timeStamp: data.timestamp, |
|
|
|
nonceStr: data.noncestr, |
|
|
|
package: data.wxPackage ? data.wxPackage : "", |
|
|
|
signType: data.signType, |
|
|
|
paySign: data.sign, |
|
|
|
success: function (e) { |
|
|
|
console.log("支付成功", res); |
|
|
|
refresh(); |
|
|
|
}, |
|
|
|
fail: function (err) { |
|
|
|
state.isclick = true |
|
|
|
confirm(err, () => { }, "支付失败", false); |
|
|
|
}, |
|
|
|
}); |
|
|
|
} else { |
|
|
|
state.isclick = true |
|
|
|
confirm(err, () => { }, "支付失败", false); |
|
|
|
}, |
|
|
|
}); |
|
|
|
} else { |
|
|
|
state.isclick = true |
|
|
|
console.log("state.isclick", state.isclick) |
|
|
|
} |
|
|
|
|
|
|
|
console.log("state.isclick", state.isclick) |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
(err)=>{ |
|
|
|
state.isclick = true |
|
|
|
console.log("err") |
|
|
|
} |
|
|
|
); |
|
|
|
}); |
|
|
|
}, |
|
|
|
(err)=>{ |
|
|
|
state.isclick = true |
|
|
|
console.log("err") |
|
|
|
} |
|
|
|
); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// #endif |
|
|
|
} |
|
|
|
// }) |
|
|
|
|
|
|
|
|
|
|
|
// #endif |
|
|
|
} |
|
|
|
}, |
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
}; |
|
|
|
const refresh = () => { |
|
|
@@ -354,14 +361,6 @@ |
|
|
|
} |
|
|
|
console.log("state.dataArray", state.dataArray) |
|
|
|
}); |
|
|
|
uni.getLocation({ |
|
|
|
type: 'gcj02', |
|
|
|
success: function (res) { |
|
|
|
console.log("经纬福",res) |
|
|
|
state.longitude = res.longitude; |
|
|
|
state.latitude = res.latitude; |
|
|
|
}, |
|
|
|
}) |
|
|
|
}); |
|
|
|
//解析URL获取参数 |
|
|
|
const getRequest = (urlStr) => { |