1
This commit is contained in:
@@ -1,13 +1,5 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<!-- 顶部时间维度筛选 -->
|
||||
<view class="seg">
|
||||
<view :class="['seg-item', range==='custom' && 'active']" @click="switchRange('custom')">自定义</view>
|
||||
<view :class="['seg-item', range==='week' && 'active']" @click="switchRange('week')">本周</view>
|
||||
<view :class="['seg-item', range==='today' && 'active']" @click="switchRange('today')">今日</view>
|
||||
<view :class="['seg-item', range==='month' && 'active']" @click="switchRange('month')">本月</view>
|
||||
<view :class="['seg-item', range==='year' && 'active']" @click="switchRange('year')">本年</view>
|
||||
</view>
|
||||
<view class="page">
|
||||
|
||||
<!-- 业务类型侧边切换:销售/进货/收款/资金/盘点 -->
|
||||
<view class="content">
|
||||
@@ -16,13 +8,24 @@
|
||||
</view>
|
||||
|
||||
<view class="panel">
|
||||
<!-- 搜索框与期间显示、总额 -->
|
||||
<!-- 期间选择 + 搜索框 + 查询按钮 -->
|
||||
<view class="toolbar">
|
||||
<view class="search">
|
||||
<input class="search-input" v-model.trim="query.kw" :placeholder="placeholder" @confirm="reload" />
|
||||
<view class="period-group">
|
||||
<text class="period-label">期间</text>
|
||||
<picker mode="date" :value="startDate" @change="onStartChange">
|
||||
<view class="date-chip">{{ startDate }}</view>
|
||||
</picker>
|
||||
<text class="sep">~</text>
|
||||
<picker mode="date" :value="endDate" @change="onEndChange">
|
||||
<view class="date-chip">{{ endDate }}</view>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="search-row">
|
||||
<view class="search">
|
||||
<input class="search-input" v-model.trim="query.kw" :placeholder="placeholder" @confirm="reload" />
|
||||
</view>
|
||||
<button class="btn" size="mini" @click="reload">查询</button>
|
||||
</view>
|
||||
<view class="period">{{ periodLabel }}</view>
|
||||
<button size="mini" @click="reload">查询</button>
|
||||
</view>
|
||||
|
||||
<view class="total">合计:¥{{ totalAmount.toFixed(2) }}</view>
|
||||
@@ -89,9 +92,16 @@ export default {
|
||||
totalAmount() { return this.items.reduce((s, it) => s + Number(it.amount || 0), 0) }
|
||||
},
|
||||
onLoad() {
|
||||
try { console.log('[detail] onLoad route = pages/detail/index') } catch(e){}
|
||||
this.computeRange()
|
||||
this.reload()
|
||||
const hasToken = (() => { try { return !!uni.getStorageSync('TOKEN') } catch(e){ return false } })()
|
||||
if (!hasToken) {
|
||||
this.items = []
|
||||
this.total = 0
|
||||
uni.showToast({ title: '请登录使用该功能', icon: 'none' })
|
||||
return
|
||||
}
|
||||
try { console.log('[detail] onLoad route = pages/detail/index') } catch(e){}
|
||||
this.computeRange()
|
||||
this.reload()
|
||||
},
|
||||
methods: {
|
||||
switchBiz(k) { if (this.biz === k) return; this.biz = k; this.reload() },
|
||||
@@ -108,7 +118,9 @@ export default {
|
||||
else { start = new Date(now.getFullYear(), now.getMonth(), 1); end = new Date(now.getFullYear(), now.getMonth() + 1, 0) }
|
||||
this.startDate = fmt(start); this.endDate = fmt(end)
|
||||
},
|
||||
reload() { this.items = []; this.page = 1; this.finished = false; this.loadMore() },
|
||||
reload() { this.items = []; this.page = 1; this.finished = false; this.loadMore() },
|
||||
onStartChange(e) { this.startDate = e?.detail?.value || this.startDate; if (this.endDate && this.startDate > this.endDate) this.endDate = this.startDate; this.reload() },
|
||||
onEndChange(e) { this.endDate = e?.detail?.value || this.endDate; if (this.startDate && this.endDate < this.startDate) this.startDate = this.endDate; this.reload() },
|
||||
async loadMore() {
|
||||
if (this.loading || this.finished) return
|
||||
this.loading = true
|
||||
@@ -134,9 +146,8 @@ export default {
|
||||
|
||||
<style lang="scss">
|
||||
.page { display:flex; flex-direction: column; height: 100vh; }
|
||||
.seg { display:flex; background:#fff; border-bottom:2rpx solid $uni-border-color; }
|
||||
.seg-item { flex:1; padding: 18rpx 0; text-align:center; color:$uni-text-color-grey; }
|
||||
.seg-item.active { color:#fff; background:$uni-color-primary; border-radius: 12rpx; margin: 8rpx; }
|
||||
/* 顶部分段(如需保留,可以隐藏或后续扩展) */
|
||||
.seg { display:none; }
|
||||
|
||||
.content { display:flex; flex:1; min-height: 0; }
|
||||
.biz-tabs { width: 140rpx; background:#fff; border-right:2rpx solid $uni-border-color; display:flex; flex-direction: column; }
|
||||
@@ -144,10 +155,15 @@ export default {
|
||||
.biz.active { background:rgba(76,141,255,0.10); color:$uni-color-primary; font-weight:700; }
|
||||
|
||||
.panel { flex:1; display:flex; flex-direction: column; background:#fff; margin: 16rpx; border-radius: 16rpx; padding: 12rpx; border:2rpx solid $uni-border-color; }
|
||||
.toolbar { display:flex; align-items: center; gap: 12rpx; padding: 8rpx 6rpx; border-bottom:2rpx solid $uni-border-color; }
|
||||
.toolbar { display:flex; flex-direction: column; gap: 10rpx; padding: 10rpx 6rpx 6rpx; border-bottom:2rpx solid $uni-border-color; }
|
||||
.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:$uni-bg-color-hover; border-radius: 12rpx; padding: 12rpx; color:$uni-text-color; }
|
||||
.period { color:$uni-text-color-grey; font-size: 24rpx; padding: 0 6rpx; }
|
||||
.search-input { width:100%; background:#fff; border-radius: 12rpx; padding: 12rpx; color:$uni-text-color; border:2rpx solid #e6ebf2; }
|
||||
.btn { background:$uni-color-primary; color:#fff; border: none; }
|
||||
.total { color:$uni-color-primary; font-weight: 700; padding: 10rpx 6rpx 12rpx; background:#fff; }
|
||||
.list { flex:1; }
|
||||
.item { display:grid; grid-template-columns: 1fr auto auto; align-items:center; gap: 8rpx; padding: 18rpx 12rpx; border-bottom: 1rpx solid $uni-border-color; }
|
||||
|
||||
Reference in New Issue
Block a user