shish 1 år sedan
förälder
incheckning
1eed510ac5

+ 1 - 1
ghsPad/src/api/product/index.js

@@ -77,7 +77,7 @@ export const generatePriceTable = data => {
 };
 
 //所有花材
-export const allProduct = async data => {
+export const allProduct = data => {
 	return https.get("/product/all", data);
 };
 

+ 9 - 8
ghsPad/src/mixins/product.js

@@ -343,20 +343,21 @@ export default {
 			}
 		},
 		listenScanItem(){
-			// #ifdef APP-PLUS
 			//避免重复,每次进来先移除全局自定义事件监听器
 			uni.$off('listenGetScanCode')
 			let that = this
 			uni.$on('listenGetScanCode',function(data){
 				that.takeItem(data.code)
 			})
-			allProduct().then(res=>{
-				if(res.code == 1){
-					that.globalAllProduct = res.data.list
-					console.log('载入最新花材...')
-				}
-			})
-			// #endif
+			this.getAllProduct()
+			//console.log('000000')
 		},
+		async getAllProduct(){
+			const { data,code } = await allProduct()
+			if(code == 1){
+				this.globalAllProduct = data.list
+				//console.log('异步载入最新花材...')
+			}
+		}
 	}
 }

+ 1 - 1
hdPad/src/api/product/index.js

@@ -77,7 +77,7 @@ export const generatePriceTable = data => {
 };
 
 //所有花材
-export const allProduct = async data => {
+export const allProduct = data => {
 	return https.get("/product/all", data);
 };
 

+ 9 - 8
hdPad/src/mixins/product.js

@@ -343,20 +343,21 @@ export default {
 			}
 		},
 		listenScanItem(){
-			// #ifdef APP-PLUS
 			//避免重复,每次进来先移除全局自定义事件监听器
 			uni.$off('listenGetScanCode')
 			let that = this
 			uni.$on('listenGetScanCode',function(data){
 				that.takeItem(data.code)
 			})
-			allProduct().then(res=>{
-				if(res.code == 1){
-					that.globalAllProduct = res.data.list
-					console.log('载入最新花材...')
-				}
-			})
-			// #endif
+			that.getAllProduct()
+			//console.log('111111')
 		},
+		async getAllProduct(){
+			const { data,code } = await allProduct()
+			if(code == 1){
+				this.globalAllProduct = data.list
+				//console.log('异步载入最新花材...')
+			}
+		}
 	}
 }