fix: 修复新增首个规格项的规格值时。规格列表显示错乱问题

master
paulGao 2022-10-14 15:43:39 +08:00
parent eb9c999a16
commit 17a4131bf1
2 changed files with 29 additions and 12 deletions

View File

@ -5,7 +5,7 @@
<Card class="mb_10" v-if="(afterSale.serviceStatus == 'PASS' && <Card class="mb_10" v-if="(afterSale.serviceStatus == 'PASS' &&
afterSale.serviceType != 'RETURN_MONEY') || (afterSale.afterSaleAllowOperationVO && afterSale.afterSaleAllowOperationVO.cancel)"> afterSale.serviceType != 'RETURN_MONEY') || (afterSale.afterSaleAllowOperationVO && afterSale.afterSaleAllowOperationVO.cancel)">
<Button type="success" @click="openModal" v-if="afterSale.serviceStatus == 'PASS' && <Button type="success" @click="openModal" v-if="afterSale.serviceStatus == 'PASS' &&
afterSale.serviceType != 'RETURN_MONEY'" size="small">提交物流</Button> afterSale.serviceType != 'RETURN_MONEY'" size="small">提交物流</Button>&nbsp;
<Button type="error" @click="cancel(afterSale.sn)" v-if="afterSale.afterSaleAllowOperationVO && afterSale.afterSaleAllowOperationVO.cancel" size="small"></Button> <Button type="error" @click="cancel(afterSale.sn)" v-if="afterSale.afterSaleAllowOperationVO && afterSale.afterSaleAllowOperationVO.cancel" size="small"></Button>
</Card> </Card>
<div class="order-card"> <div class="order-card">

View File

@ -1473,6 +1473,22 @@ export default {
filterSkuInfo.forEach((skuInfo) => { filterSkuInfo.forEach((skuInfo) => {
totalLength *= skuInfo.spec_values.length; totalLength *= skuInfo.spec_values.length;
}); });
if ($index === 0) {
index = 1;
for (let i = 0; i < totalLength; i++) {
let find = cloneObj(this.skuTableData[index - 1]);
find[item.name] = "";
find.id = "";
find.price && (find.price = "");
find.sn && (find.sn = "");
find.cost && (find.cost = "");
find.quantity && (find.quantity = "");
find.weight && (find.weight = "");
this.skuTableData.splice(this.skuTableData.length, 0, find);
index ++;
}
} else {
for (let i = 0; i < totalLength; i++) { for (let i = 0; i < totalLength; i++) {
let find = cloneObj(this.skuTableData[index - 1]); let find = cloneObj(this.skuTableData[index - 1]);
find[item.name] = ""; find[item.name] = "";
@ -1484,7 +1500,8 @@ export default {
find.weight && (find.weight = ""); find.weight && (find.weight = "");
this.skuTableData.splice(index, 0, find); this.skuTableData.splice(index, 0, find);
index += beforeLength + 1; index += $index === 0 ? beforeLength : beforeLength + 1;
}
} }
} }
this.baseInfoForm.regeneratorSkuFlag = true; this.baseInfoForm.regeneratorSkuFlag = true;