Commit 5efbc5d2 by Lin

feat: 优化策略中心与门店分析组件逻辑

- 在storeSignboard组件中更新paramsInfo的bizs字段,支持动态获取业务类型。
- 在HistoryTarget、BusinessOverview、StopBusiness、StaffOverview和StrategyList组件中引入paramsInfo的bizs字段,确保数据请求的灵活性与准确性。
- 调整相关方法以适应新的业务场景逻辑,提升用户体验与数据展示一致性。
- 优化组件样式,确保与现有UI风格保持一致。
1 parent 6ff6fe7b
<template> <template>
<baseDialog <baseDialog class="detail-content"
:is-show.sync="dialogShow"
:dialog-config="dialogConfig.config" :dialog-config="dialogConfig.config"
class="detail-content" :is-show.sync="dialogShow"
@handleClick="submit" @handleClick="submit">
> <el-form ref="form"
<el-form
ref="form"
class="form" class="form"
label-width="120px" label-width="120px"
size="small"
:rules="formRules"
:model="formData" :model="formData"
@submit.native.prevent="submit" :rules="formRules"
> size="small"
<el-form-item @submit.native.prevent="submit">
label="停止展业日期:" <el-form-item label="停止展业日期:"
prop="nodeDate" prop="nodeDate">
> <el-date-picker v-model="formData.nodeDate"
<el-date-picker
v-model="formData.nodeDate"
type="date"
placeholder="请选择停止展业日期"
:picker-options="afterTodayOptions" :picker-options="afterTodayOptions"
> placeholder="请选择停止展业日期"
type="date">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -33,90 +25,93 @@ ...@@ -33,90 +25,93 @@
<script> <script>
import { import {
stopBusiness, stopBusiness,
} from "@api/earlyWarningManager" } from "@api/earlyWarningManager";
import dayjs from "dayjs"; import dayjs from "dayjs";
export default { export default {
name: "AddStaff", name: "AddStaff",
props: { props: {
visible: { visible: {
type: Boolean, type: Boolean,
default: false default: false,
}, },
minDate: { minDate: {
type: String, type: String,
default: dayjs().format("YYYY-MM-DD") default: dayjs().format("YYYY-MM-DD"),
} },
},
inject: ["GET_PARAMS_INFO"],
data() {
return {
formData: {
nodeDate: "",
},
formRules: {
nodeDate: [{ required: true, message: "请选择停止展业日期", trigger: "blur" }],
},
dialogConfig: {
config: {
title: "停止展业",
width: "640px",
},
},
};
}, },
inject: ['GET_PARAMS_INFO'],
computed: { computed: {
dialogShow: { dialogShow: {
get () { get() {
return this.visible return this.visible;
},
set(val) {
this.close();
}, },
set (val) {
this.close()
}
}, },
afterTodayOptions () { afterTodayOptions() {
return { return {
disabledDate: (time) => { disabledDate: (time) => {
return ( return (
time.getTime() < dayjs(this.minDate).valueOf() // 小于最小日期 → 禁用 time.getTime() < dayjs(this.minDate).valueOf() // 小于最小日期 → 禁用
); );
}
}
}, },
paramsInfo () { };
return this.GET_PARAMS_INFO()
}, },
paramsInfo() {
return this.GET_PARAMS_INFO();
}, },
mounted () {
}, },
data () {
return { mounted() {
formData: {
nodeDate: '',
},
formRules: {
nodeDate: [{ required: true, message: '请选择停止展业日期', trigger: 'blur' }],
},
dialogConfig: {
config: {
title: "停止展业",
width: "640px"
}
},
}
}, },
methods: { methods: {
close () { close() {
this.formData = this.$options.data.call(this).formData this.formData = this.$options.data.call(this).formData;
this.$refs?.form?.resetFields() this.$refs?.form?.resetFields();
this.$emit('dialogClose') this.$emit("dialogClose");
}, },
submit () { submit() {
this.$refs.form.validate(async (valid) => { this.$refs.form.validate(async (valid) => {
if (valid) { if (valid) {
const { merchantIds } = this.paramsInfo, const { merchantIds, bizs } = this.paramsInfo;
{ nodeDate } = this.formData, const { nodeDate } = this.formData;
data = await stopBusiness({ const data = await stopBusiness({
merchantId: merchantIds[0], merchantId: merchantIds[0],
sceneType: 0, sceneType: 0,
bizs: 1, bizs: bizs || 1,
nodeDate: dayjs(nodeDate).format("YYYY-MM-DD HH:mm:ss") nodeDate: dayjs(nodeDate).format("YYYY-MM-DD HH:mm:ss"),
}) });
if(data) { if (data) {
this.$emit('refresh') this.$emit("refresh");
this.$message.success('操作成功') this.$message.success("操作成功");
this.close() this.close();
}else this.$message.error('操作失败') } else {
} this.$message.error("操作失败");
})
} }
} }
} });
},
},
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -95,11 +95,11 @@ export default { ...@@ -95,11 +95,11 @@ export default {
try { try {
this.businessOverviewDetail = {}; this.businessOverviewDetail = {};
this.loading = true; this.loading = true;
let { merchantIds } = this.paramsInfo; let { merchantIds, bizs } = this.paramsInfo;
let data = await getStrategyMerchantTimeline({ let data = await getStrategyMerchantTimeline({
merchantId: merchantIds[0], merchantId: merchantIds[0],
bizs: 1, // 业务类型(1.延保 2.轻改 3.权益) bizs,
sceneType: 0, // 业务场景(0.会员权益,1.精品升级) sceneType: bizs == 2 ? 1 : 0, // 业务场景(0.会员权益(延保权益),1.精品升级(轻改))
}); });
data.timelineList && data.timelineList.forEach((item) => { data.timelineList && data.timelineList.forEach((item) => {
item.nodeDate = dayjs(item.nodeDate).format("YYYY-MM-DD"); item.nodeDate = dayjs(item.nodeDate).format("YYYY-MM-DD");
......
<template> <template>
<baseDialog <baseDialog class="detail-content"
:is-show.sync="dialogShow"
:dialog-config="dialogConfig.config"
class="detail-content"
:config="config" :config="config"
> :dialog-config="dialogConfig.config"
:is-show.sync="dialogShow">
<div class="content"> <div class="content">
<d2-table <d2-table ref="table"
class="table" class="table"
ref="table" :has-num="false"
:has-page="false"
:search-form="formSearch" :search-form="formSearch"
:table-params="tableParams"
:table-data="list" :table-data="list"
:has-page="false" :table-params="tableParams">
:has-num="false"
>
</d2-table> </d2-table>
<div class="block"></div> <div class="block"></div>
</div> </div>
...@@ -24,67 +20,42 @@ ...@@ -24,67 +20,42 @@
<script> <script>
import { import {
getStrategyMerchantAnalysisIndexHistory, getStrategyMerchantAnalysisIndexHistory,
} from "@api/earlyWarningManager" } from "@api/earlyWarningManager";
export default { export default {
name: "HistoryTarget", name: "HistoryTarget",
inject: [ inject: [
'GET_PARAMS_INFO', "GET_PARAMS_INFO",
], ],
props: { props: {
visible: { visible: {
type: Boolean, type: Boolean,
default: false default: false,
}, },
index: { index: {
type: Number, type: Number,
default: 0 default: 0,
}
},
computed: {
dialogShow: {
get () {
return this.visible
}, },
set (val) {
this.close()
}
}, },
merchantId () { data() {
let [merchantId] = this.GET_PARAMS_INFO().merchantIds
return merchantId
}
},
watch: {
visible: function (val) {
if (val) {
this.list = []
this.getList()
}
}
},
mounted () {
},
data () {
return { return {
config: { config: {
isShowFooter: true, isShowFooter: true,
cancel_name: "返回", cancel_name: "返回",
hideConfirmBtn: true hideConfirmBtn: true,
}, },
dialogConfig: { dialogConfig: {
config: { config: {
title: "历史兜底目标", title: "历史兜底目标",
width: "600px" width: "600px",
} },
}, },
formSearch: {}, formSearch: {},
tableParams: { tableParams: {
tableColumns: [ tableColumns: [
{ {
label: "月份", label: "月份",
prop: 'recordYearMonth', prop: "recordYearMonth",
minWidth: 64, minWidth: 64,
}, },
{ {
...@@ -93,14 +64,14 @@ export default { ...@@ -93,14 +64,14 @@ export default {
formatter: (row) => { formatter: (row) => {
let val = row[ let val = row[
{ {
0: 'ewPenetrationRate', 0: "ewPenetrationRate",
1: 'ewAxbPenetrationRate', 1: "ewAxbPenetrationRate",
2: 'batteryPenetrationRate', 2: "batteryPenetrationRate",
3: 'ewLtPenetrationRate' 3: "ewLtPenetrationRate",
}[this.index] }[this.index]
] || null ] || null;
return val != null ? val + '%' : '-' return val != null ? val + "%" : "-";
} },
}, },
{ {
label: "转化率兜底目标", label: "转化率兜底目标",
...@@ -108,34 +79,59 @@ export default { ...@@ -108,34 +79,59 @@ export default {
formatter: (row) => { formatter: (row) => {
let val = row[ let val = row[
{ {
0: 'ewConRate', 0: "ewConRate",
1: 'ewAxbConRate', 1: "ewAxbConRate",
2: 'batteryConversionRate', 2: "batteryConversionRate",
3: 'ewLtConRate' 3: "ewLtConRate",
}[this.index] }[this.index]
] || null ] || null;
return val != null ? val + '%' : '-' return val != null ? val + "%" : "-";
} },
},
],
},
list: [],
};
},
computed: {
dialogShow: {
get() {
return this.visible;
},
set(val) {
this.close();
},
}, },
] merchantId() {
let [merchantId] = this.GET_PARAMS_INFO().merchantIds;
return merchantId;
}, },
list: [] },
watch: {
visible(val) {
if (val) {
this.list = [];
this.getList();
} }
}, },
},
mounted() {
},
methods: { methods: {
close () { close() {
this.$emit('dialogClose') this.$emit("dialogClose");
}, },
async getList () { async getList() {
const { merchantId } = this, const { merchantId } = this;
data = await getStrategyMerchantAnalysisIndexHistory({ const data = await getStrategyMerchantAnalysisIndexHistory({
bizs: 1, bizs: 1,
merchantId merchantId,
}) });
this.list = data this.list = data;
} },
} },
} };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -470,9 +470,9 @@ export default { ...@@ -470,9 +470,9 @@ export default {
async getStrategyStaffSummaryDuration(item) { async getStrategyStaffSummaryDuration(item) {
try { try {
this.staffInfoLoading = true; this.staffInfoLoading = true;
const params = this.paramsInfo;
let data = await getStrategyStaffSummaryDuration({ let data = await getStrategyStaffSummaryDuration({
// ...params, ...params,
bizs: 1,
staffUuids: [item.staffId], staffUuids: [item.staffId],
staffPhone: item.staffPhone, staffPhone: item.staffPhone,
}); });
......
...@@ -145,10 +145,10 @@ export default { ...@@ -145,10 +145,10 @@ export default {
async getStrategyList() { async getStrategyList() {
try { try {
this.loading = true; this.loading = true;
let { merchantIds } = this.paramsInfo; let { merchantIds, bizs } = this.paramsInfo;
let data = await getStrategyList({ let data = await getStrategyList({
merchantId: merchantIds[0], merchantId: merchantIds[0],
biz: 1, biz: bizs,
pageNum: this.pageNum, pageNum: this.pageNum,
pageSize: this.pageSize, pageSize: this.pageSize,
}); });
......
...@@ -309,7 +309,8 @@ export default { ...@@ -309,7 +309,8 @@ export default {
}, },
// 是否展示「主机厂数据」Tab:仅月周期且存在主机厂数据时展示 // 是否展示「主机厂数据」Tab:仅月周期且存在主机厂数据时展示
showOemDataTab() { showOemDataTab() {
return this.paramsInfo.cycleType === 3 && this.hasOemData; // return this.paramsInfo.cycleType === 3 && this.hasOemData;
return this.paramsInfo.cycleType === 3;
}, },
// 数据来源 Tab 列表(仅在 showOemDataTab 为 true 时渲染切换模块) // 数据来源 Tab 列表(仅在 showOemDataTab 为 true 时渲染切换模块)
dataSourceTabs() { dataSourceTabs() {
......
...@@ -77,7 +77,7 @@ export default { ...@@ -77,7 +77,7 @@ export default {
qualityDetailList: [], qualityDetailList: [],
currentNum: 0, currentNum: 0,
paramsInfo: { paramsInfo: {
bizs: 1, bizs: this.resolveBizs(),
sceneType: 0, sceneType: 0,
merchantIds: [], merchantIds: [],
}, },
...@@ -105,6 +105,11 @@ export default { ...@@ -105,6 +105,11 @@ export default {
return this.$refs.recruitment; return this.$refs.recruitment;
}, },
}, },
watch: {
"$route.query.businessType": function (businessType) {
this.paramsInfo.bizs = this.resolveBizs(businessType);
},
},
// 在beforeDestroy钩子中移除事件监听 // 在beforeDestroy钩子中移除事件监听
beforeDestroy() { beforeDestroy() {
window.removeEventListener("popstate", this.preventBack); window.removeEventListener("popstate", this.preventBack);
...@@ -124,8 +129,7 @@ export default { ...@@ -124,8 +129,7 @@ export default {
// 可以根据 merchantNo 更新 merchantInfo 或进行其他操作 // 可以根据 merchantNo 更新 merchantInfo 或进行其他操作
this.paramsInfo.merchantIds = [merchantNo || ""]; this.paramsInfo.merchantIds = [merchantNo || ""];
this.merchantName = storeName || ""; this.merchantName = storeName || "";
if (businessType) this.paramsInfo.bizs = this.resolveBizs(businessType);
this.paramsInfo.bizs = Number(businessType);
let { timeRangeType, startDate, endDate } = this.$route.query; let { timeRangeType, startDate, endDate } = this.$route.query;
if (timeRangeType || startDate || endDate) { if (timeRangeType || startDate || endDate) {
if (timeRangeType) { if (timeRangeType) {
...@@ -152,6 +156,11 @@ export default { ...@@ -152,6 +156,11 @@ export default {
window.addEventListener("popstate", this.preventBack); window.addEventListener("popstate", this.preventBack);
}, },
methods: { methods: {
// 与策略中心 currentTab.value 一致,优先取路由 businessType
resolveBizs(businessType = this.$route.query.businessType) {
const biz = Number(businessType);
return biz || 1;
},
init() { init() {
this.storeSignboardInfoRef.init(); this.storeSignboardInfoRef.init();
this.businessOverviewRef.init(); this.businessOverviewRef.init();
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!