@@ -0,0 +1,112 @@
|
||||
import request from '../../../../utils/request.js';
|
||||
|
||||
const app = getApp();
|
||||
const MEIYE = 10;
|
||||
|
||||
Component({
|
||||
properties: {
|
||||
status: { type: Number, value: 0, observer: 'reload' },
|
||||
trigger: { type: Number, value: 0, observer: 'reload' }
|
||||
},
|
||||
|
||||
data: {
|
||||
list: [],
|
||||
page: 1,
|
||||
hasMore: true,
|
||||
loading: false,
|
||||
loadingMore: false,
|
||||
ossImageUrl: app.globalData.ossImageUrl || '',
|
||||
showDetail: false,
|
||||
detailItem: {}
|
||||
},
|
||||
|
||||
lifetimes: {
|
||||
attached() { this.reload(); }
|
||||
},
|
||||
|
||||
methods: {
|
||||
reload() {
|
||||
this.setData({ page: 1, list: [], hasMore: true });
|
||||
this.loadData();
|
||||
},
|
||||
|
||||
mapItem(item) {
|
||||
const n = Number(item.sqzhuangtai);
|
||||
let display_status = '未知', status_class = 'zhuangtai-weizhi';
|
||||
if (n === 0) { display_status = '待处理'; status_class = 'zhuangtai-daijiaona'; }
|
||||
else if (n === 1) { display_status = '已处罚'; status_class = 'zhuangtai-yijiaona'; }
|
||||
else if (n === 2) { display_status = '已撤销'; status_class = 'zhuangtai-yibohui'; }
|
||||
else if (n === 3) { display_status = '申诉中'; status_class = 'zhuangtai-shensuzhong'; }
|
||||
|
||||
return {
|
||||
...item,
|
||||
display_status,
|
||||
status_class,
|
||||
display_time: item.CreateTime || item.create_time || '--',
|
||||
full_zhengju: (item.zhengju_tupian || []).map(u => this.fullUrl(u)),
|
||||
full_shensu: (item.shensu_tupian || []).map(u => this.fullUrl(u))
|
||||
};
|
||||
},
|
||||
|
||||
fullUrl(url) {
|
||||
if (!url) return '';
|
||||
if (url.startsWith('http')) return url;
|
||||
return this.data.ossImageUrl + url;
|
||||
},
|
||||
|
||||
async loadData(isLoadMore = false) {
|
||||
if (this.data.loading || this.data.loadingMore) return;
|
||||
if (isLoadMore && !this.data.hasMore) return;
|
||||
if (isLoadMore) this.setData({ loadingMore: true });
|
||||
else this.setData({ loading: true });
|
||||
|
||||
try {
|
||||
const res = await request({
|
||||
url: '/yonghu/sjcfjlhq',
|
||||
method: 'POST',
|
||||
data: { page: this.data.page, page_size: MEIYE, zhuangtai: this.data.status }
|
||||
});
|
||||
if (res.statusCode === 200 && res.data.code === 0) {
|
||||
const data = res.data.data;
|
||||
const rows = (data.list || []).map(item => this.mapItem(item));
|
||||
const newList = isLoadMore ? this.data.list.concat(rows) : rows;
|
||||
this.setData({
|
||||
list: newList,
|
||||
hasMore: data.has_more === true,
|
||||
page: this.data.page + 1,
|
||||
loading: false,
|
||||
loadingMore: false
|
||||
});
|
||||
} else {
|
||||
this.setData({ loading: false, loadingMore: false, hasMore: false });
|
||||
}
|
||||
} catch (e) {
|
||||
this.setData({ loading: false, loadingMore: false });
|
||||
}
|
||||
},
|
||||
|
||||
loadMore() {
|
||||
if (!this.data.hasMore || this.data.loadingMore) return;
|
||||
this.loadData(true);
|
||||
},
|
||||
|
||||
openDetail(e) {
|
||||
this.setData({ showDetail: true, detailItem: e.currentTarget.dataset.item });
|
||||
},
|
||||
|
||||
closeDetail() {
|
||||
this.setData({ showDetail: false, detailItem: {} });
|
||||
},
|
||||
|
||||
goOrder(e) {
|
||||
const id = e.currentTarget.dataset.id;
|
||||
if (!id) return;
|
||||
wx.navigateTo({ url: `/pages/merchant-order-detail/merchant-order-detail?dingdan_id=${id}` });
|
||||
},
|
||||
|
||||
previewImage(e) {
|
||||
const url = e.currentTarget.dataset.url;
|
||||
wx.previewImage({ current: url, urls: [url] });
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<view class="container">
|
||||
<scroll-view scroll-y class="scroll" bindscrolltolower="loadMore">
|
||||
<view wx:if="{{ loading && list.length === 0 }}" class="tip">加载中...</view>
|
||||
<block wx:for="{{ list }}" wx:key="id">
|
||||
<view class="card" bindtap="openDetail" data-item="{{ item }}">
|
||||
<view class="card-head">
|
||||
<text class="time">{{ item.display_time }}</text>
|
||||
<text class="tag {{ item.status_class }}">{{ item.display_status }}</text>
|
||||
</view>
|
||||
<text class="info">扣分:{{ item.jifen }} 积分</text>
|
||||
<text class="info">理由:{{ item.cfliyou }}</text>
|
||||
<text class="info link" wx:if="{{ item.dingdan_id }}">订单:{{ item.dingdan_id }}</text>
|
||||
</view>
|
||||
</block>
|
||||
<view wx:if="{{ !hasMore && list.length > 0 }}" class="tip">—— 没有更多了 ——</view>
|
||||
<view wx:if="{{ !loading && list.length === 0 }}" class="empty">暂无积分处罚记录</view>
|
||||
</scroll-view>
|
||||
|
||||
<view wx:if="{{ showDetail }}" class="modal-mask">
|
||||
<view class="modal-panel">
|
||||
<view class="modal-head">
|
||||
<text class="modal-title">积分处罚详情</text>
|
||||
<view class="modal-close" bindtap="closeDetail">✕</view>
|
||||
</view>
|
||||
<scroll-view scroll-y class="modal-body">
|
||||
<view class="row"><text class="lbl">扣分</text><text class="val strong">{{ detailItem.jifen }} 积分</text></view>
|
||||
<view class="row"><text class="lbl">状态</text><text class="tag {{ detailItem.status_class }}">{{ detailItem.display_status }}</text></view>
|
||||
<view class="row"><text class="lbl">处罚理由</text><text class="val">{{ detailItem.cfliyou }}</text></view>
|
||||
<view class="row" wx:if="{{ detailItem.dingdan_id }}">
|
||||
<text class="lbl">关联订单</text>
|
||||
<text class="val link" bindtap="goOrder" data-id="{{ detailItem.dingdan_id }}">{{ detailItem.dingdan_id }} ›</text>
|
||||
</view>
|
||||
<view class="row" wx:if="{{ detailItem.ssliyou }}"><text class="lbl">申诉理由</text><text class="val">{{ detailItem.ssliyou }}</text></view>
|
||||
<view wx:if="{{ detailItem.full_zhengju.length }}" class="section">
|
||||
<text class="sec-title">商家证据图</text>
|
||||
<view class="img-grid">
|
||||
<block wx:for="{{ detailItem.full_zhengju }}" wx:key="*this">
|
||||
<view class="img-box" bindtap="previewImage" data-url="{{ item }}">
|
||||
<image class="img" src="{{ item }}" mode="aspectFill"/>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{ detailItem.full_shensu.length }}" class="section">
|
||||
<text class="sec-title">打手申诉图</text>
|
||||
<view class="img-grid">
|
||||
<block wx:for="{{ detailItem.full_shensu }}" wx:key="*this">
|
||||
<view class="img-box" bindtap="previewImage" data-url="{{ item }}">
|
||||
<image class="img" src="{{ item }}" mode="aspectFill"/>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="modal-foot">
|
||||
<view class="pbtn default" bindtap="closeDetail">关闭</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -0,0 +1,3 @@
|
||||
@import '../../../../pages/penalty/components/fakuan-list/fakuan-list.wxss';
|
||||
|
||||
.link { color: #1565C0; }
|
||||
Reference in New Issue
Block a user