优惠券修改
This commit is contained in:
@@ -4,10 +4,10 @@
|
||||
<div class="search">
|
||||
<el-form :model="query" inline label-position="left">
|
||||
<el-form-item>
|
||||
<el-input v-model="query.name" placeholder="用户ID/用户昵称/用户手机" style="width: 180px;" />
|
||||
<el-input v-model="query.value" placeholder="用户ID/用户昵称/用户手机" style="width: 180px;" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-select v-model="query.state" placeholder="选择状态" style="width: 154px;">
|
||||
<el-select v-model="query.status" placeholder="选择状态" style="width: 154px;">
|
||||
<el-option
|
||||
v-for="item in stateList"
|
||||
:key="item.value"
|
||||
@@ -19,21 +19,22 @@
|
||||
<el-form-item />
|
||||
<el-form-item label="领取时间">
|
||||
<el-date-picker
|
||||
v-model="query.createdAt"
|
||||
v-model="queryTime"
|
||||
type="daterange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
:default-time="['00:00:00', '23:59:59']"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
@change="queryTimeChange"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="getTableData">查询</el-button>
|
||||
<el-button v-loading="downloadLoading" icon="el-icon-download" @click="downloadHandle">
|
||||
<!-- <el-button v-loading="downloadLoading" icon="el-icon-download" @click="downloadHandle">
|
||||
<span v-if="!downloadLoading">导出</span>
|
||||
<span v-else>下载中...</span>
|
||||
</el-button>
|
||||
</el-button> -->
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
@@ -41,19 +42,32 @@
|
||||
<el-table v-loading="loading" :data="tableData">
|
||||
|
||||
<el-table-column label="用户ID" prop="id" />
|
||||
<el-table-column label="用户名" prop="areaName" />
|
||||
<el-table-column label="领取时间" prop="tableName" />
|
||||
<el-table-column label="使用时间" prop="tableName" />
|
||||
<el-table-column label="获得来源" prop="tableName" />
|
||||
<el-table-column label="状态" prop="tableName" />
|
||||
<el-table-column label="使用门店" prop="tableName" />
|
||||
<el-table-column label="订单数量" prop="orderCount">
|
||||
<el-table-column label="用户名" prop="name" />
|
||||
<el-table-column label="领取时间" prop="receiveTime" />
|
||||
<el-table-column label="使用时间" prop="useTime" />
|
||||
<el-table-column label="获得来源" prop="source" />
|
||||
<el-table-column label="状态" align="status">
|
||||
<template v-slot="scope">
|
||||
<div class="cursor-pointer" @click="toTableOrderList(scope.row)">
|
||||
{{ scope.row.orderCount }}
|
||||
<div style="display: flex;align-items: center;">
|
||||
<div v-if="scope.row.overNum == scope.row.num" style="width: 30px;color: #FAAD14;">未使用</div>
|
||||
<div v-if="scope.row.num!=0&&scope.row.overNum != scope.row.num">{{ scope.row.overNum }}/{{ scope.row.num }}</div>
|
||||
<div v-if="scope.row.overNum == 0" style="color: #52C41A;">已使用</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="使用门店" prop="tableName" />
|
||||
<el-table-column label="操作" width="150">
|
||||
<template v-slot="scope">
|
||||
<el-popconfirm title="确定删除吗?" @confirm="delTableHandle([scope.row.id])">
|
||||
<el-button
|
||||
slot="reference"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
style="color: #FF4D4F;"
|
||||
>删除</el-button>
|
||||
</el-popconfirm>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
</el-table>
|
||||
</div>
|
||||
@@ -62,35 +76,98 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { queryReceive, delReceive } from '@/api/coupon'
|
||||
|
||||
export default {
|
||||
// eslint-disable-next-line vue/require-prop-types
|
||||
props: ['couponId'],
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: true,
|
||||
dialogVisible: false,
|
||||
downloadLoading: false,
|
||||
loading: false,
|
||||
stateList: [
|
||||
{ label: '未使用', value: 1 },
|
||||
{ label: '已使用', value: 2 }
|
||||
{ label: '未使用', value: 0 },
|
||||
{ label: '已使用', value: 1 }
|
||||
],
|
||||
queryTime: [],
|
||||
query: {
|
||||
name: '',
|
||||
createdAt: [],
|
||||
state: ''
|
||||
couponId: '',
|
||||
value: '',
|
||||
status: 0,
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
page: 1,
|
||||
size: 10
|
||||
},
|
||||
resetQuery: null,
|
||||
tableData: null
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
||||
this.resetQuery = { ...this.query }
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 查询
|
||||
*/
|
||||
getTableData() {
|
||||
async getTableData() {
|
||||
// eslint-disable-next-line no-unused-vars, prefer-const
|
||||
console.log(this.couponId)
|
||||
|
||||
// eslint-disable-next-line no-unused-vars, prefer-const
|
||||
let res = await queryReceive({
|
||||
shopId: localStorage.getItem('shopId'),
|
||||
couponId: this.query.couponId,
|
||||
value: this.query.value,
|
||||
status: this.query.status,
|
||||
startTime: this.query.startTime,
|
||||
endTime: this.query.endTime,
|
||||
page: this.query.page,
|
||||
size: this.query.size
|
||||
})
|
||||
},
|
||||
// 导出Excel
|
||||
|
||||
/**
|
||||
* 时间选择监听
|
||||
*/
|
||||
queryTimeChange(e) {
|
||||
this.query.startTime = e[0]
|
||||
this.query.endTime = e[1]
|
||||
},
|
||||
|
||||
/**
|
||||
* 删除优惠券
|
||||
* @param id
|
||||
*/
|
||||
async delTableHandle(id) {
|
||||
// eslint-disable-next-line no-undef
|
||||
const delRes = await delReceive(id)
|
||||
console.log(delRes)
|
||||
this.getTableData()
|
||||
},
|
||||
|
||||
/**
|
||||
* 打开详情
|
||||
* @param obj
|
||||
*/
|
||||
show(obj) {
|
||||
console.log(obj)
|
||||
this.dialogVisible = true
|
||||
this.query.couponId = obj.id
|
||||
this.getTableData()
|
||||
},
|
||||
|
||||
/**
|
||||
* 关闭详情
|
||||
*/
|
||||
close() {
|
||||
this.dialogVisible = false
|
||||
},
|
||||
|
||||
/**
|
||||
* 导出Excel
|
||||
*/
|
||||
async downloadHandle() {
|
||||
try {
|
||||
this.downloadLoading = true
|
||||
@@ -107,28 +184,8 @@ export default {
|
||||
console.log(error)
|
||||
}
|
||||
},
|
||||
// 提交
|
||||
onSubmitHandle() {
|
||||
|
||||
},
|
||||
/**
|
||||
* 打开详情
|
||||
* @param obj
|
||||
*/
|
||||
show(obj) {
|
||||
this.dialogVisible = true
|
||||
// if (obj && obj.id) {
|
||||
// this.form = { ...obj }
|
||||
// }
|
||||
},
|
||||
/**
|
||||
* 关闭详情
|
||||
*/
|
||||
close() {
|
||||
this.dialogVisible = false
|
||||
},
|
||||
reset() {
|
||||
this.form = { ...this.resetForm }
|
||||
this.query = { ...this.resetQuery }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user