| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396 |
- <style>
- .table-body {
- padding: 20px;
- background-color: #fff;
- }
- .input-item {
- display: inline-block;
- width: 250px;
- margin: 0 0 20px;
- }
- .input-item .el-input__inner {
- border-right: 0;
- }
- .input-item .el-input__inner:hover {
- border: 1px solid #dcdfe6;
- border-right: 0;
- outline: 0;
- }
- .input-item .el-input__inner:focus {
- border: 1px solid #dcdfe6;
- border-right: 0;
- outline: 0;
- }
- .input-item .el-input-group__append {
- background-color: #fff;
- border-left: 0;
- width: 10%;
- padding: 0;
- }
- .input-item .el-input-group__append .el-button {
- padding: 0;
- }
- .input-item .el-input-group__append .el-button {
- margin: 0;
- }
- .table-body .el-button {
- padding: 0 !important;
- border: 0;
- margin: 0 5px;
- }
- .form-body {
- background-color: #fff;
- margin-bottom: 20px;
- }
- .el-tabs__header {
- background-color: #fff;
- }
- .el-tabs__item {
- width: 100px;
- text-align: center;
- }
- .el-table th>.cell {
- color: #333;
- font-weight: bold;
- font-size: 14px;
- }
- .el-table__footer-wrapper,
- .el-table__header-wrapper {
- border-bottom: 1.4px solid #D6D6D6;
- }
- .flex {
- display: flex;
- align-items: center;
- }
- .flex-y-center {
- display: -webkit-box;
- display: -webkit-flex;
- display: flex;
- -webkit-box-align: center;
- -webkit-align-items: center;
- -ms-flex-align: center;
- -ms-grid-row-align: center;
- align-items: center;
- }
- .coupon-info{
- padding: 12px 22px;
- background: #F8F8F8;
- }
- .coupon-info-text{
- color: #333;
- font-size: 16px;
- flex-direction: column;
- }
- .coupon-info-type{
- border: 1px solid #FF2222;
- padding: 2px 4px;
- color: #FF2222;
- }
- </style>
- <div id="app" v-cloak>
- <el-card shadow="never" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
- <div class="coupon-info" flex>
- <el-image style="width: 76px; height: 76px;margin-right: 17px;" src="resources/img/plugins/coupon/coupon-2.png"></el-image>
- <div class="coupon-info-text" flex>
- <div style="margin-bottom: 4px;">
- <span>券名称 {{coupon_info.name}}</span>
- <span class="coupon-info-type">{{coupon_info.status_text}}</span>
- </div>
- <div style="flex: 1;color: #585858;">{{coupon_info.content}}</div>
- <div style="font-size: 16px;">
- <span class="data-info-name">使用时间:</span>
- <span v-if="coupon_info.expire_type==2">{{coupon_info.use_time}}</span>
- <span v-else-if="coupon_info.expire_type==1">领取后{{coupon_info.expire_day}}天过期</span>
- <span v-else-if="coupon_info.expire_type==3">领取后{{coupon_info.effect_days}}天生效,有效期{{coupon_info.expire_day}}天</span>
- </div>
- </div>
- </div>
- <div class="table-body">
- <div class="flex">
- <div class="flex" style="margin-right: 30px;">
- <div class="input-title">会员ID</div>
- <el-input style="width: 180px;margin-left: 10px;" size="small" placeholder="请输入会员ID" prefix-icon="el-icon-search" v-model="search_data.user_id"> </el-input>
- </div>
- <div class="flex" style="margin-right: 30px;">
- <div class="input-title">会员</div>
- <el-input style="width: 180px;margin-left: 10px;" size="small" placeholder="请输入会员昵称/手机号" prefix-icon="el-icon-search" v-model="search_data.keyword"> </el-input>
- </div>
- <div class="flex" style="margin: 0 45px;">
- <div class="input-title" style="margin-right: 10px;">使用时间</div>
- <el-date-picker size="small" v-model="search_data.use_time" type="daterange" size="large" start-placeholder="开始日期" end-placeholder="结束日期" format="yyyy-MM-dd" value-format="timestamp" @change="select_date">
- </el-date-picker>
- </div>
- <div class="flex">
- <el-button type="primary" @click="search" style="padding: 9px 15px !important;">搜索</el-button>
- <el-button type="warning" @click="clereSearch" v-if="search_data.user_id || search_data.keyword || search_data.use_time.length" style="padding: 9px 15px !important;">清除搜索条件</el-button>
- </div>
- </div>
- <el-table v-loading="listLoading" :data="list" stripe style="width: 100%">
- <el-table-column label="会员ID" prop="user_id" min-width="80" align="center">
- <template slot-scope="scope">
- <div size="small">{{scope.row.user_id}}</div>
- </template>
- </el-table-column>
- <el-table-column label="会员名称" prop="nickname" min-width="80" align="center">
- <template slot-scope="scope">
- <div size="small" class="flex-y-center">
- <com-image width='50px' height='50px' :src=scope.row.avatar_url style="border-radius: 50%"></com-image>
- <span style="padding-left: 10px;">{{scope.row.nickname}}</span>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="券名称" prop="name" min-width="80" align="center">
- <template slot-scope="scope">
- <div size="small">{{scope.row.name}}</div>
- </template>
- </el-table-column>
- <el-table-column label="领取时间" prop="use_time" min-width="80" align="center">
- <template slot-scope="scope">
- <div size="small">{{scope.row.created_at|dateTimeFormat('Y-m-d H:i:s')}}</div>
- </template>
- </el-table-column>
- <el-table-column label="使用时间" prop="use_time" min-width="80" align="center">
- <template slot-scope="scope">
- <div size="small">{{scope.row.begin_at|dateTimeFormat('Y-m-d H:i:s')}}至{{scope.row.end_at|dateTimeFormat('Y-m-d H:i:s')}}</div>
- </template>
- </el-table-column>
- <el-table-column label="领取来源" prop="receive_type" min-width="80" align="center">
- <template slot-scope="scope">
- <div size="small">{{scope.row.receive_type}}</div>
- </template>
- </el-table-column>
- <el-table-column label="操作" min-width="100" align="center">
- <template slot-scope="scope">
- <el-button type="text" size="mini" @click="handleClick(scope.$index, action_type)" style="width:56px;height: 24px;" v-if="action_type=='force-failure' && scope.row.is_force_failure==0 && scope.row.is_use==0 && scope.row.giving_status!=2">
- 停止会员用券
- </el-button>
- <el-button type="text" size="mini" @click="handleClick(scope.$index, action_type)" style="width:56px;height: 24px;" v-if="action_type=='order-detail' && scope.row.is_use==1">
- 查看订单
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- <div style="text-align: left;margin: 20px 0;" v-if="action_type=='force-failure' && list.length && coupon_id && status==1 && is_used_number == 0">
- <el-button type="info" size="small" @click="forceFailureAll()" style="padding: 9px 15px !important;">停止所有会员用券</el-button>
- </div>
- <el-col :span="24" class="toolbar">
- <el-pagination v-if="pagination" style="display: inline-block;float: right;" background @current-change="pageChange" layout="prev, pager, next" :page-count="pageCount">
- </el-pagination>
- </el-col>
- </div>
- </el-card>
- </div>
- <script>
- const app = new Vue({
- el: '#app',
- data() {
- return {
- search_data: {
- user_id: '',
- keyword: '',
- use_time: [],
- start_time: 0,
- end_time: 0,
- },
- list: [],
- listLoading: false,
- page: 1,
- pageCount: 0,
- btnLoading: false,
- action_type: 'force-failure',
- coupon_info: {
- content: '',
- name: '',
- use_time: '',
- status: '',
- },
- // 从优惠券列表点击进来带的 coupon_id
- coupon_id: null,
- status: null,
- is_used_number: 0,
- send_from_map:{},
- pageCount: 0,
- };
- },
- methods: {
- search() {
- this.page = 1;
- this.getList();
- },
- clereSearch() {
- this.search_data.user_id = '';
- this.search_data.keyword = '';
- this.search_data.use_time = [];
- this.search_data.start_time = 0;
- this.search_data.end_time = 0;
- this.search();
- },
- pagination(currentPage) {
- let self = this;
- self.page = currentPage;
- self.getList();
- },
- //分页
- pageChange(page) {
- this.page = page;
- this.getList();
- },
- select_date(date) {
- console.log(date);
- if (date) {
- this.search_data.start_time = parseInt(date[0] / 1000);
- this.search_data.end_time = parseInt(date[1] / 1000) + 86400;
- } else {
- this.search_data.start_time = 0;
- this.search_data.end_time = 0;
- }
- },
- getList() {
- let self = this;
- self.listLoading = true;
- request({
- params: {
- r: 'store/client/coupon/user-coupon-detail',
- coupon_id: self.coupon_id,
- status: self.status,
- user_id: self.search_data.user_id,
- keyword: self.search_data.keyword,
- start_time: self.search_data.start_time,
- end_time: self.search_data.end_time,
- page: this.page,
- // page_size: this.page_size
- },
- method: 'get'
- }).then(e => {
- // console.log(e);
- self.listLoading = false;
- if (e.data.code == 0) {
- self.list = e.data.data.list.list;
- self.send_from_map = e.data.data.send_from_map;
- self.coupon_info = e.data.data.coupon_info;
- self.pageCount = e.data.data.list.page_count;
- } else {
- self.$message.error(e.data.msg);
- }
- for (let i = 0; i < self.list.length; i++) {
- if (1 == self.list[i].is_use) self.is_used_number += 1;
- }
- }).catch(e => {
- console.log(e);
- self.listLoading = false;
- self.$message.error('网络错误');
- });
- },
- handleClick(index, action_type) {
- // console.log(index, action_type); return null;
- let user_id = this.list[index].user_id;
- let coupon_id = this.list[index].coupon_id;
- if (action_type == 'force-failure') {
- this.$confirm('此操作将强制禁用会员已领取的优惠券, 是否继续?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- this.listLoading = true;
- request({
- params: {
- r: 'store/client/coupon/force-failure',
- user_id: user_id,
- coupon_id: coupon_id,
- },
- method: 'get'
- }).then(e => {
- this.listLoading = false;
- if (e.data.code == 0) {
- this.list[index].is_force_failure = 1;
- this.$message.success(e.data.msg);
- } else {
- this.$message.error(e.data.msg);
- }
- }).catch(e => {
- this.listLoading = false;
- console.log(e);
- this.$message.error('网络错误');
- });
- }).catch(() => { });
- } else {
- navigateTo({
- r: 'store/client/order/index',
- user_id: user_id,
- order_id: this.list[index].order_id,
- });
- }
- },
- forceFailureAll(index) {
- let coupon_id = getQuery('coupon_id');
- let self = this;
- this.$confirm('此操作将强制禁用会员已领取的优惠券, 是否继续?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- this.listLoading = true;
- request({
- params: {
- r: 'store/client/coupon/force-failure-all',
- coupon_id: coupon_id,
- },
- method: 'get'
- }).then(e => {
- this.listLoading = false;
- if (e.data.code == 0) {
- this.$message.success(e.data.msg);
- let num = this.list.length;
- for (let i = 0; i < num; i++) {
- this.list[i].is_force_failure = 1;
- }
- } else {
- this.$message.error(e.data.msg);
- }
- }).catch(e => {
- this.listLoading = false;
- console.log(e);
- this.$message.error('网络错误');
- });
- }).catch(() => { });
- },
- },
- mounted: function() {
- let type = getQuery('status');
- // console.log(type);
- if (1 == type) {
- this.action_type = 'force-failure';
- } else {
- this.action_type = 'order-detail';
- }
- this.status = getQuery('status');
- this.coupon_id = getQuery('coupon_id');
- this.getList();
- }
- });
- </script>
|