shish 1 год назад
Родитель
Сommit
e200641a37

+ 1 - 5
hdApp/src/admin/clear/info.vue

@@ -177,11 +177,7 @@ export default {
 				return false
 			}
 			let that = this
-			detail({ id:info.id }).then(res => {
-				if(res.code == 1) {
-					that.pageTo({ url: '/pagesPurchase/gatherPay?orderSn=' + res.data.orderSn + '&actPrice=' + res.data.actPrice+'&remainSecond='+res.data.remainSecond+'&id='+res.data.id,type:2})
-				}
-			})
+			that.pageTo({ url: '/pagesPurchase/gatherPay?id='+info.id,type:2})
 		},
 		copy(val) {
 			const self = this;

+ 0 - 1
hdApp/src/admin/home/workbench.vue

@@ -209,7 +209,6 @@
           </view>
           <view class="box_6 flex-row" @click="settleAccounts(ghsInfo)" v-if="Number(ghsInfo.debtAmount)>0">
             <view class="show_clear_area flex-row justify-between">
-              <image class="icon_2" referrerpolicy="no-referrer" src="/static/lanhu_020105gongyingshangliebiao/ps2pvfa1l5i34w5vqj2k7b3kejml3i3nmrba1421bf-caa2-491b-8773-af413df7e96d.png" />
               <text class="waite_clear_order">
                 待结订单 {{ghsInfo.debtNum}}笔 合计¥{{ghsInfo.debtAmount?parseFloat(ghsInfo.debtAmount):0}}
                 <text style="margin-left:30upx;" v-if="ghsInfo.remainDebtAmount>0">选订单结 》</text>

+ 1 - 0
hdApp/src/pages.json

@@ -434,6 +434,7 @@
 				{ "path": "aliPay", "style": { "navigationBarTitleText": "待支付"} },
 				{ "path": "cosNext", "style": { "navigationBarTitleText": "下一步", "enablePullDownRefresh": true } },
 				{ "path": "gatherPay", "style": { "navigationBarTitleText": "", "enablePullDownRefresh": false } },
+				{ "path": "gatherAliPay", "style": { "navigationBarTitleText": "", "enablePullDownRefresh": false } },
 				{ "path": "gatherResult", "style": { "navigationBarTitleText": "", "enablePullDownRefresh": false } },
 				{ "path": "purDetails", "style": { "navigationBarTitleText": "采购详情", "enablePullDownRefresh": true } },
 				{ "path": "info", "style": { "navigationBarTitleText": "订单详情", "enablePullDownRefresh": true } },

+ 351 - 0
hdApp/src/pagesPurchase/gatherAliPay.vue

@@ -0,0 +1,351 @@
+<template>
+  <div class="app-content awaitPayYe awaitPayYe">
+    <div class="callback-wrap">
+      <div class="bg_01"></div>
+      <div class="callback-blo">
+        <block>
+          <div class="icon">
+            <i class="iconfont icondaizhifu"></i>
+          </div>
+        </block>
+        <view class="wait">待付款</view>
+        <block>
+          <div class="price">
+            <span>¥</span>
+            <span class="app-size-36 app-bold">{{ actPrice || ''}}</span>
+          </div>
+          <div class="order-num app-color-3 order-show">订单号: {{ orderSn || ''}}</div>
+          <div class="order-num app-color-3 order-show" v-if="orderTime>0">{{orderTime}} 秒后订单失效</div>
+          <div class="order-num app-color-3 order-show" v-else>订单已失效</div>
+        </block>
+        <block>
+          <div class="call-one-btn">
+            <block v-if="orderTime>0">
+              <!-- #ifdef MP-WEIXIN -->
+              <view style="margin-top:30upx;text-align: center;">
+                <image :src="aliPayCodeImg" mode="heightFix" style="width:290upx;height:290upx;margin:0 auto;"></image>
+                <view style="margin-top:10upx;font-size:32upx;">支付宝扫此二维码付款</view>
+              </view>
+              <button class="button-com ali-btn" @click="savePayCode" style="margin-top:10upx;">保存二维码</button>
+              <button class="button-com ali-btn" @click="goDetail" style="margin-top:10upx;">我已经付款</button>
+              <view style="margin-top:25upx;font-size:32upx;text-decoration: underline;" @click="teachPayFn()">不会用支付宝付款?点这里教您</view>
+              <button class="button-com green pay-wx" @click="useWxPay" style="margin-top:50upx;">用微信付款</button>
+              <!-- #endif -->
+            </block>
+            <block v-else>
+              <button class="button-com disable pay-wx">微信支付</button>
+              <button class="button-com disable pay-wx">支付宝支付</button>
+            </block>
+          </div>
+        </block>
+      </div>
+    </div>
+  </div>
+</template>
+<script>
+import { purchaseClearWxPay,purchaseClearAliPay } from "@/api/purchase";
+import { getAliPayClearCode,detail } from "@/api/clear";
+import wexinPay from "@/utils/pay/wxPay";
+import { mapGetters } from "vuex";
+import { postWxCode } from '@/api/mini'
+export default {
+  name: "callback",
+  data () {
+    return {
+    	orderTime:120,
+      type: '',
+      modalForm: {
+        payPassword: ''
+      },
+      psdKey: '',
+      orderSn: '',
+      id:0,
+      actPrice: '',
+      hasRequestApi:false,
+      needCheck:0,
+      aliPayCodeImg:'',
+      remainSecond:0
+    };
+  },
+  onLoad (options) {
+    this.id = options.id ? options.id : 0
+    this.aliPayCodeImg = `${this.$constant.imgUrl}/default-img.png`
+    detail({ id:this.id }).then(res => {
+				if(res.code == 1) {
+          this.orderSn = res.data.orderSn?res.data.orderSn:''
+          this.actPrice = res.data.actPrice?res.data.actPrice:0
+          this.remainSecond = res.data.remainSecond?res.data.remainSecond:0
+          this.orderTime = this.remainSecond - 10 > 0 ? (this.remainSecond - 10) : 0
+          this.orderTimeFun()
+          // #ifdef MP-WEIXIN
+          this.getPayCodeFn(this.orderSn)
+          // #endif
+				}
+		})
+  },
+  computed: {
+    ...mapGetters(["getLoginInfo", 'getDictionariesInfo']),
+  },
+  onShow(){
+    let that = this
+    if(that.needCheck == 1){
+      that.needCheck = 0
+      that.$util.confirmModal({content:'已付款成功?',okText:'是的',cancelText:'没有'},() => {
+        that.pageTo({ url: '/pagesPurchase/gatherResult?id='+that.id, type: 2 })
+      })
+    }
+  },
+  methods: {
+    openAliPay(){
+      this.$msg('商家还未开通此功能')
+    },
+    init(){
+    },
+    useWxPay(){
+      this.orderSn = this.option.orderSn
+      this.id = this.option.id ? this.option.id : 0
+      this.actPrice = this.option.actPrice ? this.option.actPrice : 0
+      this.$util.pageTo({url: "/pagesPurchase/gatherPay?id="+this.id,type:2})
+    },
+    getPayCodeFn(orderSn){
+      getAliPayClearCode({orderSn:orderSn}).then(res=>{
+        if(res.code == 1){
+          if(res.data.imgUrl){
+            this.aliPayCodeImg = res.data.imgUrl
+          }
+        }
+      })
+    },
+    savePayCode(){
+      let url = this.aliPayCodeImg
+      uni.downloadFile({
+        url: url,
+        success: (res) => {
+          if (res.statusCode === 200) {
+            uni.saveImageToPhotosAlbum({
+              filePath: res.tempFilePath,
+              success: function (data) {
+                uni.showToast({title:'下载成功'})
+              }
+            });
+          }
+        }
+      })
+    },
+    goDetail(){
+      this.$util.pageTo({url: "/admin/clear/info?id="+this.id,type:2})
+    },
+    teachPayFn() {
+				this.pageTo({ url: "/admin/ghs/teachPay"})
+		},
+    orderTimeFun(){
+      if(this.orderTime==0){
+        return
+      }
+      setTimeout(()=>{
+        this.orderTime--;
+        this.orderTimeFun();
+      },1000)
+    },
+    aliPay(){
+      let that = this
+      //解决重复提交问题
+      if(this.hasRequestApi == true){
+        this.$msg('正在请求,请5秒后重试')
+        return false
+      }
+      that.hasRequestApi = true
+      setTimeout(() => {
+        that.hasRequestApi = false
+      },7000)
+
+      // #ifdef APP-PLUS
+      that.$util.confirmModal({content:'确认收到花材没有问题?结清后订单无法再售后'},() => {
+        purchaseClearAliPay({ orderSn: this.orderSn}).then(res=>{
+          if(res.code == 1){
+            that.orderSn = res.data.orderSn
+            that.needCheck = 1
+            plus.runtime.openWeb(res.data.payUrl)
+          }
+        })
+      })
+      // #endif
+    },
+    wxPayFn(type){
+
+			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.$util.confirmModal({content:'确认收到花材没有问题?结清后订单无法再售后'},() => {
+        if(type == 1){
+          that.confirmWxPayFn()
+        }else{
+          that.confirmWxPayFnOld()
+        }
+      })
+    },
+    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.currentMiniOpenId){
+              let thisMiniOpenId = subRes.data.currentMiniOpenId
+              uni.setStorageSync('currentMiniOpenId',thisMiniOpenId)
+              that.weixinPay(thisMiniOpenId)
+            }
+          })
+        }
+      })
+    },
+    weixinPay(currentMiniOpenId){
+      let that = this
+      purchaseClearWxPay({ orderSn: this.orderSn,currentMiniOpenId:currentMiniOpenId }).then(res => {
+        that.orderSn = res.data.orderSn
+        wexinPay(res.data, this.getSuccess, this.getError)
+        that.getPayCodeFn(that.orderSn)
+      })
+    },
+    confirmWxPayFnOld() {
+      let currentMiniOpenId = uni.getStorageSync('currentMiniOpenId')
+      let that = this
+      if(!this.$util.isEmpty(currentMiniOpenId)){
+        that.weixinPayOld()
+      }else{
+        //没有miniOpenId补miniOpenId
+        uni.showLoading({mask:true})
+        uni.login({
+          provider: 'weixin',
+          success: res => {
+            postWxCode({ code: res.code }).then(subRes => {
+              uni.hideLoading()
+              if(subRes.data.currentMiniOpenId){
+                let thisMiniOpenId = subRes.data.currentMiniOpenId
+                uni.setStorageSync('currentMiniOpenId',thisMiniOpenId)
+                that.weixinPayOld()
+              }
+            })
+          }
+        })
+      }
+    },
+    weixinPayOld(){
+      let that = this
+      let currentMiniOpenId = uni.getStorageSync('currentMiniOpenId')
+      purchaseClearWxPay({ orderSn: this.orderSn,currentMiniOpenId:currentMiniOpenId }).then(res => {
+        that.orderSn = res.data.orderSn
+        wexinPay(res.data, this.getSuccess, this.getError)
+      })
+    },
+    getSuccess () {
+      let that = this
+      that.pageTo({ url: '/pagesPurchase/gatherResult?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: #3385ff;
+      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: 170upx;
+        }
+      }
+      // 一个按钮
+      .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>

+ 29 - 40
hdApp/src/pagesPurchase/gatherPay.vue

@@ -21,22 +21,16 @@
         <block>
           <div class="call-one-btn">
             <block v-if="orderTime>0">
-              <button v-if="getPayType == 1" class="button-com green pay-wx" @click="wxPayFn(1)" >微信支付</button>
-              <button v-else class="button-com green pay-wx" @click="wxPayFn(0)" >微信支付</button>
+              <button class="button-com green pay-wx" @click="wxPayFn(1)" >微信支付</button>
 
-                <!-- #ifdef MP-WEIXIN -->
-                <view style="margin-top:30upx;text-align: center;">
-                <image :src="aliPayCodeImg" mode="heightFix" style="width:290upx;height:290upx;margin:0 auto;"></image>
-                <view style="margin-top:10upx;font-size:32upx;">支付宝扫此二维码付款</view>
-              </view>
-              <button class="button-com ali-btn" @click="savePayCode" style="margin-top:10upx;">保存二维码</button>
-              <button class="button-com ali-btn" @click="goDetail" style="margin-top:10upx;">我已经付款</button>
-              <view style="margin-top:25upx;font-size:32upx;text-decoration: underline;" @click="teachPayFn()">不会用支付宝付款?点这里教您</view>
+              <!-- #ifdef MP-WEIXIN -->
+              <button class="button-com ali-btn" @click="useAliPay" style="margin-top:50upx;">用支付宝付款</button>
               <!-- #endif -->
 
               <!-- #ifdef APP-PLUS -->
               <button class="button-com green pay-wx ali-btn" @click="aliPay()">支付宝支付</button>
               <!-- #endif -->
+
             </block>
             <block v-else>
               <button class="button-com disable pay-wx">微信支付</button>
@@ -50,7 +44,7 @@
 </template>
 <script>
 import { purchaseClearWxPay,purchaseClearAliPay } from "@/api/purchase";
-import { getAliPayClearCode,detail } from "@/api/clear";
+import { detail } from "@/api/clear";
 import wexinPay from "@/utils/pay/wxPay";
 import { mapGetters } from "vuex";
 import { postWxCode } from '@/api/mini'
@@ -67,23 +61,24 @@ export default {
       orderSn: '',
       id:0,
       actPrice: '',
-      getPayType:1,
       hasRequestApi:false,
       needCheck:0,
-      aliPayCodeImg:''
+      aliPayCodeImg:'',
+      remainSecond:0
     };
   },
   onLoad (options) {
-    this.orderSn = options.orderSn
     this.id = options.id ? options.id : 0
-    this.actPrice = options.actPrice
-    this.getPayType = options.getPayType
-    this.orderTime = options.remainSecond - 10 > 0 ? (options.remainSecond - 10) : 0
-    this.orderTimeFun()
     this.aliPayCodeImg = `${this.$constant.imgUrl}/default-img.png`
-    // #ifdef MP-WEIXIN
-    this.getPayCodeFn(this.orderSn)
-    // #endif
+    detail({ id:this.id }).then(res => {
+				if(res.code == 1) {
+          this.orderSn = res.data.orderSn?res.data.orderSn:''
+          this.actPrice = res.data.actPrice?res.data.actPrice:0
+          this.remainSecond = res.data.remainSecond?res.data.remainSecond:0
+          this.orderTime = this.remainSecond - 10 > 0 ? (this.remainSecond - 10) : 0
+          this.orderTimeFun()
+				}
+		})
   },
   computed: {
     ...mapGetters(["getLoginInfo", 'getDictionariesInfo']),
@@ -103,14 +98,11 @@ export default {
     },
     init(){
     },
-    getPayCodeFn(orderSn){
-      getAliPayClearCode({orderSn:orderSn}).then(res=>{
-        if(res.code == 1){
-          if(res.data.imgUrl){
-            this.aliPayCodeImg = res.data.imgUrl
-          }
-        }
-      })
+    useAliPay(){
+      this.orderSn = this.option.orderSn
+      this.id = this.option.id ? this.option.id : 0
+      this.actPrice = this.option.actPrice ? this.option.actPrice : 0
+      this.$util.pageTo({url: "/pagesPurchase/gatherAliPay?id="+this.id,type:2})
     },
     savePayCode(){
       let url = this.aliPayCodeImg
@@ -135,10 +127,12 @@ export default {
 				this.pageTo({ url: "/admin/ghs/teachPay"})
 		},
     orderTimeFun(){
-      if(this.orderTime==0)return;
+      if(this.orderTime==0){
+        return
+      }
       setTimeout(()=>{
         this.orderTime--;
-        this.orderTimeFun();
+        this.orderTimeFun()
       },1000)
     },
     aliPay(){
@@ -154,7 +148,7 @@ export default {
       },7000)
 
       // #ifdef APP-PLUS
-      that.$util.confirmModal({content:'确认收到花材没有问题?结清后单无法再售后'},() => {
+      that.$util.confirmModal({content:'确认收到花材没有问题?结清后单无法再售后'},() => {
         purchaseClearAliPay({ orderSn: this.orderSn}).then(res=>{
           if(res.code == 1){
             that.orderSn = res.data.orderSn
@@ -165,7 +159,7 @@ export default {
       })
       // #endif
     },
-    wxPayFn(type){
+    wxPayFn(){
 
 			let platformType = uni.getSystemInfoSync().platform
 			if(platformType == 'windows'){
@@ -187,12 +181,8 @@ export default {
       this.$msg('请用小程序打开,再支付')
       return false
       // #endif
-      that.$util.confirmModal({content:'确认收到花材没有问题?结清后订单无法再售后'},() => {
-        if(type == 1){
-          that.confirmWxPayFn()
-        }else{
-          that.confirmWxPayFnOld()
-        }
+      that.$util.confirmModal({content:'确认收到花材没有问题?结清后本单无法再售后'},() => {
+        that.confirmWxPayFn()
       })
     },
     confirmWxPayFn () {
@@ -217,7 +207,6 @@ export default {
       purchaseClearWxPay({ orderSn: this.orderSn,currentMiniOpenId:currentMiniOpenId }).then(res => {
         that.orderSn = res.data.orderSn
         wexinPay(res.data, this.getSuccess, this.getError)
-        that.getPayCodeFn(that.orderSn)
       })
     },
     confirmWxPayFnOld() {

+ 1 - 1
hdApp/src/pagesPurchase/gathering.vue

@@ -195,7 +195,7 @@ export default {
                 that.pageTo({ url: '/admin/clear/list', type: 2})
               })              
             }else{
-              that.pageTo({ url: '/pagesPurchase/gatherPay?orderSn=' + res.data.orderSn + '&actPrice=' + res.data.actPrice+'&remainSecond='+res.data.remainSecond+'&getPayType='+res.data.getPayType+'&id='+res.data.id, type: 2 })
+              that.pageTo({ url: '/pagesPurchase/gatherPay?id='+res.data.id, type: 2 })
             } 
           }
         })

+ 0 - 1
hdApp/src/pagesPurchase/order.vue

@@ -72,7 +72,6 @@
               </view>
               <view class="box_6 flex-row" @click.stop="settleAccounts(ghsInfo)" v-if="Number(ghsInfo.debtAmount)>0">
                 <view class="show_clear_area flex-row justify-between">
-                  <image class="icon_2" referrerpolicy="no-referrer" src="/static/lanhu_020105gongyingshangliebiao/ps2pvfa1l5i34w5vqj2k7b3kejml3i3nmrba1421bf-caa2-491b-8773-af413df7e96d.png" />
                   <text class="waite_clear_order">
                   待结订单 {{ghsInfo.debtNum}}笔 合计¥{{ghsInfo.debtAmount?parseFloat(ghsInfo.debtAmount):0}}
                   <text style="margin-left:30upx;" v-if="ghsInfo.remainDebtAmount>0">选订单结 》</text>