|
@@ -63,23 +63,26 @@ async function fetchShopOptions() {
|
|
|
}
|
|
|
|
|
|
async function fetchAuthorizedShop() {
|
|
|
- const resp = await useResponse(api.getAuthorizedShop, { user_id: rowData?.id});
|
|
|
- const authorizedShops = (resp.data.authorized_shops ?? []).filter((item: any) => item !== null); // 过滤掉 null 值
|
|
|
-
|
|
|
- if (resp.data.is_authorized_all_shops) {
|
|
|
- radio.value = '2';
|
|
|
- } else if (authorizedShops.length > 0) {
|
|
|
- radio.value = '1';
|
|
|
- shopTags.value = authorizedShops.map((id: string) => {
|
|
|
- const selectedOption = shopOptions.value.find((option: any) => option.id === id);
|
|
|
- return {
|
|
|
- id: selectedOption.id,
|
|
|
- name: selectedOption.name
|
|
|
- };
|
|
|
- });
|
|
|
- }
|
|
|
+ const resp = await useResponse(api.getAuthorizedShop, { user_id: rowData?.id });
|
|
|
+ const authorizedShops = (resp.data.authorized_shops ?? []).filter((item: any) => item !== null);
|
|
|
+
|
|
|
+ if (resp.data.is_authorized_all_shops) {
|
|
|
+ radio.value = '2';
|
|
|
+ } else if (authorizedShops.length > 0) {
|
|
|
+ radio.value = '1';
|
|
|
+ shopTags.value = authorizedShops
|
|
|
+ .map((id: string) => {
|
|
|
+ const selectedOption = shopOptions.value.find((option: any) => option.id === id);
|
|
|
+ return selectedOption ? {
|
|
|
+ id: selectedOption.id,
|
|
|
+ name: selectedOption.name
|
|
|
+ } : null;
|
|
|
+ })
|
|
|
+ .filter(Boolean); // 过滤掉 null 值
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+
|
|
|
async function confirmAuthorize() {
|
|
|
const body = {
|
|
|
...(radio.value === '2' ? {} : { authorized_shops: shopTags.value.map((tag: any) => tag.id) }),
|