Commit a32cf930 by 胡悦

feat(订单创建): 优化订单创建组件的数据处理和回显逻辑

重构订单创建组件的数据处理流程,添加对多规格商品和套餐商品的支持
- 新增商品价格旧值存储功能
- 完善订单数据回显处理逻辑
- 优化商品分类和位置信息显示
- 添加调试日志便于问题排查
1 parent 6ade9623
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<!-- <view class="alias-name">商品别名:阿尔法 T5极狐非三电整车延保(新车2年6万公里)</view> --> <!-- <view class="alias-name">商品别名:阿尔法 T5极狐非三电整车延保(新车2年6万公里)</view> -->
<view class="front-gear-box"> <view class="front-gear-box">
<view class="front-gear-input-box"> <view class="front-gear-input-box">
<view class="front-gear-label" v-if="goods.merchantGoodsPosition || goods.goodsInfo.goodsTypeName">{{goods.goodsInfo.goodsType===1?formatPosition(goods.merchantGoodsPosition, positionTypeList):goods.goodsInfo.goodsTypeName}}</view> <!-- <view class="front-gear-label" v-if="goods.merchantGoodsPosition || goods.goodsInfo.goodsTypeName">{{goods.goodsInfo.goodsType===1?formatPosition(goods.merchantGoodsPosition, positionTypeList):goods.goodsInfo.goodsTypeName}}</view> -->
<view class="front-gear-input"> <view class="front-gear-input">
<view class="unit">¥</view> <view class="unit">¥</view>
<input class="uni-input" type="digit" maxlength="9" placeholder="请输入价格" placeholder-style="font-size: 14px" v-model="goods.sellPrice" @blur="validatePrice($event, goods, ind, index)" /> <input class="uni-input" type="digit" maxlength="9" placeholder="请输入价格" placeholder-style="font-size: 14px" v-model="goods.sellPrice" @blur="validatePrice($event, goods, ind, index)" />
...@@ -48,6 +48,7 @@ export default { ...@@ -48,6 +48,7 @@ export default {
created() { created() {
// 初始化商品数量 // 初始化商品数量
this.initProductNumbers() this.initProductNumbers()
console.log(this.list, 'Package-list')
}, },
mounted() { mounted() {
// 确保每次使用组件时都检查并设置number属性 // 确保每次使用组件时都检查并设置number属性
...@@ -56,6 +57,7 @@ export default { ...@@ -56,6 +57,7 @@ export default {
updated() { updated() {
// 当组件数据更新时也检查number属性 // 当组件数据更新时也检查number属性
this.initProductNumbers() this.initProductNumbers()
console.log(this.list, 'Package-list')
}, },
methods: { methods: {
// 初始化商品数量方法 // 初始化商品数量方法
...@@ -65,14 +67,20 @@ export default { ...@@ -65,14 +67,20 @@ export default {
if (!item.packageGoods.number) { if (!item.packageGoods.number) {
this.$set(item.packageGoods, 'number', '1') this.$set(item.packageGoods, 'number', '1')
} }
// 存储旧值
item.packageGoods.goodsList.forEach(goods => {
if (!goods.price) {
goods.oldPrice = goods.sellPrice
}
})
}) })
} }
}, },
// 格式化位置信息 // // 格式化位置信息
formatPosition(item, positionTypeList) { // formatPosition(item, positionTypeList) {
const filterData = positionTypeList.filter(v => v.positionValue == item) // const filterData = positionTypeList.filter(v => v.positionValue == item)
return (filterData.length && filterData[0] && filterData[0].positionName) || '' // return (filterData.length && filterData[0] && filterData[0].positionName) || ''
}, // },
// 验证数量输入 // 验证数量输入
validateNumber(event, item) { validateNumber(event, item) {
let value = event.detail.value let value = event.detail.value
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!