Commit e9fe013b by 李伟康

Merge branch 'feature/584/lwk' into 'SAAS+V5.8.4'

Feature/584/lwk

See merge request !855
2 parents 7e88c865 02861363
Showing 21 changed files with 997 additions and 722 deletions
...@@ -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,
});
}
/** /**
* 编辑门店上架审批单 * 编辑门店上架审批单
......
...@@ -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 {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!