|
@@ -0,0 +1,58 @@
|
|
|
+<template>
|
|
|
+ <view>
|
|
|
+
|
|
|
+ </view>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ export default {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ payData: "",
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onLoad(option) {
|
|
|
+
|
|
|
+ uni.showLoading({
|
|
|
+ title: '支付中'
|
|
|
+ })
|
|
|
+
|
|
|
+ let that = {};
|
|
|
+ that.payData = JSON.parse(option.miniPayquest)
|
|
|
+ if (that.payData == null) return uni.hideLoading()
|
|
|
+
|
|
|
+ uni.requestPayment({
|
|
|
+ "provider": "wxpay",
|
|
|
+ "orderInfo": that.payData,
|
|
|
+ "appid": "wx3be1d6d84d46cdf7", // 微信开放平台 - 应用 - AppId,注意和微信小程序、公众号 AppId 可能不一致
|
|
|
+ "paySign": that.payData.paySign,
|
|
|
+ "nonceStr": that.payData.nonceStr, // 随机字符串
|
|
|
+ "package": that.payData.package, // 固定值
|
|
|
+ // "prepayid": that.payData.package, // 统一下单订单号
|
|
|
+ "timeStamp": that.payData.timeStamp, // 时间戳(单位:秒)
|
|
|
+ "signType": that.payData.signType, //签名算法
|
|
|
+ success(msg) {
|
|
|
+ console.log('msg', msg, res);
|
|
|
+
|
|
|
+ uni.showToast({
|
|
|
+ title: '支付成功!',
|
|
|
+ icon: 'fail'
|
|
|
+ })
|
|
|
+
|
|
|
+ uni.hideLoading()
|
|
|
+ },
|
|
|
+ fail(e) {
|
|
|
+ console.log('err', e);
|
|
|
+ uni.hideLoading()
|
|
|
+ uni.showToast({
|
|
|
+ title: '取消支付',
|
|
|
+ icon: 'fail'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+</script>
|
|
|
+
|
|
|
+<style>
|
|
|
+</style>
|