Bladeren bron

支持中文搜索

shish 4 jaren geleden
bovenliggende
commit
426613183b
3 gewijzigde bestanden met toevoegingen van 38 en 24 verwijderingen
  1. 2 0
      ghsApp/src/admin/home/workbench.vue
  2. 31 21
      ghsApp/src/mixins/product.js
  3. 5 3
      hdApp/src/mixins/cgPlantProduct.js

+ 2 - 0
ghsApp/src/admin/home/workbench.vue

@@ -192,6 +192,8 @@ export default {
 			this.pageTo({ url: '/admin/custom/selectCustom',query: {style:1}})
 		},
 		skKd(){
+			this.$msg('请在零售端开单')
+			return false
 			let that = this
 			let currentId = 0;
 			if(this.skCustomId > 0){

+ 31 - 21
ghsApp/src/mixins/product.js

@@ -258,28 +258,33 @@ export default {
 				return
 			}
 
+			var reg = /^[0-9a-zA-Z]*$/g
+			let notChinese = reg.test(this.py) == true ? true : false
+
 			//大于等于2个字符才开始搜索 shish 20210622
 			if(this.py.length <=1){
 				return
 			}
-			//红色粉色花材太多,搜索时会卡住,所以设置输入第三个字母时才搜索
-			if(this.py.indexOf('fs') == 0 && this.py.length <= 2){
-				return
-			}
-			if(this.py.indexOf('hs') == 0 && this.py.length <= 2){
-				return
-			}
-			if(this.py.indexOf('zs') == 0 && this.py.length <= 2){
-				return
-			}
-			if(this.py.indexOf('ls') == 0 && this.py.length <= 2){
-				return
-			}
-			if(this.py.indexOf('bs') == 0 && this.py.length <= 2){
-				return
-			}
-			if(this.py.indexOf('yj') == 0 && this.py.length <= 2){
-				return
+			if(notChinese){
+				//红色粉色花材太多,搜索时会卡住,所以设置输入第三个字母时才搜索
+				if(this.py.indexOf('fs') == 0 && this.py.length <= 2){
+					return
+				}
+				if(this.py.indexOf('hs') == 0 && this.py.length <= 2){
+					return
+				}
+				if(this.py.indexOf('zs') == 0 && this.py.length <= 2){
+					return
+				}
+				if(this.py.indexOf('ls') == 0 && this.py.length <= 2){
+					return
+				}
+				if(this.py.indexOf('bs') == 0 && this.py.length <= 2){
+					return
+				}
+				if(this.py.indexOf('yj') == 0 && this.py.length <= 2){
+					return
+				}
 			}
 			//涉及记住花材的代码和流程,请全项目搜索关键词remember_item
 			//将已选的花材按productId键名组合
@@ -305,9 +310,14 @@ export default {
 					currentItem.userPrice = 0
 					currentItem.smallCount = 0
 				}
-				let elePy = (currentItem.py && currentItem.py.toLocaleUpperCase()) || "";
-				let hasPy = elePy.indexOf(this.py.toLocaleUpperCase()) >= 0;
-				if (hasPy) {
+				let has = false
+				if (notChinese){
+					let elePy = (currentItem.py && currentItem.py.toLocaleUpperCase()) || "";
+					has = elePy.indexOf(this.py.toLocaleUpperCase()) >= 0 ? true : false
+				}else{
+					has = currentItem.name && currentItem.name.indexOf(this.py) >= 0 ? true : false
+				}
+				if (has) {
 					if(this.$util.isEmpty(filterItemData)){
 						filterItemData = [{classId: currentItem.classId, className: currentItem.className,isActive:true,child:[currentItem]}]
 					}else{

+ 5 - 3
hdApp/src/mixins/cgPlantProduct.js

@@ -335,10 +335,12 @@ export default {
 			}
 			let index = list.findIndex(element => element.id == item.id)
 			if(index == -1){
-				if(this.$util.isEmpty(item.userPrice) || Number(item.userPrice) == 0){
-					item.userPrice = item.bigPrice
+				if(Number(item.bigCount) > 0){
+					if(this.$util.isEmpty(item.userPrice) || Number(item.userPrice) == 0){
+						item.userPrice = item.bigPrice
+					}
+					list.push(item)
 				}
-				list.push(item)			
 			}else{
 				if(item.bigCount <= 0){
 					//删除商品