|
@@ -45,6 +45,7 @@
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<div style="text-align: center">
|
|
|
+ <el-button :disabled="form.rewordList.length <= 1" class="add-reword" round icon="el-icon-minus" @click="onRemoveReword">删除奖品</el-button>
|
|
|
<el-button class="add-reword" round icon="el-icon-plus" @click="onAddReword">添加奖品</el-button>
|
|
|
</div>
|
|
|
<el-form-item label="备注" label-width="100PX"
|
|
@@ -65,13 +66,15 @@
|
|
|
import Tooltip from '@/components/Tooltip/index'
|
|
|
import pagination from "@/components/Pagination/index";
|
|
|
import dayjs from 'dayjs';
|
|
|
+import numeral from 'numeral';
|
|
|
import cleanDeep from 'clean-deep';
|
|
|
import { luckDrawPrizeBatchAdd } from './api'
|
|
|
const validNumber1 = (rule, value, callback) => {
|
|
|
+ const re = /^[0-9]+$/
|
|
|
if (value == '' && typeof value == 'string' || value == null) {
|
|
|
callback(new Error('请输入库存'))
|
|
|
- } else if (value < 0) {
|
|
|
- callback(new Error('输入值不能小于0'))
|
|
|
+ } else if (!re.test(value) && value < 0) {
|
|
|
+ callback(new Error('输入库存为正整数'))
|
|
|
} else {
|
|
|
callback()
|
|
|
}
|
|
@@ -117,6 +120,13 @@ export default {
|
|
|
mounted () {
|
|
|
},
|
|
|
methods: {
|
|
|
+ onRemoveReword() { // 删除奖品
|
|
|
+ let form = this.form
|
|
|
+ if(form.rewordList.length <= 1) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.form.rewordList.pop()
|
|
|
+ },
|
|
|
onAddReword() { // 添加奖品
|
|
|
let form = this.form
|
|
|
form.rewordList.push({
|
|
@@ -137,7 +147,7 @@ export default {
|
|
|
params.push({
|
|
|
name: item.name,
|
|
|
groupId: form.groupId,
|
|
|
- chances: item.chances ? item.chances / 100 : 0,
|
|
|
+ chances: numeral(item.chances ? item.chances / 100 : 0).format('0.00'),
|
|
|
stock: item.stock,
|
|
|
memo: form.memo,
|
|
|
enabled: 1
|
|
@@ -184,7 +194,7 @@ export default {
|
|
|
|
|
|
.add-reword {
|
|
|
margin-bottom: 22px;
|
|
|
- width: 250px;
|
|
|
+ width: 180px;
|
|
|
border-style: dashed;
|
|
|
}
|
|
|
</style>
|