refactor(goods-detail): 升级商品留言表单组件与接口适配
1. 将原有的同步调用改为异步处理handleGoodsSkuData和getGoodsForm方法 2. 重构getGoodsForm接口请求逻辑,兼容新旧版接口返回格式 3. 新增goods_form_config字段支持新表单组件样式配置 4. 替换旧版ns-form为ns-newform组件,完善空数据兜底处理 5. 优化商品留言初始化的可选链操作避免空指针报错
This commit is contained in:
@@ -411,7 +411,11 @@
|
||||
</view> -->
|
||||
<!-- v-if="goodsSkuDetail.goodsForm" -->
|
||||
<view style="padding: 0 30rpx;">
|
||||
<ns-form :data="informationform" ref="form"></ns-form>
|
||||
<ns-newform
|
||||
:data="informationform"
|
||||
:form-config="goodsSkuDetail.goods_form_config"
|
||||
ref="form"
|
||||
></ns-newform>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="button-box"><button type="primary" @click="saveubfirnation()">{{ $lang('goods.detail.confirm') }}</button></view>
|
||||
|
||||
@@ -156,7 +156,7 @@ export default {
|
||||
};
|
||||
|
||||
// 处理商品数据
|
||||
this.handleGoodsSkuData();
|
||||
await this.handleGoodsSkuData();
|
||||
|
||||
// 限时折扣
|
||||
if (this.goodsSkuDetail.promotion_type == 1 && this.addonIsExist.discount) {
|
||||
@@ -221,7 +221,7 @@ export default {
|
||||
|
||||
//商品留言打开
|
||||
showinformation(){
|
||||
this.informationform = this.goodsSkuDetail.goods_form
|
||||
this.informationform = this.goodsSkuDetail?.goods_form ?? [];
|
||||
this.$refs.informationPopup.open();
|
||||
},
|
||||
//商品留言关闭
|
||||
|
||||
Reference in New Issue
Block a user