This commit is contained in:
磷叶 2025-05-24 18:02:14 +08:00
parent 146f431549
commit a32ac364c2
2 changed files with 418 additions and 0 deletions

44
src/api/bst/vipOrder.js Normal file
View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询卡券订单列表
export function listVipOrder(query) {
return request({
url: '/bst/vipOrder/list',
method: 'get',
params: query
})
}
// 查询卡券订单详细
export function getVipOrder(id) {
return request({
url: '/bst/vipOrder/' + id,
method: 'get'
})
}
// 新增卡券订单
export function addVipOrder(data) {
return request({
url: '/bst/vipOrder',
method: 'post',
data: data
})
}
// 修改卡券订单
export function updateVipOrder(data) {
return request({
url: '/bst/vipOrder',
method: 'put',
data: data
})
}
// 删除卡券订单
export function delVipOrder(id) {
return request({
url: '/bst/vipOrder/' + id,
method: 'delete'
})
}

View File

@ -0,0 +1,374 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="订单编号" prop="no">
<el-input
v-model="queryParams.no"
placeholder="请输入订单编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="下单用户" prop="userName">
<el-input
v-model="queryParams.userName"
placeholder="请输入下单用户名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable @change="handleQuery">
<el-option
v-for="dict in dict.type.vip_order_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="运营区" prop="vipAreaId">
<area-remote-select v-model="queryParams.vipAreaId" placeholder="请选择运营区" clearable @change="handleQuery"/>
</el-form-item>
<el-form-item label="VIP类型" prop="vipType">
<el-select v-model="queryParams.vipType" placeholder="请选择VIP类型" clearable @change="handleQuery">
<el-option
v-for="dict in dict.type.vip_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="取消备注" prop="cancelRemark">
<el-input
v-model="queryParams.cancelRemark"
placeholder="请输入取消备注"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</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="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-has-permi="['bst:vipOrder:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="vipOrderList" @selection-change="handleSelectionChange" :default-sort="defaultSort" @sort-change="onSortChange">
<el-table-column type="selection" width="55" align="center" />
<template v-for="column of showColumns">
<el-table-column
:key="column.key"
:label="column.label"
:prop="column.key"
:align="column.align"
:min-width="column.minWidth"
:sort-orders="orderSorts"
:sortable="column.sortable"
:show-overflow-tooltip="column.overflow"
:width="column.width"
>
<template slot-scope="d">
<template v-if="column.key === 'id'">
{{d.row[column.key]}}
</template>
<template v-else-if="column.key === 'status'">
<dict-tag :options="dict.type.vip_order_status" :value="d.row[column.key]"/>
</template>
<template v-else-if="column.key === 'vipType'">
<dict-tag :options="dict.type.vip_type" :value="d.row[column.key]"/>
</template>
<template v-else-if="column.key === 'vipLimitUnit'">
<dict-tag :options="dict.type.vip_limit_unit" :value="d.row[column.key]"/>
</template>
<template v-else>
{{d.row[column.key]}}
</template>
</template>
</el-table-column>
</template>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-has-permi="['bst:vipOrder:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-has-permi="['bst:vipOrder:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
<script>
import { addVipOrder, delVipOrder, getVipOrder, listVipOrder, updateVipOrder } from "@/api/bst/vipOrder";
import AreaRemoteSelect from '@/components/Business/Area/AreaRemoteSelect.vue';
import FormCol from "@/components/FormCol/index.vue";
import { $showColumns } from '@/utils/mixins';
//
const defaultSort = {
prop: "createTime",
order: "descending"
}
export default {
name: "VipOrder",
mixins: [$showColumns],
dicts: ['vip_type', 'vip_order_status', 'vip_limit_unit'],
components: {FormCol, AreaRemoteSelect},
data() {
return {
span: 24,
//
columns: [
{key: 'id', visible: true, label: '订单ID', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'no', visible: true, label: '订单编号', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'userName', visible: true, label: '下单用户', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'status', visible: true, label: '状态', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'vipAreaName', visible: true, label: '运营区', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'vipName', visible: true, label: '卡券名称', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'vipType', visible: true, label: '卡券类型', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'vipPrice', visible: true, label: '售价', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'vipDiscountValue', visible: true, label: '优惠值', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'vipValidDays', visible: true, label: '有效期', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'vipEnableLimit', visible: true, label: '是否限制频率', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'vipLimitTotal', visible: true, label: '可用次数', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'vipLimitCount', visible: true, label: '限制频率次数', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'vipLimitRound', visible: true, label: '限制频率周期', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'vipLimitUnit', visible: true, label: '限制频率单位', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'vipMinAmount', visible: true, label: '使用门槛', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'payNo', visible: true, label: '支付单号', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'cancelTime', visible: true, label: '取消时间', minWidth: null, sortable: false, overflow: false, align: 'center', width: "100"},
{key: 'cancelRemark', visible: true, label: '取消备注', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'payExpireTime', visible: true, label: '支付过期时间', minWidth: null, sortable: false, overflow: false, align: 'center', width: "100"},
{key: 'createTime', visible: true, label: '创建时间', minWidth: null, sortable: false, overflow: false, align: 'center', width: "100"},
],
//
orderSorts: ['ascending', 'descending', null],
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
vipOrderList: [],
//
title: "",
//
open: false,
defaultSort,
//
queryParams: {
pageNum: 1,
pageSize: 20,
orderByColumn: defaultSort.prop,
isAsc: defaultSort.order,
id: null,
no: null,
userId: null,
status: null,
vipId: null,
vipAreaId: null,
vipType: null,
vipEnableLimit: null,
vipLimitUnit: null,
payId: null,
cancelRemark: null,
},
//
form: {},
//
rules: {
no: [
{ required: true, message: "订单编号不能为空", trigger: "blur" }
],
userId: [
{ required: true, message: "下单用户ID不能为空", trigger: "blur" }
],
status: [
{ required: true, message: "状态不能为空", trigger: "change" }
],
vipId: [
{ required: true, message: "VIP ID不能为空", trigger: "blur" }
],
vipAreaId: [
{ required: true, message: "VIP运营区ID不能为空", trigger: "blur" }
],
vipType: [
{ required: true, message: "VIP类型不能为空", trigger: "change" }
],
vipPrice: [
{ required: true, message: "VIP售价不能为空", trigger: "blur" }
],
createTime: [
{ required: true, message: "创建时间不能为空", trigger: "blur" }
],
}
};
},
created() {
this.getList();
},
methods: {
/** 当排序按钮被点击时触发 **/
onSortChange(column) {
if (column.order == null) {
this.queryParams.orderByColumn = defaultSort.prop;
this.queryParams.isAsc = defaultSort.order;
} else {
this.queryParams.orderByColumn = column.prop;
this.queryParams.isAsc = column.order;
}
this.getList();
},
/** 查询卡券订单列表 */
getList() {
this.loading = true;
listVipOrder(this.queryParams).then(response => {
this.vipOrderList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
no: null,
userId: null,
status: null,
vipId: null,
vipAreaId: null,
vipType: null,
vipPrice: null,
vipDiscountValue: null,
vipValidDays: null,
vipEnableLimit: null,
vipLimitTotal: null,
vipLimitCount: null,
vipLimitRound: null,
vipLimitUnit: null,
vipMinAmount: null,
createTime: null,
payId: null,
cancelTime: null,
cancelRemark: null,
payExpireTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加卡券订单";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getVipOrder(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改卡券订单";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateVipOrder(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addVipOrder(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除卡券订单编号为"' + ids + '"的数据项?').then(function() {
return delVipOrder(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('bst/vipOrder/export', {
...this.queryParams
}, `vipOrder_${new Date().getTime()}.xlsx`)
}
}
};
</script>