Просмотр исходного кода

花掌柜的挂单功能可以了

shish 1 год назад
Родитель
Сommit
985ff19d73
2 измененных файлов с 58 добавлено и 7 удалено
  1. 42 1
      hdPad/src/mixins/product.js
  2. 16 6
      hdPad/src/pages/home/components/console.vue

+ 42 - 1
hdPad/src/mixins/product.js

@@ -7,6 +7,8 @@ export default {
 		return {
 			currentJobType: "bill",//业务类型,开单、采购、报损、盘点
 			currentJobId:0,//业务类型对应的主体ID等
+			currentBackJobId:1,
+			globalHasHand:0,
 			isCut:false,
 			productInfoList: [], //商品信息
 			classIndex: 0, //当前商品类别下标
@@ -86,7 +88,46 @@ export default {
 			this.setSelectInfo({ currentJobType: this.currentJobType, info: selectData,currentJobId:this.currentJobId })
 			uni.setStorageSync('selectList_'+this.currentJobType+'_target_'+this.currentJobId, selectData)
 		},
-		//询问是否删除缓存
+		handOrder(){
+			let that = this
+			let has = uni.getStorageSync('selectList_'+this.currentJobType+'_target_'+this.currentBackJobId)
+			if(!this.$util.isEmpty(has)){
+				this.$msg('已挂了一单')
+				return false
+			}
+
+			let currentInfo = uni.getStorageSync('selectList_'+this.currentJobType+'_target_'+this.currentJobId)
+			if(this.$util.isEmpty(currentInfo)){
+				this.$msg('没有花材要挂单')
+				return false
+			}
+			uni.setStorageSync('selectList_'+this.currentJobType+'_target_'+this.currentBackJobId, currentInfo)
+
+			uni.removeStorageSync('selectList_'+that.currentJobType+'_target_'+that.currentJobId)
+			that.reSetSelectInfo({currentJobType:that.currentJobType,currentJobId:that.currentJobId})
+
+			this.globalHasHand = 1
+		},
+		getHandOrder(){
+			let that = this
+			let currentInfo = uni.getStorageSync('selectList_'+this.currentJobType+'_target_'+this.currentBackJobId)
+			if(this.$util.isEmpty(currentInfo)){
+				this.$msg('没有挂单')
+				return false
+			}
+			uni.removeStorageSync('selectList_'+that.currentJobType+'_target_'+that.currentJobId)
+			that.reSetSelectInfo({currentJobType:that.currentJobType,currentJobId:that.currentJobId})
+
+			uni.setStorageSync('selectList_'+this.currentJobType+'_target_'+this.currentBackJobId, currentInfo)
+			if(!this.$util.isEmpty(currentInfo)){
+				this.setSelectInfo({ currentJobType: this.currentJobType, info: currentInfo,currentJobId:this.currentJobId })
+			}
+
+			//清除挂单
+			uni.removeStorageSync('selectList_'+that.currentJobType+'_target_'+that.currentBackJobId)
+
+			this.globalHasHand = 0
+		},
 		removeFromSave(){
 			let that = this
 			that.$util.confirmModal({content:'确认清除花材?'},() => {

+ 16 - 6
hdPad/src/pages/home/components/console.vue

@@ -3,12 +3,9 @@
 	<view class="active" @click="changeProperty(1)">花材</view>
 	<view class="active" @click="changeProperty(0)">花束</view>
 	<view class="active" @click="openBox">开箱</view>
-	 <view class="active" 
- style="background-color:orange;color:white;border-color:orange;position:fixed;left:135upx;bottom:13upx;width:84upx;height:50upx;line-height:30upx;font-size:16upx;" 
- @click="goSettleCommit">结算</view>
-	 <view class="active" 
- style="position:fixed;left:36upx;bottom:13upx;width:84upx;height:50upx;line-height:30upx;font-size:15upx;" 
- @click="gatheringFn()">收款</view>
+	<view class="active" style="background-color:orange;color:white;border-color:orange;position:fixed;left:135upx;bottom:13upx;width:84upx;height:50upx;line-height:30upx;font-size:16upx;" @click="goSettleCommit">结算</view>
+	<view class="active" style="position:fixed;left:36upx;bottom:13upx;width:84upx;height:50upx;line-height:30upx;font-size:15upx;" @click="toHand()" v-if="globalHasHand == 0">挂单</view>
+	<view class="active" style="position:fixed;left:36upx;bottom:13upx;width:84upx;height:50upx;line-height:30upx;font-size:15upx;color:white;background-color: #3385FF;" @click="getHand()" v-else>取单</view>
     <view class="active" @click="toWastage">报损</view>
 	<view class="active" @click="selectCustom()">选客</view>
     <view class="active" @click="clearItemFn">清空</view>
@@ -114,6 +111,13 @@ export default {
     },
 	created(){
 		this.listenScanItem()
+
+		//判断是否有单可取
+		let has = uni.getStorageSync('selectList_'+this.currentJobType+'_target_'+this.currentBackJobId)
+		if(!this.$util.isEmpty(has)){
+			this.globalHasHand = 1
+		}
+
 	},
 	destroyed(){
 		// #ifdef APP-PLUS
@@ -191,6 +195,12 @@ export default {
 				}
 			})
 		},
+		toHand(){
+			this.handOrder()
+		},
+		getHand(){
+			this.getHandOrder()
+		},
 		gatheringFn(){
 			this.$util.hitVoice()
 			this.$refs.gatheringRef.open('center')