Commit 38411541 by 李伟康

```

fix(equity): 调用权益订单添加接口时增加异步参数

在调用 dj.api.smartcarlife.vehicle.damage.upgrade.equityOrder.add 接口时,
新增第三个参数 true 来支持异步处理,确保订单添加操作能够正确执行。
```
1 parent b3a57259
...@@ -243,6 +243,6 @@ module.exports = { ...@@ -243,6 +243,6 @@ module.exports = {
method: 'dj.api.smartcarlife.vehicle.damage.upgrade.equityOrder.add', method: 'dj.api.smartcarlife.vehicle.damage.upgrade.equityOrder.add',
projectName: 'boutique', projectName: 'boutique',
...data ...data
}) }, true)
}, },
} }
...@@ -55,10 +55,10 @@ ...@@ -55,10 +55,10 @@
<view class="btns flex"> <view class="btns flex">
<view <view
class="btn save" class="btn save"
@click="handleEditSave" @click="submit(0)"
>存草稿</view> >存草稿</view>
<view <view
@click="submit" @click="submit(1)"
class="btn" class="btn"
>确认提交</view> >确认提交</view>
</view> </view>
...@@ -161,14 +161,19 @@ export default { ...@@ -161,14 +161,19 @@ export default {
EquityConversion, EquityConversion,
NoticePopup NoticePopup
}, },
props: {
transmissionOfData: {
type: Object,
default: () => null
}
},
data () { data () {
return { return {
formList: utils.deepClone(EQUITY_FORM_LIST), formList: utils.deepClone(EQUITY_FORM_LIST),
titleList: utils.deepClone(EQUITY_FORM_TITLE_LIST), titleList: utils.deepClone(EQUITY_FORM_TITLE_LIST),
endDate: dayjs().format('YYYY-MM-DD'), endDate: dayjs().format('YYYY-MM-DD'),
equityFormRule: utils.deepClone(EQUITY_FORM_RULE), equityFormRule: utils.deepClone(EQUITY_FORM_RULE),
orderObj: { orderObj: {},
},
loadComplete: false, loadComplete: false,
popupType: 0, popupType: 0,
viewKey: Date.now(), viewKey: Date.now(),
...@@ -179,13 +184,22 @@ export default { ...@@ -179,13 +184,22 @@ export default {
} }
}, },
watch: {
transmissionOfData: {
handler (val) {
if (val && val.contractNo) this.getServiceInfoDetail(val.contractNo)
},
deep: true,
immediate: true
}
},
computed: { computed: {
orderPopupRef () { orderPopupRef () {
return this.$refs.orderPopup return this.$refs.orderPopup
} }
}, },
mounted () { mounted () {
this.getServiceInfoDetail('car995580848107536384')
}, },
methods: { methods: {
// 单选框change事件 // 单选框change事件
...@@ -205,6 +219,7 @@ export default { ...@@ -205,6 +219,7 @@ export default {
this.orderPopupRef.open() this.orderPopupRef.open()
}, },
onConfirm (val) { onConfirm (val) {
console.log(val)
const { chooseContent, popupType } = val, const { chooseContent, popupType } = val,
_typeValue = EQUITY_POPUP_ENUM[popupType] _typeValue = EQUITY_POPUP_ENUM[popupType]
console.log(_typeValue) console.log(_typeValue)
...@@ -219,6 +234,7 @@ export default { ...@@ -219,6 +234,7 @@ export default {
return return
} }
this.$set(this.orderObj, _typeValue.value, chooseContent) this.$set(this.orderObj, _typeValue.value, chooseContent)
this.viewKey = Date.now()
}, },
inputBlur (e, val) { inputBlur (e, val) {
this.orderObj[val.value] = this.orderObj[val.value] this.orderObj[val.value] = this.orderObj[val.value]
...@@ -274,9 +290,10 @@ export default { ...@@ -274,9 +290,10 @@ export default {
} }
let priceList = ['actualSalesPrice'] let priceList = ['actualSalesPrice']
data.goodInfoList.map((item, idx) => { data.goodInfoList.map((item, idx) => {
priceList.forEach(k => { if (item.actualSalesPrice) item.actualSalesPrice = NP.divide(Number(item.actualSalesPrice), 100).toFixed(2)
data.goodInfoList[idx][k] = item[k] === null ? null : (item[k] / 100).toFixed(2) // priceList.forEach(k => {
}) // data.goodInfoList[idx][k] = item[k] === null ? null : (item[k] / 100).toFixed(2)
// })
if (item.vehicleRegistrationDate) { if (item.vehicleRegistrationDate) {
item.vehicleRegistrationDate = dayjs(item.vehicleRegistrationDate).format('YYYY-MM-DD') item.vehicleRegistrationDate = dayjs(item.vehicleRegistrationDate).format('YYYY-MM-DD')
} }
...@@ -331,8 +348,9 @@ export default { ...@@ -331,8 +348,9 @@ export default {
Object.assign(this.orderObj, { Object.assign(this.orderObj, {
...data, ...data,
vin: data.vin, vin: data.vin,
invoicePrice: NP.divide(data.invoicePrice || 0, 100).toFixed(2), invoicePrice: NP.divide(Number(data.invoicePrice || 0), 100).toFixed(2),
seatesNum: data.seatesNum, seatesNum: data.seatesNum,
seat: data.seatesNum,
engineNo: data.engineNo, engineNo: data.engineNo,
vehicleColor: data.vehicleColor, vehicleColor: data.vehicleColor,
billingDate: data.billingDate ? dayjs(data.billingDate).format('YYYY-MM-DD') : dayjs().format('YYYY-MM-DD'), billingDate: data.billingDate ? dayjs(data.billingDate).format('YYYY-MM-DD') : dayjs().format('YYYY-MM-DD'),
...@@ -375,15 +393,16 @@ export default { ...@@ -375,15 +393,16 @@ export default {
}, },
confirmCalendar (e, key) { confirmCalendar (e, key) {
this.orderObj[key] = e.fulldate this.orderObj[key] = e.fulldate
this.viewKey = Date.now()
}, },
async submit () { async submit (operationType) {
uni.showLoading({ uni.showLoading({
title: '提交中...', title: '提交中...',
mask: true mask: true
}) })
const { orderObj, conSecondObj } = this, const { orderObj, conSecondObj } = this,
{ goodsRef, tireRef, uplopdRef, conversionRef } = this.$refs { goodsRef, tireRef, uplopdRef, conversionRef } = this.$refs
let params = orderObj, let params = utils.deepClone(orderObj),
attachmentList = [], attachmentList = [],
attributeList = [] attributeList = []
if (tireRef) { if (tireRef) {
...@@ -400,11 +419,17 @@ export default { ...@@ -400,11 +419,17 @@ export default {
}) })
params.attributeList = attributeList params.attributeList = attributeList
} }
if (goodsRef) params.goodInfoList = goodsRef.goodInfoList if (goodsRef) {
let goodInfoList = utils.deepClone(goodsRef.goodInfoList)
goodInfoList.map(item => {
item.actualSalesPrice = NP.times(Number(item.actualSalesPrice), 100)
})
params.goodInfoList = goodInfoList
}
if (uplopdRef || conversionRef) { if (uplopdRef || conversionRef) {
let imgObj = {} let imgObj = {}
if (uplopdRef) imgObj = uplopdRef.imgObj if (uplopdRef) imgObj = uplopdRef.imgObj
if (conversionRef) imgObj = { if (conversionRef && params.inclueType == 1) imgObj = {
...imgObj, ...imgObj,
...conversionRef.imgObj ...conversionRef.imgObj
} }
...@@ -426,17 +451,21 @@ export default { ...@@ -426,17 +451,21 @@ export default {
} }
}) })
} }
params.invoicePrice = NP.times(params.invoicePrice, 100) params.invoicePrice = NP.times(Number(params.invoicePrice), 100)
params.attachmentList = attachmentList params.attachmentList = attachmentList
if (operationType == 0) {
this.confirm(params, operationType)
return
}
if (!this.checkOrder(params)) return uni.hideLoading() if (!this.checkOrder(params)) return uni.hideLoading()
const { code, message } = await uni.$api.equityApi.checkVinBuyEquityOrder({ const { code, message } = await uni.$api.equityApi.checkVinBuyEquityOrder({
vin: orderObj.vin vin: orderObj.vin
}) })
if (code == 0) { if (code == 0) {
this.confirm(params) this.confirm(params, operationType)
} else if (code == '-2') { } else if (code == '-2') {
if (conSecondObj.vin == orderObj.vin) { if (conSecondObj.vin == orderObj.vin) {
this.confirm(params) this.confirm(params, operationType)
this.conSecondObj.vin = '' this.conSecondObj.vin = ''
} else { } else {
this.conSecondObj.vin = orderObj.vin this.conSecondObj.vin = orderObj.vin
...@@ -461,6 +490,7 @@ export default { ...@@ -461,6 +490,7 @@ export default {
}) })
params.goodInfoList?.map(item => { params.goodInfoList?.map(item => {
if (item.printType == 2) {
if (item.itemsCode == 'YB0003') Object.keys(oilFormRule).map(key => { if (item.itemsCode == 'YB0003') Object.keys(oilFormRule).map(key => {
let [nullCheck, validatorCheck] = oilFormRule[key] let [nullCheck, validatorCheck] = oilFormRule[key]
if (nullCheck.required) { if (nullCheck.required) {
...@@ -486,6 +516,7 @@ export default { ...@@ -486,6 +516,7 @@ export default {
}) })
if (item.itemsCode != 'YB0001' && item.itemsCode != 'YB0002' && item.itemsCode != 'YB0003') Object.keys(extendServiceFormRule).map(key => { if (item.itemsCode != 'YB0001' && item.itemsCode != 'YB0002' && item.itemsCode != 'YB0003') Object.keys(extendServiceFormRule).map(key => {
let [nullCheck, validatorCheck] = extendServiceFormRule[key] let [nullCheck, validatorCheck] = extendServiceFormRule[key]
if (nullCheck.required) { if (nullCheck.required) {
if (!item[key]) throw extendServiceFormRule[key][0].message if (!item[key]) throw extendServiceFormRule[key][0].message
...@@ -497,6 +528,7 @@ export default { ...@@ -497,6 +528,7 @@ export default {
} }
}) })
}
}) })
if (params.ybAttachmentFlag == 0 || params.qsFlag == 1) { if (params.ybAttachmentFlag == 0 || params.qsFlag == 1) {
...@@ -525,15 +557,78 @@ export default { ...@@ -525,15 +557,78 @@ export default {
} }
return true return true
}, },
handleEditSave () { async confirm (paramsData, operationType) {
try {
}, let params = utils.deepClone(paramsData)
async confirm (params) {
this.$refs.reportNotice.close() this.$refs.reportNotice.close()
console.log(params, '===') console.log(params, '===')
const data = await uni.$api.equityApi.addEquityOrder(params) // 0草稿,1提单
console.log(data) params.operationType = operationType
params.addOnsFlag = params.inclueType == 2 ? 0 : 1
params.seatesNum = params.seat
delete params.imgObj
delete params.inclueType
delete params.seat
uni.showLoading({
mask: true
})
const { code, message } = await uni.$api.equityApi.addEquityOrder(params)
if (code == 0) {
if (operationType == 0) {
uni.hideLoading() uni.hideLoading()
uni.showToast({
title: '保存成功',
icon: 'none',
mask: true
})
setTimeout(() => {
this.$emit('jump', 'EquityManagement')
}, 1500)
} else {
// 从URL获取文件名
const getFileNameFromUrl = (url) => {
return url.split('/').pop().split('?')[0] || '未知文件'
}
const { contractNo } = params,
url = await uni.$api.equityApi.printContract({ contractNo }),
fileName = getFileNameFromUrl(url),
type = 3
if (!url) throw '获取合同失败'
this.noticeObj = {
title: '提单成功',
text: '提单合同支持分享或保存',
type: 'success',
buttons: [
{
text: '查看合同',
type: 'primary',
callback: _ => {
this.$refs.reportNotice.close()
this.$emit('jump', 'EquityManagement')
// 跳转到预览页面
uni.navigateTo({
url: `/pages/common/filePreview?fileUrl=${encodeURIComponent(url)}&fileType=${type}&fileName=${encodeURIComponent(fileName)}`
})
}
}
]
}
setTimeout(() => {
uni.hideLoading()
this.$refs.reportNotice.open()
}, 100)
}
} else throw message
} catch (error) {
console.log(error)
uni.hideLoading()
if (error) uni.showToast({
title: error,
icon: 'none'
})
}
}, },
openNotice (message, params) { openNotice (message, params) {
uni.hideLoading() uni.hideLoading()
...@@ -544,7 +639,7 @@ export default { ...@@ -544,7 +639,7 @@ export default {
title = '信息确认' title = '信息确认'
btnText = '继续出单' btnText = '继续出单'
callbackFun = () => { callbackFun = () => {
this.confirm(params) this.confirm(params, 1)
} }
} }
this.noticeObj = { this.noticeObj = {
......
...@@ -86,6 +86,7 @@ export default { ...@@ -86,6 +86,7 @@ export default {
externalData: { externalData: {
handler (val) { handler (val) {
let { imgObj } = val let { imgObj } = val
if (Object.keys(this.imgObj).length) return
this.imgObj = { this.imgObj = {
retrofitInvoice: imgObj.retrofitInvoice || '', retrofitInvoice: imgObj.retrofitInvoice || '',
retrofit: imgObj.retrofit || '' retrofit: imgObj.retrofit || ''
......
...@@ -195,6 +195,7 @@ export default { ...@@ -195,6 +195,7 @@ export default {
externalData: { externalData: {
handler (val) { handler (val) {
let { imgObj } = val let { imgObj } = val
if(Object.keys(this.imgObj).length) return
this.imgObj = { this.imgObj = {
invoice: imgObj.invoice || '', invoice: imgObj.invoice || '',
driveFront: imgObj.driveFront || '', driveFront: imgObj.driveFront || '',
......
...@@ -465,7 +465,7 @@ const EQUITY_FORM_LIST = [ ...@@ -465,7 +465,7 @@ const EQUITY_FORM_LIST = [
}, },
{ {
label: '座位数', label: '座位数',
value: 'seatesNum', value: 'seat',
type: 'select', type: 'select',
key: 'seat', key: 'seat',
}, },
...@@ -619,7 +619,7 @@ const EQUITY_FORM_TITLE_LIST = [ ...@@ -619,7 +619,7 @@ const EQUITY_FORM_TITLE_LIST = [
] ]
const EQUITY_POPUP_ENUM = { const EQUITY_POPUP_ENUM = {
18: { 18: {
value: 'seatesNum', value: 'seat',
key: 'seat' key: 'seat'
}, },
21: { 21: {
...@@ -709,7 +709,7 @@ const EQUITY_FORM_RULE = { ...@@ -709,7 +709,7 @@ const EQUITY_FORM_RULE = {
} }
} }
], ],
seatesNum: [{ required: true, message: '座位数不能为空' }], seat: [{ required: true, message: '座位数不能为空' }],
engineNo: [ engineNo: [
{ required: true, message: '发动机号不能为空' }, { required: true, message: '发动机号不能为空' },
{ {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!