Commit c453398a by lixiaomin

修改优惠券

parent 4df4f5b6
import request from "@/utils/request"; import request from "@/utils/request";
// 查询列表 // 查询列表
export function listCoupon(data) { export function listCoupon(pageNum,pageSize,data) {
return request({ return request({
url: "/coupon/list", url: "/coupon/list?pageNum=" + pageNum+ "&pageSize="+pageSize,
method: "post", method: "post",
data: data, data: data,
}); });
...@@ -53,9 +53,9 @@ export function onlineCoupon(id) { ...@@ -53,9 +53,9 @@ export function onlineCoupon(id) {
} }
// 用户领取优惠券列表 // 用户领取优惠券列表
export function getCouponInfoList(data) { export function getCouponInfoList(pageNum,pageSize,data) {
return request({ return request({
url: "/coupon-user/list", url: "/coupon-user/list?pageNum=" + pageNum+ "&pageSize="+pageSize,
method: "post", method: "post",
data: data, data: data,
}); });
...@@ -94,4 +94,13 @@ export function giveCoupon(data) { ...@@ -94,4 +94,13 @@ export function giveCoupon(data) {
}); });
} }
// 优惠券修改前校验
export function updateCheck(id) {
return request({
url: "/coupon/update/check/"+id,
method: "post",
});
}
import request from "@/utils/request"; import request from "@/utils/request";
// 查询列表 // 查询列表
export function getCouCategoryList(data) { export function getCouCategoryList(pageNum,pageSize,data) {
return request({ return request({
url: "/coupon-category", url: "/coupon-category?pageNum=" + pageNum+ "&pageSize="+pageSize,
method: "post", method: "post",
data: data, data: data,
}); });
......
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-table :data="goodsList"> <el-table :data="goodsList" @selection-change="handleSelectionChange">
<el-table-column label="商品名称" align="center" prop="goodsName" /> <el-table-column label="商品名称" align="center" prop="goodsName" />
<el-table-column label="缩略图" align="center"> <el-table-column label="缩略图" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
...@@ -89,12 +89,13 @@ ...@@ -89,12 +89,13 @@
<el-table-column label="折扣价" align="center" prop="realAmount" /> <el-table-column label="折扣价" align="center" prop="realAmount" />
<el-table-column label="实付" align="center" prop="realAmount" /> <el-table-column label="实付" align="center" prop="realAmount" />
<el-table-column label="数量" align="center" prop="num" /> <el-table-column label="数量" align="center" prop="num" />
<el-table-column type="selection" width="55"/>
</el-table> </el-table>
</el-form> </el-form>
<div v-show="refundTag" style="margin-top: 20px;" > <div v-show="refundTag" style="margin-top: 20px;" >
<el-form ref="refundForm" :rules="rules" :model="refundForm" label-width="80px"> <el-form ref="refundForm" :rules="rules" :model="refundForm" label-width="80px">
<el-form-item label="退款金额" prop="refundAmount"> <el-form-item label="退款金额" prop="refundAmount">
<el-input v-model="refundForm.refundAmount" style="width:200px;" placeholder="请输入退款金额"/> <el-input v-model="refundForm.refundAmount" style="width:200px;" placeholder="请输入退款金额" disabled/>
</el-form-item> </el-form-item>
<el-form-item label="处理备注" prop="desc"> <el-form-item label="处理备注" prop="desc">
<el-input v-model="refundForm.desc" type="textarea" placeholder="请输入处理备注"/> <el-input v-model="refundForm.desc" type="textarea" placeholder="请输入处理备注"/>
...@@ -322,6 +323,15 @@ export default { ...@@ -322,6 +323,15 @@ export default {
list.push(picObj.thumbnail) list.push(picObj.thumbnail)
return list; return list;
}, },
handleSelectionChange(selectList){
let sum=null;
if(selectList.length>0){
for(let i=0;i<selectList.length;i++){
sum+=selectList[i].realAmount;
}
}
this.refundForm.refundAmount=sum;
}
} }
}; };
</script> </script>
...@@ -94,7 +94,7 @@ export default { ...@@ -94,7 +94,7 @@ export default {
}, },
/** 查询优惠券列表 */ /** 查询优惠券列表 */
getCouponList() { getCouponList() {
listCoupon({pageNum: 1,pageSize: 100000,state:1}).then((response) => { listCoupon(1,10000,{state:1}).then((response) => {
if(response.code==200){ if(response.code==200){
this.couponList = response.rows; this.couponList = response.rows;
} }
......
...@@ -21,14 +21,14 @@ ...@@ -21,14 +21,14 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery" v-hasPermi="['coupon:coupon:query']">搜索</el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery" v-hasPermi="['coupon:list']">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
v-hasPermi="['coupon:coupon:add']">新增</el-button> v-hasPermi="['coupon:add']">新增</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button type="primary" plain size="mini" @click="giveClick" <el-button type="primary" plain size="mini" @click="giveClick"
...@@ -64,11 +64,11 @@ ...@@ -64,11 +64,11 @@
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button v-show="scope.row.state == 1" size="mini" type="text" icon="el-icon-edit" @click="handleStatus(scope.row,'1')" <el-button v-show="scope.row.state == 1" size="mini" type="text" icon="el-icon-edit" @click="handleStatus(scope.row,'1')"
v-hasPermi="['coupon:coupon:restart']">下线</el-button> v-hasPermi="['coupon:offline']">下线</el-button>
<el-button v-show="scope.row.state == 2" size="mini" type="text" icon="el-icon-edit" @click="handleStatus(scope.row,'2')" <el-button v-show="scope.row.state == 2" size="mini" type="text" icon="el-icon-edit" @click="handleStatus(scope.row,'2')"
v-hasPermi="['coupon:coupon:stop']">上线</el-button> v-hasPermi="['coupon:online']">上线</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['coupon:coupon:remove']">删除</el-button> v-hasPermi="['coupon:delete']">删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -195,7 +195,7 @@ ...@@ -195,7 +195,7 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm" v-hasPermi="['coupon:coupon:edit']">确 定</el-button> <el-button type="primary" @click="submitForm" v-hasPermi="['coupon:update']">确 定</el-button>
<el-button @click="cancel">取 消</el-button> <el-button @click="cancel">取 消</el-button>
</div> </div>
</el-dialog> </el-dialog>
...@@ -204,7 +204,7 @@ ...@@ -204,7 +204,7 @@
</template> </template>
<script> <script>
import {addCoupon,updateCoupon,listCoupon,offlineCoupon,onlineCoupon,delCoupon,getCouponDetail,getMessageMoudle} from "@/api/coupon/coupon"; import {addCoupon,updateCoupon,listCoupon,offlineCoupon,onlineCoupon,delCoupon,getCouponDetail,getMessageMoudle,updateCheck} from "@/api/coupon/coupon";
import {getCouCategoryList} from "@/api/coupon/couponType"; import {getCouCategoryList} from "@/api/coupon/couponType";
import GiveCoupon from './giveCoupon.vue'; import GiveCoupon from './giveCoupon.vue';
import {listClass} from "@/api/system/category"; import {listClass} from "@/api/system/category";
...@@ -393,7 +393,7 @@ export default { ...@@ -393,7 +393,7 @@ export default {
}, },
/** 查询券类别列表 */ /** 查询券类别列表 */
getcouCategoryList() { getcouCategoryList() {
getCouCategoryList({state:1,pageNum:1,pageSize:10000}).then((response) => { getCouCategoryList(1,10000,{state:1}).then((response) => {
this.couCategoryList = response.rows; this.couCategoryList = response.rows;
}); });
}, },
...@@ -423,7 +423,8 @@ export default { ...@@ -423,7 +423,8 @@ export default {
/** 查询列表 */ /** 查询列表 */
getList() { getList() {
this.loading = true; this.loading = true;
listCoupon(this.queryParams).then((response) => { listCoupon(this.queryParams.pageNum,this.queryParams.pageSize,
{name:this.queryParams.name,state:this.queryParams.state,categoryId:this.queryParams.categoryId}).then((response) => {
if(response.code==200){ if(response.code==200){
this.couponList = response.rows; this.couponList = response.rows;
this.total = response.total; this.total = response.total;
...@@ -483,6 +484,10 @@ export default { ...@@ -483,6 +484,10 @@ export default {
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
updateCheck(row.id).then((response) => {
if(response.code==500){
return;
}else{
this.reset(); this.reset();
this.open = true; this.open = true;
this.title = "修改优惠券"; this.title = "修改优惠券";
...@@ -564,8 +569,9 @@ export default { ...@@ -564,8 +569,9 @@ export default {
let ps_ary = this.buildPS(response.data); let ps_ary = this.buildPS(response.data);
this.storesRange = ps_ary; this.storesRange = ps_ary;
} }
}); });
}
}).catch(() => {});
}, },
/** 组装省市区门店数据,供回显使用 */ /** 组装省市区门店数据,供回显使用 */
buildPS(pdata){ buildPS(pdata){
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery" v-hasPermi="['coupon:category:query']">搜索</el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery" v-hasPermi="['coupon:category:list']">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -142,7 +142,7 @@ export default { ...@@ -142,7 +142,7 @@ export default {
/** 查询列表 */ /** 查询列表 */
getList() { getList() {
this.loading = true; this.loading = true;
getCouCategoryList(this.queryParams).then((response) => { getCouCategoryList(this.queryParams.pageNum,this.queryParams.pageSize,{name:this.queryParams.name,state:this.queryParams.state}).then((response) => {
this.couponTypeList = response.rows; this.couponTypeList = response.rows;
this.total = response.total; this.total = response.total;
this.loading = false; this.loading = false;
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery" v-hasPermi="['coupon:category:query']">搜索</el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery" v-hasPermi="['coupon:user:list']">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -113,6 +113,9 @@ export default { ...@@ -113,6 +113,9 @@ export default {
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
source:"",
state:null,
couponId:null
}, },
options: [{ options: [{
value: null, value: null,
...@@ -155,7 +158,8 @@ export default { ...@@ -155,7 +158,8 @@ export default {
/** 查询列表 */ /** 查询列表 */
getList() { getList() {
this.loading = true; this.loading = true;
getCouponInfoList(this.queryParams).then((response) => { getCouponInfoList(this.queryParams.pageNum,this.queryParams.pageSize,
{source:this.queryParams.source,state:this.queryParams.state,couponId:this.queryParams.couponId}).then((response) => {
this.couponInfoList = response.rows; this.couponInfoList = response.rows;
this.total = response.total; this.total = response.total;
this.loading = false; this.loading = false;
...@@ -213,7 +217,7 @@ export default { ...@@ -213,7 +217,7 @@ export default {
}, },
/** 查询优惠券列表 */ /** 查询优惠券列表 */
getCouponList() { getCouponList() {
listCoupon({pageNum: 1,pageSize: 1000,state: 1}).then((response) => { listCoupon(1,10000,{state: 1}).then((response) => {
if(response.code==200){ if(response.code==200){
this.couponList = response.rows; this.couponList = response.rows;
} }
......
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