2
This commit is contained in:
@@ -5,8 +5,7 @@ const API_OF = {
|
||||
sale: "/api/orders",
|
||||
purchase: "/api/purchase-orders",
|
||||
collect: "/api/payments",
|
||||
fund: "/api/other-transactions",
|
||||
stock: "/api/inventories/logs"
|
||||
fund: "/api/other-transactions"
|
||||
};
|
||||
const _sfc_main = {
|
||||
data() {
|
||||
@@ -16,18 +15,19 @@ const _sfc_main = {
|
||||
{ key: "sale", name: "出货" },
|
||||
{ key: "purchase", name: "进货" },
|
||||
{ key: "collect", name: "收款" },
|
||||
{ key: "fund", name: "资金" },
|
||||
{ key: "stock", name: "盘点" }
|
||||
{ key: "fund", name: "资金" }
|
||||
],
|
||||
range: "month",
|
||||
query: { kw: "" },
|
||||
items: [],
|
||||
page: 1,
|
||||
size: 20,
|
||||
size: 15,
|
||||
finished: false,
|
||||
loading: false,
|
||||
startDate: "",
|
||||
endDate: ""
|
||||
endDate: "",
|
||||
nonVipRetentionDays: 0,
|
||||
isVip: false
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -56,7 +56,7 @@ const _sfc_main = {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
common_vendor.index.__f__("log", "at pages/detail/index.vue:102", "[detail] onLoad route = pages/detail/index");
|
||||
common_vendor.index.__f__("log", "at pages/detail/index.vue:104", "[detail] onLoad route = pages/detail/index");
|
||||
} catch (e) {
|
||||
}
|
||||
this.computeRange();
|
||||
@@ -133,12 +133,43 @@ const _sfc_main = {
|
||||
if (list.length < this.size)
|
||||
this.finished = true;
|
||||
this.page += 1;
|
||||
await this.hintIfNonVipOutOfWindow();
|
||||
} catch (e) {
|
||||
common_vendor.index.showToast({ title: "加载失败", icon: "none" });
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
async hintIfNonVipOutOfWindow() {
|
||||
try {
|
||||
if (this.isVip && this.isVip === true)
|
||||
return;
|
||||
if (!this.nonVipRetentionDays) {
|
||||
const v = await common_http.get("/api/vip/status");
|
||||
this.isVip = !!(v == null ? void 0 : v.isVip);
|
||||
this.nonVipRetentionDays = Number((v == null ? void 0 : v.nonVipRetentionDays) || 60);
|
||||
if (this.isVip)
|
||||
return;
|
||||
}
|
||||
if (!this.startDate)
|
||||
return;
|
||||
const start = new Date(this.startDate).getTime();
|
||||
const threshold = Date.now() - this.nonVipRetentionDays * 24 * 3600 * 1e3;
|
||||
if (start < threshold) {
|
||||
common_vendor.index.showModal({
|
||||
title: "提示",
|
||||
content: `普通用户仅显示近${this.nonVipRetentionDays}天数据,开通VIP可查看全部历史。`,
|
||||
confirmText: "去开通VIP",
|
||||
cancelText: "我知道了",
|
||||
success: (r) => {
|
||||
if (r.confirm)
|
||||
common_vendor.index.navigateTo({ url: "/pages/my/vip" });
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
}
|
||||
},
|
||||
formatDate(s) {
|
||||
if (!s)
|
||||
return "";
|
||||
@@ -201,8 +232,14 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
};
|
||||
})
|
||||
} : {}, {
|
||||
p: common_vendor.o((...args) => $options.loadMore && $options.loadMore(...args)),
|
||||
q: common_vendor.o((...args) => $options.onCreate && $options.onCreate(...args))
|
||||
p: $data.items.length && !$data.finished
|
||||
}, $data.items.length && !$data.finished ? {
|
||||
q: $data.loading
|
||||
} : {}, {
|
||||
r: $data.finished && $data.items.length
|
||||
}, $data.finished && $data.items.length ? {} : {}, {
|
||||
s: common_vendor.o((...args) => $options.loadMore && $options.loadMore(...args)),
|
||||
t: common_vendor.o((...args) => $options.onCreate && $options.onCreate(...args))
|
||||
});
|
||||
}
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
||||
|
||||
@@ -1 +1 @@
|
||||
<view class="page"><view class="content"><view class="biz-tabs"><view wx:for="{{a}}" wx:for-item="b" wx:key="b" class="{{['biz', b.c]}}" bindtap="{{b.d}}">{{b.a}}</view></view><view class="panel"><view class="toolbar"><view class="period-group"><text class="period-label">期间</text><picker mode="date" value="{{c}}" bindchange="{{d}}"><view class="date-chip">{{b}}</view></picker><text class="sep">~</text><picker mode="date" value="{{f}}" bindchange="{{g}}"><view class="date-chip">{{e}}</view></picker></view><view class="search-row"><view class="search"><input class="search-input" placeholder="{{h}}" bindconfirm="{{i}}" value="{{j}}" bindinput="{{k}}"/></view><button class="btn" size="mini" bindtap="{{l}}">查询</button></view></view><view class="total">合计:¥{{m}}</view><scroll-view scroll-y class="list" bindscrolltolower="{{p}}"><block wx:if="{{n}}"><view wx:for="{{o}}" wx:for-item="it" wx:key="g" class="item" bindtap="{{it.h}}"><view class="item-left"><view class="date">{{it.a}}</view><view class="name">{{it.b}}</view><view class="no">{{it.c}}</view></view><view class="{{['amount', it.e && 'in', it.f && 'out']}}">¥ {{it.d}}</view><view class="arrow">›</view></view></block><view wx:else class="empty">暂无数据</view></scroll-view><view class="fab" bindtap="{{q}}">+</view></view></view></view>
|
||||
<view class="page"><view class="content"><view class="biz-tabs"><view wx:for="{{a}}" wx:for-item="b" wx:key="b" class="{{['biz', b.c]}}" bindtap="{{b.d}}">{{b.a}}</view></view><view class="panel"><view class="toolbar"><view class="period-group"><text class="period-label">期间</text><picker mode="date" value="{{c}}" bindchange="{{d}}"><view class="date-chip">{{b}}</view></picker><text class="sep">~</text><picker mode="date" value="{{f}}" bindchange="{{g}}"><view class="date-chip">{{e}}</view></picker></view><view class="search-row"><view class="search"><input class="search-input" placeholder="{{h}}" bindconfirm="{{i}}" value="{{j}}" bindinput="{{k}}"/></view><button class="btn" size="mini" bindtap="{{l}}">查询</button></view></view><view class="total">合计:¥{{m}}</view><scroll-view scroll-y class="list" bindscrolltolower="{{s}}"><block wx:if="{{n}}"><view wx:for="{{o}}" wx:for-item="it" wx:key="g" class="item" bindtap="{{it.h}}"><view class="item-left"><view class="date">{{it.a}}</view><view class="name">{{it.b}}</view><view class="no">{{it.c}}</view></view><view class="{{['amount', it.e && 'in', it.f && 'out']}}">¥ {{it.d}}</view><view class="arrow">›</view></view></block><view wx:else class="empty">暂无数据</view><view wx:if="{{p}}" class="loading" hidden="{{!q}}">加载中...</view><view wx:if="{{r}}" class="finished">没有更多了</view></scroll-view><view class="fab" bindtap="{{t}}">+</view></view></view></view>
|
||||
@@ -66,7 +66,6 @@
|
||||
margin: 16rpx;
|
||||
border-radius: 16rpx;
|
||||
padding: 12rpx;
|
||||
border: 2rpx solid #e5e7eb;
|
||||
}
|
||||
.toolbar {
|
||||
display: flex;
|
||||
@@ -80,7 +79,6 @@
|
||||
align-items: center;
|
||||
gap: 8rpx;
|
||||
background: #f6f8fb;
|
||||
border: 2rpx solid #e6ebf2;
|
||||
border-radius: 10rpx;
|
||||
padding: 8rpx 10rpx;
|
||||
}
|
||||
@@ -100,23 +98,42 @@
|
||||
.search-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10rpx;
|
||||
gap: 16rpx;
|
||||
}
|
||||
.search {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
}
|
||||
.search-input {
|
||||
width: 100%;
|
||||
flex: 1;
|
||||
height: 72rpx;
|
||||
line-height: 72rpx;
|
||||
padding: 0 24rpx;
|
||||
box-sizing: border-box;
|
||||
background: #fff;
|
||||
border-radius: 12rpx;
|
||||
padding: 12rpx;
|
||||
color: #111;
|
||||
border: 2rpx solid #e6ebf2;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
.btn {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 72rpx;
|
||||
padding: 0 32rpx;
|
||||
margin-left: 4rpx;
|
||||
border-radius: 12rpx;
|
||||
background: #4C8DFF;
|
||||
color: #fff;
|
||||
border: none;
|
||||
font-size: 26rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.btn::after {
|
||||
border: none;
|
||||
}
|
||||
.total {
|
||||
color: #4C8DFF;
|
||||
@@ -127,6 +144,16 @@
|
||||
.list {
|
||||
flex: 1;
|
||||
}
|
||||
.loading {
|
||||
text-align: center;
|
||||
padding: 20rpx 0;
|
||||
color: #444;
|
||||
}
|
||||
.finished {
|
||||
text-align: center;
|
||||
padding: 20rpx 0;
|
||||
color: #444;
|
||||
}
|
||||
.item {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr auto auto;
|
||||
|
||||
Reference in New Issue
Block a user