1304317391@qq.com
2 years ago
3 changed files with 256 additions and 2 deletions
@ -0,0 +1,211 @@
|
||||
<template> |
||||
<el-dialog :append-to-body="true" :close-on-click-modal="false" :before-close="cancel" :visible.sync="dialog" |
||||
title="发放优惠券'" width="1200px"> |
||||
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="100px"> |
||||
<el-col :span="12"> |
||||
<el-form-item label="优惠券ID"> |
||||
<el-input v-model="form.cid" style="width: 300px;" :disabled="true" /> |
||||
<el-input v-model="form.ctype" type="hidden" /> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="12"> |
||||
<el-form-item label="优惠券名称"> |
||||
<el-input v-model="form.cname" style="width: 300px;" :disabled="true" /> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="24"> |
||||
<el-form-item label="选择会员"> |
||||
<div class="head-container"> |
||||
<!-- 搜索 --> |
||||
<el-input v-model="query.value" clearable placeholder="输入搜索内容" style="width: 200px;" |
||||
class="filter-item" @keyup.enter.native="toQuery" /> |
||||
<el-select v-model="query.type" clearable placeholder="类型" class="filter-item" |
||||
style="width: 130px"> |
||||
<el-option v-for="item in queryTypeOptions" :key="item.key" :label="item.display_name" |
||||
:value="item.key" /> |
||||
</el-select> |
||||
<el-select v-model="userType" clearable placeholder="用户来源" class="filter-item" |
||||
style="width: 130px"> |
||||
<el-option v-for="item in statusOptions" :key="item.value" :label="item.label" |
||||
:value="item.value" /> |
||||
</el-select> |
||||
<el-button class="filter-item" size="mini" type="success" icon="el-icon-search" |
||||
@click="toQuery">搜索 |
||||
</el-button> |
||||
<!-- 新增 --> |
||||
<el-button type="danger" class="filter-item" size="mini" icon="el-icon-refresh" |
||||
@click="toQuery">刷新 |
||||
</el-button> |
||||
</div> |
||||
<el-table v-loading="loading" :data="data" size="small" style="width: 100%;" @selection-change="handleSelectionChange"> |
||||
<el-table-column type="selection" width="55"></el-table-column> |
||||
<el-table-column prop="uid" label="用户id" /> |
||||
<el-table-column prop="nickname" label="用户昵称" /> |
||||
<el-table-column ref="table" prop="avatar" label="用户头像"> |
||||
<template slot-scope="scope"> |
||||
<a :href="scope.row.avatar" style="color: #42b983" target="_blank"><img |
||||
:src="scope.row.avatar" alt="点击打开" class="el-avatar"></a> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="phone" label="手机号码" /> |
||||
<el-table-column prop="nowMoney" label="用户余额" /> |
||||
<el-table-column prop="createTime" label="创建日期" width="140"> |
||||
<template slot-scope="scope"> |
||||
<span>{{ scope.row.createTime }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="状态" align="center"> |
||||
<template slot-scope="scope"> |
||||
<div @click="onStatus(scope.row.uid, scope.row.status)"> |
||||
<el-tag v-if="scope.row.status == 1" style="cursor: pointer" :type="''">正常</el-tag> |
||||
<el-tag v-else style="cursor: pointer" :type="'info'">禁用</el-tag> |
||||
</div> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="用户来源" align="center"> |
||||
<template slot-scope="scope"> |
||||
<div> |
||||
<el-tag v-if="scope.row.userType == 'wechat'">公众号</el-tag> |
||||
<el-tag v-else-if="scope.row.userType == 'routine'">小程序</el-tag> |
||||
<el-tag v-else>H5</el-tag> |
||||
</div> |
||||
</template> |
||||
</el-table-column> |
||||
<!-- <el-table-column prop="spreadUid" label="推荐人" /> --> |
||||
<el-table-column prop="payCount" label="购买次数" /> |
||||
</el-table> |
||||
<el-pagination :total="total" :current-page="page + 1" style="margin-top: 8px;" |
||||
layout="total, prev, pager, next, sizes" @size-change="sizeChange" |
||||
@current-change="pageChange" /> |
||||
</el-form-item> |
||||
</el-col> |
||||
|
||||
</el-form> |
||||
<div slot="footer" class="dialog-footer"> |
||||
<el-button type="text" @click="cancel">取消</el-button> |
||||
<el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button> |
||||
</div> |
||||
</el-dialog> |
||||
</template> |
||||
|
||||
<script> |
||||
import checkPermission from '@/utils/permission' |
||||
import { add, edit } from '@/api/bxg/yxStoreCouponIssue' |
||||
import initData from '@/mixins/crud' |
||||
export default { |
||||
mixins: [initData], |
||||
data() { |
||||
return { |
||||
userType: '', |
||||
queryTypeOptions: [ |
||||
{ key: 'nickname', display_name: '用户昵称' }, |
||||
{ key: 'phone', display_name: '手机号码' } |
||||
], |
||||
statusOptions: [ |
||||
{ value: 'routine', label: '小程序' }, |
||||
{ value: 'wechat', label: '公众号' }, |
||||
{ value: 'H5', label: 'H5' } |
||||
], |
||||
loading: false, |
||||
dialog: false, |
||||
form: { |
||||
id: '', |
||||
cid: '', |
||||
cname: '', |
||||
ctype: 0, |
||||
startTimeDate: '', |
||||
endTimeDate: '', |
||||
totalCount: 0, |
||||
remainCount: 0, |
||||
isPermanent: 0, |
||||
status: 1, |
||||
isDel: 0, |
||||
addTime: '' |
||||
}, |
||||
rules: { |
||||
}, |
||||
multipleSelection: [] |
||||
} |
||||
}, |
||||
created() { |
||||
this.$nextTick(() => { |
||||
this.init() |
||||
}) |
||||
}, |
||||
methods: { |
||||
handleSelectionChange(val){ |
||||
this.multipleSelection = val; |
||||
console.log('this.multipleSelection',this.multipleSelection ) |
||||
}, |
||||
checkPermission, |
||||
beforeInit() { |
||||
this.url = 'bxg/api/yxUser' |
||||
const sort = 'uid,desc' |
||||
this.params = { page: this.page, size: this.size, sort: sort, userType: this.userType } |
||||
const query = this.query |
||||
const type = query.type |
||||
const value = query.value |
||||
if (type && value) { this.params[type] = value } |
||||
return true |
||||
}, |
||||
cancel() { |
||||
// this.resetForm() |
||||
this.dialog = false |
||||
}, |
||||
doSubmit() { |
||||
this.loading = true |
||||
}, |
||||
doAdd() { |
||||
add(this.form).then(res => { |
||||
this.resetForm() |
||||
this.$notify({ |
||||
title: '添加成功', |
||||
type: 'success', |
||||
duration: 2500 |
||||
}) |
||||
this.loading = false |
||||
this.$parent.init() |
||||
}).catch(err => { |
||||
this.loading = false |
||||
console.log(err.response.data.message) |
||||
}) |
||||
}, |
||||
doEdit() { |
||||
edit(this.form).then(res => { |
||||
this.resetForm() |
||||
this.$notify({ |
||||
title: '修改成功', |
||||
type: 'success', |
||||
duration: 2500 |
||||
}) |
||||
this.loading = false |
||||
this.$parent.init() |
||||
}).catch(err => { |
||||
this.loading = false |
||||
console.log(err.response.data.message) |
||||
}) |
||||
}, |
||||
// resetForm() { |
||||
// this.dialog = false |
||||
// this.$refs['form'].resetFields() |
||||
// this.form = { |
||||
// id: '', |
||||
// cid: '', |
||||
// startTime: '', |
||||
// endTime: '', |
||||
// totalCount: '', |
||||
// remainCount: '', |
||||
// isPermanent: '', |
||||
// status: '', |
||||
// isDel: '', |
||||
// addTime: '' |
||||
// } |
||||
// } |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped> |
||||
|
||||
</style> |
||||
|
Loading…
Reference in new issue