Commit 5ad9460a by lixiaomin

修改优惠券

parent 60410311
......@@ -29,10 +29,26 @@ export function updateClass(data) {
}
// 删除
export function delClass(id) {
export function delCoupon(id) {
return request({
url: "/system/category/" + id,
url: "/coupon/" + id,
method: "delete",
});
}
// 下架
export function offlineCoupon(id) {
return request({
url: "/coupon/offline/" + id,
method: "get",
});
}
// 上架
export function onlineCoupon(id) {
return request({
url: "/coupon/online/" + id,
method: "get",
});
}
<template>
<div class="app-container">
<el-dialog :visible.sync="giveOpen" width="1000px" append-to-body>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px">
<el-form-item label="手机号" prop="name">
<el-input v-model="queryParams.name" placeholder="手机号" clearable @keyup.enter.native="handleQuery" />
<el-form :model="queryParams" size="small" :inline="true" label-width="68px">
<el-form-item label="手机号" prop="userInfo">
<el-input v-model="queryParams.userInfo" placeholder="请输入手机号" clearable @keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="优惠券">
<el-select v-model="queryParams.state" placeholder="请选择" clearable @keyup.enter.native="handleQuery">
<el-select v-model="queryParams.state" placeholder="请选择优惠券" clearable @keyup.enter.native="handleQuery">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value">
v-for="item in couponList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</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 icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery" v-hasPermi="['coupon:coupon:query']">搜索</el-button>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="userList">
<el-table-column label="用户" align="center" prop="name"/>
<el-table-column label="手机号" align="center" prop="code" />
<el-table-column label="订单量" align="center" prop="remarks" />
<el-table-column label="总金额" align="center" prop="goodsCount" />
<el-table-column label="已取消" align="center" prop="goodsCount" />
<el-table-column label="取消金额" align="center" prop="goodsCount" />
<el-table-column label="已退款" align="center" prop="goodsCount" />
<el-table-column label="退款金额" align="center" prop="goodsCount" />
<el-table-column label="最近订单时间" align="center" prop="goodsCount" />
<el-table-column label="注册时间" align="center" prop="goodsCount" />
<el-table-column label="来源" align="center" prop="state">
<el-table v-loading="loading" :data="customerList">
<el-table-column label="用户" align="center" prop="userName" >
<template slot-scope="scope">
<span v-if="scope.row.state == 1">启用</span>
<span v-if="scope.row.state == 2">停用</span>
<a myattr="mcv" v-hasPermi="['system:customer:view']">
<span @click="getDetial(scope.row)" style="color: blue"> {{ scope.row.userName }}</span>
</a>
</template>
</el-table-column>
<el-table-column label="手机号" align="center" prop="phoneNumber"/>
<el-table-column label="订单量" align="center" prop="orderCount"/>
<el-table-column label="总金额" align="center" prop="amount"/>
<el-table-column label="已取消" align="center" prop="cancelCount"/>
<el-table-column label="取消金额" align="center" prop="cancelAmount"/>
<el-table-column label="已退款" align="center" prop="refundCount"/>
<el-table-column label="退款金额" align="center" prop="refundAmount"/>
<el-table-column label="最近订单时间" align="center" prop="lastOrderDate"/>
<el-table-column label="注册时间" align="center" prop="createDate"/>
<el-table-column label="来源" align="center">
<template slot-scope="scope">
<span v-if="scope.row.source=='3'">小程序</span>
<span v-if="scope.row.source=='12'">点单屏</span>
</template>
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer" style="text-align: center;">
<el-button type="primary" @click="submitForm">确定</el-button>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<div slot="footer" class="dialog-footer" >
<el-button type="primary" @click="submitForm">赠送</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
......@@ -47,67 +59,60 @@
</template>
<script>
import {
listClass,
getClass,
delClass,
addClass,
updateClass,
turnList
} from "@/api/coupon/couponType";
import {listCustomer} from "@/api/system/customer";
import {listCoupon} from "@/api/coupon/coupon";
export default {
name: "Class",
data() {
return {
// 遮罩层
loading: true,
loading: false,
// 总条数
total: 0,
// 表格数据
userList: [],
// 弹出层标题
title: "",
total: 0,
// 是否显示弹出层
giveOpen: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
name: null,
state: null
},
options: [{
value: '1',
label: '满减券'
}, {
value: '2',
label: '折扣券'
}],
customerList:[],
couponList:[]
};
},
created() {
//this.getList();
this.getCouponList();
},
methods: {
/** 搜索按钮操作 */
handleQuery() {
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams.name=null;
this.queryParams.state=null;
this.handleQuery();
},
/** 查询列表 */
getList() {
this.giveOpen=true;
this.giveOpen = true;
},
/** 查询优惠券列表 */
getCouponList() {
listCoupon({pageNum: 1,pageSize: 100000,state:1}).then((response) => {
if(response.code==200){
this.couponList = response.rows;
}
});
},
/** 搜索按钮操作 */
handleQuery() {
if(this.queryParams.userInfo==null){
this.$message.error("请输入手机号");
return;
}
if(this.queryParams.userInfo.length!=11){
this.$message.error("请输入11位手机号");
return;
}
this.loading = true;
listClass(this.queryParams).then((response) => {
// this.userList = response.rows;
// this.total = response.total;
this.loading = false;
listCustomer(this.queryParams).then((response) => {
if(response.code=="200"){
this.customerList = response.rows;
this.total = response.total;
this.loading = false;
}
});
},
// 取消按钮
......
......@@ -36,21 +36,25 @@
<a @click="handleUpdate(scope.row)" style="color: blue">{{ scope.row.name }}</a>
</template>
</el-table-column>
<el-table-column label="类别" align="center" prop="code" />
<el-table-column label="券价值" align="center" prop="remarks" />
<el-table-column label="使用范围" align="center" prop="goodsCount" />
<el-table-column label="时效" align="center" prop="goodsCount" />
<el-table-column label="状态" align="center" prop="state">
<el-table-column label="类别" align="center" prop="typeDesc" />
<el-table-column label="券价值" align="center">
<template slot-scope="scope">
<span v-if="scope.row.state == 1">启用</span>
<span v-if="scope.row.state == 2">停用</span>
</template>
{{ scope.row.ruleDesc }}{{scope.row.ruleName}}
</template>
</el-table-column>
<el-table-column label="使用范围" align="center" prop="goodsCount" />
<el-table-column label="时效" align="center" width="300">
<template slot-scope="scope">
<p>{{formateTime(scope.row.useStartTime)}}{{formateTime(scope.row.useEndTime)}}</p>
<p v-show="scope.row.relativeTime!=''">{{scope.row.relativeTime}}日内有效</p>
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="stateDesc"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button v-show="scope.row.state == 2" 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>
<el-button v-show="scope.row.state == 1" 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>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['coupon:coupon:remove']">删除</el-button>
......@@ -183,9 +187,7 @@
</template>
<script>
import {
addCoupon,listCoupon
} from "@/api/coupon/coupon";
import {addCoupon,listCoupon,offlineCoupon,onlineCoupon,delCoupon} from "@/api/coupon/coupon";
import {getCouCategoryList} from "@/api/coupon/couponType";
import GiveCoupon from './giveCoupon.vue';
import {listClass} from "@/api/system/category";
......@@ -276,6 +278,11 @@ export default {
this.getCityList();
},
methods: {
formateTime(val){
let index =val.lastIndexOf(":");
val=val.substring(0, index );
return val;
},
/** 查询商品分类列表 */
getCategoryList() {
listClass({pageNum: 1,pageSize: 10000,state:1}).then((response) => {
......@@ -437,21 +444,21 @@ export default {
},
/** 启用、禁用按钮操作 */
handleStatus(row,tag) {
let mess="";
let sta="";
let mess="";
if(tag=='1'){
mess="启用";
sta="1";
mess="下线";
}else if(tag=='2'){
mess="停用";
sta="2";
mess="上线";
}
this.$modal
.confirm('是否确认' + mess + '该数据项?')
.then(function () {
return updateClass({id:row.id,state:sta});
})
.then((response) => {
if(tag=="1"){
return offlineCoupon(row.id);
}else if(tag=="2"){
return onlineCoupon(row.id);
}
}).then((response) => {
if(response.code="200"){
this.getList();
this.$modal.msgSuccess('' + mess + '成功');
......@@ -562,21 +569,17 @@ export default {
});
},
/** 删除按钮操作 */
handleDelete(row) {
if(row.state=="1"){
this.$message.error("停用状态才能删除!");
return;
}
const ids = row.id || this.ids;
handleDelete(row) {
this.$modal
.confirm('是否确认删除分类编码为' + row.code + '的数据项?')
.confirm('是否确定删除?')
.then(function () {
return delClass(ids);
return delCoupon(row.id);
})
.then((response) => {
console.log("response",response);
this.getList();
this.$modal.msgSuccess("删除成功");
if(response.code=="200"){
this.getList();
this.$modal.msgSuccess("删除成功");
}
})
.catch(() => { });
},
......
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