shish 1 год назад
Родитель
Сommit
e0f4eb4725
2 измененных файлов с 55 добавлено и 22 удалено
  1. 17 8
      ghsPad/src/pages/home/cash.vue
  2. 38 14
      ghsPad/src/pages/home/components/customerList.vue

+ 17 - 8
ghsPad/src/pages/home/cash.vue

@@ -32,7 +32,8 @@
     </uni-popup>
 
     <uni-popup ref="myCustomRef" background-color="#fff" type="center" :animation="false">
-        <customerList @fastKd="fastKd" ref="inCustomRef" @confirmCustom="confirmCustom" @cancelChoose="cancelChoose"> </customerList>
+        <customerList @fastKd="fastKd" :myCustomList.sync="myCustomList" @confirmCustom="confirmCustom" @cancelChoose="cancelChoose">
+		</customerList>
     </uni-popup>
 
 </view>
@@ -48,6 +49,7 @@ import leftGroup from './components/leftGroup.vue'
 import navComponent from './components/nav.vue'
 import loginComponent from './login.vue'
 import { checkRefresh } from '@/api/item'
+import { customList } from '@/api/home/index'
 import productMins from "@/mixins/product";
 import customerList from './components/customerList.vue'
 export default {
@@ -68,7 +70,8 @@ export default {
             currentJobType:'bill',
             currentJobId:0,
 			hasChooseCustomer:true,
-			T:null
+			T:null,
+			myCustomList:[]
 		}
 	},
 	computed: {
@@ -78,6 +81,7 @@ export default {
 		this.initDataFromStorage()
 
 		this.beginRemind()
+
 	},
 	onUnload(){
 		clearInterval(this.T)
@@ -112,8 +116,18 @@ export default {
 		}
 	},
 	methods: {
+		init(){
+			customList({ name: '',isCashier:1 }).then(res=>{
+				if(res.code == 1){
+					if(res.data.list.length > 14){
+						this.myCustomList = res.data.list.slice(0,14)
+					}else{
+						this.myCustomList = res.data.list
+					}
+				}
+      		})
+		},
 		fastKd(){
-			this.$refs.inCustomRef.focusInput = false
 			this.$refs.myCustomRef.close()
 			this.customId = this.getLoginInfo.skCustomId && this.getLoginInfo.skCustomId > 0 ? Number(this.getLoginInfo.skCustomId) : 0
 			this.customName = '快捷开单'
@@ -122,16 +136,11 @@ export default {
 		},
 		showCustomPop(){
 			this.$refs.myCustomRef.open('top')
-			this.$refs.inCustomRef.searchUser = ''
-			this.$refs.inCustomRef.searchCustomer()
-			this.$refs.inCustomRef.focusInput = true
 		},
 		cancelChoose(){
-			this.$refs.inCustomRef.focusInput = false
 			this.$refs.myCustomRef.close()
 		},
 		confirmCustom(info){
-			this.$refs.inCustomRef.focusInput = false
 			this.$refs.myCustomRef.close()
 			this.customId = Number(info.id)
 			this.customName = info.name

+ 38 - 14
ghsPad/src/pages/home/components/customerList.vue

@@ -3,23 +3,30 @@
     <view class="title">请选客户</view>
     <view class="app-userList_box">
       <block v-for="(item,index) in list" :key="item.id">
-        <block v-if="index == 12">
-            <view class="user-list-item_box" @click.stop="fastKd()" 
+        
+            <view class="user-list-item_box" @click.stop="fastKd()" v-if="index == 12"
             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>
               </view>
             </view>
-        </block>
-        <view @click="confirmCustom(item)" class="user-list-item_box" >
-          <view class="head-box">
-            <view class="name">{{item.name}}</view>
-          </view>
-        </view>
+        
+            <view class="user-list-item_box" @click.stop="cancelChoose()" v-else-if="index == 13"
+            style="background-color:#a0a5ad;border:1upx solid #a0a5ad;text-align:center;">
+              <view class="head-box">
+                <view class="name" style="color:white;font-size:15upx;font-weight:bold;">取消</view>
+              </view>
+            </view>
+        
+            <view @click="confirmCustom(item)" class="user-list-item_box" v-else>
+              <view class="head-box">
+                <view class="name">{{item.name}}</view>
+              </view>
+            </view>
       </block>
       <block v-if="list.length && list.length < 6">
         <view class="user-list-item_box" @click.stop="fastKd()" 
-        style="background-color:green;border:1upx solid green;text-align:center;">
+        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>
           </view>
@@ -28,7 +35,6 @@
     </view>
     <view style="position: relative;">
         <input class="input-serach_box" v-model="searchUser" type="text" :focus="focusInput" @focus="clearInput" @input="changSearch" placeholder-class="input-placeholder" placeholder="请输入客户名称"/>
-        <button class="admin-button-com mini-btn default" style="position: absolute;right:40upx;top:-5upx;font-size:15upx;" @click="cancelChoose">取消</button>
     </view>
   </view>
 </template>
@@ -36,8 +42,12 @@
 import { customList } from '@/api/home/index'
 export default {
   name: "selectCustom",
-  components: {  },
+  components: {},
 	props: {
+		myCustomList: {
+			type: Array,
+			default: 0
+		}
   },
   data() {
     return {
@@ -47,8 +57,22 @@ export default {
 	};
   },
   mounted() {
-	  this.searchCustomer()
+	  
+    if (!this.$util.isEmpty(this.myCustomList)) {
+      this.list = this.myCustomList
+    }
+
   },
+  watch:{
+      myCustomList:{
+          handler(newList){
+            console.log(newList)
+            console.log('-----')
+            this.list = newList
+          },
+          immediate:true
+        }
+    },
   methods: {
     fastKd(){
       this.$util.hitVoice()
@@ -72,8 +96,8 @@ export default {
     searchCustomer() {
       customList({ name: this.searchUser,isCashier:1 }).then(res=>{
         if(res.code == 1){
-          if(res.data.list.length > 13){
-            this.list = res.data.list.slice(0,13)
+          if(res.data.list.length > 14){
+            this.list = res.data.list.slice(0,14)
           }else{
             this.list = res.data.list
           }