shish 2 سال پیش
والد
کامیت
78970e12e3
2فایلهای تغییر یافته به همراه33 افزوده شده و 5 حذف شده
  1. 5 4
      hdApp/src/api/purchase/index.js
  2. 28 1
      hdApp/src/pagesPurchase/wechatPay.vue

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

@@ -104,10 +104,11 @@ export const createPurchaseOrderApi = async data => {
 	return https.get("/purchase/detail", data);
 };
 
-/** *
- * 采购详情
- */
- export const purchaseWxPay = async data => {
+export const purchaseAliPay = async data => {
+	return https.post("/purchase/ali-pay", data);
+};
+
+export const purchaseWxPay = async data => {
 	return https.post("/purchase/wx-pay", data);
 };
 /** *

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

@@ -40,6 +40,7 @@
           <view>
             <button class="button-com pay-wx" :class="[remainPayTime >0 ? 'green':'default']" :disabled="remainPayTime >0 ? false : true" @click="appWxPayFn">微信支付</button>
           </view>
+          <button class="button-com pay-wx" :class="[remainPayTime >0 ? 'ali-btn':'default']" :disabled="remainPayTime >0 ? false : true" @click="appAliPayFn">支付宝支付</button>
           <button class="button-com pay-wx" :class="[remainPayTime >0 ? 'green':'default']" :disabled="remainPayTime >0 ? false : true" @click="debtPay" v-if="hasDebtPay === '1'">赊账</button>
         </div>
         <!-- #endif -->
@@ -57,7 +58,7 @@
 </template>
 
 <script>
-import { purchaseBalancePay, purchaseDebtPay, purchaseWxPay,getDetail } from "@/api/purchase";
+import { purchaseBalancePay, purchaseDebtPay, purchaseWxPay,purchaseAliPay,getDetail } from "@/api/purchase";
 import keyboardModule from './components/keyboard'
 import { mapGetters } from "vuex";
 import wexinPay from "@/utils/pay/wxPay";
@@ -141,6 +142,27 @@ export default {
         })
       })      
     },
+    appAliPayFn(){
+      let that = this
+      // #ifdef APP-PLUS
+      uni.showLoading()
+      let id = this.option.id ? this.option.id : 0   
+      purchaseAliPay({ orderSn: this.orderSn }).then(res => {
+        uni.hideLoading()
+        if(res.code == 1){
+          if(res.data.payUrl){
+            that.orderSn = res.data.orderSn
+            plus.runtime.openWeb(res.data.payUrl)
+            setTimeout(function(){
+              that.$util.confirmModal({content:'已付款成功?',okText:'是的',cancelText:'没有'},() => {
+                that.pageTo({ url: '/pagesPurchase/particulars?id=' + id, type: 2 })
+              })
+            },3000)
+          }
+        }
+      })
+      // #endif
+    },
     appWxPayFn(){
         let that = this
         // #ifdef APP-PLUS
@@ -318,6 +340,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-repeat: no-repeat;