From acb2f6b8d289c3090f1250c01675ab2a9e5884d5 Mon Sep 17 00:00:00 2001 From: "liujw155@outlook.com" Date: Tue, 28 Feb 2023 14:34:21 +0800 Subject: [PATCH] add black ls api --- src/subpackage/blacklist/js/api.js | 2 + .../pages/abnormal_list/abnormal_list.vue | 137 +++++++++++++++++---- 2 files changed, 117 insertions(+), 22 deletions(-) diff --git a/src/subpackage/blacklist/js/api.js b/src/subpackage/blacklist/js/api.js index ebcd45a..a059e51 100644 --- a/src/subpackage/blacklist/js/api.js +++ b/src/subpackage/blacklist/js/api.js @@ -3,6 +3,8 @@ import { ORIGIN } from '../../../js/api'; export const BLACKLIST_API = { stadiumList:`${ORIGIN}/admin/stadium/list`, // 店铺列表 identifyRecords:`${ORIGIN}/admin/stadium/identify/records`, // 疑似逃票的记录 + blacklistAdd:`${ORIGIN}/admin/user/blacklist/add`, // 黑名单添加-后台 + blacklistRemove:`${ORIGIN}/admin/user/blacklist/remove`, // 黑名单移除-后台 } diff --git a/src/subpackage/blacklist/pages/abnormal_list/abnormal_list.vue b/src/subpackage/blacklist/pages/abnormal_list/abnormal_list.vue index e2f13d2..61847eb 100644 --- a/src/subpackage/blacklist/pages/abnormal_list/abnormal_list.vue +++ b/src/subpackage/blacklist/pages/abnormal_list/abnormal_list.vue @@ -5,7 +5,7 @@ - {{ selectStadium.name || '全部' }} + {{ selectStadium.name || '全部' }} @@ -20,29 +20,40 @@ - - 欧轩智能羽毛球馆(永泰店) + + {{ e.extension.stadium_name || '-' }} - 订单编号:20195175645666 - (租场) + 订单编号:{{ e.order_no || '-' }} + ({{ e.type || '-' }}) - 用户信息:183165538(周大强) + 用户信息:{{ e.extension.mobile || '-' }}({{ e.extension.nickname || '-' }}) - 核销码:200801108978 + 核销码:{{ e.verify_code || '-' }} - 验证方式:扫码器验证(pad) + 验证方式:{{ e.verify_desc || '-' }} - 核销时间:2021-05-17 11:12:58 + 核销时间:{{ e.verify_leave_time || '-' }} 抓拍图片: - + + + - 移出黑名单 + {{e.in_black_list === 1?'移出黑名单':'加入黑名单'}} @@ -59,6 +70,8 @@ export default { stadiumLs: [], selectStadium: {}, curDate: '', + blackLs: [], + page: 1 } }, async onLoad(options){ @@ -73,41 +86,119 @@ export default { console.warn('get records ls err --->', err); } }, + onReachBottom(){ + let { selectStadium, curDate, page } = this; + this.getRecords({ + brand_id: selectStadium.brand_id, + stadium_id: selectStadium.id, + verify_time: curDate, + page: ++page + }) + }, methods: { + previewImg(url){ + uni.previewImage({ urls: [url] }) + }, getRecords({ - authority = 'wx', + authority = 'wx', // 后台:随便字段写死 brand_id = 63, stadium_id = '', page = 1, - page_size = 15, + page_size = 10, verify_time = '' }){ + util.showLoad(); server.get({ url: BLACKLIST_API.identifyRecords, data: { authority, brand_id, page, page_size, - stadium_id, verify_time + stadium_id: stadium_id || '', verify_time }, failMsg: '加载列表失败!' }) .then(res => { - console.warn('getRecords->', res); + util.hideLoad(); + let _ls = res.list || []; + if(page ===1)return this.blackLs = _ls; + if(!_ls.length)return util.showNone('没有更多数据!'); + this.page = page; + this.blackLs = [ ...this.blackLs, ..._ls ]; + }) }, dateChange(e){ - this.curDate = e.detail.value || '-' + let { selectStadium } = this; + let _date = e.detail.value || '-' + this.curDate = _date; + this.page = 1; + this.blackLs = []; + this.getRecords({ + brand_id: selectStadium.brand_id, + stadium_id: selectStadium.id, + verify_time: _date, + }) }, stadiumChange(e){ - let { stadiumLs } = this; - this.selectStadium = stadiumLs[e.detail.value] + let { stadiumLs, curDate } = this; + let _curStadium = stadiumLs[e.detail.value] || {}; + this.selectStadium = _curStadium; + this.page = 1; + this.blackLs = []; + this.getRecords({ + brand_id: _curStadium.brand_id, + stadium_id: _curStadium.id, + verify_time: curDate, + }) + }, + operateBtn(e, idx){ + let _status = e.in_black_list || '' + let _qry = { + uid: e.user_id, + brand_id: e.brand_id, + idx: idx, + status: _status, + } + if(_status == 0)return this.modalToDo({ qry: _qry, content: '确定将该用户拉入黑名单吗?确定后用户将不能再进入小程序' }); + + if(_status === 1)return this.modalToDo({ qry: _qry, content: '确定移出黑名单吗?' }); + }, - operateBtn(){ + modalToDo({ qry, content }){ util.showModal({ title: '提示', - content: '确定将该用户拉入黑名单吗?确定后用户将不能再进入小程序', + content: content, showCancel: true, + success: mRes => { + if(mRes.confirm)this.blackLsOpt(qry); + } }) }, + blackLsOpt: util.debounce(function({ uid, brand_id, idx, status}){ + let _url = ''; + if(status == 0)_url = BLACKLIST_API.blacklistAdd; + if(status == 1)_url = BLACKLIST_API.blacklistRemove; + util.showLoad(); + server.get({ + url: _url, + data: { + id: uid, + brand_id, + }, + isDefaultGet: false + }) + .then(res=>{ + util.hideLoad(); + if(res.data.code == 0){ + util.showNone('操作成功!'); + let _blackLs = this.blackLs || []; + _blackLs[idx].in_black_list = status == 0 ? 1 : 0; + this.blackLs = _blackLs; + setTimeout(_=>this.$forceUpdate(), 1200); + }else{ + util.showNone(res.data.message || '操作失败!稍后重试'); + } + }) + }, 300, true), // 获取店铺列表 getStoreList({ page=1, @@ -125,7 +216,7 @@ export default { }) .then(res=>{ let _list = res.list || []; - _list.unshift({ name: '全部', id: 0 }) + _list.unshift({ name: '全部', id: '' }) this.stadiumLs = _list; return _list }) @@ -163,6 +254,9 @@ export default { @include textHide(1); font-size: 28upx; color: #9c9c9f; + &.select{ + color: #1A1A1A; + } } .ac-icon{ flex-shrink: 0; @@ -228,7 +322,6 @@ export default { height: 180upx; overflow: hidden; border-radius: 6upx; - background-color: skyblue; >image{ width: 100%; height: 100%;