浏览代码

feat: 订阅升级0元订单提交

yangfeng 4 年之前
父节点
当前提交
384465a4f1

+ 7 - 6
src/jfw/modules/app/src/web/staticres/jyapp/vipsubscribe/js/vip_upgrade.js

@@ -586,12 +586,13 @@ $(function () {
       if (r.success) {
         try {
           clearSessionStorage()
-          // if (param.price == 0) {
-          //   window.location.replace("/jyapp/vipsubscribe/toOrderDetailPage?orderCode=" + r.data.code)
-          //   return
-          // }
-          history.replaceState({}, '', '/jyapp/vipsubscribe/toOrderDetailPage?orderCode=' + r.data.code);
-          window.location.href = "/jyapp/pay/checkout_subvip?orderCode=" + r.data.code + "&t=2&from=buy"
+          if (r.data.needPay) {
+            history.replaceState({}, '', '/jyapp/vipsubscribe/toOrderDetailPage?orderCode=' + r.data.code);
+            window.location.href = "/jyapp/pay/checkout_subvip?orderCode=" + r.data.code + "&t=2&from=buy"
+          } else {
+            // 0元订单提交
+            window.location.replace("/jyapp/subvip/paySuccess?orderCode=" + r.data.code + '&t=2');
+          }
         } catch (e) {
           showToast(e)
         }

+ 7 - 2
src/web/staticres/vipsubscribe/js/vip_upgrade.js

@@ -593,8 +593,13 @@ $(function () {
     $DoPost("/subscribepay/vipsubscribe/upgrade", param, function (r) {
       if (r.success) {
         clearSessionStorage();
-        history.replaceState({}, '', '/front/vipsubscribe/toOrderDetailPage?orderCode=' + r.data.code);
-        window.location.href = "/weixin/pay/checkout_subvip?t=2&orderCode=" + r.data.code;
+        if (r.data.needPay) {
+          history.replaceState({}, '', '/front/vipsubscribe/toOrderDetailPage?orderCode=' + r.data.code);
+          window.location.href = "/weixin/pay/checkout_subvip?t=2&orderCode=" + r.data.code;
+        } else {
+          // 0元订单提交
+          window.location.replace("/weixin/subvip/paySuccess?orderCode=" + r.data.code + '&t=2');
+        }
       } else {
         $('.vip-footer.renew .confirm').removeAttr("disabled");
       }