shish il y a 1 an
Parent
commit
37d90ae8e1

+ 5 - 2
ghsPad/src/pages/home/cash.vue

@@ -81,7 +81,9 @@ export default {
 		this.initDataFromStorage()
 
 		this.beginRemind()
-
+		
+		//这个页面有二个这方法,不能去掉,不然会造成:全部缓存清了,点选客没有客户可选
+		this.getCustomData()
 	},
 	onUnload(){
 		clearInterval(this.T)
@@ -117,6 +119,7 @@ export default {
 	},
 	methods: {
 		init(){
+			//这个页面有二个这方法,不能去掉,不然会造成:全部缓存清了,点选客没有客户可选
 			this.getCustomData()
 		},
 		getCustomData(){
@@ -176,7 +179,7 @@ export default {
 			this.customName = '快捷开单'
 			//要调用rightItemRef里的方法更新,不能这边直接请求product.js更新,因为会造成扫码那块出问题,识别不到,关键词scan_right_item
 			this.$refs.rightItemRef.refreshMyRightItem(this.customId)
-			//this.getCustomData()
+			this.getCustomData()
 		},
 		changeProperty(property){
 			this.currentProperty = property

+ 12 - 11
ghsPad/src/pages/home/components/customerList.vue

@@ -17,7 +17,7 @@
               </view>
             </view>
         
-            <view @click="confirmCustom(item)" class="user-list-item_box" v-for="(item,index) in list" :key="item.id">
+            <view @click="confirmCustom(item)" class="user-list-item_box" v-for="(item,index) in currentCustomList" :key="item.id">
               <view class="head-box">
                 <view class="name">{{item.name}}</view>
               </view>
@@ -37,29 +37,30 @@ export default {
 	props: {
 		myCustomList: {
 			type: Array,
-			default: 0
+			default:[]
 		}
   },
   data() {
     return {
 		searchUser: '',
-		list:[],
-    focusInput:true
+		currentCustomList:[],
+    focusInput:false
 	};
   },
   mounted() {
-	  
     if (!this.$util.isEmpty(this.myCustomList)) {
-      this.list = this.myCustomList
+      this.currentCustomList = this.myCustomList
     }
-
   },
   watch:{
       myCustomList:{
           handler(newList){
-            this.list = newList
+            if (!this.$util.isEmpty(newList)) {
+              this.currentCustomList = newList
+            }
           },
-          immediate:true
+          immediate:true,
+          deep:true
         }
     },
   methods: {
@@ -89,9 +90,9 @@ export default {
       customList({ name: this.searchUser,isCashier:1 }).then(res=>{
         if(res.code == 1){
           if(res.data.list.length > 12){
-            this.list = res.data.list.slice(0,12)
+            this.currentCustomList = res.data.list.slice(0,12)
           }else{
-            this.list = res.data.list
+            this.currentCustomList = res.data.list
           }
         }
       })