Browse Source

获取快捷开单的客户信息

shish 6 months ago
parent
commit
d64cafb8f1
2 changed files with 18 additions and 6 deletions
  1. 6 2
      ghsPad/src/pages/home/cash.vue
  2. 12 4
      hdPad/src/pages/home/cash.vue

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

@@ -138,6 +138,8 @@ export default {
 					if (newValue.skCustomId && newValue.skCustomId > 0) {
 					if (newValue.skCustomId && newValue.skCustomId > 0) {
 						this.customId = newValue.skCustomId
 						this.customId = newValue.skCustomId
 						this.customName = '快捷开单'
 						this.customName = '快捷开单'
+						//获取快捷开单的客户信息,用于获取跑腿的地址信息
+						this.getDefaultCustom(this.customId)
 						//世纪花都、龙岩小林鲜花要自动弹出客户列表,多个地方要同步修改,关键词sj_pop_auto
 						//世纪花都、龙岩小林鲜花要自动弹出客户列表,多个地方要同步修改,关键词sj_pop_auto
 						if (newValue.shopId == 30300 || newValue.shopId == 15007) {
 						if (newValue.shopId == 30300 || newValue.shopId == 15007) {
 							this.showCustomPop()
 							this.showCustomPop()
@@ -165,8 +167,10 @@ export default {
 					}
 					}
 				}
 				}
 			})
 			})
-			if(this.getLoginInfo.skCustomId && this.getLoginInfo.skCustomId > 0){
-				getDetail({id:this.getLoginInfo.skCustomId}).then(res=>{
+		},
+		getDefaultCustom(skCustomId){
+			if(Number(skCustomId)>0){
+				getDetail({id:skCustomId}).then(res=>{
 					if(res.code == 1){
 					if(res.code == 1){
 						this.custom = res.data?res.data:{}
 						this.custom = res.data?res.data:{}
 					}
 					}

+ 12 - 4
hdPad/src/pages/home/cash.vue

@@ -58,6 +58,7 @@ import loginComponent from './login.vue'
 import { checkRefresh } from '@/api/item'
 import { checkRefresh } from '@/api/item'
 import productMins from "@/mixins/product";
 import productMins from "@/mixins/product";
 import { customList } from '@/api/home/index'
 import { customList } from '@/api/home/index'
+import { getDetail } from '@/api/custom'
 import customerList from './components/customerList.vue'
 import customerList from './components/customerList.vue'
 export default {
 export default {
 	name: "cash",
 	name: "cash",
@@ -124,8 +125,6 @@ export default {
 		}else{
 		}else{
 			this.isLogin = 1
 			this.isLogin = 1
 			if(this.getMyShopInfo.defaultCustomId && this.getMyShopInfo.defaultCustomId > 0){
 			if(this.getMyShopInfo.defaultCustomId && this.getMyShopInfo.defaultCustomId > 0){
-				// 遍历 customList 通过 defaultCustomId 找到对应的客户信息
-				this.custom = this.customList.find(item=>item.id == this.getMyShopInfo.defaultCustomId)
 				this.customId =  Number(this.getMyShopInfo.defaultCustomId)
 				this.customId =  Number(this.getMyShopInfo.defaultCustomId)
 				this.customName = '快捷开单'
 				this.customName = '快捷开单'
 				this.balance = 0
 				this.balance = 0
@@ -144,11 +143,11 @@ export default {
 		},
 		},
 		getMyShopInfo:{
 		getMyShopInfo:{
 			handler(newValue) {
 			handler(newValue) {
-				// 遍历 customList 通过 defaultCustomId 找到对应的客户信息
-				this.custom = this.customList.find(item=>item.id == newValue.defaultCustomId)
 				this.customId = newValue.defaultCustomId && newValue.defaultCustomId > 0 ? Number(newValue.defaultCustomId):0
 				this.customId = newValue.defaultCustomId && newValue.defaultCustomId > 0 ? Number(newValue.defaultCustomId):0
 				this.customName = '快捷开单'
 				this.customName = '快捷开单'
 				this.balance = 0
 				this.balance = 0
+				//获取快捷开单的客户信息,用于获取跑腿的地址信息
+				this.getDefaultCustomId(this.customId)
 			}
 			}
 		}
 		}
 	},
 	},
@@ -177,6 +176,15 @@ export default {
 				}
 				}
       		})
       		})
 		},
 		},
+		getDefaultCustomId(defaultCustomId){
+			if(Number(defaultCustomId) > 0){
+				getDetail({userId:defaultCustomId}).then(res=>{
+					if(res.code == 1){
+						this.custom = res.data ? res.data : {}
+					}
+				})
+			}
+		},
 		showCustomPop(){
 		showCustomPop(){
 			this.$refs.myCustomRef.open('top')
 			this.$refs.myCustomRef.open('top')
 		},
 		},