From db7fa6a91b9534ac90e219b6f554c54c43c83a5a Mon Sep 17 00:00:00 2001
From: liujie <liujie>
Date: 星期三, 16 八月 2023 09:28:15 +0800
Subject: [PATCH] update

---
 management/guns-admin/src/main/webapp/static/modular/system/tCoupon/tCoupon_info.js |   59 +++++++++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 47 insertions(+), 12 deletions(-)

diff --git a/management/guns-admin/src/main/webapp/static/modular/system/tCoupon/tCoupon_info.js b/management/guns-admin/src/main/webapp/static/modular/system/tCoupon/tCoupon_info.js
index 7bab211..b2549d4 100644
--- a/management/guns-admin/src/main/webapp/static/modular/system/tCoupon/tCoupon_info.js
+++ b/management/guns-admin/src/main/webapp/static/modular/system/tCoupon/tCoupon_info.js
@@ -8,27 +8,24 @@
             validators: {
                 notEmpty: {
                     message: '优惠券名称不能为空'
+                },
+                regexp: {
+                    regexp:  /^[\u4E00-\u9FA5A-Za-z\s]+$/,
+                    message: '不能输入特殊字符和数字'
                 }
             }
         },
         couponType: {
             validators: {
                 notEmpty: {
-                    message: '优惠券类型不能为空'
+                    message: '请选择优惠券类型'
                 }
             }
         },
         couponServiceType: {
             validators: {
                 notEmpty: {
-                    message: '服务类类型不能为空'
-                }
-            }
-        },
-        couponCount: {
-            validators: {
-                notEmpty: {
-                    message: '优惠券数量不能为空'
+                    message: '请选择服务类类型'
                 }
             }
         },
@@ -36,6 +33,10 @@
             validators: {
                 notEmpty: {
                     message: '条件金额不能为空'
+                },
+                regexp: {
+                    regexp: /^[1-9]\d*$/,
+                    message: '请输入大于0的正整数'
                 }
             }
         },
@@ -43,6 +44,10 @@
             validators: {
                 notEmpty: {
                     message: '优惠金额不能为空'
+                },
+                regexp: {
+                    regexp: /^[1-9]\d*$/,
+                    message: '请输入大于0的正整数'
                 }
             }
         },
@@ -50,6 +55,10 @@
             validators: {
                 notEmpty: {
                     message: '有效期不能为空'
+                },
+                regexp: {
+                    regexp: /^[1-9]\d*$/,
+                    message: '请输入大于0的正整数'
                 }
             }
         },
@@ -57,6 +66,10 @@
             validators: {
                 notEmpty: {
                     message: '优惠券总量不能为空'
+                },
+                regexp: {
+                    regexp: /^[1-9]\d*$/,
+                    message: '请输入大于0的正整数'
                 }
             }
         },
@@ -137,11 +150,33 @@
         return ;
     }
 
+    var couponConditionalAmount = $('#couponConditionalAmount').val();
+    if(couponConditionalAmount < 14){
+        Feng.info("条件金额最低14元!")
+        return;
+    }
+
+    var couponType = $('#couponType').val();
+    if(couponType == 2 && ($("input[name=couponCount2]").val() == null || $("input[name=couponCount2]").val() == '')){
+        Feng.info("请填写优惠券限制数量!")
+        return;
+    }
+
+    // if(couponType == 2 && $("input[name=couponCount2]").val() < 1){
+    //     Feng.info("新人优惠券限制数量必须大于0!")
+    //     return;
+    // }
+
     //提交信息
     var ajax = new $ax(Feng.ctxPath + "/tCoupon/add", function(data){
-        Feng.success("添加成功!");
-        window.parent.TCoupon.table.refresh();
-        TCouponInfoDlg.close();
+        if(500 == data.code){
+            Feng.error(data.message)
+            return;
+        }else {
+            Feng.success("添加成功!");
+            window.parent.TCoupon.table.refresh();
+            TCouponInfoDlg.close();
+        }
     },function(data){
         Feng.error("添加失败!" + data.responseJSON.message + "!");
     });

--
Gitblit v1.7.1