Commit c453398a by lixiaomin

修改优惠券

parent 4df4f5b6
import request from "@/utils/request";
// 查询列表
export function listCoupon(data) {
export function listCoupon(pageNum,pageSize,data) {
return request({
url: "/coupon/list",
url: "/coupon/list?pageNum=" + pageNum+ "&pageSize="+pageSize,
method: "post",
data: data,
});
......@@ -53,9 +53,9 @@ export function onlineCoupon(id) {
}
// 用户领取优惠券列表
export function getCouponInfoList(data) {
export function getCouponInfoList(pageNum,pageSize,data) {
return request({
url: "/coupon-user/list",
url: "/coupon-user/list?pageNum=" + pageNum+ "&pageSize="+pageSize,
method: "post",
data: 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";
// 查询列表
export function getCouCategoryList(data) {
export function getCouCategoryList(pageNum,pageSize,data) {
return request({
url: "/coupon-category",
url: "/coupon-category?pageNum=" + pageNum+ "&pageSize="+pageSize,
method: "post",
data: data,
});
......
......@@ -73,7 +73,7 @@
</el-form-item>
</el-col>
</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">
<template slot-scope="scope">
......@@ -88,13 +88,14 @@
<el-table-column label="原售价" align="center" prop="amount" />
<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-form>
<div v-show="refundTag" style="margin-top: 20px;" >
<el-form ref="refundForm" :rules="rules" :model="refundForm" label-width="80px">
<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 label="处理备注" prop="desc">
<el-input v-model="refundForm.desc" type="textarea" placeholder="请输入处理备注"/>
......@@ -321,7 +322,16 @@ export default {
let picObj = JSON.parse(str);
list.push(picObj.thumbnail)
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>
......@@ -94,7 +94,7 @@ export default {
},
/** 查询优惠券列表 */
getCouponList() {
listCoupon({pageNum: 1,pageSize: 100000,state:1}).then((response) => {
listCoupon(1,10000,{state:1}).then((response) => {
if(response.code==200){
this.couponList = response.rows;
}
......
......@@ -21,14 +21,14 @@
</el-select>
</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-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<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 :span="1.5">
<el-button type="primary" plain size="mini" @click="giveClick"
......@@ -64,11 +64,11 @@
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<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')"
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')"
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)"
v-hasPermi="['coupon:coupon:remove']">删除</el-button>
v-hasPermi="['coupon:delete']">删除</el-button>
</template>
</el-table-column>
</el-table>
......@@ -195,7 +195,7 @@
</el-form-item>
</el-form>
<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>
</div>
</el-dialog>
......@@ -204,7 +204,7 @@
</template>
<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 GiveCoupon from './giveCoupon.vue';
import {listClass} from "@/api/system/category";
......@@ -393,7 +393,7 @@ export default {
},
/** 查询券类别列表 */
getcouCategoryList() {
getCouCategoryList({state:1,pageNum:1,pageSize:10000}).then((response) => {
getCouCategoryList(1,10000,{state:1}).then((response) => {
this.couCategoryList = response.rows;
});
},
......@@ -423,7 +423,8 @@ export default {
/** 查询列表 */
getList() {
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){
this.couponList = response.rows;
this.total = response.total;
......@@ -483,89 +484,94 @@ export default {
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
this.open = true;
this.title = "修改优惠券";
this.getShopRangeList();
this.getShopAreaTree();
this.getMessageMoudle();
getCouponDetail(row.id).then((response) => {
if(response.code==200){
this.form.id=response.data.id;
this.form.name=response.data.name;
this.form.categoryId=response.data.categoryId;
this.type=response.data.type;
if(this.type==1){
this.liJian=response.data.priceDiscount;
if(response.data.priceLimit==0){
this.firstRadioValue=1;
}else{
this.firstRadioValue=2;
this.priceLimit=response.data.priceLimit;
}
}else if(this.type==2){
this.jiZhe=response.data.priceDiscount;
if(response.data.orderLimit){
this.twoRadioValue=3;
}else{
this.twoRadioValue=4;
}
}else if(this.type==3){
this.twoRadioValue=3;
if(response.data.priceLimit==0){
this.firstRadioValue=1;
}else{
this.firstRadioValue=2;
this.priceLimit=response.data.priceLimit;
}
}
if(response.data.daysLimit==0 && response.data.userLimit==0){
this.form.userNumber=2
}else{
this.form.userNumber=1;
this.form.daysLimit=response.data.daysLimit;
this.form.userLimit=response.data.userLimit;
}
this.form.times=[response.data.useStartTime,response.data.useEndTime];
this.form.relativeTime=response.data.relativeTime;
this.form.receivableTime=response.data.receivableTime;
if(response.data.weekLimit[0]==0){
this.form.week=[];
}else{
this.form.week=response.data.weekLimit;
}
//短信通知
if(response.data.sendMsg){
this.form.sendMsgTag=1
}else{
this.form.sendMsgTag=2
}
//适用范围分品类
if(response.data.categoryIds.length>0){
if(response.data.categoryIds[0]=='0'){
this.shopRange=[0];
}else{
let sr_ary = new Array();
for(let i=0;i<response.data.categoryIds.length;i++){
sr_ary.push([1,response.data.categoryIds[i]])
updateCheck(row.id).then((response) => {
if(response.code==500){
return;
}else{
this.reset();
this.open = true;
this.title = "修改优惠券";
this.getShopRangeList();
this.getShopAreaTree();
this.getMessageMoudle();
getCouponDetail(row.id).then((response) => {
if(response.code==200){
this.form.id=response.data.id;
this.form.name=response.data.name;
this.form.categoryId=response.data.categoryId;
this.type=response.data.type;
if(this.type==1){
this.liJian=response.data.priceDiscount;
if(response.data.priceLimit==0){
this.firstRadioValue=1;
}else{
this.firstRadioValue=2;
this.priceLimit=response.data.priceLimit;
}
}else if(this.type==2){
this.jiZhe=response.data.priceDiscount;
if(response.data.orderLimit){
this.twoRadioValue=3;
}else{
this.twoRadioValue=4;
}
}else if(this.type==3){
this.twoRadioValue=3;
if(response.data.priceLimit==0){
this.firstRadioValue=1;
}else{
this.firstRadioValue=2;
this.priceLimit=response.data.priceLimit;
}
}
if(response.data.daysLimit==0 && response.data.userLimit==0){
this.form.userNumber=2
}else{
this.form.userNumber=1;
this.form.daysLimit=response.data.daysLimit;
this.form.userLimit=response.data.userLimit;
}
this.form.times=[response.data.useStartTime,response.data.useEndTime];
this.form.relativeTime=response.data.relativeTime;
this.form.receivableTime=response.data.receivableTime;
if(response.data.weekLimit[0]==0){
this.form.week=[];
}else{
this.form.week=response.data.weekLimit;
}
//短信通知
if(response.data.sendMsg){
this.form.sendMsgTag=1
}else{
this.form.sendMsgTag=2
}
//适用范围分品类
if(response.data.categoryIds.length>0){
if(response.data.categoryIds[0]=='0'){
this.shopRange=[0];
}else{
let sr_ary = new Array();
for(let i=0;i<response.data.categoryIds.length;i++){
sr_ary.push([1,response.data.categoryIds[i]])
}
this.shopRange=sr_ary;
}
}
//适用范围商品
if(response.data.shopIds!=null){
let sh_ary = new Array();
for(let i=0;i<response.data.shopIds.length;i++){
sh_ary.push([1,response.data.shopIds[i]])
}
this.shopRange=sh_ary;
}
this.shopRange=sr_ary;
//省市区门店
let ps_ary = this.buildPS(response.data);
this.storesRange = ps_ary;
}
}
//适用范围商品
if(response.data.shopIds!=null){
let sh_ary = new Array();
for(let i=0;i<response.data.shopIds.length;i++){
sh_ary.push([1,response.data.shopIds[i]])
}
this.shopRange=sh_ary;
}
//省市区门店
let ps_ary = this.buildPS(response.data);
this.storesRange = ps_ary;
}
});
});
}
}).catch(() => {});
},
/** 组装省市区门店数据,供回显使用 */
buildPS(pdata){
......
......@@ -15,7 +15,7 @@
</el-select>
</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-form-item>
</el-form>
......@@ -142,7 +142,7 @@ export default {
/** 查询列表 */
getList() {
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.total = response.total;
this.loading = false;
......
......@@ -25,7 +25,7 @@
</el-select>
</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-form-item>
</el-form>
......@@ -113,6 +113,9 @@ export default {
queryParams: {
pageNum: 1,
pageSize: 10,
source:"",
state:null,
couponId:null
},
options: [{
value: null,
......@@ -155,7 +158,8 @@ export default {
/** 查询列表 */
getList() {
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.total = response.total;
this.loading = false;
......@@ -213,7 +217,7 @@ export default {
},
/** 查询优惠券列表 */
getCouponList() {
listCoupon({pageNum: 1,pageSize: 1000,state: 1}).then((response) => {
listCoupon(1,10000,{state: 1}).then((response) => {
if(response.code==200){
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