Commit ed3f8d5c by 张立顺

Merge branch 'SAAS+V5.8.4' of http://192.168.3.233:8090/saas_plus/dj-car-life-sy…

…stem into feature/V5.8.4/zls
2 parents 228258f5 69443621
Showing 81 changed files with 2760 additions and 1241 deletions
...@@ -72,7 +72,6 @@ export function getGoodsInfoById(data) { ...@@ -72,7 +72,6 @@ export function getGoodsInfoById(data) {
data => data, data => data,
// 第二个函数:使用保持精度的解析 // 第二个函数:使用保持精度的解析
(data) => { (data) => {
console.log(data, typeof data);
if (typeof data === "string") { if (typeof data === "string") {
return parseKeepPrecision(data); return parseKeepPrecision(data);
} }
......
import { applyDivisionRuleTestGetMock } from "./mockDivisionRuleTestGetResponse";
/* /*
* @Author: 'wangzhihui' '1733904062@qq.com' * @Author: 'wangzhihui' '1733904062@qq.com'
* @Date: 2025-09-01 15:41:23 * @Date: 2025-09-01 15:41:23
...@@ -8,7 +9,6 @@ ...@@ -8,7 +9,6 @@
*/ */
import request from "./request"; import request from "./request";
import RequestMethods from "./request.methods"; import RequestMethods from "./request.methods";
import { applyDivisionRuleTestGetMock } from "./mockDivisionRuleTestGetResponse";
const path = "dj.api."; const path = "dj.api.";
const path2 = "dj.api.smartcarlife."; const path2 = "dj.api.smartcarlife.";
...@@ -291,8 +291,8 @@ export function scenemerchantrefQueryServiceRefByShop(data) { ...@@ -291,8 +291,8 @@ export function scenemerchantrefQueryServiceRefByShop(data) {
// 获取商户财务设置进度 // 获取商户财务设置进度
export function divisionRuleTestGet(data) { export function divisionRuleTestGet(data) {
data.method = `${path2}divisionRuleTest.get`; data.method = `${path2}divisionRuleTest.get`;
return request(data, RequestMethods.POST).then((result) => return request(data, RequestMethods.POST).then(result =>
applyDivisionRuleTestGetMock(result) applyDivisionRuleTestGetMock(result),
); );
} }
...@@ -466,8 +466,8 @@ export function paymentChannelList(data = {}) { ...@@ -466,8 +466,8 @@ export function paymentChannelList(data = {}) {
* 获取对账配置所有品类列表 * 获取对账配置所有品类列表
*/ */
export function getReconciliationGoodsTypeListApi(data = {}) { export function getReconciliationGoodsTypeListApi(data = {}) {
data.method = data.method
"dj.api.create.business.approve.listReconciliationGoodsTypeGroup"; = "dj.api.create.business.approve.listReconciliationGoodsTypeGroup";
return request(data, RequestMethods.POST); return request(data, RequestMethods.POST);
} }
...@@ -479,3 +479,11 @@ export function getMerchantList(data) { ...@@ -479,3 +479,11 @@ export function getMerchantList(data) {
data.method = "dj.api.servicemerchantref.pageServiceMerchantRef"; data.method = "dj.api.servicemerchantref.pageServiceMerchantRef";
return request(data, RequestMethods.POST); return request(data, RequestMethods.POST);
} }
/**
* 查询兜底指标列表
*/
export function getBackstopList(data) {
data.method = "dj.api.oaapproval.store.approve.queryMetricConfigs";
return request(data, RequestMethods.POST);
}
...@@ -225,6 +225,24 @@ export function importBatchEditSKU(data) { ...@@ -225,6 +225,24 @@ export function importBatchEditSKU(data) {
return request(data, "post", ["file"]); return request(data, "post", ["file"]);
} }
// 批量新增SPU/SKU权益/延保导入
export function importBatchAddSPUOrSKUExtension(data) {
data.method = "dj.api.smartcarlife.productManager.yanbao.spu.sku.batch.add.import";
return request(data, "post", ["file"]);
}
// 批量新增SKU权益/延保导入
export function importBatchAddSKUExtension(data) {
data.method = "dj.api.smartcarlife.productManager.yanbao.sku.batch.add.import";
return request(data, "post", ["file"]);
}
// 批量修改SKU权益/延保导入
export function importBatchEditSKUExtension(data) {
data.method = "dj.api.smartcarlife.productManager.yanbao.sku.batch.update.import";
return request(data, "post", ["file"]);
}
// 获取供应商数据 // 获取供应商数据
export function getGoodsProviderList(data) { export function getGoodsProviderList(data) {
data.method = "dj.api.smartcarlife.goodsProvider.page"; data.method = "dj.api.smartcarlife.goodsProvider.page";
......
...@@ -11,8 +11,8 @@ import { baseConfig } from "@/main"; ...@@ -11,8 +11,8 @@ import { baseConfig } from "@/main";
// import axios from "@/plugin/axios" // import axios from "@/plugin/axios"
import axios from "@/plugin/axios/index_code"; import axios from "@/plugin/axios/index_code";
import RequestMethods from "./request.methods"; import RequestMethods from "./request.methods";
import sign from "./sign";
import resolveApiName, { getAxiosConfigKey, getSignWay } from "./resolveApiName"; import resolveApiName, { getAxiosConfigKey, getSignWay } from "./resolveApiName";
import sign from "./sign";
function request( function request(
params = {}, params = {},
...@@ -79,8 +79,9 @@ function request( ...@@ -79,8 +79,9 @@ function request(
method, method,
...reqData, ...reqData,
}; };
if (options.returnAll) if (options.returnAll) {
axiosParams.headers = { "return-all": true }; axiosParams.headers = { "return-all": true };
}
return axios(axiosParams); return axios(axiosParams);
/** /**
......
...@@ -22,8 +22,8 @@ export function potentialCustomersDetail(data) { ...@@ -22,8 +22,8 @@ export function potentialCustomersDetail(data) {
// 潜客核验详情(含 merchantInfo) // 潜客核验详情(含 merchantInfo)
export function potentialCustomersVerificationDetail(data) { export function potentialCustomersVerificationDetail(data) {
data.method = data.method
"dj.api.smartcarlife.sale.potentialCustomers.verificationDetail"; = "dj.api.smartcarlife.sale.potentialCustomers.verificationDetail";
return request(data, "post"); return request(data, "post");
} }
...@@ -35,15 +35,15 @@ export function bind4SStore(data) { ...@@ -35,15 +35,15 @@ export function bind4SStore(data) {
// 潜客信息核验提交(dj.api.smartcarlife.sale.potentialCustomers.submitVerification) // 潜客信息核验提交(dj.api.smartcarlife.sale.potentialCustomers.submitVerification)
export function potentialCustomersInfoVerify(data) { export function potentialCustomersInfoVerify(data) {
data.method = data.method
"dj.api.smartcarlife.sale.potentialCustomers.submitVerification"; = "dj.api.smartcarlife.sale.potentialCustomers.submitVerification";
return request(data, "post"); return request(data, "post");
} }
// 潜客新建商户 — 校验商户名称是否与账户中心重复 // 潜客新建商户 — 校验商户名称是否与账户中心重复
export function potentialCustomersCheckMerchantName(data) { export function potentialCustomersCheckMerchantName(data) {
data.method = data.method
"dj.api.smartcarlife.sale.potentialCustomers.checkMerchantName"; = "dj.api.smartcarlife.sale.potentialCustomers.checkMerchantName";
// data.method = "dj.api.smartcarlife.sale.potentialCustomers.infoVerify"; // data.method = "dj.api.smartcarlife.sale.potentialCustomers.infoVerify";
return request(data, "post"); return request(data, "post");
} }
...@@ -82,7 +82,7 @@ export function closeStorePage(data) { ...@@ -82,7 +82,7 @@ export function closeStorePage(data) {
data.method = "dj.api.smartcarlife.sale.closeStore.page"; data.method = "dj.api.smartcarlife.sale.closeStore.page";
return request(data, "post"); return request(data, "post");
} }
//是否关店 // 是否关店
export function closeStoreConfirm(data) { export function closeStoreConfirm(data) {
data.method = "dj.api.smartcarlife.sale.closeStore.confirm"; data.method = "dj.api.smartcarlife.sale.closeStore.confirm";
return request(data, "post"); return request(data, "post");
...@@ -125,6 +125,43 @@ export function storeApproveQueryDetail(data) { ...@@ -125,6 +125,43 @@ export function storeApproveQueryDetail(data) {
data.method = "dj.api.oaapproval.store.approve.queryDetail"; data.method = "dj.api.oaapproval.store.approve.queryDetail";
return request(data, "post"); return request(data, "post");
} }
/**
* 查询兜底指标列表
*/
export function storeApproveQueryMetricConfigs(data) {
data.method = "dj.api.oaapproval.store.approve.queryMetricConfigs";
return request(data, "post");
}
/**
* 编辑流量方确认(含兜底配置)
*/
export function storeApproveEditTrafficParty(data) {
data.method = "dj.api.oaapproval.store.approve.editTrafficParty";
return request(data, "post", ["file"], {
returnAll: true,
});
}
/**
* 编辑分账配置
*/
export function storeApproveEditDivisionConfig(data) {
data.method = "dj.api.oaapproval.store.approve.editDivisionConfig";
return request(data, "post", ["file"], {
returnAll: true,
});
}
/**
* 编辑对账配置
*/
export function storeApproveEditReconciliationConfig(data) {
data.method = "dj.api.oaapproval.store.approve.editReconciliationConfig";
return request(data, "post", ["file"], {
returnAll: true,
});
}
/** /**
* 编辑门店上架审批单 * 编辑门店上架审批单
...@@ -168,3 +205,18 @@ export function qyMerchantPageList(data = {}) { ...@@ -168,3 +205,18 @@ export function qyMerchantPageList(data = {}) {
data.method = "dj.smartcarlife.api.qyMerchant.pageList"; data.method = "dj.smartcarlife.api.qyMerchant.pageList";
return request(data, "post"); return request(data, "post");
} }
/**
* 潜客编辑关联商户
*/
export function potentialCustomersEditMerchant(data) {
data.method = "merchants.api.oaapproval.merchant.update";
return request(data, "post");
}
/**
* 潜客获取详情信息
*/
export function potentialCustomerDetail(data) {
data.method = "merchants.api.oaapproval.merchant.detail";
return request(data, "post");
}
import request from "./request" import request from "./request";
import RequestMethods from "./request.methods" import RequestMethods from "./request.methods";
const path = "dj.smartcarlife.api." const path = "dj.smartcarlife.api.";
// 交易明细列表 // 交易明细列表
export function nbcbAccDetailPage(data) { export function nbcbAccDetailPage(data) {
data.method = `${path}nbcb.acc.detail.page` data.method = `${path}nbcb.acc.detail.page`;
return request(data, RequestMethods.POST) return request(data, RequestMethods.POST);
} }
// 财资数据筛选项列表 // 财资数据筛选项列表
export function nbcbAccDetailConfig(data) { export function nbcbAccDetailConfig(data) {
data.method = `${path}nbcb.acc.detail.config` data.method = `${path}nbcb.acc.detail.config`;
return request(data, RequestMethods.POST) return request(data, RequestMethods.POST);
} }
// 交易明细重取 // 交易明细重取
export function nbcbAccDetailRefetch(data) { export function nbcbAccDetailRefetch(data) {
data.method = `${path}nbcb.acc.detail.refetch` data.method = `${path}nbcb.acc.detail.refetch`;
return request(data, RequestMethods.POST) return request(data, RequestMethods.POST);
} }
// 批量同步交易明细 // 批量同步交易明细
export function nbcbAccDetailBatchSync(data) { export function nbcbAccDetailBatchSync(data) {
data.method = `${path}nbcb.acc.detail.batch.sync` data.method = `${path}nbcb.acc.detail.batch.sync`;
return request(data, RequestMethods.POST) return request(data, RequestMethods.POST);
} }
// 交易明细详情 // 交易明细详情
export function nbcbAccDetail(data) { export function nbcbAccDetail(data) {
data.method = `${path}nbcb.acc.detail` data.method = `${path}nbcb.acc.detail`;
return request(data, RequestMethods.POST) return request(data, RequestMethods.POST);
} }
// 交易明细关联回单pdf // 交易明细关联回单pdf
export function nbcbReceiptPdfUrl(data) { export function nbcbReceiptPdfUrl(data) {
data.method = `${path}nbcb.receipt.pdf.url` data.method = `${path}nbcb.receipt.pdf.url`;
return request(data, RequestMethods.POST) return request(data, RequestMethods.POST);
} }
// 批量打印 // 批量打印
export function batchPrinting(data) { export function batchPrinting(data) {
data.method = `${path}nbcb.acc.batch.printing` data.method = `${path}nbcb.acc.batch.printing`;
return request(data, RequestMethods.POST) return request(data, RequestMethods.POST);
} }
// 查询交易明细、回单文件解析任务结果(手动导入关联时使用,无任务id时会新建任务id) // 查询交易明细、回单文件解析任务结果(手动导入关联时使用,无任务id时会新建任务id)
export function getImportTask(data) { export function getImportTask(data) {
data.method = `${path}nbcb.acc.association.import.task` data.method = `${path}nbcb.acc.association.import.task`;
return request(data, RequestMethods.POST) return request(data, RequestMethods.POST);
} }
// 交易明细、回单关联 // 交易明细、回单关联
export function association(data) { export function association(data) {
data.method = `${path}nbcb.acc.association` data.method = `${path}nbcb.acc.association`;
return request(data, RequestMethods.POST) return request(data, RequestMethods.POST);
} }
// 同步保存交易明细、回单 关联记录 // 同步保存交易明细、回单 关联记录
export function saveAssociation(data) { export function saveAssociation(data) {
data.method = `${path}nbcb.acc.association.save` data.method = `${path}nbcb.acc.association.save`;
return request(data, RequestMethods.POST) return request(data, RequestMethods.POST);
} }
// 交易明细excel导入 // 交易明细excel导入
export function detailExcelImport(data) { export function detailExcelImport(data) {
data.method = `${path}nbcb.acc.detail.excel.import` data.method = `${path}nbcb.acc.detail.excel.import`;
return request(data, "post", ["file"]) return request(data, "post", ["file"]);
} }
// 回单文件导入(.pdf|.zip|.rar) // 回单文件导入(.pdf|.zip|.rar)
export function receiptImport(data) { export function receiptImport(data) {
data.method = `${path}nbcb.acc.receipt.import` data.method = `${path}nbcb.acc.receipt.import`;
return request(data, "post", ["file"]) return request(data, "post", ["file"]);
} }
// 批量同步电子回单到金蝶 // 批量同步电子回单到金蝶
export function receiptBatchSync(data) { export function receiptBatchSync(data) {
data.method = `${path}nbcb.acc.receipt.batch.sync` data.method = `${path}nbcb.acc.receipt.batch.sync`;
return request(data, RequestMethods.POST) return request(data, RequestMethods.POST);
}
// 查询财资标签树
export function getDetailTagTree(data) {
data.method = `${path}nbcb.acc.detail.tag.tree`;
return request(data, RequestMethods.POST);
}
// 标签编辑保存预览
export function saveDetailTagPreview(data) {
data.method = "dj.smartcarlife.api.nbcb.acc.detail.tag.save.preview";
return request(data, RequestMethods.POST);
}
// 保存财资标签
export function saveDetailTag(data) {
data.method = "dj.smartcarlife.api.nbcb.acc.detail.tag.save";
return request(data, RequestMethods.POST);
}
// 标签删除预览
export function deleteDetailTagPreview(data) {
data.method = "dj.smartcarlife.api.nbcb.acc.detail.tag.delete.preview";
return request(data, RequestMethods.POST);
}
// 删除财资标签
export function deleteDetailTag(data) {
data.method = "dj.smartcarlife.api.nbcb.acc.detail.tag.delete";
return request(data, RequestMethods.POST);
}
// 财资明细打标签
export function bindDetailTag(data) {
data.method = "dj.smartcarlife.api.nbcb.acc.detail.tag.bind";
return request(data, RequestMethods.POST);
}
// 权限校验
export function checkPermission(data) {
data.method = "dj.smartcarlife.api.nbcb.acc.summary.report.download.preview";
return request(data, RequestMethods.POST);
} }
...@@ -1245,6 +1245,7 @@ export const operationTypeOpt = [ ...@@ -1245,6 +1245,7 @@ export const operationTypeOpt = [
{ confId: 7, confValue: "推送回单" }, { confId: 7, confValue: "推送回单" },
{ confId: 8, confValue: "重推流水明细" }, { confId: 8, confValue: "重推流水明细" },
{ confId: 9, confValue: "重推回单" }, { confId: 9, confValue: "重推回单" },
{ confId: 10, confValue: "编辑自定义标签" },
]; ];
// 财资数据 操作项 // 财资数据 操作项
......
...@@ -490,6 +490,91 @@ export function getMonthDateRange(targetMonth) { ...@@ -490,6 +490,91 @@ export function getMonthDateRange(targetMonth) {
return { startDate, endDate }; return { startDate, endDate };
} }
export function getFallbackSettlementOptions() {
const options = [{ label: "每月最后1天", value: 0 }];
for (let day = 1; day <= 27; day += 1) {
options.push({ label: `每月${day}号`, value: day });
}
return options;
}
export function getSettlementPeriodRange(targetMonth, settlementDate = 0) {
const monthRange = getMonthDateRange(targetMonth);
if (!monthRange) return null;
const day = Number(settlementDate) || 0;
if (day <= 0) {
return {
startDate: monthRange.startDate,
fullEndDate: monthRange.endDate,
maxEndDate: monthRange.endDate,
};
}
const [yearStr, monthStr] = targetMonth.split("-");
const year = parseInt(yearStr, 10);
const month = parseInt(monthStr, 10);
const start = new Date(year, month - 2, day + 1);
const startDate = `${start.getFullYear()}-${String(start.getMonth() + 1).padStart(2, "0")}-${String(start.getDate()).padStart(2, "0")}`;
const fullEndDate = `${yearStr}-${monthStr.padStart(2, "0")}-${String(day).padStart(2, "0")}`;
return {
startDate,
fullEndDate,
maxEndDate: fullEndDate,
};
}
export function getSettlementPeriodPickerDefaultDate(targetMonth, settlementDate = 0) {
const { maxEndDate } = getSettlementPeriodRange(targetMonth, settlementDate) || {};
if (!maxEndDate) return null;
const [year, month, day] = maxEndDate.split("-").map(item => parseInt(item, 10));
return new Date(year, month - 1, day);
}
export function getEditablePeriodStartDateRange(targetMonth) {
if (!targetMonth) return null;
const [yearStr, monthStr] = targetMonth.split("-");
const year = parseInt(yearStr, 10);
const month = parseInt(monthStr, 10);
if (!year || !month) return null;
const minStart = new Date(year, month - 2, 2);
const minStartDate = `${minStart.getFullYear()}-${String(minStart.getMonth() + 1).padStart(2, "0")}-02`;
const maxStartDate = `${yearStr}-${monthStr.padStart(2, "0")}-01`;
return { minStartDate, maxStartDate };
}
export function getEditablePeriodStartPickerDefaultDate(targetMonth) {
const { minStartDate } = getEditablePeriodStartDateRange(targetMonth) || {};
if (!minStartDate) return null;
const [year, month, day] = minStartDate.split("-").map(item => parseInt(item, 10));
return new Date(year, month - 1, day);
}
export function getEditableSettlementPeriodRange(targetMonth, startDate) {
const monthRange = getMonthDateRange(targetMonth);
const startRange = getEditablePeriodStartDateRange(targetMonth);
if (!monthRange || !startRange || !startDate) return null;
if (startDate < startRange.minStartDate || startDate > startRange.maxStartDate) return null;
const [, , startDayStr] = startDate.split("-");
const startDay = parseInt(startDayStr, 10);
const monthLastDay = parseInt(monthRange.endDate.split("-")[2], 10);
const endDay = Math.min(startDay - 1, monthLastDay);
const fullEndDate = startDate === monthRange.startDate
? monthRange.endDate
: `${targetMonth}-${String(endDay).padStart(2, "0")}`;
return {
startDate,
fullEndDate,
maxEndDate: fullEndDate,
};
}
/** /**
* 解析归属周期展示字符串为 [startDate, endDate] * 解析归属周期展示字符串为 [startDate, endDate]
* 支持 2026/05/01-2026/05/15 与 2026-05-01-2026-05-15 * 支持 2026/05/01-2026/05/15 与 2026-05-01-2026-05-15
......
<!-- 文件导入弹框通用组件 --> <!-- 文件导入弹框通用组件 -->
<template> <template>
<d2-dialog :is-visible="isVisible" <d2-dialog :is-visible="isVisible"
:title="title" :title="title"
@closeDialog="handleClose" @closeDialog="handleClose"
@confirmDialog="handleConfirm"> @confirmDialog="handleConfirm">
<el-form ref="fileFormRef" <el-form ref="fileFormRef"
label-width="120px" label-width="120px"
:model="form" :model="form"
:rules="rules"> :rules="rules">
<slot name="prepend" /> <slot name="prepend" />
<el-form-item :label="formItemLabel" <el-form-item prop="fileName"
prop="fileName"> :label="formItemLabel">
<el-col :span="16"> <el-col :span="16">
<el-input v-model="form.fileName" <el-input v-model="form.fileName"
readonly /> readonly />
<slot name="tip" /> <slot name="tip" />
</el-col> </el-col>
<el-col class="m-l-md" <el-col class="m-l-md"
:span="4"> :span="4">
<el-button class="import-btn"> <el-button class="import-btn">
导入文件 导入文件
<input ref="fileInput" <input ref="fileInput"
:accept="accept" class="import-input"
class="import-input" type="file"
type="file" :accept="accept"
@change="onFileChange" @change="onFileChange"
@click="$event.target.value = null"> @click="$event.target.value = null">
<el-link class="import-template" <el-link class="import-template"
icon="el-icon-link" icon="el-icon-link"
type="primary" type="primary"
@click="$emit('downloadTemplate')"> @click="$emit('downloadTemplate')">
{{ templateName }} {{ templateName }}
</el-link> </el-link>
</el-button> </el-button>
</el-col> </el-col>
</el-form-item> </el-form-item>
</el-form> </el-form>
</d2-dialog> </d2-dialog>
</template> </template>
<script> <script>
...@@ -67,6 +67,14 @@ export default { ...@@ -67,6 +67,14 @@ export default {
type: String, type: String,
default: "导入文件:", default: "导入文件:",
}, },
formData: {
type: Object,
default: null,
},
formRule: {
type: Object,
default: null,
},
}, },
data() { data() {
return { return {
...@@ -81,10 +89,43 @@ export default { ...@@ -81,10 +89,43 @@ export default {
isVisible(val) { isVisible(val) {
if (!val) { if (!val) {
this.resetForm(); this.resetForm();
return;
} }
this.syncRules();
this.syncFormData();
},
formData: {
handler(val) {
this.syncFormData(val, true);
},
deep: true,
},
formRule: {
handler() {
this.syncRules();
},
deep: true,
}, },
}, },
methods: { methods: {
syncRules() {
if (this.formRule) {
Object.assign(this.rules, this.formRule);
}
},
syncFormData(data = this.formData, clearValidate = false) {
if (!data) {
return;
}
Object.keys(data).forEach((key) => {
this.$set(this.form, key, data[key]);
});
if (clearValidate && this.$refs.fileFormRef) {
this.$nextTick(() => {
this.$refs.fileFormRef && this.$refs.fileFormRef.clearValidate(Object.keys(data));
});
}
},
resetForm() { resetForm() {
this.$refs.fileFormRef && this.$refs.fileFormRef.resetFields(); this.$refs.fileFormRef && this.$refs.fileFormRef.resetFields();
this.fileData = null; this.fileData = null;
...@@ -97,18 +138,22 @@ export default { ...@@ -97,18 +138,22 @@ export default {
this.$emit("closeDialog"); this.$emit("closeDialog");
}, },
handleConfirm() { handleConfirm() {
this.$refs.fileFormRef.validate((valid) => { this.syncFormData();
if (valid && this.fileData) { this.$nextTick(() => {
this.$emit("confirmDialog", { this.$refs.fileFormRef.validate((valid) => {
fileName: this.form.fileName, if (valid && this.fileData) {
fileData: this.fileData, this.$emit("confirmDialog", {
}); fileName: this.form.fileName,
} fileData: this.fileData,
});
}
});
}); });
}, },
onFileChange(e) { onFileChange(e) {
if (!e.target.files || !e.target.files[0]) if (!e.target.files || !e.target.files[0]) {
return; return;
}
const file = e.target.files[0]; const file = e.target.files[0];
const size = file.size / 1024 / 1024; const size = file.size / 1024 / 1024;
e.target.value = ""; e.target.value = "";
......
...@@ -242,6 +242,7 @@ export default { ...@@ -242,6 +242,7 @@ export default {
methods: { methods: {
// 选择框-添加其他属性 // 选择框-添加其他属性
selectAddAttr(value, targetItem) { selectAddAttr(value, targetItem) {
console.log("selectAddAttr value", value, "targetItem", targetItem);
targetItem.changeAttr && targetItem.changeAttr(value, targetItem); targetItem.changeAttr && targetItem.changeAttr(value, targetItem);
// 根据所选值 获取数据 // 根据所选值 获取数据
if (targetItem.name === "sceneType") { if (targetItem.name === "sceneType") {
......
/** 货架新增商户 / 潜客信息核验:提交前确认与创建成功 MessageBox */ /** 货架新增商户 / 潜客信息核验:提交前确认与创建成功 MessageBox */
export const MERCHANT_SUBMIT_CONFIRM_TITLE = "信息确认"; export const MERCHANT_SUBMIT_CONFIRM_TITLE = "信息确认";
export const MERCHANT_SUBMIT_CONFIRM_MESSAGE = export const MERCHANT_SUBMIT_CONFIRM_MESSAGE
"请确认商户信息无误,点击确认按钮后会同步账户中心生成商户账号!"; = "请确认商户信息无误,点击确认按钮后会同步账户中心生成商户账号!";
export const MERCHANT_SUBMIT_CONFIRM_EDIT_MESSAGE = "请确认商户信息无误,点击确认按钮后会同步账户中心商户账号!";
export const MERCHANT_CREATE_SUCCESS_TITLE = "提示"; export const MERCHANT_CREATE_SUCCESS_TITLE = "提示";
export const MERCHANT_CREATE_SUCCESS_MESSAGE = "商户创建完成!"; export const MERCHANT_CREATE_SUCCESS_MESSAGE = "商户创建完成!";
export const MERCHANT_EDIT_SUCCESS_MESSAGE = "商户编辑成功!";
export function showMerchantSubmitConfirm(vm) { export function showMerchantSubmitConfirm(vm, isEdit) {
return vm.$confirm( return vm.$confirm(
MERCHANT_SUBMIT_CONFIRM_MESSAGE, isEdit ? MERCHANT_SUBMIT_CONFIRM_MESSAGE : MERCHANT_SUBMIT_CONFIRM_EDIT_MESSAGE,
MERCHANT_SUBMIT_CONFIRM_TITLE, MERCHANT_SUBMIT_CONFIRM_TITLE,
{ {
type: "warning", type: "warning",
...@@ -17,18 +18,18 @@ export function showMerchantSubmitConfirm(vm) { ...@@ -17,18 +18,18 @@ export function showMerchantSubmitConfirm(vm) {
cancelButtonText: "取消", cancelButtonText: "取消",
closeOnClickModal: false, closeOnClickModal: false,
customClass: "merchant-submit-confirm-msgbox", customClass: "merchant-submit-confirm-msgbox",
} },
); );
} }
export function showMerchantCreateSuccess(vm) { export function showMerchantCreateSuccess(vm, isEdit) {
return vm.$msgbox.alert( return vm.$msgbox.alert(
MERCHANT_CREATE_SUCCESS_MESSAGE, isEdit ? MERCHANT_CREATE_SUCCESS_MESSAGE : MERCHANT_EDIT_SUCCESS_MESSAGE,
MERCHANT_CREATE_SUCCESS_TITLE, MERCHANT_CREATE_SUCCESS_TITLE,
{ {
type: "success", type: "success",
confirmButtonText: "知道了", confirmButtonText: "知道了",
customClass: "merchant-submit-success-msgbox", customClass: "merchant-submit-success-msgbox",
} },
); );
} }
...@@ -816,12 +816,17 @@ export default { ...@@ -816,12 +816,17 @@ export default {
val.merchantId = val.merchantNo - 0; val.merchantId = val.merchantNo - 0;
}); });
this.storeAllPages = res.count; this.storeAllPages = res.count;
this.baseData.parentMerchantList = this.baseData // 合并新旧数据,根据 id 去重(优先保留接口返回的最新数据)
.parentMerchantList const oldList = this.baseData.parentMerchantList || [];
? this.baseData.parentMerchantList.concat( const newList = res.data || [];
res.data || [] const mergedList = [...oldList, ...newList];
) // 去重:使用 id 作为唯一标识,重复时保留最后一个(接口返回的最新数据)
: res.data; const uniqueMap = new Map();
mergedList.forEach(item => {
const key = String(item.id || item.merchantNo);
uniqueMap.set(key, item);
});
this.baseData.parentMerchantList = Array.from(uniqueMap.values());
this.getOptionsList("editFormData", false, "parentId"); this.getOptionsList("editFormData", false, "parentId");
resolve(); resolve();
}) })
......
...@@ -143,6 +143,30 @@ export const routerName = { ...@@ -143,6 +143,30 @@ export const routerName = {
type: "primary", type: "primary",
handle: "handleBatchEditSKU", handle: "handleBatchEditSKU",
}, },
{
authId: "9030719",
parentId: "90307",
label: "批量新增SPU/SKU权益/延保",
category: "Button",
type: "primary",
handle: "handleBatchCreateSPUOrSKUExtension",
},
{
authId: "9030720",
parentId: "90307",
label: "批量新增SKU权益/延保",
category: "Button",
type: "primary",
handle: "handleBatchCreateSKUExtension",
},
{
authId: "9030721",
parentId: "90307",
label: "批量编辑SKU权益/延保",
category: "Button",
type: "primary",
handle: "handleBatchEditSKUExtension",
},
], ],
component: _import("goods/productManage/index"), component: _import("goods/productManage/index"),
}, },
......
...@@ -321,6 +321,30 @@ export const routerName = { ...@@ -321,6 +321,30 @@ export const routerName = {
}, },
auth: [ auth: [
{ {
authId: "9050910",
parentId: "90509",
label: "批量修改标签",
category: "Button",
type: "primary",
handle: "handleBatchEditTag",
},
{
authId: "9050911",
parentId: "90509",
label: "管理自定义标签",
category: "Button",
type: "primary",
handle: "handleManageTag",
},
{
authId: "9050912",
parentId: "90509",
label: "下载汇总表",
category: "Button",
type: "primary",
handle: "handleExportSummary",
},
{
authId: "9050901", authId: "9050901",
parentId: "90509", parentId: "90509",
label: "重取明细", label: "重取明细",
......
...@@ -53,6 +53,12 @@ export const routerName = { ...@@ -53,6 +53,12 @@ export const routerName = {
label: "信息核验", label: "信息核验",
handle: "handleInfoCheck", handle: "handleInfoCheck",
}, },
{
authId: "9210105",
parentId: "92101",
label: "编辑",
handle: "handleMerchantEdit",
},
], ],
component: _import("salesManagement/customer/index"), component: _import("salesManagement/customer/index"),
}, },
...@@ -149,7 +155,7 @@ export const routerName = { ...@@ -149,7 +155,7 @@ export const routerName = {
}, },
auth: [], auth: [],
component: _import( component: _import(
"salesManagement/availableInStores/tigaListingAndSalesContract/index" "salesManagement/availableInStores/tigaListingAndSalesContract/index",
), ),
}, },
9210404: { 9210404: {
...@@ -164,7 +170,7 @@ export const routerName = { ...@@ -164,7 +170,7 @@ export const routerName = {
}, },
auth: [], auth: [],
component: _import( component: _import(
"salesManagement/availableInStores/tigaListingAndSalesContract/index" "salesManagement/availableInStores/tigaListingAndSalesContract/index",
), ),
}, },
92105: { 92105: {
......
...@@ -63,7 +63,7 @@ export default { ...@@ -63,7 +63,7 @@ export default {
width: "88px", width: "88px",
height: "88px", height: "88px",
isClose: true, isClose: true,
limitSize: 1 limitSize: 15
}, },
} }
}, },
......
<template>
<el-dialog custom-class="batch-edit-tag-dialog"
:title="dialogTitle"
width="450px"
:close-on-click-modal="false"
:visible.sync="dialogVisible"
@close="handleClose">
<div v-loading="loading">
<div class="batch-edit-tag-dialog__tip">
<template v-if="isSingleMode">
请选择该流水的目标三级标签路径:
</template>
<template v-else>
您已勾选 <span>{{ selectedCount }}</span> 条流水,请选择统一覆盖的目标三级标签路径:
</template>
</div>
<glsx-combi-form ref="tagForm"
class="batch-edit-tag-dialog__form"
default-width="410px"
form-ref="tagFormRef"
is-block="true"
label-width="0px"
:form-data="tagFormData"
:form-obj="tagForm"
:form-rules="tagRules">
<template #tagPathHtml>
<el-cascader v-model="tagForm.tagPath"
class="batch-edit-tag-dialog__cascader"
placeholder="请选择三级财务标签"
separator=" / "
clearable
filterable
:options="tagOptions"
:props="cascaderProps"
@change="handleTagPathChange" />
</template>
</glsx-combi-form>
</div>
<template #footer>
<el-button size="small"
@click="handleClose">
取消
</el-button>
<el-button size="small"
type="primary"
:loading="saving"
@click="handleConfirm">
确定
</el-button>
</template>
</el-dialog>
</template>
<script>
import { bindDetailTag, nbcbAccDetailConfig } from "@api/theAssetData";
export default {
name: "BatchEditTagDialog",
props: {
visible: {
type: Boolean,
default: false,
},
selectedList: {
type: Array,
default: () => [],
},
mode: {
type: String,
default: "batch",
},
initialTagId: {
type: [String, Number],
default: "",
},
},
data() {
return {
loading: false,
saving: false,
tagOptions: [],
tagForm: {
tagPath: [],
tagId: "",
},
cascaderProps: {
value: "id",
label: "name",
children: "children",
emitPath: true,
},
tagRules: {},
tagFormData: [{
label: "",
name: "tagPath",
addHtml: "tagPathHtml",
style: {
marginRight: "0",
},
}],
};
},
computed: {
dialogVisible: {
get() {
return this.visible;
},
set(val) {
this.$emit("update:visible", val);
},
},
selectedCount() {
return this.selectedList.length;
},
isSingleMode() {
return this.mode === "single";
},
dialogTitle() {
return this.isSingleMode ? "修改自定义标签" : "批量配置三级财务标签";
},
currentTagId() {
const detail = this.selectedList[0] || {};
return this.initialTagId || detail.accDetailTagId || detail.detailTagId || detail.tagId || "";
},
},
watch: {
visible(val) {
if (val) {
this.setInitialTagPath();
}
},
},
mounted() {
this.getTagOptions();
},
methods: {
resetForm() {
this.tagForm = {
tagPath: [],
tagId: "",
};
this.$nextTick(() => {
const form = this.$refs.tagForm?.$refs?.tagFormRef;
form && form.clearValidate();
});
},
getTagOptions() {
this.loading = true;
nbcbAccDetailConfig({ custType: 1 }).then((res) => {
this.tagOptions = this.normalizeTagTree(res.accDetailTagOptions || []);
this.setInitialTagPath();
}).catch(() => {
this.tagOptions = [];
}).finally(() => {
this.loading = false;
});
},
normalizeTagTree(list, level = 1) {
return (list || []).map((item) => {
const children = this.normalizeTagTree(item.children || [], level + 1);
return {
...item,
id: item.id,
name: item.name || item.tagName || item.label || "",
children: level < 3 ? children : undefined,
};
});
},
handleTagPathChange(value) {
this.tagForm.tagId = value && value.length ? value[value.length - 1] : "";
},
setInitialTagPath() {
if (!this.isSingleMode || !this.currentTagId || !this.tagOptions.length) {
this.resetForm();
return;
}
const tagPath = this.findTagPath(this.tagOptions, this.currentTagId);
this.tagForm = {
tagPath,
tagId: tagPath.length ? tagPath[tagPath.length - 1] : "",
};
},
findTagPath(list, targetId, parentPath = []) {
for (const item of list || []) {
const currentPath = [...parentPath, item.id];
if (`${item.id}` === `${targetId}`) {
return currentPath;
}
const childPath = this.findTagPath(item.children || [], targetId, currentPath);
if (childPath.length) {
return childPath;
}
}
return [];
},
handleClose() {
this.dialogVisible = false;
},
handleConfirm() {
this.$refs.tagForm.validate().then(() => {
const params = {
detailIds: this.selectedList.map(item => item.id).join(","),
accDetailTagId: this.tagForm.tagId,
};
this.saving = true;
bindDetailTag(params).then(() => {
this.$message({
message: "保存成功",
type: "success",
showClose: true,
});
this.$emit("confirm");
this.handleClose();
}).finally(() => {
this.saving = false;
});
}).catch(() => {});
},
},
};
</script>
<style lang="scss" scoped>
::v-deep .batch-edit-tag-dialog {
.el-dialog__body {
padding: 28px 30px 24px;
}
.el-dialog__footer {
padding: 0 20px 20px;
}
.batch-edit-tag-dialog__tip {
margin-bottom: 14px;
font-size: 14px;
color: #606266;
}
.batch-edit-tag-dialog__tip span {
color: #2a58ad;
font-weight: 700;
}
.batch-edit-tag-dialog__form .glsx-combi-form-block {
display: block;
}
.batch-edit-tag-dialog__form .el-form-item {
margin-right: 0 !important;
margin-bottom: 8px;
}
.batch-edit-tag-dialog__form .el-form-item__content {
width: 100%;
}
.batch-edit-tag-dialog__cascader {
width: 100%;
}
.batch-edit-tag-dialog__desc {
margin-top: 8px;
font-size: 12px;
line-height: 18px;
color: #909399;
}
}
</style>
...@@ -73,6 +73,18 @@ ...@@ -73,6 +73,18 @@
:display-value="searchForm.qualityTestScore"> :display-value="searchForm.qualityTestScore">
</InputRange> </InputRange>
</div> </div>
<!-- 自定义标签 -->
<div slot="accDetailTagHtml">
<el-cascader v-model="searchForm.accDetailTagPath"
class="tag-search-cascader"
placeholder="请选择"
separator=" / "
clearable
filterable
:options="accDetailTagSearchOptions"
:props="tagCascaderProps">
</el-cascader>
</div>
</d2-search> </d2-search>
<div class="up-btns"> <div class="up-btns">
<el-button size="small" <el-button size="small"
...@@ -87,8 +99,11 @@ ...@@ -87,8 +99,11 @@
</div> </div>
</div> </div>
<div class="d2-container-content"> <div class="d2-container-content">
<d2-table-header> <d2-table-header style="" :left-span="0">
<auth-button category="Button" /> <span style="margin-right: 10px">
<auth-button category="Button" :show-btn-ids="['9050910', '9050911', '9050912']" />
</span>
<auth-button category="Button" :show-btn-ids="['9050901', '9050902', '9050903', '9050907', '9050908', '9050909']" />
</d2-table-header> </d2-table-header>
<d2-table ref="recordTable" <d2-table ref="recordTable"
:before-search-fn="beforeSearchFn" :before-search-fn="beforeSearchFn"
...@@ -122,6 +137,32 @@ ...@@ -122,6 +137,32 @@
</el-tooltip> </el-tooltip>
</span> </span>
</div> </div>
<div slot="accDetailTagHtml"
slot-scope="scope">
<el-tooltip v-if="scope.scope.accDetailTagPathName"
class="item"
effect="dark"
placement="right"
:content="scope.scope.accDetailTagPathName">
<span>
{{ scope.scope.accDetailTagPathName ? (scope.scope.accDetailTagPathName.length > 15 ? (`${scope.scope.accDetailTagPathName.slice(0, 15)}...`) : scope.scope.accDetailTagPathName) : '' }}
</span>
</el-tooltip>
<span v-else>-</span>
</div>
<div slot="financialReportCaliberHtml"
slot-scope="scope">
<el-tooltip v-if="scope.scope.financialReportCaliber"
class="item"
effect="dark"
placement="right"
:content="scope.scope.financialReportCaliber">
<span>
{{ scope.scope.financialReportCaliber ? (scope.scope.financialReportCaliber.length > 15 ? (`${scope.scope.financialReportCaliber.slice(0, 15)}...`) : scope.scope.financialReportCaliber) : '' }}
</span>
</el-tooltip>
<span v-else>-</span>
</div>
<auth-button slot="auth-button" <auth-button slot="auth-button"
slot-scope="scope" slot-scope="scope"
:data="scope.scope" /> :data="scope.scope" />
...@@ -169,17 +210,26 @@ ...@@ -169,17 +210,26 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
</d2-dialog> </d2-dialog>
<ManageTagDrawer v-if="tagDrawerVisible"
:visible.sync="tagDrawerVisible"
@close="handleDrawerClose" />
<BatchEditTagDialog v-if="batchEditTagVisible"
:selected-list="batchEditTagList"
:visible.sync="batchEditTagVisible"
@confirm="handleBatchEditTagConfirm" />
</div> </div>
</template> </template>
<script> <script>
import { batchPrinting, getImportTask, nbcbAccDetailBatchSync, nbcbAccDetailConfig, nbcbAccDetailPage, nbcbReceiptPdfUrl } from "@api/theAssetData"; import { batchPrinting, checkPermission, getImportTask, nbcbAccDetailBatchSync, nbcbAccDetailConfig, nbcbAccDetailPage, nbcbReceiptPdfUrl } from "@api/theAssetData";
// import { rangePickerOptions } from '@/common/format' // import { rangePickerOptions } from '@/common/format'
import { mapActions, mapMutations, mapState } from "vuex"; import { mapActions, mapMutations, mapState } from "vuex";
import { cdSignOpt, dataSourceOpt, jdSyncOpt, receiptStatusOpt } from "@/common/constants.js"; import { cdSignOpt, dataSourceOpt, jdSyncOpt, receiptStatusOpt } from "@/common/constants.js";
import { deepClone, Util } from "@/common/util"; import { deepClone, Util } from "@/common/util";
import batchEditTagDialog from "./components/batchEditTagDialog";
import detailDialog from "./components/detailDialog"; import detailDialog from "./components/detailDialog";
import inputRange from "./components/inputRange"; import inputRange from "./components/inputRange";
import manageTagDrawer from "./components/manageTagDrawer";
import refetchDialog from "./components/refetchDialog"; import refetchDialog from "./components/refetchDialog";
// import PrintJs from 'print-js' // import PrintJs from 'print-js'
export default { export default {
...@@ -188,6 +238,8 @@ export default { ...@@ -188,6 +238,8 @@ export default {
InputRange: inputRange, InputRange: inputRange,
RefetchDialog: refetchDialog, RefetchDialog: refetchDialog,
DetailDialog: detailDialog, DetailDialog: detailDialog,
ManageTagDrawer: manageTagDrawer,
BatchEditTagDialog: batchEditTagDialog,
}, },
data() { data() {
return { return {
...@@ -195,7 +247,7 @@ export default { ...@@ -195,7 +247,7 @@ export default {
// rangePickerOptions: rangePickerOptions // rangePickerOptions: rangePickerOptions
// }, // },
userInfo: this.$store.state.d2admin.user.info, userInfo: this.$store.state.d2admin.user.info,
labelWidth: "100px", labelWidth: "110px",
searchForm: { searchForm: {
// 主体类型:1-广联 2-优加 // 主体类型:1-广联 2-优加
custType: 1, custType: 1,
...@@ -217,6 +269,8 @@ export default { ...@@ -217,6 +269,8 @@ export default {
jdSyncStatus: "", jdSyncStatus: "",
dataSource: "", dataSource: "",
uses: "", uses: "",
accDetailTagPath: [],
financialReportCaliber: "",
}, },
printForm: { printForm: {
pageType: 1, pageType: 1,
...@@ -347,6 +401,16 @@ export default { ...@@ -347,6 +401,16 @@ export default {
type: "input", type: "input",
maxlength: "50", maxlength: "50",
isClear: true, isClear: true,
}, {
label: "自定义标签",
name: "accDetailTagPath",
addHtml: "accDetailTagHtml",
}, {
label: "财务报表口径",
name: "financialReportCaliber",
type: "input",
maxlength: "20",
isClear: true,
}], }],
getListApi: nbcbAccDetailPage, getListApi: nbcbAccDetailPage,
tableParams: { tableParams: {
...@@ -422,6 +486,16 @@ export default { ...@@ -422,6 +486,16 @@ export default {
width: "200px", width: "200px",
addHtml: "usesHtml", addHtml: "usesHtml",
}, { }, {
label: "自定义标签",
prop: "accDetailTagPathName",
minWidth: "240px",
addHtml: "accDetailTagHtml",
}, {
label: "财务报表口径",
prop: "financialReportCaliber",
width: "240px",
addHtml: "financialReportCaliberHtml",
}, {
label: "回单状态", label: "回单状态",
prop: "receiptStatus", prop: "receiptStatus",
width: "100px", width: "100px",
...@@ -486,6 +560,7 @@ export default { ...@@ -486,6 +560,7 @@ export default {
jdSyncOpt: deepClone(jdSyncOpt), jdSyncOpt: deepClone(jdSyncOpt),
receiptStatusOpt: deepClone(receiptStatusOpt), receiptStatusOpt: deepClone(receiptStatusOpt),
dataSourceOpt: deepClone(dataSourceOpt), dataSourceOpt: deepClone(dataSourceOpt),
accDetailTagOptions: [],
jdSyncStatusOpt: [{ jdSyncStatusOpt: [{
confId: "1", confId: "1",
confValue: "流水明细", confValue: "流水明细",
...@@ -541,12 +616,25 @@ export default { ...@@ -541,12 +616,25 @@ export default {
taskInfo: null, taskInfo: null,
taskStatus: null, taskStatus: null,
intervalId: null, // 存储定时器ID intervalId: null, // 存储定时器ID
tagDrawerVisible: false,
batchEditTagVisible: false,
batchEditTagList: [],
tagCascaderProps: {
value: "id",
label: "name",
children: "children",
checkStrictly: true,
emitPath: true,
},
}; };
}, },
computed: { computed: {
...mapState({ ...mapState({
dowloadList: state => state.d2admin.user.dowloadList, dowloadList: state => state.d2admin.user.dowloadList,
}), }),
accDetailTagSearchOptions() {
return this.getLimitedTagOptions(this.baseData.accDetailTagOptions);
},
}, },
watch: { watch: {
taskStatus: { taskStatus: {
...@@ -583,6 +671,18 @@ export default { ...@@ -583,6 +671,18 @@ export default {
this.getOptionsList(); this.getOptionsList();
}, },
getLimitedTagOptions(options = [], level = 1) {
return options.map((item) => {
const tag = { ...item };
if (level < 3 && Array.isArray(item.children) && item.children.length) {
tag.children = this.getLimitedTagOptions(item.children, level + 1);
} else {
delete tag.children;
}
return tag;
});
},
beforeSearchFn() { beforeSearchFn() {
return new Promise((resolve) => { return new Promise((resolve) => {
this.searchFormSearch = deepClone(this.searchForm); this.searchFormSearch = deepClone(this.searchForm);
...@@ -600,6 +700,13 @@ export default { ...@@ -600,6 +700,13 @@ export default {
delete this.searchFormSearch.amtMin; delete this.searchFormSearch.amtMin;
delete this.searchFormSearch.amtMax; delete this.searchFormSearch.amtMax;
} }
if (this.searchFormSearch.accDetailTagPath && this.searchFormSearch.accDetailTagPath.length > 0) {
const tagPath = this.searchFormSearch.accDetailTagPath;
this.searchFormSearch.accDetailTagId = tagPath[tagPath.length - 1];
} else {
delete this.searchFormSearch.accDetailTagId;
}
delete this.searchFormSearch.accDetailTagPath;
if (this.searchFormSearch.jdSyncType == "1") { if (this.searchFormSearch.jdSyncType == "1") {
this.searchFormSearch.jdSync = this.searchFormSearch.jdSyncStatus; this.searchFormSearch.jdSync = this.searchFormSearch.jdSyncStatus;
} else if (this.searchFormSearch.jdSyncType == "2") { } else if (this.searchFormSearch.jdSyncType == "2") {
...@@ -675,6 +782,8 @@ export default { ...@@ -675,6 +782,8 @@ export default {
jdSyncStatus: "", jdSyncStatus: "",
dataSource: "", dataSource: "",
uses: "", uses: "",
accDetailTagPath: [],
financialReportCaliber: "",
}; };
this.$refs.recordTable.refreshTable(false, true); this.$refs.recordTable.refreshTable(false, true);
}, },
...@@ -780,7 +889,7 @@ export default { ...@@ -780,7 +889,7 @@ export default {
for (let key in res) { for (let key in res) {
if (this.baseData[key]) { if (this.baseData[key]) {
this.baseData[key] = res[key]; this.baseData[key] = res[key];
if (key != "curCodeList") { if (key != "curCodeList" && key != "accDetailTagOptions") {
this.baseData[key] = this.baseData[key].map((item) => { this.baseData[key] = this.baseData[key].map((item) => {
return { return {
confId: item, confId: item,
...@@ -915,6 +1024,55 @@ export default { ...@@ -915,6 +1024,55 @@ export default {
handleClosePrint() { handleClosePrint() {
this.batchPrintVisible = false; this.batchPrintVisible = false;
}, },
// 批量修改标签
handleBatchEditTag() {
const selectedData = this.$refs.recordTable.mutiSelectArr.transferAccounts || [];
if (!selectedData?.length) {
this.$message({
message: "请选择要标签的明细",
type: "warning",
showClose: true,
});
return false;
}
this.batchEditTagList = selectedData;
this.batchEditTagVisible = true;
},
handleBatchEditTagConfirm() {
this.batchEditTagVisible = false;
this.$refs.recordTable.refreshTable(false, true);
},
// 管理自定义标签
handleManageTag() {
this.tagDrawerVisible = !this.tagDrawerVisible;
},
handleDrawerClose() {
this.tagDrawerVisible = !this.tagDrawerVisible;
this.nbcbAccDetailConfig();
},
// 下载汇总表
handleExportSummary() {
checkPermission({}).then((res) => {
const params = {
method: "dj.smartcarlife.api.nbcb.acc.summary.report.download",
};
const list = [
...this.dowloadList,
{
name: "财资汇总报表",
exportParam: JSON.stringify(params),
status: "waiting",
timeid: new Date().getTime(),
},
];
this.actionSetDownloadList({ list, type: "dowloadList" });
});
},
// //前端处理批量打印 // //前端处理批量打印
// handleBatchPrint() { // handleBatchPrint() {
// // let arr = [] // // let arr = []
...@@ -1008,6 +1166,9 @@ export default { ...@@ -1008,6 +1166,9 @@ export default {
.tableHeaderBtn { .tableHeaderBtn {
margin-left: 10px; margin-left: 10px;
} }
.tag-search-cascader {
width: 100%;
}
.importResult-1 { .importResult-1 {
width: 100%; width: 100%;
height: 40px; height: 40px;
......
...@@ -230,11 +230,17 @@ export default { ...@@ -230,11 +230,17 @@ export default {
formatter: row => formatThousand(row.dayEndBalance), formatter: row => formatThousand(row.dayEndBalance),
}, },
{ {
label: "待补录未分账订单", label: "待补录未分账订单(期限内)",
prop: "waitInputMoney", prop: "waitInputMoney",
minWidth: "90px", minWidth: "90px",
formatter: row => formatThousand(row.waitInputMoney), formatter: row => formatThousand(row.waitInputMoney),
}, },
{
label: "待补录未分账订单(期限外)",
prop: "waitInputOverdueMoney",
minWidth: "90px",
formatter: row => formatThousand(row.waitInputOverdueMoney),
},
], ],
}, },
track_event_code: "ysprepayment_manage_page", track_event_code: "ysprepayment_manage_page",
...@@ -454,6 +460,7 @@ export default { ...@@ -454,6 +460,7 @@ export default {
"serviceCharge", "serviceCharge",
"dayEndBalance", "dayEndBalance",
"waitInputMoney", "waitInputMoney",
"waitInputOverdueMoney",
]; ];
columns.forEach((column, index) => { columns.forEach((column, index) => {
if (index === 0) { if (index === 0) {
......
...@@ -65,23 +65,33 @@ export const ONLINE_DETAIL_TABLE_COLUMNS = { ...@@ -65,23 +65,33 @@ export const ONLINE_DETAIL_TABLE_COLUMNS = {
formatter: amountFormatter(["extendedWarrantyAmount"]), formatter: amountFormatter(["extendedWarrantyAmount"]),
}, },
{ {
label: "其他",
prop: "otherBusinessAmount",
formatter: amountFormatter(["otherBusinessAmount"]),
},
{
label: "待补录已分账订单", label: "待补录已分账订单",
prop: "waitInputtedAmount", prop: "waitInputtedAmount",
formatter: amountFormatter(["waitInputtedAmount"]), formatter: amountFormatter(["waitInputtedAmount"]),
}, },
{ {
label: "待补录未分账订单", label: "待补录未分账订单(期限内)",
prop: "waitInputtedNotDivisionAmount", prop: "waitInputtedNotDivisionAmount",
formatter: amountFormatter(["waitInputtedNotDivisionAmount"]), formatter: amountFormatter(["waitInputtedNotDivisionAmount"]),
}, },
{ {
label: "待补录未分账订单(期限外)",
prop: "waitInputtedNotDivisionOverdueAmount",
formatter: amountFormatter(["waitInputtedNotDivisionOverdueAmount"]),
},
{
label: "收款金额总计", label: "收款金额总计",
prop: "tradeAmount", prop: "tradeAmount",
minWidth: 90, minWidth: 90,
formatter: amountFormatter(["tradeAmount"]), formatter: amountFormatter(["tradeAmount"]),
}, },
], ],
tableSummary: ["lightChangeAmount", "equityAmount", "extendedWarrantyAmount", "waitInputtedAmount", "waitInputtedNotDivisionAmount", "tradeAmount"], tableSummary: ["lightChangeAmount", "equityAmount", "extendedWarrantyAmount", "otherBusinessAmount", "waitInputtedAmount", "waitInputtedNotDivisionAmount", "waitInputtedNotDivisionOverdueAmount", "tradeAmount"],
}, },
// 明细-收款 // 明细-收款
[ONLINE_DETAIL_TAB.DETAIL_COLLECTION]: { [ONLINE_DETAIL_TAB.DETAIL_COLLECTION]: {
...@@ -199,6 +209,11 @@ export const ONLINE_DETAIL_TABLE_COLUMNS = { ...@@ -199,6 +209,11 @@ export const ONLINE_DETAIL_TABLE_COLUMNS = {
formatter: amountFormatter(["extendedWarrantyAmount"]), formatter: amountFormatter(["extendedWarrantyAmount"]),
}, },
{ {
label: "其他",
prop: "otherBusinessAmount",
formatter: amountFormatter(["otherBusinessAmount"]),
},
{
label: "待补录已分账订单", label: "待补录已分账订单",
minWidth: 100, minWidth: 100,
prop: "waitInputtedAmount", prop: "waitInputtedAmount",
...@@ -227,6 +242,7 @@ export const ONLINE_DETAIL_TABLE_COLUMNS = { ...@@ -227,6 +242,7 @@ export const ONLINE_DETAIL_TABLE_COLUMNS = {
"lightChangeAmount", "lightChangeAmount",
"equityAmount", "equityAmount",
"extendedWarrantyAmount", "extendedWarrantyAmount",
"otherBusinessAmount",
"waitInputtedAmount", "waitInputtedAmount",
"divisionMoney", "divisionMoney",
"serviceCharge", "serviceCharge",
......
...@@ -24,7 +24,7 @@ export default { ...@@ -24,7 +24,7 @@ export default {
this.virtualScrollTop = 0; this.virtualScrollTop = 0;
return; return;
} }
const containerHeight = this.virtualScrollContainerHeight || 400; const containerHeight = this.virtualScrollContainerHeight || 650;
const totalHeight = this.virtualScrollTotalHeight; const totalHeight = this.virtualScrollTotalHeight;
const maxTop = Math.max(0, (this.virtualScrollUseVariableHeight ? totalHeight : (list.length || 0) * rowHeight) - containerHeight); const maxTop = Math.max(0, (this.virtualScrollUseVariableHeight ? totalHeight : (list.length || 0) * rowHeight) - containerHeight);
if (this.virtualScrollTop > maxTop) { if (this.virtualScrollTop > maxTop) {
...@@ -34,8 +34,9 @@ export default { ...@@ -34,8 +34,9 @@ export default {
}, },
virtualScrollVisibleRows: { virtualScrollVisibleRows: {
handler() { handler() {
if (!this.virtualScrollIsEnabled || (!this.virtualScrollUseVariableHeight && !this.virtualScrollUseAutoRowHeight)) if (!this.virtualScrollIsEnabled || (!this.virtualScrollUseVariableHeight && !this.virtualScrollUseAutoRowHeight)) {
return; return;
}
this.$nextTick(() => { this.$nextTick(() => {
this.virtualScrollMeasureVisibleRows(); this.virtualScrollMeasureVisibleRows();
}); });
...@@ -50,14 +51,17 @@ export default { ...@@ -50,14 +51,17 @@ export default {
return this.virtualScrollAutoRowHeight === true; return this.virtualScrollAutoRowHeight === true;
}, },
virtualScrollIsEnabled() { virtualScrollIsEnabled() {
if (this.virtualScrollEnabled === false) if (this.virtualScrollEnabled === false) {
return false; return false;
}
const rowHeight = Number(this.virtualScrollRowHeight || 40); const rowHeight = Number(this.virtualScrollRowHeight || 40);
const containerHeight = this.virtualScrollContainerHeight; const containerHeight = this.virtualScrollContainerHeight;
if (!Number.isFinite(rowHeight) || rowHeight <= 0) if (!Number.isFinite(rowHeight) || rowHeight <= 0) {
return false; return false;
if (!Number.isFinite(containerHeight) || containerHeight <= 0) }
if (!Number.isFinite(containerHeight) || containerHeight <= 0) {
return false; return false;
}
return true; return true;
}, },
virtualScrollDisplayList() { virtualScrollDisplayList() {
...@@ -79,8 +83,9 @@ export default { ...@@ -79,8 +83,9 @@ export default {
virtualScrollFixedRowHeight() { virtualScrollFixedRowHeight() {
if (this.virtualScrollUseAutoRowHeight) { if (this.virtualScrollUseAutoRowHeight) {
const h = Number(this.virtualScrollAutoMeasuredRowHeight || 0); const h = Number(this.virtualScrollAutoMeasuredRowHeight || 0);
if (Number.isFinite(h) && h > 0) if (Number.isFinite(h) && h > 0) {
return h; return h;
}
} }
const h = Number(this.virtualScrollRowHeight || 40); const h = Number(this.virtualScrollRowHeight || 40);
return Number.isFinite(h) && h > 0 ? h : 40; return Number.isFinite(h) && h > 0 ? h : 40;
...@@ -100,8 +105,9 @@ export default { ...@@ -100,8 +105,9 @@ export default {
}, },
virtualScrollStartIndex() { virtualScrollStartIndex() {
const list = this.virtualScrollDisplayList; const list = this.virtualScrollDisplayList;
if (!this.virtualScrollIsEnabled || !this.virtualScrollUseVariableHeight || !list.length) if (!this.virtualScrollIsEnabled || !this.virtualScrollUseVariableHeight || !list.length) {
return 0; return 0;
}
const prefix = this.virtualScrollPrefixSums; const prefix = this.virtualScrollPrefixSums;
const buffer = this.virtualScrollBuffer || 5; const buffer = this.virtualScrollBuffer || 5;
...@@ -111,42 +117,47 @@ export default { ...@@ -111,42 +117,47 @@ export default {
let hi = prefix.length - 1; let hi = prefix.length - 1;
while (lo < hi) { while (lo < hi) {
const mid = Math.floor((lo + hi + 1) / 2); const mid = Math.floor((lo + hi + 1) / 2);
if (prefix[mid] <= target) if (prefix[mid] <= target) {
lo = mid; lo = mid;
else } else {
hi = mid - 1; hi = mid - 1;
}
} }
const idx = Math.max(0, Math.min(list.length - 1, lo)); const idx = Math.max(0, Math.min(list.length - 1, lo));
return Math.max(0, idx - buffer); return Math.max(0, idx - buffer);
}, },
virtualScrollEndIndex() { virtualScrollEndIndex() {
const list = this.virtualScrollDisplayList; const list = this.virtualScrollDisplayList;
if (!this.virtualScrollIsEnabled || !this.virtualScrollUseVariableHeight || !list.length) if (!this.virtualScrollIsEnabled || !this.virtualScrollUseVariableHeight || !list.length) {
return list.length; return list.length;
}
const prefix = this.virtualScrollPrefixSums; const prefix = this.virtualScrollPrefixSums;
const containerHeight = this.virtualScrollContainerHeight || 400; const containerHeight = this.virtualScrollContainerHeight || 650;
const buffer = this.virtualScrollBuffer || 5; const buffer = this.virtualScrollBuffer || 5;
const estimated = this.virtualScrollEstimatedRowHeight; const estimated = this.virtualScrollEstimatedRowHeight;
const start = this.virtualScrollStartIndex; const start = this.virtualScrollStartIndex;
const limit = Math.max(0, this.virtualScrollTop) + containerHeight + buffer * estimated; const limit = Math.max(0, this.virtualScrollTop) + containerHeight + buffer * estimated;
let end = start; let end = start;
while (end < list.length && prefix[end] < limit) end++; while (end < list.length && prefix[end] < limit) {
end++;
}
end = Math.min(list.length, end + buffer); end = Math.min(list.length, end + buffer);
return end; return end;
}, },
virtualScrollVisibleRows() { virtualScrollVisibleRows() {
const list = this.virtualScrollDisplayList; const list = this.virtualScrollDisplayList;
if (!this.virtualScrollIsEnabled) if (!this.virtualScrollIsEnabled) {
return list; return list;
}
if (this.virtualScrollUseVariableHeight) { if (this.virtualScrollUseVariableHeight) {
const start = this.virtualScrollStartIndex; const start = this.virtualScrollStartIndex;
const end = this.virtualScrollEndIndex; const end = this.virtualScrollEndIndex;
return list.slice(start, end); return list.slice(start, end);
} }
const rowHeight = this.virtualScrollFixedRowHeight; const rowHeight = this.virtualScrollFixedRowHeight;
const containerHeight = this.virtualScrollContainerHeight || 400; const containerHeight = this.virtualScrollContainerHeight || 650;
const buffer = this.virtualScrollBuffer || 5; const buffer = this.virtualScrollBuffer || 5;
const start = Math.max(0, Math.floor(this.virtualScrollTop / rowHeight) - buffer); const start = Math.max(0, Math.floor(this.virtualScrollTop / rowHeight) - buffer);
const visibleCount = Math.ceil(containerHeight / rowHeight); const visibleCount = Math.ceil(containerHeight / rowHeight);
...@@ -155,8 +166,9 @@ export default { ...@@ -155,8 +166,9 @@ export default {
}, },
virtualScrollTotalHeight() { virtualScrollTotalHeight() {
const list = this.virtualScrollDisplayList; const list = this.virtualScrollDisplayList;
if (!this.virtualScrollIsEnabled) if (!this.virtualScrollIsEnabled) {
return 0; return 0;
}
if (this.virtualScrollUseVariableHeight) { if (this.virtualScrollUseVariableHeight) {
const prefix = this.virtualScrollPrefixSums; const prefix = this.virtualScrollPrefixSums;
return prefix[prefix.length - 1] || 0; return prefix[prefix.length - 1] || 0;
...@@ -165,8 +177,9 @@ export default { ...@@ -165,8 +177,9 @@ export default {
return Math.max(0, (list?.length || 0) * rowHeight + 2); return Math.max(0, (list?.length || 0) * rowHeight + 2);
}, },
virtualScrollOffsetY() { virtualScrollOffsetY() {
if (!this.virtualScrollIsEnabled) if (!this.virtualScrollIsEnabled) {
return 0; return 0;
}
if (this.virtualScrollUseVariableHeight) { if (this.virtualScrollUseVariableHeight) {
const prefix = this.virtualScrollPrefixSums; const prefix = this.virtualScrollPrefixSums;
const start = this.virtualScrollStartIndex; const start = this.virtualScrollStartIndex;
...@@ -180,12 +193,14 @@ export default { ...@@ -180,12 +193,14 @@ export default {
}, },
methods: { methods: {
virtualScrollOnScroll(e) { virtualScrollOnScroll(e) {
if (!this.virtualScrollIsEnabled) if (!this.virtualScrollIsEnabled) {
return; return;
}
const nextTop = e?.target?.scrollTop || 0; const nextTop = e?.target?.scrollTop || 0;
this.virtualScrollPendingTop = nextTop; this.virtualScrollPendingTop = nextTop;
if (this.virtualScrollRafId) if (this.virtualScrollRafId) {
return; return;
}
if (typeof window === "undefined" || typeof window.requestAnimationFrame !== "function") { if (typeof window === "undefined" || typeof window.requestAnimationFrame !== "function") {
this.virtualScrollTop = this.virtualScrollPendingTop; this.virtualScrollTop = this.virtualScrollPendingTop;
return; return;
...@@ -197,12 +212,14 @@ export default { ...@@ -197,12 +212,14 @@ export default {
}, },
virtualScrollMeasureVisibleRows() { virtualScrollMeasureVisibleRows() {
const table = this.$refs && this.$refs.bodyTable; const table = this.$refs && this.$refs.bodyTable;
if (!table) if (!table) {
return; return;
}
const list = this.virtualScrollVisibleRows || []; const list = this.virtualScrollVisibleRows || [];
const rows = table.querySelectorAll ? table.querySelectorAll("tbody tr") : []; const rows = table.querySelectorAll ? table.querySelectorAll("tbody tr") : [];
if (!rows || !rows.length) if (!rows || !rows.length) {
return; return;
}
if (this.virtualScrollUseAutoRowHeight && !this.virtualScrollUseVariableHeight) { if (this.virtualScrollUseAutoRowHeight && !this.virtualScrollUseVariableHeight) {
let sum = 0; let sum = 0;
...@@ -210,13 +227,15 @@ export default { ...@@ -210,13 +227,15 @@ export default {
for (let i = 0; i < rows.length && i < list.length; i++) { for (let i = 0; i < rows.length && i < list.length; i++) {
const h = rows[i].getBoundingClientRect ? rows[i].getBoundingClientRect().height : rows[i].offsetHeight; const h = rows[i].getBoundingClientRect ? rows[i].getBoundingClientRect().height : rows[i].offsetHeight;
const height = Math.max(0, Math.round(h || 0)); const height = Math.max(0, Math.round(h || 0));
if (!height) if (!height) {
continue; continue;
}
sum += height; sum += height;
count += 1; count += 1;
} }
if (!count) if (!count) {
return; return;
}
const avg = Math.max(1, Math.round(sum / count)); const avg = Math.max(1, Math.round(sum / count));
const prev = Number(this.virtualScrollAutoMeasuredRowHeight || 0); const prev = Number(this.virtualScrollAutoMeasuredRowHeight || 0);
if (!prev) { if (!prev) {
...@@ -224,20 +243,23 @@ export default { ...@@ -224,20 +243,23 @@ export default {
return; return;
} }
const next = Math.max(1, Math.round(prev * 0.7 + avg * 0.3)); const next = Math.max(1, Math.round(prev * 0.7 + avg * 0.3));
if (next !== prev) if (next !== prev) {
this.virtualScrollAutoMeasuredRowHeight = next; this.virtualScrollAutoMeasuredRowHeight = next;
}
return; return;
} }
let changed = false; let changed = false;
for (let i = 0; i < rows.length && i < list.length; i++) { for (let i = 0; i < rows.length && i < list.length; i++) {
const key = list[i] && list[i].key; const key = list[i] && list[i].key;
if (!key) if (!key) {
continue; continue;
}
const h = rows[i].getBoundingClientRect ? rows[i].getBoundingClientRect().height : rows[i].offsetHeight; const h = rows[i].getBoundingClientRect ? rows[i].getBoundingClientRect().height : rows[i].offsetHeight;
const height = Math.max(0, Math.round(h || 0)); const height = Math.max(0, Math.round(h || 0));
if (!height) if (!height) {
continue; continue;
}
if (this.virtualScrollRowHeights[key] !== height) { if (this.virtualScrollRowHeights[key] !== height) {
this.$set(this.virtualScrollRowHeights, key, height); this.$set(this.virtualScrollRowHeights, key, height);
changed = true; changed = true;
...@@ -245,11 +267,12 @@ export default { ...@@ -245,11 +267,12 @@ export default {
} }
if (changed) { if (changed) {
const list2 = this.virtualScrollDisplayList; const list2 = this.virtualScrollDisplayList;
const containerHeight = this.virtualScrollContainerHeight || 400; const containerHeight = this.virtualScrollContainerHeight || 650;
const totalHeight = this.virtualScrollTotalHeight; const totalHeight = this.virtualScrollTotalHeight;
const maxTop = Math.max(0, totalHeight - containerHeight); const maxTop = Math.max(0, totalHeight - containerHeight);
if (this.virtualScrollTop > maxTop) if (this.virtualScrollTop > maxTop) {
this.virtualScrollTop = maxTop; this.virtualScrollTop = maxTop;
}
} }
}, },
}, },
......
...@@ -12,12 +12,14 @@ const APPROVAL_TYPE_OPTIONS = Object.keys(APPROVAL_TYPE).map((key) => { ...@@ -12,12 +12,14 @@ const APPROVAL_TYPE_OPTIONS = Object.keys(APPROVAL_TYPE).map((key) => {
} }
}) })
/** /**
* 系统状态 * 系统状态 系统状态:1-草稿,4-运营复核,2-已转OA,3-完成上架更新,5-已驳回
*/ */
const SYSTEM_STATUS = { const SYSTEM_STATUS = {
1: "草稿", 1: "草稿",
4: "运营复核",
2: "已转OA", 2: "已转OA",
3: '完成上架更新' 3: '完成上架更新',
5: "已驳回"
} }
const SYSTEM_STATUS_OPTIONS = Object.keys(SYSTEM_STATUS).map((key) => { const SYSTEM_STATUS_OPTIONS = Object.keys(SYSTEM_STATUS).map((key) => {
return { return {
......
...@@ -103,6 +103,12 @@ ...@@ -103,6 +103,12 @@
type="text" type="text"
@click="handleEdit(scope.scope,'reapply')" @click="handleEdit(scope.scope,'reapply')"
>重新发起</el-button> >重新发起</el-button>
<!--👇 仅系统状态=“运营复核”的记录可操作 -->
<el-button
v-if="scope.scope.systemStatus == 4"
type="text"
@click="handleEdit(scope.scope, 'audit')"
>运营复核</el-button>
</div> </div>
</d2-table> </d2-table>
</div> </div>
...@@ -207,7 +213,14 @@ export default { ...@@ -207,7 +213,14 @@ export default {
optionId: 'baseSceneCode', optionId: 'baseSceneCode',
optionLabel: 'name', optionLabel: 'name',
optionsName: 'businessSceneOptions' optionsName: 'businessSceneOptions'
} },
{
label: '提交人',
name: 'createdBy',
type: 'input',
isClear: true,
maxlength: 20
},
], ],
getListApi: storeApprovePageQuery, getListApi: storeApprovePageQuery,
// 表格参数 // 表格参数
......
<template>
<div class="steps-box">
<el-steps finish-status="success" :active="stepIndex - 1">
<template v-for="(step, index) in stepList">
<el-step :key="index" :title="`${index + 1}、${step}`"></el-step>
</template>
</el-steps>
</div>
</template>
<script type='text/ecmascript-6'>
export default {
name: 'StepBox',
props: {
stepIndex: {
type: [Number, String],
default: 0
},
stepType: {
type: [Number, String],
default: 0
},
},
data() {
return {}
},
watch: {},
computed: {
stepList() {
return this.stepType == 1 ? [
'流量方确认',
'分账配置',
'对账配置'
] : [
'门店上架表导入',
'流量方确认',
'分账配置',
'对账配置'
]
}
},
mounted() { },
methods: {}
}
</script>
<style scoped lang='scss'>
.steps-box {
padding: 20px 36px;
background-color: white;
margin: 0 20px 20px;
::v-deep .el-step {
.el-step__head {
.el-step__line {
top: 7px;
left: 36px;
width: calc(100% - 58px);
height: 1px;
border-color: #2a58ad;
background-color: #2a58ad;
color: #2a58ad;
border: 0;
.el-step__line-inner {
display: none;
}
}
.el-step__icon {
position: relative;
width: 16px;
height: 16px;
border-color: #2a58ad;
}
&.is-process {
.el-step__icon {
&::after {
position: absolute;
content: "";
width: 8px;
height: 8px;
background-color: #2a58ad;
border-radius: 100%;
animation: elasticScale 0.6s ease-in forwards;
transform: scale(0);
}
.el-step__icon-inner {
display: none;
}
}
}
&.is-wait {
.el-step__icon {
.el-step__icon-inner {
display: none;
}
}
}
&.is-success {
.el-step__icon {
}
.el-step__icon-inner {
display: none;
}
}
}
.el-step__main {
.el-step__title {
font-size: 16px;
line-height: 29px;
&.is-process {
color: #2a58ad;
}
&.is-wait {
color: #333333;
}
&.is-success {
color: #333333;
}
}
}
}
}
@keyframes elasticScale {
0% {
/* 起始:0px */
transform: scale(0);
}
70% {
/* 过度缩放:8px * 1.25 = 10px(超出目标尺寸) */
transform: scale(1.25);
}
90% {
/* 过度缩放:8px * 1.25 = 10px(超出目标尺寸) */
transform: scale(0.75);
}
100% {
/* 回弹:回到8px(原始尺寸) */
transform: scale(1);
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="step-box-content">
<template v-if="reconciliationSceneConfigs.length > 1">
<el-tabs v-model="baseSceneCode">
<template v-for="(i, index) in reconciliationSceneConfigs">
<el-tab-pane :key="index" :label="i.baseSceneName" :name="i.baseSceneCode"></el-tab-pane>
</template>
</el-tabs>
</template>
<el-scrollbar :class="['step-box', { 'step-box-with-tabs': reconciliationSceneConfigs.length > 1 }]">
<div class="step-content">
<StepFourForm :currentItem="currentItem" :disabled="disabled" ref="stepFourForm"
:baseSceneCode="baseSceneCode" />
</div>
</el-scrollbar>
</div>
</template>
<script type='text/ecmascript-6'>
import StepFourForm from './components/StepFourForm'
export default {
name: 'StepFour',
components: { StepFourForm },
props: {
disabled: {
type: Boolean,
default: false
},
},
data() {
return {
baseSceneName: '',
baseSceneCode: '',
shelfType: '',
reconciliationSceneConfigs: [],
pageComplete: false
}
},
watch: {},
computed: {
currentItem() {
return this.reconciliationSceneConfigs.find(i => i.baseSceneCode === this.baseSceneCode)
}
},
mounted() { },
methods: {
init({ reconciliationSceneConfigs, shelfType, trafficPartyConfigs }) {
this.reconciliationSceneConfigs = reconciliationSceneConfigs
this.shelfType = shelfType
this.baseSceneCode = reconciliationSceneConfigs[0].baseSceneCode
this.baseSceneName = reconciliationSceneConfigs[0].baseSceneName
this.pageComplete = true
},
validate(callback) {
let { shelfType, baseSceneName, reconciliationSceneConfigs } = this
let flag = true,
message = '',
rulesKeys = [
'managementMarketFee1',
'managementMarketFee2',
'sunshineIncentiveFee',
'sunshine2IncentiveFee'
],
valueKey = {
managementMarketFee1: '管理层市场费1',
managementMarketFee2: '管理层市场费2',
sunshineIncentiveFee: '一线阳光激励费',
sunshine2IncentiveFee: '一线阳光2激励费'
},
label = ''
reconciliationSceneConfigs.forEach(i => {
if (shelfType == 1 && reconciliationSceneConfigs.length > 1) label = `${i.baseSceneName} `
i.productCategoryRules.forEach((e, index) => {
e.actualDivideRules = []
e.expenseOwnershipRules = []
rulesKeys.map(key => {
if (e[key] === null || e[key] === '' || e[key] === undefined) {
if (!message) message = `${label} 特殊品类${index + 1}:${valueKey[key]}不能为空`
flag = false
}
})
})
})
callback(flag, flag ? { sceneConfigs: reconciliationSceneConfigs } : message)
},
}
}
</script>
<style scoped lang='scss'>
@import "../common.scss";
.step-box-content {
height: 100%;
background-color: #fff;
margin-right: 24px;
margin-left: 24px;
::v-deep .el-tabs__nav-wrap {
padding: 0 20px;
.el-tabs__active-bar {
height: 2px;
}
&::after {
height: 1px;
z-index: 2;
}
}
::v-deep .el-tabs__header {
margin: 0 !important;
}
::v-deep .el-tabs__item {
height: 54px;
line-height: 54px;
font-size: 16px;
}
}
.step-box-with-tabs {
height: calc(100% - 57px);
}
.step-box {
.step-content {
margin: 0;
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="split-payment-box">
<template v-for="(item, index) in componentData">
<div class="split-payment-item flex" :key="index">
<div class="block flex">{{ item.paymentChannelName }}</div>
<span class="tips-block">
<span class="tips-label">线上自动分账</span>
<el-tooltip content="产生交易后会自动打款给商户,开启及关闭操作第二天生效。" effect="dark" placement="top" popper-class="tooltip-class">
<span class="tips-icon" />
</el-tooltip>:
</span>
<el-switch v-model="item.autoFlag" active-value="Y" class="switch" inactive-value="N" />
<div class="right">
<span class="tips-block">
<span class="tips-label">分账周期</span>
<el-tooltip content="用户支付的款项可按T+1或指定日自动打款给商户。" effect="dark" placement="top" popper-class="tooltip-class">
<span class="tips-icon" />
</el-tooltip>
<span>:</span>
</span>
分账周期 T+
<el-input-number class="input-number" controls-position="right" :min="1" :max="20" v-model="item.settleTime"
:disabled="item.autoFlag === 'N'"></el-input-number>
<span>日</span>
<span>(分账后第{{ item.settleTime }}天到分账方对公账户)</span>
</div>
</div>
</template>
</div>
</template>
<script type='text/ecmascript-6'>
export default {
name: 'SplitPayment',
props: {
list: {
type: Array,
default: () => []
}
},
data() {
return {
componentData: []
}
},
watch: {
list: {
handler(val) {
this.componentData = val
},
immediate: true,
deep: true
}
},
computed: {},
mounted() { },
methods: {
}
}
</script>
<style scoped lang='scss'>
.flex {
display: flex;
align-items: center;
}
.split-payment-box {
padding: 20px 20px 0;
.split-payment-item {
color: #333333;
font-size: 14px;
.block {
background: #F5F7FA;
width: 150px;
height: 32px;
justify-content: center;
margin-right: 30px;
}
margin-bottom: 20px;
.right {
margin-left: 64px;
::v-deep .input-number {
width: 80px;
margin: 0 12px;
.el-input__inner {
padding-left: 8px;
padding-right: 26px;
text-align: left;
}
}
}
}
.tips-block {
.tips-icon {
top: 50%;
transform: translateY(-50%);
&:before {
width: 100%;
height: 100%;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
}
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="split-payment-table">
<el-table :data="tableRows" border style="width: 100%">
<!-- 业务对象/费用类目列 -->
<el-table-column prop="merchantTypeName" label="业务对象/费用类目" width="180" fixed="left" />
<!-- 动态生成的费用列 -->
<el-table-column v-for="(item, index) in componentData" :key="'col-' + item.expenseCategoryId + '-' + index"
:label="getExpenseName(item.expenseCategoryId)" align="center">
<template slot-scope="{ row }">
<span class="radio-wrapper"
:class="[{ 'is-checked': getSelectedValue(item.expenseCategoryId) === row.targetMerchantType }, { 'disabled': isViewMode }]"
@click.stop="handleRadioChange(row, item, index)">
<i class="radio"></i>
</span>
</template>
</el-table-column>
</el-table>
</div>
</template>
<script type='text/ecmascript-6'>
export default {
name: 'SplitPaymentTable',
props: {
data: {
type: Array,
default: () => []
},
isViewMode: {
type: Boolean,
default: false
},
shelfType: Number,
currentTrafficParty: Object,
},
data() {
return {
componentData: [],
// targetMerchantType 枚举映射
merchantTypeMap: {
1: '平台方',
2: '服务商',
3: '流量方/上级流量方',
5: '服务商2'
},
nameMap: {
1: 'signingEntity',
2: 'partnerName',
3: 'parentName',
5: 'serviceMerchant2fName'
},
// expenseCategoryId 枚举映射
expenseCategoryMap: {
1: '流量费',
2: '服务商分润',
302: '资源费',
1300: '其他费用',
3: '产品成本',
4: '手续费',
706: '管理层市场费1',
808: '管理层市场费2',
1100: '一线阳光激励费',
902: '一线阳光2激励费',
701: '第三方成本'
},
// 存储当前选中的状态:{ expenseCategoryId: targetMerchantType }
selectedMap: {}
}
},
watch: {
data: {
handler(val) {
this.componentData = val
// 初始化选中状态
this.initSelectedMap()
},
deep: true,
immediate: true
}
},
computed: {
// 生成表格行数据
tableRows() {
const rows = [],
{ currentTrafficParty, shelfType, nameMap } = this
// 固定的业务对象类型(平台方、服务商、4s店)
const fixedMerchantTypes = [1, 2, 3]
// 添加固定的三行
fixedMerchantTypes.forEach(type => {
let merchantTypeName = this.merchantTypeMap[type] || ''
if (shelfType == 1) {
merchantTypeName = `${merchantTypeName}:${currentTrafficParty[nameMap[type]] || ''}`
}
const row = {
targetMerchantType: type,
merchantTypeName
}
rows.push(row)
})
// 只有当 componentData 中存在 targetMerchantType = 5 的数据时,才添加服务商2行
const hasService2 = this.componentData.some(item => item.targetMerchantType === 5)
if (hasService2) {
let service2Name = this.merchantTypeMap[5] || ''
if (shelfType == 1) {
service2Name = `${service2Name}:${currentTrafficParty[nameMap[5]] || ''}`
}
const service2Row = {
targetMerchantType: 5,
merchantTypeName: service2Name
}
rows.push(service2Row)
}
return rows
}
},
mounted() {
},
methods: {
// 初始化选中状态
initSelectedMap() {
this.selectedMap = {}
this.componentData.forEach(item => {
this.$set(this.selectedMap, item.expenseCategoryId, item.targetMerchantType)
})
},
// 获取费用名称
getExpenseName(expenseCategoryId) {
return this.expenseCategoryMap[expenseCategoryId] || `费用${expenseCategoryId}`
},
// 获取某费用项的选中值(用于模板中直接调用)
getSelectedValue(expenseCategoryId) {
return this.selectedMap[expenseCategoryId]
},
// 处理点击事件
handleRadioChange(row, item, index) {
if (this.isViewMode) return
// 使用 Vue.set 确保响应式更新
this.$set(this.selectedMap, item.expenseCategoryId, row.targetMerchantType)
// 强制更新视图
this.$forceUpdate()
// 通知父组件
this.$emit('change', {
expenseCategoryId: item.expenseCategoryId,
targetMerchantType: row.targetMerchantType,
index
// selectedMap: { ...this.selectedMap }
})
}
}
}
</script>
<style scoped lang='scss'>
.split-payment-table {
padding: 20px;
::v-deep .el-table {
.is-leaf {
color: #333333;
}
.el-table__header-wrapper {
th {
font-weight: bold;
}
}
}
.radio-wrapper {
display: block;
position: relative;
width: 12px;
height: 12px;
border-radius: 50%;
border: 1px solid #dcdfe6;
cursor: pointer;
transition: all 0.3s;
margin: 0 auto;
&:hover {
border-color: #2A58AD;
}
&.is-checked {
border-color: #2A58AD;
.radio {
display: block;
&::after {
content: '';
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 8px;
height: 8px;
border-radius: 50%;
background-color: #2A58AD;
}
}
}
&.disabled {
opacity: 0.6;
cursor: not-allowed;
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="step-box-content">
<template v-if="pageComplete">
<template v-if="divisionSceneConfigs.length > 1">
<el-tabs v-model="baseSceneCode">
<template v-for="(i, index) in divisionSceneConfigs">
<el-tab-pane :key="index" :label="i.baseSceneName" :name="i.baseSceneCode"></el-tab-pane>
</template>
</el-tabs>
</template>
<el-scrollbar :class="['step-box', { 'step-box-with-tabs': divisionSceneConfigs.length > 1 }]">
<div class="step-content">
<StepThreeForm :currentItem="currentItem" :shelfType="shelfType" :baseSceneCode="baseSceneCode"
:trafficPartyConfigs="trafficPartyConfigs" ref="stepThreeForm" />
</div>
</el-scrollbar>
</template>
</div>
</template>
<script type='text/ecmascript-6'>
import StepThreeForm from './components/StepThreeForm.vue'
export default {
components: { StepThreeForm },
name: 'StepThree',
props: {
disabled: {
type: Boolean,
default: false
},
},
data() {
return {
baseSceneName: '',
baseSceneCode: '',
shelfType: '',
divisionSceneConfigs: [],
trafficPartyConfigs: [],
pageComplete: false
}
},
watch: {},
computed: {
currentItem() {
return this.divisionSceneConfigs.find(i => i.baseSceneCode === this.baseSceneCode)
}
},
mounted() { },
methods: {
init({ divisionSceneConfigs, shelfType, trafficPartyConfigs }) {
this.divisionSceneConfigs = divisionSceneConfigs
this.shelfType = shelfType
this.baseSceneCode = divisionSceneConfigs[0].baseSceneCode
this.baseSceneName = divisionSceneConfigs[0].baseSceneName
this.trafficPartyConfigs = trafficPartyConfigs
this.pageComplete = true
},
validate(callback) {
let { shelfType, baseSceneName, divisionSceneConfigs } = this
let flag = true,
message = '',
rulesKeys = [
'trafficPartyRatio',
'serviceProviderRatio',
'resourceFeeRatio',
'otherFeeRatio'
],
valueKey = {
trafficPartyRatio: '流量费',
serviceProviderRatio: '服务商分润',
resourceFeeRatio: '资源费',
otherFeeRatio: '其他费用'
},
label = ''
divisionSceneConfigs.forEach(i => {
if (shelfType == 1 && divisionSceneConfigs.length > 1) label = `${i.baseSceneName} `
i.productCategoryRules.forEach((e, index) => {
rulesKeys.map(key => {
if (e[key] === null || e[key] === '' || e[key] === undefined) {
if (!message) message = `${label} 特殊品类${index + 1}:${valueKey[key]}不能为空`
flag = false
}
})
})
})
callback(flag, flag ? { sceneConfigs: divisionSceneConfigs } : message)
},
}
}
</script>
<style scoped lang='scss'>
@import "../common.scss";
.step-box-content {
height: 100%;
background-color: #fff;
margin-right: 24px;
margin-left: 24px;
::v-deep .el-tabs__nav-wrap {
padding: 0 20px;
.el-tabs__active-bar {
height: 2px;
}
&::after {
height: 1px;
z-index: 2;
}
}
::v-deep .el-tabs__header {
margin: 0 !important;
}
::v-deep .el-tabs__item {
height: 54px;
line-height: 54px;
font-size: 16px;
}
}
.step-box-with-tabs {
height: calc(100% - 57px);
}
.step-box {
.step-content {
margin: 0;
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="bottom-line-box">
<template v-if="isViewMode">
{{ {
1: '是',
0: '否'
}[data] }}
<div class="condition-box-view">
<template v-for="(item, index) in 2">
<div class="block">{{ item }}</div>
</template>
</div>
</template>
<template v-else>
<el-radio-group v-model="data" @change="changeData">
<el-radio :label="1">是</el-radio>
<el-radio :label="0">否</el-radio>
</el-radio-group>
<template v-if="data == 1">
<div class="condition-box">
<el-button type="primary" plain icon="el-icon-plus" size="small" @click="addCondition"
:disabled="guaranteeConfigs.length >= 10">添加兜底条件</el-button>
<div class="condition-list">
<template v-for="(item, index) in guaranteeConfigs">
<conditionItem :key="index" :includesList="includesConditionList" :item="item" :num="index"
@delete="deleteCondition(index)" @changeCondition="changeCondition($event, index)"
:listLength="guaranteeConfigs.length" :ref="`conditionItem${index}`" />
</template>
</div>
</div>
</template>
</template>
</div>
</template>
<script type='text/ecmascript-6'>
import ConditionItem from './ConditionItem.vue'
import { storeApproveQueryMetricConfigs } from '@/api/salesManagement.js'
export default {
name: 'BottomLineCondition',
components: { ConditionItem },
inject: ['GET_BASE_SCENE_CODE'],
props: {
value: {
type: Number,
default: 0
},
isViewMode: {
type: Boolean,
default: false
},
list: {
type: Array,
default: () => []
},
},
data() {
return {
data: '',
guaranteeConfigs: [],
includesConditionList: [],
options: []
}
},
watch: {
value: {
handler(val) {
this.data = val
},
immediate: true,
deep: true
},
list: {
handler(val) {
if (val && val.length) {
this.guaranteeConfigs = val
this.includesConditionList = val.map(item => item.guaranteeIndex)
} else this.guaranteeConfigs = [{
guaranteeIndex: '',
guaranteeStandard: null,
compensationMode: 0
}]
},
immediate: true,
deep: true
}
},
computed: {},
mounted() {
this.storeApproveQueryMetricConfigs()
},
methods: {
async storeApproveQueryMetricConfigs() {
let baseSceneCode = this.GET_BASE_SCENE_CODE(),
metricConfigs = JSON.parse(localStorage.getItem('metricConfigs')) || {}
if (!metricConfigs[baseSceneCode]) {
const data = await storeApproveQueryMetricConfigs({
baseSceneCode
})
if (data) {
metricConfigs[baseSceneCode] = data
localStorage.setItem('metricConfigs', JSON.stringify(metricConfigs))
}
}
},
addCondition() {
this.guaranteeConfigs.push({
guaranteeIndex: '',
guaranteeStandard: null,
compensationMode: '0'
})
},
deleteCondition(index) {
this.includesConditionList.splice(index, 1)
this.guaranteeConfigs.splice(index, 1)
},
changeData(val) {
this.$emit('update:value', val)
this.includesConditionList = []
if (val == 1 && this.guaranteeConfigs.length == 0) this.addCondition()
if (val == 0) this.guaranteeConfigs = []
},
changeCondition(val, index) {
this.$set(this.includesConditionList, index, val)
},
validate(callback) {
try {
let { guaranteeConfigs } = this
guaranteeConfigs.map((item, index) => {
this.$refs[`conditionItem${index}`][0]?.validate((data) => {
guaranteeConfigs[index] = data
})
})
callback(guaranteeConfigs)
} catch (error) {
console.log(error)
this.$message.error(error)
}
}
}
}
</script>
<style scoped lang='scss'>
.bottom-line-box {
width: 100%;
.condition-box {
margin-top: 8px;
}
.condition-list {
margin-top: 8px;
display: flex;
gap: 8px;
flex-direction: column;
}
.condition-box-view {
width: calc(100% + 150px);
margin-left: -150px;
display: flex;
flex-direction: column;
gap: 8px;
.block {
width: 100%;
height: 40px;
background: #F5F7FA;
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="business-information-container">
<el-form ref="formRef"
label-width="155px"
:model="componentData"
:rules="rules"
:size="size">
<div class="business-information-content">
<template v-for="(i, index) in fixedInfo">
<el-form-item :key="`fixedInfo${index}`"
class="business-information-item"
:label="`${i.label}:`">
{{ getData(i.key) || '-' }}
</el-form-item>
</template>
<template v-for="(i, index) in businessInformation">
<el-form-item :key="`businessInformation${index}`"
class="business-information-item"
:label="`${i.label}:`"
:prop="isViewMode ? '' : i.key">
<template v-if="i.type === 'text' || isViewMode">
<template v-if="componentData[i.key] != null">
{{ componentData[i.key] }}<template v-if="i.unit">
{{ i.unit }}
</template>
</template>
<template v-else></template>
</template>
<template v-else>
<div class="business-information-item-content">
<el-input v-model="componentData[i.key]"
:maxlength="i.maxlength || -1"
@input="filterInputVal(i, $event, 'componentData')">
</el-input>
<template v-if="i.unit">
{{ i.unit }}
</template>
</div>
</template>
</el-form-item>
</template>
</div>
</el-form>
</div>
</template>
<script type='text/ecmascript-6'>
import NP from "number-precision";
import { deepClone } from "@/common/util";
import componentsMixin from "./mixins.js";
export default {
name: "BusinessInformation",
mixins: [componentsMixin],
inject: ["size", "GET_PRODUCT_DETAILS"],
props: {
data: {
type: Object,
default: () => ({}),
},
isViewMode: {
type: Boolean,
default: false,
},
},
data() {
return {
componentData: {},
fixedInfo: [
{ label: "嘀加毛利", key: "djGrossProfit", type: "text" },
{ label: "嘀加毛利率", key: "djGpr", type: "text" },
],
businessInformation: [
{ label: "预估交付数/月", key: "deliveryCount", filterRule: "integerRange", min: 0, max: 999999 },
{ label: "预估触客率", key: "customerTouchRate", unit: "%", filterRule: "decimalRange", min: 0, max: 100, precision: 2 },
{ label: "人员成本", key: "personnelCost", filterRule: "decimalRange", min: 0, max: 999999, precision: 2 },
{ label: "房租", key: "rentCost", filterRule: "decimalRange", min: 0, max: 999999, precision: 2 },
{ label: "折旧与摊销", key: "depreciationCost", filterRule: "decimalRange", min: 0, max: 999999, precision: 2 },
{ label: "其他(水电、耗材等)", key: "otherCost", filterRule: "decimalRange", min: 0, max: 999999, precision: 2 },
{ label: "门店单台利润额", key: "storeProfitPerCar", filterRule: "decimalRange", min: 0, max: 999999, precision: 2 },
],
rules: {
deliveryCount: [{ required: true, message: "请输入预估交付数/月", trigger: "blur" }],
customerTouchRate: [{ required: true, message: "请输入预估触客率", trigger: "blur" }],
personnelCost: [{ required: true, message: "请输入人员成本", trigger: "blur" }],
rentCost: [{ required: true, message: "请输入房租", trigger: "blur" }],
depreciationCost: [{ required: true, message: "请输入折旧与摊销", trigger: "blur" }],
otherCost: [{ required: true, message: "请输入其他(水电、耗材等)", trigger: "blur" }],
// storeProfitPerCar: [{ required: true, message: '请输入门店单台利润额', trigger: 'blur' }]
},
};
},
computed: {
productDetails() {
return this.GET_PRODUCT_DETAILS();
},
formRef() {
return this.$refs.formRef;
},
djGrossProfit() {
let { productDetails, componentData } = this;
let { personnelCost, rentCost, depreciationCost, otherCost } = componentData;
let sum = 0;
let revenue = 0;
let trafficFee = 0;
let marketFee1 = 0;
let marketFee2 = 0;
let incentive1 = 0;
let incentive2 = 0;
let resourceFee = 0;
let productCost = 0;
let recyclingFilm = 0;
productDetails.forEach((item) => {
const lineRev = item.estimatedRevenue != null ? item.estimatedRevenue : item.revenue;
revenue = NP.plus(revenue, lineRev || 0);
trafficFee = NP.plus(trafficFee, item.trafficFee || 0);
marketFee1 = NP.plus(marketFee1, item.marketFee1 || 0);
marketFee2 = NP.plus(marketFee2, item.marketFee2 || 0);
incentive1 = NP.plus(incentive1, item.incentive1 || 0);
incentive2 = NP.plus(incentive2, item.incentive2 || 0);
resourceFee = NP.plus(resourceFee, item.resourceFee || 0);
productCost = NP.plus(productCost, item.productCost || 0);
recyclingFilm = NP.plus(recyclingFilm, item.recyclingFilm || 0);
});
sum = NP.minus(
revenue,
NP.plus(
trafficFee,
marketFee1,
marketFee2,
incentive1,
incentive2,
resourceFee,
productCost,
recyclingFilm,
personnelCost || 0,
rentCost || 0,
depreciationCost || 0,
otherCost || 0,
),
);
return Math.floor(sum * 100) / 100;
},
djGpr() {
let { productDetails, djGrossProfit } = this;
let revenue = 0;
productDetails.forEach((item) => {
const lineRev = item.estimatedRevenue != null ? item.estimatedRevenue : item.revenue;
revenue = NP.plus(revenue, lineRev || 0);
});
// 检查边界情况
if (revenue === 0 || !isFinite(revenue)) {
return "0.00%";
}
if (!isFinite(djGrossProfit)) {
return "0.00%";
}
try {
// 使用原生除法,然后手动控制精度
const division = djGrossProfit / revenue;
// 检查结果是否有效
if (!isFinite(division)) {
return "0.00%";
}
// 转换为百分比并保留2位小数(四舍五入)
const percentage = division * 100;
const roundedPercentage = Math.round(percentage * 100) / 100;
// 最终检查
if (!isFinite(roundedPercentage)) {
return "0.00%";
}
return roundedPercentage.toFixed(2) + "%";
} catch (error) {
console.error("毛利率计算错误:", error);
return "0.00%";
}
},
},
watch: {
data: {
handler(newVal) {
if (!Object.keys(this.componentData).length) {
this.componentData = deepClone(newVal);
}
},
deep: true,
immediate: true,
},
},
mounted() {
},
methods: {
getData(key) {
return this[key];
},
},
};
</script>
<style scoped lang='scss'>
.business-information-container {
padding: 20px;
.business-information-content {
width: 100%;
flex-shrink: 0;
display: flex;
align-items: center;
font-size: 14px;
gap: 0 32px;
flex-wrap: wrap;
.business-information-item {
flex-shrink: 0;
width: calc(50% - 16px);
&-content {
display: flex;
align-items: center;
gap: 11px;
}
}
}
}
</style>
<template>
<el-drawer
class="sales-category-drawer"
size="61.11vw"
:visible.sync="dialogShow"
ref="drawer"
@close="close"
append-to-body
:wrapperClosable="false"
>
<div
slot="title"
class="sales-category-drawer-title"
>{{ item.edit ? '编辑':'新增' }}销售品类</div>
<div
class="sales-category-drawer-content"
:key="viewKey"
v-loading="loading"
>
<div class="content">
<el-form
ref="form"
:model="data"
label-width="150px"
size="small"
:rules="rules"
@submit.native.prevent="handleSubmit"
>
<template v-for="(item,index) in salesCategoryList">
<div
class="block"
:key="index"
>
<div class="sub-title">{{ item.title }}</div>
<div class="sales-category-content">
<template v-for="(i,ind) in item.list">
<el-form-item
:prop="i.key"
class="sales-category-item"
:label="i.label + ':'"
:key="ind"
>
<div class="sales-category-item-content">
<template v-if="i.type === 'input'">
<el-input
:placeholder="`请输入${i.label}`"
v-model="data[i.key]"
@input="filterInputVal(i,$event,'data')"
:maxlength="i.maxlength || -1"
></el-input>
</template>
<template v-else-if="i.type === 'select'">
<el-select
v-model="data[i.key]"
:placeholder="`请选择${i.label}`"
class="select"
:disabled="setDisabled(i)"
@change="change(i,$event)"
>
<el-option
v-for="option in i.options"
:key="option.value"
:label="option.label"
:value="option.value"
/>
</el-select>
</template>
<template v-if="i.unit">{{ i.unit }}</template>
</div>
</el-form-item>
</template>
</div>
</div>
</template>
</el-form>
</div>
<div class="footer">
<el-button
v-preventReClick
@click="close"
:size="size"
>
取消
</el-button>
<el-button
v-preventReClick
@click="handleSubmit"
:size="size"
type="primary"
>
确定
</el-button>
</div>
</div>
</el-drawer>
</template>
<script type='text/ecmascript-6'>
import data from '@/views/stockManage/returnManage/constant/data';
import { SALES_CATEGORY_LIST, SALES_CATEGORY_RULES } from './constant'
import componentsMixin from './mixins.js';
import { queryProductTypes, queryProductCategories } from '@/api/salesManagement.js'
import { deepClone } from '@/common/util'
export default {
mixins: [componentsMixin],
name: 'SalesCategoryDetail',
props: {
dialogVisible: {
type: Boolean,
default: false
},
item: {
type: Object,
default: () => ({})
},
},
inject: ['GET_BASE_SCENE_CODE'],
data () {
return {
salesCategoryList: deepClone(SALES_CATEGORY_LIST),
size: 'small',
viewKey: Date.now(),
loading: false,
data: {},
rules: SALES_CATEGORY_RULES
}
},
computed: {
dialogShow: {
get () {
return this.dialogVisible
},
set (val) {
this.close()
}
},
baseSceneCode () {
return this.GET_BASE_SCENE_CODE()
},
},
watch: {
dialogShow: {
handler (val) {
if (val) this.init()
},
immediate: true,
deep: true
},
item: {
handler (val) {
this.data = val
},
immediate: true,
deep: true
},
},
mounted () {
},
methods: {
init () {
this.loading = true
this.queryProductTypes()
this.viewKey = Date.now()
},
async queryProductTypes () {
const { items } = await queryProductTypes({ baseSceneCode: this.baseSceneCode })
this.loading = false
this.salesCategoryList[0].list[0].options = items.map(i => ({ label: i, value: i }))
},
async queryProductCategories () {
const { items } = await queryProductCategories({ baseSceneCode: this.baseSceneCode, productType: this.data.productType })
this.salesCategoryList[0].list[1].options = items.map(i => ({ label: i, value: i }))
if (this.data.productCategory && !items.includes(this.data.productCategory)) this.data.productCategory = ''
},
close () {
this.$emit('update:dialogVisible', false)
},
handleSubmit () {
this.$refs.form.validate(valid => {
if (valid) {
this.$emit('submit', this.data)
}
})
},
setDisabled (i) {
let flag = false
if (i.key == 'productCategory') {
flag = !this.data.productType
}
if (this.item.edit && ['productType', 'productCategory'].includes(i.key)) flag = true
return flag
},
change (i, e) {
if (i.key == "productType") this.queryProductCategories()
}
}
}
</script>
<style scoped lang='scss'>
.flex {
display: flex;
align-items: center;
}
::v-deep.sales-category-drawer {
.el-drawer__header {
padding: 0;
margin: 0;
border-bottom: 1px solid #e5e5e5;
}
.el-drawer__close-btn {
padding: 0 20px;
.el-dialog__close {
font-weight: 700;
font-size: 24px;
}
}
&-title {
height: 26px;
line-height: 26px;
color: #333333;
font-size: 18px;
padding: 17px 20px;
font-weight: bold;
}
&-content {
height: calc(100vh - 61px);
.content {
height: calc(100% - 61px);
padding: 0 20px;
overflow-y: auto;
.sub-title {
height: 32px;
background: #f5f7fa;
line-height: 32px;
color: #333333;
text-align: center;
font-size: 14px;
font-weight: 500;
margin-bottom: 20px;
}
.block {
&:first-child {
margin-top: 20px;
}
}
.sales-category-content {
width: 100%;
display: flex;
align-items: center;
font-size: 14px;
gap: 0 32px;
flex-wrap: wrap;
.sales-category-item {
flex-shrink: 0;
width: calc(50% - 16px);
&-content {
display: flex;
align-items: center;
gap: 11px;
}
}
.select {
width: 100%;
}
}
}
.footer {
padding: 14px 0;
border-top: 1px solid #e5e5e5;
display: flex;
justify-content: flex-end;
padding-right: 20px;
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="sales-category-container">
<template v-if="!isViewMode && length > 0">
<div class="sales-category-btns">
<el-button
@click="editSalesCategory"
:size="size"
plain
type="primary"
>编辑</el-button>
<el-button
@click="deleteSalesCategory"
:size="size"
plain
type="info"
v-if="length > 1"
>删除</el-button>
</div>
</template>
<el-form
ref="formRef"
label-width="150px"
:model="componentData"
:size="size"
>
<template v-for="(item,index) in salesCategoryList">
<div
class="sales-category-item-box"
:key="index"
>
<div class="sub-title">{{ item.title }}</div>
<div class="sales-category-content">
<template v-for="(i,ind) in item.list">
<el-form-item
class="sales-category-item"
:label="i.label + ':'"
:key="ind"
>
<template v-if="componentData[i.key] != null">
{{ componentData[i.key] }}<template v-if="i.unit">{{ i.unit }}</template>
</template>
<template v-else>-</template>
</el-form-item>
</template>
</div>
</div>
</template>
</el-form>
<EditSalesCategory
:dialogVisible.sync="salesCategoryDetailVisible"
:item="currentItem"
@submit="handleEditSalesCategory"
/>
</div>
</template>
<script type='text/ecmascript-6'>
import { deepClone } from '@/common/util'
import { SALES_CATEGORY_LIST, SALES_CATEGORY_RULES } from './constant'
import EditSalesCategory from './EditSalesCategory.vue'
export default {
name: 'SalesCategory',
components: { EditSalesCategory },
props: {
data: {
type: Object,
default: () => ({})
},
length: {
type: Number,
default: 0
},
isViewMode: {
type: Boolean,
default: false
},
},
inject: ['size'],
watch: {
data: {
handler (newVal) {
if (newVal !== null && typeof newVal === 'object' && Object.keys(newVal).length) this.componentData = deepClone(newVal)
},
deep: true,
immediate: true
}
},
computed: {
formRef () {
return this.$refs.formRef
},
},
data () {
return {
componentData: {},
editStatus: false,
salesCategoryList: deepClone(SALES_CATEGORY_LIST),
salesCategoryDetailVisible: false,
currentItem: {},
rules: deepClone(SALES_CATEGORY_RULES)
}
},
mounted () {
},
methods: {
editSalesCategory (item) {
this.currentItem = {
...this.componentData,
edit: true
}
this.salesCategoryDetailVisible = true
},
addSalesCategory () {
this.currentItem = {}
this.salesCategoryDetailVisible = true
},
deleteSalesCategory () {
this.$confirm("删除后不可恢复,是否确定删除?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
closeOnClickModal: false
}).then(async () => {
this.$emit('delete', this.data)
})
},
handleEditSalesCategory (data) {
if (data.edit) {
delete data.edit
this.$emit('edit', data)
this.salesCategoryDetailVisible = false
} else {
this.$emit('add', data)
this.closeDetail()
}
},
closeDetail () {
this.salesCategoryDetailVisible = false
}
}
}
</script>
<style scoped lang='scss'>
::v-deep .el-form-item__content {
word-break: break-all;
}
.sales-category-container {
padding: 20px;
.sub-title {
height: 32px;
background: #f5f7fa;
line-height: 32px;
color: #333333;
text-align: center;
font-size: 14px;
font-weight: 500;
margin-bottom: 20px;
}
.sales-category-btns {
display: flex;
justify-content: center;
align-items: center;
gap: 20px;
margin-bottom: 20px;
}
.sales-category-content {
width: 100%;
display: flex;
align-items: center;
font-size: 14px;
gap: 0 32px;
flex-wrap: wrap;
.sales-category-item {
flex-shrink: 0;
width: calc(50% - 16px);
}
.select {
width: 100%;
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
export default { export default {
data () { data() {
return { return {
} }
}, },
...@@ -8,9 +8,10 @@ export default { ...@@ -8,9 +8,10 @@ export default {
}, },
methods: { methods: {
filterInputVal (i, val, keyName) { filterInputVal(i, val, keyName, subKeyName) {
if (!i.filterRule) return; if (!i.filterRule) return;
let target = this[keyName];
if (subKeyName !== null && subKeyName !== undefined) target = target[subKeyName];
if (i.filterRule === 'integerRange') { if (i.filterRule === 'integerRange') {
// 只保留数字 // 只保留数字
let filtered = (val || '').replace(/\D/g, ''); let filtered = (val || '').replace(/\D/g, '');
...@@ -27,7 +28,8 @@ export default { ...@@ -27,7 +28,8 @@ export default {
if (!isNaN(numValue) && numValue > i.max) { if (!isNaN(numValue) && numValue > i.max) {
filtered = String(i.max); filtered = String(i.max);
} }
this.$set(this[keyName], i.key, filtered);
this.$set(target, i.key, filtered);
} else if (i.filterRule === 'decimalRange') { } else if (i.filterRule === 'decimalRange') {
// 只保留数字和小数点 // 只保留数字和小数点
let filtered = (val || '').replace(/[^\d.]/g, ''); let filtered = (val || '').replace(/[^\d.]/g, '');
...@@ -64,7 +66,7 @@ export default { ...@@ -64,7 +66,7 @@ export default {
filtered = String(i.max); filtered = String(i.max);
} }
} }
this.$set(this[keyName], i.key, filtered); this.$set(target, i.key, filtered);
} }
} }
} }
......
::v-deep .el-scrollbar__wrap { ::v-deep .el-scrollbar__wrap {
overflow: auto scroll; overflow: auto scroll;
} }
::v-deep .el-form-item__label{
padding: 0 !important;
}
.flex { .flex {
display: flex; display: flex;
align-items: center; align-items: center;
...@@ -19,28 +21,33 @@ ...@@ -19,28 +21,33 @@
position: sticky; position: sticky;
top: 0; top: 0;
z-index: 1; z-index: 1;
background: var(--background-color, #ffffff); background: #ffffff;
height: 50px; height: 50px;
border-bottom: 1px solid var(--border-color, #e5e5e5); border-bottom: 1px solid #e5e5e5;
display: flex; display: flex;
align-items: center; align-items: center;
padding: 0 20px; padding: 0 20px;
box-sizing: border-box; box-sizing: border-box;
font-size: 16px; font-size: 16px;
font-weight: 500; font-weight: 500;
color: var(--text-color, #333333); color: #333333;
} }
} }
.step-select {
width: 400px;
}
.step-button {
margin-left: auto;
}
.step-form { .step-form {
padding: 20px; padding: 20px;
.upload-tips { .upload-tips {
color: #999999; color: #999999;
line-height: 14px; line-height: 20px;
font-size: 12px; font-size: 14px;
text-align: left; text-align: left;
margin-top: 2px;
} }
.upload-file { .upload-file {
......
/**
* 商户编辑表单 Mixin
* 继承 merchantVerifyFormMixin,针对编辑场景定制:
* 1. 商户类型固定为 4S店(accounttypeId = "2"),不可修改
* 2. 账户等级联动优化:
* - 编辑初始化时:只控制字段显示/隐藏,不清空上级商户数据,不自动请求上级商户列表
* - 用户手动修改账户等级时:正常触发完整联动(清空数据+自动请求)
* 3. 只在 loadMerchantDetail 中按需请求一次上级商户列表用于回显
* 4. 编辑场景特殊字段显示:
* - 渠道、开通模式、登录账号:固定显示为text文本,有必填标识但不校验(赋临时值避免校验)
* - 提交时忽略这些字段的临时值,提交真实数据或不提交
* 5. 联系电话:添加输入校验,仅可输入数字
*/
import merchantVerifyFormMixin from "@/components/merchantVerify/merchantVerifyFormMixin";
export default {
mixins: [merchantVerifyFormMixin],
data() {
return {
// 标记是否正在加载编辑数据(初始化阶段)
isLoadingEditDetail: false,
// 只读字段的临时占位值(用于避免校验)
_READONLY_PLACEHOLDER_: "__readonly_placeholder__",
};
},
methods: {
/**
* 编辑场景:设置字段为只读文本显示
* @param {string} fieldName - 字段名称
* @param {boolean} showRequired - 是否显示必填标识
* @param {Function} formatter - 格式化函数(可选)
* @param {boolean} usePlaceholder - 是否使用临时占位值避免校验
*/
setFieldAsReadonlyText(fieldName, showRequired = false, formatter = null, usePlaceholder = false) {
const idx = this.findIdx(fieldName);
if (idx < 0) {
return;
}
const field = this.editFormData[idx];
// 保存原始类型(用于可能的重置)
if (!field._originalType) {
field._originalType = field.type;
}
// 设置为showTxt类型(显示纯文本)
field.type = "showTxt";
// 控制必填标识显示
field.labelRequired = showRequired;
// 确保字段显示
field.isHide = false;
// 如果提供了格式化函数,添加formatter
if (formatter && typeof formatter === "function") {
field.formatter = formatter;
}
// 使用临时占位值避免校验(赋值给editData)
if (usePlaceholder) {
this.editData[fieldName] = this._READONLY_PLACEHOLDER_;
}
},
/**
* 编辑场景:初始化字段显示类型
*/
initEditFieldDisplayTypes() {
// 渠道:显示为showTxt,无必填标识,使用临时占位值
// 添加formatter显示渠道名称
this.setFieldAsReadonlyText("channelId", false, (formObj) => {
const channelId = formObj.channelId;
if (!channelId || channelId === this._READONLY_PLACEHOLDER_) {
return "-";
}
const channelList = this.baseData.channelList || [];
const channel = channelList.find(
c => String(c.dictValue) === String(channelId),
);
return channel ? channel.dictLabel : channelId;
}, true);
// 开通模式:显示为showTxt,无必填标识,使用临时占位值
// 添加formatter显示开通模式名称
this.setFieldAsReadonlyText("merchantModel", false, (formObj) => {
const merchantModel = formObj.merchantModel;
if (!merchantModel || merchantModel === this._READONLY_PLACEHOLDER_) {
return "-";
}
const modelList = this.baseData.modelList || [];
const model = modelList.find(
m => String(m.confId) === String(merchantModel),
);
return model ? model.confLabel : merchantModel;
}, true);
// 登录账号:显示为showTxt,无必填标识,使用临时占位值
// 添加formatter显示登录账号
this.setFieldAsReadonlyText("loginAccount", false, (formObj) => {
const loginAccount = formObj.loginAccount;
if (!loginAccount || loginAccount === this._READONLY_PLACEHOLDER_) {
return "-";
}
return loginAccount;
}, true);
// 编辑场景:完全移除三个只读字段的校验规则
// 注意:不能使用 delete,因为父类方法会访问这些字段
// 设置为包含一个永远通过的校验函数的数组
this.formRules.channelId = [{
validator: (rule, value, callback) => callback(),
trigger: "change",
}];
this.formRules.merchantModel = [{
validator: (rule, value, callback) => callback(),
trigger: "change",
}];
this.formRules.loginAccount = [{
validator: (rule, value, callback) => callback(),
trigger: "change",
}];
// 登录密码:保持为input类型,支持修改
const loginPasswordIdx = this.findIdx("loginPassword");
if (loginPasswordIdx >= 0) {
// 确保登录密码字段显示
this.editFormData[loginPasswordIdx].isHide = false;
}
// 联系电话:添加输入校验,仅可输入数字
const contactPhoneIdx = this.findIdx("contactPhone");
if (contactPhoneIdx >= 0) {
const field = this.editFormData[contactPhoneIdx];
// 使用 inputFn 而不是 inputLimit(glsx-combi-form 只处理 inputFn)
if (!field.inputFn) {
field.inputFn = (value) => {
// 过滤非数字字符
const filtered = value.replace(/\D/g, "");
this.editData.contactPhone = filtered;
};
}
}
},
/**
* 编辑场景:账户等级联动优化
* - 初始化阶段(isLoadingEditDetail=true):只控制字段显示/隐藏,不清空数据,不自动请求
* - 用户手动修改阶段(isLoadingEditDetail=false):正常触发完整联动
*/
syncMerchantAccountLevelSideEffects(value) {
const v = value !== undefined && value !== null
? value
: this.editData.merchantAccountLevel;
// 上级商户字段:工厂级隐藏,非工厂级显示
this.editFormData[this.findIdx("parentId")].isHide = v == "1";
this.formRules.parentId[0].required = v != "1";
// 渠道和开通模式在编辑场景下固定显示为text,不受账户等级影响
// 已在 initEditFieldDisplayTypes 中设置为text类型并固定显示
// 编辑场景优化:
// - 初始化阶段(isLoadingEditDetail=true):
// 只更新下拉选项列表,不清空上级商户数据,不自动请求上级商户列表
// 上级商户数据已在 mapMerchantDetailToEditData 中设置,稍后在 loadMerchantDetail 中按需请求列表用于回显
// - 用户手动修改阶段(isLoadingEditDetail=false):
// 正常触发完整联动:清空上级商户数据,自动请求上级商户列表
if (this.isLoadingEditDetail) {
// 初始化阶段:只更新下拉选项列表(不清空数据)
this.getOptionsList("editFormData", false, "parentId");
} else {
// 用户手动修改阶段:完整联动逻辑
this.editData.parentId = "";
this.editData.parentMerchantName = "";
this.storeCurrentPage = 1;
this.storeAllPages = 0;
this.baseData.parentMerchantList = [];
this.merchantNameKeyword = "";
this.getOptionsList("editFormData", false, "parentId");
// 自动请求上级商户列表(非工厂级时)
if (v != "1") {
this.get4sAndServiceMerchantList("store");
}
}
this.refreshMerchantTypeRadioDisabled();
},
/**
* 编辑场景:商户类型固定为 4S店
* 即使选项加载完成后,也强制设置为 "2" 并禁用
*/
async getMerchantType() {
// 调用父类方法加载商户类型选项
await merchantVerifyFormMixin.methods.getMerchantType.call(this);
// 编辑场景:强制设置为 4S店(值为 "2")
this.editData.accounttypeId = "2";
// 确保只有一个选项且禁用
this.refreshMerchantTypeRadioDisabled();
},
/**
* 编辑场景:重置表单时保持商户类型为 4S店
*/
resetMerchantVerifyForm() {
// 调用父类方法重置表单
merchantVerifyFormMixin.methods.resetMerchantVerifyForm.call(this);
// 编辑场景:重置后立即设置商户类型为 4S店
this.$nextTick(() => {
this.editData.accounttypeId = "2";
// 确保商户类型radio正确显示为disabled状态
this.refreshMerchantTypeRadioDisabled();
});
},
},
};
<!-- 销售管理 - 组织架构管理 - 列表 --> <!-- 销售管理 - 组织架构管理 - 列表 -->
<template> <template>
<div> <div>
<div class="d2-container-content" style="margin-top: 0;padding: 20px;padding-top: 5px;"> <div class="d2-container-content" style="margin-top: 0;padding: 20px;padding-top: 5px;">
<d2-table ref="organizeTable" :get-list-api="getListApi" :table-params="tableParams"> <d2-table ref="organizeTable"
<div slot="userList" slot-scope="scope"> :get-list-api="getListApi"
<el-tooltip v-if="scope.scope.userList && scope.scope.userList.length" effect="dark" placement="top"> :table-params="tableParams">
<div slot="content" class="tooltip-content-max"> <div slot="userList" slot-scope="scope">
<div>{{ scope.columnsObj.formatter(scope.scope) }}</div> <el-tooltip v-if="scope.scope.userList && scope.scope.userList.length"
</div> effect="dark"
<span class="one-line-ellipsis">{{ scope.columnsObj.formatter(scope.scope) }}</span> placement="top">
</el-tooltip> <div slot="content" class="tooltip-content-max">
<div v-else>-</div> <div>{{ scope.columnsObj.formatter(scope.scope) }}</div>
</div> </div>
<auth-button slot="auth-button" slot-scope="scope" :data="scope.scope" /> <span class="one-line-ellipsis">{{ scope.columnsObj.formatter(scope.scope) }}</span>
</d2-table> </el-tooltip>
<div v-else>
-
</div>
</div> </div>
<auth-button slot="auth-button"
slot-scope="scope"
:data="scope.scope" />
</d2-table>
</div> </div>
</template> </div>
</template>
<script>
import { busTypeOpt, cooperModeOpt, flowSituateOpt } from '../constant/baseData' <script>
import { organizationUserList } from '@api/salesManagement' import { organizationUserList } from "@api/salesManagement";
export default { import { busTypeOpt, cooperModeOpt, flowSituateOpt } from "../constant/baseData";
name: 'Customer',
data() { export default {
return { name: "Customer",
recordInfo: {}, data() {
userInfo: this.$store.state.d2admin.user.info, return {
getListApi: organizationUserList, recordInfo: {},
tableParams: { userInfo: this.$store.state.d2admin.user.info,
btnId: new Date().getTime() + parseInt(Math.random() * 1000), getListApi: organizationUserList,
listName: 'list', tableParams: {
tableOption: true, btnId: new Date().getTime() + Number.parseInt(Math.random() * 1000),
tableColumns: [{ listName: "list",
label: '省份名称', tableOption: true,
prop: 'provinceName' tableColumns: [{
},{ label: "省份名称",
label: '区域运营大区经理', prop: "provinceName",
prop: 'areaManagerName', }, {
}, { label: "区域运营大区经理",
label: '区域运营', prop: "areaManagerName",
prop: 'regionalOperationsName', }, {
}, { label: "1.1区域运营",
label: '修改时间', prop: "regionalOperationsName",
prop: 'updatedDate', }, {
width: '150px' label: "2.1区域运营",
}] prop: "regionalOperationsTwoOneName",
}, }, {
baseData: { label: "2.3区域运营",
tmplTypeList: [], prop: "regionalOperationsTwoThreeName",
provinceInfoList: [], }, {
cityList: [], label: "修改时间",
brandList: [], prop: "updatedDate",
busTypeOpt: busTypeOpt, width: "150px",
cooperModeOpt: cooperModeOpt, }],
flowSituateOpt: flowSituateOpt },
} baseData: {
} tmplTypeList: [],
}, provinceInfoList: [],
mounted() { cityList: [],
}, brandList: [],
busTypeOpt,
methods: { cooperModeOpt,
handleEdit(row = {}) { flowSituateOpt,
console.log("CS1220"); },
};
this.$router.push({ },
name: "editOrganize", mounted() {
query: { },
source: 'regional',
activeTab: 'regional', methods: {
id: row?.id || '', handleEdit(row = {}) {
regionName: row?.provinceName || '', console.log("CS1220");
regionalOperationsAreaManager: row?.regionalOperationsAreaManager || '',
regionalOperations: row?.regionalOperations || '', this.$router.push({
userList: row?.userList || [] name: "editOrganize",
} query: {
}) source: "regional",
} activeTab: "regional",
} id: row?.id || "",
} regionName: row?.provinceName || "",
regionalOperationsAreaManager: row?.regionalOperationsAreaManager || "",
</script> regionalOperations: row?.regionalOperations || "",
regionalOperationsTwoOne: row?.regionalOperationsTwoOne || "",
regionalOperationsTwoThree: row?.regionalOperationsTwoThree || "",
userList: row?.userList || [],
},
});
},
},
};
</script>
<style scoped> <style scoped>
.tabs-container { .tabs-container {
background: #ffffff;
padding: 0 20px;
margin-bottom: 0;
}
.tooltip-content-max {
max-height: 320px;
overflow-y: scroll;
}
.count-txt {
font-weight: 700;
color: #2a58ad;
margin: 0 2px;
}
.leftSpan {
display: inline-block;
box-sizing: border-box;
margin-right: 10px;
}
.fields-txt {
width: 346px;
display: inline-block;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
</style>
\ No newline at end of file \ No newline at end of file
background: #ffffff;
padding: 0 20px;
margin-bottom: 0;
}
.tooltip-content-max {
max-height: 320px;
overflow-y: scroll;
}
.count-txt {
font-weight: 700;
color: #2a58ad;
margin: 0 2px;
}
.leftSpan {
display: inline-block;
box-sizing: border-box;
margin-right: 10px;
}
.fields-txt {
width: 346px;
display: inline-block;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
</style>
...@@ -107,6 +107,7 @@ export default { ...@@ -107,6 +107,7 @@ export default {
goodsSeries: "", goodsSeries: "",
selectData: [], selectData: [],
queryDate: "", queryDate: "",
upgradeCommodityCode: "",
}, },
searchFormSearch: {}, searchFormSearch: {},
searchSelectObj: { searchSelectObj: {
...@@ -162,6 +163,11 @@ export default { ...@@ -162,6 +163,11 @@ export default {
isClear: true, isClear: true,
placeholder: "请选择", placeholder: "请选择",
pickerOptions: "stockQueryDatePickerOptions", pickerOptions: "stockQueryDatePickerOptions",
}, {
label: "产品ID",
name: "upgradeCommodityCode",
type: "input",
isClear: true,
}], }],
getListApi: getMerchantGoodsStockMonthReport, getListApi: getMerchantGoodsStockMonthReport,
tableParams: { tableParams: {
...@@ -344,6 +350,7 @@ export default { ...@@ -344,6 +350,7 @@ export default {
goodsSeries: "", goodsSeries: "",
selectData: [], selectData: [],
queryDate: "", queryDate: "",
upgradeCommodityCode: "",
}; };
this.$refs.recordTable.refreshTable(); this.$refs.recordTable.refreshTable();
this.stockMonthReportCount(); this.stockMonthReportCount();
......
<!-- 归属周期:开始固定1号 + 结束日期 + 全月 --> <!-- 归属周期:开始日期 + 结束日期 + 全月 -->
<template> <template>
<div class="period-date-range"> <div class="period-date-range">
<el-date-picker :value="startDate" <el-date-picker v-if="editableStart"
:key="startPickerKey"
v-model="startDateValue"
class="period-picker start-picker"
format="yyyy/MM/dd"
placeholder="开始日期"
type="date" type="date"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
:default-value="startPickerDefaultValue"
:disabled="disabled || !targetMonth"
:picker-options="startPickerOptions"
@change="handleStartChange" />
<el-date-picker v-else
class="period-picker start-picker"
format="yyyy/MM/dd" format="yyyy/MM/dd"
placeholder="开始日期" placeholder="开始日期"
disabled
class="period-picker start-picker" />
<span class="range-separator">-</span>
<el-date-picker v-model="endDate"
type="date" type="date"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
disabled
:value="startDate" />
<span class="range-separator">-</span>
<el-date-picker :key="endPickerKey"
v-model="endDate"
class="period-picker end-picker"
format="yyyy/MM/dd" format="yyyy/MM/dd"
placeholder="结束日期" placeholder="结束日期"
:disabled="disabled || !targetMonth" type="date"
value-format="yyyy-MM-dd"
:default-value="endPickerDefaultValue"
:disabled="disabled || !targetMonth || !startDate"
:picker-options="endPickerOptions" :picker-options="endPickerOptions"
class="period-picker end-picker"
@change="handleEndChange" /> @change="handleEndChange" />
<el-checkbox v-model="isFullMonth" <el-checkbox v-model="isFullMonth"
:disabled="disabled || !targetMonth"
class="full-month-check" class="full-month-check"
:disabled="disabled || !targetMonth || !startDate"
@change="handleFullMonthChange"> @change="handleFullMonthChange">
全月 全月
</el-checkbox> </el-checkbox>
...@@ -28,134 +43,198 @@ ...@@ -28,134 +43,198 @@
</template> </template>
<script> <script>
import { getMonthDateRange } from '@/common/format' import {
getEditablePeriodStartDateRange,
getEditablePeriodStartPickerDefaultDate,
getEditableSettlementPeriodRange,
getSettlementPeriodPickerDefaultDate,
getSettlementPeriodRange,
} from "@/common/format";
export default { export default {
name: 'PeriodDateRange', name: "PeriodDateRange",
props: { props: {
value: { value: {
type: Array, type: Array,
default: () => [] default: () => [],
}, },
targetMonth: { targetMonth: {
type: String, type: String,
default: '' default: "",
}, },
disabled: { settlementDate: {
type: Boolean, type: [Number, String],
default: false default: 0,
} },
}, editableStart: {
data() { type: Boolean,
return { default: false,
endDate: '', },
isFullMonth: false, disabled: {
endPickerOptions: { type: Boolean,
disabledDate: (time) => this.isEndDateDisabled(time) default: false,
} },
} },
}, data() {
computed: { return {
startDate() { startDateValue: "",
const { startDate } = getMonthDateRange(this.targetMonth) || {} endDate: "",
return startDate || '' isFullMonth: false,
} startPickerOptions: {
}, disabledDate: time => this.isStartDateDisabled(time),
watch: { },
value: { endPickerOptions: {
immediate: true, disabledDate: time => this.isEndDateDisabled(time),
handler(val) { },
if (val && val.length === 2 && val[1]) { };
this.endDate = val[1] },
} else { computed: {
this.endDate = '' periodRangeLimit() {
} if (this.editableStart) {
this.syncFullMonthState() return getEditableSettlementPeriodRange(this.targetMonth, this.startDateValue) || {};
} }
}, return getSettlementPeriodRange(this.targetMonth, this.settlementDate) || {};
targetMonth(val, oldVal) { },
if (val !== oldVal && oldVal) { startDate() {
this.resetRangeState() return this.editableStart ? this.startDateValue : (this.periodRangeLimit.startDate || "");
} },
} startPickerDefaultValue() {
}, return getEditablePeriodStartPickerDefaultDate(this.targetMonth);
methods: { },
isEndDateDisabled(time) { startPickerKey() {
const monthRange = getMonthDateRange(this.targetMonth) return `start-${this.targetMonth || ""}-${this.editableStart ? "editable" : "fixed"}`;
if (!monthRange) return true },
const { startDate, endDate } = monthRange endPickerKey() {
const timeStr = this.formatDateStr(time) return `end-${this.targetMonth || ""}-${this.startDate || ""}-${this.endPickerDefaultValue ? this.endPickerDefaultValue.getTime() : ""}`;
return timeStr < startDate || timeStr > endDate },
}, endPickerDefaultValue() {
resetRangeState() { if (this.editableStart) {
this.endDate = '' const { maxEndDate } = this.periodRangeLimit;
this.isFullMonth = false if (!maxEndDate) {
this.emitChange([]) return null;
}, }
formatDateStr(time) { const [year, month, day] = maxEndDate.split("-").map(item => Number.parseInt(item, 10));
const y = time.getFullYear() return new Date(year, month - 1, day);
const m = String(time.getMonth() + 1).padStart(2, '0') }
const d = String(time.getDate()).padStart(2, '0') return getSettlementPeriodPickerDefaultDate(this.targetMonth, this.settlementDate);
return `${y}-${m}-${d}` },
}, },
syncFullMonthState() { watch: {
if (!this.targetMonth || !this.endDate || !this.startDate) { value: {
this.isFullMonth = false immediate: true,
return handler(val) {
} if (this.editableStart) {
const { endDate } = getMonthDateRange(this.targetMonth) || {} this.startDateValue = val && val.length === 2 && val[0] ? val[0] : "";
this.isFullMonth = this.endDate === endDate }
}, this.endDate = val && val.length === 2 && val[1] ? val[1] : "";
emitChange(range) { this.syncFullMonthState();
this.$emit('input', range) },
this.$emit('change', range) },
}, targetMonth(val, oldVal) {
handleEndChange(val) { if (val !== oldVal && oldVal) {
if (!val || !this.startDate) { this.resetRangeState();
this.isFullMonth = false }
this.emitChange([]) },
return settlementDate(val, oldVal) {
} if (val !== oldVal) {
this.syncFullMonthState() this.resetRangeState();
this.emitChange([this.startDate, val]) }
}, },
handleFullMonthChange(checked) { },
if (checked) { methods: {
const { startDate, endDate } = getMonthDateRange(this.targetMonth) || {} isStartDateDisabled(time) {
if (startDate && endDate) { const startRange = getEditablePeriodStartDateRange(this.targetMonth);
this.endDate = endDate if (!startRange) {
this.emitChange([startDate, endDate]) return true;
} }
} else { const timeStr = this.formatDateStr(time);
this.endDate = '' return timeStr < startRange.minStartDate || timeStr > startRange.maxStartDate;
this.emitChange([]) },
} isEndDateDisabled(time) {
} const { startDate, maxEndDate } = this.periodRangeLimit;
} if (!startDate || !maxEndDate) {
} return true;
}
const timeStr = this.formatDateStr(time);
return timeStr < startDate || timeStr > maxEndDate;
},
resetRangeState() {
this.startDateValue = "";
this.endDate = "";
this.isFullMonth = false;
this.emitChange([]);
},
formatDateStr(time) {
const y = time.getFullYear();
const m = String(time.getMonth() + 1).padStart(2, "0");
const d = String(time.getDate()).padStart(2, "0");
return `${y}-${m}-${d}`;
},
syncFullMonthState() {
if (!this.targetMonth || !this.endDate || !this.startDate) {
this.isFullMonth = false;
return;
}
const { fullEndDate } = this.periodRangeLimit;
this.isFullMonth = this.endDate === fullEndDate;
},
emitChange(range) {
this.$emit("input", range);
this.$emit("change", range);
},
handleStartChange(val) {
this.endDate = "";
this.isFullMonth = false;
this.emitChange(val ? [val, ""] : []);
},
handleEndChange(val) {
if (!val || !this.startDate) {
this.isFullMonth = false;
this.emitChange([]);
return;
}
this.syncFullMonthState();
this.emitChange([this.startDate, val]);
},
handleFullMonthChange(checked) {
if (checked) {
const { startDate, fullEndDate } = this.periodRangeLimit;
if (startDate && fullEndDate) {
this.endDate = fullEndDate;
this.emitChange([startDate, fullEndDate]);
} else {
this.isFullMonth = false;
}
} else {
this.endDate = "";
this.emitChange([]);
}
},
},
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.period-date-range { .period-date-range {
display: flex; display: flex;
align-items: center; align-items: center;
width: 90%; width: 90%;
.period-picker { .period-picker {
flex: 1; flex: 1;
} }
.start-picker { .start-picker {
max-width: 46%; max-width: 46%;
} }
.end-picker { .end-picker {
max-width: 46%; max-width: 46%;
} }
.range-separator { .range-separator {
margin: 0 4px; margin: 0 4px;
color: #606266; color: #606266;
} }
.full-month-check { .full-month-check {
margin-left: 10px; margin-left: 10px;
white-space: nowrap; white-space: nowrap;
} }
} }
</style> </style>
import {
getEditablePeriodStartDateRange,
getEditablePeriodStartPickerDefaultDate,
getEditableSettlementPeriodRange,
getFallbackSettlementOptions,
getSettlementPeriodPickerDefaultDate,
getSettlementPeriodRange,
} from "@/common/format";
describe("delivery quantity settlement period", () => {
it("builds last-day and 1-27 fallback settlement options", () => {
const options = getFallbackSettlementOptions();
expect(options).toHaveLength(28);
expect(options[0]).toEqual({ label: "每月最后1天", value: 0 });
expect(options[1]).toEqual({ label: "每月1号", value: 1 });
expect(options[27]).toEqual({ label: "每月27号", value: 27 });
});
it("uses natural month range when fallback settlement day is the last day", () => {
expect(getSettlementPeriodRange("2026-05", 0)).toEqual({
startDate: "2026-05-01",
fullEndDate: "2026-05-31",
maxEndDate: "2026-05-31",
});
});
it("uses previous-month next day through selected day for full period", () => {
expect(getSettlementPeriodRange("2026-05", 25)).toEqual({
startDate: "2026-04-26",
fullEndDate: "2026-05-25",
maxEndDate: "2026-05-25",
});
});
it("opens end date picker on target month instead of current month", () => {
const defaultDate = getSettlementPeriodPickerDefaultDate("2026-06", 25);
expect(defaultDate).toEqual(new Date(2026, 5, 25));
});
it("limits editable start date to previous month day 2 through target month day 1", () => {
expect(getEditablePeriodStartDateRange("2026-05")).toEqual({
minStartDate: "2026-04-02",
maxStartDate: "2026-05-01",
});
});
it("opens editable start date picker on previous month", () => {
expect(getEditablePeriodStartPickerDefaultDate("2026-06")).toEqual(new Date(2026, 4, 2));
});
it("calculates editable full range from selected start date", () => {
expect(getEditableSettlementPeriodRange("2026-05", "2026-04-26")).toEqual({
startDate: "2026-04-26",
fullEndDate: "2026-05-25",
maxEndDate: "2026-05-25",
});
expect(getEditableSettlementPeriodRange("2026-05", "2026-05-01")).toEqual({
startDate: "2026-05-01",
fullEndDate: "2026-05-31",
maxEndDate: "2026-05-31",
});
});
});
...@@ -92,13 +92,16 @@ ...@@ -92,13 +92,16 @@
</d2-table> </d2-table>
</div> </div>
<d2-file-import-dialog title="交付数导入" <d2-file-import-dialog title="交付数导入"
:form-data="importForm"
:form-rule="importFormRule"
:is-visible="fileVisible" :is-visible="fileVisible"
@closeDialog="handleImport" @closeDialog="handleImport"
@confirmDialog="handleConfirmImport" @confirmDialog="handleConfirmImport"
@downloadTemplate="exportTemplate"> @downloadTemplate="exportTemplate">
<template #prepend> <template #prepend>
<el-form-item label="交付目标月份:" <el-form-item class="required-form-item"
required> label="交付目标月份:"
prop="targetMonth">
<el-date-picker v-model="importForm.targetMonth" <el-date-picker v-model="importForm.targetMonth"
format="yyyy-MM" format="yyyy-MM"
placeholder="选择月" placeholder="选择月"
...@@ -108,9 +111,24 @@ ...@@ -108,9 +111,24 @@
:picker-options="importMonthPickerOption" :picker-options="importMonthPickerOption"
@change="handleImportTargetMonthChange" /> @change="handleImportTargetMonthChange" />
</el-form-item> </el-form-item>
<el-form-item label="归属周期:" <el-form-item class="required-form-item"
required> label="兜底结算日期:"
prop="settlementDate">
<el-select v-model="importForm.settlementDate"
placeholder="请选择"
style="width: 100%;"
@change="handleImportFallbackSettlementDayChange">
<el-option v-for="item in fallbackSettlementOptions"
:key="item.value"
:label="item.label"
:value="item.value" />
</el-select>
</el-form-item>
<el-form-item class="required-form-item"
label="归属周期:"
prop="periodRange">
<PeriodDateRange v-model="importForm.periodRange" <PeriodDateRange v-model="importForm.periodRange"
:settlement-date="importForm.settlementDate"
:target-month="importForm.targetMonth" /> :target-month="importForm.targetMonth" />
</el-form-item> </el-form-item>
</template> </template>
...@@ -128,7 +146,7 @@ ...@@ -128,7 +146,7 @@
import { getList } from "@api/merchant"; import { getList } from "@api/merchant";
import { deleteById_deliver, deliverTargeConfigImport, distinctAllBrand, listWithPage_deliver } from "@api/shopConfig"; import { deleteById_deliver, deliverTargeConfigImport, distinctAllBrand, listWithPage_deliver } from "@api/shopConfig";
import { mapActions, mapState } from "vuex"; import { mapActions, mapState } from "vuex";
import { rangePickerOptions_deliveryQuantity_import } from "@/common/format"; import { getFallbackSettlementOptions, getSettlementPeriodRange, rangePickerOptions_deliveryQuantity_import } from "@/common/format";
import { deepClone, Util } from "@/common/util"; import { deepClone, Util } from "@/common/util";
import reportTrackFunMixin from "@/mixins/reportTrackFunMixin"; import reportTrackFunMixin from "@/mixins/reportTrackFunMixin";
import editDialog from "./components/editDialog"; import editDialog from "./components/editDialog";
...@@ -269,8 +287,29 @@ export default { ...@@ -269,8 +287,29 @@ export default {
importMonthPickerOption: rangePickerOptions_deliveryQuantity_import, importMonthPickerOption: rangePickerOptions_deliveryQuantity_import,
importForm: { importForm: {
targetMonth: "", targetMonth: "",
settlementDate: 0,
periodRange: [], periodRange: [],
}, },
importFormRule: {
targetMonth: [
{ required: true, message: "请选择交付目标月份", trigger: "change" },
],
settlementDate: [
{ required: true, message: "请选择兜底结算日期", trigger: "change" },
],
periodRange: [{
required: true,
trigger: "change",
validator: (rule, value, callback) => {
if (!value || value.length !== 2 || !value[0] || !value[1]) {
callback(new Error("请选择归属周期"));
return;
}
callback();
},
}],
},
fallbackSettlementOptions: getFallbackSettlementOptions(),
track_event_code: "shopConfig_deliver_list", track_event_code: "shopConfig_deliver_list",
track_businessParam_key: "searchForm", track_businessParam_key: "searchForm",
}; };
...@@ -485,6 +524,7 @@ export default { ...@@ -485,6 +524,7 @@ export default {
resetImportForm() { resetImportForm() {
this.importForm = { this.importForm = {
targetMonth: "", targetMonth: "",
settlementDate: 0,
periodRange: [], periodRange: [],
}; };
}, },
...@@ -493,16 +533,29 @@ export default { ...@@ -493,16 +533,29 @@ export default {
this.importForm.periodRange = []; this.importForm.periodRange = [];
}, },
handleImportFallbackSettlementDayChange() {
this.importForm.periodRange = [];
},
validateImportForm() { validateImportForm() {
if (!this.importForm.targetMonth) { if (!this.importForm.targetMonth) {
this.notice.warningTips("请选择交付目标月份"); this.notice.warningTips("请选择交付目标月份");
return false; return false;
} }
if (this.importForm.settlementDate === "" || this.importForm.settlementDate === null || this.importForm.settlementDate === undefined) {
this.notice.warningTips("请选择兜底结算日期");
return false;
}
const { periodRange } = this.importForm; const { periodRange } = this.importForm;
if (!periodRange || periodRange.length !== 2 || !periodRange[0] || !periodRange[1]) { if (!periodRange || periodRange.length !== 2 || !periodRange[0] || !periodRange[1]) {
this.notice.warningTips("请选择归属周期"); this.notice.warningTips("请选择归属周期");
return false; return false;
} }
const monthRange = getSettlementPeriodRange(this.importForm.targetMonth, this.importForm.settlementDate);
if (!monthRange || periodRange[0] !== monthRange.startDate || periodRange[1] < periodRange[0] || periodRange[1] > monthRange.maxEndDate) {
this.notice.warningTips("归属周期日期无效");
return false;
}
return true; return true;
}, },
...@@ -513,6 +566,7 @@ export default { ...@@ -513,6 +566,7 @@ export default {
let params = { let params = {
file: fileData, file: fileData,
targetMonth: this.importForm.targetMonth, targetMonth: this.importForm.targetMonth,
settlementDate: this.importForm.settlementDate,
periodStartDate: this.importForm.periodRange[0], periodStartDate: this.importForm.periodRange[0],
periodEndDate: this.importForm.periodRange[1], periodEndDate: this.importForm.periodRange[1],
}; };
...@@ -561,4 +615,10 @@ export default { ...@@ -561,4 +615,10 @@ export default {
.m-t-40 { .m-t-40 {
margin-top: 40px; margin-top: 40px;
} }
::v-deep .required-form-item > .el-form-item__label::before {
content: "*";
margin-right: 4px;
color: #f56c6c;
}
</style> </style>
This diff could not be displayed because it is too large.
...@@ -12,5 +12,6 @@ export const CLASSIFICATION_EMIT = { ...@@ -12,5 +12,6 @@ export const CLASSIFICATION_EMIT = {
DELETE_SELECT_UPGRADE_GOODS_LIST: "deleteSelectUpgradeGoodsList", DELETE_SELECT_UPGRADE_GOODS_LIST: "deleteSelectUpgradeGoodsList",
DELETE_SELECT_PACKAGE_GOODS_LIST: "deleteSelectPackageGoodsList", DELETE_SELECT_PACKAGE_GOODS_LIST: "deleteSelectPackageGoodsList",
CLASSIFICATION_TOUCHED: "classification-touched", CLASSIFICATION_TOUCHED: "classification-touched",
RULES_TEST: "rulesTest" RULES_TEST: "rulesTest",
SYNC_CATEGORY_TYPE: "syncCategoryType"
} }
<template> <template>
<div class="merchant-grounding-edit" v-loading="loading"> <div v-loading="loading" class="merchant-grounding-edit">
<el-scrollbar class="scroll-wrap"> <el-scrollbar class="scroll-wrap">
<div class="section traffic-section-wrap"> <div class="section traffic-section-wrap">
<div class="section-title"> <div class="section-title">
流量方信息 流量方信息
</div> </div>
<merchant-grounding-traffic-provider-information <MerchantGroundingTrafficProviderInformation ref="trafficProviderInformationRef"
ref="trafficProviderInformationRef" :data="trafficProviderData"
:data="trafficProviderData" :is-view-mode="false"
:is-view-mode="false" :show-edit-toolbar="false"
:show-edit-toolbar="false" :show-other-service-providers="true"
:show-other-service-providers="true" @updateData="onTrafficProviderUpdate" />
@updateData="onTrafficProviderUpdate" </div>
/> </el-scrollbar>
</div> <div class="footer-actions">
<div class="section"> <el-button type="primary"
<div class="section-title">经营信息</div> :loading="saving"
<mg-business-section ref="businessRef" :data="businessForm" :product-details="productDetails" /> @click="handleSave">
</div> 保存
<div class="section section-sales-category"> </el-button>
<div class="section-title section-title-sales-category"> <el-button @click="handleCancel">
<span class="section-title-label">销售品类</span> 取消
<el-select </el-button>
v-model="productValue" </div>
:size="trafficFormSize" </div>
class="mg-step-select"
placeholder="请选择销售品类"
>
<el-option
v-for="(item, pIndex) in productDetails"
:key="`product-${pIndex}`"
:label="`${item.productType}+${item.productCategory}`"
:value="`${item.productType}+${item.productCategory}`"
/>
</el-select>
</div>
<merchant-grounding-sales-category :data="salesCategoryData" />
</div>
</el-scrollbar>
<div class="footer-actions">
<el-button type="primary" :loading="saving" @click="handleSave">
保存
</el-button>
<el-button @click="handleCancel">
取消
</el-button>
</div>
</div>
</template> </template>
<script> <script>
import { deepClone } from "@/common/util";
import { merchantOnShelf, queryMerchantDetail } from "@api/merchant"; import { merchantOnShelf, queryMerchantDetail } from "@api/merchant";
import { getBaseSceneCodeList } from "@api/productManage"; import { getBaseSceneCodeList } from "@api/productManage";
import { deepClone } from "@/common/util";
import MerchantGroundingTrafficProviderInformation from "./components/MerchantGroundingTrafficProviderInformation.vue"; import MerchantGroundingTrafficProviderInformation from "./components/MerchantGroundingTrafficProviderInformation.vue";
import MgBusinessSection from "./components/MgBusinessSection.vue";
import MerchantGroundingSalesCategory from "./components/salesCategory/MerchantGroundingSalesCategory.vue"; import MerchantGroundingSalesCategory from "./components/salesCategory/MerchantGroundingSalesCategory.vue";
import { SALES_CATEGORY_RULES } from "./components/salesCategory/merchantGroundingSalesCategoryConstants"; import { SALES_CATEGORY_RULES } from "./components/salesCategory/merchantGroundingSalesCategoryConstants";
import MgBusinessSection from "./components/MgBusinessSection.vue"; import { buildBusinessForm, buildTrafficProviderData, normalizeBaseSceneListResponse } from "./utils/merchantDetailMap";
import { buildTrafficProviderData, buildBusinessForm, normalizeBaseSceneListResponse } from "./utils/merchantDetailMap";
import { buildMerchantOnShelfOpenPayload } from "./utils/merchantOnShelfOpenPayload"; import { buildMerchantOnShelfOpenPayload } from "./utils/merchantOnShelfOpenPayload";
export default { export default {
...@@ -151,18 +128,23 @@ export default { ...@@ -151,18 +128,23 @@ export default {
merchantId: this.detailQueryMerchantId, merchantId: this.detailQueryMerchantId,
baseSceneCode: this.detailQueryBaseSceneCode, baseSceneCode: this.detailQueryBaseSceneCode,
}); });
const mi = res?.merchantInfo || res; const mi = res?.merchantInfo || {};
const pd = res?.productDetails; const pd = res?.productDetails;
if (!mi) { if (!mi) {
this.$message.error("未获取到商户详情"); this.$message.error("未获取到商户详情");
return; return;
} }
this.merchantInfo = mi; res?.guaranteeList?.forEach((val) => {
if (val.compensationMode == 2 && val.ladderConditions) {
val.ladderConditions = JSON.parse(val.ladderConditions);
}
});
this.merchantInfo = { ...mi, guaranteeList: res?.guaranteeList };
this.productDetails = (Array.isArray(pd) ? pd : []).map(p => this.productDetails = (Array.isArray(pd) ? pd : []).map(p =>
this.applyLegacySalesCategoryKeys(p), this.applyLegacySalesCategoryKeys(p),
); );
this.detailRaw = res && typeof res === "object" ? deepClone(res) : null; this.detailRaw = res && typeof res === "object" ? deepClone(res) : null;
this.applyMerchantInfo(mi); this.applyMerchantInfo({ ...mi, guaranteeList: res?.guaranteeList });
} catch (e) { } catch (e) {
console.error(e); console.error(e);
this.$message.error("加载详情失败"); this.$message.error("加载详情失败");
...@@ -173,7 +155,9 @@ export default { ...@@ -173,7 +155,9 @@ export default {
}, },
syncTrafficProviderFormEditable() { syncTrafficProviderFormEditable() {
const ref = this.$refs.trafficProviderInformationRef; const ref = this.$refs.trafficProviderInformationRef;
if (ref) ref.editStatus = true; if (ref) {
ref.editStatus = true;
}
}, },
applyLegacySalesCategoryKeys(pd) { applyLegacySalesCategoryKeys(pd) {
const out = { ...pd }; const out = { ...pd };
...@@ -199,8 +183,10 @@ export default { ...@@ -199,8 +183,10 @@ export default {
return out; return out;
}, },
mapProductDetailsForSubmit(list) { mapProductDetailsForSubmit(list) {
if (!Array.isArray(list) || !list.length) return []; if (!Array.isArray(list) || !list.length) {
return list.map((pd) => this.applyLegacySalesCategoryKeys(pd)); return [];
}
return list.map(pd => this.applyLegacySalesCategoryKeys(pd));
}, },
handleCancel() { handleCancel() {
this.$router.go(-1); this.$router.go(-1);
...@@ -229,8 +215,8 @@ export default { ...@@ -229,8 +215,8 @@ export default {
recyclingFilm: "预估运营成本-原厂回收膜", recyclingFilm: "预估运营成本-原厂回收膜",
}; };
try { try {
productDetails.forEach(item => { productDetails.forEach((item) => {
rulesKeys.forEach(key => { rulesKeys.forEach((key) => {
if (item[key] === undefined || item[key] === null) { if (item[key] === undefined || item[key] === null) {
const keyName = `${item.productType}+${item.productCategory}`; const keyName = `${item.productType}+${item.productCategory}`;
throw `${keyName} ${valueKeys[key] || key} 不能为空`; throw `${keyName} ${valueKeys[key] || key} 不能为空`;
...@@ -249,27 +235,52 @@ export default { ...@@ -249,27 +235,52 @@ export default {
this.$message.error("流量方表单未就绪"); this.$message.error("流量方表单未就绪");
return; return;
} }
// 表单校验
const trafficOk = await new Promise((resolve) => { const trafficOk = await new Promise((resolve) => {
trafficRef.formRef.validate(valid => resolve(valid)); trafficRef.formRef.validate(valid => resolve(valid));
}); });
if (!trafficOk) return; if (!trafficOk) {
return;
}
// 兜底条件校验
if (typeof trafficRef.validateBottomSupport === "function") {
const bottomError = trafficRef.validateBottomSupport();
if (bottomError) {
this.$message.warning(bottomError);
return;
}
}
const businessRef = this.$refs.businessRef; const businessRef = this.$refs.businessRef;
if (businessRef && typeof businessRef.validate === "function") { if (businessRef && typeof businessRef.validate === "function") {
const bizOk = await businessRef.validate(); const bizOk = await businessRef.validate();
if (!bizOk) return; if (!bizOk) {
return;
}
}
if (!this.validateProductDetailsForSave()) {
return;
} }
if (!this.validateProductDetailsForSave()) return;
const traffic = deepClone(trafficRef.componentData || this.trafficProviderData); const traffic = deepClone(trafficRef.componentData || this.trafficProviderData);
if (typeof trafficRef.buildOtherServiceProvidersForSubmit === "function") { if (typeof trafficRef.buildOtherServiceProvidersForSubmit === "function") {
Object.assign(traffic, trafficRef.buildOtherServiceProvidersForSubmit()); Object.assign(traffic, trafficRef.buildOtherServiceProvidersForSubmit());
} }
const businessForm = const businessForm
businessRef && typeof businessRef.getFormData === "function" = businessRef && typeof businessRef.getFormData === "function"
? businessRef.getFormData() ? businessRef.getFormData()
: { ...this.businessForm }; : { ...this.businessForm };
const productDetailsForSubmit = this.mapProductDetailsForSubmit(this.productDetails); const productDetailsForSubmit = this.mapProductDetailsForSubmit(this.productDetails);
this.saving = true; this.saving = true;
try { try {
// 使用组件方法构建包含 dataType 的兜底条件列表
console.log(trafficRef.buildGuaranteeListForSubmit);
const guaranteeList = typeof trafficRef.buildGuaranteeListForSubmit === "function"
? trafficRef.buildGuaranteeListForSubmit()
: traffic.guaranteeList || [];
guaranteeList?.forEach((val) => {
if (val.compensationMode == 2 && val.ladderConditions?.length) {
val.ladderConditions = JSON.stringify(val.ladderConditions);
}
});
const payload = buildMerchantOnShelfOpenPayload({ const payload = buildMerchantOnShelfOpenPayload({
detailQueryBaseSceneCode: this.detailQueryBaseSceneCode, detailQueryBaseSceneCode: this.detailQueryBaseSceneCode,
detailQueryMerchantId: this.detailQueryMerchantId, detailQueryMerchantId: this.detailQueryMerchantId,
...@@ -278,13 +289,15 @@ export default { ...@@ -278,13 +289,15 @@ export default {
businessForm, businessForm,
productDetailsForSubmit, productDetailsForSubmit,
baseSceneList: this.baseSceneList, baseSceneList: this.baseSceneList,
guaranteeList,
}); });
console.log(payload);
await merchantOnShelf(payload); await merchantOnShelf(payload);
this.$message.success("保存成功"); this.$message.success("保存成功");
this.$router.push({ name: "merchantManage" }); this.$router.push({ name: "merchantManage" });
} catch (e) { } catch (e) {
console.error(e); console.error(e);
this.$message.error((e && e.message) || "保存失败"); // this.$message.error((e && e.message) || "保存失败");
} finally { } finally {
this.saving = false; this.saving = false;
} }
...@@ -297,14 +310,13 @@ export default { ...@@ -297,14 +310,13 @@ export default {
.merchant-grounding-edit { .merchant-grounding-edit {
position: relative; position: relative;
/* 占满主内容可视高度(约扣顶栏+分页签+边距),底栏相对本区域固定在底部,不压侧边菜单 */ /* 占满主内容可视高度(约扣顶栏+分页签+边距),底栏相对本区域固定在底部,不压侧边菜单 */
height: calc(100vh - 120px); height: calc(100vh - 145px);
max-height: calc(100vh - 120px); max-height: calc(100vh - 145px);
box-sizing: border-box; box-sizing: border-box;
background-color: #fff; background-color: #fff;
} }
.scroll-wrap { .scroll-wrap {
height: calc(100% - 56px); height: calc(100% - 56px);
} }
......
<template> <template>
<div class="merchant-relation-grounding-readonly" v-loading="loading"> <div v-loading="loading" class="merchant-relation-grounding-readonly">
<div class="section grounding-section-traffic"> <div class="section grounding-section-traffic">
<div class="section-title"> <div class="section-title">
流量方信息 流量方信息
</div> </div>
<merchant-grounding-traffic-provider-information <MerchantGroundingTrafficProviderInformation :data="trafficProviderData"
:data="trafficProviderData" :is-view-mode="true"
:is-view-mode="true" :show-edit-toolbar="false"
:show-edit-toolbar="false" :show-other-service-providers="true" />
:show-other-service-providers="true" </div>
:fetch-staff-role-options="fetchStaffRoleOptions" </div>
/>
</div>
<div class="section">
<div class="section-title">经营信息</div>
<mg-business-section
:data="businessForm"
:product-details="productDetails"
/>
</div>
<div class="section section-sales-category">
<mg-sales-category-section :product-details="productDetails" />
</div>
</div>
</template> </template>
<script> <script>
import MerchantGroundingTrafficProviderInformation from "./components/MerchantGroundingTrafficProviderInformation.vue"; import MerchantGroundingTrafficProviderInformation from "./components/MerchantGroundingTrafficProviderInformation.vue";
import MgBusinessSection from "./components/MgBusinessSection.vue";
import MgSalesCategorySection from "./components/MgSalesCategorySection.vue";
export default { export default {
name: "MerchantRelationGroundingReadonly", name: "MerchantRelationGroundingReadonly",
components: { components: {
MerchantGroundingTrafficProviderInformation, MerchantGroundingTrafficProviderInformation,
MgBusinessSection,
MgSalesCategorySection,
}, },
provide () { provide() {
return { return {
size: "mini", size: "mini",
GET_BASE_SCENE_CODE: () => this.baseSceneCode,
}; };
}, },
props: { props: {
...@@ -59,10 +43,9 @@ export default { ...@@ -59,10 +43,9 @@ export default {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
/** 见 MerchantGroundingTrafficProviderInformation.fetchStaffRoleOptions */ baseSceneCode: {
fetchStaffRoleOptions: { type: String,
type: Boolean, default: "",
default: true,
}, },
}, },
}; };
......
...@@ -2,22 +2,32 @@ import NP from "number-precision"; ...@@ -2,22 +2,32 @@ import NP from "number-precision";
/** 详情/历史接口人员 ID、姓名字段大小写不一致时的兜底读取 */ /** 详情/历史接口人员 ID、姓名字段大小写不一致时的兜底读取 */
function pickStr(mi, ...keys) { function pickStr(mi, ...keys) {
if (!mi || typeof mi !== "object") return ""; if (!mi || typeof mi !== "object") {
return "";
}
for (const k of keys) { for (const k of keys) {
const v = mi[k]; const v = mi[k];
if (v != null && String(v).trim() !== "") return String(v).trim(); if (v != null && String(v).trim() !== "") {
return String(v).trim();
}
} }
return ""; return "";
} }
function joinStaffIds(mi, listKey, ...idKeys) { function joinStaffIds(mi, listKey, ...idKeys) {
if (!mi || typeof mi !== "object") return ""; if (!mi || typeof mi !== "object") {
return "";
}
for (const idKey of idKeys) { for (const idKey of idKeys) {
const str = mi[idKey]; const str = mi[idKey];
if (str != null && str !== "") return String(str); if (str != null && str !== "") {
return String(str);
}
} }
const list = mi[listKey]; const list = mi[listKey];
if (Array.isArray(list) && list.length) return list.join(","); if (Array.isArray(list) && list.length) {
return list.join(",");
}
return ""; return "";
} }
...@@ -26,12 +36,14 @@ function joinStaffIds(mi, listKey, ...idKeys) { ...@@ -26,12 +36,14 @@ function joinStaffIds(mi, listKey, ...idKeys) {
* listKeys / scalarKeys 可传多个别名(如 areaOpIdList / areaopIdList)。 * listKeys / scalarKeys 可传多个别名(如 areaOpIdList / areaopIdList)。
*/ */
export function normalizeStaffIdListFromMi(mi, listKeys, scalarKeys) { export function normalizeStaffIdListFromMi(mi, listKeys, scalarKeys) {
if (!mi || typeof mi !== "object") return []; if (!mi || typeof mi !== "object") {
return [];
}
const lk = Array.isArray(listKeys) ? listKeys : [listKeys]; const lk = Array.isArray(listKeys) ? listKeys : [listKeys];
for (const key of lk) { for (const key of lk) {
const rawList = mi[key]; const rawList = mi[key];
if (Array.isArray(rawList) && rawList.length) { if (Array.isArray(rawList) && rawList.length) {
return rawList.map((x) => String(x).trim()).filter(Boolean); return rawList.map(x => String(x).trim()).filter(Boolean);
} }
} }
const sk = Array.isArray(scalarKeys) ? scalarKeys : [scalarKeys]; const sk = Array.isArray(scalarKeys) ? scalarKeys : [scalarKeys];
...@@ -40,7 +52,7 @@ export function normalizeStaffIdListFromMi(mi, listKeys, scalarKeys) { ...@@ -40,7 +52,7 @@ export function normalizeStaffIdListFromMi(mi, listKeys, scalarKeys) {
if (str != null && String(str).trim() !== "") { if (str != null && String(str).trim() !== "") {
return String(str) return String(str)
.split(/[,/]+/) .split(/[,/]+/)
.map((s) => s.trim()) .map(s => s.trim())
.filter(Boolean); .filter(Boolean);
} }
} }
...@@ -49,10 +61,14 @@ export function normalizeStaffIdListFromMi(mi, listKeys, scalarKeys) { ...@@ -49,10 +61,14 @@ export function normalizeStaffIdListFromMi(mi, listKeys, scalarKeys) {
/** 场景列表接口可能返回 { list } 或裸数组,统一成数组 */ /** 场景列表接口可能返回 { list } 或裸数组,统一成数组 */
export function normalizeBaseSceneListResponse(res) { export function normalizeBaseSceneListResponse(res) {
if (Array.isArray(res)) return res; if (Array.isArray(res)) {
return res;
}
if (res && typeof res === "object") { if (res && typeof res === "object") {
const inner = res.list ?? res.records ?? res.data ?? res.rows ?? res.scenes; const inner = res.list ?? res.records ?? res.data ?? res.rows ?? res.scenes;
if (Array.isArray(inner)) return inner; if (Array.isArray(inner)) {
return inner;
}
} }
return []; return [];
} }
...@@ -63,47 +79,67 @@ export function normalizeBaseSceneListResponse(res) { ...@@ -63,47 +79,67 @@ export function normalizeBaseSceneListResponse(res) {
* 按 baseSceneCode 精确匹配取 sceneType;无效时返回 0。 * 按 baseSceneCode 精确匹配取 sceneType;无效时返回 0。
*/ */
export function resolveSceneTypeFromBaseSceneFilterList(baseSceneCode, baseSceneList = []) { export function resolveSceneTypeFromBaseSceneFilterList(baseSceneCode, baseSceneList = []) {
if (baseSceneCode == null || baseSceneCode === "") return 0; if (baseSceneCode == null || baseSceneCode === "") {
return 0;
}
const codeStr = String(baseSceneCode).trim(); const codeStr = String(baseSceneCode).trim();
if (!codeStr) return 0; if (!codeStr) {
return 0;
}
const list = Array.isArray(baseSceneList) ? baseSceneList : []; const list = Array.isArray(baseSceneList) ? baseSceneList : [];
const hit = list.find( const hit = list.find(
item => item != null item => item != null
&& String(item.baseSceneCode ?? "").trim() === codeStr, && String(item.baseSceneCode ?? "").trim() === codeStr,
) ?? null; ) ?? null;
if (hit == null) return 0; if (hit == null) {
return 0;
}
const v = hit.sceneType; const v = hit.sceneType;
if (v === undefined || v === null || v === "") return 0; if (v === undefined || v === null || v === "") {
return 0;
}
const n = Number(v); const n = Number(v);
return Number.isFinite(n) ? n : 0; return Number.isFinite(n) ? n : 0;
} }
function sceneRowMatchCodes(row) { function sceneRowMatchCodes(row) {
if (!row || typeof row !== "object") return []; if (!row || typeof row !== "object") {
return [];
}
const keys = ["baseSceneCode", "sceneCode", "bizSceneCode", "code", "id", "sceneId"]; const keys = ["baseSceneCode", "sceneCode", "bizSceneCode", "code", "id", "sceneId"];
const out = []; const out = [];
for (const k of keys) { for (const k of keys) {
const v = row[k]; const v = row[k];
if (v != null && v !== "") out.push(String(v).trim()); if (v != null && v !== "") {
out.push(String(v).trim());
}
} }
return out; return out;
} }
/** 历史/详情里可能出现的场景编码字段(仅用于名称反查,不含 scene 大类枚举) */ /** 历史/详情里可能出现的场景编码字段(仅用于名称反查,不含 scene 大类枚举) */
export function pickSceneLookupCode(mi) { export function pickSceneLookupCode(mi) {
if (!mi || typeof mi !== "object") return ""; if (!mi || typeof mi !== "object") {
return "";
}
const keys = ["baseSceneCode", "bizBaseSceneCode", "bizSceneCode", "sceneBizCode", "businessSceneCode"]; const keys = ["baseSceneCode", "bizBaseSceneCode", "bizSceneCode", "sceneBizCode", "businessSceneCode"];
for (const k of keys) { for (const k of keys) {
const v = mi[k]; const v = mi[k];
if (v != null && v !== "") return v; if (v != null && v !== "") {
return v;
}
} }
return ""; return "";
} }
export function resolveSceneName(code, baseSceneList = []) { export function resolveSceneName(code, baseSceneList = []) {
if (code == null || code === "") return ""; if (code == null || code === "") {
return "";
}
const codeStr = String(code).trim(); const codeStr = String(code).trim();
if (!codeStr) return ""; if (!codeStr) {
return "";
}
const hit = baseSceneList.find(row => sceneRowMatchCodes(row).includes(codeStr)); const hit = baseSceneList.find(row => sceneRowMatchCodes(row).includes(codeStr));
if (hit) { if (hit) {
return hit.name ?? hit.sceneName ?? hit.label ?? hit.confLabel ?? codeStr; return hit.name ?? hit.sceneName ?? hit.label ?? hit.confLabel ?? codeStr;
...@@ -116,22 +152,32 @@ export function resolveSceneName(code, baseSceneList = []) { ...@@ -116,22 +152,32 @@ export function resolveSceneName(code, baseSceneList = []) {
* 供头部「业务场景」等按 baseSceneCode 回显,避免无列表数据时把纯数字编码当作名称展示。 * 供头部「业务场景」等按 baseSceneCode 回显,避免无列表数据时把纯数字编码当作名称展示。
*/ */
export function getSceneDisplayNameFromList(code, baseSceneList = []) { export function getSceneDisplayNameFromList(code, baseSceneList = []) {
if (code == null || code === "") return ""; if (code == null || code === "") {
return "";
}
const codeStr = String(code).trim(); const codeStr = String(code).trim();
if (!codeStr) return ""; if (!codeStr) {
const hit = baseSceneList.find((row) => return "";
sceneRowMatchCodes(row).includes(codeStr) }
const hit = baseSceneList.find(row =>
sceneRowMatchCodes(row).includes(codeStr),
); );
if (!hit) return ""; if (!hit) {
return "";
}
const n = hit.name ?? hit.sceneName ?? hit.label ?? hit.confLabel; const n = hit.name ?? hit.sceneName ?? hit.label ?? hit.confLabel;
return n != null && String(n).trim() !== "" ? String(n).trim() : ""; return n != null && String(n).trim() !== "" ? String(n).trim() : "";
} }
/** 门店单台利润额:仅回显接口字段 storeProfitPerCar,不做推算 */ /** 门店单台利润额:仅回显接口字段 storeProfitPerCar,不做推算 */
export function storeProfitPerCar(mi) { export function storeProfitPerCar(mi) {
if (!mi || typeof mi !== "object") return ""; if (!mi || typeof mi !== "object") {
return "";
}
const direct = mi.storeProfitPerCar; const direct = mi.storeProfitPerCar;
if (direct == null || direct === "") return ""; if (direct == null || direct === "") {
return "";
}
const n = Number(direct); const n = Number(direct);
if (!Number.isNaN(n)) { if (!Number.isNaN(n)) {
return String(NP.round(n, 2)); return String(NP.round(n, 2));
...@@ -162,14 +208,20 @@ export function parseOtherServiceProvidersFromMi(mi) { ...@@ -162,14 +208,20 @@ export function parseOtherServiceProvidersFromMi(mi) {
const ids = []; const ids = [];
const names = []; const names = [];
for (const item of parsed) { for (const item of parsed) {
if (item == null) continue; if (item == null) {
continue;
}
if (typeof item === "number") { if (typeof item === "number") {
if (!Number.isNaN(item)) ids.push(Number(item)); if (!Number.isNaN(item)) {
ids.push(Number(item));
}
continue; continue;
} }
if (typeof item === "string") { if (typeof item === "string") {
const n = Number(item); const n = Number(item);
if (!Number.isNaN(n)) ids.push(n); if (!Number.isNaN(n)) {
ids.push(n);
}
continue; continue;
} }
if (typeof item === "object") { if (typeof item === "object") {
...@@ -177,7 +229,9 @@ export function parseOtherServiceProvidersFromMi(mi) { ...@@ -177,7 +229,9 @@ export function parseOtherServiceProvidersFromMi(mi) {
const nameRaw = item.merchantName ?? item.name ?? ""; const nameRaw = item.merchantName ?? item.name ?? "";
if (idRaw != null && idRaw !== "") { if (idRaw != null && idRaw !== "") {
const n = Number(idRaw); const n = Number(idRaw);
if (!Number.isNaN(n)) ids.push(n); if (!Number.isNaN(n)) {
ids.push(n);
}
} }
if (nameRaw != null && String(nameRaw).trim() !== "") { if (nameRaw != null && String(nameRaw).trim() !== "") {
names.push(String(nameRaw).trim()); names.push(String(nameRaw).trim());
...@@ -223,6 +277,15 @@ export function buildTrafficProviderData(mi, baseSceneList = []) { ...@@ -223,6 +277,15 @@ export function buildTrafficProviderData(mi, baseSceneList = []) {
nameFromMi != null && String(nameFromMi).trim() !== "" nameFromMi != null && String(nameFromMi).trim() !== ""
? String(nameFromMi).trim() ? String(nameFromMi).trim()
: osp.namesStr, : osp.namesStr,
estimatedDeliveryCountPerMonth: mi.estimatedDeliveryCountPerMonth,
personnelCostRate: mi.personnelCostRate,
renovationEquipmentCost: mi.renovationEquipmentCost,
estimatedGrossMargin: mi.estimatedGrossMargin,
hasGuarantee: mi.hasGuarantee,
monthlySettlementDate: mi.monthlySettlementDate,
otherCostPerMonth: mi.otherCostPerMonth,
// 兜底条件列表
guaranteeList: Array.isArray(mi.guaranteeList) ? mi.guaranteeList : [],
}; };
} }
......
This diff could not be displayed because it is too large.
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!