Commit 9de1ff6a by 吕明尚

增加金额券

parent f9db5bd3
...@@ -68,6 +68,15 @@ ...@@ -68,6 +68,15 @@
v-hasPermi="['system:coupon:add']" v-hasPermi="['system:coupon:add']"
>新增 >新增
</el-button> </el-button>
<el-button
v-hasPermi="['system:coupon:add']"
icon="el-icon-plus"
plain
size="mini"
type="primary"
@click="sumAdd"
>新增金额券
</el-button>
</el-col> </el-col>
<!-- <el-col :span="1.5">--> <!-- <el-col :span="1.5">-->
<!-- <el-button--> <!-- <el-button-->
...@@ -360,6 +369,149 @@ ...@@ -360,6 +369,149 @@
<el-button @click="cancel"> </el-button> <el-button @click="cancel"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
<el-dialog :title="sumTitle" :visible.sync="sumOpen" append-to-body width="500px">
<el-form ref="sumForm" :model="sumForm" :rules="sumRules" label-width="120px">
<el-form-item label="优惠券名称" prop="name">
<el-input v-model="sumForm.name" placeholder="请输入优惠券名称"/>
</el-form-item>
<!-- <el-form-item label="优惠券类型" prop="couponType">-->
<!-- <el-select v-model="form.couponType" placeholder="请选择优惠券类型" disabled>-->
<!-- <el-option-->
<!-- v-for="dict in dict.type.duration_coupon_type"-->
<!-- :key="dict.value"-->
<!-- :label="dict.label"-->
<!-- :value="parseInt(dict.value)"-->
<!-- ></el-option>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<el-form-item label="优惠券类型" prop="couponType">
<el-select v-model="sumForm.couponType" clearable disabled placeholder="请选择优惠券类型">
<el-option
key="6"
label="金额券"
value="6"
/>
</el-select>
</el-form-item>
<el-form-item label="门槛金额" prop="miniPrice">
<el-input-number v-model="sumForm.miniPrice" :max="9999" :min="0" label="优惠卷数量"/>
</el-form-item>
<el-form-item label="数量" prop="number">
<el-input-number v-model="sumForm.number" :max="9999" :min="1" label="优惠卷数量"/>
<!-- <el-input v-model="form.number" type="textarea" placeholder="请输入数量" />-->
</el-form-item>
<el-form-item label="平台类型" prop="platformType">
<el-select v-model="sumForm.platformType" clearable disabled placeholder="请选择平台类型">
<el-option
:key="1"
:value="1"
label="自营"
/>
</el-select>
</el-form-item>
<el-form-item label="订单类型" prop="orderType">
<el-select v-model="sumForm.orderType" clearable placeholder="请选择订单类型">
<el-option
key="1"
label="预订"
value="1"
/>
<el-option
key="2"
label="续单"
value="2"
/>
</el-select>
</el-form-item>
<el-form-item label="适用星期" prop="weeks">
<div style="display: flex;flex-direction: row;align-items: center;width: 100%;">
<el-select v-model="weeks" multiple placeholder="选择星期" style="width: 100%;" @change="onChangeweeks">
<el-option
v-for="dict in dict.type.sunday_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</div>
</el-form-item>
<el-form-item label="套餐" prop="packageId">
<el-select v-model="sumForm.packIds" clearable multiple placeholder="请选择套餐">
<el-option
v-for="dict in packList"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="适用门店" prop="storeIds">
<el-select v-model="sumForm.storeIds" clearable multiple placeholder="请选择适用门店">
<el-option
v-for="dict in storeList"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="有效期开始" prop="startDate">
<el-date-picker v-model="sumForm.startDate"
clearable
placeholder="请选择有效期开始"
type="date"
value-format="yyyy-MM-dd">
</el-date-picker>
</el-form-item>
<el-form-item label="有效期结束" prop="endDate">
<el-date-picker v-model="sumForm.endDate"
clearable
placeholder="请选择有效期结束"
type="date"
value-format="yyyy-MM-dd">
</el-date-picker>
</el-form-item>
<el-form-item label="有效开始时段" prop="validStartTime">
<el-time-select v-model="sumForm.validStartTime"
:picker-options="{
start: '00:00',
step: '01:00',
end: '23:00'
}"
clearable
placeholder="选择开始时段">
</el-time-select>
</el-form-item>
<el-form-item label="有效结束时段" prop="validEndTime">
<el-time-select v-model="sumForm.validEndTime"
:picker-options="{
start: '00:00',
step: '01:00',
end: '23:00'
}"
clearable
placeholder="选择结束时段">
</el-time-select>
</el-form-item>
<el-form-item label="数量" prop="number">
<el-input-number v-model="sumForm.number" :max="9999" :min="1" label="优惠卷数量"/>
<!-- <el-input v-model="form.number" type="textarea" placeholder="请输入数量" />-->
</el-form-item>
<el-form-item label="过期天数" prop="expirationNumber">
<el-input-number v-model="sumForm.expirationNumber" :max="365" :min="1" :step="1" label="过期天数"/>
</el-form-item>
<el-form-item label="说明" prop="remark">
<el-input v-model="sumForm.remark" placeholder="请输入内容" type="textarea"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitSumForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
...@@ -394,6 +546,31 @@ export default { ...@@ -394,6 +546,31 @@ export default {
weeks: [], weeks: [],
// 弹出层标题 // 弹出层标题
title: "", title: "",
sumTitle: "",
sumOpen: false,
sumForm: {},
sumRules: {
name: [
{required: true, message: "优惠券名称不能为空", trigger: "blur"}
],
originalPrice: [
//限制为数字
{pattern: /^[0-9]+(.[0-9]{1,2})?$/, message: '请输入正确的金额格式', trigger: 'blur'},
{required: true, message: "原始金额不能为空", trigger: "change"}
],
number: [
{required: true, message: "数量不能为空", trigger: "blur"}
],
expirationNumber: [
{required: true, message: "过期天数不能为空", trigger: "blur"}
],
startDate: [
{required: true, message: "有效期开始不能为空", trigger: "change"}
],
endDate: [
{required: true, message: "有效期结束不能为空", trigger: "change"}
]
},
// 是否显示弹出层 // 是否显示弹出层
open: false, open: false,
// 查询参数 // 查询参数
...@@ -471,6 +648,7 @@ export default { ...@@ -471,6 +648,7 @@ export default {
onChangeweeks(e) { onChangeweeks(e) {
console.log(e) console.log(e)
this.form.weeks = e.join() this.form.weeks = e.join()
this.sumForm.weeks = e.join()
}, },
/** 查询优惠券列表 */ /** 查询优惠券列表 */
...@@ -528,12 +706,14 @@ export default { ...@@ -528,12 +706,14 @@ export default {
}, },
// 取消按钮 // 取消按钮
cancel() { cancel() {
this.sumOpen = false;
this.open = false; this.open = false;
this.reset(); this.reset();
}, },
// 表单重置 // 表单重置
reset() { reset() {
this.weeks = [] this.weeks = []
this.sumForm = {};
this.form = { this.form = {
id: null, id: null,
name: null, name: null,
...@@ -553,6 +733,8 @@ export default { ...@@ -553,6 +733,8 @@ export default {
packIds: [] packIds: []
}; };
this.resetForm("form"); this.resetForm("form");
this.resetForm("sumForm");
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
...@@ -577,6 +759,13 @@ export default { ...@@ -577,6 +759,13 @@ export default {
this.open = true; this.open = true;
this.title = "添加优惠券"; this.title = "添加优惠券";
}, },
sumAdd() {
this.reset();
this.sumForm.platformType = 1;
this.sumForm.couponType = '6';
this.sumOpen = true;
this.sumTitle = "添加金额券";
},
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();
...@@ -634,6 +823,31 @@ export default { ...@@ -634,6 +823,31 @@ export default {
} }
}); });
}, },
/** 提交按钮 */
submitSumForm() {
this.$refs["sumForm"].validate(valid => {
if (valid) {
if (this.weeks.length) {
this.sumForm.weeks = this.weeks.join();
}
this.sumForm.storeIds = this.sumForm.storeIds && this.sumForm.storeIds.length ? this.sumForm.storeIds.join() : ''
this.sumForm.packIds = this.sumForm.packIds && this.sumForm.packIds.length ? this.sumForm.packIds.join() : ''
if (this.sumForm.id != null) {
updateCoupon(this.sumForm).then(response => {
this.$modal.msgSuccess("修改成功");
this.sumOpen = false;
this.getList();
});
} else {
addCoupon(this.sumForm).then(response => {
this.$modal.msgSuccess("新增成功");
this.sumOpen = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const ids = row.id || this.ids; const ids = row.id || this.ids;
......
...@@ -92,6 +92,7 @@ ...@@ -92,6 +92,7 @@
<el-table v-loading="loading" :data="storeList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="storeList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"/> <el-table-column type="selection" width="55" align="center"/>
<el-table-column label="门店名称" align="center" prop="name" width="100px"/> <el-table-column label="门店名称" align="center" prop="name" width="100px"/>
<el-table-column align="center" label="城市名称" prop="cityName" width="100px"/>
<el-table-column label="门店类型" align="center" prop="storeType"> <el-table-column label="门店类型" align="center" prop="storeType">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.store_type" :value="scope.row.storeType"/> <dict-tag :options="dict.type.store_type" :value="scope.row.storeType"/>
...@@ -187,6 +188,9 @@ ...@@ -187,6 +188,9 @@
<el-form-item label="门店名称" prop="name"> <el-form-item label="门店名称" prop="name">
<el-input v-model="form.name" placeholder="请输入门店名称"/> <el-input v-model="form.name" placeholder="请输入门店名称"/>
</el-form-item> </el-form-item>
<el-form-item label="所在城市" prop="cityName">
<el-input v-model="form.cityName" placeholder="请输入所在城市"/>
</el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
...@@ -629,6 +633,7 @@ export default { ...@@ -629,6 +633,7 @@ export default {
this.form.openShopUuid = openShopUuid; this.form.openShopUuid = openShopUuid;
this.form.address = cityname + shopaddress; this.form.address = cityname + shopaddress;
this.form.name = branchname; this.form.name = branchname;
this.form.cityName = cityname;
this.onSearchMapAddress(); this.onSearchMapAddress();
}, },
selectPoiId(tiktokPoiId) { selectPoiId(tiktokPoiId) {
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
<el-table-column label="店铺名称" align="center" prop="shopname" width="120px"/> <el-table-column label="店铺名称" align="center" prop="shopname" width="120px"/>
<el-table-column label="分店名称" align="center" prop="branchname" width="120px"/> <el-table-column label="分店名称" align="center" prop="branchname" width="120px"/>
<el-table-column label="店铺地址" align="center" prop="shopaddress" /> <el-table-column label="店铺地址" align="center" prop="shopaddress" />
<el-table-column align="center" label="城市名称" prop="cityname"/>
</el-table> </el-table>
</el-row> </el-row>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment