|
|
@@ -0,0 +1,197 @@
|
|
|
+<template>
|
|
|
+ <view class="app-content awaitPayYe awaitPayYe">
|
|
|
+ <view class="callback-wrap">
|
|
|
+ <view class="bg_01"></view>
|
|
|
+ <view class="callback-blo">
|
|
|
+ <block>
|
|
|
+ <view class="icon">
|
|
|
+ <i class="iconfont icondaizhifu"></i>
|
|
|
+ </view>
|
|
|
+ </block>
|
|
|
+ <view class="wait">待付款</view>
|
|
|
+ <block>
|
|
|
+ <view class="price">
|
|
|
+ <span>¥</span>
|
|
|
+ <span class="app-size-36 app-bold">{{ rechargeAmount }}</span>
|
|
|
+ </view>
|
|
|
+ <view class="order-num app-color-3 order-show">订单号: {{ orderSn}}</view>
|
|
|
+ </block>
|
|
|
+ <block>
|
|
|
+ <view class="call-one-btn">
|
|
|
+ <button class="button-com green pay-wx" @click="wxPayFn(1)" style="height:100upx;line-height:50upx;">微信支付</button>
|
|
|
+ </view>
|
|
|
+ </block>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+import wexinPay from "@/utils/pay/wxPay";
|
|
|
+import { mapGetters } from "vuex";
|
|
|
+import { postWxCode } from '@/api/mini'
|
|
|
+import { getDetail,wxPayRecharge } from '@/api/recharge'
|
|
|
+export default {
|
|
|
+ name: "pay",
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ id:0,
|
|
|
+ orderSn:'',
|
|
|
+ rechargeAmount:0,
|
|
|
+ hasRequestApi:false
|
|
|
+ };
|
|
|
+ },
|
|
|
+ onLoad() {
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapGetters(["getLoginInfo", 'getDictionariesInfo']),
|
|
|
+ },
|
|
|
+ onShow(){
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ init(){
|
|
|
+ getDetail({id:this.option.id}).then(res=>{
|
|
|
+ if(res.code == 1){
|
|
|
+ this.id = res.data.id
|
|
|
+ this.orderSn = res.data.orderSn
|
|
|
+ this.rechargeAmount = res.data.amount?parseFloat(res.data.amount):0
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ wxPayFn(){
|
|
|
+ let platformType = uni.getSystemInfoSync().platform
|
|
|
+ if(platformType == 'windows'){
|
|
|
+ this.$msg('请使用手机小程序付款')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ let that = this
|
|
|
+ //解决重复提交问题
|
|
|
+ if(this.hasRequestApi == true){
|
|
|
+ this.$msg('正在请求,请5秒后重试')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ that.hasRequestApi = true
|
|
|
+ setTimeout(() => {
|
|
|
+ that.hasRequestApi = false
|
|
|
+ },7000)
|
|
|
+ // #ifdef APP-PLUS
|
|
|
+ this.$msg('请用小程序打开,再支付')
|
|
|
+ return false
|
|
|
+ // #endif
|
|
|
+ that.confirmWxPayFn()
|
|
|
+ },
|
|
|
+ confirmWxPayFn () {
|
|
|
+ let that = this
|
|
|
+ uni.showLoading({mask:true})
|
|
|
+ uni.login({
|
|
|
+ provider: 'weixin',
|
|
|
+ success: res => {
|
|
|
+ postWxCode({ code: res.code }).then(subRes => {
|
|
|
+ uni.hideLoading()
|
|
|
+ if(subRes.data.miniOpenId){
|
|
|
+ let miniOpenId = subRes.data.miniOpenId
|
|
|
+ uni.setStorageSync('miniOpenId',miniOpenId)
|
|
|
+ that.weixinPay(miniOpenId)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ weixinPay(miniOpenId){
|
|
|
+ let that = this
|
|
|
+ wxPayRecharge({ id: this.id,miniOpenId:miniOpenId }).then(res => {
|
|
|
+ that.orderSn = res.data.orderSn
|
|
|
+ wexinPay(res.data, this.getSuccess, this.getError)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getSuccess () {
|
|
|
+ let that = this
|
|
|
+ that.pageTo({ url: '/pages/settle/result?id='+that.id,type:2})
|
|
|
+ },
|
|
|
+ getError () {
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|
|
|
+<style lang="scss" scoped>
|
|
|
+.app-content {
|
|
|
+ .ali-btn{
|
|
|
+ background-color:#3385ff;
|
|
|
+ border:1upx solid #3385ff;
|
|
|
+ color:white;
|
|
|
+ }
|
|
|
+ .callback-wrap {
|
|
|
+ padding-top: 50upx;
|
|
|
+ // background-image: url("../../src/static/images/callback/bg.png");
|
|
|
+ background-repeat: no-repeat;
|
|
|
+ background-size: 100% auto;
|
|
|
+ position: relative;
|
|
|
+ .bg_01 {
|
|
|
+ position: absolute;
|
|
|
+ top: 0;
|
|
|
+ left: 0;
|
|
|
+ width: 100vw;
|
|
|
+ height: 290upx;
|
|
|
+ background: #07be0b;
|
|
|
+ border-radius: 0upx 0upx 83upx 83upx;
|
|
|
+ z-index: 1;
|
|
|
+ }
|
|
|
+ .callback-blo {
|
|
|
+ position: absolute;
|
|
|
+ z-index: 9;
|
|
|
+ left: 50%;
|
|
|
+ transform: translateX(-50%);
|
|
|
+ width: 90%;
|
|
|
+ margin: 0 auto;
|
|
|
+ padding: 70upx 0;
|
|
|
+ background-color: #fff;
|
|
|
+ box-shadow: 2upx 2upx 16upx 0upx rgba(181, 181, 181, 0.29);
|
|
|
+ border-radius: 10upx;
|
|
|
+ text-align: center;
|
|
|
+ // 使用icon
|
|
|
+ .icon {
|
|
|
+ .iconfont {
|
|
|
+ font-size: 120upx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 一个按钮
|
|
|
+ .call-one-btn {
|
|
|
+ .button-com {
|
|
|
+ width: 70%;
|
|
|
+ padding-top: 22upx;
|
|
|
+ padding-bottom: 22upx;
|
|
|
+ font-size: 32upx;
|
|
|
+ margin-top: 40upx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .order-show{
|
|
|
+ margin-top:20upx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+// 待支付 - 公共
|
|
|
+.awaitPayWx,
|
|
|
+.awaitPayYe {
|
|
|
+ .status-text {
|
|
|
+ margin-top: 22upx;
|
|
|
+ margin-bottom: 52upx;
|
|
|
+ color: #ffa92e;
|
|
|
+ }
|
|
|
+ .surplus {
|
|
|
+ margin-top: 22upx;
|
|
|
+ margin-bottom: 38upx;
|
|
|
+ }
|
|
|
+ .icon {
|
|
|
+ .iconfont {
|
|
|
+ color: #ffa92e;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+// 待确认样式
|
|
|
+.wait {
|
|
|
+ color: #ffa92e;
|
|
|
+ font-size: 40upx;
|
|
|
+ font-weight: 700;
|
|
|
+ margin: 20upx 0;
|
|
|
+}
|
|
|
+</style>
|