修改在已有秒杀商品情况下添加新的秒杀商品 数据保存错误问题

master
pikachu 2021-08-16 19:54:18 +08:00
parent f33efac045
commit db919a57f3
1 changed files with 293 additions and 265 deletions

View File

@ -99,7 +99,8 @@
size="small"
ghost
@click="delGoods(index, row)"
>删除</Button
>删除
</Button
>
</template>
</Table>
@ -114,7 +115,8 @@
:loading="submitLoading"
v-if="promotionStatus === 'NEW'"
@click="save"
>提交</Button
>提交
</Button
>
</Row>
</Card>
@ -133,6 +135,7 @@ import {
delSeckillGoods
} from "@/api/promotion.js";
import skuSelect from "@/views/lili-dialog";
export default {
components: {
skuSelect,
@ -218,6 +221,8 @@ export default {
save() {
let list = JSON.parse(JSON.stringify(this.goodsList));
console.warn(list)
let params = {
seckillId: this.$route.query.id,
applyVos: [],
@ -229,6 +234,9 @@ export default {
});
});
this.submitLoading = true;
console.log(list)
setSeckillGoods(params).then((res) => {
this.submitLoading = false;
if (res && res.success) {
@ -313,10 +321,9 @@ export default {
},
selectedGoodsData(item) {
//
let list = [];
console.log(item);
item.forEach((e) => {
list.push({
if(this.goodsList[this.tabIndex].list.length == 0){
this.goodsList[this.tabIndex].list.push({
goodsName: e.goodsName,
price: e.price,
originalPrice: e.price,
@ -327,11 +334,31 @@ export default {
storeName: e.storeName,
skuId: e.id,
timeLine: this.data[0].hours.split(",")[this.tabIndex],
});
});
}else{
this.goodsList[this.tabIndex].list.forEach(goods => {
if (e.id != goods.skuId) {
this.goodsList[this.tabIndex].list.push(
{
goodsName: e.goodsName,
price: e.price,
originalPrice: e.price,
promotionApplyStatus: e.promotionApplyStatus || '',
quantity: e.quantity,
seckillId: this.$route.query.id,
storeId: e.storeId,
storeName: e.storeName,
skuId: e.id,
timeLine: this.data[0].hours.split(",")[this.tabIndex],
}
)
}
})
}
})
this.goodsList[this.tabIndex].list = list;
this.$nextTick(() => {
this.$forceUpdate()
})
@ -396,6 +423,7 @@ export default {
.operation {
margin: 10px 0;
}
.reason {
cursor: pointer;
color: #2d8cf0;