Просмотр исходного кода

Merge branch 'redesign‌-260706' of http://git.huaml.com/zhh/front-end into redesign‌-260706

ouyang 22 часов назад
Родитель
Сommit
46868757ee
3 измененных файлов с 25 добавлено и 0 удалено
  1. 3 0
      mallApp/src/constant/errCode.js
  2. 11 0
      mallApp/src/pages/callback/index.vue
  3. 11 0
      mallApp/src/pages/callback/pay.vue

+ 3 - 0
mallApp/src/constant/errCode.js

@@ -1,4 +1,7 @@
 /** 与后端 common/components/errCode.php 对应的业务错误码 */
 /** 与后端 common/components/errCode.php 对应的业务错误码 */
 
 
+// 订单:应付金额为0,无需拉起微信支付
+export const ORDER_PAY_AMOUNT_ZERO = 4001
+
 // 拼团:客户在当前门店暂无绑定关系
 // 拼团:客户在当前门店暂无绑定关系
 export const GROUP_BUY_HD_NOT_BOUND = 6001
 export const GROUP_BUY_HD_NOT_BOUND = 6001

+ 11 - 0
mallApp/src/pages/callback/index.vue

@@ -66,6 +66,7 @@ import wexinPay from "@/utils/pay/wxPay";
 import { getShopUser } from "@/utils/auth";
 import { getShopUser } from "@/utils/auth";
 import { balancePay, wxPay } from "@/api/order";
 import { balancePay, wxPay } from "@/api/order";
 import { postWxCode } from '@/api/mini';
 import { postWxCode } from '@/api/mini';
+import { ORDER_PAY_AMOUNT_ZERO } from '@/constant/errCode'
 import { getHdInfo } from '@/api/hd';
 import { getHdInfo } from '@/api/hd';
 export default {
 export default {
   name: "index",
   name: "index",
@@ -151,6 +152,11 @@ export default {
             if(subRes.data.miniOpenId){
             if(subRes.data.miniOpenId){
               let miniOpenId = subRes.data.miniOpenId
               let miniOpenId = subRes.data.miniOpenId
               wxPay({ orderSn: that.orderSn, couponId: that.option.couponId,miniOpenId:miniOpenId }).then(res => {
               wxPay({ orderSn: that.orderSn, couponId: that.option.couponId,miniOpenId:miniOpenId }).then(res => {
+                if (res.code === ORDER_PAY_AMOUNT_ZERO) {
+                  that.orderSn = (res.data && res.data.orderSn) ? res.data.orderSn : that.orderSn
+                  that.paySuccess()
+                  return
+                }
                 this.payCallData = res.data
                 this.payCallData = res.data
                 wexinPay(res.data, that.paySuccess, that.payFail)
                 wexinPay(res.data, that.paySuccess, that.payFail)
                 that.orderSn = res.data.orderSn ? res.data.orderSn : ''
                 that.orderSn = res.data.orderSn ? res.data.orderSn : ''
@@ -163,6 +169,11 @@ export default {
     wxPayFnOld() {
     wxPayFnOld() {
       let miniOpenId = uni.getStorageSync('miniOpenId')
       let miniOpenId = uni.getStorageSync('miniOpenId')
       wxPay({ orderSn: this.orderSn, couponId: this.option.couponId,miniOpenId:miniOpenId }).then(res => {
       wxPay({ orderSn: this.orderSn, couponId: this.option.couponId,miniOpenId:miniOpenId }).then(res => {
+        if (res.code === ORDER_PAY_AMOUNT_ZERO) {
+          this.orderSn = (res.data && res.data.orderSn) ? res.data.orderSn : this.orderSn
+          this.paySuccess()
+          return
+        }
         this.payCallData = res.data
         this.payCallData = res.data
         wexinPay(res.data, this.paySuccess, this.payFail)
         wexinPay(res.data, this.paySuccess, this.payFail)
         this.orderSn = res.data.orderSn ? res.data.orderSn : ''
         this.orderSn = res.data.orderSn ? res.data.orderSn : ''

+ 11 - 0
mallApp/src/pages/callback/pay.vue

@@ -75,6 +75,7 @@ import wexinPay from "@/utils/pay/wxPay";
 import { getShopUser } from "@/utils/auth";
 import { getShopUser } from "@/utils/auth";
 import { balancePay, wxPay, getDetail } from "@/api/order";
 import { balancePay, wxPay, getDetail } from "@/api/order";
 import { postWxCode } from '@/api/mini';
 import { postWxCode } from '@/api/mini';
+import { ORDER_PAY_AMOUNT_ZERO } from '@/constant/errCode'
 export default {
 export default {
   name: "index",
   name: "index",
   components: {
   components: {
@@ -152,6 +153,11 @@ export default {
             if(subRes.data.miniOpenId){
             if(subRes.data.miniOpenId){
               let miniOpenId = subRes.data.miniOpenId
               let miniOpenId = subRes.data.miniOpenId
               wxPay({ orderSn: that.orderSn, couponId: that.option.couponId,miniOpenId:miniOpenId }).then(res => {
               wxPay({ orderSn: that.orderSn, couponId: that.option.couponId,miniOpenId:miniOpenId }).then(res => {
+                if (res.code === ORDER_PAY_AMOUNT_ZERO) {
+                  that.orderSn = (res.data && res.data.orderSn) ? res.data.orderSn : that.orderSn
+                  that.paySuccess()
+                  return
+                }
                 this.payCallData = res.data
                 this.payCallData = res.data
                 wexinPay(res.data, that.paySuccess, that.payFail)
                 wexinPay(res.data, that.paySuccess, that.payFail)
                 that.orderSn = res.data.orderSn ? res.data.orderSn : ''
                 that.orderSn = res.data.orderSn ? res.data.orderSn : ''
@@ -164,6 +170,11 @@ export default {
     wxPayFnOld() {
     wxPayFnOld() {
       let miniOpenId = uni.getStorageSync('miniOpenId')
       let miniOpenId = uni.getStorageSync('miniOpenId')
       wxPay({ orderSn: this.orderSn, couponId: this.option.couponId,miniOpenId:miniOpenId }).then(res => {
       wxPay({ orderSn: this.orderSn, couponId: this.option.couponId,miniOpenId:miniOpenId }).then(res => {
+        if (res.code === ORDER_PAY_AMOUNT_ZERO) {
+          this.orderSn = (res.data && res.data.orderSn) ? res.data.orderSn : this.orderSn
+          this.paySuccess()
+          return
+        }
         this.payCallData = res.data
         this.payCallData = res.data
         wexinPay(res.data, this.paySuccess, this.payFail)
         wexinPay(res.data, this.paySuccess, this.payFail)
         this.orderSn = res.data.orderSn ? res.data.orderSn : ''
         this.orderSn = res.data.orderSn ? res.data.orderSn : ''