Просмотр исходного кода

feat: 加载会员渠道列表,编辑时回显成员渠道

Developer 4 дней назад
Родитель
Сommit
a58fd3628e
1 измененных файлов с 25 добавлено и 0 удалено
  1. 25 0
      pagesMy/familyMemberVindicate.vue

+ 25 - 0
pagesMy/familyMemberVindicate.vue

@@ -105,8 +105,31 @@
 		currentSchool:''
 	})
 	const qicShow = ref(false)
+	// 渠道相关
+	const channelList = ref([])          // 会员渠道列表(可选项)
+	const selectedChannelId = ref('')    // 已选渠道 ID(字符串)
+	const selectedChannelIndex = ref(-1) // picker 当前选中下标,-1 表示未选
 	const turnType = ref('')
 	
+	const loadChannelList = () => {
+		proxy.$api.get('/app/channel/list', {}).then(({ data: res }) => {
+			if (res.code !== 0) return
+			channelList.value = res.data || []
+		})
+	}
+
+	const loadMemberChannel = (memberId) => {
+		proxy.$api.get('/app/member/channelList', { memberId }).then(({ data: res }) => {
+			if (res.code !== 0) return
+			const list = res.data || []
+			if (list.length > 0) {
+				selectedChannelId.value = String(list[0].id)
+				const idx = channelList.value.findIndex(c => String(c.id) === selectedChannelId.value)
+				if (idx >= 0) selectedChannelIndex.value = idx
+			}
+		})
+	}
+
 	const changeMember = (value,key) => {
 		memberInfo.value[key] = value;
 	}
@@ -228,10 +251,12 @@
 	
 	onLoad((options)=>{
 		turnType.value = options.type;
+		loadChannelList()
 		const id = options?.id;
 		if(id){
 			title.value = '编辑家庭成员';
 			getMemberInfo(id)
+			loadMemberChannel(id)
 		}
 	})
 </script>