Commit 4853f810 by lixiaomin

修改赠送优惠券

parent 5ad9460a
...@@ -52,3 +52,12 @@ export function onlineCoupon(id) { ...@@ -52,3 +52,12 @@ export function onlineCoupon(id) {
}); });
} }
// 赠送优惠券
export function giveCoupon(data) {
return request({
url: "/coupon-user/give",
method: "post",
data: data,
});
}
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
<div class="app-container"> <div class="app-container">
<el-dialog :visible.sync="giveOpen" width="1000px" append-to-body> <el-dialog :visible.sync="giveOpen" width="1000px" append-to-body>
<el-form :model="queryParams" size="small" :inline="true" label-width="68px"> <el-form :model="queryParams" size="small" :inline="true" label-width="68px">
<el-form-item label="手机号" prop="userInfo"> <el-form-item label="手机号" >
<el-input v-model="queryParams.userInfo" placeholder="请输入手机号" clearable @keyup.enter.native="handleQuery" /> <el-input v-model="queryParams.userInfo" placeholder="请输入手机号" clearable @keyup.enter.native="handleQuery" />
</el-form-item> </el-form-item>
<el-form-item label="优惠券"> <el-form-item label="优惠券">
<el-select v-model="queryParams.state" placeholder="请选择优惠券" clearable @keyup.enter.native="handleQuery"> <el-select v-model="queryParams.couponId" placeholder="请选择优惠券" clearable @keyup.enter.native="handleQuery" filterable>
<el-option <el-option
v-for="item in couponList" v-for="item in couponList"
:key="item.id" :key="item.id"
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
<script> <script>
import {listCustomer} from "@/api/system/customer"; import {listCustomer} from "@/api/system/customer";
import {listCoupon} from "@/api/coupon/coupon"; import {listCoupon,giveCoupon} from "@/api/coupon/coupon";
export default { export default {
name: "Class", name: "Class",
data() { data() {
...@@ -73,8 +73,8 @@ export default { ...@@ -73,8 +73,8 @@ export default {
giveOpen: false, giveOpen: false,
// 查询参数 // 查询参数
queryParams: { queryParams: {
pageNum: 1, userInfo: null,
pageSize: 10, couponId: null,
}, },
customerList:[], customerList:[],
couponList:[] couponList:[]
...@@ -86,7 +86,11 @@ export default { ...@@ -86,7 +86,11 @@ export default {
methods: { methods: {
/** 查询列表 */ /** 查询列表 */
getList() { getList() {
this.giveOpen = true; this.giveOpen = true;
this.queryParams.userInfo=null;
this.queryParams.couponId=null;
this.customerList=[];
this.total=0;
}, },
/** 查询优惠券列表 */ /** 查询优惠券列表 */
getCouponList() { getCouponList() {
...@@ -121,54 +125,33 @@ export default { ...@@ -121,54 +125,33 @@ export default {
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
this.$refs["form"].validate((valid) => { let userId=null;
if (valid) { let userPhone=null;
if (this.form.id != null) { if(this.customerList.length>0){
if(this.form.state == "1"){ userId=this.customerList[0].id;
this.$message.error("停用之后才可以修改"); userPhone=this.customerList[0].phoneNumber;
return; }else{
} this.$message.error("请查询赠送优惠券的用户!");
updateClass(this.form).then((response) => { return;
this.$modal.msgSuccess("修改成功"); }
this.giveOpen = false; let couponId=this.queryParams.couponId;
this.getList(); if(couponId==null){
}); this.$message.error("请选择需要赠送的优惠券!");
} else { return;
addClass(this.form).then((response) => { }
this.$modal.msgSuccess("新增成功"); giveCoupon({"userId":userId,"userPhone":userPhone,"couponId":couponId}).then((response) => {
this.giveOpen = false; if(response.code==200){
this.getList(); this.$modal.msgSuccess("赠送成功");
}); this.giveOpen = false;
}
} }
}); });
}
}, },
},
}; };
</script> </script>
<style lang="scss" > <style lang="scss" >
.dialogClass .spanClass{
margin-left: 10px;
}
.dialogClass .inputCalss{
width:50px;
margin-left: 10px;
}
.dialogClass .el-radio__label {
padding-left: 3px !important;
}
.dialogClass .marginLeft10 {
padding-left: 10px;
}
.dialogClass .marginLeft20 {
padding-left: 20px;
}
.dialogClass .width {
width: 326px;
}
</style> </style>
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