更新商品编辑时价格有概率无法回显的bug

This commit is contained in:
weipengfei 2023-12-19 15:51:42 +08:00
parent 47fcd00bd2
commit 0ef83a8e79
2 changed files with 72 additions and 70 deletions

View File

@ -104,11 +104,11 @@
</view> </view>
</view> </view>
</view> </view>
<u-modal :show="showSpecType" title="温馨提示" content="切换后商品原有规格将失效,是否继续?" <u-modal :show="showSpecType" title="温馨提示" content="切换后商品原有规格将失效,是否继续?" show-cancel-button confirm-text="继续"
show-cancel-button confirm-text="继续" @confirm="changeSpecType2" @cancel="showSpecType=false" @confirm="changeSpecType2" @cancel="showSpecType=false"></u-modal>
></u-modal>
</picker> </picker>
<priceComponent v-if="setFormData.spec_type==0" :datas="setFormData.attrValue[0]" ref="priceRef" :product_id="product_id" :bar_code="code" @updateCode="updateCode"> <priceComponent v-if="setFormData.spec_type==0" :datas="setFormData.attrValue[0]" ref="priceRef"
:product_id="product_id" :bar_code="code" @updateCode="updateCode">
</priceComponent> </priceComponent>
<view v-else class="popup_group" style="margin-top: 0;border-top: 1rpx solid #eeeeee;"> <view v-else class="popup_group" style="margin-top: 0;border-top: 1rpx solid #eeeeee;">
<view class="popup_group_item" @click="navToSpecGood()"> <view class="popup_group_item" @click="navToSpecGood()">
@ -301,8 +301,7 @@
}) })
}) })
}) })
} } else if (this.product_id) {
else if(this.product_id){
this.initDataEditData(); this.initDataEditData();
} }
}, },
@ -402,8 +401,10 @@
item => item item => item
.category && item.category.cate_name).join(',') : ''; .category && item.category.cate_name).join(',') : '';
this.setFormData.brand_name = editGoodsDetils.brand ? editGoodsDetils.brand.brand_name : ''; this.setFormData.brand_name = editGoodsDetils.brand ? editGoodsDetils.brand.brand_name : '';
if(typeof res.data.content == 'string')res.data.content = JSON.parse(res.data.content); if (res.data.content && typeof res.data.content == 'string') res.data.content = JSON.parse(res.data
.content);
// //
this.$nextTick(() => {
this.$refs.commodityRef.setDatas({ this.$refs.commodityRef.setDatas({
addGoodsSecoundData: { addGoodsSecoundData: {
is_good: res.data.is_good, // is_good: res.data.is_good, //
@ -421,6 +422,7 @@
if (this.setFormData.spec_type == 0) { if (this.setFormData.spec_type == 0) {
this.$refs.priceRef.setDatas(res.data.attrValue[0]); this.$refs.priceRef.setDatas(res.data.attrValue[0]);
} }
})
editGoodsDetils.temp && (this.setFormData.tempName = editGoodsDetils.temp.name); editGoodsDetils.temp && (this.setFormData.tempName = editGoodsDetils.temp.name);
hideLoading(); hideLoading();
@ -662,8 +664,7 @@
if (this.import == 1) { if (this.import == 1) {
uni.$emit('importAttrValueOK', this.setFormData.import_id); uni.$emit('importAttrValueOK', this.setFormData.import_id);
uni.navigateBack(); uni.navigateBack();
} } else uni.redirectTo({
else uni.redirectTo({
url: '/pages/product/goodsOnSale/index?mer_id=' + this.merId url: '/pages/product/goodsOnSale/index?mer_id=' + this.merId
}) })
}) })

View File

@ -165,7 +165,8 @@
else this.formList.splice(len-1, this.formList.length); else this.formList.splice(len-1, this.formList.length);
}, },
setDatas(data){ setDatas(data){
this.singleSpecification = data; console.log('收到', data);
this.singleSpecification = {...data};
}, },
input(val) { input(val) {
this.singleSpecification = val this.singleSpecification = val