Selaa lähdekoodia

提交选中商品的规则

lvhao 2 kuukautta sitten
vanhempi
commit
3fc38ed4d4
2 muutettua tiedostoa jossa 78 lisäystä ja 0 poistoa
  1. 1 0
      template/erp/choice.html
  2. 77 0
      template/erp/js/goodsrules.js

+ 1 - 0
template/erp/choice.html

@@ -550,4 +550,5 @@
 		**/
 	</script>
 	<script src="{$theme}js/fullorder-addedit.js?v=202310110001"></script>
+	<script src="{$theme}js/goodsrules.js?v={time()}"></script>
 	{Template footer}

+ 77 - 0
template/erp/js/goodsrules.js

@@ -0,0 +1,77 @@
+// 此文件就是为了限制商品的规则  避免选择错误
+
+//头套种类
+$("select[name='lacetype']").on("change", function() {
+    checkHD($(this))
+})
+//蕾丝类型
+$("select[name='lacetypes']").on("change", function() {
+    checkHD($(this))
+})
+//类目
+$("select[name='category']").on("change", function() {
+    checkBendang($(this))
+})
+//真人发类型
+$("select[name='hairtype']").on("change", function() {
+    checkBendang($(this))
+})
+//等级
+$("select[name='grade']").on("change", function() {
+    checkColorGrade($(this))
+})
+//颜色
+$("select[name='color']").on("change", function() {
+    checkColorGrade($(this))
+})
+
+/**
+ * 头套类型里有HD字眼则不可再单独勾选蕾丝类型里的HD字眼
+ * lacetype_text  头套类型选中的文本值
+ * lacetypes_text 蕾丝类型选中的文本值
+ */
+function  checkHD(that) {
+    let lacetype_text = $("select[name='lacetype']").find("option:selected").text();
+    let lacetypes_text = $("select[name='lacetypes']").find("option:selected").text();
+    if (lacetype_text.indexOf("HD") >= 0 && lacetypes_text.indexOf("HD") >= 0) {
+        that.val("")
+        layx.alert('错误', '头套类型里有HD字眼则不可再单独勾选蕾丝类型里的HD字眼', function(id, button) {
+                        
+        }, { dialogIcon: 'error' });
+    }
+}
+
+/**
+ * 发条类产品勾选的时候,不可勾选“BENDANG”选项
+ * category_value 选中类目的值     发条id   126
+ * hairtype_value 真人发类型选中值  本档id  2469
+ */ 
+function checkBendang(that) {
+    let category_value = $("select[name='category']").val();
+    let hairtype_value = $("select[name='hairtype']").val();
+    if (category_value == 126 && hairtype_value == 2469) {
+        that.val("")
+        layx.alert('错误', '发条类产品勾选的时候,不可勾选“BENDANG”选项', function(id, button) {
+                        
+        }, { dialogIcon: 'error' });
+    }
+}
+
+/**
+ * 当颜色选择是#613时,不可将等级勾选为9A
+ * grade_value 选中类目的值      9A代表80  10A代表81
+ * color_value 真人发类型选中值  44代表#613
+ */ 
+function checkColorGrade(that) {
+    let grade_value = $("select[name='grade']").val();
+    let color_value = $("select[name='color']").val();
+    
+    if (grade_value == 80 && color_value == 44) {
+        that.val("")
+        layx.alert('错误', '当颜色选择是#613时,不可将等级勾选为9A', function(id, button) {
+           let ysdj =  $("select[name='color']").find("option:selected").data('ysdj')
+           $("select[name='grade']").val(ysdj)
+        }, { dialogIcon: 'error' });
+    }
+}
+