Commit 85fcb5e1 by 李伟康

refactor(OrderPopup): 优化 SkuPopup 组件

- 添加数据存在性检查,提高组件的健壮性
- 调整模板结构,确保仅在数据存在时渲染商品列表
- 优化确认按钮点击逻辑,增加数据存在性验证
1 parent 99d6018b
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
</view> </view>
</view> </view>
<view class="popup-tips">温馨提示:请仔细确认当前售价,避免录错单</view> <view class="popup-tips">温馨提示:请仔细确认当前售价,避免录错单</view>
<template v-if="data">
<view class="popup-body"> <view class="popup-body">
<scroll-view <scroll-view
scroll-y scroll-y
...@@ -49,6 +50,7 @@ ...@@ -49,6 +50,7 @@
</view> </view>
</scroll-view> </scroll-view>
</view> </view>
</template>
</popup> </popup>
</template> </template>
...@@ -64,7 +66,7 @@ export default { ...@@ -64,7 +66,7 @@ export default {
data () { data () {
return { return {
data: {}, data: null,
currentId: '' currentId: ''
} }
}, },
...@@ -94,11 +96,11 @@ export default { ...@@ -94,11 +96,11 @@ export default {
this.currentId = i.goodsId this.currentId = i.goodsId
}, },
confirm () { confirm () {
let { currentId, data } = this, let { currentId, data } = this
{ baseGoodsName, id, specificationGoodsMap, specificationList, skuGoodsList } = data.multipleSpecificationsGoods if (!currentId || !data) return uni.showToast({
if (!currentId) return uni.showToast({
title: '请勾选商品', title: '请勾选商品',
}) })
let { baseGoodsName, id, specificationGoodsMap, specificationList, skuGoodsList } = data.multipleSpecificationsGoods
let goods = skuGoodsList.find(e => e.goodsId == currentId) let goods = skuGoodsList.find(e => e.goodsId == currentId)
this.$emit('onConfirm', { this.$emit('onConfirm', {
count: 1, count: 1,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!