shish пре 7 месеци
родитељ
комит
edc409146e

+ 22 - 0
ghsPad/src/mixins/product.js

@@ -228,6 +228,9 @@ export default {
 			}else{
 			}else{
 				if(item.currentNum <= 0){
 				if(item.currentNum <= 0){
 					list.splice(index,1)
 					list.splice(index,1)
+					if(item.variety == 1){
+						uni.removeStorageSync("xj")
+					}
 				}else{
 				}else{
 					list[index].currentNum = item.currentNum
 					list[index].currentNum = item.currentNum
 					list[index].unitPrice = item.unitPrice
 					list[index].unitPrice = item.unitPrice
@@ -315,6 +318,25 @@ export default {
 			}
 			}
 			this.customData = {};
 			this.customData = {};
 		},
 		},
+		//清除全部多颜色
+        globalClearXj(customData){
+            customData.currentNum = 0
+			this.replaceItemFn(customData)
+            this.globalCloseXjPop()
+        },
+		//确认多颜色
+        globalConfirmChangeXj(customData,xjData) {
+            customData.currentNum = xjData.stock
+            customData.unitPrice = xjData.price
+            customData.unitType = 0
+			customData.unitName = customData.bigUnit
+            this.confirmAddItemModel(customData)
+            this.globalCloseXjPop()
+        },
+		//取消多颜色框
+		globalCloseXjPop(){
+			this.$refs.selectFlowerGridRef.close()
+		},
 		async takeItem(code){
 		async takeItem(code){
 			if(this.$util.isEmpty(code)){
 			if(this.$util.isEmpty(code)){
 				return false
 				return false

+ 7 - 1
ghsPad/src/pages/home/components/leftArea.vue

@@ -38,15 +38,21 @@
             <selectNumPrice @confirmAddItemModel="confirmAddItemModel" :customData.sync="customData" @cancelKdSelectNumPrice="addItemModelHidden"></selectNumPrice>
             <selectNumPrice @confirmAddItemModel="confirmAddItemModel" :customData.sync="customData" @cancelKdSelectNumPrice="addItemModelHidden"></selectNumPrice>
         </uni-popup>
         </uni-popup>
 
 
+        <!-- 花材网格选择弹框 -->
+        <uni-popup ref="selectFlowerGridRef" background-color="#fff" type="center" :animation="false">
+            <selectFlowerGrid :flowerData="globalGridFlowerList" @globalClearXj="globalClearXj" @globalConfirmChangeXj="globalConfirmChangeXj" @globalCloseXjPop="globalCloseXjPop" :customData.sync="customData"></selectFlowerGrid>
+        </uni-popup>
+
     </view>
     </view>
 </template>
 </template>
 <script>
 <script>
 import productMins from "@/mixins/product";
 import productMins from "@/mixins/product";
 import selectNumPrice from './selectNumPrice.vue'
 import selectNumPrice from './selectNumPrice.vue'
 import { mapGetters } from "vuex";
 import { mapGetters } from "vuex";
+import selectFlowerGrid from './selectFlowerGrid.vue'
 export default {
 export default {
     name:'leftItem',
     name:'leftItem',
-    components:{selectNumPrice},
+    components:{selectNumPrice,selectFlowerGrid},
 	mixins: [productMins],
 	mixins: [productMins],
 	props: {
 	props: {
         changeCurrentJobType:{
         changeCurrentJobType:{

+ 1 - 29
ghsPad/src/pages/home/components/rightItem.vue

@@ -28,7 +28,7 @@
 
 
         <!-- 花材网格选择弹框 -->
         <!-- 花材网格选择弹框 -->
         <uni-popup ref="selectFlowerGridRef" background-color="#fff" type="center" :animation="false">
         <uni-popup ref="selectFlowerGridRef" background-color="#fff" type="center" :animation="false">
-            <selectFlowerGrid :flowerData="globalGridFlowerList" @clearAll="clearAll" @confirm="confirmFlowerGrid" @cancel="cancelFlowerGrid" :customId.sync="customId" :customData.sync="customData"></selectFlowerGrid>
+            <selectFlowerGrid :flowerData="globalGridFlowerList" @globalClearXj="globalClearXj" @globalConfirmChangeXj="globalConfirmChangeXj" @globalCloseXjPop="globalCloseXjPop" :customData.sync="customData"></selectFlowerGrid>
         </uni-popup>
         </uni-popup>
 
 
     </view>
     </view>
@@ -94,18 +94,6 @@ export default {
         }
         }
     },
     },
     methods:{
     methods:{
-        clearAll(customData){
-            
-			//this.customData = this.xjDataInfo
-            // this.customData.bigCount = 0
-            // this.customData.smallCount = 0
-            // this.replaceItemFn(this.customData,1)
-
-            customData.bigCount = 0
-            customData.smallCount = 0
-            this.replaceItemFn(customData,1)
-
-        },
         addToClear(){
         addToClear(){
             this.$msg('请扫码打开')
             this.$msg('请扫码打开')
         },
         },
@@ -123,22 +111,6 @@ export default {
         },
         },
         addListenScan(){
         addListenScan(){
             this.listenScanItem()
             this.listenScanItem()
-        },
-        // 确认花材网格选择
-        confirmFlowerGrid(customData,xjData) {
-
-            customData.bigCount = xjData.stock
-            customData.smallCount = 0
-            customData.bigPrice = xjData.price
-            customData.price = xjData.price
-            customData.itemPrice = xjData.price
-            customData.userPrice = xjData.price
-            this.confirmAddItemModel(customData)
-
-        },
-        // 取消花材网格选择
-        cancelFlowerGrid() {
-            this.$refs.selectFlowerGridRef.close()
         }
         }
     }
     }
 }
 }

+ 29 - 46
ghsPad/src/pages/home/components/selectFlowerGrid.vue

@@ -28,8 +28,8 @@
                             </view>
                             </view>
                             <view class="qty-display">
                             <view class="qty-display">
                                 <input 
                                 <input 
-                                    v-model.number="item.selectedQty" 
-                                    type="number"
+                                    v-model="numList[item.id]" 
+                                    type="digit"
                                     class="qty-input"
                                     class="qty-input"
                                     @blur="validateQty(item)">
                                     @blur="validateQty(item)">
                             </view>
                             </view>
@@ -44,7 +44,7 @@
 
 
         <!-- 底部按钮栏 -->
         <!-- 底部按钮栏 -->
         <view class="popup-footer">
         <view class="popup-footer">
-            <view class="footer-btn cancel-btn" @tap="clearAllFlowers">
+            <view class="footer-btn cancel-btn" @tap="confirmClearXj">
                 <text>清除全部</text>
                 <text>清除全部</text>
             </view>
             </view>
             <view class="footer-btn cancel-btn" @tap="handleCancel">
             <view class="footer-btn cancel-btn" @tap="handleCancel">
@@ -62,8 +62,7 @@ export default {
     name: 'selectFlowerGrid',
     name: 'selectFlowerGrid',
     props: {
     props: {
         flowerData: { type: Array, default: () => [] },
         flowerData: { type: Array, default: () => [] },
-        customData:{ type:Object, default:()=>{} },
-		customId: { type: Number, default: 0 }
+        customData:{ type:Object, default:()=>{} }
     },
     },
     data() {
     data() {
         return {
         return {
@@ -78,10 +77,13 @@ export default {
         flowerData: {
         flowerData: {
             handler(newData) {
             handler(newData) {
                 const dataToUse = (newData && newData.length > 0) ? newData : []
                 const dataToUse = (newData && newData.length > 0) ? newData : []
-                this.flowerList = dataToUse.map(item => ({
-                    ...item,
-                    selectedQty: item.selectedQty || 0
-                }))
+                this.flowerList = dataToUse
+                // 初始化 numList,保持已有的数量
+                dataToUse.forEach(item => {
+                    if (!this.numList[item.id]) {
+                        this.numList[item.id] = 0
+                    }
+                })
             },
             },
             deep: true,
             deep: true,
             immediate: true
             immediate: true
@@ -97,12 +99,10 @@ export default {
     },
     },
     mounted() {
     mounted() {
         this.calculateScrollHeight()
         this.calculateScrollHeight()
-        
     },
     },
     methods: {
     methods: {
-        // 初始化xj数据 - 对应 onLoad 逻辑
         initXjData() {
         initXjData() {
-            let saveInfo = uni.getStorageSync("xj" + this.customId)
+            let saveInfo = uni.getStorageSync("xj")
             if (!this.$util.isEmpty(saveInfo)) {
             if (!this.$util.isEmpty(saveInfo)) {
                 saveInfo.forEach((item, index) => {
                 saveInfo.forEach((item, index) => {
                     let hasList = item.list ? item.list : []
                     let hasList = item.list ? item.list : []
@@ -114,63 +114,47 @@ export default {
                 })
                 })
             }
             }
         },
         },
-
         // 计算滚动区域高度
         // 计算滚动区域高度
         calculateScrollHeight() {
         calculateScrollHeight() {
             // 总高度 - 头部高度 - 底部按钮高度
             // 总高度 - 头部高度 - 底部按钮高度
             this.scrollHeight = 'calc(100vh - 100upx - 90upx)'
             this.scrollHeight = 'calc(100vh - 100upx - 90upx)'
         },
         },
-
         // 增加数量
         // 增加数量
         increaseQty(item) {
         increaseQty(item) {
             this.$util.hitVoice()
             this.$util.hitVoice()
-            item.selectedQty = parseInt(item.selectedQty) || 0
-            item.selectedQty++
+            let currentNum = parseInt(this.numList[item.id]) || 0
+            this.$set(this.numList, item.id, currentNum + 1)
         },
         },
-
         // 减少数量
         // 减少数量
         decreaseQty(item) {
         decreaseQty(item) {
             this.$util.hitVoice()
             this.$util.hitVoice()
-            item.selectedQty = parseInt(item.selectedQty) || 0
-            if (item.selectedQty > 0) {
-                item.selectedQty--
+            let currentNum = parseInt(this.numList[item.id]) || 0
+            if (currentNum > 0) {
+                this.$set(this.numList, item.id, currentNum - 1)
             }
             }
         },
         },
-
         // 验证数量输入
         // 验证数量输入
         validateQty(item) {
         validateQty(item) {
-            let qty = parseInt(item.selectedQty) || 0
+            let qty = parseInt(this.numList[item.id]) || 0
             if (qty < 0) {
             if (qty < 0) {
-                item.selectedQty = 0
+                this.$set(this.numList, item.id, 0)
+            } else {
+                this.$set(this.numList, item.id, qty)
             }
             }
-            item.selectedQty = qty
         },
         },
-
-        // 清除全部 - 对应 xj.vue 的 clearXj
-        clearAllFlowers() {
-            this.$util.confirmModal({content:'确认全部清除?'},() => {
-                this.confirmClearXj()
-            })
-        },
-
-        // 确认清除 - 对应 xj.vue 的 confirmClearXj
         confirmClearXj() {
         confirmClearXj() {
-            uni.removeStorageSync("xj" + this.customId)
+            uni.removeStorageSync("xj")
             if (!this.$util.isEmpty(this.numList)) {
             if (!this.$util.isEmpty(this.numList)) {
                 this.numList.forEach((item, index, arr) => {
                 this.numList.forEach((item, index, arr) => {
-                    arr[index] = ''
+                    arr[index] = 0
                 })
                 })
                 this.$forceUpdate()
                 this.$forceUpdate()
             }
             }
-            this.$emit('clearAll', this.customData)
+            this.$emit('globalClearXj', this.customData)
         },
         },
-
-        // 处理取消
         handleCancel() {
         handleCancel() {
-            this.$emit('cancel')
+            this.$emit('globalCloseXjPop')
         },
         },
-
-        // 处理确认 - 对应 xj.vue 的 confirmXj
         handleConfirm() {
         handleConfirm() {
             // 收集选中的花材
             // 收集选中的花材
             let arr = []
             let arr = []
@@ -196,7 +180,6 @@ export default {
                 this.$msg("请填写数量哈")
                 this.$msg("请填写数量哈")
                 return false
                 return false
             }
             }
-
             // 验证库存
             // 验证库存
             if (totalNum > Number(this.customData.stock)) {
             if (totalNum > Number(this.customData.stock)) {
                 this.$msg("数量超过总库存")
                 this.$msg("数量超过总库存")
@@ -204,7 +187,7 @@ export default {
             }
             }
 
 
             // 保存到本地存储
             // 保存到本地存储
-            let saveInfo = uni.getStorageSync("xj" + this.customId)
+            let saveInfo = uni.getStorageSync("xj")
             const ptItemId = this.customData.id ? this.customData.id : 0
             const ptItemId = this.customData.id ? this.customData.id : 0
             if (!this.$util.isEmpty(saveInfo)) {
             if (!this.$util.isEmpty(saveInfo)) {
                 let getIndex = -1
                 let getIndex = -1
@@ -221,11 +204,11 @@ export default {
             } else {
             } else {
                 saveInfo = [{ptItemId: ptItemId, list: arr}]
                 saveInfo = [{ptItemId: ptItemId, list: arr}]
             }
             }
-            uni.setStorageSync("xj" + this.customId, saveInfo)
+            uni.setStorageSync("xj", saveInfo)
 
 
             // 返回确认数据
             // 返回确认数据
             this.xjData = {price: this.unitPrice, stock: totalNum, hasUpdate: 1, cancel: 0}
             this.xjData = {price: this.unitPrice, stock: totalNum, hasUpdate: 1, cancel: 0}
-            this.$emit('confirm', this.xjData)
+            this.$emit('globalConfirmChangeXj',this.customData, this.xjData)
         }
         }
     }
     }
 }
 }
@@ -257,7 +240,7 @@ export default {
             align-items: center;
             align-items: center;
 
 
             text {
             text {
-                font-size: 18upx;
+                font-size: 19upx;
                 color: #333333;
                 color: #333333;
                 font-weight: 500;
                 font-weight: 500;
                 margin-right: 10upx;
                 margin-right: 10upx;