Commit fe6f38f4 by zhangquan

加改装件

1 parent 22eea678
...@@ -67,7 +67,8 @@ ...@@ -67,7 +67,8 @@
<p class="photo-top-tips">{{ item.topTips }}</p> <p class="photo-top-tips">{{ item.topTips }}</p>
<div v-if="!item.isDisabled" :style="{ width: item.width || defaultWidth }"> <div v-if="!item.isDisabled" :style="{ width: item.width || defaultWidth }">
<div v-if="Array.isArray(formObj[item.name]) ? formObj[item.name].length < item.maxPhotoNum : !formObj[item.name]" class="activity-img img-w-h"> <div v-if="Array.isArray(formObj[item.name]) ? formObj[item.name].length < item.maxPhotoNum : !formObj[item.name]" class="activity-img img-w-h">
<div class="add" :style="{ top: item.maxPhotoNum == 1 ? '50%' : '40%' }">+</div> <div class="add">+</div>
<div class="add-label">上传图片</div>
<span v-if="item.maxPhotoNum > 1" class="number">{{ formObj[item.name].length }} / {{ item.maxPhotoNum }}</span> <span v-if="item.maxPhotoNum > 1" class="number">{{ formObj[item.name].length }} / {{ item.maxPhotoNum }}</span>
<input v-if="item.uploadType == 'video'" type="file" style="opacity: 0;" :id="item.name + 'file'" ref="file" class="activity-img img-w-h" accept="video/mp4" @change="e => handleUploadChange(e, item)" /> <input v-if="item.uploadType == 'video'" type="file" style="opacity: 0;" :id="item.name + 'file'" ref="file" class="activity-img img-w-h" accept="video/mp4" @change="e => handleUploadChange(e, item)" />
<input v-else type="file" style="opacity: 0;" :id="item.name + 'file'" ref="file" class="activity-img img-w-h" accept="image/png, image/jpeg, image/gif, image/jpg" @change="e => handleUploadChange(e, item)" /> <input v-else type="file" style="opacity: 0;" :id="item.name + 'file'" ref="file" class="activity-img img-w-h" accept="image/png, image/jpeg, image/gif, image/jpg" @change="e => handleUploadChange(e, item)" />
...@@ -365,15 +366,18 @@ export default { ...@@ -365,15 +366,18 @@ export default {
color: #999999; color: #999999;
} }
.glsx-combi-form .img-w-h { .glsx-combi-form .img-w-h {
width: 80px; width: 104px;
height: 80px; height: 104px;
border-radius: 4px;
box-sizing: border-box;
} }
.glsx-combi-form .activity-img { .glsx-combi-form .activity-img {
position: relative; position: relative;
color: #999999; color: #999999;
background-color: #f7f7f7; background: #0000000a;
border: 1px dotted #d9d9d9; border: 1px dotted #00000026;
cursor: pointer; cursor: pointer;
border-radius: 4px;
} }
.glsx-combi-form .activity-Input { .glsx-combi-form .activity-Input {
...@@ -389,12 +393,21 @@ export default { ...@@ -389,12 +393,21 @@ export default {
.activity-img .add { .activity-img .add {
position: absolute; position: absolute;
top: 40%; top: 30%;
font-size: 40px; font-size: 30px;
left: 50%; left: 50%;
transform: translate3d(-50%, -50%, 0); transform: translate3d(-50%, -50%, 0);
} }
.add-label {
position: absolute;
top: 50%;
font-size: 14px;
left: 50%;
white-space: nowrap;
transform: translateX(-50%);
}
.activity-img .number { .activity-img .number {
position: absolute; position: absolute;
bottom: 0; bottom: 0;
...@@ -406,8 +419,9 @@ export default { ...@@ -406,8 +419,9 @@ export default {
display: none; display: none;
height: 100%; height: 100%;
position: absolute; position: absolute;
width: 80px; width: 104px;
height: 80px; height: 104px;
border-radius: 4px;
left: 0; left: 0;
top: 0; top: 0;
z-index: 2; z-index: 2;
......
...@@ -241,6 +241,13 @@ ...@@ -241,6 +241,13 @@
<template v-if="showUploadInfo"> <template v-if="showUploadInfo">
<uploadInfo :imgsQuery="attachmentListQuery" :disabled="disabled" :cardImg="cardImg" :uploadMessage="uploadMessage" @getAttachmentList="getAttachmentList"></uploadInfo> <uploadInfo :imgsQuery="attachmentListQuery" :disabled="disabled" :cardImg="cardImg" :uploadMessage="uploadMessage" @getAttachmentList="getAttachmentList"></uploadInfo>
</template> </template>
<!-- 改装件信息 -->
<div v-if="(refitFormObj.customFlag && equityRadio == '2') || (refitFormObj.autoFlag && equityRadio == '1') || refitFormObj.showFlag" class="container m-t-10">
<p class="edit-title">改装件信息</p>
<div style="padding: 20px 20px 1px;"><glsx-combi-form ref="refitRef" :isEdit="true" :isInline="false" defaultWidth="320px" :formObj="refitFormObj" :formData="refitFormData" :formRules="refitRules"></glsx-combi-form></div>
</div>
<!-- 其他信息 --> <!-- 其他信息 -->
<div class="container m-t-10" id="otherInfo"> <div class="container m-t-10" id="otherInfo">
<p class="edit-title">其他信息</p> <p class="edit-title">其他信息</p>
...@@ -260,7 +267,7 @@ ...@@ -260,7 +267,7 @@
<div class="mar-10"></div> <div class="mar-10"></div>
<el-button plain v-if="![3, 5].includes(routeInfo.addOrEdit)" @click="handleDraft">草稿</el-button> <el-button plain v-if="![3, 5].includes(routeInfo.addOrEdit)" @click="handleDraft">草稿</el-button>
<div class="mar-10"></div> <div class="mar-10"></div>
<el-button v-if="routeInfo.addOrEdit != '5'" type="primary" @click="handleConfirm">{{ routeInfo.addOrEdit != '3' ? '提单' : '确定' }}</el-button> <el-button v-if="routeInfo.addOrEdit != '5'" type="primary" @click="checkRefitInfo()">{{ routeInfo.addOrEdit != '3' ? '提单' : '确定' }}</el-button>
<div class="mar-10"></div> <div class="mar-10"></div>
</div> </div>
</div> </div>
...@@ -583,6 +590,96 @@ export default { ...@@ -583,6 +590,96 @@ export default {
tire: {}, tire: {},
glass: {} glass: {}
}, },
refitRules: {
addOnsFlag: [{ required: true, message: '请选择含加改装件', trigger: 'change' }],
invoice: [
{
required: true,
validator: (rule, value, callback) => {
if (this.refitFormObj.addOnsFlag && !value) {
callback(new Error('请上传发票或收据'))
} else {
callback()
}
},
trigger: 'change'
}
],
refitImg: [
{
required: true,
validator: (rule, value, callback) => {
if (this.refitFormObj.addOnsFlag && !value) {
callback(new Error('请上传加改装部位照片'))
} else {
callback()
}
},
trigger: 'change'
}
]
},
refitFormObj: {
autoFlag: 0,
customFlag: 0,
showFlag: false,
addOnsFlag: 1,
invoice: '',
refitImg: ''
},
refitFormData: [
{
label: '含加改装件',
name: 'addOnsFlag',
type: 'radio',
optionList: [
{
confId: 1,
confName: '是'
},
{
confId: 0,
confName: '否'
}
],
optionId: 'confId',
optionLabel: 'confName'
},
{
label: '发票或收据',
name: 'invoice',
type: 'upload',
isHide: false,
maxPhotoNum: 1,
handleUpload: (e, file, targetItem) => {
const imgFile = e.target.result
const base64 = file.name.split('.').pop() + '@' + imgFile.split(',')[1]
this.$apis.beforeSale.uploadImgApi({ file: base64, fileType: 'image' }).then(res => {
if (res) {
this.refitFormObj.invoice = res
this.$refs.refitRef.$refs.formRef.validateField('invoice')
}
})
}
},
{
label: '加改装部位照片',
name: 'refitImg',
isHide: false,
type: 'upload',
maxPhotoNum: 1,
handleUpload: (e, file, targetItem) => {
const imgFile = e.target.result
const base64 = file.name.split('.').pop() + '@' + imgFile.split(',')[1]
this.$apis.beforeSale.uploadImgApi({ file: base64, fileType: 'image' }).then(res => {
if (res) {
this.refitFormObj.refitImg = res
this.$refs.refitRef.$refs.formRef.validateField('refitImg')
}
})
}
}
],
// 其他信息 // 其他信息
editRuleOther: { editRuleOther: {
deviceNo: [{ required: false, message: '请输入设备号', trigger: 'change' }], deviceNo: [{ required: false, message: '请输入设备号', trigger: 'change' }],
...@@ -839,6 +936,16 @@ export default { ...@@ -839,6 +936,16 @@ export default {
}, },
watch: { watch: {
'refitFormObj.addOnsFlag': {
handler(newValue, oldValue) {
this.refitFormData.forEach(item => {
if (item.type == 'upload') {
item.isHide = !newValue
}
})
},
immediate: true
},
'editForm.vehicle.invoicePrice'(newValue, oldValue) { 'editForm.vehicle.invoicePrice'(newValue, oldValue) {
this.editForm.vehicle.invoicePrice = limitPrice(newValue, oldValue, 7, 2, 0, 2000000) this.editForm.vehicle.invoicePrice = limitPrice(newValue, oldValue, 7, 2, 0, 2000000)
if (this.currentVaildItem) { if (this.currentVaildItem) {
...@@ -1096,6 +1203,8 @@ export default { ...@@ -1096,6 +1203,8 @@ export default {
}) })
} }
} }
let hasRefitFlagList = this.allProdList.filter(item => this.packageCodeList.includes(item.packageCode))
this.refitFormObj.autoFlag = !!hasRefitFlagList?.find(item => item.qsFlag)
}, },
changeRaido(e, item) { changeRaido(e, item) {
if (e) { if (e) {
...@@ -1138,6 +1247,8 @@ export default { ...@@ -1138,6 +1247,8 @@ export default {
this.showUploadInfo = false this.showUploadInfo = false
} }
} }
let hasRefitFlagList = this.allProdList.filter(item => this.autoPackageCodeList.includes(item.packageCode))
this.refitFormObj.customFlag = !!hasRefitFlagList?.find(item => item.qsFlag)
}, },
// 获取店铺信息 // 获取店铺信息
getStoreInfo() { getStoreInfo() {
...@@ -1534,6 +1645,19 @@ export default { ...@@ -1534,6 +1645,19 @@ export default {
}, },
getInfo(productArrData) { getInfo(productArrData) {
this.$apis.beforeSale.getEquityApi({ contractNo: this.routeInfo.contractNo, repeatedFlag: this.routeInfo.addOrEdit == 4 ? 1 : 0 }).then(res => { this.$apis.beforeSale.getEquityApi({ contractNo: this.routeInfo.contractNo, repeatedFlag: this.routeInfo.addOrEdit == 4 ? 1 : 0 }).then(res => {
this.refitFormObj.addOnsFlag = res.addOnsFlag
this.refitFormObj.showFlag = res.addOnsFlag !== null
let attachmentList = []
res.attachmentList?.forEach(item => {
if (item.attachmentCode == 'QS0001') {
this.refitFormObj.invoice = item.attachmentFile
} else if (item.attachmentCode == 'QS0002') {
this.refitFormObj.refitImg = item.attachmentFile
} else {
attachmentList.push(item)
}
})
res.attachmentList = attachmentList
this.editForm = { this.editForm = {
...res ...res
} }
...@@ -2042,7 +2166,24 @@ export default { ...@@ -2042,7 +2166,24 @@ export default {
if (!params.sn) { if (!params.sn) {
delete params.sn delete params.sn
} }
const { customFlag, autoFlag, showFlag, addOnsFlag, invoice, refitImg } = this.refitFormObj
if ((customFlag && this.equityRadio == '2') || (autoFlag && this.equityRadio == '1') || showFlag) {
params.addOnsFlag = addOnsFlag
if (addOnsFlag) {
let invoiceItem = {
attachmentCode: 'QS0001',
attachmentFile: invoice,
attachmentType: 'IMG'
}
params.attachmentList.push(invoiceItem)
let refitImgItem = {
attachmentCode: 'QS0002',
attachmentFile: refitImg,
attachmentType: 'IMG'
}
params.attachmentList.push(refitImgItem)
}
}
params.dataSource = this.editForm.dataSource || '' params.dataSource = this.editForm.dataSource || ''
this.$apis.beforeSale.updateEquityApi(params).then(res => { this.$apis.beforeSale.updateEquityApi(params).then(res => {
this.submit = false this.submit = false
...@@ -2111,6 +2252,17 @@ export default { ...@@ -2111,6 +2252,17 @@ export default {
} }
return isEmpty return isEmpty
}, },
checkRefitInfo() {
if (this.$refs?.refitRef?.$refs?.formRef) {
this.$refs?.refitRef?.$refs.formRef.validate(valid => {
if (valid) {
this.handleConfirm()
}
})
} else {
this.handleConfirm()
}
},
handleConfirm() { handleConfirm() {
try { try {
this.vaildGlassParams() this.vaildGlassParams()
...@@ -2196,6 +2348,14 @@ export default { ...@@ -2196,6 +2348,14 @@ export default {
} }
}, },
handleReset() { handleReset() {
this.refitFormObj = {
autoFlag: 0,
customFlag: 0,
showFlag: false,
addOnsFlag: 1,
invoice: '',
refitImg: ''
}
this.editForm = { this.editForm = {
packageCode: '', packageCode: '',
suggestedSellingPrice: '', suggestedSellingPrice: '',
......
...@@ -1706,6 +1706,10 @@ export default { ...@@ -1706,6 +1706,10 @@ export default {
} }
&:last-child { &:last-child {
width: 330px; width: 330px;
.muti-imgs {
width: 80px;
height: 80px;
}
.img-btns, .img-btns,
img { img {
width: 64px; width: 64px;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!