Commit 6bedddb0 by Lin

feat: 门店毛利额模块CRUD接口联调

1 parent 47fba1ca
......@@ -323,45 +323,45 @@ export function updateOrderFieldSetting(data) {
data.method = "dj.api.smartcarlife.order.field.setting.update"
return request(data)
}
/** 门店毛利额 start */
// 门店毛利额-列表
export function listProfitPage(data) {
data.method = `/dj.api.script.merchant.profit.record.page`
data.method = `dj.api.script.merchant.profit.record.page`
return request(data)
}
// 门店毛利额-详情
export function getProfitDetail(data) {
data.method = `/dj.api.script.merchant.profit.record.detail`
data.method = `dj.api.script.merchant.profit.record.detail`
return request(data)
}
// 门店毛利额-删除
export function deleteProfit(data) {
data.method = `/dj.api.script.merchant.profit.record.delete`
data.method = `dj.api.script.merchant.profit.record.delete`
return request(data)
}
// 门店毛利额-修改
export function updateProfit(data) {
data.method = `/dj.api.script.merchant.profit.record.upd`
data.method = `dj.api.script.merchant.profit.record.upd`
return request(data)
}
// 门店毛利额-新增
export function insertProfit(data) {
data.method = `/dj.api.script.merchant.profit.record.add`
data.method = `dj.api.script.merchant.profit.record.add`
return request(data)
}
// 门店毛利额-导出
export function exportProfit(data) {
data.method = `/dj.api.script.merchant.profit.record.async.export`
data.method = `dj.api.script.merchant.profit.record.async.export`
return request(data)
}
// 门店毛利额-导入
export function importProfit(data) {
data.method = `/dj.api.script.merchant.profit.record.async.import`
data.method = `dj.api.script.merchant.profit.record.async.import`
return request(data)
}
\ No newline at end of file
......@@ -23,7 +23,7 @@
</div>
<div class="dialog-title1">
<div class="flex-1 flex">
<span class="title-text">事项时间:</span>
<span class="title-text">创建时间:</span>
<!-- <span class="title-text1 flex-1">{{ info.reason }}</span> -->
<span class="title-text1 flex-1">2025-10-11</span>
</div>
......
......@@ -77,7 +77,8 @@
}}
</div>
</div>
<template slot="auth-button" slot-scope="scope">
<!-- 已处理状态不展示操作 -->
<template v-if="scope.scope.auditStatus !== 1" slot="auth-button" slot-scope="scope">
<el-button
type="text"
@click="handleAudits(scope.scope)"
......
......@@ -14,9 +14,9 @@
<el-row>
<el-col :span="12">
<el-form-item label="4S门店:"
:prop="operationType =='add'?'merchantId':''">
:prop="operationType =='add'?'storeId':''">
<div v-if="operationType =='add'">
<el-select v-model="formData.merchantId"
<el-select v-model="formData.storeId"
placeholder="请选择4S门店"
remote
reserve-keyword
......@@ -34,7 +34,7 @@
</el-select>
</div>
<div v-else>
{{ formData.merchantName +'('+ formData.merchantId +')' }}
{{ formData.storeName }}
</div>
</el-form-item>
</el-col>
......@@ -61,33 +61,33 @@
<el-row>
<el-col :span="12">
<el-form-item label="所属月份:"
:prop="operationType =='add'?'dealMonth':''">
:prop="operationType =='add'?'monthYear':''">
<div v-if="operationType =='add'">
<el-date-picker v-model="formData.dealMonth"
<el-date-picker v-model="formData.monthYear"
type="month"
value-format="yyyy-MM"
format="yyyy-MM"
value-format="yyyyMM"
format="yyyyMM"
placeholder="选择月份"
:picker-options="pickerOption"
class="sortInput">
</el-date-picker>
</div>
<div v-else>
{{ formData.dealMonth }}
{{ formData.monthYear }}
</div>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="毛利额:"
:prop="operationType !='detail'?'dealRate':''">
:prop="operationType !='detail'?'profitAmount':''">
<div v-if="operationType !='detail'">
<el-input v-model="formData.dealRate"
<el-input v-model="formData.profitAmount"
@input="dealRate_handleInput"
placeholder="请输入毛利额"
class="sortInput" />
</div>
<div v-else>
{{ formData.dealRate }}
{{ formData.profitAmount }}
</div>
</el-form-item>
</el-col>
......@@ -96,7 +96,7 @@
<el-col :span="12">
<el-form-item label="录入时间:"
v-if="operationType!='add'">
{{ formData.createdDateShow }}
{{ formData.createdAt }}
</el-form-item>
</el-col>
</el-row>
......@@ -122,7 +122,7 @@ import { Util, deepClone } from '@/common/util'
import { limitPrice } from '@/common/format'
import { getList } from "@api/merchant"
import { outputValue_operTypeOpt } from "@/common/constants.js"
import { insertPersonalConfig, getById_personal, getCarBrand, getStaffDataApi } from '@api/shopConfig'
import { insertProfit, getProfitDetail, getStaffDataApi, updateProfit } from '@api/shopConfig'
import reportTrackFunMixin from '@/mixins/reportTrackFunMixin'
export default {
......@@ -169,18 +169,11 @@ export default {
},
userInfo: this.$store.state.d2admin.user.info,
formData: {
merchantId: '',
merchantName: '',
brand: [],
brandId: '',
brandName: '',
brandChildId: '',
brandChildName: '',
dealRate: '',
dealMonth: '',
storeId: '',
storeName: '',
profitAmount: '',
monthYear: '',
businessType: '',
staffUuid: '',
staffName: ''
},
oldVal: {
dealRate: ''
......@@ -190,11 +183,9 @@ export default {
width: '1080px'
},
formRules: {
merchantId: [{ required: true, message: '请选择4S门店', trigger: 'change' }],
brand: [{ required: true, message: '请选择品牌', trigger: 'change' }],
dealMonth: [{ required: true, message: '请选择成交月份', trigger: 'change' }],
dealRate: [{ required: true, message: '请输入成交率', trigger: 'blur' }],
staffUuid: [{ required: true, message: '请输入驻店员工', trigger: 'blur' }],
storeId: [{ required: true, message: '请选择4S门店', trigger: 'change' }],
monthYear: [{ required: true, message: '请选择所属月份', trigger: 'change' }],
profitAmount: [{ required: true, message: '请输入毛利额', trigger: 'blur' }],
businessType: [{ required: true, message: '请选择业务类型', trigger: 'change' }]
},
searchForm: {
......@@ -220,7 +211,7 @@ export default {
}
}, {
label: '操作人',
prop: 'operatorName'
prop: 'operator'
}]
},
baseData: {
......@@ -228,21 +219,20 @@ export default {
businessTypeList: [],
staffList: []
},
carBrands: [],
operTypeOpt: deepClone(outputValue_operTypeOpt),
currentPage: 1,
pageSize: 20,
defaultBusinessList: [{
confId: 0,
confValue: '轻改'
}, {
confId: 1,
confValue: '权益'
confValue: '延保'
}, {
confId: 2,
confValue: '延保'
confValue: '轻改'
}, {
confId: 3,
confValue: '权益'
}, {
confId: 4,
confValue: '二手车'
}]
}
......@@ -277,7 +267,7 @@ export default {
mounted() {
if (this.paramsObj) {
this.getInfo(this.paramsObj.id)
this.getInfo(this.paramsObj.recordId)
if (this.operationType == 'edit') {
this.dialogConfig.title = '修改毛利'
} else {
......@@ -292,9 +282,7 @@ export default {
methods: {
handleChangeBusiness(e) {
let sceneType = e == 0 ? 1 : 0 // 轻改对应精品升级场景值(1)权益延保对应会员权益升级场景值(0)
this.formData.staffUuid = ''
this.formData.staffName = ''
let sceneType = e == 0 ? 1 : 0
if (!this.formData.merchantId) return
this.getStaffList(sceneType, this.formData.merchantId)
},
......@@ -349,12 +337,12 @@ export default {
},
getInfo(id) {
getById_personal({
id: id
getProfitDetail({
recordId: id
}).then(res => {
if (res) res.businessTypeDesc = this.defaultBusinessList?.find(v => v.confId == res?.businessType)?.confValue
this.formData = deepClone(res)
this.tableData = deepClone(res.operateLogs)
this.tableData = deepClone(res.operationRecord)
this.formData.createdDateShow = this.formData.createdDate
? Util.dateFormate(this.formData.createdDate, 'YYYY-MM-DD HH:mm:ss')
: ""
......@@ -363,18 +351,7 @@ export default {
},
choose4S(merchantId) {
this.formData.brand = []
this.formData.brandId = ''
this.formData.brandName = ''
this.formData.brandChildId = ''
this.formData.brandChildName = ''
this.formData.staffUuid = '' // 清空员工
this.formData.staffName = ''
this.formData.businessType = '' // 清空业务类型
if (merchantId) {
this.getCarBrand(merchantId)
}
let selectObj = this.baseData.merchantList?.find(v => v.merchantId == merchantId)
this.baseData.businessTypeList = this.filterArray(this.defaultBusinessList, selectObj.sceneList)
},
......@@ -405,35 +382,17 @@ export default {
return result
},
getCarBrand(merchantId) {
getCarBrand({
merchantId: merchantId
}).then(res => {
this.carBrands = deepClone(res)
}).catch(() => {
})
},
chooseBrand(value) {
const checkedNode = this.$refs.cascader.getCheckedNodes()[0]
const brandNode = checkedNode.pathNodes[0]
const childNode = checkedNode.pathNodes[1]
this.formData.brandId = brandNode.value
this.formData.brandName = brandNode.label
this.formData.brandChildId = childNode.value
this.formData.brandChildName = childNode.label
},
dealRate_handleInput(newVal) {
this.formData.dealRate = limitPrice(
this.formData.profitAmount = limitPrice(
newVal,
this.oldVal.dealRate,
this.oldVal.profitAmount,
3,
2,
0,
100
)
this.oldVal.dealRate = this.formData.dealRate
this.oldVal.profitAmount = this.formData.profitAmount
},
handleAddConfirm() {
......@@ -443,16 +402,26 @@ export default {
}
this.$refs.infoForm.validate(valid => {
if (valid) {
var params = deepClone(this.formData)
params.merchantName = this.baseData.merchantList.find(item => item.merchantId == params.merchantId)?.merchantName || params?.merchantName
params.staffName = this.baseData.staffList?.find(item => item.staffUuid == params.staffUuid)?.staffName || params?.staffName
params.brandChildId = params.brandChildId || params?.carChildsBrandId // 编辑时使用详情接口返回的carChildsBrandId
params.brandChildName = params.brandChildName || params?.carChildsBrandName
delete params.createdDate
delete params.updatedDate
delete params.operateLogs
delete params.createdDateShow
insertPersonalConfig(params).then(res => {
let params
// 根据操作类型区分请求参数
if (this.operationType == 'edit') {
// 编辑模式:只传递 profitAmount 和 recordId
params = {
recordId: this.formData.recordId,
profitAmount: this.formData.profitAmount
}
} else {
// 新增模式:传递完整参数
params = deepClone(this.formData)
// params.merchantName = this.baseData.merchantList.find(item => item.merchantId == params.merchantId)?.merchantName || params?.merchantName
delete params.createdDate
delete params.updatedDate
delete params.operateLogs
delete params.createdDateShow
}
// 根据操作类型判断调用新增还是修改接口
const apiMethod = this.operationType == 'edit' ? updateProfit : insertProfit
apiMethod(params).then(res => {
this.notice.okTips('操作成功')
this.dialogShow = true
})
......
......@@ -10,9 +10,7 @@
:form-data="showFormData"
label-width="120px">
<div slot="4sHtml">
<el-select v-model="searchForm.merchantIds"
multiple
collapse-tags
<el-select v-model="searchForm.storeId"
remote
reserve-keyword
placeholder="请选择4S店"
......@@ -34,14 +32,10 @@
value-format="yyyy-MM"
format="yyyy-MM"
placeholder="选择月"
:picker-options="monthPickerOptions"
style="width: 100%;">
</el-date-picker>
</div>
<!-- <div slot="dealRateHtml">
<input-range start-placeholder="最小成交率"
end-placeholder="最大成交率"
:display-value="searchForm.dealRate"></input-range>
</div> -->
</d2-search>
<div class="up-btns">
<el-button :id="tableParams.btnId"
......@@ -142,7 +136,7 @@
import { Util, deepClone } from "@/common/util"
import inputRange from './components/inputRange'
import editDialog from "./components/editDialog"
import { listWithPage_personal, personalConfigImport, deleteById_personal } from '@api/shopConfig'
import { listProfitPage, personalConfigImport, deleteProfit } from '@api/shopConfig'
import { getList } from "@api/merchant"
import reportTrackFunMixin from '@/mixins/reportTrackFunMixin'
export default {
......@@ -169,7 +163,7 @@
data() {
return {
searchForm: {
merchantIds: [],
storeId: [],
brandChildIds: [],
brandId: "",
dealMonth: "",
......@@ -180,7 +174,7 @@
searchFormSearch: {},
showFormData: [
{
label: "4s门店",
label: "4S门店",
name: "merchantIds",
addHtml: "4sHtml"
},
......@@ -207,7 +201,7 @@
pickerOptions: 'rangePickerOptions'
}
],
getListApi: listWithPage_personal,
getListApi: listProfitPage,
// 表格参数
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
......@@ -216,10 +210,7 @@
tableColumns: [
{
label: "4S门店",
prop: "merchantId",
formatter: (cellValue) => {
return cellValue.merchantName + "(" + cellValue.merchantId + ")"
}
prop: "storeName"
},
{
label: "业务类型",
......@@ -228,23 +219,23 @@
},
{
label: "所属月份",
prop: "dealMonth",
prop: "monthYear",
width: "150"
},
{
label: "毛利额",
prop: "dealRate",
prop: "profitAmount",
width: "200",
formatter: (cellValue) => {
return (cellValue.dealRate || cellValue.dealRate == 0) ? cellValue.dealRate : "-"
return (cellValue.profitAmount || cellValue.profitAmount == 0) ? cellValue.profitAmount : "-"
}
},
{
label: "导入时间",
prop: "createdDate",
prop: "createdAt",
width: "180",
formatter: (cellValue) => {
return Util.dateFormate(cellValue.createdDate, "YYYY-MM-DD HH:mm:ss")
return Util.dateFormate(cellValue.createdAt, "YYYY-MM-DD HH:mm:ss")
}
}
]
......@@ -266,16 +257,16 @@
confValue: '二手车'
}],
businessOptShowClass: {
0: "type-yellow",
1: "type-blue",
2: "type-green",
3: "type-purple"
1: "type-green",
2: "type-yellow",
3: "type-purple",
4: "type-blue"
},
businessNameShow: {
0: "轻改",
1: "权益",
2: "延保",
3: "二手车"
1: "延保",
2: "轻改",
3: "权益",
4: "二手车"
},
},
fileRules: {
......@@ -289,7 +280,19 @@
fileForm: {},
editVisible: false,
track_event_code: 'shopConfig_personalConversion_list',
track_businessParam_key: 'searchForm'
track_businessParam_key: 'searchForm',
// 月份选择器配置:仅允许选择当前月份及之前的月份
monthPickerOptions: {
disabledDate(time) {
const now = new Date()
const currentYear = now.getFullYear()
const currentMonth = now.getMonth()
const timeYear = time.getFullYear()
const timeMonth = time.getMonth()
// 禁用未来的月份
return timeYear > currentYear || (timeYear === currentYear && timeMonth > currentMonth)
}
}
}
},
......@@ -332,11 +335,11 @@
return new Promise((resolve) => {
this.searchFormSearch = deepClone(this.searchForm)
if (this.searchFormSearch.createTime) {
this.searchFormSearch.createdStartDate = Util.dateFormate(this.searchFormSearch.createTime[0], 'YYYY-MM-DD HH:mm:ss')
this.searchFormSearch.createdEndDate = Util.dateFormate(this.searchFormSearch.createTime[1], 'YYYY-MM-DD') + ' 23:59:59'
this.searchFormSearch.startDate = Util.dateFormate(this.searchFormSearch.createTime[0], 'YYYY-MM-DD HH:mm:ss')
this.searchFormSearch.endDate = Util.dateFormate(this.searchFormSearch.createTime[1], 'YYYY-MM-DD') + ' 23:59:59'
} else {
delete this.searchFormSearch.createdStartDate
delete this.searchFormSearch.createdEndDate
delete this.searchFormSearch.startDate
delete this.searchFormSearch.endDate
}
if (this.searchFormSearch.dealRate && this.searchFormSearch.dealRate.length > 0) {
this.searchFormSearch.dealRateStart = this.searchFormSearch.dealRate[0]
......@@ -401,7 +404,7 @@
},
handleReset() {
this.searchForm = {
merchantIds: [],
storeId: [],
brandChildIds: [],
brandId: "",
dealMonth: "",
......@@ -561,7 +564,7 @@
type: 'warning',
closeOnClickModal: false
}).then(() => {
deleteById_personal({ id: row.id }).then(res => {
deleteProfit({ recordId : row.recordId }).then(res => {
this.notice.okTips()
this.$refs.personalTable.refreshTable()
})
......@@ -608,18 +611,23 @@
}
.type-yellow {
@include typeBase();
background: #ff8d1a1a;
color: #ff8d1a;
background: #FF8D1A1A;
color: #FF8D1AFF;
}
.type-blue {
@include typeBase();
background: #5850ff1a;
color: #5850ff;
background: #2A58AD1A;
color: #2A58ADFF;
}
.type-green {
@include typeBase();
background: #43cf7c1a;
color: #43cf7c;
background: #43CF7C1A;
color: #43CF7CFF;
}
.type-purple {
@include typeBase();
background: #5850FF1A;
color: #5850FFFF;
}
.import-template {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!