mirror of
https://gitee.com/zongzhige/shopxo.git
synced 2026-06-07 02:12:25 +08:00
数据列表优化+优购返现小程序
This commit is contained in:
@ -67,7 +67,7 @@ App({
|
||||
|
||||
// 请求地址
|
||||
request_url: "{{request_url}}",
|
||||
// request_url: 'http://shopxo.com/',
|
||||
request_url: 'http://shopxo.com/',
|
||||
// request_url: 'https://dev.shopxo.net/',
|
||||
|
||||
// 基础信息
|
||||
@ -559,6 +559,49 @@ App({
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* alert确认框
|
||||
* title [string] 标题(默认空)
|
||||
* msg [string] 提示信息,必传
|
||||
* is_show_cancel [int] 是否显示取消按钮(默认显示 0否, 1|undefined是)
|
||||
* cancel_text [string] 取消按钮文字(默认 取消)
|
||||
* cancel_color [string] 取消按钮的文字颜色,必须是 16 进制格式的颜色字符串(默认 #000000)
|
||||
* confirm_text [string] 确认按钮文字(默认 确认)
|
||||
* confirm_color [string] 确认按钮的文字颜色,必须是 16 进制格式的颜色字符串(默认 #000000)
|
||||
* object [boject] 回调操作对象,点击确认回调参数1,取消回调0
|
||||
* method [string] 回调操作对象的函数
|
||||
*/
|
||||
alert(e)
|
||||
{
|
||||
var msg = e.msg || null;
|
||||
if (msg != null)
|
||||
{
|
||||
var title = e.title || '';
|
||||
var is_show_cancel = (e.is_show_cancel == 0) ? false : true;
|
||||
var cancel_text = e.cancel_text || '取消';
|
||||
var confirm_text = e.confirm_text || '确认';
|
||||
var cancel_color = e.cancel_color || '';
|
||||
var confirm_color = e.confirm_color || '';
|
||||
|
||||
wx.showModal({
|
||||
title: title,
|
||||
content: msg,
|
||||
showCancel: is_show_cancel,
|
||||
cancelText: cancel_text,
|
||||
cancelColor: cancel_color,
|
||||
confirmText: confirm_text,
|
||||
confirmColor: confirm_color,
|
||||
success(res) {
|
||||
if ((e.object || null) != null && typeof e.object === 'object' && (e.method || null) != null) {
|
||||
e.object[e.method](res.confirm ? 1 : 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
self.showToast('提示信息为空 alert');
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 是否需要登录
|
||||
* 是否需要绑定手机号码
|
||||
|
||||
@ -61,7 +61,9 @@
|
||||
"pages/plugins/wallet/user-recharge/user-recharge",
|
||||
"pages/plugins/wallet/user-recharge-detail/user-recharge-detail",
|
||||
"pages/plugins/wallet/user-cash/user-cash",
|
||||
"pages/plugins/wallet/user-cash-detail/user-cash-detail"
|
||||
"pages/plugins/wallet/user-cash-detail/user-cash-detail",
|
||||
"pages/plugins/excellentbuyreturntocash/profit/profit",
|
||||
"pages/plugins/excellentbuyreturntocash/profit-detail/profit-detail"
|
||||
],
|
||||
"permission": {
|
||||
"scope.userLocation": {
|
||||
|
||||
@ -0,0 +1,91 @@
|
||||
const app = getApp();
|
||||
Page({
|
||||
data: {
|
||||
params: null,
|
||||
data_list_loding_status: 1,
|
||||
data_list_loding_msg: '',
|
||||
data_bottom_line_status: false,
|
||||
|
||||
detail: null,
|
||||
detail_list: [],
|
||||
},
|
||||
|
||||
onLoad(params) {
|
||||
//params['id'] = 1;
|
||||
this.setData({ params: params });
|
||||
this.init();
|
||||
},
|
||||
|
||||
onShow() {},
|
||||
|
||||
init() {
|
||||
var self = this;
|
||||
wx.showLoading({ title: "加载中..." });
|
||||
this.setData({
|
||||
data_list_loding_status: 1
|
||||
});
|
||||
|
||||
wx.request({
|
||||
url: app.get_request_url("detail", "profit", "excellentbuyreturntocash"),
|
||||
method: "POST",
|
||||
data: {
|
||||
id: this.data.params.id
|
||||
},
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
wx.hideLoading();
|
||||
wx.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
self.setData({
|
||||
detail: data.data,
|
||||
detail_list: [
|
||||
{ name: "订单号", value: data.data.order_no },
|
||||
{ name: "订单金额", value: data.data.total_price + '元' || '' },
|
||||
{ name: "退款金额", value: data.data.refund_price + '元' || '' },
|
||||
{ name: "有效金额", value: data.data.valid_price + '元' || '' },
|
||||
{ name: "返现金额", value: data.data.profit_price + '元' || '' },
|
||||
{ name: "结算状态", value: data.data.status_name || '' },
|
||||
{ name: "订单状态", value: data.data.order_status_name || '' },
|
||||
{ name: "订单支付状态", value: data.data.order_pay_status_name || '' },
|
||||
{ name: "来源终端", value: data.data.order_client_type_name || '' },
|
||||
{ name: "结算时间", value: (data.data.status == 2 && (data.data.success_estimate_icon || null) != null ? '(' + data.data.success_estimate_icon + ') ' : '') +data.data.success_time || '' },
|
||||
{ name: "添加时间", value: data.data.add_time || '' },
|
||||
{ name: "更新时间", value: data.data.upd_time || '' },
|
||||
],
|
||||
|
||||
data_list_loding_status: 3,
|
||||
data_bottom_line_status: true,
|
||||
data_list_loding_msg: '',
|
||||
});
|
||||
} else {
|
||||
self.setData({
|
||||
data_list_loding_status: 2,
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_msg: res.data.msg,
|
||||
});
|
||||
if (app.is_login_check(res.data, self, 'init')) {
|
||||
app.showToast(res.data.msg);
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
wx.hideLoading();
|
||||
wx.stopPullDownRefresh();
|
||||
self.setData({
|
||||
data_list_loding_status: 2,
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_msg: '服务器请求出错',
|
||||
});
|
||||
|
||||
app.showToast("服务器请求出错");
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.init();
|
||||
},
|
||||
|
||||
});
|
||||
@ -0,0 +1,4 @@
|
||||
{
|
||||
"enablePullDownRefresh": true,
|
||||
"navigationBarTitleText": "返现详情"
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
<view wx:if="{{detail != null}}">
|
||||
<view wx:if="{{detail_list.length > 0}}" class="panel-item">
|
||||
<view class="panel-content bg-white">
|
||||
<view wx:for="{{detail_list}}" wx:key="item" class="item br-b oh">
|
||||
<view class="title fl cr-888">{{item.name}}</view>
|
||||
<view class="content cr-666 fl br-l">{{item.value}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<import src="/pages/common/bottom_line.wxml" />
|
||||
<template is="bottom_line" data="{{status: data_bottom_line_status}}"></template>
|
||||
</view>
|
||||
|
||||
<view wx:if="{{detail == null}}">
|
||||
<import src="/pages/common/nodata.wxml" />
|
||||
<template is="nodata" data="{{status: data_list_loding_status, msg: data_list_loding_msg}}"></template>
|
||||
|
||||
<view class="nav-back tc wh-auto">
|
||||
<navigator open-type="navigateBack" hover-class="none">
|
||||
<button type="default" size="mini" class="cr-888 br" hover-class="none">返回</button>
|
||||
</navigator>
|
||||
</view>
|
||||
</view>
|
||||
@ -0,0 +1,27 @@
|
||||
.panel-item .panel-title {
|
||||
background: #fff;
|
||||
font-weight: bold;
|
||||
padding: 15rpx;
|
||||
border-bottom: 2px solid #eee;
|
||||
font-size: 34rpx;
|
||||
}
|
||||
.panel-item .panel-content .item {
|
||||
padding: 20rpx 0;
|
||||
}
|
||||
.panel-item .panel-content .item:last-child {
|
||||
border: 0;
|
||||
}
|
||||
.panel-item .panel-content .item .title {
|
||||
width: 25%;
|
||||
padding-left: 20rpx;
|
||||
}
|
||||
.panel-item .panel-content .item .content {
|
||||
width: calc(75% - 50rpx);
|
||||
padding-left: 20rpx;
|
||||
min-height: 46rpx;
|
||||
word-wrap: break-word;
|
||||
word-break: normal;
|
||||
}
|
||||
.panel-item .panel-content .item view {
|
||||
line-height: 46rpx;
|
||||
}
|
||||
@ -0,0 +1,201 @@
|
||||
const app = getApp();
|
||||
Page({
|
||||
data: {
|
||||
data_list: [],
|
||||
data_page_total: 0,
|
||||
data_page: 1,
|
||||
data_list_loding_status: 1,
|
||||
data_bottom_line_status: false,
|
||||
params: null,
|
||||
nav_status_list: [
|
||||
{ name: "全部", value: "-1" },
|
||||
{ name: "待生效", value: "0" },
|
||||
{ name: "生效中", value: "1" },
|
||||
{ name: "待结算", value: "2" },
|
||||
{ name: "已结算", value: "3" },
|
||||
{ name: "已失效", value: "4" },
|
||||
],
|
||||
nav_status_index: 0,
|
||||
},
|
||||
|
||||
onLoad(params) {
|
||||
// 是否指定状态
|
||||
var nav_status_index = 0;
|
||||
if ((params.status || null) != null) {
|
||||
for (var i in this.data.nav_status_list) {
|
||||
if (this.data.nav_status_list[i]['value'] == params.status) {
|
||||
nav_status_index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.setData({
|
||||
params: params,
|
||||
nav_status_index: nav_status_index,
|
||||
});
|
||||
this.init();
|
||||
},
|
||||
|
||||
onShow() {},
|
||||
|
||||
init() {
|
||||
var user = app.get_user_info(this, 'init');
|
||||
if (user != false) {
|
||||
// 用户未绑定用户则转到登录页面
|
||||
if (app.user_is_need_login(user)) {
|
||||
wx.redirectTo({
|
||||
url: "/pages/login/login?event_callback=init"
|
||||
});
|
||||
return false;
|
||||
} else {
|
||||
// 获取数据
|
||||
this.get_data_list();
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_bottom_line_status: false,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 获取数据
|
||||
get_data_list(is_mandatory) {
|
||||
// 分页是否还有数据
|
||||
if ((is_mandatory || 0) == 0) {
|
||||
if (this.data.data_bottom_line_status == true) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 加载loding
|
||||
wx.showLoading({ title: "加载中..." });
|
||||
this.setData({
|
||||
data_list_loding_status: 1
|
||||
});
|
||||
|
||||
// 参数
|
||||
var status = ((this.data.nav_status_list[this.data.nav_status_index] || null) == null) ? -1 : this.data.nav_status_list[this.data.nav_status_index]['value'];
|
||||
|
||||
// 获取数据
|
||||
wx.request({
|
||||
url: app.get_request_url("index", "profit", "excellentbuyreturntocash"),
|
||||
method: "POST",
|
||||
data: {
|
||||
page: this.data.data_page,
|
||||
status: status,
|
||||
is_more: 1,
|
||||
},
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
wx.hideLoading();
|
||||
wx.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
if (res.data.data.data.length > 0) {
|
||||
if (this.data.data_page <= 1) {
|
||||
var temp_data_list = res.data.data.data;
|
||||
} else {
|
||||
var temp_data_list = this.data.data_list;
|
||||
var temp_data = res.data.data.data;
|
||||
for (var i in temp_data) {
|
||||
temp_data_list.push(temp_data[i]);
|
||||
}
|
||||
}
|
||||
this.setData({
|
||||
data_list: temp_data_list,
|
||||
data_total: res.data.data.total,
|
||||
data_page_total: res.data.data.page_total,
|
||||
data_list_loding_status: 3,
|
||||
data_page: this.data.data_page + 1,
|
||||
});
|
||||
|
||||
// 是否还有数据
|
||||
if (this.data.data_page > 1 && this.data.data_page > this.data.data_page_total) {
|
||||
this.setData({ data_bottom_line_status: true });
|
||||
} else {
|
||||
this.setData({ data_bottom_line_status: false });
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_list: [],
|
||||
data_bottom_line_status: false,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
});
|
||||
if (app.is_login_check(res.data, this, 'get_data_list')) {
|
||||
app.showToast(res.data.msg);
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
wx.hideLoading();
|
||||
wx.stopPullDownRefresh();
|
||||
|
||||
this.setData({
|
||||
data_list_loding_status: 2,
|
||||
});
|
||||
app.showToast("服务器请求出错");
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 立即结算事件
|
||||
list_submit_settlement_event(e) {
|
||||
var index = e.currentTarget.dataset.index || 0;
|
||||
var self = this;
|
||||
|
||||
// 提交数据
|
||||
wx.showLoading({ title: "处理中..." });
|
||||
wx.request({
|
||||
url: app.get_request_url("auto", "profit", "excellentbuyreturntocash"),
|
||||
method: "POST",
|
||||
data: { id: self.data.data_list[index]['id']},
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
wx.hideLoading();
|
||||
if (res.data.code == 0) {
|
||||
var temp_data_list = this.data.data_list;
|
||||
temp_data_list[index]['status'] = 3;
|
||||
temp_data_list[index]['status_name'] = '已结算';
|
||||
self.setData({
|
||||
data_list: temp_data_list,
|
||||
});
|
||||
app.showToast(res.data.msg, "success");
|
||||
} else {
|
||||
app.alert({ msg: res.data.msg, is_show_cancel: 0});
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
wx.hideLoading();
|
||||
app.showToast("服务器请求出错");
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.setData({
|
||||
data_page: 1
|
||||
});
|
||||
this.get_data_list(1);
|
||||
},
|
||||
|
||||
// 滚动加载
|
||||
scroll_lower(e) {
|
||||
this.get_data_list();
|
||||
},
|
||||
|
||||
// 导航事件
|
||||
nav_event(e) {
|
||||
this.setData({
|
||||
nav_status_index: e.currentTarget.dataset.index || 0,
|
||||
data_page: 1,
|
||||
});
|
||||
this.get_data_list(1);
|
||||
},
|
||||
});
|
||||
@ -0,0 +1,4 @@
|
||||
{
|
||||
"enablePullDownRefresh": true,
|
||||
"navigationBarTitleText": "返现明细"
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
<!-- 导航 -->
|
||||
<view class="nav">
|
||||
<block wx:for="{{nav_status_list}}" wx:key="key">
|
||||
<view class="item fl tc cr-888 {{nav_status_index == index ? 'active' : ''}}" data-index="{{index}}" bindtap="nav_event">{{item.name}}</view>
|
||||
</block>
|
||||
</view>
|
||||
|
||||
<!-- 列表 -->
|
||||
<scroll-view scroll-y="{{true}}" class="scroll-box" bindscrolltolower="scroll_lower" lower-threshold="30">
|
||||
<view class="data-list">
|
||||
<view class="item bg-white spacing-mb" wx:if="{{data_list.length > 0}}" wx:for="{{data_list}}" wx:key="key">
|
||||
<view class="base oh br-b">
|
||||
<text class="cr-666">{{item.add_time_time}}</text>
|
||||
<text class="fr cr-main">{{item.status_name}}</text>
|
||||
</view>
|
||||
<navigator url="/pages/plugins/excellentbuyreturntocash/profit-detail/profit-detail?id={{item.id}}" hover-class="none">
|
||||
<view class="content">
|
||||
<view class="multi-text">
|
||||
<text class="title cr-666">订单金额</text>
|
||||
<text class="value">{{item.total_price}}</text>
|
||||
<text class="unit cr-888">元</text>
|
||||
</view>
|
||||
<view class="multi-text">
|
||||
<text class="title cr-666">退款金额</text>
|
||||
<text class="value">{{item.refund_price}}</text>
|
||||
<text class="unit cr-888">元</text>
|
||||
</view>
|
||||
<view class="multi-text">
|
||||
<text class="title cr-666">有效金额</text>
|
||||
<text class="value">{{item.valid_price}}</text>
|
||||
<text class="unit cr-888">元</text>
|
||||
</view>
|
||||
<view class="multi-text">
|
||||
<text class="title cr-666">返现金额</text>
|
||||
<text class="value">{{item.profit_price}}</text>
|
||||
<text class="unit cr-888">元</text>
|
||||
</view>
|
||||
</view>
|
||||
</navigator>
|
||||
<view wx:if="{{item.status == 2}}" class="operation tr br-t-dashed">
|
||||
<button class="cr-888 br" type="default" size="mini" hover-class="none" class="br" data-index="{{index}}" data-id="{{item.id}}" bindtap="list_submit_settlement_event">立即结算</button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view wx:if="{{data_list.length == 0}}">
|
||||
<import src="/pages/common/nodata.wxml" />
|
||||
<template is="nodata" data="{{status: data_list_loding_status}}">
|
||||
</template>
|
||||
</view>
|
||||
|
||||
<import src="/pages/common/bottom_line.wxml" />
|
||||
<template is="bottom_line" data="{{status: data_bottom_line_status}}"></template>
|
||||
</view>
|
||||
</scroll-view>
|
||||
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* 导航
|
||||
*/
|
||||
.nav {
|
||||
background: #eee;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
}
|
||||
.nav .item {
|
||||
width: 16.66%;
|
||||
}
|
||||
.nav .active {
|
||||
color: #d2364c;
|
||||
}
|
||||
|
||||
/*
|
||||
* 列表
|
||||
*/
|
||||
.scroll-box {
|
||||
height: calc(100vh - 80rpx);
|
||||
}
|
||||
.data-list .item .base,
|
||||
.data-list .item .content {
|
||||
padding: 20rpx 10rpx;
|
||||
}
|
||||
.data-list .item .content .multi-text {
|
||||
line-height: 50rpx;
|
||||
}
|
||||
.data-list .item .content .multi-text .title {
|
||||
margin-right: 30rpx;
|
||||
}
|
||||
.data-list .item .content .multi-text .value {
|
||||
font-weight: 500;
|
||||
}
|
||||
.data-list .item .content .multi-text .unit {
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
.data-list .item .operation {
|
||||
padding: 20rpx 10rpx;
|
||||
}
|
||||
.data-list .item .submit-order {
|
||||
border: 1px solid #e5e5e5;
|
||||
color: #888 !important;
|
||||
}
|
||||
.data-list .item .operation button:not(:first-child) {
|
||||
margin-left: 30rpx;
|
||||
}
|
||||
Reference in New Issue
Block a user