From 200acf9283ff06e75874df263b1e125a71e76215 Mon Sep 17 00:00:00 2001
From: nickchange <126672920+nickchange@users.noreply.github.com>
Date: 星期五, 27 十月 2023 14:57:43 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 cloud-server-management/src/main/webapp/static/modular/system/tCoupon/TCouponInfo.js |   59 +++++++++++++++++++++++++++++++++++------------------------
 1 files changed, 35 insertions(+), 24 deletions(-)

diff --git a/cloud-server-management/src/main/webapp/static/modular/system/tCoupon/TCouponInfo.js b/cloud-server-management/src/main/webapp/static/modular/system/tCoupon/TCouponInfo.js
index 6dbb6fd..d4cab8a 100644
--- a/cloud-server-management/src/main/webapp/static/modular/system/tCoupon/TCouponInfo.js
+++ b/cloud-server-management/src/main/webapp/static/modular/system/tCoupon/TCouponInfo.js
@@ -358,10 +358,12 @@
     }
 
 
-    // 说明
-    var illustrate = $('#illustrate').val();
-    if (illustrate === undefined || illustrate === '' || illustrate === null){
-        return Feng.error('优惠券说明不能为空');
+    if ($('#userType').val()==1) {
+        // 说明
+        var illustrate = $('#illustrate').val();
+        if (illustrate === undefined || illustrate === '' || illustrate === null) {
+            return Feng.error('优惠券说明不能为空');
+        }
     }
     // 发放方式
     let distributionMethod = $(":radio[name='distributionMethod']:checked").val();
@@ -390,6 +392,7 @@
     if (periodOfValidity === undefined || periodOfValidity === '' || periodOfValidity === null){
         return Feng.error('有效期不能为空');
     }
+    if ($('#userType').val()==1){
     // 兑换方式
     let exchangeMethod = $(':radio[name="exchangeMethod"]:checked').val();
     if (exchangeMethod === '' || exchangeMethod === undefined || exchangeMethod === null){
@@ -413,28 +416,29 @@
             return Feng.error('所需现金不能为空');
         }
     }
-
+    }
     let company = $(':radio[name="company"]:checked').val();
     var cts = "";
-    if (company === '2'){
-        var myselect=document.getElementById('cityData');
-        var seCity = myselect.options[myselect.selectedIndex].value;
-        if (seCity === null || seCity === undefined || seCity === ''){
-            return Feng.error('请选中一个省市');
-        }
-        cityIds.push(seCity);
-        if (num > 0){
-            for (let i = 1; i <= num; i++) {
-                var insSelect=document.getElementById('cityData'+i);
-                var inData = insSelect.options[insSelect.selectedIndex].value;
-                if (inData !== undefined || inData !== null ||  inData !== ''){
-                    cityIds.push(inData);
-                }
+    if ($('#userType').val()==1) {
+        if (company === '2') {
+            var myselect = document.getElementById('cityData');
+            var seCity = myselect.options[myselect.selectedIndex].value;
+            if (seCity === null || seCity === undefined || seCity === '') {
+                return Feng.error('请选中一个省市');
             }
-            cts = cityIds.join(',');
+            cityIds.push(seCity);
+            if (num > 0) {
+                for (let i = 1; i <= num; i++) {
+                    var insSelect = document.getElementById('cityData' + i);
+                    var inData = insSelect.options[insSelect.selectedIndex].value;
+                    if (inData !== undefined || inData !== null || inData !== '') {
+                        cityIds.push(inData);
+                    }
+                }
+                cts = cityIds.join(',');
+            }
         }
     }
-
     const commaSeparatedString = this.goodsPicArray.join(',');
 
     var stores = "";
@@ -454,14 +458,15 @@
     }, function (data) {
         Feng.error("添加失败!" + data.responseJSON.message + "!");
     });
-    ajax.set("userType",1);
-    ajax.set("cityManagerId",1);
+    ajax.set("userType",$('#userType').val());
+    ajax.set("cityManagerId",0);
     ajax.set("couponName",couponName);
     ajax.set("prescription",prescription);
     ajax.set("condition",conditionalAmount);
     ajax.set("subtraction",deductionAmount);
     ajax.set("discount",voucherAmount);
     ajax.set("experience",experienceName);
+    var illustrate = $('#illustrate').val();
     ajax.set("illustrate",illustrate);
     ajax.set("distributionMethod",distributionMethod);
     ajax.set("requiredPoints",requiredPoints);
@@ -470,7 +475,13 @@
     ajax.set("quantityIssued",quantityIssued);
     ajax.set("pickUpQuantity",pickUpQuantity);
     ajax.set("periodOfValidity",periodOfValidity);
-    ajax.set("exchangeMethod",exchangeMethod);
+
+    if ($('#userType').val()==2) {
+        ajax.set("exchangeMethod",1);
+    }else{
+        let exchangeMethod = $(':radio[name="exchangeMethod"]:checked').val();
+        ajax.set("exchangeMethod",exchangeMethod);
+    }
     ajax.set("goodImg",this.goodsCover);
     ajax.set("goodImgs",commaSeparatedString);
     ajax.set("company",company);

--
Gitblit v1.7.1