1
This commit is contained in:
@@ -42,8 +42,21 @@ const _sfc_main = {
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
const hasToken = (() => {
|
||||
try {
|
||||
return !!common_vendor.index.getStorageSync("TOKEN");
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
})();
|
||||
if (!hasToken) {
|
||||
this.items = [];
|
||||
this.total = 0;
|
||||
common_vendor.index.showToast({ title: "请登录使用该功能", icon: "none" });
|
||||
return;
|
||||
}
|
||||
try {
|
||||
common_vendor.index.__f__("log", "at pages/detail/index.vue:92", "[detail] onLoad route = pages/detail/index");
|
||||
common_vendor.index.__f__("log", "at pages/detail/index.vue:102", "[detail] onLoad route = pages/detail/index");
|
||||
} catch (e) {
|
||||
}
|
||||
this.computeRange();
|
||||
@@ -91,6 +104,20 @@ const _sfc_main = {
|
||||
this.finished = false;
|
||||
this.loadMore();
|
||||
},
|
||||
onStartChange(e) {
|
||||
var _a;
|
||||
this.startDate = ((_a = e == null ? void 0 : e.detail) == null ? void 0 : _a.value) || this.startDate;
|
||||
if (this.endDate && this.startDate > this.endDate)
|
||||
this.endDate = this.startDate;
|
||||
this.reload();
|
||||
},
|
||||
onEndChange(e) {
|
||||
var _a;
|
||||
this.endDate = ((_a = e == null ? void 0 : e.detail) == null ? void 0 : _a.value) || this.endDate;
|
||||
if (this.startDate && this.endDate < this.startDate)
|
||||
this.startDate = this.endDate;
|
||||
this.reload();
|
||||
},
|
||||
async loadMore() {
|
||||
if (this.loading || this.finished)
|
||||
return;
|
||||
@@ -137,17 +164,7 @@ const _sfc_main = {
|
||||
};
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: common_vendor.n($data.range === "custom" && "active"),
|
||||
b: common_vendor.o(($event) => $options.switchRange("custom")),
|
||||
c: common_vendor.n($data.range === "week" && "active"),
|
||||
d: common_vendor.o(($event) => $options.switchRange("week")),
|
||||
e: common_vendor.n($data.range === "today" && "active"),
|
||||
f: common_vendor.o(($event) => $options.switchRange("today")),
|
||||
g: common_vendor.n($data.range === "month" && "active"),
|
||||
h: common_vendor.o(($event) => $options.switchRange("month")),
|
||||
i: common_vendor.n($data.range === "year" && "active"),
|
||||
j: common_vendor.o(($event) => $options.switchRange("year")),
|
||||
k: common_vendor.f($data.bizList, (b, k0, i0) => {
|
||||
a: common_vendor.f($data.bizList, (b, k0, i0) => {
|
||||
return {
|
||||
a: common_vendor.t(b.name),
|
||||
b: b.key,
|
||||
@@ -155,18 +172,23 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
d: common_vendor.o(($event) => $options.switchBiz(b.key), b.key)
|
||||
};
|
||||
}),
|
||||
l: $options.placeholder,
|
||||
m: common_vendor.o((...args) => $options.reload && $options.reload(...args)),
|
||||
n: $data.query.kw,
|
||||
o: common_vendor.o(common_vendor.m(($event) => $data.query.kw = $event.detail.value, {
|
||||
b: common_vendor.t($data.startDate),
|
||||
c: $data.startDate,
|
||||
d: common_vendor.o((...args) => $options.onStartChange && $options.onStartChange(...args)),
|
||||
e: common_vendor.t($data.endDate),
|
||||
f: $data.endDate,
|
||||
g: common_vendor.o((...args) => $options.onEndChange && $options.onEndChange(...args)),
|
||||
h: $options.placeholder,
|
||||
i: common_vendor.o((...args) => $options.reload && $options.reload(...args)),
|
||||
j: $data.query.kw,
|
||||
k: common_vendor.o(common_vendor.m(($event) => $data.query.kw = $event.detail.value, {
|
||||
trim: true
|
||||
})),
|
||||
p: common_vendor.t($options.periodLabel),
|
||||
q: common_vendor.o((...args) => $options.reload && $options.reload(...args)),
|
||||
r: common_vendor.t($options.totalAmount.toFixed(2)),
|
||||
s: $data.items.length
|
||||
l: common_vendor.o((...args) => $options.reload && $options.reload(...args)),
|
||||
m: common_vendor.t($options.totalAmount.toFixed(2)),
|
||||
n: $data.items.length
|
||||
}, $data.items.length ? {
|
||||
t: common_vendor.f($data.items, (it, k0, i0) => {
|
||||
o: common_vendor.f($data.items, (it, k0, i0) => {
|
||||
return {
|
||||
a: common_vendor.t($options.formatDate(it.orderTime || it.txTime || it.createdAt)),
|
||||
b: common_vendor.t(it.customerName || it.supplierName || it.accountName || it.remark || "-"),
|
||||
@@ -179,8 +201,8 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
};
|
||||
})
|
||||
} : {}, {
|
||||
v: common_vendor.o((...args) => $options.loadMore && $options.loadMore(...args)),
|
||||
w: common_vendor.o((...args) => $options.onCreate && $options.onCreate(...args))
|
||||
p: common_vendor.o((...args) => $options.loadMore && $options.loadMore(...args)),
|
||||
q: 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="seg"><view class="{{['seg-item', a]}}" bindtap="{{b}}">自定义</view><view class="{{['seg-item', c]}}" bindtap="{{d}}">本周</view><view class="{{['seg-item', e]}}" bindtap="{{f}}">今日</view><view class="{{['seg-item', g]}}" bindtap="{{h}}">本月</view><view class="{{['seg-item', i]}}" bindtap="{{j}}">本年</view></view><view class="content"><view class="biz-tabs"><view wx:for="{{k}}" 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="search"><input class="search-input" placeholder="{{l}}" bindconfirm="{{m}}" value="{{n}}" bindinput="{{o}}"/></view><view class="period">{{p}}</view><button size="mini" bindtap="{{q}}">查询</button></view><view class="total">合计:¥{{r}}</view><scroll-view scroll-y class="list" bindscrolltolower="{{v}}"><block wx:if="{{s}}"><view wx:for="{{t}}" 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="{{w}}">+</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="{{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>
|
||||
@@ -29,22 +29,10 @@
|
||||
flex-direction: column;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
/* 顶部分段(如需保留,可以隐藏或后续扩展) */
|
||||
.seg {
|
||||
display: flex;
|
||||
background: #fff;
|
||||
border-bottom: 2rpx solid #e5e7eb;
|
||||
}
|
||||
.seg-item {
|
||||
flex: 1;
|
||||
padding: 18rpx 0;
|
||||
text-align: center;
|
||||
color: #444;
|
||||
}
|
||||
.seg-item.active {
|
||||
color: #fff;
|
||||
background: #4C8DFF;
|
||||
border-radius: 12rpx;
|
||||
margin: 8rpx;
|
||||
display: none;
|
||||
}
|
||||
.content {
|
||||
display: flex;
|
||||
@@ -82,25 +70,53 @@
|
||||
}
|
||||
.toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12rpx;
|
||||
padding: 8rpx 6rpx;
|
||||
flex-direction: column;
|
||||
gap: 10rpx;
|
||||
padding: 10rpx 6rpx 6rpx;
|
||||
border-bottom: 2rpx solid #e5e7eb;
|
||||
}
|
||||
.period-group {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8rpx;
|
||||
background: #f6f8fb;
|
||||
border: 2rpx solid #e6ebf2;
|
||||
border-radius: 10rpx;
|
||||
padding: 8rpx 10rpx;
|
||||
}
|
||||
.period-label {
|
||||
color: #6b778c;
|
||||
}
|
||||
.date-chip {
|
||||
padding: 8rpx 12rpx;
|
||||
background: #fff;
|
||||
border: 2rpx solid #e6ebf2;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
.sep {
|
||||
color: #99a2b3;
|
||||
padding: 0 6rpx;
|
||||
}
|
||||
.search-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10rpx;
|
||||
}
|
||||
.search {
|
||||
flex: 1;
|
||||
}
|
||||
.search-input {
|
||||
width: 100%;
|
||||
background: #f1f1f1;
|
||||
background: #fff;
|
||||
border-radius: 12rpx;
|
||||
padding: 12rpx;
|
||||
color: #111;
|
||||
border: 2rpx solid #e6ebf2;
|
||||
}
|
||||
.period {
|
||||
color: #444;
|
||||
font-size: 24rpx;
|
||||
padding: 0 6rpx;
|
||||
.btn {
|
||||
background: #4C8DFF;
|
||||
color: #fff;
|
||||
border: none;
|
||||
}
|
||||
.total {
|
||||
color: #4C8DFF;
|
||||
|
||||
Reference in New Issue
Block a user