shish 4 лет назад
Родитель
Сommit
edfe7a292d

+ 3 - 4
hdPad/src/mixins/product.js

@@ -15,7 +15,7 @@ export default {
 			globalClassItemList:'',
 			globalClassItemList:'',
 			kdType:'HIT',//点击和扫码开单,HIT SCAN
 			kdType:'HIT',//点击和扫码开单,HIT SCAN
 			checkStock:true,// 考虑库存,盘点不需要考虑库存
 			checkStock:true,// 考虑库存,盘点不需要考虑库存
-			customData: { currentNum: 0, unitPrice: 0,unitType:0, unitName:'扎'},
+			customData: { currentNum: 0, unitPrice: 0,unitType:0, unitName:'扎',property:1},
 			globalItemList:[]
 			globalItemList:[]
 		};
 		};
 	},
 	},
@@ -179,9 +179,9 @@ export default {
 					list[index].unitType = item.unitType
 					list[index].unitType = item.unitType
 				}
 				}
 			}
 			}
-
 			//数据放到仓库永久存放
 			//数据放到仓库永久存放
 			this.pushToSave(list)
 			this.pushToSave(list)
+			this.addItemModelHidden()
 		},
 		},
 		//显示可以修改花材的弹框
 		//显示可以修改花材的弹框
 		showAddModelFn(info) {
 		showAddModelFn(info) {
@@ -226,8 +226,7 @@ export default {
 					return;
 					return;
 				}
 				}
 			}
 			}
