|
@@ -68,13 +68,41 @@
|
|
|
<el-table-column label="课程" prop="courseName" align="center" />
|
|
<el-table-column label="课程" prop="courseName" align="center" />
|
|
|
<el-table-column label="小节" prop="videoName" align="center" />
|
|
<el-table-column label="小节" prop="videoName" align="center" />
|
|
|
<el-table-column label="营期日期" prop="dayDate" align="center"/>
|
|
<el-table-column label="营期日期" prop="dayDate" align="center"/>
|
|
|
- <el-table-column label="红包金额" width="200px" align="center">
|
|
|
|
|
|
|
+ <el-table-column label="小程序红包金额" width="200px" align="center">
|
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
|
<el-input-number
|
|
<el-input-number
|
|
|
v-model="scope.row.amount"
|
|
v-model="scope.row.amount"
|
|
|
:min="0.0"
|
|
:min="0.0"
|
|
|
:precision="2"
|
|
:precision="2"
|
|
|
- :step="0.01"
|
|
|
|
|
|
|
+ :step="0.1"
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ style="width: 150px"
|
|
|
|
|
+ >
|
|
|
|
|
+ <template slot="append">元</template>
|
|
|
|
|
+ </el-input-number>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="APP红包金额" width="200px" align="center">
|
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
|
+ <el-input-number
|
|
|
|
|
+ v-model="scope.row.appAmount"
|
|
|
|
|
+ :min="0.0"
|
|
|
|
|
+ :precision="2"
|
|
|
|
|
+ :step="0.1"
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ style="width: 150px"
|
|
|
|
|
+ >
|
|
|
|
|
+ <template slot="append">元</template>
|
|
|
|
|
+ </el-input-number>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="H5红包金额" width="200px" align="center">
|
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
|
+ <el-input-number
|
|
|
|
|
+ v-model="scope.row.h5Amount"
|
|
|
|
|
+ :min="0.0"
|
|
|
|
|
+ :precision="2"
|
|
|
|
|
+ :step="0.1"
|
|
|
size="small"
|
|
size="small"
|
|
|
style="width: 150px"
|
|
style="width: 150px"
|
|
|
>
|
|
>
|
|
@@ -90,21 +118,46 @@
|
|
|
</el-dialog>
|
|
</el-dialog>
|
|
|
|
|
|
|
|
<!-- 课程红包设置弹窗 -->
|
|
<!-- 课程红包设置弹窗 -->
|
|
|
- <el-dialog title="设置红包金额" :visible.sync="batchRedPacketDialog.visible" width="400px" append-to-body>
|
|
|
|
|
- <el-form ref="batchRedPacketForm" :model="batchRedPacketDialog.form" label-width="100px">
|
|
|
|
|
- <el-form-item label="红包金额" prop="amount" :rules="{required: true, message: '红包金额不能为空', trigger: 'blur'}">
|
|
|
|
|
|
|
+ <el-dialog title="设置红包金额" :visible.sync="batchRedPacketDialog.visible" width="500px" append-to-body>
|
|
|
|
|
+ <el-form ref="batchRedPacketForm" :model="batchRedPacketDialog.form" label-width="120px">
|
|
|
|
|
+ <el-form-item label="小程序红包金额" prop="amount" :rules="{required: true, message: '红包金额不能为空', trigger: 'blur'}">
|
|
|
<div style="display: inline-flex; align-items: center">
|
|
<div style="display: inline-flex; align-items: center">
|
|
|
<el-input-number
|
|
<el-input-number
|
|
|
v-model="batchRedPacketDialog.form.amount"
|
|
v-model="batchRedPacketDialog.form.amount"
|
|
|
- :min="0.1"
|
|
|
|
|
|
|
+ :min="0.0"
|
|
|
|
|
+ :precision="2"
|
|
|
|
|
+ :step="0.1"
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ >
|
|
|
|
|
+ </el-input-number>
|
|
|
|
|
+ <span style="margin-left: 10px">元</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="APP红包金额" prop="appAmount" :rules="{required: true, message: '红包金额不能为空', trigger: 'blur'}">
|
|
|
|
|
+ <div style="display: inline-flex; align-items: center">
|
|
|
|
|
+ <el-input-number
|
|
|
|
|
+ v-model="batchRedPacketDialog.form.appAmount"
|
|
|
|
|
+ :min="0.0"
|
|
|
:precision="2"
|
|
:precision="2"
|
|
|
- :step="0.01"
|
|
|
|
|
|
|
+ :step="0.1"
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ >
|
|
|
|
|
+ </el-input-number>
|
|
|
|
|
+ <span style="margin-left: 10px">元</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="H5红包金额" prop="h5Amount" :rules="{required: true, message: '红包金额不能为空', trigger: 'blur'}">
|
|
|
|
|
+ <div style="display: inline-flex; align-items: center">
|
|
|
|
|
+ <el-input-number
|
|
|
|
|
+ v-model="batchRedPacketDialog.form.h5Amount"
|
|
|
|
|
+ :min="0.0"
|
|
|
|
|
+ :precision="2"
|
|
|
|
|
+ :step="0.1"
|
|
|
size="small"
|
|
size="small"
|
|
|
>
|
|
>
|
|
|
</el-input-number>
|
|
</el-input-number>
|
|
|
<span style="margin-left: 10px">元</span>
|
|
<span style="margin-left: 10px">元</span>
|
|
|
</div>
|
|
</div>
|
|
|
- <div style="color: rgba(169,88,18,0.9)">金额低于0.1元将自动置为0.1元</div>
|
|
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-form>
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
<div slot="footer" class="dialog-footer">
|
|
@@ -165,7 +218,9 @@ export default {
|
|
|
batchRedPacketDialog: {
|
|
batchRedPacketDialog: {
|
|
|
visible: false,
|
|
visible: false,
|
|
|
form: {
|
|
form: {
|
|
|
- amount: 0.1
|
|
|
|
|
|
|
+ amount: 0.0,
|
|
|
|
|
+ appAmount: 0.0,
|
|
|
|
|
+ h5Amount: 0.0
|
|
|
},
|
|
},
|
|
|
saveLoading: false,
|
|
saveLoading: false,
|
|
|
}
|
|
}
|
|
@@ -254,35 +309,62 @@ export default {
|
|
|
},
|
|
},
|
|
|
// 获取课程列表
|
|
// 获取课程列表
|
|
|
getCourseList() {
|
|
getCourseList() {
|
|
|
|
|
+ this.redPacketList = []
|
|
|
getPeriodRedPacketList({
|
|
getPeriodRedPacketList({
|
|
|
periodId: this.periodId,
|
|
periodId: this.periodId,
|
|
|
companyId: this.currentCompany.companyId
|
|
companyId: this.currentCompany.companyId
|
|
|
}).then(response => {
|
|
}).then(response => {
|
|
|
this.redPacketList = (response.data || []).map(item => ({
|
|
this.redPacketList = (response.data || []).map(item => ({
|
|
|
...item,
|
|
...item,
|
|
|
- amount:item.amount ?? 0.1
|
|
|
|
|
|
|
+ amount:item.amount ?? 0,
|
|
|
|
|
+ appAmount: item.appAmount ?? 0,
|
|
|
|
|
+ h5Amount: item.h5Amount ?? 0,
|
|
|
}));
|
|
}));
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
// 保存红包金额
|
|
// 保存红包金额
|
|
|
handleSave() {
|
|
handleSave() {
|
|
|
// 筛选出有金额的项目
|
|
// 筛选出有金额的项目
|
|
|
- const validAmountItems = this.redPacketList.filter(item => item.amount >= 0);
|
|
|
|
|
|
|
+ const validAmountItems = this.redPacketList.filter(item =>
|
|
|
|
|
+ item.amount >= 0 || item.appAmount >= 0 || item.h5Amount >= 0
|
|
|
|
|
+ );
|
|
|
if (validAmountItems.length === 0) {
|
|
if (validAmountItems.length === 0) {
|
|
|
this.$message.warning('请至少设置一个红包金额');
|
|
this.$message.warning('请至少设置一个红包金额');
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 验证金额范围
|
|
|
|
|
- const invalidItems = validAmountItems.filter(item => item.amount < 0.0);
|
|
|
|
|
- if (invalidItems.length > 0) {
|
|
|
|
|
- this.$message.error('红包金额需要大于等于0元');
|
|
|
|
|
|
|
+ // 验证金额范围 - amount
|
|
|
|
|
+ const invalidAmountItems = validAmountItems.filter(item =>
|
|
|
|
|
+ item.amount < 0 || (item.amount > 0 && item.amount < 0.1)
|
|
|
|
|
+ );
|
|
|
|
|
+ if (invalidAmountItems.length > 0) {
|
|
|
|
|
+ this.$message.error('小程序红包金额需要等于0元或者大于等于0.1元');
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 验证金额范围 - appAmount
|
|
|
|
|
+ const invalidAppAmountItems = validAmountItems.filter(item =>
|
|
|
|
|
+ item.appAmount < 0 || (item.appAmount > 0 && item.appAmount < 0.1)
|
|
|
|
|
+ );
|
|
|
|
|
+ if (invalidAppAmountItems.length > 0) {
|
|
|
|
|
+ this.$message.error('APP红包金额需要等于0元或者大于等于0.1元');
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 验证金额范围 - h5Amount
|
|
|
|
|
+ const invalidH5AmountItems = validAmountItems.filter(item =>
|
|
|
|
|
+ item.h5Amount < 0 || (item.h5Amount > 0 && item.h5Amount < 0.1)
|
|
|
|
|
+ );
|
|
|
|
|
+ if (invalidH5AmountItems.length > 0) {
|
|
|
|
|
+ this.$message.error('H5红包金额需要等于0元或者大于等于0.1元');
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const saveData = validAmountItems.map(item => ({
|
|
const saveData = validAmountItems.map(item => ({
|
|
|
companyId: this.currentCompany.companyId,
|
|
companyId: this.currentCompany.companyId,
|
|
|
redPacketMoney: item.amount,
|
|
redPacketMoney: item.amount,
|
|
|
|
|
+ redPacketMoneyApp: item.appAmount,
|
|
|
|
|
+ redPacketMoneyH5: item.h5Amount,
|
|
|
videoId: item.videoId,
|
|
videoId: item.videoId,
|
|
|
periodId: this.periodId,
|
|
periodId: this.periodId,
|
|
|
dataType: 2
|
|
dataType: 2
|
|
@@ -318,12 +400,36 @@ export default {
|
|
|
this.$message.warning('请填写正确的红包金额')
|
|
this.$message.warning('请填写正确的红包金额')
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ // 验证金额范围
|
|
|
|
|
+ const { amount, appAmount, h5Amount } = this.batchRedPacketDialog.form;
|
|
|
|
|
+
|
|
|
|
|
+ // 验证小程序红包金额
|
|
|
|
|
+ if (amount < 0 || (amount > 0 && amount < 0.1)) {
|
|
|
|
|
+ this.$message.error('小程序红包金额需要等于0元或者大于等于0.1元');
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 验证APP红包金额
|
|
|
|
|
+ if (appAmount < 0 || (appAmount > 0 && appAmount < 0.1)) {
|
|
|
|
|
+ this.$message.error('APP红包金额需要等于0元或者大于等于0.1元');
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 验证H5红包金额
|
|
|
|
|
+ if (h5Amount < 0 || (h5Amount > 0 && h5Amount < 0.1)) {
|
|
|
|
|
+ this.$message.error('H5红包金额需要等于0元或者大于等于0.1元');
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
this.batchRedPacketDialog.saveLoading = true
|
|
this.batchRedPacketDialog.saveLoading = true
|
|
|
|
|
|
|
|
const saveData = {
|
|
const saveData = {
|
|
|
periodId: this.periodId,
|
|
periodId: this.periodId,
|
|
|
companyIds: this.selectCompanyIds,
|
|
companyIds: this.selectCompanyIds,
|
|
|
- redPacketMoney: this.batchRedPacketDialog.form.amount
|
|
|
|
|
|
|
+ redPacketMoney: this.batchRedPacketDialog.form.amount,
|
|
|
|
|
+ redPacketMoneyApp: this.batchRedPacketDialog.form.appAmount,
|
|
|
|
|
+ redPacketMoneyH5: this.batchRedPacketDialog.form.h5Amount,
|
|
|
}
|
|
}
|
|
|
batchSaveRedPacketByCompany(saveData).then(response => {
|
|
batchSaveRedPacketByCompany(saveData).then(response => {
|
|
|
const {code, msg} = response
|
|
const {code, msg} = response
|