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" :is-show.sync="dialogShow"
class="detail-content" @handleClick="submit">
@handleClick="submit" <el-form ref="form"
> class="form"
<el-form label-width="120px"
ref="form" :model="formData"
class="form" :rules="formRules"
label-width="120px" size="small"
size="small" @submit.native.prevent="submit">
:rules="formRules" <el-form-item label="停止展业日期:"
:model="formData" prop="nodeDate">
@submit.native.prevent="submit" <el-date-picker v-model="formData.nodeDate"
> :picker-options="afterTodayOptions"
<el-form-item placeholder="请选择停止展业日期"
label="停止展业日期:" type="date">
prop="nodeDate"
>
<el-date-picker
v-model="formData.nodeDate"
type="date"
placeholder="请选择停止展业日期"
:picker-options="afterTodayOptions"
>
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -32,125 +24,128 @@ ...@@ -32,125 +24,128 @@
<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'], inject: ["GET_PARAMS_INFO"],
data() {
return {
formData: {
nodeDate: "",
},
formRules: {
nodeDate: [{ required: true, message: "请选择停止展业日期", trigger: "blur" }],
},
dialogConfig: {
config: {
title: "停止展业",
width: "640px",
},
},
};
},
computed: { computed: {
dialogShow: { dialogShow: {
get () { get() {
return this.visible return this.visible;
}, },
set (val) { set(val) {
this.close() 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 () { paramsInfo() {
return this.GET_PARAMS_INFO() return this.GET_PARAMS_INFO();
}, },
}, },
mounted () { mounted() {
}, },
data () { methods: {
return { close() {
formData: { this.formData = this.$options.data.call(this).formData;
nodeDate: '', this.$refs?.form?.resetFields();
}, this.$emit("dialogClose");
formRules: { },
nodeDate: [{ required: true, message: '请选择停止展业日期', trigger: 'blur' }], submit() {
}, this.$refs.form.validate(async (valid) => {
dialogConfig: { if (valid) {
config: { const { merchantIds, bizs } = this.paramsInfo;
title: "停止展业", const { nodeDate } = this.formData;
width: "640px" const data = await stopBusiness({
} merchantId: merchantIds[0],
}, sceneType: 0,
} bizs: bizs || 1,
}, nodeDate: dayjs(nodeDate).format("YYYY-MM-DD HH:mm:ss"),
methods: { });
close () { if (data) {
this.formData = this.$options.data.call(this).formData this.$emit("refresh");
this.$refs?.form?.resetFields() this.$message.success("操作成功");
this.$emit('dialogClose') this.close();
}, } else {
submit () { this.$message.error("操作失败");
this.$refs.form.validate(async (valid) => { }
if (valid) { }
const { merchantIds } = this.paramsInfo, });
{ nodeDate } = this.formData, },
data = await stopBusiness({ },
merchantId: merchantIds[0], };
sceneType: 0,
bizs: 1,
nodeDate: dayjs(nodeDate).format("YYYY-MM-DD HH:mm:ss")
})
if(data) {
this.$emit('refresh')
this.$message.success('操作成功')
this.close()
}else this.$message.error('操作失败')
}
})
}
}
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.flex { .flex {
display: flex; display: flex;
align-items: center; align-items: center;
} }
::v-deep.el-dialog__wrapper { ::v-deep.el-dialog__wrapper {
overflow: hidden !important; overflow: hidden !important;
.el-dialog { .el-dialog {
margin: 50vh auto 0 !important; margin: 50vh auto 0 !important;
transform: translateY(-50%); transform: translateY(-50%);
.el-dialog__body { .el-dialog__body {
padding: 0; padding: 0;
// padding-bottom: 24px; // padding-bottom: 24px;
// border-bottom: 1px solid #e6e6e6; // border-bottom: 1px solid #e6e6e6;
} }
.el-dialog__footer { .el-dialog__footer {
margin-top: auto; margin-top: auto;
border-top: 1px solid #e5e5e5; border-top: 1px solid #e5e5e5;
padding: 15px 20px 15px; padding: 15px 20px 15px;
} }
.dialog-footer { .dialog-footer {
border-top: none; border-top: none;
padding: 0; padding: 0;
} }
} }
} }
.detail-content { .detail-content {
.form { .form {
padding: 52px 42px 34px; padding: 52px 42px 34px;
.el-date-editor { .el-date-editor {
width: 100%; width: 100%;
} }
} }
} }
</style> </style>
...@@ -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" :config="config"
:dialog-config="dialogConfig.config" :dialog-config="dialogConfig.config"
class="detail-content" :is-show.sync="dialogShow">
:config="config"
>
<div class="content"> <div class="content">
<d2-table <d2-table ref="table"
class="table" class="table"
ref="table" :has-num="false"
:search-form="formSearch" :has-page="false"
:table-params="tableParams" :search-form="formSearch"
: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>
...@@ -23,156 +19,156 @@ ...@@ -23,156 +19,156 @@
<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: { data() {
dialogShow: { return {
get () { config: {
return this.visible isShowFooter: true,
}, cancel_name: "返回",
set (val) { hideConfirmBtn: true,
this.close() },
} dialogConfig: {
}, config: {
merchantId () { title: "历史兜底目标",
let [merchantId] = this.GET_PARAMS_INFO().merchantIds width: "600px",
return merchantId },
} },
}, formSearch: {},
watch: { tableParams: {
visible: function (val) { tableColumns: [
if (val) { {
this.list = [] label: "月份",
this.getList() prop: "recordYearMonth",
} minWidth: 64,
} },
}, {
label: "渗透率兜底目标",
minWidth: 80,
formatter: (row) => {
let val = row[
{
0: "ewPenetrationRate",
1: "ewAxbPenetrationRate",
2: "batteryPenetrationRate",
3: "ewLtPenetrationRate",
}[this.index]
] || null;
return val != null ? val + "%" : "-";
},
},
{
label: "转化率兜底目标",
minWidth: 80,
formatter: (row) => {
let val = row[
{
0: "ewConRate",
1: "ewAxbConRate",
2: "batteryConversionRate",
3: "ewLtConRate",
}[this.index]
] || null;
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;
},
},
watch: {
visible(val) {
if (val) {
this.list = [];
this.getList();
}
},
},
mounted () { mounted() {
}, },
data () { methods: {
return { close() {
config: { this.$emit("dialogClose");
isShowFooter: true, },
cancel_name: "返回", async getList() {
hideConfirmBtn: true const { merchantId } = this;
}, const data = await getStrategyMerchantAnalysisIndexHistory({
dialogConfig: { bizs: 1,
config: { merchantId,
title: "历史兜底目标", });
width: "600px" this.list = data;
} },
}, },
formSearch: {}, };
tableParams: {
tableColumns: [
{
label: "月份",
prop: 'recordYearMonth',
minWidth: 64,
},
{
label: "渗透率兜底目标",
minWidth: 80,
formatter: (row) => {
let val = row[
{
0: 'ewPenetrationRate',
1: 'ewAxbPenetrationRate',
2: 'batteryPenetrationRate',
3: 'ewLtPenetrationRate'
}[this.index]
] || null
return val != null ? val + '%' : '-'
}
},
{
label: "转化率兜底目标",
minWidth: 80,
formatter: (row) => {
let val = row[
{
0: 'ewConRate',
1: 'ewAxbConRate',
2: 'batteryConversionRate',
3: 'ewLtConRate'
}[this.index]
] || null
return val != null ? val + '%' : '-'
}
},
]
},
list: []
}
},
methods: {
close () {
this.$emit('dialogClose')
},
async getList () {
const { merchantId } = this,
data = await getStrategyMerchantAnalysisIndexHistory({
bizs: 1,
merchantId
})
this.list = data
}
}
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.flex { .flex {
display: flex; display: flex;
align-items: center; align-items: center;
} }
::v-deep.el-dialog__wrapper { ::v-deep.el-dialog__wrapper {
overflow: hidden !important; overflow: hidden !important;
.el-dialog { .el-dialog {
margin: 50vh auto 0 !important; margin: 50vh auto 0 !important;
transform: translateY(-50%); transform: translateY(-50%);
.el-dialog__body { .el-dialog__body {
padding: 0; padding: 0;
// padding-bottom: 24px; // padding-bottom: 24px;
// border-bottom: 1px solid #e6e6e6; // border-bottom: 1px solid #e6e6e6;
} }
.el-dialog__footer { .el-dialog__footer {
margin-top: auto; margin-top: auto;
border-top: 1px solid #e5e5e5; border-top: 1px solid #e5e5e5;
padding: 15px 20px 15px; padding: 15px 20px 15px;
} }
.dialog-footer { .dialog-footer {
border-top: none; border-top: none;
padding: 0; padding: 0;
} }
} }
} }
.detail-content { .detail-content {
.content { .content {
height: 592px; height: 592px;
box-sizing: border-box; box-sizing: border-box;
padding: 20px; padding: 20px;
overflow-y: auto; overflow-y: auto;
.table { .table {
width: 100%; width: 100%;
} }
} }
} }
</style> </style>
...@@ -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!