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

+ 1 - 1
ghsApp/src/admin/item/components/ItemStock.vue

@@ -25,7 +25,7 @@
 	<!-- #ifdef MP-WEIXIN -->
 	<text class="bottom-button" @click.stop="goToProduct(info.id)">分享</text>
 	<!-- #endif -->
-	<!-- <text class="bottom-button" @click.stop="moreToDo(info)">更多</text> -->
+	<text class="bottom-button" @click.stop="moreToDo(info)">更多</text>
 </view>
 </template>
 <script>

+ 11 - 5
hdPad/src/mixins/product.js

@@ -129,7 +129,8 @@ export default {
 		//添加删除和修改花材
 		//multiple 0单个加减 1弹框方式多个加减
 		//calc 当multiple=0时,add表示加,sub表示减
-		replaceItemFn(product,multiple=0,calc='add') {
+		//scan 0不是扫码 1扫码
+		replaceItemFn(product,multiple=0,calc='add',scan=0) {
 			let item = copyObject(product)
 			if(multiple == 0){
 				if(calc == 'add'){
@@ -148,6 +149,13 @@ export default {
 				}
 			}
 			const list = this.selectList
+			let index = list.findIndex(element => element.id == item.id)
+
+			//扫码再数量累加
+			if(index != -1 && scan == 1){
+				item.buyNum = parseInt(Number(item.buyNum)+Number(list[index].buyNum))
+			}
+
 			if(this.checkStock){
 				if(item.unitType == 0){
 					if(Number(item.buyNum)>Number(item.stock)){
@@ -165,7 +173,7 @@ export default {
 					}
 				}
 			}
-			let index = list.findIndex(element => element.id == item.id)
+
 			if(index == -1){
 				if(this.$util.isEmpty(item.unitPrice) || Number(item.unitPrice) == 0){
 					item.unitPrice = item.bigPrice
@@ -180,9 +188,7 @@ export default {
 					list[index].unitType = item.unitType
 				}
 			}
-			if(this.kdType == 'HIT' && multiple ==0){
-				this.$util.hitRemind()
-			}
+
 			//数据放到仓库永久存放
 			this.pushToSave(list)
 		},

+ 1 - 1
hdPad/src/pages/home/cash.vue

@@ -27,7 +27,7 @@
 				</view>
 				<!-- 按钮操作 -->
 				<view class="open-box">
-					<consoleButton @resetCustomer="resetCustomer" :customId.sync="customId" @changeProperty="changeProperty"></consoleButton>
+					<consoleButton :changeCurrentJobType.sync="currentJobType" :changeCurrentJobId.sync="currentJobId" @resetCustomer="resetCustomer" :customId.sync="customId" @changeProperty="changeProperty"></consoleButton>
 				</view>
 			</view>
 		</template>

+ 51 - 20
hdPad/src/pages/home/components/console.vue

@@ -1,11 +1,11 @@
 <template>
 <view class="button-area">
-	<view class="active" @click="changeProperty(1)">花材</view>
-	<view @click="changeProperty(0)">成品</view>
+	<view class="active" @click="changeProperty">{{property==1 ? '花材' : '成品'}}</view>
 	<view @click="gosettleCommit">结算 </view>
 	<view>收款</view>
     <view @click="breakage">报损</view>
 	<view @click="resetCustomer">选客</view>
+	<view @click="calcFn">{{calc == 'add' ? '+' : '-'}}</view>
     <view @click="clearItemFn">清空</view>
 	<view @click="logout">退出</view>
 
@@ -28,12 +28,6 @@
         <toPayWay @cancelPay="cancelPay()" @selectPayWayBack="selectPayWayBack" :orderId.sync="orderId"></toPayWay>
     </uni-popup>
 
-	<!-- 开单选花材输入数量和金额 -->
-	<uni-popup ref="selectNumPriceRef" background-color="#fff" type="center" :animation="false">
-		<selectNum v-if="currentJobType=='make'" @confirmAddItemModel="confirmAddItemModel" :customData.sync="customData" @cancelKdSelectNumPrice="addItemModelHidden"></selectNum>
-		<selectNumPrice v-else @confirmAddItemModel="confirmAddItemModel" :customData.sync="customData" @cancelKdSelectNumPrice="addItemModelHidden"></selectNumPrice>
-	</uni-popup>
-
 </view>
 </template>
 <script>
@@ -45,26 +39,53 @@ import { allProduct } from '@/api/product'
 export default {
     name:'console',
 	mixins: [productMins],
-    components:{ settlePop,toPayWay },
+    components:{ settlePop,toPayWay},
 	props: {
 		customId: {
 			type: Number,
 			default: 0
-		}
+		},
+        changeCurrentJobType:{
+            type:String,
+            default:'bill'
+        },
+        changeCurrentJobId:{
+            type:Number,
+            default:0
+        }
     },
     data(){
         return {
             totalShop:{ bigUnit: 0, smallUnit:0, totalPrice: 0 },
 			orderId:0,
-			allProduct:[]
+			allProduct:[],
+            currentJobType:'bill',
+            currentJobId:0,
+			calc:'add',
+			property:1
+        }
+    },
+    watch:{
+        changeCurrentJobType:{
+            handler(str){
+                this.currentJobType = str
+            },
+            immediate:true
+        },
+        changeCurrentJobId:{
+            handler(id){
+                this.currentJobId = Number(id)
+            },
+            immediate:true
         }
     },
 	created(){
 		// #ifdef APP-PLUS
 		//避免重复,每次进来先移除全局自定义事件监听器
-        uni.$off('listenGetScanCode') 
+        uni.$off('listenGetScanCode')
+		let that = this
         uni.$on('listenGetScanCode',function(data){
-			console.log(data.code)
+			that.takeItem(data.code)
         })
 		allProduct().then(res=>{
 			this.allProduct = res.data.list
@@ -73,15 +94,25 @@ export default {
 		// #endif
 	},
     methods:{
-		takeItem(code){
-			
+		calcFn(){
+			this.calc = this.calc == 'add' ? 'sub' : 'add'
 		},
-		popAddModelFn(info) {
-            this.$util.hitRemind()
-			this.showAddModelFn({ ...info, buyNum: 1, unitPrice: info.price,unitType:0})
+		takeItem(code){
+			code = 1001
+			let current = this.allProduct.find(function(val){
+				return val.itemId == code
+			})
+			if(current == undefined){
+				return false
+			}
+			this.$util.hitRemind()
+			let num = this.calc == 'add' ? 1 : -1
+			let params = {...current,unitName:current.bigUnit,unitPrice:current.bigPrice,buyNum:num}
+			this.replaceItemFn(params,1,'',1)
 		},
-		changeProperty(property){
-			this.$emit('changeProperty',property)
+		changeProperty(){
+			this.property = this.property == 1 ? 0 : 1
+			this.$emit('changeProperty',this.property)
 		},
 		resetCustomer(){
 			this.$util.hitRemind()

+ 1 - 1
hdPad/src/pages/home/components/leftArea.vue

@@ -10,7 +10,7 @@
                     <view class="item-price-num">
                         <template v-if="item.property && item.property == 1">
                             <view>{{parseFloat(item.unitPrice)}}元/{{item.unitName}}</view>
-                            <view>{{item.buyNum}} {{item.unitName}}</view>
+                            <view>{{item.buyNum}}{{item.unitName}}</view>
                         </template>
                         <template v-else>
                             <view>{{parseFloat(item.unitPrice)}}元/份</view>

+ 2 - 2
hdPad/src/pages/home/components/rightGoods.vue

@@ -74,8 +74,8 @@ export default {
             default:true
         },
         changeFlower:{
-            type:String,
-            default:''
+            type:Number,
+            default:1
         }
     },
     created(){