|
@@ -44,6 +44,9 @@
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
<el-table-column label="档数" align="center" prop="tierCount" width="60"/>
|
|
<el-table-column label="档数" align="center" prop="tierCount" width="60"/>
|
|
|
|
|
+ <el-table-column label="阶梯类型" align="center" width="90">
|
|
|
|
|
+ <template slot-scope="scope">{{ scope.row.tierTypeLabel || (scope.row.tierType === 2 ? '折扣' : '金额') }}</template>
|
|
|
|
|
+ </el-table-column>
|
|
|
<el-table-column label="上不封顶" align="center" width="80">
|
|
<el-table-column label="上不封顶" align="center" width="80">
|
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
|
<el-tag size="mini" :type="scope.row.isCapped === 1 ? 'success' : 'info'">{{ scope.row.isCapped === 1 ? '是' : '否' }}</el-tag>
|
|
<el-tag size="mini" :type="scope.row.isCapped === 1 ? 'success' : 'info'">{{ scope.row.isCapped === 1 ? '是' : '否' }}</el-tag>
|
|
@@ -112,18 +115,51 @@
|
|
|
<span>满减阶梯</span>
|
|
<span>满减阶梯</span>
|
|
|
<el-button v-if="!tierLocked" style="float: right; padding: 3px 0" type="text" @click="addTier">+ 添加一档</el-button>
|
|
<el-button v-if="!tierLocked" style="float: right; padding: 3px 0" type="text" @click="addTier">+ 添加一档</el-button>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+ <el-form-item label="阶梯类型" prop="tierType">
|
|
|
|
|
+ <el-radio-group v-model="form.tierType" :disabled="tierLocked" @change="handleTierTypeChange">
|
|
|
|
|
+ <el-radio :label="1">金额</el-radio>
|
|
|
|
|
+ <el-radio :label="2">折扣</el-radio>
|
|
|
|
|
+ </el-radio-group>
|
|
|
|
|
+ <span class="tip-text">{{ form.tierType === 2 ? '满X件打Y折' : '满X元减Y元' }}</span>
|
|
|
|
|
+ </el-form-item>
|
|
|
<el-table :data="form.tiers" border size="mini">
|
|
<el-table :data="form.tiers" border size="mini">
|
|
|
<el-table-column label="档位" width="60" align="center">
|
|
<el-table-column label="档位" width="60" align="center">
|
|
|
<template slot-scope="scope">{{ scope.$index + 1 }}</template>
|
|
<template slot-scope="scope">{{ scope.$index + 1 }}</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
- <el-table-column label="满(元)" align="center">
|
|
|
|
|
|
|
+ <el-table-column :label="form.tierType === 2 ? '满(件)' : '满(元)'" align="center">
|
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
|
- <el-input-number v-model="scope.row.thresholdAmount" :min="0.01" :precision="2" :disabled="tierLocked" controls-position="right" style="width: 100%"/>
|
|
|
|
|
|
|
+ <el-input-number
|
|
|
|
|
+ v-model="scope.row.thresholdAmount"
|
|
|
|
|
+ :min="form.tierType === 2 ? 1 : 0.01"
|
|
|
|
|
+ :precision="form.tierType === 2 ? 0 : 2"
|
|
|
|
|
+ :disabled="tierLocked"
|
|
|
|
|
+ controls-position="right"
|
|
|
|
|
+ style="width: 100%"
|
|
|
|
|
+ />
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
- <el-table-column label="减(元)" align="center">
|
|
|
|
|
|
|
+ <el-table-column :label="form.tierType === 2 ? '折扣(折)' : '减(元)'" align="center">
|
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
|
- <el-input-number v-model="scope.row.discountAmount" :min="0.01" :precision="2" :disabled="tierLocked" controls-position="right" style="width: 100%"/>
|
|
|
|
|
|
|
+ <el-input-number
|
|
|
|
|
+ v-if="form.tierType === 2"
|
|
|
|
|
+ v-model="scope.row.discountAmount"
|
|
|
|
|
+ :min="0.1"
|
|
|
|
|
+ :max="9.9"
|
|
|
|
|
+ :step="0.1"
|
|
|
|
|
+ :precision="1"
|
|
|
|
|
+ :disabled="tierLocked"
|
|
|
|
|
+ controls-position="right"
|
|
|
|
|
+ style="width: 100%"
|
|
|
|
|
+ />
|
|
|
|
|
+ <el-input-number
|
|
|
|
|
+ v-else
|
|
|
|
|
+ v-model="scope.row.discountAmount"
|
|
|
|
|
+ :min="0.01"
|
|
|
|
|
+ :precision="2"
|
|
|
|
|
+ :disabled="tierLocked"
|
|
|
|
|
+ controls-position="right"
|
|
|
|
|
+ style="width: 100%"
|
|
|
|
|
+ />
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
<el-table-column label="操作" width="70" align="center" v-if="!tierLocked">
|
|
<el-table-column label="操作" width="70" align="center" v-if="!tierLocked">
|
|
@@ -132,7 +168,7 @@
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
</el-table>
|
|
</el-table>
|
|
|
- <el-form-item label="上不封顶" style="margin-top: 12px">
|
|
|
|
|
|
|
+ <el-form-item v-if="form.tierType === 1" label="上不封顶" style="margin-top: 12px">
|
|
|
<el-switch v-model="form.isCapped" :active-value="1" :inactive-value="0"/>
|
|
<el-switch v-model="form.isCapped" :active-value="1" :inactive-value="0"/>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-card>
|
|
</el-card>
|
|
@@ -193,19 +229,24 @@
|
|
|
<el-descriptions-item label="状态">{{ detail.displayStatusLabel }}</el-descriptions-item>
|
|
<el-descriptions-item label="状态">{{ detail.displayStatusLabel }}</el-descriptions-item>
|
|
|
<el-descriptions-item label="开始时间">{{ parseTime(detail.startTime) }}</el-descriptions-item>
|
|
<el-descriptions-item label="开始时间">{{ parseTime(detail.startTime) }}</el-descriptions-item>
|
|
|
<el-descriptions-item label="结束时间">{{ parseTime(detail.endTime) }}</el-descriptions-item>
|
|
<el-descriptions-item label="结束时间">{{ parseTime(detail.endTime) }}</el-descriptions-item>
|
|
|
|
|
+ <el-descriptions-item label="阶梯类型">{{ detail.tierTypeLabel || (detail.tierType === 2 ? '折扣' : '金额') }}</el-descriptions-item>
|
|
|
<el-descriptions-item label="适用范围">{{ detail.scopeTypeLabel }}</el-descriptions-item>
|
|
<el-descriptions-item label="适用范围">{{ detail.scopeTypeLabel }}</el-descriptions-item>
|
|
|
<el-descriptions-item label="每人限次">{{ detail.limitPerUser === 0 ? '不限' : detail.limitPerUser }}</el-descriptions-item>
|
|
<el-descriptions-item label="每人限次">{{ detail.limitPerUser === 0 ? '不限' : detail.limitPerUser }}</el-descriptions-item>
|
|
|
- <el-descriptions-item label="上不封顶">{{ detail.isCapped === 1 ? '是' : '否' }}</el-descriptions-item>
|
|
|
|
|
|
|
+ <el-descriptions-item label="上不封顶">{{ detail.tierType === 2 ? '-' : (detail.isCapped === 1 ? '是' : '否') }}</el-descriptions-item>
|
|
|
<el-descriptions-item label="叠加优惠券">{{ detail.isStackable === 1 ? '是' : '否' }}</el-descriptions-item>
|
|
<el-descriptions-item label="叠加优惠券">{{ detail.isStackable === 1 ? '是' : '否' }}</el-descriptions-item>
|
|
|
<el-descriptions-item v-if="detail.remark" label="备注" :span="2">{{ detail.remark }}</el-descriptions-item>
|
|
<el-descriptions-item v-if="detail.remark" label="备注" :span="2">{{ detail.remark }}</el-descriptions-item>
|
|
|
</el-descriptions>
|
|
</el-descriptions>
|
|
|
|
|
|
|
|
<div v-if="detail && detail.tiers && detail.tiers.length" class="detail-block">
|
|
<div v-if="detail && detail.tiers && detail.tiers.length" class="detail-block">
|
|
|
- <div class="detail-block-title">满减阶梯</div>
|
|
|
|
|
|
|
+ <div class="detail-block-title">{{ detail.tierType === 2 ? '折扣阶梯' : '满减阶梯' }}</div>
|
|
|
<el-table :data="detail.tiers" border size="mini">
|
|
<el-table :data="detail.tiers" border size="mini">
|
|
|
<el-table-column label="档位" prop="sortOrder" width="60" align="center"/>
|
|
<el-table-column label="档位" prop="sortOrder" width="60" align="center"/>
|
|
|
- <el-table-column label="满(元)" prop="thresholdAmount" align="center"/>
|
|
|
|
|
- <el-table-column label="减(元)" prop="discountAmount" align="center"/>
|
|
|
|
|
|
|
+ <el-table-column :label="detail.tierType === 2 ? '满(件)' : '满(元)'" prop="thresholdAmount" align="center"/>
|
|
|
|
|
+ <el-table-column :label="detail.tierType === 2 ? '折扣(折)' : '减(元)'" align="center">
|
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
|
+ {{ formatTierDiscountValue(scope.row.discountAmount, detail.tierType) }}
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
</el-table>
|
|
</el-table>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
@@ -292,7 +333,8 @@ export default {
|
|
|
storeId: [{ required: true, message: '请选择店铺', trigger: 'change' }],
|
|
storeId: [{ required: true, message: '请选择店铺', trigger: 'change' }],
|
|
|
startTime: [{ required: true, message: '请选择开始时间', trigger: 'change' }],
|
|
startTime: [{ required: true, message: '请选择开始时间', trigger: 'change' }],
|
|
|
endTime: [{ required: true, message: '请选择结束时间', trigger: 'change' }],
|
|
endTime: [{ required: true, message: '请选择结束时间', trigger: 'change' }],
|
|
|
- scopeType: [{ required: true, message: '请选择适用类型', trigger: 'change' }]
|
|
|
|
|
|
|
+ scopeType: [{ required: true, message: '请选择适用类型', trigger: 'change' }],
|
|
|
|
|
+ tierType: [{ required: true, message: '请选择阶梯类型', trigger: 'change' }]
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
@@ -321,6 +363,27 @@ export default {
|
|
|
if (!time) return ''
|
|
if (!time) return ''
|
|
|
return time
|
|
return time
|
|
|
},
|
|
},
|
|
|
|
|
+ formatTierDiscountValue(value, tierType) {
|
|
|
|
|
+ if (value == null || value === '') {
|
|
|
|
|
+ return '-'
|
|
|
|
|
+ }
|
|
|
|
|
+ return Number(tierType) === 2 ? value + '折' : value
|
|
|
|
|
+ },
|
|
|
|
|
+ getDefaultTiers(tierType) {
|
|
|
|
|
+ if (Number(tierType) === 2) {
|
|
|
|
|
+ return [{ sortOrder: 1, thresholdAmount: 3, discountAmount: 9.5 }]
|
|
|
|
|
+ }
|
|
|
|
|
+ return [{ sortOrder: 1, thresholdAmount: 199, discountAmount: 30 }]
|
|
|
|
|
+ },
|
|
|
|
|
+ handleTierTypeChange() {
|
|
|
|
|
+ if (this.tierLocked) {
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ this.form.tiers = this.getDefaultTiers(this.form.tierType)
|
|
|
|
|
+ if (Number(this.form.tierType) === 2) {
|
|
|
|
|
+ this.form.isCapped = 0
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
displayStatusTag(status) {
|
|
displayStatusTag(status) {
|
|
|
const map = { 0: 'info', 1: 'warning', 2: 'success', 3: 'info', 4: 'danger' }
|
|
const map = { 0: 'info', 1: 'warning', 2: 'success', 3: 'info', 4: 'danger' }
|
|
|
return map[status] || 'info'
|
|
return map[status] || 'info'
|
|
@@ -468,12 +531,13 @@ export default {
|
|
|
startTime: null,
|
|
startTime: null,
|
|
|
endTime: null,
|
|
endTime: null,
|
|
|
scopeType: 1,
|
|
scopeType: 1,
|
|
|
|
|
+ tierType: 1,
|
|
|
scopeIds: [],
|
|
scopeIds: [],
|
|
|
isStackable: 1,
|
|
isStackable: 1,
|
|
|
isCapped: 0,
|
|
isCapped: 0,
|
|
|
limitPerUser: 0,
|
|
limitPerUser: 0,
|
|
|
remark: null,
|
|
remark: null,
|
|
|
- tiers: [{ sortOrder: 1, thresholdAmount: 199, discountAmount: 30 }]
|
|
|
|
|
|
|
+ tiers: this.getDefaultTiers(1)
|
|
|
}
|
|
}
|
|
|
this.activeEditing = false
|
|
this.activeEditing = false
|
|
|
this.productOptions = []
|
|
this.productOptions = []
|
|
@@ -504,6 +568,7 @@ export default {
|
|
|
startTime: data.startTime,
|
|
startTime: data.startTime,
|
|
|
endTime: data.endTime,
|
|
endTime: data.endTime,
|
|
|
scopeType: data.scopeType,
|
|
scopeType: data.scopeType,
|
|
|
|
|
+ tierType: data.tierType == null ? 1 : data.tierType,
|
|
|
scopeIds: data.scopeIds || [],
|
|
scopeIds: data.scopeIds || [],
|
|
|
isStackable: data.isStackable,
|
|
isStackable: data.isStackable,
|
|
|
isCapped: data.isCapped,
|
|
isCapped: data.isCapped,
|
|
@@ -513,7 +578,7 @@ export default {
|
|
|
sortOrder: t.sortOrder,
|
|
sortOrder: t.sortOrder,
|
|
|
thresholdAmount: t.thresholdAmount,
|
|
thresholdAmount: t.thresholdAmount,
|
|
|
discountAmount: t.discountAmount
|
|
discountAmount: t.discountAmount
|
|
|
- })) : [{ sortOrder: 1, thresholdAmount: 199, discountAmount: 30 }]
|
|
|
|
|
|
|
+ })) : this.getDefaultTiers(data.tierType == null ? 1 : data.tierType)
|
|
|
}
|
|
}
|
|
|
this.activeEditing = data.displayStatus === 2
|
|
this.activeEditing = data.displayStatus === 2
|
|
|
if (data.scopeType === 3 && data.scopeProducts && data.scopeProducts.length) {
|
|
if (data.scopeType === 3 && data.scopeProducts && data.scopeProducts.length) {
|
|
@@ -544,6 +609,14 @@ export default {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
const last = this.form.tiers[this.form.tiers.length - 1]
|
|
const last = this.form.tiers[this.form.tiers.length - 1]
|
|
|
|
|
+ if (Number(this.form.tierType) === 2) {
|
|
|
|
|
+ this.form.tiers.push({
|
|
|
|
|
+ sortOrder: this.form.tiers.length + 1,
|
|
|
|
|
+ thresholdAmount: last ? Number(last.thresholdAmount) + 1 : 3,
|
|
|
|
|
+ discountAmount: last ? Math.max(Number(last.discountAmount) - 0.5, 0.1) : 9.5
|
|
|
|
|
+ })
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
this.form.tiers.push({
|
|
this.form.tiers.push({
|
|
|
sortOrder: this.form.tiers.length + 1,
|
|
sortOrder: this.form.tiers.length + 1,
|
|
|
thresholdAmount: last ? Number(last.thresholdAmount) + 100 : 100,
|
|
thresholdAmount: last ? Number(last.thresholdAmount) + 100 : 100,
|