Commit 5efbc5d2 by Lin

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

- 在storeSignboard组件中更新paramsInfo的bizs字段,支持动态获取业务类型。
- 在HistoryTarget、BusinessOverview、StopBusiness、StaffOverview和StrategyList组件中引入paramsInfo的bizs字段,确保数据请求的灵活性与准确性。
- 调整相关方法以适应新的业务场景逻辑,提升用户体验与数据展示一致性。
- 优化组件样式,确保与现有UI风格保持一致。
1 parent 6ff6fe7b
<template>
<baseDialog
:is-show.sync="dialogShow"
:dialog-config="dialogConfig.config"
class="detail-content"
@handleClick="submit"
>
<el-form
ref="form"
class="form"
label-width="120px"
size="small"
:rules="formRules"
:model="formData"
@submit.native.prevent="submit"
>
<el-form-item
label="停止展业日期:"
prop="nodeDate"
>
<el-date-picker
v-model="formData.nodeDate"
type="date"
placeholder="请选择停止展业日期"
:picker-options="afterTodayOptions"
>
<baseDialog class="detail-content"
:dialog-config="dialogConfig.config"
:is-show.sync="dialogShow"
@handleClick="submit">
<el-form ref="form"
class="form"
label-width="120px"
:model="formData"
:rules="formRules"
size="small"
@submit.native.prevent="submit">
<el-form-item label="停止展业日期:"
prop="nodeDate">
<el-date-picker v-model="formData.nodeDate"
:picker-options="afterTodayOptions"
placeholder="请选择停止展业日期"
type="date">
</el-date-picker>
</el-form-item>
</el-form>
......@@ -32,125 +24,128 @@
<script>
import {
stopBusiness,
} from "@api/earlyWarningManager"
stopBusiness,
} from "@api/earlyWarningManager";
import dayjs from "dayjs";
export default {
name: "AddStaff",
props: {
visible: {
type: Boolean,
default: false
},
minDate: {
type: String,
default: dayjs().format("YYYY-MM-DD")
}
},
inject: ['GET_PARAMS_INFO'],
name: "AddStaff",
props: {
visible: {
type: Boolean,
default: false,
},
minDate: {
type: String,
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",
},
},
};
},
computed: {
dialogShow: {
get () {
return this.visible
},
set (val) {
this.close()
}
},
afterTodayOptions () {
return {
disabledDate: (time) => {
return (
time.getTime() < dayjs(this.minDate).valueOf() // 小于最小日期 → 禁用
);
}
}
},
paramsInfo () {
return this.GET_PARAMS_INFO()
},
},
computed: {
dialogShow: {
get() {
return this.visible;
},
set(val) {
this.close();
},
},
afterTodayOptions() {
return {
disabledDate: (time) => {
return (
time.getTime() < dayjs(this.minDate).valueOf() // 小于最小日期 → 禁用
);
},
};
},
paramsInfo() {
return this.GET_PARAMS_INFO();
},
},
mounted () {
},
data () {
return {
formData: {
nodeDate: '',
},
formRules: {
nodeDate: [{ required: true, message: '请选择停止展业日期', trigger: 'blur' }],
},
dialogConfig: {
config: {
title: "停止展业",
width: "640px"
}
},
}
},
methods: {
close () {
this.formData = this.$options.data.call(this).formData
this.$refs?.form?.resetFields()
this.$emit('dialogClose')
},
submit () {
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('操作失败')
}
})
}
}
}
mounted() {
},
methods: {
close() {
this.formData = this.$options.data.call(this).formData;
this.$refs?.form?.resetFields();
this.$emit("dialogClose");
},
submit() {
this.$refs.form.validate(async (valid) => {
if (valid) {
const { merchantIds, bizs } = this.paramsInfo;
const { nodeDate } = this.formData;
const data = await stopBusiness({
merchantId: merchantIds[0],
sceneType: 0,
bizs: 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>
<style lang="scss" scoped>
.flex {
display: flex;
align-items: center;
display: flex;
align-items: center;
}
::v-deep.el-dialog__wrapper {
overflow: hidden !important;
.el-dialog {
margin: 50vh auto 0 !important;
transform: translateY(-50%);
.el-dialog__body {
padding: 0;
// padding-bottom: 24px;
// border-bottom: 1px solid #e6e6e6;
}
.el-dialog__footer {
margin-top: auto;
border-top: 1px solid #e5e5e5;
padding: 15px 20px 15px;
}
.dialog-footer {
border-top: none;
padding: 0;
}
}
overflow: hidden !important;
.el-dialog {
margin: 50vh auto 0 !important;
transform: translateY(-50%);
.el-dialog__body {
padding: 0;
// padding-bottom: 24px;
// border-bottom: 1px solid #e6e6e6;
}
.el-dialog__footer {
margin-top: auto;
border-top: 1px solid #e5e5e5;
padding: 15px 20px 15px;
}
.dialog-footer {
border-top: none;
padding: 0;
}
}
}
.detail-content {
.form {
padding: 52px 42px 34px;
.el-date-editor {
width: 100%;
}
}
.form {
padding: 52px 42px 34px;
.el-date-editor {
width: 100%;
}
}
}
</style>
......@@ -95,11 +95,11 @@ export default {
try {
this.businessOverviewDetail = {};
this.loading = true;
let { merchantIds } = this.paramsInfo;
let { merchantIds, bizs } = this.paramsInfo;
let data = await getStrategyMerchantTimeline({
merchantId: merchantIds[0],
bizs: 1, // 业务类型(1.延保 2.轻改 3.权益)
sceneType: 0, // 业务场景(0.会员权益,1.精品升级)
bizs,
sceneType: bizs == 2 ? 1 : 0, // 业务场景(0.会员权益(延保权益),1.精品升级(轻改))
});
data.timelineList && data.timelineList.forEach((item) => {
item.nodeDate = dayjs(item.nodeDate).format("YYYY-MM-DD");
......
<template>
<baseDialog
:is-show.sync="dialogShow"
:dialog-config="dialogConfig.config"
class="detail-content"
:config="config"
>
<baseDialog class="detail-content"
:config="config"
:dialog-config="dialogConfig.config"
:is-show.sync="dialogShow">
<div class="content">
<d2-table
class="table"
ref="table"
:search-form="formSearch"
:table-params="tableParams"
:table-data="list"
:has-page="false"
:has-num="false"
>
<d2-table ref="table"
class="table"
:has-num="false"
:has-page="false"
:search-form="formSearch"
:table-data="list"
:table-params="tableParams">
</d2-table>
<div class="block"></div>
</div>
......@@ -23,156 +19,156 @@
<script>
import {
getStrategyMerchantAnalysisIndexHistory,
} from "@api/earlyWarningManager"
getStrategyMerchantAnalysisIndexHistory,
} from "@api/earlyWarningManager";
export default {
name: "HistoryTarget",
inject: [
'GET_PARAMS_INFO',
],
props: {
visible: {
type: Boolean,
default: false
},
index: {
type: Number,
default: 0
}
},
computed: {
dialogShow: {
get () {
return this.visible
},
set (val) {
this.close()
}
},
merchantId () {
let [merchantId] = this.GET_PARAMS_INFO().merchantIds
return merchantId
}
},
watch: {
visible: function (val) {
if (val) {
this.list = []
this.getList()
}
}
},
name: "HistoryTarget",
inject: [
"GET_PARAMS_INFO",
],
props: {
visible: {
type: Boolean,
default: false,
},
index: {
type: Number,
default: 0,
},
},
data() {
return {
config: {
isShowFooter: true,
cancel_name: "返回",
hideConfirmBtn: true,
},
dialogConfig: {
config: {
title: "历史兜底目标",
width: "600px",
},
},
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: [],
};
},
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 () {
},
data () {
return {
config: {
isShowFooter: true,
cancel_name: "返回",
hideConfirmBtn: true
},
dialogConfig: {
config: {
title: "历史兜底目标",
width: "600px"
}
},
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
}
}
}
mounted() {
},
methods: {
close() {
this.$emit("dialogClose");
},
async getList() {
const { merchantId } = this;
const data = await getStrategyMerchantAnalysisIndexHistory({
bizs: 1,
merchantId,
});
this.list = data;
},
},
};
</script>
<style lang="scss" scoped>
.flex {
display: flex;
align-items: center;
display: flex;
align-items: center;
}
::v-deep.el-dialog__wrapper {
overflow: hidden !important;
.el-dialog {
margin: 50vh auto 0 !important;
transform: translateY(-50%);
.el-dialog__body {
padding: 0;
// padding-bottom: 24px;
// border-bottom: 1px solid #e6e6e6;
}
.el-dialog__footer {
margin-top: auto;
border-top: 1px solid #e5e5e5;
padding: 15px 20px 15px;
}
.dialog-footer {
border-top: none;
padding: 0;
}
}
overflow: hidden !important;
.el-dialog {
margin: 50vh auto 0 !important;
transform: translateY(-50%);
.el-dialog__body {
padding: 0;
// padding-bottom: 24px;
// border-bottom: 1px solid #e6e6e6;
}
.el-dialog__footer {
margin-top: auto;
border-top: 1px solid #e5e5e5;
padding: 15px 20px 15px;
}
.dialog-footer {
border-top: none;
padding: 0;
}
}
}
.detail-content {
.content {
height: 592px;
box-sizing: border-box;
padding: 20px;
overflow-y: auto;
.table {
width: 100%;
}
}
.content {
height: 592px;
box-sizing: border-box;
padding: 20px;
overflow-y: auto;
.table {
width: 100%;
}
}
}
</style>
......@@ -470,9 +470,9 @@ export default {
async getStrategyStaffSummaryDuration(item) {
try {
this.staffInfoLoading = true;
const params = this.paramsInfo;
let data = await getStrategyStaffSummaryDuration({
// ...params,
bizs: 1,
...params,
staffUuids: [item.staffId],
staffPhone: item.staffPhone,
});
......
......@@ -145,10 +145,10 @@ export default {
async getStrategyList() {
try {
this.loading = true;
let { merchantIds } = this.paramsInfo;
let { merchantIds, bizs } = this.paramsInfo;
let data = await getStrategyList({
merchantId: merchantIds[0],
biz: 1,
biz: bizs,
pageNum: this.pageNum,
pageSize: this.pageSize,
});
......
......@@ -309,7 +309,8 @@ export default {
},
// 是否展示「主机厂数据」Tab:仅月周期且存在主机厂数据时展示
showOemDataTab() {
return this.paramsInfo.cycleType === 3 && this.hasOemData;
// return this.paramsInfo.cycleType === 3 && this.hasOemData;
return this.paramsInfo.cycleType === 3;
},
// 数据来源 Tab 列表(仅在 showOemDataTab 为 true 时渲染切换模块)
dataSourceTabs() {
......
......@@ -77,7 +77,7 @@ export default {
qualityDetailList: [],
currentNum: 0,
paramsInfo: {
bizs: 1,
bizs: this.resolveBizs(),
sceneType: 0,
merchantIds: [],
},
......@@ -105,6 +105,11 @@ export default {
return this.$refs.recruitment;
},
},
watch: {
"$route.query.businessType": function (businessType) {
this.paramsInfo.bizs = this.resolveBizs(businessType);
},
},
// 在beforeDestroy钩子中移除事件监听
beforeDestroy() {
window.removeEventListener("popstate", this.preventBack);
......@@ -124,8 +129,7 @@ export default {
// 可以根据 merchantNo 更新 merchantInfo 或进行其他操作
this.paramsInfo.merchantIds = [merchantNo || ""];
this.merchantName = storeName || "";
if (businessType)
this.paramsInfo.bizs = Number(businessType);
this.paramsInfo.bizs = this.resolveBizs(businessType);
let { timeRangeType, startDate, endDate } = this.$route.query;
if (timeRangeType || startDate || endDate) {
if (timeRangeType) {
......@@ -152,6 +156,11 @@ export default {
window.addEventListener("popstate", this.preventBack);
},
methods: {
// 与策略中心 currentTab.value 一致,优先取路由 businessType
resolveBizs(businessType = this.$route.query.businessType) {
const biz = Number(businessType);
return biz || 1;
},
init() {
this.storeSignboardInfoRef.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!