Commit c3bbcc3e by Lin

feat(financeManage):通过动态场景类型处理来增强账户管理对话框的功能

- 在 downloadAccountDialog.vue 中添加了 sceneTypeList 属性,以便根据选定的业务线动态检索场景。
- 更新了 downloadReconciDialog.vue 以反映业务线术语的变化。
- 对 financeList.vue 进行了重构,以确保对场景类型的正确数据处理。
- 改进了 offlineAccountList.vue 和 onlineAccountList.vue 模板,以提供更好的用户体验并确保账户信息的显示一致性。
1 parent 2d199960
......@@ -166,6 +166,7 @@
<script>
import { getBillTmplAdapter, getMetaTmpl, getShopList, getTmplList } from "@api/accountManage";
import { getMerchantPageSearch } from "@api/publicAccount";
import { getScenesByParams } from "@api/senseManage";
import dayjs from "dayjs";
import { mapActions, mapState } from "vuex";
import {
......@@ -187,10 +188,6 @@ export default {
type: String,
default: "",
},
sceneTypeList: {
type: Array,
default: () => [],
},
},
data() {
const validateLonlat = (rule, value, callback) => {
......@@ -207,6 +204,7 @@ export default {
return {
loading: false,
multipleLimit: 10,
sceneTypeList: [],
// 判断是否是模版模式
isTmpl: false,
localTmplList: deepClone(localTmplList),
......@@ -340,7 +338,7 @@ export default {
dowloadList: state => state.d2admin.user.dowloadList,
}),
sceneTypeOptionList() {
// 选项 = 全部 + 父页面传入的“当前场景下子场景列表”
// 选项 = 全部 + 当前业务线动态获取的场景列表
const inputList = Array.isArray(this.sceneTypeList) ? this.sceneTypeList : [];
const filteredList = inputList
.map((item) => {
......@@ -362,6 +360,8 @@ export default {
const sceneStr = val == null ? "" : String(val);
const exists = this.baseData.businessLineList.some(i => i.confId === sceneStr);
this.infoForm.businessLine = exists ? sceneStr : (this.baseData.businessLineList[0]?.confId || "");
// 首次打开弹框时,确保能根据当前业务线拉取“业务场景”列表
this.syncSceneTypeList();
},
immediate: true,
},
......@@ -369,6 +369,7 @@ export default {
handler() {
// 切换业务线时,业务场景默认回到“全部”
this.infoForm.sceneType = [""];
this.syncSceneTypeList();
},
},
},
......@@ -394,6 +395,27 @@ export default {
methods: {
...mapActions("d2admin/user", ["actionSetDownloadList"]),
syncSceneTypeList() {
const sceneType = Number(this.infoForm?.businessLine);
if (this.infoForm?.businessLine === "" || this.infoForm?.businessLine === null || this.infoForm?.businessLine === undefined || Number.isNaN(sceneType)) {
this.sceneTypeList = [];
return;
}
getScenesByParams({ sceneType }).then((res) => {
const list = Array.isArray(res)
? res
: (Array.isArray(res?.data) ? res.data : []);
const normalized = list
.map(item => ({
confId: item?.baseSceneCode,
confLabel: item?.name,
}))
.filter(item => item.confId !== undefined && item.confId !== null && item.confId !== "");
this.sceneTypeList = normalized;
}).catch(() => {
this.sceneTypeList = [];
});
},
handleSceneTypeChange(value) {
if (!Array.isArray(value)) {
return;
......
......@@ -13,7 +13,7 @@
:model="infoForm"
:rules="formRules"
label-width="120px">
<el-form-item label="业务线:" prop="businessLine">
<el-form-item label="业务场景:" prop="businessLine">
<el-select v-model="infoForm.businessLine" style="width:400px">
<el-option v-for="item in baseData.businessLineList"
:key="item.confId"
......@@ -273,10 +273,10 @@ export default {
baseData: {
businessLineList: [{
confId: "1",
confLabel: "权益类",
confLabel: "精品升级",
}, {
confId: "2",
confLabel: "轻改类",
confId: "0",
confLabel: "会员权益升级",
}],
reconStatusList: [{
confId: "all",
......
......@@ -603,7 +603,6 @@
<DownloadAccountDialog v-if="accountVisible"
:account-visible="accountVisible"
:scene="searchForm.sceneType"
:scene-type-list="baseData.subSceneTypeList"
@custTmpl="handleCustTmpl"
@handleBill="handleBill"
@accountClose="accountClose" />
......@@ -726,7 +725,7 @@ export default {
multiple: true,
collapseTags: true,
optionList: [],
optionId: "id",
optionId: "baseSceneCode",
optionLabel: "name",
optionsName: "subSceneTypeList",
changeAttr: (value) => {
......@@ -734,7 +733,11 @@ export default {
return;
}
const ALL = "";
let next = value;
let next = value
.filter(v => v !== undefined && v !== null)
.map(v => (typeof v === "string" ? v : String(v)));
// 去重(以 baseSceneCode 作为唯一值)
next = Array.from(new Set(next));
// 空选择:视为“全部”
if (!next.length) {
next = [ALL];
......@@ -743,8 +746,8 @@ export default {
if (next.includes(ALL) && next.length > 1) {
next = next[next.length - 1] === ALL ? [ALL] : next.filter(v => v !== ALL);
}
// v-model 绑定在 subSceneType,同时同步给后端入参 baseSceneCodeList
this.searchForm.subSceneType = next;
// 保持现有入参行为:baseSceneCodeList 与该选择同步
this.searchForm.baseSceneCodeList = next;
},
},
......@@ -1060,11 +1063,11 @@ export default {
: (Array.isArray(res?.data) ? res.data : []);
const normalized = list
.map(item => ({
id: item?.id,
baseSceneCode: item?.baseSceneCode,
name: item?.name,
}))
.filter(item => item.id !== undefined && item.id !== null);
this.baseData.subSceneTypeList = normalized.map(({ id, name }) => ({ id, name }));
.filter(item => item.baseSceneCode !== undefined && item.baseSceneCode !== null);
this.baseData.subSceneTypeList = normalized.map(({ baseSceneCode, name }) => ({ baseSceneCode, name }));
this.getOptionsList();
});
},
......@@ -1402,13 +1405,6 @@ export default {
? this.searchForm.channelType.join(",")
: this.searchForm.channelType;
}
if (Array.isArray(this.searchForm.subSceneType) && this.searchForm.subSceneType.length) {
const selected = this.searchForm.subSceneType;
// “全部”= 不传;否则按逗号分隔传给后端
if (!selected.includes("")) {
params.subSceneType = selected.join(",");
}
}
if (Array.isArray(this.searchForm.baseSceneCodeList) && this.searchForm.baseSceneCodeList.length) {
const selected = this.searchForm.baseSceneCodeList;
// “全部”= 不传;否则保持数组类型传给后端
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!