|
@@ -64,7 +64,6 @@
|
|
|
<el-form-item
|
|
|
label="每包张数"
|
|
|
prop="pkgUnit"
|
|
|
- v-if="form.type == 'offline'"
|
|
|
>
|
|
|
<el-input
|
|
|
v-model="form.pkgUnit"
|
|
@@ -128,7 +127,7 @@
|
|
|
<el-table-column label="奖品类型">
|
|
|
<template slot-scope="scope">
|
|
|
<div v-if="scope.row.prizeType == 'goods'">商品</div>
|
|
|
- <div v-if="scope.row.prizeType == 'coupon'">代金券</div>
|
|
|
+ <div v-if="scope.row.prizeType == 'coupon'">券</div>
|
|
|
<div v-if="scope.row.prizeType == 'coin'">盲豆</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
@@ -140,7 +139,6 @@
|
|
|
controls-position="right"
|
|
|
@change="handleChange($event, index)"
|
|
|
:min="1"
|
|
|
- :max="100"
|
|
|
size="small"
|
|
|
></el-input-number>
|
|
|
</div>
|
|
@@ -165,7 +163,7 @@
|
|
|
</el-button>
|
|
|
<el-dropdown-menu slot="dropdown">
|
|
|
<el-dropdown-item command="goods">商品</el-dropdown-item>
|
|
|
- <el-dropdown-item command="coupon">代金券</el-dropdown-item>
|
|
|
+ <el-dropdown-item command="coupon">券</el-dropdown-item>
|
|
|
<el-dropdown-item command="coin">盲豆</el-dropdown-item>
|
|
|
</el-dropdown-menu>
|
|
|
</el-dropdown>
|
|
@@ -192,7 +190,7 @@
|
|
|
<div>商品名称:</div>
|
|
|
<el-input
|
|
|
v-model="goodsTitle"
|
|
|
- placeholder="请输入盲票组名称"
|
|
|
+ placeholder="请输入商品名称"
|
|
|
clearable
|
|
|
size="small"
|
|
|
style="width: 240px"
|
|
@@ -258,16 +256,16 @@
|
|
|
</el-dialog>
|
|
|
<!-- 添加卡券 -->
|
|
|
<el-dialog
|
|
|
- title="添加代金券奖品"
|
|
|
+ title="添加券奖品"
|
|
|
width="1000px"
|
|
|
:visible.sync="couponTableVisible"
|
|
|
:before-close="close"
|
|
|
>
|
|
|
<div class="dialog-search">
|
|
|
- <div>代金券名称:</div>
|
|
|
+ <div>券名称:</div>
|
|
|
<el-input
|
|
|
v-model="couponTitle"
|
|
|
- placeholder="请输入代金券名称"
|
|
|
+ placeholder="请输入券名称"
|
|
|
clearable
|
|
|
size="small"
|
|
|
style="width: 240px"
|
|
@@ -294,8 +292,8 @@
|
|
|
align="center"
|
|
|
fixed="left"
|
|
|
/>
|
|
|
- <el-table-column label="代金券ID" prop="couponId" />
|
|
|
- <el-table-column label="代金券图片">
|
|
|
+ <el-table-column label="券ID" prop="couponId" />
|
|
|
+ <el-table-column label="券图片">
|
|
|
<template slot-scope="scope">
|
|
|
<div>
|
|
|
<el-image
|
|
@@ -307,13 +305,13 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="代金券名称" prop="title" min-width="85" />
|
|
|
- <el-table-column label="代金券类型" min-width="85">
|
|
|
+ <el-table-column label="券名称" prop="title" min-width="85" />
|
|
|
+ <el-table-column label="使用场景" min-width="85">
|
|
|
<template slot-scope="scope">
|
|
|
<div>{{ scope.row.type.desc }}</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="代金券价格" min-width="85">
|
|
|
+ <el-table-column label="券价格" min-width="85">
|
|
|
<template slot-scope="scope">
|
|
|
<div>¥{{ $numberFormat(scope.row.discount) }}</div>
|
|
|
</template>
|
|
@@ -370,6 +368,7 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
+import CustomFieldsMixin from "@/mixins/CustomFields";
|
|
|
import { getGoodsList } from "@/api/business/goods";
|
|
|
import { getCouponList } from "@/api/business/coupon";
|
|
|
import { ticketBoxCreate } from "@/api/business/ticket";
|
|
@@ -377,6 +376,7 @@ import { publicFileGetUrl } from "@/api/common";
|
|
|
import { accMul } from "@/utils/util";
|
|
|
export default {
|
|
|
name: "TicketCreate",
|
|
|
+ mixins: [CustomFieldsMixin],
|
|
|
data() {
|
|
|
return {
|
|
|
loading: false,
|
|
@@ -387,7 +387,7 @@ export default {
|
|
|
facePrice: "", // 面值
|
|
|
salePrice: "", // 售价
|
|
|
quantity: "", // 数量
|
|
|
- pkgUnit: "", // 张数
|
|
|
+ pkgUnit: 200, // 张数
|
|
|
pkgSalePrice: "", // 单价
|
|
|
saleCommRate: "", // 基数
|
|
|
},
|
|
@@ -501,7 +501,7 @@ export default {
|
|
|
goodsTotal: 0, // 商品总数
|
|
|
selectGoodsList: [], // 选中商品
|
|
|
|
|
|
- couponTitle: "", // 代金券名称
|
|
|
+ couponTitle: "", // 券名称
|
|
|
couponTableVisible: false, // 添加卡券弹框
|
|
|
couponList: [], // 卡券列表
|
|
|
couponTotal: 0, // 卡券总数
|
|
@@ -579,7 +579,8 @@ export default {
|
|
|
|
|
|
// 保存
|
|
|
submitForm() {
|
|
|
- this.$refs["form"].validate((valid) => {
|
|
|
+ const subForm = this.$refs["form"]
|
|
|
+ subForm.validate((valid) => {
|
|
|
if (valid) {
|
|
|
let prizeIndex = this.awardsList.findIndex((item) => {
|
|
|
return !item.prizeList.length;
|
|
@@ -591,10 +592,25 @@ export default {
|
|
|
);
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
+ if ((this.form.quantity % this.form.pkgUnit != 0) && this.form.type == 'offline') {
|
|
|
+ this.$message.error("每包数量错误!");
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ let quantityTotal = 0;
|
|
|
+ this.awardsList.forEach((item) => {
|
|
|
+ quantityTotal += item.quantity;
|
|
|
+ });
|
|
|
+ if (this.form.quantity != quantityTotal) {
|
|
|
+ this.$message.error("盲票数量和奖品数量不一致!");
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
this.awardsList.forEach((item) => {
|
|
|
item.prizeList = item.prizeList.map((ele) => {
|
|
|
return {
|
|
|
- // ...ele,
|
|
|
+ ...ele,
|
|
|
refId: ele.goodsId || ele.couponId,
|
|
|
prizeType: ele.prizeType,
|
|
|
quantity: ele.quantity,
|
|
@@ -618,25 +634,18 @@ export default {
|
|
|
});
|
|
|
ticketBoxCreate(data)
|
|
|
.then((res) => {
|
|
|
+ loading.close();
|
|
|
if (res.code == 0) {
|
|
|
this.msgSuccess("保存成功");
|
|
|
this.$store.dispatch("tagsView/delView", this.$route);
|
|
|
this.$router.go(-1);
|
|
|
- loading.close();
|
|
|
- } else {
|
|
|
- this.$message.error("保存失败,请重新添加!");
|
|
|
- this.$store.dispatch("tagsView/delView", this.$route);
|
|
|
- this.$router.go(-1);
|
|
|
- loading.close();
|
|
|
}
|
|
|
})
|
|
|
.catch(() => {
|
|
|
- this.$message.error("保存失败,请重新添加!");
|
|
|
- this.$store.dispatch("tagsView/delView", this.$route);
|
|
|
- this.$router.go(-1);
|
|
|
loading.close();
|
|
|
});
|
|
|
} else {
|
|
|
+ this.getFormErrorMessage(subForm);
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
@@ -686,7 +695,7 @@ export default {
|
|
|
this.getGoodsList(this.goodsTitle);
|
|
|
},
|
|
|
|
|
|
- // 查询代金券
|
|
|
+ // 查询券
|
|
|
handleQueryCoupon() {
|
|
|
this.getCouponList(this.couponTitle);
|
|
|
},
|