修改在已有秒杀商品情况下添加新的秒杀商品 数据保存错误问题
parent
f33efac045
commit
db919a57f3
|
@ -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>
|
||||
|
@ -126,14 +128,15 @@
|
|||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import {
|
||||
import {
|
||||
seckillGoodsList,
|
||||
seckillDetail,
|
||||
setSeckillGoods,
|
||||
delSeckillGoods
|
||||
} from "@/api/promotion.js";
|
||||
import skuSelect from "@/views/lili-dialog";
|
||||
export default {
|
||||
} 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,12 +334,32 @@ 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.$nextTick(() => {
|
||||
this.$forceUpdate()
|
||||
})
|
||||
},
|
||||
|
@ -384,21 +411,22 @@ export default {
|
|||
this.init();
|
||||
},
|
||||
// 如果是从详情页返回列表页,修改列表页keepAlive为true,确保不刷新页面
|
||||
beforeRouteLeave(to, from, next){
|
||||
if(to.name === 'seckill') {
|
||||
beforeRouteLeave(to, from, next) {
|
||||
if (to.name === 'seckill') {
|
||||
to.meta.keepAlive = true
|
||||
}
|
||||
next()
|
||||
}
|
||||
};
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.operation {
|
||||
.operation {
|
||||
margin: 10px 0;
|
||||
}
|
||||
.reason {
|
||||
}
|
||||
|
||||
.reason {
|
||||
cursor: pointer;
|
||||
color: #2d8cf0;
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
Loading…
Reference in New Issue