Commit 30a838ca by 胡悦

fix(boutique): 修复产品列表和包列表的显示条件逻辑

fix(Form): 修正输入框maxlength处理逻辑
fix(boutique): 修复包总价计算逻辑并添加精度处理
feat(boutique): 添加订单创建和补充订单的埋点跟踪
fix(boutique): 修复VIN码校验和订单提交逻辑
style(sprite): 调整图标样式和顺序
1 parent 578522bc

2.61 MB | W: | H:

2.61 MB | W: | H:

assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
<view class="input-box"> <view class="input-box">
<input class="input-value" v-model="formData[item.value]" :type="item.inputType || 'text'" <input class="input-value" v-model="formData[item.value]" :type="item.inputType || 'text'"
@blur="handleBlur($event, item)" :placeholder="item.placeholder || '请输入'" @blur="handleBlur($event, item)" :placeholder="item.placeholder || '请输入'"
:maxlength="item.inputType === 'number' ? false : (item.maxlength || -1)" :maxlength="item.maxlength ? item.maxlength : -1"
@input="item.inputType === 'number' && item.maxlength ? (formData[item.value] = String($event.target.value).slice(0, item.maxlength)) : null" /> @input="item.inputType === 'number' && item.maxlength ? (formData[item.value] = String($event.target.value).slice(0, item.maxlength)) : null" />
<view v-if="item.valueIcon" :class="['sprite-icon', `icon-${item.valueIcon}`]" <view v-if="item.valueIcon" :class="['sprite-icon', `icon-${item.valueIcon}`]"
@click="onValueClick(item)"></view> @click="onValueClick(item)"></view>
......
...@@ -6,10 +6,24 @@ ...@@ -6,10 +6,24 @@
<view class="box-content"> <view class="box-content">
<GlCell :formList="formList" :formData="orderObj" @radioChange="radioChange" @inputBlur="inputBlur" <GlCell :formList="formList" :formData="orderObj" @radioChange="radioChange" @inputBlur="inputBlur"
@handleCell="handleCell"> @handleCell="handleCell">
<!-- 使用v-for循环渲染产品组件,减少重复代码 --> <template slot="frontGear">
<template v-for="(_, slotName) in productSlots" :slot="slotName"> <Product v-if="orderObj.frontGear" @changeTotalPrice="changeTotalPrice" :list="orderObj.frontGear" :positionTypeList="positionTypeList"
<Product :key="slotName" v-if="orderObj[slotName] && orderObj[slotName].length" :baseConfigData="baseConfigData"></Product>
@changeTotalPrice="changeTotalPrice" :list="orderObj[slotName]" :positionTypeList="positionTypeList" </template>
<template slot="frontWindow">
<Product v-if="orderObj.frontWindow" @changeTotalPrice="changeTotalPrice" :list="orderObj.frontWindow" :positionTypeList="positionTypeList"
:baseConfigData="baseConfigData"></Product>
</template>
<template slot="rearWindow">
<Product v-if="orderObj.rearWindow" @changeTotalPrice="changeTotalPrice" :list="orderObj.rearWindow" :positionTypeList="positionTypeList"
:baseConfigData="baseConfigData"></Product>
</template>
<template slot="rearGear">
<Product v-if="orderObj.rearGear" @changeTotalPrice="changeTotalPrice" :list="orderObj.rearGear" :positionTypeList="positionTypeList"
:baseConfigData="baseConfigData"></Product>
</template>
<template slot="sunRoof">
<Product v-if="orderObj.sunRoof" @changeTotalPrice="changeTotalPrice" :list="orderObj.sunRoof" :positionTypeList="positionTypeList"
:baseConfigData="baseConfigData"></Product> :baseConfigData="baseConfigData"></Product>
</template> </template>
<template slot="package"> <template slot="package">
...@@ -214,7 +228,13 @@ export default { ...@@ -214,7 +228,13 @@ export default {
}, },
methods: { methods: {
initData() { initData() {
console.log('initData', this.orderCreateType) console.log('initData', this.orderCreateType, this.orderObj.id)
// 埋点
if (this.orderCreateType == 'createWithPay' && !this.orderObj.id) {
uni.$track.add({ eventCode: 'app_create_order' })
} else if(this.orderCreateType == 'supplementOrder') {
uni.$track.add({ eventCode: 'app_supplement_order' })
}
const { userInfo } = this const { userInfo } = this
if (!this.orderObj.id) { if (!this.orderObj.id) {
// 在原有的 orderObj 对象上新增这些属性 // 在原有的 orderObj 对象上新增这些属性
...@@ -285,7 +305,8 @@ export default { ...@@ -285,7 +305,8 @@ export default {
// 弹窗确认回调 // 弹窗确认回调
onConfirm(val) { onConfirm(val) {
console.log(val, 'onConfirm') console.log(val, 'onConfirm')
const { chooseContent } = val // const { chooseContent } = val
const chooseContent = utils.deepClone(val.chooseContent)
// 根据popupTypeEnum优化处理 // 根据popupTypeEnum优化处理
const _typeValue = this.popupTypeEnum[this.popupType] const _typeValue = this.popupTypeEnum[this.popupType]
console.log(_typeValue) console.log(_typeValue)
...@@ -310,6 +331,7 @@ export default { ...@@ -310,6 +331,7 @@ export default {
} else if (productFields.includes(_typeValue.key)) { } else if (productFields.includes(_typeValue.key)) {
if (_typeValue.key == 'skuGoods') { if (_typeValue.key == 'skuGoods') {
if (!this.orderObj[_typeValue.key]) { if (!this.orderObj[_typeValue.key]) {
// 其他精品第一次赋值
this.$set(this.orderObj, _typeValue.key, chooseContent) this.$set(this.orderObj, _typeValue.key, chooseContent)
} else { } else {
// 过滤出已选的goodFlag为2的对象 // 过滤出已选的goodFlag为2的对象
...@@ -318,7 +340,7 @@ export default { ...@@ -318,7 +340,7 @@ export default {
const moreGoods = chooseContent const moreGoods = chooseContent
.filter(item => item.goodsFlag === 2) .filter(item => item.goodsFlag === 2)
.filter(item => { .filter(item => {
return !selectedGoods.some(selectedItem => selectedItem.multipleSpecificationsGoods.id === item.multipleSpecificationsGoods.id) return !selectedGoods.some(selectedItem => selectedItem.multipleSpecificationsGoods.goods.upgradeGoodsId === item.multipleSpecificationsGoods.goods.upgradeGoodsId)
}) })
// 合并已选的goodFlag为2的对象 // 合并已选的goodFlag为2的对象
this.orderObj[_typeValue.key] = [...singleGoods, ...moreGoods, ...selectedGoods] this.orderObj[_typeValue.key] = [...singleGoods, ...moreGoods, ...selectedGoods]
...@@ -386,6 +408,18 @@ export default { ...@@ -386,6 +408,18 @@ export default {
} }
} }
if (this.orderObj.standNo) {
const vinRex = /[A-Z0-9]{17}$/;
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的特殊校验
if (onlyLabelItem.length > 0) { if (onlyLabelItem.length > 0) {
// 检查frontGear、frontWindow、rearGear、rearWindow、sunRoof和couponInfo字段中是否至少有一个不为空 // 检查frontGear、frontWindow、rearGear、rearWindow、sunRoof和couponInfo字段中是否至少有一个不为空
...@@ -487,6 +521,11 @@ export default { ...@@ -487,6 +521,11 @@ export default {
title: '保存成功', title: '保存成功',
icon: 'success' icon: 'success'
}) })
if (this.orderCreateType == 'createWithPay' && !this.orderObj.id) {
uni.$track.add({ eventCode: 'app_submit_create_order' })
} else if(this.orderCreateType == 'supplementOrder') {
uni.$track.add({ eventCode: 'app_submit_supplement_order' })
}
this.$emit('jump', orderCreateType == 'supplementOrder' ? 'OrderDetail' : 'ConfirmOrder', res) this.$emit('jump', orderCreateType == 'supplementOrder' ? 'OrderDetail' : 'ConfirmOrder', res)
} }
} }
......
<template> <template>
<view> <view>
<view class="package-list"> <view :class="[list.length > 0 ? 'package-list' : '']">
<view class="package-item" v-for="(item, index) in list" :key="index"> <view class="package-item" v-for="(item, index) in list" :key="index">
<view class="header"> <view class="header">
<view class="header-left"> <view class="header-left">
...@@ -170,10 +170,11 @@ export default { ...@@ -170,10 +170,11 @@ export default {
changeTotal(item) { changeTotal(item) {
let total = 0 let total = 0
item.packageGoods.goodsList.forEach(i => { item.packageGoods.goodsList.forEach(i => {
total += parseFloat(i.sellPrice) * parseInt(item.packageGoods.number) // total += parseFloat(i.sellPrice) * parseInt(item.packageGoods.number)
total += parseFloat(i.sellPrice)
}) })
item.packageGoods.upgradePrice = total item.packageGoods.upgradePrice = total
return total return total.toFixed(2)
} }
} }
} }
......
<template> <template>
<view> <view>
<view class="shop-list"> <view :class="[list.length ? 'shop-list':'']">
<view class="shop-item" v-for="(item, index) in list" :key="item.goods.goodsId"> <view class="shop-item" v-for="(item, index) in list" :key="item.goods.goodsId">
<view class="sprite-icon icon-blue-delete" @click="deleteGoods(index)"></view> <view class="sprite-icon icon-blue-delete" @click="deleteGoods(index)"></view>
<view class="right"> <view class="right">
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!