shish пре 1 година
родитељ
комит
b8b7da1b3a

+ 18 - 14
ghsPad/.hbuilderx/launch.json

@@ -1,16 +1,20 @@
-{ // launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
-  // launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数
-    "version": "0.0",
-    "configurations": [{
-     	"app-plus" : 
-     	{
-     		"launchtype" : "local"
-     	},
-     	"default" : 
-     	{
-     		"launchtype" : "local"
-     	},
-     	"type" : "uniCloud"
-     }
+{
+    // launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
+    // launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数
+    "version" : "0.0",
+    "configurations" : [
+        {
+            "app-plus" : {
+                "launchtype" : "local"
+            },
+            "default" : {
+                "launchtype" : "local"
+            },
+            "type" : "uniCloud"
+        },
+        {
+            "playground" : "custom",
+            "type" : "uni-app:app-android"
+        }
     ]
 }

+ 38 - 13
ghsPad/src/mixins/product.js

@@ -1,7 +1,8 @@
 import { mapGetters, mapActions } from "vuex";
 import { copyObject } from "@/utils/util";
 import { getBySn } from '@/api/goods'
-import { allProduct } from '@/api/product'
+import { showClass } from '@/api/item-class/index'
+import { showList } from '@/api/item/index'
 export default {
 	data() {
 		return {
@@ -22,7 +23,12 @@ export default {
 			customData: { currentNum: 0, unitPrice: 0,unitType:0, unitName:'扎',property:1},
 			globalItemList:[],
 			globalAllProduct:[],
-			calc:'add'
+			calc:'add',
+			globalRightItemCustomId:0,
+            globalRightItemClass:[],
+            globalRightItemCategoryId: '',
+            globalRightAllItemInfo:[],
+            globalRightItemInfloList:[],
 		};
 	},
 	onLoad(options) {
@@ -316,6 +322,8 @@ export default {
 					this.$refs.selectNumPriceRef.open('center')
 				}
 			}else{
+				console.log('---000---')
+				console.log(this.globalAllProduct)
 				//花材
 				current = this.globalAllProduct.find(function(val){
 					return Number(val.itemId) == Number(code)
@@ -349,17 +357,34 @@ export default {
 			uni.$on('listenGetScanCode',function(data){
 				that.takeItem(data.code)
 			})
-			if(this.getMyShopInfo && this.getMyShopInfo.scan == 1){
-				this.getAllProduct()
-			}
 		},
-		getAllProduct(){
-			allProduct().then(res=>{
-				if(res.code == 1){
-					this.globalAllProduct = res.data.list
-					//console.log('载入最新花材...')
-				}
-			})
-		}
+        async getRightItemData(id){
+            let { data } =  await showClass()
+            this.globalRightItemClass = data
+            this.globalRightItemCategoryId = this.globalRightItemClass[0].id
+            this.globalRightItemCustomId = id
+            let { data:{list,productList} } =  await showList({isCashier:1,customId:this.globalRightItemCustomId})
+            this.globalRightAllItemInfo = list
+			this.globalAllProduct = productList
+            this.globalShowCatItem()
+        },
+        itemRefresh(){
+            showList({isCashier:1,customId:this.globalRightItemCustomId}).then(res=>{
+                this.globalRightAllItemInfo = res.data.list
+				this.globalAllProduct = res.data.productList
+                this.globalShowCatItem()
+            })
+        },
+        globalShowCatItem(){
+            this.globalRightItemInfloList = this.globalRightAllItemInfo[this.globalRightItemCategoryId]
+        },
+        globalChangeCategory(item){
+            if(item.id === this.globalRightItemCategoryId){
+                return false
+            }
+            this.globalRightItemCategoryId = item.id
+            this.$util.hitVoice()
+            this.globalShowCatItem()
+        }
 	}
 }

+ 12 - 16
ghsPad/src/pages/home/cash.vue

@@ -20,8 +20,8 @@
 			</view>
 
 			<view class="open-box">
-				<consoleButton :changeCurrentJobType.sync="currentJobType" :changeCurrentJobId.sync="currentJobId" @clearAll="clearAll" @showCustomPop="showCustomPop" @fastKd="fastKd"
-				:customId.sync="customId" :customName.sync="customName" @changeProperty="changeProperty" @rightItemRefresh="rightItemRefresh"></consoleButton>
+				<consoleButton :changeCurrentJobType.sync="currentJobType" :changeCurrentJobId.sync="currentJobId" @showCustomPop="showCustomPop" @fastCreate="fastCreate"
+				:customId.sync="customId" :customName.sync="customName" @changeProperty="changeProperty" @updateRightItem="updateRightItem"></consoleButton>
 			</view>
 		</view>
 
@@ -32,7 +32,7 @@
     </uni-popup>
 
     <uni-popup ref="myCustomRef" background-color="#fff" type="center" :animation="false">
-        <customerList @fastKd="fastKd" :myCustomList.sync="myCustomList" @confirmCustom="confirmCustom" @cancelChoose="cancelChoose">
+        <customerList @fastCreate="fastCreate" :myCustomList.sync="myCustomList" @confirmCustom="confirmCustom" @cancelChoose="cancelChoose">
 		</customerList>
     </uni-popup>
 
@@ -130,12 +130,12 @@ export default {
 				}
       		})
 		},
-		fastKd(){
+		fastCreate(){
 			this.$refs.myCustomRef.close()
 			this.customId = this.getLoginInfo.skCustomId && this.getLoginInfo.skCustomId > 0 ? Number(this.getLoginInfo.skCustomId) : 0
 			this.customName = '快捷开单'
-			this.$refs.rightItemRef.currentCustomId = this.customId
-			this.$refs.rightItemRef.itemRefresh()
+			//要调用rightItemRef里的方法更新,不能这边直接请求product.js更新,因为会造成扫码那块出问题,识别不到,关键词scan_right_item
+			this.$refs.rightItemRef.refreshMyRightItem(this.customId)
 		},
 		showCustomPop(){
 			this.$refs.myCustomRef.open('top')
@@ -147,12 +147,8 @@ export default {
 			this.$refs.myCustomRef.close()
 			this.customId = Number(info.id)
 			this.customName = info.name
-			this.$refs.rightItemRef.currentCustomId = this.customId
-			this.$refs.rightItemRef.itemRefresh()
-		},
-		clearAll(){
-			this.customId = 0
-			this.customName = ''
+			//要调用rightItemRef里的方法更新,不能这边直接请求product.js更新,因为会造成扫码那块出问题,识别不到,关键词scan_right_item
+			this.$refs.rightItemRef.refreshMyRightItem(this.customId)
 		},
 		cancelRefresh(){
 			this.beginRemind()
@@ -175,12 +171,12 @@ export default {
 				})
 			}, 15000)
 		},
-		rightItemRefresh(){
+		updateRightItem(){
 			this.customId = this.getLoginInfo.skCustomId && this.getLoginInfo.skCustomId > 0 ? Number(this.getLoginInfo.skCustomId) : 0
 			this.customName = '快捷开单'
-			this.$refs.rightItemRef.currentCustomId = this.customId
-			this.$refs.rightItemRef.itemRefresh()
-			this.getCustomData()
+			//要调用rightItemRef里的方法更新,不能这边直接请求product.js更新,因为会造成扫码那块出问题,识别不到,关键词scan_right_item
+			this.$refs.rightItemRef.refreshMyRightItem(this.customId)
+			//this.getCustomData()
 		},
 		changeProperty(property){
 			this.currentProperty = property

+ 5 - 14
ghsPad/src/pages/home/components/cashConsole.vue

@@ -1,12 +1,11 @@
 <template>
 <view class="button-area">
-	<view class="active" @click="getAllProduct">扫码</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="beginSettle">结算</view>
 	<view class="active" style="position:fixed;left:36upx;bottom:13upx;width:84upx;height:50upx;line-height:30upx;font-size:15upx;" @click="handOrder()" 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="getHandOrder()" v-else>取单</view>
 	<view class="active" @click="showCustomPop" style="background-color:#3385FF;color:white;">选客</view>
-	<view class="active" @click="fastKd" style="font-size:8upx;">快捷开单</view>
+	<view class="active" @click="fastCreate" style="font-size:8upx;">快捷开单</view>
     <view class="active" @click="clearItemFn">清空</view>
 
 	<view v-if="Number(customId)>0" style="position:fixed;left:32upx;bottom:66upx;width:189upx;height:20upx;line-height:5upx;font-size:13upx;background-color:white;color:#3385FF;font-weight:bold;border:none;">{{customName}}</view>
@@ -103,7 +102,6 @@ export default {
         }
     },
 	created(){
-		this.listenScanItem()
 
 		//判断是否有单可取
 		let has = uni.getStorageSync('selectList_'+this.currentJobType+'_target_'+this.currentBackJobId)
@@ -123,9 +121,9 @@ export default {
 			this.$util.hitVoice()
 			this.$emit('showCustomPop')
 		},
-		fastKd(){
+		fastCreate(){
 			this.$util.hitVoice()
-			this.$emit('fastKd')
+			this.$emit('fastCreate')
 		},
 		cancelSelectPrice(){
 			this.$refs.gatheringRef.close()
@@ -155,13 +153,8 @@ export default {
 			this.$util.hitVoice()
 			this.$refs.toPayRef.close()
 			this.removeFromSaveDirect()
-			this.customId =0
-			this.customName=''
-			this.$emit('clearAll')
-			//继续监听花材扫码
-			//this.listenScanItem()
 			//开单完成之后更新花材库存
-			this.$emit('rightItemRefresh')
+			this.$emit('updateRightItem')
 		},
 		calcFn(){
 			this.calc = this.calc == 'add' ? 'sub' : 'add'
@@ -205,9 +198,8 @@ export default {
 						this.$refs.toPayRef.open('center')
 					}else{
 						this.removeFromSaveDirect()
-						this.$emit('clearAll')
 						//开单完成之后更新花材库存
-						this.$emit('rightItemRefresh')
+						this.$emit('updateRightItem')
 						uni.showToast({ title: '操作成功', duration: 1000 })
 					}
 					this.settleOpenStatus = 0
@@ -221,7 +213,6 @@ export default {
 		cancelPay(){
 			this.$util.hitVoice()
 			this.$refs.toPayRef.close()
-			this.listenScanItem()
 		},
 		cancelSettle(){
 			this.$util.hitVoice()

+ 3 - 3
ghsPad/src/pages/home/components/customerList.vue

@@ -10,7 +10,7 @@
               </view>
             </view>
 
-            <view class="user-list-item_box" @click.stop="fastKd()"
+            <view class="user-list-item_box" @click.stop="fastCreate()"
             style="background-color:#3385FF;border:1upx solid #3385FF;text-align:center;">
               <view class="head-box">
                 <view class="name" style="color:white;font-size:15upx;font-weight:bold;">快捷开单</view>
@@ -63,10 +63,10 @@ export default {
         }
     },
   methods: {
-    fastKd(){
+    fastCreate(){
       this.$util.hitVoice()
       this.searchUser = ''
-      this.$emit('fastKd')
+      this.$emit('fastCreate')
     },
     cancelChoose(){
       this.$util.hitVoice()

+ 21 - 36
ghsPad/src/pages/home/components/rightItem.vue

@@ -1,10 +1,10 @@
 <template>
     <view class="shop-listType_box">
         <view class="cat-list-area">
-            <view v-for="item in classData" :key="item.id" :class="[categoryId===item.id?'active':'']" @click="changeCategory(item)" > {{item.name}} </view>
+            <view v-for="item in globalRightItemClass" :key="item.id" :class="[globalRightItemCategoryId===item.id?'active':'']" @click="globalChangeCategory(item)" > {{item.name}} </view>
         </view>
         <view class="shop-show_box">
-            <view v-for="item in itemInfoList" :key="item.id" class="show-shop_box">
+            <view v-for="item in globalRightItemInfloList" :key="item.id" class="show-shop_box">
                 <view class="item-detail" @click="popAddModelFn(item)">
                     <image class="img" :src="item.cover" lazy-load="true" :lazy-load-margin="0" mode="scaleToFill" ></image>
                     <view class="shop-info_price">
@@ -29,8 +29,6 @@
     </view>
 </template>
 <script>
-import { showClass } from '@/api/item-class/index'
-import { showList } from '@/api/item/index'
 import productMins from "@/mixins/product";
 import selectNumPrice from './selectNumPrice.vue'
 import selectNum from './selectNum.vue'
@@ -40,13 +38,8 @@ export default {
 	mixins: [productMins],
     data(){
         return {
-            classData:[],
-            categoryId: '',
-            allItemInfo:[],
-            itemInfoList:[],
             currentJobType:'bill',
-            currentJobId:0,
-            currentCustomId:0
+            currentJobId:0
         }
     },
 	props: {
@@ -64,9 +57,23 @@ export default {
         }
     },
     mounted(){
-        this.init()
+        let id = this.customId>0 ? this.customId : 0
+        if(id>0){
+            this.getRightItemData(id)
+        }
+    },
+	created(){
+		this.listenScanItem()
     },
     watch:{
+        customId:{
+            handler(id){
+                if(id>0){
+                    this.getRightItemData(id)
+                }
+            },
+            immediate:true
+        },
         changeCurrentJobType:{
             handler(str){
                 this.currentJobType = str
@@ -88,31 +95,9 @@ export default {
             this.$util.hitVoice()
 			this.showAddModelFn({ ...info, currentNum: 1, unitPrice: info.price,unitType:0})
 		},
-        async init(){
-            let { data } =  await showClass()
-            this.classData = data
-            this.categoryId = this.classData[0].id
-            this.currentCustomId = this.customId>0 ? this.customId : 0
-            let { data:{list} } =  await showList({isCashier:1,customId:this.currentCustomId})
-            this.allItemInfo = list
-            this.showCatItem()
-        },
-        itemRefresh(){
-            showList({isCashier:1,customId:this.currentCustomId}).then(res=>{
-                this.allItemInfo = res.data.list
-                this.showCatItem()
-            })
-        },
-        showCatItem(){
-            this.itemInfoList = this.allItemInfo[this.categoryId]
-        },
-        changeCategory(item){
-            if(item.id === this.categoryId){
-                return false
-            }
-            this.categoryId = item.id
-            this.$util.hitVoice()
-            this.showCatItem()
+        refreshMyRightItem(customId){
+			this.globalRightItemCustomId = customId
+			this.itemRefresh()
         }
     }
 }