Commit c133fd93 by cen

fix: 补充协议

1 parent 66a0a202
......@@ -127,5 +127,11 @@ module.exports = {
return gscPost(`/evalOrder/salesAgreementPreview`, {
...data
})
},
/** 线上合同预览 */
viewOnlineContract(data) {
return gscPost(`/evalOrder/viewOnlineContract`, {
...data
})
}
}
......@@ -68,6 +68,11 @@ uni.signHttpConfig = {
},
error: (error, config) => {
console.log('error事件触发', error, config)
uni.hideLoading()
uni.showToast({
title: error.msg || '请求失败',
icon: 'none'
})
return Promise.reject(error)
},
logout: config => {
......
......@@ -145,42 +145,42 @@ export default {
isExistSamePlate: false,
formData: {
evalOrderBasicReqDTO: {
sellerUserId: 'S10001',
sellerName: '李四',
sellerMerchantId: 3001,
sellerMerchantName: '园区店002'
sellerUserId: '',
sellerName: '',
sellerMerchantId: '',
sellerMerchantName: ''
},
carBaseReqDTO: {
carBrandId: 101,
carBrand: '大众',
carChildsBrandId: 201,
carChildsBrandName: '上汽大众',
carSeriesId: 301,
carSeriesName: '帕萨特',
carTypeId: 401,
carTypeName: '帕萨特2020款 330TSI',
carBrandId: '',
carBrand: '',
carChildsBrandId: '',
carChildsBrandName: '',
carSeriesId: '',
carSeriesName: '',
carTypeId: '',
carTypeName: '',
vin: '',
licensePlate: '苏21920012',
engineNumber: 'ENG20250922',
registrationDate: '2020-05-01',
registrationProvinceId: 32,
registrationProvinceName: '江苏省',
registrationCityId: 3201,
registrationCityName: '南京市',
carProvinceId: 32,
carProvinceName: '江苏省',
carCityId: 3201,
carCityName: '南京市',
mileage: 35000,
licensePlate: '',
engineNumber: '',
registrationDate: '',
registrationProvinceId: '',
registrationProvinceName: '',
registrationCityId: '',
registrationCityName: '',
carProvinceId: '',
carProvinceName: '',
carCityId: '',
carCityName: '',
mileage: 0,
usageType: 1,
ownerType: 1,
sunroof: 2,
vehicleCategory: 1,
emissionStandard: 6,
interiorColor: '黑色',
exteriorColor: '黑色',
interiorColor: '',
exteriorColor: '',
productionDate: '',
guidePrice: 230000,
guidePrice: 0,
buyNewCar: 1,
hasAccident: 0,
overallRating: '1',
......@@ -194,7 +194,7 @@ export default {
commercialInsuranceExpiry: '',
previousOwnerName: '',
previousOwnerAddress: '',
previousOwnerPhone: '13059281290'
previousOwnerPhone: ''
},
imageList: []
},
......@@ -310,25 +310,25 @@ export default {
targetNameKey: 'exteriorColorName',
sourceNameKey: 'staffName',
sourceKey: 'uuid',
targetKey: 'sellerUserId',
targetObj: 'evalOrderBasicReqDTO',
targetKey: 'exteriorColor',
targetObj: 'carBaseReqDTO',
type: 'pricek',
showText: 'shopMerchantName',
fieldPickerArray: [
{ name: '黑色', value: '1' },
{ name: '白色', value: '2' },
{ name: '银色', value: '2' },
{ name: '灰色', value: '2' },
{ name: '红色', value: '2' },
{ name: '蓝色', value: '2' },
{ name: '绿色', value: '2' },
{ name: '棕色', value: '2' },
{ name: '金色', value: '2' },
{ name: '橙色', value: '2' },
{ name: '紫色', value: '2' },
{ name: '黄色', value: '2' },
{ name: '香槟色', value: '2' },
{ name: '其他', value: '2' }
{ name: '银色', value: '3' },
{ name: '灰色', value: '4' },
{ name: '红色', value: '5' },
{ name: '蓝色', value: '6' },
{ name: '绿色', value: '7' },
{ name: '棕色', value: '8' },
{ name: '金色', value: '9' },
{ name: '橙色', value: '10' },
{ name: '紫色', value: '11' },
{ name: '黄色', value: '12' },
{ name: '香槟色', value: '13' },
{ name: '其他', value: '14' }
]
},
{
......@@ -339,25 +339,25 @@ export default {
targetNameKey: 'interiorColorName',
sourceNameKey: 'staffName',
sourceKey: 'uuid',
targetKey: 'sellerUserId',
targetObj: 'evalOrderBasicReqDTO',
targetKey: 'interiorColor',
targetObj: 'carBaseReqDTO',
type: 'pricek',
showText: 'shopMerchantName',
fieldPickerArray: [
{ name: '黑色', value: '1' },
{ name: '白色', value: '2' },
{ name: '银色', value: '2' },
{ name: '灰色', value: '2' },
{ name: '红色', value: '2' },
{ name: '蓝色', value: '2' },
{ name: '绿色', value: '2' },
{ name: '棕色', value: '2' },
{ name: '金色', value: '2' },
{ name: '橙色', value: '2' },
{ name: '紫色', value: '2' },
{ name: '黄色', value: '2' },
{ name: '香槟色', value: '2' },
{ name: '其他', value: '2' }
{ name: '银色', value: '3' },
{ name: '灰色', value: '4' },
{ name: '红色', value: '5' },
{ name: '蓝色', value: '6' },
{ name: '绿色', value: '7' },
{ name: '棕色', value: '8' },
{ name: '金色', value: '9' },
{ name: '橙色', value: '10' },
{ name: '紫色', value: '11' },
{ name: '黄色', value: '12' },
{ name: '香槟色', value: '13' },
{ name: '其他', value: '14' }
]
},
{ key: 'productionDate', label: '生产日期', required: true, fullWidth: false, targetNameKey: 'sellerName', sourceNameKey: 'staffName', sourceKey: 'uuid', targetKey: 'productionDate', targetObj: 'carBaseReqDTO', type: 'calendar' },
......@@ -501,13 +501,6 @@ export default {
this.getDetail(this.query.evalOrderNo)
}
this.userInfo = uni.$storage.get('userInfo') || {}
console.log('userInfo', this.userInfo)
Object.assign(this.formData.evalOrderBasicReqDTO, {
sellerMerchantName: userInfo.merchantName,
sellerName: userInfo.name,
sellerMerchantId: userInfo.merchantId,
sellerUserId: userInfo.uuid
})
uni.$track.add({ eventCode: 'app_add_evaluation_from' })
},
methods: {
......@@ -593,14 +586,22 @@ export default {
that.formFields.forEach(field => {
if (field.fieldPickerArray && field.targetObj && field.targetKey && field.targetNameKey) {
const targetValue = that.formData[field.targetObj][field.targetKey]
console.log('targetValue:', targetValue)
if (targetValue !== undefined && targetValue !== null && targetValue !== '') {
// 查找fieldPickerArray中对应的值
const selectedItem = field.fieldPickerArray.find(item => item.value === targetValue.toString())
console.log('selectedItem:', selectedItem)
let selectedItem
// 为颜色字段添加特殊处理,使用name匹配
if (field.key === 'exteriorColor' || field.key === 'interiorColor') {
// 查找name匹配的选项
selectedItem = field.fieldPickerArray.find(item => item.name === targetValue)
} else {
// 其他字段继续使用value匹配
selectedItem = field.fieldPickerArray.find(item => item.value === targetValue.toString())
}
if (selectedItem) {
// 设置显示名称
that.$set(that.formData[field.targetObj], field.targetNameKey, selectedItem.name)
// 同时确保值也正确设置,以便表单提交时使用正确的值
that.$set(that.formData[field.targetObj], field.targetKey, selectedItem.value)
}
}
}
......@@ -634,7 +635,7 @@ export default {
// 车架号验证 - 长度17且只能包含数字和大写字母
const vin = this.formData.carBaseReqDTO.vin
const vinRegex = /^[A-Z0-9]{17}$/
const vinRegex = /^[A-Z0-9]+$/
if (!vinRegex.test(vin)) {
uni.showToast({
......@@ -782,7 +783,7 @@ export default {
},
pickerChange(index, field) {
console.log('pickerChange', index, field)
this.$set(this.formData[field.targetObj], field.targetKey, field.fieldPickerArray[index].value)
this.$set(this.formData[field.targetObj], field.targetKey, field.key == 'exteriorColor' || field.key == 'interiorColor' ? field.fieldPickerArray[index].name : field.fieldPickerArray[index].value)
this.$set(this.formData[field.targetObj], field.targetNameKey, field.fieldPickerArray[index].name)
console.log('pickerChange', this.formData)
},
......@@ -1039,27 +1040,31 @@ export default {
if (this.query.type === 'add') {
const res = await uni.$api.evaluationApi.evalOrderCreate(this.formData)
console.log('res:', res)
if (res) {
if (res.data) {
uni.hideLoading()
uni.showToast({
title: '新增成功',
icon: 'none'
})
setTimeout(() => {
this.backPage()
uni.navigateBack({
delta: 1
})
}, 300)
}
} else if (this.query.type === 'edit') {
const res = await uni.$api.evaluationApi.evalOrderUpdate(this.formData)
console.log('res:', res)
if (res) {
if (res.data) {
uni.hideLoading()
uni.showToast({
title: '编辑成功',
icon: 'none'
})
setTimeout(() => {
this.backPage()
uni.navigateBack({
delta: 1
})
}, 300)
}
}
......@@ -1164,6 +1169,9 @@ export default {
// 否则直接赋值到formData
setValue(this.formData, key, chooseContent[key] || chooseContent)
}
console.log(this.userInfo)
this.$set(this.formData.evalOrderBasicReqDTO, 'sellerMerchantId', this.userInfo.shopMerchantId || '')
this.$set(this.formData.evalOrderBasicReqDTO, 'sellerMerchantName', this.userInfo.shopMerchantName || '')
console.log('formData', this.formData)
......
......@@ -11,7 +11,7 @@
<view v-if="subStatus == 2 || subStatus == 3" class="common-btn gray-btn ml-24" @click="handleClick('paying')">支付中</view>
<view v-if="status == 40 && !subStatus && paymentType == 1" class="common-btn blue-btn ml-24" @click="handleClick('payFull')">支付尾款</view>
<view v-if="status == 50 && !subStatus" class="common-btn blue-btn ml-24" @click="handleClick('confirmDelivery')">确认交车</view>
<view v-if="status == 1" class="common-btn blue-btn ml-24" @click="handleClick('reSubmit')">重新提交</view>
<view v-if="status == '-1'" class="common-btn blue-btn ml-24" @click="handleClick('reSubmit')">重新提交</view>
</div>
</template>
......
......@@ -45,7 +45,8 @@
<text class="common-label">评估价格</text>
<view class="price ml-16" :class="{ 'text-blue': carInfo.evalPriceDisplay && carInfo.status != 10 }">
{{ carInfo.status == 10 ? '评估中' : carInfo.evalPriceDisplay }}
<text v-if="carInfo.evalPriceDisplay && carInfo.status != 10" class="text-gray">(定金: {{ carInfo.depositPrice }}元 | 尾款: {{ carInfo.finalPrice }}元)</text>
<text v-if="carInfo.paymentType == 1 && carInfo.status != 10" class="text-gray">(定金: {{ carInfo.depositPrice }}元 | 尾款: {{ carInfo.finalPrice }}元)</text>
<text v-if="carInfo.paymentType == 2 && carInfo.status != 10" class="text-gray">(全款: {{ carInfo.evalPrice }}元 )</text>
</view>
</view>
<ButtonModule @button-click="$emit('button-click', { ...$event, ...carInfo })" :status="carInfo.status" :subStatus="carInfo.subStatus" :paymentType="carInfo.paymentType"></ButtonModule>
......
......@@ -22,14 +22,18 @@ export default {
return {
url: '',
title: '',
fileType: 'pdf'
fileType: 'pdf',
Signature: true
}
},
onLoad (options) {
console.log(options)
this.fileType = options.fileType || 'pdf'
this.Signature = options.Signature === 'false' ? false : (options.Signature || true);
if(this.fileType === 'docx') {
this.url = options.fileUrl
}else if(!this.Signature) {
this.url = options.fileUrl
}else {
this.url = options.fileUrl + '&OSSAccessKeyId='+ options.OSSAccessKeyId + '&Signature=' + options.Signature
}
......
......@@ -304,7 +304,7 @@ export default {
...this.formData
})
console.log('res:', res)
if (res) {
if (res.data) {
uni.showToast({ title: '交车成功', icon: 'none' })
setTimeout(() => {
// uni.navigateBack({
......
......@@ -128,7 +128,7 @@
</StepperNavigation>
</view>
<view v-else-if="activeTab === 4">
<view class="mb-32 upload-box">
<view class="mb-32 upload-box" v-if="detailsInfo.signingInfo.saleContract">
<view class="tab-panel-title">车辆买卖协议</view>
<view class="gridBoxNoPadding">
<view v-for="(item, index) in vehicleItems" :key="index" :class="['flex align-start', { 'full-width': item.fullWidth }]">
......@@ -136,7 +136,7 @@
<view v-if="item.type == 'image'">
<image :src="formatValue(item, detailsInfo)" @click.stop="previewMedia(formatValue(item, detailsInfo), 1)"></image>
</view>
<view v-else-if="item.type == 'link'" class="flex-1">
<view v-else-if="item.type == 'link'" class="flex-1" @click.stop="pdfPreview(detailsInfo.signingInfo.saleContract.contractNo)">
<view class="pdf-box flex align-center justify-between">
<view class="flex align-center">
<view class="sprite-icon icon-pdf"></view>
......@@ -605,6 +605,20 @@ export default {
uni.navigateTo({
url: `${url}`
})
},
pdfPreview(contractNo) {
uni.$api.evaluationApi
.viewOnlineContract({
contractNo: contractNo
})
.then(res => {
console.log('res:', res)
// const pdfUrl = 'https://jinrong-huidan-test.oss-cn-shenzhen.aliyuncs.com/testdev/696fdf0c-0287-4bcd-9d4e-6b423f2fe5ba%E4%BA%8C%E6%89%8B%E8%BD%A6%E8%BD%AC%E8%AE%A9%E5%8D%8F%E8%AE%AE.docx'
const url = `/pages/evaluationForm/components/pdfPreView?fileUrl=${res.contractUrl}&title=pdf&fileType=pdf&Signature=false`
uni.navigateTo({
url: `${url}`
})
})
}
}
}
......
......@@ -106,7 +106,7 @@
<text class="amount-title">{{ payPopupObj.paymentType == 1 && payPopupObj.status != 40 ? '定金' : payPopupObj.paymentType == 1 && payPopupObj.status == 40 ? '尾款' : '全款' }}金额</text>
<text class="amount-value">{{ payPopupObj.paymentType == 1 && payPopupObj.status != 40 ? payPopupObj.depositPrice : payPopupObj.paymentType == 1 && payPopupObj.status == 40 ? payPopupObj.finalPrice : payPopupObj.evalPrice }}元</text>
</view>
<view class="flex align-center mt-28 mb-16">
<view class="flex align-center mt-28 mb-16" v-if="payPopupObj.paymentType == 1">
<text class="popup-cell-title light-title">{{ payPopupObj.paymentType == 1 && payPopupObj.status == 40 ? '已支付定金' : '待支付尾款' }}</text>
<text class="popup-cell-value light-value">{{ payPopupObj.paymentType == 1 && payPopupObj.status == 40 ? payPopupObj.depositPrice : payPopupObj.finalPrice }}元</text>
</view>
......@@ -317,6 +317,21 @@ export default {
this.amountRequestedPopupTitle = e.status == 40 && e.paymentType == 1 ? '申请尾款支付' : '申请全款支付'
} else if (e.type === 'details') {
this.jumpToDetails(e)
} else if (e.type === 'reSubmit') {
this.reSubmit(e)
}
},
async reSubmit(e) {
const res = await uni.$api.evaluationApi.evalOrderConfirmVehicleDelivery({
evalOrderNo: e.evalOrderNo
})
if (res) {
uni.showToast({
title: '重新提交成功',
icon: 'none'
})
this.currentPage = 1
this.search()
}
},
jumpToDetails(e) {
......
......@@ -380,7 +380,7 @@ export default {
purchaseInvoice: '',
trafficScreenshot: '',
carKey: '',
carKeyCount: 0,
carKeyCount: 2,
trafficInsurance: '',
insuranceCard: '',
transferPhoto: '',
......@@ -465,16 +465,10 @@ export default {
// 监听定金变化,自动计算尾款
'formData.depositPrice': {
handler(newValue) {
console.log(newValue)
this.calculateFinalPrice()
},
immediate: true
},
// 监听尾款变化,自动计算定金
'formData.finalPrice': {
handler(newValue) {
this.calculateDepositPrice()
},
immediate: true
}
},
onLoad(options) {
......@@ -631,6 +625,8 @@ export default {
}
]
if (value === 1) {
this.formData.finalPrice = 0
this.formData.depositPrice = 0
// 定金+尾款模式
// 如果之前有填写全款金额,则将其分配给定金和尾款
if (this.formData.fullPrice > 0) {
......@@ -642,6 +638,7 @@ export default {
this.formData.fullPrice = this.query.evalPrice
}
} else if (value === 2) {
console.log('this.formData', this.formData)
this.formFields = [
{
key: 'fullPrice',
......@@ -715,11 +712,6 @@ export default {
}
]
// 全款模式
// 如果之前有填写定金和尾款,则计算总和作为全款金额
if (this.formData.depositPrice > 0 || this.formData.finalPrice > 0) {
this.formData.fullPrice = parseInt(this.formData.depositPrice || 0) + parseInt(this.formData.finalPrice || 0)
}
// 确保评估价已设置
if (this.query.evalPrice && !this.formData.fullPrice) {
this.formData.fullPrice = this.query.evalPrice
......@@ -862,6 +854,11 @@ export default {
this.$refs.notice.open()
},
comfirm() {
console.log('this.formData', this.formData)
if (this.formData.paymentType == 2) {
delete this.formData.depositPrice
delete this.formData.finalPrice
}
uni.$api.evaluationApi.evalOrderSignContract({ ...this.formData, evalOrderNo: this.query.evalOrderNo })
uni.showToast({
title: '电子签约已发送,请注意查收短信',
......@@ -873,6 +870,7 @@ export default {
},
// 计算尾款:尾款 = 评估价 - 定金
calculateFinalPrice() {
console.log(' 计算尾款:尾款 = 评估价 - 定金', this.formData)
const depositPrice = parseFloat(this.formData.depositPrice) || 0
const evalPrice = parseFloat(this.formData.evalPrice) || 0
const finalPrice = evalPrice - depositPrice
......@@ -890,25 +888,7 @@ export default {
})
}
},
// 计算定金:定金 = 评估价 - 尾款
calculateDepositPrice() {
const finalPrice = parseFloat(this.formData.finalPrice) || 0
const evalPrice = parseFloat(this.formData.evalPrice) || 0
const depositPrice = evalPrice - finalPrice
// 确保定金不为负数
if (depositPrice >= 0) {
this.formData.depositPrice = depositPrice
} else {
// 尾款不能大于评估价
this.formData.finalPrice = evalPrice
this.formData.depositPrice = 0
uni.showToast({
title: '尾款不能大于评估价',
icon: 'none'
})
}
},
// 处理输入事件
handleInputChange(e, field) {
const value = e.detail.value
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!