|
@@ -21,8 +21,10 @@
|
|
|
console.log('调用失败!');
|
|
console.log('调用失败!');
|
|
|
})
|
|
})
|
|
|
*/
|
|
*/
|
|
|
|
|
+let wexinPay = null
|
|
|
|
|
+// #ifdef H5
|
|
|
const wx = require('jweixin-module')
|
|
const wx = require('jweixin-module')
|
|
|
-const wexinPay = (data, cb, errorCb) => {
|
|
|
|
|
|
|
+wexinPay = (data, cb, errorCb) => {
|
|
|
let [appId, timestamp, nonceStr, signature, packages, paySign] = [data.appId, data.timeStamp, data.nonceStr, data.signature,
|
|
let [appId, timestamp, nonceStr, signature, packages, paySign] = [data.appId, data.timeStamp, data.nonceStr, data.signature,
|
|
|
data.package, data.paySign
|
|
data.package, data.paySign
|
|
|
]
|
|
]
|
|
@@ -58,5 +60,27 @@ const wexinPay = (data, cb, errorCb) => {
|
|
|
/* alert("config信息验证失败");*/
|
|
/* alert("config信息验证失败");*/
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
+// #endif
|
|
|
|
|
+// #ifdef MP-WEIXIN
|
|
|
|
|
+wexinPay = (payParams, cb, errorCb) => {
|
|
|
|
|
+ // console.log(payParams, 'payParams')
|
|
|
|
|
+ const { timeStamp, nonceStr, signType, paySign } = payParams
|
|
|
|
|
+ const that = this
|
|
|
|
|
+ uni.requestPayment({
|
|
|
|
|
+ provider: 'wxpay',
|
|
|
|
|
+ timeStamp: timeStamp + '',
|
|
|
|
|
+ nonceStr: nonceStr,
|
|
|
|
|
+ package: payParams.package,
|
|
|
|
|
+ signType: signType,
|
|
|
|
|
+ paySign: paySign,
|
|
|
|
|
+ success: res => {
|
|
|
|
|
+ cb(res)
|
|
|
|
|
+ },
|
|
|
|
|
+ fail: res => {
|
|
|
|
|
+ errorCb(res)
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+}
|
|
|
|
|
+// #endif
|
|
|
|
|
|
|
|
export default wexinPay
|
|
export default wexinPay
|