适配重构促销

This commit is contained in:
paulGao
2021-12-11 13:50:58 +08:00
parent fd1d32d431
commit edef393535
40 changed files with 2532 additions and 1486 deletions

View File

@@ -18,45 +18,90 @@
</Row>
<Row class="operation">
<Tabs type="card" v-model="tabCurrent">
<TabPane v-for="(tab, tabIndex) in goodsList" :key="tabIndex" :label="tab.hour" :name="tabIndex + ''">
<Table :loading="loading" border :columns="goodsColumns" v-if="tabIndex == tabCurrent" :data="tab.list" :ref="'table' + tabIndex"
@on-selection-change="changeSelect">
<TabPane
v-for="(tab, tabIndex) in goodsList"
:key="tabIndex"
:label="tab.hour"
:name="tabIndex + ''"
>
<Table
:loading="loading"
border
:columns="goodsColumns"
v-if="tabIndex == tabCurrent"
:data="tab.list"
:ref="'table' + tabIndex"
@on-selection-change="changeSelect"
>
<template slot-scope="{ row }" slot="originalPrice">
<div>{{ row.originalPrice | unitPrice("¥") }}</div>
</template>
<template slot-scope="{ row, index }" slot="quantity">
<InputNumber :min="0" v-model="row.quantity" :disabled="row.promotionApplyStatus == 'PASS'" @input="
goodsList[tabIndex].list[index].quantity = row.quantity
" />
<InputNumber
:min="0"
v-model="row.quantity"
:disabled="row.promotionApplyStatus == 'PASS'"
@input="goodsList[tabIndex].list[index].quantity = row.quantity"
/>
</template>
<template slot-scope="{ row, index }" slot="price">
<InputNumber :min="0" style="width:100%;" v-model="row.price" :disabled="row.promotionApplyStatus == 'PASS'"
@input="goodsList[tabIndex].list[index].price = row.price" />
<InputNumber
:min="0"
style="width: 100%"
v-model="row.price"
:disabled="row.promotionApplyStatus == 'PASS'"
@input="goodsList[tabIndex].list[index].price = row.price"
/>
</template>
<template slot-scope="{ row }" slot="promotionApplyStatus">
<Badge status="success" v-if="row.promotionApplyStatus == 'PASS'"
:text="promotionApplyStatus(row.promotionApplyStatus)" />
<Badge status="blue" v-if="row.promotionApplyStatus == 'APPLY'"
:text="promotionApplyStatus(row.promotionApplyStatus)" />
<Badge status="error" v-if="row.promotionApplyStatus == 'REFUSE'"
:text="promotionApplyStatus(row.promotionApplyStatus)" />
<span v-if="row.promotionApplyStatus == 'REFUSE'" @click="showReason(row.failReason)"
class="reason">拒绝原因</span>
<Badge status="error" v-if="row.promotionApplyStatus == ''"
:text="promotionApplyStatus(row.promotionApplyStatus)" />
<Badge
status="success"
v-if="row.promotionApplyStatus == 'PASS'"
:text="promotionApplyStatus(row.promotionApplyStatus)"
/>
<Badge
status="blue"
v-if="row.promotionApplyStatus == 'APPLY'"
:text="promotionApplyStatus(row.promotionApplyStatus)"
/>
<Badge
status="error"
v-if="row.promotionApplyStatus == 'REFUSE'"
:text="promotionApplyStatus(row.promotionApplyStatus)"
/>
<span
v-if="row.promotionApplyStatus == 'REFUSE'"
@click="showReason(row.failReason)"
class="reason"
>拒绝原因</span
>
<Badge
status="error"
v-if="row.promotionApplyStatus == ''"
:text="promotionApplyStatus(row.promotionApplyStatus)"
/>
</template>
<template slot-scope="{ row }" slot="QRCode">
<img v-if="row.QRCode" :src="row.QRCode || '../../../assets/lili.png'" width="50px" height="50px"
alt="" />
<img
v-if="row.QRCode"
:src="row.QRCode || '../../../assets/lili.png'"
width="50px"
height="50px"
alt=""
/>
</template>
<template slot-scope="{ row, index }" slot="action">
<Button type="error" v-if="promotionStatus === 'NEW'" size="small" ghost
@click="delGoods(index, row)">删除
<Button
type="error"
v-if="promotionStatus === 'NEW'"
size="small"
ghost
@click="delGoods(index, row)"
>删除
</Button>
</template>
</Table>
@@ -66,7 +111,12 @@
<Row class="operation">
<Button @click="closeCurrentPage">返回</Button>
<Button type="primary" :loading="submitLoading" v-if="promotionStatus === 'NEW'" @click="save">提交
<Button
type="primary"
:loading="submitLoading"
v-if="promotionStatus === 'NEW'"
@click="save"
>提交
</Button>
</Row>
</Card>
@@ -87,14 +137,14 @@ export default {
components: {
skuSelect,
},
watch:{
tabCurrent(val){
this.tabIndex = val
}
watch: {
tabCurrent(val) {
this.tabIndex = val;
},
},
data() {
return {
tabCurrent:0,
tabCurrent: 0,
promotionStatus: "", //
loading: false, //
searchForm: {
@@ -292,10 +342,9 @@ export default {
});
});
this.$set(this.goodsList[this.tabIndex], "list", [
...way,
...this.defaultGoodsList,
// ...this.defaultGoodsList,
]);
// this.$nextTick(() => {
// this.$forceUpdate();
@@ -305,14 +354,11 @@ export default {
//
this.$refs.skuSelect.open("goods");
this.$refs.skuSelect.selectedWay = [];
console.warn(this.goodsList[this.tabIndex].list);
let data = this.goodsList[this.tabIndex].list;
data.forEach((e) => {
e.id = e.skuId;
});
this.$refs.skuSelect.selectedWay = data;
console.log(this.$refs.skuSelect.selectedWay);
this.$refs.skuSelect.goodsData = data;
},
unixDate(time) {
//