-			this.replaceItemFn(item)
-			this.addItemModelHidden()			
+			this.replaceItemFn(item)			
 		},
 		},
 		addItemModelHidden() {
 		addItemModelHidden() {
 			this.$refs.selectNumPriceRef.close()
 			this.$refs.selectNumPriceRef.close()

+ 2 - 0
hdPad/src/mixins/scan.js

@@ -11,6 +11,7 @@ export default {
     },
     },
 	methods: {
 	methods: {
         listenScan(){
         listenScan(){
+            //let that = this
             //商米收银台
             //商米收银台
             if(plus.device.vendor == 'SUNMI'){
             if(plus.device.vendor == 'SUNMI'){
                 //https://ext.dcloud.net.cn/plugin?id=3514
                 //https://ext.dcloud.net.cn/plugin?id=3514
@@ -20,6 +21,7 @@ export default {
                 globalEvent.addEventListener('scancode',function(e){
                 globalEvent.addEventListener('scancode',function(e){
                     if(e.code == 'ok'){
                     if(e.code == 'ok'){
                         let productIdCode = e.data
                         let productIdCode = e.data
+                        //that.$msg(productIdCode)
                         uni.$emit('listenGetScanCode',{code:productIdCode})
                         uni.$emit('listenGetScanCode',{code:productIdCode})
                     }
                     }
                 })
                 })

+ 33 - 12
hdPad/src/pages/home/components/console.vue

@@ -37,22 +37,28 @@
 		<selectPrice @confirmSelectPrice="confirmSelectPrice" @cancelSelectPrice="cancelSelectPrice"></selectPrice>
 		<selectPrice @confirmSelectPrice="confirmSelectPrice" @cancelSelectPrice="cancelSelectPrice"></selectPrice>
 	</uni-popup>
 	</uni-popup>
 
 
+	<!-- 开单选花材输入数量和金额 -->
+	<uni-popup ref="selectNumPriceRef" background-color="#fff" type="center" :animation="false">
+		<selectNumPrice @confirmAddItemModel="confirmAddItemModel" :customData.sync="customData" @cancelKdSelectNumPrice="addItemModelHidden"></selectNumPrice>
+	</uni-popup>
+
 </view>
 </view>
 </template>
 </template>
 <script>
 <script>
-import settlePop from './settlePop.vue'
-import toPayWay from './toPay.vue'
+import settlePop from './settlePop'
+import toPayWay from './toPay'
 import { wastageCreateOrder } from '@/api/home/index'
 import { wastageCreateOrder } from '@/api/home/index'
 import { createOrder} from '@/api/order'
 import { createOrder} from '@/api/order'
 import {goodsWastage} from '@/api/wastage'
 import {goodsWastage} from '@/api/wastage'
 import productMins from "@/mixins/product"
 import productMins from "@/mixins/product"
 import { allProduct } from '@/api/product'
 import { allProduct } from '@/api/product'
 import { getBySn } from '@/api/goods'
 import { getBySn } from '@/api/goods'
-import selectPrice from './selectPrice.vue'
+import selectPrice from './selectPrice'
+import selectNumPrice from './selectNumPrice'
 export default {
 export default {
     name:'console',
     name:'console',
 	mixins: [productMins],
 	mixins: [productMins],
-    components:{ settlePop,toPayWay,selectPrice},
+    components:{ settlePop,toPayWay,selectPrice,selectNumPrice},
 	props: {
 	props: {
 		customId: {
 		customId: {
 			type: Number,
 			type: Number,
@@ -95,6 +101,12 @@ export default {
 	created(){
 	created(){
 		this.initData()
 		this.initData()
 	},
 	},
+	destroyed(){
+		// #ifdef APP-PLUS
+		//避免重复,每次进来先移除全局自定义事件监听器
+		uni.$off('listenGetScanCode')
+		// #endif
+	},
     methods:{
     methods:{
 		cancelSelectPrice(){
 		cancelSelectPrice(){
 			this.$refs.gatheringRef.close()
 			this.$refs.gatheringRef.close()
@@ -137,6 +149,7 @@ export default {
 			this.calc = this.calc == 'add' ? 'sub' : 'add'
 			this.calc = this.calc == 'add' ? 'sub' : 'add'
 		},
 		},
 		async takeItem(code){
 		async takeItem(code){
+			console.log(code)
 			if(this.$util.isEmpty(code)){
 			if(this.$util.isEmpty(code)){
 				return false
 				return false
 			}
 			}
@@ -148,8 +161,16 @@ export default {
 				const res = await getBySn({sn:code})
 				const res = await getBySn({sn:code})
 				if(res.code == 1){
 				if(res.code == 1){
 					current = res.data
 					current = res.data
+					if(this.$util.isEmpty(current)){
+						return false
+					}
 					unitName = '份'
 					unitName = '份'
 					unitPrice = Number(res.data.price)
 					unitPrice = Number(res.data.price)
+					this.customData = current
+					this.customData.currentNum = 1
+					this.customData.unitPrice = unitPrice
+					this.customData.property = 0
+					this.$refs.selectNumPriceRef.open('center')
 				}
 				}
 			}else{
 			}else{
 				//花材
 				//花材
@@ -159,17 +180,17 @@ export default {
 				if(current == undefined){
 				if(current == undefined){
 					return false
 					return false
 				}
 				}
+				if(this.$util.isEmpty(current)){
+					return false
+				}
 				unitName = current.bigUnit
 				unitName = current.bigUnit
 				unitPrice = current.bigPrice
 				unitPrice = current.bigPrice
+				this.$util.hitRemind()
+				let num = this.calc == 'add' ? 1 : -1
+				let params = {...current,unitName:unitName,unitPrice:unitPrice,currentNum:num}
+				console.log(params)
+				this.replaceItemFn(params,1)
 			}
 			}
-			if(this.$util.isEmpty(current)){
-				return false
-			}
-			this.$util.hitRemind()
-			let num = this.calc == 'add' ? 1 : -1
-			let params = {...current,unitName:unitName,unitPrice:unitPrice,currentNum:num}
-			console.log(params)
-			this.replaceItemFn(params,1)
 		},
 		},
 		changeProperty(){
 		changeProperty(){
 			this.property = this.property == 1 ? 0 : 1
 			this.property = this.property == 1 ? 0 : 1

+ 9 - 5
hdPad/src/pages/home/components/nav.vue

@@ -34,13 +34,17 @@ export default {
   },
   },
   methods: {
   methods: {
 		getScan(item){
 		getScan(item){
+      console.log(item)
       let hasScanCode = uni.getStorageSync('hasScanCode')
       let hasScanCode = uni.getStorageSync('hasScanCode')
-      let code = item.key || ''
-      if(!this.$util.isEmpty(code) && code != 'Unidentified'){
-        if(code != 'Enter'){
-          uni.setStorageSync('hasScanCode', hasScanCode+code)
+      let val = item.key || ''
+      let code = item.code || ''
+      if(!this.$util.isEmpty(val) && code != 'Minus' && val != 'Unidentified'){
+        console.log('aaaaa')
+        console.log(val)
+        if(val != 'Enter'){
+          uni.setStorageSync('hasScanCode', hasScanCode+val)
         }
         }
-        if(code == 'Enter'){
+        if(val == 'Enter'){
           uni.$emit('listenGetScanCode',{code:hasScanCode})
           uni.$emit('listenGetScanCode',{code:hasScanCode})
           uni.removeStorageSync('hasScanCode')
           uni.removeStorageSync('hasScanCode')
         }
         }

+ 2 - 0
hdPad/src/pages/home/make.vue

@@ -69,6 +69,8 @@ export default {
 	},
 	},
 	onShow() {
 	onShow() {
 	},
 	},
+	created(){
+	},
 	mounted() {
 	mounted() {
 		if(this.$util.isEmpty(this.getLoginInfo.admin) || this.getLoginInfo.admin.currentShopId == 0){
 		if(this.$util.isEmpty(this.getLoginInfo.admin) || this.getLoginInfo.admin.currentShopId == 0){
 			this.isLogin = 0
 			this.isLogin = 0