Commit b4e75df9 by cwq0219

编辑

1 parent 203f866b
......@@ -34,6 +34,17 @@ const getCarBrandListApi = params => {
})
}
const getCarChildListApi = params => {
// params.method = 'dj.api.car.series.list'
params.method = 'scrm.api.carlife.common.getOnlyCarBrandList'
return http_brand({
url: 'rop-scrm-carlife/router',
method: 'GET',
data: params,
sign: true
})
}
const getCarSeriesListApi = params => {
params.method = 'scrm.api.carlife.common.getCarSeriesList'
return http_brand({
......@@ -118,4 +129,4 @@ const createCodeApi = params => {
})
}
export default { getListApi, getExportApi, getCarBrandListApi, getCarTypeListApi, getCarSeriesListApi, getHotlineApi, updateHotlineApi, getPackageListApi, getEquityApi, updateEquityApi, createCodeApi }
export default { getListApi, getExportApi, getCarBrandListApi, getCarChildListApi, getCarTypeListApi, getCarSeriesListApi, getHotlineApi, updateHotlineApi, getPackageListApi, getEquityApi, updateEquityApi, createCodeApi }
......@@ -13,7 +13,7 @@
</span>
<slot v-if="item.addHtml" :name="item.addHtml" :scope="item"></slot>
<div v-else-if="item.type === 'input'">
<el-input :placeholder="item.placeholder || '请输入' + item.label" v-model.trim="formObj[item.name]" :disabled="item.isDisabled" :maxlength="item.maxlength" :clearable="item.isClear || false" :type="item.inputType || 'text'" :rows="item.rows || 2" :style="{ width: item.width || defaultWidth }" :show-word-limit="item.showLimit || false" :show-password="item.showPass || false" @keydown.native="e => handleInputDown(e, item)">
<el-input :placeholder="item.placeholder || '请输入' + item.label" v-model.trim="formObj[item.name]" :disabled="item.isDisabled" :maxlength="item.maxlength" :clearable="item.isClear || false" :type="item.inputType || 'text'" :rows="item.rows || 2" :style="{ width: item.width || defaultWidth }" :show-word-limit="item.showLimit || false" :show-password="item.showPass || false" @keydown.native="e => handleInputDown(e, item)" @blur="e => handleInputBlur(e, item)">
<span v-if="item.prepend" slot="prepend">{{ item.prepend }}</span>
<span v-if="item.append" slot="append">{{ item.append }}</span>
</el-input>
......@@ -174,6 +174,9 @@ export default {
item.keyFn()
}
},
handleInputBlur(e, targetItem) {
targetItem.inputBlur && targetItem.inputBlur()
},
handleDateChange(value, targetItem) {
targetItem.handleDateChange && targetItem.handleDateChange(value, targetItem)
},
......
......@@ -5,14 +5,23 @@
<p class="edit-title">车辆信息</p>
<glsx-combi-form class="edit-form-container" ref="editFormRefCar" labelWidth="140px" formRef="editChildRefCar" :formObj.sync="editForm.vehicle" :formData="editFormDataCar" :formRules="editRuleCar">
<template slot="vehicleBrandId">
<el-select v-model="editForm.vehicle.vehicleBrandId" placeholder="请选择品牌" filterable @change="getCarSeriesList(editForm.vehicle.vehicleBrandId)" style="width:220px; margin-right: 20px;">
<el-select v-model="editForm.vehicle.vehicleBrandId" placeholder="请选择品牌" filterable @change="handleChangeBrand(editForm.vehicle.vehicleBrandId)" style="width:220px; margin-right: 20px;">
<el-option v-for="item in baseData.carBrandOptions" :key="item.id" :value="item.id" :label="item.name" />
</el-select>
</template>
<template slot="vehicleSubBrandId">
<el-select v-model="editForm.vehicle.vehicleSubBrandId" placeholder="请选择子品牌" filterable @change="getCarSeriesList()" style="width:220px; margin-right: 20px;">
<el-option v-for="item in baseData.carChildOptions" :key="item.id" :value="item.id" :label="item.name" />
</el-select>
</template>
<template slot="vehicleSeriesId">
<el-select v-model="editForm.vehicle.vehicleSeriesId" placeholder="请选择车系" @change="getCarTypeList(editForm.vehicle.vehicleSeriesId)" style="width:220px; margin-right: 20px;">
<el-option v-for="item in baseData.carSeriesOptions" :key="item.carChildsBrandId" :value="item.carChildsBrandId" :label="item.carChildsBrandName" />
<el-option v-for="item in baseData.carSeriesOptions" :key="item.id" :value="item.id" :label="item.name" />
</el-select>
</template>
<template slot="vehicleShapeId">
<el-select v-model="editForm.vehicle.vehicleShapeId" placeholder="请选择车型" style="width:220px;">
<el-option v-for="item in baseData.carTypeOptions" :key="item.carSeriesId" :value="item.carSeriesId" :label="item.carSeriesName" />
<el-option v-for="item in baseData.carTypeOptions" :key="item.id" :value="item.id" :label="item.name" />
</el-select>
</template>
</glsx-combi-form>
......@@ -23,7 +32,8 @@
</div>
<div class="container">
<p class="edit-title">选择产品</p>
<glsx-combi-form class="edit-form-container" ref="editFormRefPro" labelWidth="140px" formRef="editChildRefPro" :formObj="editForm" :formData="editFormDataPro" :formRules="editRulePro">
<!-- <glsx-combi-form class="edit-form-container" ref="editFormRefPro" labelWidth="140px" formRef="editChildRefPro" :formObj="editForm" :formData="editFormDataPro" :formRules="editRulePro"> -->
<glsx-combi-form class="edit-form-container" labelWidth="140px" :formObj="editForm" :formData="editFormDataPro">
<template slot="packageCode" slot-scope="scope">
<el-radio-group class="package-code-box" v-model="editForm[scope.scope.name]" :disabled="scope.scope.isDisabled" @change="scope.scope.handleRadioChange">
<el-radio class="package-code" v-for="subItem in scope.scope.optionList" :key="subItem[scope.scope.optionId]" :label="subItem[scope.scope.optionId]">
......@@ -31,15 +41,15 @@
<div class="radio-add-block">
<p>{{ subItem.serviceItems }}</p>
<div v-if="editForm.packageCode == subItem[scope.scope.optionId]">
<glsx-combi-form class="edit-form-container" ref="editFormRefPro" labelWidth="140px" :formRef="editChildRefPro" :isBlock="true" :formObj="editFormPro" :formData="subItem.editFormData" :formRules="editRulePro">
<glsx-combi-form class="edit-form-container" ref="editFormRefPro" labelWidth="140px" formRef="editChildRefPro" :isBlock="true" :formObj="editFormPro" :formData="subItem.editFormData" :formRules="editRulePro">
<template slot="table" slot-scope="scope">
<table class="table-style">
<tbody>
<tr>
<td v-for="(m, n) in scope.scope.attributeList" :key="n" :style="{ width: (100 / scope.scope.attributeList.length) + '%'}">{{ m.attributeDesc }}</td>
<td v-for="(m, n) in scope.scope.attributeList" :key="n" :style="{ width: 100 / scope.scope.attributeList.length + '%' }">{{ m.attributeDesc }}</td>
</tr>
<tr v-for="(m, n) in scope.scope.tableList" :key="n">
<td v-for="(i, j) in m" :key="j" :style="{ width: (100 / scope.scope.attributeList.length) + '%'}">
<td v-for="(i, j) in m" :key="j" :style="{ width: 100 / scope.scope.attributeList.length + '%' }">
<el-input :disabled="isDisabled" :class="{ 'border-red': !editFormPro[i.name] }" placeholder="请输入" v-model="editFormPro[i.name]">
<el-popover v-show="!editFormPro[i.name]" slot="suffix" placement="top" title="" width="90" trigger="hover" :content="i.attributeDesc + '是必填项'">
<i class="el-icon-warning color-red" slot="reference"></i>
......@@ -98,6 +108,7 @@ export default {
actualSalesPrice: '',
vehicle: {
vehicleBrandId: '',
vehicleSubBrandId: '',
vehicleSeriesId: '',
vehicleShapeId: '',
licensing: '',
......@@ -108,9 +119,14 @@ export default {
editRuleCar: {
licensing: [{ required: true, message: '请选择是否上牌', trigger: 'change' }],
licensePlate: [{ required: true, message: '请输入车牌号码', trigger: 'change' }],
vin: [{ required: true, message: '请输入车架号', trigger: 'change' }],
engineNo: [{ required: true, message: '请输入发动机号', trigger: 'change' }],
invoicePrice: [{ required: true, message: '请输入发票价格', trigger: 'change' }],
vehicleColor: [{ required: true, message: '请输入车身颜色', trigger: 'change' }],
vehicleBrandId: [{ required: true, message: '请选择车品牌', trigger: 'change' }],
vehicleSubBrandId: [{ required: true, message: '请选择车子品牌', trigger: 'change' }],
vehicleSeriesId: [{ required: true, message: '请选择车系', trigger: 'change' }],
// vehicleShapeId: [{ required: true, message: '请选择车型', trigger: 'change' }],
billingDate: [{ required: true, message: '请选择开票日期', trigger: 'change' }],
seatesNum: [{ required: true, message: '请选择座位数', trigger: 'change' }]
},
......@@ -132,6 +148,12 @@ export default {
maxlength: 32
},
{
label: '车架号',
name: 'vin',
type: 'input',
maxlength: 19
},
{
label: '发动机号',
name: 'engineNo',
type: 'input',
......@@ -142,7 +164,10 @@ export default {
name: 'invoicePrice',
type: 'input',
append: '元',
maxlength: 11
maxlength: 11,
inputBlur: () => {
this.packageAttr()
}
},
{
label: '车身颜色',
......@@ -153,10 +178,22 @@ export default {
{
label: '品牌车型',
name: 'vehicleBrandId',
addHtml: 'vehicleBrandId',
style: {
display: 'block'
}
addHtml: 'vehicleBrandId'
},
{
label: '',
name: 'vehicleSubBrandId',
addHtml: 'vehicleSubBrandId'
},
{
label: '',
name: 'vehicleSeriesId',
addHtml: 'vehicleSeriesId'
},
{
label: '',
name: 'vehicleShapeId',
addHtml: 'vehicleShapeId'
},
{
label: '开票日期',
......@@ -259,7 +296,8 @@ export default {
suggestedSellingPrice: [{ required: true, message: '请输入建议销售价', trigger: 'change' }],
actualSalesPrice: [
{ required: true, message: '请输入实际销售价', trigger: 'change' },
{ validator: (rule, value, callback) => {
{
validator: (rule, value, callback) => {
return +this.editForm.suggestedSellingPrice > +value ? callback(new Error('输入价格有误')) : callback()
},
trigger: 'change'
......@@ -300,77 +338,83 @@ export default {
type: 'datePicker',
dateType: 'date',
valueFormat: 'yyyy-MM-dd',
pickerOptions: 'beforeRangePickerOptions'
pickerOptions: 'afterRangePickerOptions'
}
],
// 公共数据
baseData: {
licensingList: [
{
confId: '0',
confId: 0,
confName: '否'
},
{
confId: '1',
confId: 1,
confName: '是'
}
],
seatesNumList: [
{
confId: '2',
confId: 1,
confName: '1'
},
{
confId: 2,
confName: '2'
},
{
confId: '3',
confId: 3,
confName: '3'
},
{
confId: '4',
confId: 4,
confName: '4'
},
{
confId: '5',
confId: 5,
confName: '5'
},
{
confId: '6',
confId: 6,
confName: '6'
},
{
confId: '7',
confId: 7,
confName: '7'
}
],
customerTypeList: [
{
confId: '1',
confId: 1,
confName: '个人'
},
{
confId: '2',
confId: 2,
confName: '企业'
}
],
cardTypeList: [
{
confId: '1',
confId: 1,
confName: '身份证'
},
{
confId: '2',
confId: 2,
confName: '统一社会信息代码'
}
],
servicePeriodList: [
{
confId: '1',
confId: 1,
confName: '1年'
}
],
carBrandOptions: [],
carChildOptions: [],
carSeriesOptions: [],
carTypeOptions: []
}
},
allCarChildList: []
}
},
......@@ -390,19 +434,29 @@ export default {
// 获取套餐列表
this.getPackageList()
this.getAllVehicleBrand()
this.routeInfo.addOrEdit != 1 ? this.getInfo() : ''
this.getCarChildList()
},
methods: {
getInfo() {
this.$apis.beforeSale.getEquityApi({ contractNo: this.routeInfo.contractNo }).then(res => {
console.log(res)
// this.editForm.zoneName = res.zoneName
// this.editForm.zoneImg = res.zoneImg
// this.editForm.merchantList = res.merchantRefList
// this.editForm.merchantList.forEach(item => {
// item.merchantNo = item.merchantId
// })
this.editForm = {
...res
}
// 格式化价格
if (this.editForm.vehicle.invoicePrice) {
this.editForm.vehicle.invoicePrice = (this.editForm.vehicle.invoicePrice / 100).toFixed(2)
}
if (this.editForm.suggestedSellingPrice) {
this.editForm.suggestedSellingPrice = (this.editForm.suggestedSellingPrice / 100).toFixed(2)
}
if (this.editForm.actualSalesPrice) {
this.editForm.actualSalesPrice = (this.editForm.actualSalesPrice / 100).toFixed(2)
}
this.editForm.vehicle.billingDate = this.editForm.vehicle.billingDate ? new Date(this.editForm.vehicle.billingDate) : ''
this.editForm.effectiveDate = this.editForm.effectiveDate ? new Date(this.editForm.effectiveDate) : ''
this.editForm.packageCode && this.packageAttr(true)
})
},
getPackageList() {
......@@ -412,11 +466,12 @@ export default {
this.autoGenerate()
})
},
packageAttr() {
packageAttr(recovery = false) {
var targetItem = this.packageList.find(item => item.packageCode == this.editForm.packageCode)
this.editForm.suggestedSellingPrice = ''
if (this.editForm.vehicle.invoicePrice) {
var invoicePrice = (this.editForm.vehicle.invoicePrice * 100).toFixed(2)
console.log(targetItem)
targetItem.servicePackagePrices.forEach(item => {
if (invoicePrice > item.carButtomPrice && invoicePrice < item.carHighestPrice) {
this.editForm.suggestedSellingPrice = (item.retailPrice / 100).toFixed(2)
......@@ -440,6 +495,19 @@ export default {
}
}
})
if (recovery) {
this.recoveryEditFormPro()
}
},
recoveryEditFormPro() {
this.editForm.attributeList.length && this.editForm.attributeList.forEach((item, idx) => {
let hashObj = {}
this.editForm.attributeList.map(i => i.attributeName).forEach((i, subIdx) => {
Object.keys(hashObj).includes(i) ? (hashObj[i] = hashObj[i] + 1) : (hashObj[i] = 1)
})
this.$set(this.editFormPro, hashObj[item.attributeName] != 1 ? (item.attributeName + item.sort) : item.attributeName, item.attributeValue)
})
console.log(this.editFormPro)
},
autoGenerate() {
var tempList = []
......@@ -454,8 +522,8 @@ export default {
})
if (k.attributeList[0].attributeType == 'datePicker') {
tempList[idx].dateType = 'date'
tempList[idx].valueFormat = 'yyyy-MM-dd'
// tempList[idx].pickerOptions = 'beforeRangePickerOptions'
tempList[idx].valueFormat = 'yyyy-MM-dd',
tempList[idx].pickerOptions = 'beforeRangePickerOptions'
}
} else {
// console.log(k)
......@@ -494,6 +562,7 @@ export default {
})
})
console.log(this.editFormDataPro)
this.routeInfo.addOrEdit != 1 ? this.getInfo() : ''
},
getOptionsList(formName, hasAll = true, refreshSigle) {
if (refreshSigle) {
......@@ -521,16 +590,35 @@ export default {
}
},
// 获取品牌车型
getAllVehicleBrand(fn = () => { }) {
getAllVehicleBrand(fn = () => {}) {
const params = {}
this.$apis.beforeSale.getCarBrandListApi(params).then(res => {
this.baseData.carBrandOptions = res || []
})
},
handleChangeBrand(brandId) {
this.editForm.vehicle.vehicleSubBrandId = ''
this.editForm.vehicle.vehicleSeriesId = ''
this.editForm.vehicle.vehicleShapeId = ''
this.baseData.carChildOptions = this.allCarChildList.find(item => item.id == brandId).childs
this.baseData.carSeriesOptions = []
this.baseData.carTypeOptions = []
},
// 获取子品牌
getCarChildList() {
this.$apis.beforeSale.getCarChildListApi({}).then(res => {
this.allCarChildList = res || []
})
},
// 获取车系
getCarSeriesList(brandId) {
getCarSeriesList() {
this.editForm.vehicle.vehicleSeriesId = ''
this.editForm.vehicle.vehicleShapeId = ''
this.baseData.carSeriesOptions = []
this.baseData.carTypeOptions = []
const params = {
brandId: brandId
brandId: this.editForm.vehicle.vehicleBrandId,
childBrandId: this.editForm.vehicle.vehicleSubBrandId
}
this.$apis.beforeSale.getCarSeriesListApi(params).then(res => {
this.baseData.carSeriesOptions = res || []
......@@ -538,6 +626,8 @@ export default {
},
// 获取车型
getCarTypeList(value) {
this.editForm.vehicle.vehicleShapeId = ''
this.baseData.carTypeOptions = []
const params = {
carSeriesId: value
}
......@@ -545,6 +635,10 @@ export default {
this.baseData.carTypeOptions = res || []
})
},
// 跳转
whereToGo(id) {
document.getElementById(id).scrollIntoView()
},
getParams() {
var params = this.$common.utils.deepClone(this.editForm)
// 格式化价格
......@@ -615,31 +709,33 @@ export default {
handleConfirm() {
var list = ['Car', 'User', 'Pro', 'Other']
var flag = true
var errorObjList = []
for (var i = 0; i < list.length; i++) {
this.$refs['editFormRef' + list[i]].$refs['editChildRef' + list[i]].validate(valid => {
flag = valid
var pRef = list[i] == 'Pro' ? this.$refs['editFormRef' + list[i]][0] : this.$refs['editFormRef' + list[i]]
pRef.$refs['editChildRef' + list[i]].validate((valid, errorObj) => {
!valid && errorObjList.push(errorObj)
flag && (flag = valid)
})
}
if (!flag) {
this.whereToGo(Object.keys(errorObjList[0])[0])
return true
}
this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => {
if (valid) {
var params = this.$common.utils.deepClone(this.editForm)
if (this.routeInfo.addOrEdit == 2) {
params.contractNo = this.routeInfo.contractNo
}
// this.$apis.zoneList.insertZoneApi(params).then(res => {
// this.$message({
// message: res.code == '0' ? '操作成功' : '操作失败',
// type: res.code == '0' ? 'success' : 'error'
// })
// if (res.code == '0') {
// this.handleCancel()
// }
// })
}
})
var params = this.getParams()
if (this.routeInfo.addOrEdit == 2) {
params.contractNo = this.routeInfo.contractNo
}
params.operationType = 1
if (this.routeInfo.addOrEdit == 2) {
params.contractNo = this.routeInfo.contractNo
this.updateEquity(params)
} else {
this.$apis.beforeSale.createCodeApi({}).then(res => {
console.log(res)
params.contractNo = res
this.updateEquity(params)
})
}
},
handleCancel() {
this.$router.push({
......
......@@ -24,7 +24,7 @@
<el-button v-if="[0].includes(scope.scope.orderStatus)" type="text" @click="handleEdit(2, scope.scope)">编辑</el-button>
<el-button v-if="[2].includes(scope.scope.orderStatus)" type="text" @click="handleEdit(3, scope.scope)">修改</el-button>
<el-button v-if="[2].includes(scope.scope.orderStatus)" type="text" @click="handleDelete(scope.scope)">退保</el-button>
<el-button v-if="[4, 5].includes(scope.scope.orderStatus)" type="text" @click="handleDelete(scope.scope)">重新提单</el-button>
<el-button v-if="[3, 4, 5].includes(scope.scope.orderStatus)" type="text" @click="handleDelete(scope.scope)">重新提单</el-button>
</div>
</GLTable>
<!-- 表格区域 end -->
......@@ -106,7 +106,10 @@ export default {
tableColumns: [
{
label: '车主姓名',
prop: 'customerName'
prop: 'customerName',
formatter: cellValue => {
return cellValue.customerName || '-'
}
},
{
label: '合同号',
......@@ -117,7 +120,7 @@ export default {
prop: 'successDate',
width: '160px',
formatter: cellValue => {
return dayjs(cellValue.successDate).format('YYYY-MM-DD HH:mm:ss')
return cellValue.successDate ? dayjs(cellValue.successDate).format('YYYY-MM-DD HH:mm:ss') : '-'
}
},
{
......@@ -125,42 +128,60 @@ export default {
prop: 'expirationDate',
width: '160px',
formatter: cellValue => {
return dayjs(cellValue.expirationDate).format('YYYY-MM-DD HH:mm:ss')
return cellValue.expirationDate ? dayjs(cellValue.expirationDate).format('YYYY-MM-DD HH:mm:ss') : '-'
}
},
{
label: '店面名称',
prop: 'merchantName',
width: '160px',
line: 2
line: 2,
formatter: cellValue => {
return cellValue.merchantName || '-'
}
},
{
label: '车品牌',
prop: 'vehicleBrandName'
prop: 'vehicleBrandName',
formatter: cellValue => {
return cellValue.vehicleBrandName || '-'
}
},
{
label: '车系',
prop: 'vehicleSeriesName'
prop: 'vehicleSeriesName',
formatter: cellValue => {
return cellValue.vehicleSeriesName || '-'
}
},
{
label: '车架',
prop: 'vin'
prop: 'vin',
formatter: cellValue => {
return cellValue.vin || '-'
}
},
{
label: '电话',
prop: 'customerPhone',
width: '160px'
width: '160px',
formatter: cellValue => {
return cellValue.customerPhone || '-'
}
},
{
label: '产品名称',
prop: 'packageName'
prop: 'packageName',
formatter: cellValue => {
return cellValue.packageName || '-'
}
},
{
label: '实际销售价',
prop: 'actualSalesPrice',
width: '160px',
formatter: cellValue => {
return (cellValue.actualSalesPrice / 100).toFixed(2)
return cellValue.actualSalesPrice ? (cellValue.actualSalesPrice / 100).toFixed(2) : '-'
}
},
{
......@@ -172,7 +193,7 @@ export default {
prop: 'expirationDate',
width: '160px',
formatter: cellValue => {
return dayjs(cellValue.expirationDate).format('YYYY-MM-DD HH:mm:ss')
return cellValue.expirationDate ? dayjs(cellValue.expirationDate).format('YYYY-MM-DD HH:mm:ss') : '-'
}
},
{
......@@ -185,14 +206,23 @@ export default {
{
label: '大区',
prop: ''
// formatter: cellValue => {
// return cellValue.packageName || '-'
// }
},
{
label: '片区',
prop: ''
// formatter: cellValue => {
// return cellValue.packageName || '-'
// }
},
{
label: '操作人',
prop: ''
// formatter: cellValue => {
// return cellValue.packageName || '-'
// }
}
]
},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!