shish 2 years ago
parent
commit
78d8381f5f

+ 5 - 4
hdApp/src/api/purchase/index.js

@@ -76,13 +76,14 @@ export const createPurchaseOrderApi = async data => {
 	return https.post("/purchase-clear/create-order", data);
 };
 
-/** *
- * 待结款 - 微信支付
- */
- export const purchaseClearWxPay = async data => {
+export const purchaseClearWxPay = async data => {
 	return https.post("/purchase-clear/wx-pay", data);
 };
 
+export const purchaseClearAliPay = async data => {
+	return https.post("/purchase-clear/ali-pay", data);
+};
+
 /** *
  * 余额支付
  */

+ 47 - 5
hdApp/src/pagesPurchase/gatherPay.vue

@@ -23,9 +23,11 @@
             <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 ali-btn" @click="aliPay()">支付宝支付</button>
             </block>
             <block v-else>
               <button class="button-com disable pay-wx">微信支付</button>
+              <button class="button-com disable pay-wx">支付宝支付</button>
             </block>
           </div>
         </block>
@@ -34,7 +36,7 @@
   </div>
 </template>
 <script>
-import { purchaseClearWxPay } from "@/api/purchase/index";
+import { purchaseClearWxPay,purchaseClearAliPay } from "@/api/purchase";
 import wexinPay from "@/utils/pay/wxPay";
 import { mapGetters } from "vuex";
 import { postWxCode } from '@/api/mini'
@@ -51,7 +53,8 @@ export default {
       orderSn: '',
       actPrice: '',
       getPayType:1,
-      hasRequestApi:false
+      hasRequestApi:false,
+      needCheck:0
     };
   },
   onLoad (options) {
@@ -64,7 +67,14 @@ export default {
   computed: {
     ...mapGetters(["getLoginInfo", 'getDictionariesInfo']),
   },
-  mounted () {
+  onShow(){
+    let that = this
+    if(that.needCheck == 1){
+      that.needCheck = 0
+      that.$util.confirmModal({content:'已付款成功?',okText:'是的',cancelText:'没有'},() => {
+        that.pageTo({ url: '/pagesPurchase/gatherResult', type: 2 })
+      })
+    }
   },
   methods: {
     init(){
@@ -77,8 +87,12 @@ export default {
         this.orderTimeFun();
       },1000)
     },
-    wxPayFn(type){
+    aliPay(){
       let that = this
+      // #ifdef MP-WEIXIN
+      this.$util.confirmModal({content:'请到【应用市场】下载花掌柜,登录即可支付'},() => { })
+      return false
+      // #endif
 
       //解决重复提交问题
       if(this.hasRequestApi == true){
@@ -90,11 +104,34 @@ export default {
         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 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:'确认收到花材且无需售后?结清后订单不能再申请售后'},() => {
+      that.$util.confirmModal({content:'确认收到花材没有问题?结清后订单无法再售后'},() => {
         if(type == 1){
           that.confirmWxPayFn()
         }else{
@@ -169,6 +206,11 @@ export default {
 
 <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");

+ 1 - 2
hdApp/src/pagesPurchase/wechatPay.vue

@@ -11,7 +11,7 @@
         <view class="wait">待付款</view>
         <block>
           <div class="price" v-if="info.reachDiscountPrice && Number(info.reachDiscountPrice)>0">
-            <span class="app-size-36 app-bold" style="text-decoration:line-through;color:#8a7f7f;">¥{{ parseFloat((Number(info.reachDiscountPrice)+Number(realPrice)).toFixed(2)) }}</span>
+            <span class="app-size-36 app-bold" style="text-decoration:line-through;color:#8a7f7f;">¥{{ parseFloat((Number(info.reachDiscountPrice)+Number(realPrice)+Number(info.orderReachDiscountPrice)).toFixed(2)) }}</span>
           </div>
 
           <div class="order-num app-color-3" style="color:red;font-size:30upx;margin-top:10upx;margin-bottom:10upx;font-weight:bold;" 
@@ -218,7 +218,6 @@ export default {
     },
     wxPayFn () {
       let that = this
-
       //解决重复提交问题
       if(this.hasRequestApi == true){
         this.$msg('正在请求,请5秒后重试')