Commit 5ad9460a by lixiaomin

修改优惠券

parent 60410311
...@@ -29,10 +29,26 @@ export function updateClass(data) { ...@@ -29,10 +29,26 @@ export function updateClass(data) {
} }
// 删除 // 删除
export function delClass(id) { export function delCoupon(id) {
return request({ return request({
url: "/system/category/" + id, url: "/coupon/" + id,
method: "delete", 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> <template>
<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" ref="queryForm" size="small" :inline="true" label-width="68px"> <el-form :model="queryParams" size="small" :inline="true" label-width="68px">
<el-form-item label="手机号" prop="name"> <el-form-item label="手机号" prop="userInfo">
<el-input v-model="queryParams.name" 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.state" placeholder="请选择优惠券" clearable @keyup.enter.native="handleQuery">
<el-option <el-option
v-for="item in options" v-for="item in couponList"
:key="item.value" :key="item.id"
:label="item.label" :label="item.name"
:value="item.value"> :value="item.id">
</el-option> </el-option>
</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:coupon:query']">搜索</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-table v-loading="loading" :data="userList"> <el-table v-loading="loading" :data="customerList">
<el-table-column label="用户" align="center" prop="name"/> <el-table-column label="用户" align="center" prop="userName" >
<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">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.state == 1">启用</span> <a myattr="mcv" v-hasPermi="['system:customer:view']">
<span v-if="scope.row.state == 2">停用</span> <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> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<div slot="footer" class="dialog-footer" style="text-align: center;"> <pagination
<el-button type="primary" @click="submitForm">确定</el-button> 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> <el-button @click="cancel">取 消</el-button>
</div> </div>
</el-dialog> </el-dialog>
...@@ -47,67 +59,60 @@ ...@@ -47,67 +59,60 @@
</template> </template>
<script> <script>
import { import {listCustomer} from "@/api/system/customer";
listClass, import {listCoupon} from "@/api/coupon/coupon";
getClass,
delClass,
addClass,
updateClass,
turnList
} from "@/api/coupon/couponType";
export default { export default {
name: "Class", name: "Class",
data() { data() {
return { return {
// 遮罩层 // 遮罩层
loading: true, loading: false,
// 总条数 // 总条数
total: 0, total: 0,
// 表格数据
userList: [],
// 弹出层标题
title: "",
// 是否显示弹出层 // 是否显示弹出层
giveOpen: false, giveOpen: false,
// 查询参数 // 查询参数
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
name: null,
state: null
}, },
options: [{ customerList:[],
value: '1', couponList:[]
label: '满减券'
}, {
value: '2',
label: '折扣券'
}],
}; };
}, },
created() { created() {
//this.getList(); this.getCouponList();
}, },
methods: { methods: {
/** 搜索按钮操作 */
handleQuery() {
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams.name=null;
this.queryParams.state=null;
this.handleQuery();
},
/** 查询列表 */ /** 查询列表 */
getList() { 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; this.loading = true;
listClass(this.queryParams).then((response) => { listCustomer(this.queryParams).then((response) => {
// this.userList = response.rows; if(response.code=="200"){
// this.total = response.total; this.customerList = response.rows;
this.total = response.total;
this.loading = false; this.loading = false;
}
}); });
}, },
// 取消按钮 // 取消按钮
......
...@@ -36,21 +36,25 @@ ...@@ -36,21 +36,25 @@
<a @click="handleUpdate(scope.row)" style="color: blue">{{ scope.row.name }}</a> <a @click="handleUpdate(scope.row)" style="color: blue">{{ scope.row.name }}</a>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="类别" align="center" prop="code" /> <el-table-column label="类别" align="center" prop="typeDesc" />
<el-table-column label="券价值" align="center" prop="remarks" /> <el-table-column label="券价值" align="center">
<template slot-scope="scope">
{{ scope.row.ruleDesc }}{{scope.row.ruleName}}
</template>
</el-table-column>
<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" width="300">
<el-table-column label="状态" align="center" prop="state">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.state == 1">启用</span> <p>{{formateTime(scope.row.useStartTime)}}{{formateTime(scope.row.useEndTime)}}</p>
<span v-if="scope.row.state == 2">停用</span> <p v-show="scope.row.relativeTime!=''">{{scope.row.relativeTime}}日内有效</p>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="状态" align="center" prop="stateDesc"/>
<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 == 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> 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> v-hasPermi="['coupon:coupon:stop']">上线</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:coupon:remove']">删除</el-button>
...@@ -183,9 +187,7 @@ ...@@ -183,9 +187,7 @@
</template> </template>
<script> <script>
import { import {addCoupon,listCoupon,offlineCoupon,onlineCoupon,delCoupon} from "@/api/coupon/coupon";
addCoupon,listCoupon
} 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";
...@@ -276,6 +278,11 @@ export default { ...@@ -276,6 +278,11 @@ export default {
this.getCityList(); this.getCityList();
}, },
methods: { methods: {
formateTime(val){
let index =val.lastIndexOf(":");
val=val.substring(0, index );
return val;
},
/** 查询商品分类列表 */ /** 查询商品分类列表 */
getCategoryList() { getCategoryList() {
listClass({pageNum: 1,pageSize: 10000,state:1}).then((response) => { listClass({pageNum: 1,pageSize: 10000,state:1}).then((response) => {
...@@ -438,20 +445,20 @@ export default { ...@@ -438,20 +445,20 @@ export default {
/** 启用、禁用按钮操作 */ /** 启用、禁用按钮操作 */
handleStatus(row,tag) { handleStatus(row,tag) {
let mess=""; let mess="";
let sta="";
if(tag=='1'){ if(tag=='1'){
mess="启用"; mess="下线";
sta="1";
}else if(tag=='2'){ }else if(tag=='2'){
mess="停用"; mess="上线";
sta="2";
} }
this.$modal this.$modal
.confirm('是否确认' + mess + '该数据项?') .confirm('是否确认' + mess + '该数据项?')
.then(function () { .then(function () {
return updateClass({id:row.id,state:sta}); if(tag=="1"){
}) return offlineCoupon(row.id);
.then((response) => { }else if(tag=="2"){
return onlineCoupon(row.id);
}
}).then((response) => {
if(response.code="200"){ if(response.code="200"){
this.getList(); this.getList();
this.$modal.msgSuccess('' + mess + '成功'); this.$modal.msgSuccess('' + mess + '成功');
...@@ -563,20 +570,16 @@ export default { ...@@ -563,20 +570,16 @@ export default {
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
if(row.state=="1"){
this.$message.error("停用状态才能删除!");
return;
}
const ids = row.id || this.ids;
this.$modal this.$modal
.confirm('是否确认删除分类编码为' + row.code + '的数据项?') .confirm('是否确定删除?')
.then(function () { .then(function () {
return delClass(ids); return delCoupon(row.id);
}) })
.then((response) => { .then((response) => {
console.log("response",response); if(response.code=="200"){
this.getList(); this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
}
}) })
.catch(() => { }); .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