Browse Source

增加限制医美机构购买优惠券

zhengjinyi 3 years ago
parent
commit
e86bdf707f

+ 9 - 1
src/main/resources/static/js/product/detail.js

@@ -687,7 +687,15 @@ var productDetail = new Vue({
                     let couponRecordId = response.data.couponRecordId
                     window.location.href = '/pay/caimei-paycash.html?pageType=3&couponId='+coupon.couponId+'&couponRecordId='+couponRecordId;
                 }else{
-                    CAIMEI.Alert(response.msg, '确定', false);
+                    if(response.code == -1){//个人机构不能购买
+                        CAIMEI.Alert('该优惠券仅限医美机构购买,请升级为医美机构后再次购买。', '去升级', true, function(){
+                            window.location.href = "/user/setting/upgrade.html.html";
+                        });
+                    }else if(response.code == -2){//会员机构不是医美机构不能购买
+                        CAIMEI.dialog('该优惠券仅限医美机构购买',false,function () {});
+                    }else{
+                        CAIMEI.Alert(response.msg, '确定', false);
+                    }
                 }
             })
         },

+ 9 - 1
src/main/resources/static/js/shopping/cart.js

@@ -539,7 +539,15 @@ var shoppingCart = new Vue({
                     let couponRecordId = response.data.couponRecordId
                     window.location.href = '/pay/caimei-paycash.html?pageType=3&couponId='+coupon.couponId+'&couponRecordId='+couponRecordId;
                 }else{
-                    CAIMEI.Alert(response.msg, '确定', false);
+                    if(response.code == -1){//个人机构不能购买
+                        CAIMEI.Alert('该优惠券仅限医美机构购买,请升级为医美机构后再次购买。', '去升级', true, function(){
+                            window.location.href = "/user/setting/upgrade.html.html";
+                        });
+                    }else if(response.code == -2){//会员机构不是医美机构不能购买
+                        CAIMEI.dialog('该优惠券仅限医美机构购买',false,function () {});
+                    }else{
+                        CAIMEI.Alert(response.msg, '确定', false);
+                    }
                 }
             })
         },

+ 9 - 1
src/main/resources/static/js/user-center/account/coupon-collection.js

@@ -112,7 +112,15 @@ var orderPage = new Vue({
                         let couponRecordId = response.data.couponRecordId
                         window.location.href = '/pay/caimei-paycash.html?pageType=3&couponId='+coupon.couponId+'&couponRecordId='+couponRecordId;
                     }else{
-                        CAIMEI.Alert(response.msg, '确定', false);
+                        if(response.code == -1){//个人机构不能购买
+                            CAIMEI.Alert('该优惠券仅限医美机构购买,请升级为医美机构后再次购买。', '去升级', true, function(){
+                                window.location.href = "/user/setting/upgrade.html.html";
+                            });
+                        }else if(response.code == -2){//会员机构不是医美机构不能购买
+                            CAIMEI.dialog('该优惠券仅限医美机构购买',false,function () {});
+                        }else{
+                            CAIMEI.Alert(response.msg, '确定', false);
+                        }
                     }
                 })
             }