shish 3 лет назад
Родитель
Сommit
f25d98b29c
1 измененных файлов с 21 добавлено и 5 удалено
  1. 21 5
      ghsPad/src/pages/home/components/settlePop.vue

+ 21 - 5
ghsPad/src/pages/home/components/settlePop.vue

@@ -113,8 +113,9 @@
 </template>
 <script>
 import VKeyboard from '@/components/vKeyboard/VKeyboard.vue'
-import productMins from "@/mixins/product";
+import productMins from "@/mixins/product"
 import { getAllStaff} from '@/api/shop-admin'
+import { mapGetters } from "vuex"
 export default {
     name:'selectCustomer',
     data() {
@@ -170,6 +171,7 @@ export default {
     components:{ VKeyboard },
 	mixins: [productMins],
     computed:{
+        ...mapGetters(["getLoginInfo"]),
         totalPrice(){
             let price = 0
             if(!this.$util.isEmpty(this.groupInfo)){
@@ -220,11 +222,25 @@ export default {
                 this.getStaffList = res.data.list
                 this.shopAdminIdList = res.data.list
                 if(!this.$util.isEmpty(this.getStaffList)){
-                    this.form.getStaffId = this.getStaffList[0].id
-                    this.form.getStaffName = this.getStaffList[0].name
 
-                    this.form.shopAdminId = this.getStaffList[0].id
-                    this.form.shopAdminName = this.getStaffList[0].name
+                    let currentId = 0
+                    let currentName = ''
+                    this.getStaffList.forEach((staff) => {
+                        if(this.getLoginInfo.shopAdminId && staff.id == this.getLoginInfo.shopAdminId){
+                            currentId = staff.id
+                            currentName = staff.name
+                        }
+                    })
+                    if(currentId == 0){
+                        currentId = this.getStaffList[0].id
+                        currentName = this.getStaffList[0].name
+                    }
+
+                    this.form.getStaffId = currentId
+                    this.form.getStaffName = currentName
+
+                    this.form.shopAdminId = currentId
+                    this.form.shopAdminName = currentName
 
                 }
             }