Commit d60131a7 by 李伟康

fix(components): 修复 GlCell 和 SkuGoodsList 中的 key 及样式问题

- 为 `GlCell.vue` 中的 `view` 元素添加 `:key="idx"` 以解决 Vue 列表渲染警告
- 调整 radio 样式缩放值,优化显示效果
- 修正 `SkuGoodsList.vue` 中删除选中项时索引查找逻辑,确保正确移除对应元素
- 增加 `word-break: break-all` 样式以防止商品名称换行异常

fix(pages): 优化订单创建页面 VIN 校验与报价信息处理

- 将 VIN 码校验提取至工具函数 `utils.validateVIN` 统一管理
- 在获取权益订单报价信息时增加错误捕获并提示用户
- 补充价格转换处理,保证数据精度
- 改进支付方式选择逻辑,支持回显已选类型
- 提交前对订单价格进行 hundred 倍数处理以适配后端接口要求
1 parent dc719d4d
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
</view> </view>
</template> </template>
<template v-for="(item, idx) in items"> <template v-for="(item, idx) in items">
<view v-if="!item.hidden"> <view v-if="!item.hidden" :key="idx">
<view <view
class="cell-row" class="cell-row"
:key="idx" :key="idx"
...@@ -93,7 +93,7 @@ ...@@ -93,7 +93,7 @@
:key="radio.value + item.value" :key="radio.value + item.value"
> >
<radio <radio
style="transform: scale(0.7)" style="transform: scale(0.65) translateY(-3px)"
:value="radio.value" :value="radio.value"
:disabled="item.disabled || radio.disabled" :disabled="item.disabled || radio.disabled"
:checked="radio.value == item.current" :checked="radio.value == item.current"
......
...@@ -341,17 +341,26 @@ export default { ...@@ -341,17 +341,26 @@ export default {
let { goodsId } = i.goods let { goodsId } = i.goods
id = String(goodsId) id = String(goodsId)
} }
let { currentIds } = this, let { currentIds, chooseList } = this,
index = currentIds.indexOf(id) delIndex = currentIds.indexOf(id)
if (index == -1) { if (delIndex == -1) {
this.currentIds.push(id) this.currentIds.push(id)
this.chooseList.push(i) this.chooseList.push(i)
} else { } else {
this.currentIds.splice(index, 1) this.currentIds.splice(delIndex, 1)
this.chooseList.splice(index, 1)
const delChooseIndex = chooseList.findIndex(e => {
let chooseId = ''
if (e.goodsFlag == 3) chooseId = e.packageGoods.packageCode
if (e.goodsFlag == 1) chooseId = String(e.goods.goodsId)
if (e.goodsFlag == i.goodsFlag) {
if (id == chooseId) return e
} }
})
if (delChooseIndex != -1) this.chooseList.splice(delChooseIndex, 1)
} }
this.$emit('choose', this.chooseList) this.$emit('choose', this.chooseList)
}
} catch (error) { } catch (error) {
console.log(error) console.log(error)
} }
...@@ -374,7 +383,6 @@ export default { ...@@ -374,7 +383,6 @@ export default {
chooseList.map(e => { chooseList.map(e => {
if (e.goodsFlag == 2) ids.push(e.multipleSpecificationsGoods.id) if (e.goodsFlag == 2) ids.push(e.multipleSpecificationsGoods.id)
}) })
return ids.includes(i.multipleSpecificationsGoods.id) return ids.includes(i.multipleSpecificationsGoods.id)
} }
if (goodsFlag == 3) id = packageGoods.packageCode if (goodsFlag == 3) id = packageGoods.packageCode
...@@ -551,9 +559,10 @@ export default { ...@@ -551,9 +559,10 @@ export default {
.title { .title {
min-height: toRpx(88); min-height: toRpx(88);
padding: toRpx(24) 0 toRpx(20); padding: toRpx(24) 0 toRpx(20);
}
.goods-name { .goods-name {
max-width: 80%; max-width: 80%;
} word-break: break-all;
} }
.base-tips { .base-tips {
margin-bottom: 20rpx; margin-bottom: 20rpx;
......
...@@ -431,15 +431,7 @@ export default { ...@@ -431,15 +431,7 @@ export default {
} }
if (this.orderObj.standNo) { if (this.orderObj.standNo) {
const vinRex = /^(?=.*[A-Za-z])[A-Za-z0-9]{17}$/ if (!utils.validateVIN(this.orderObj.standNo)) throw '车架号校验不匹配,请核对后重新输入'
console.log(this.orderObj.standNo, vinRex.test(this.orderObj.standNo))
if (!vinRex.test(this.orderObj.standNo)) {
uni.showToast({
title: `请输入正确的VIN码`,
icon: 'none'
})
return false
}
} }
// 处理onlyLabel为true的特殊校验 // 处理onlyLabel为true的特殊校验
......
...@@ -224,13 +224,15 @@ export default { ...@@ -224,13 +224,15 @@ export default {
}, },
methods: { methods: {
async getQuotationInfoById (id) { async getQuotationInfoById (id) {
try {
let { goodsList: quotationGoodsList } = this, data = await uni.$api.equityApi.getQuotationInfoById({ id }), let { goodsList: quotationGoodsList } = this, data = await uni.$api.equityApi.getQuotationInfoById({ id }),
{ orderObj } = this, { orderObj } = this,
{ owner, insurancePrice, quotedPriceUpdate } = data { owner, insurancePrice, quotedPriceUpdate } = data
orderObj.price = owner.price uni.hideLoading()
orderObj.insurancePrice = insurancePrice orderObj.price = this.divideByHundred(owner.price)
orderObj.quotedPriceUpdate = quotedPriceUpdate orderObj.insurancePrice = this.divideByHundred(insurancePrice)
data.vdQuotationGoodsList = data.vdQuotationGoodsList.map( orderObj.quotedPriceUpdate = this.divideByHundred(quotedPriceUpdate)
orderObj.vdQuotationGoodsList = data.vdQuotationGoodsList.map(
item => { item => {
item.price = this.divideByHundred(item.goodsPrice) item.price = this.divideByHundred(item.goodsPrice)
return item return item
...@@ -316,7 +318,6 @@ export default { ...@@ -316,7 +318,6 @@ export default {
return ele.packageGoods.packageId == item.packageId return ele.packageGoods.packageId == item.packageId
} }
}) })
// console.log(index, 'index');
if (index != -1) { if (index != -1) {
pre[index].packageGoods.goodsList.push(obj) pre[index].packageGoods.goodsList.push(obj)
pre[index].price = NP.plus(pre[index].price, obj.price) pre[index].price = NP.plus(pre[index].price, obj.price)
...@@ -344,8 +345,8 @@ export default { ...@@ -344,8 +345,8 @@ export default {
return pre return pre
}, []) }, [])
let keyList = ['mode', 'payee', 'payType', 'referrerId', 'referrer', let keyList = ['mode', 'payee', 'payType', 'referrerId', 'referrer',
'deliveryId', 'deliveryName', 'total', 'notes', 'pay2Time', 'id', 'orderId' 'deliveryId', 'deliveryName', 'notes', 'id', 'orderId'
], customerKeyList = ['owner', 'phone', 'certificateNo', 'carVin', 'seat', 'price', ], customerKeyList = ['owner', 'phone', 'certificateNo', 'carVin', 'seat', ,
'ownerGender', 'ageRange', 'hobby', 'companion', 'carColor', 'salesType', 'city'] 'ownerGender', 'ageRange', 'hobby', 'companion', 'carColor', 'salesType', 'city']
keyList.map(key => { keyList.map(key => {
if (data[key] != null) orderObj[key] = data[key] if (data[key] != null) orderObj[key] = data[key]
...@@ -355,14 +356,25 @@ export default { ...@@ -355,14 +356,25 @@ export default {
}) })
if (owner.id) orderObj.customerId = owner.id if (owner.id) orderObj.customerId = owner.id
this.orderObj = orderObj this.orderObj = orderObj
console.log(data, '===') this.getConfig()
console.log(this.orderObj, '---') setTimeout(() => {
this.changeTotalPrice()
}, 0)
} catch (error) {
uni.hideLoading()
if (error) uni.showToast({
title: error,
icon: 'none',
})
}
}, },
initData () { initData () {
// 埋点 // 埋点
// uni.$track.add({ eventCode: 'app_create_order' }) // uni.$track.add({ eventCode: 'app_create_order' })
this.getConfig() const { paramsData } = this
this.getSelectOrderGoodsList() this.getSelectOrderGoodsList()
if (!paramsData.id) this.getConfig()
this.getShopMerchantPointConfig() this.getShopMerchantPointConfig()
this.orderSettingList() this.orderSettingList()
}, },
...@@ -528,8 +540,7 @@ export default { ...@@ -528,8 +540,7 @@ export default {
if (item.value === 'phone' && !phoneRex.test(value)) throw `请输入正确的${item.label}` if (item.value === 'phone' && !phoneRex.test(value)) throw `请输入正确的${item.label}`
} }
if (orderObj.carVin) { if (orderObj.carVin) {
const vinRex = /^(?=.*[A-Za-z])[A-Za-z0-9]{17}$/ if (!utils.validateVIN(orderObj.carVin)) throw '车架号校验不匹配,请核对后重新输入'
if (!vinRex.test(orderObj.carVin)) throw '请输入正确的车架号'
} }
if (onlyLabelItem.length) { if (onlyLabelItem.length) {
...@@ -560,7 +571,7 @@ export default { ...@@ -560,7 +571,7 @@ export default {
try { try {
let orderInfo = this.getInsurance(), let orderInfo = this.getInsurance(),
{ payType } = orderInfo { payType } = orderInfo
if ( if (check &&
([2, 5, 6, 7].includes(+payType)) && ([2, 5, 6, 7].includes(+payType)) &&
!(orderInfo.transactionNo && orderInfo.paymentDocList.length) !(orderInfo.transactionNo && orderInfo.paymentDocList.length)
) return this.showUpload = true ) return this.showUpload = true
...@@ -623,7 +634,7 @@ export default { ...@@ -623,7 +634,7 @@ export default {
if (orderInfo.id) params.id = orderInfo.id if (orderInfo.id) params.id = orderInfo.id
params.merchantId4s = default4SStoreInfo?.merchantId params.merchantId4s = default4SStoreInfo?.merchantId
params.merchantName4s = default4SStoreInfo?.merchantName params.merchantName4s = default4SStoreInfo?.merchantName
orderInfo.price = this.multipliedByHundred(orderInfo.price)
params.insurancePrice = this.multipliedByHundred( params.insurancePrice = this.multipliedByHundred(
orderInfo.insurancePrice orderInfo.insurancePrice
) )
...@@ -777,19 +788,26 @@ export default { ...@@ -777,19 +788,26 @@ export default {
this.changePayee() this.changePayee()
}, },
changePayee () { changePayee () {
const cell = this.formList[4].find(item => item.value === 'payType') const cell = this.formList[4].find(item => item.value === 'payType'),
{ payType } = this.orderObj
if (cell) { if (cell) {
cell.radioList = this.orderObj.payee == 1 ? this.merchantPayList : this.djPayList cell.radioList = this.orderObj.payee == 1 ? this.merchantPayList : this.djPayList
if (!this.orderObj.id && cell.radioList && cell.radioList.length > 0) { let index = cell.radioList.findIndex(i => i.value == payType)
cell.current = cell.radioList[0].value if (index == -1) index = 0
if (cell.radioList && cell.radioList.length > 0) {
cell.current = cell.radioList[index].value
// 使用 $set 确保响应式更新 // 使用 $set 确保响应式更新
this.$set(this.orderObj, 'payType', cell.radioList[0].value) this.$set(this.orderObj, 'payType', cell.radioList[index].value)
} }
} }
}, },
// 商品列表 // 商品列表
async getSelectOrderGoodsList () { async getSelectOrderGoodsList () {
const { userInfo, paramsData } = this const { userInfo, paramsData } = this
if (paramsData.id) uni.showLoading({
title: '加载中...',
mask: true
})
const res = await uni.$api.boutiqueApi.getSelectOrderGoodsList({ const res = await uni.$api.boutiqueApi.getSelectOrderGoodsList({
merchantId: userInfo.shopMerchantId, merchantId: userInfo.shopMerchantId,
sceneType: userInfo.sceneType sceneType: userInfo.sceneType
......
...@@ -102,7 +102,7 @@ const FORM_LIST = [ ...@@ -102,7 +102,7 @@ const FORM_LIST = [
value: 'carBrandText', value: 'carBrandText',
type: 'select', type: 'select',
key: 'carBrand', key: 'carBrand',
required:false required: false
}, },
{ {
label: '车辆颜色', label: '车辆颜色',
...@@ -115,7 +115,7 @@ const FORM_LIST = [ ...@@ -115,7 +115,7 @@ const FORM_LIST = [
value: 'carVin', value: 'carVin',
maxlength: '17', maxlength: '17',
type: 'input', type: 'input',
required:false required: false
}, },
{ {
label: '座位数', label: '座位数',
...@@ -129,7 +129,8 @@ const FORM_LIST = [ ...@@ -129,7 +129,8 @@ const FORM_LIST = [
value: 'price', value: 'price',
maxlength: '8', maxlength: '8',
type: 'input', type: 'input',
required: true required: true,
inputType: 'digit'
} }
], ],
[ [
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!