diff --git a/package2/shop/shopBill.vue b/package2/shop/shopBill.vue index e1b8507..dddd329 100644 --- a/package2/shop/shopBill.vue +++ b/package2/shop/shopBill.vue @@ -11,83 +11,74 @@ - - - - 2026 + + + + 待结算 + 已结算 - - - - 10/25-10/25账单 + + + {{searchForm.startDate || '开始日期'}} + + + + {{searchForm.endDate || '结束日期'}} + + 筛选 + 重置 + + + + + {{searchForm.status === 0 ? '待结算金额' : '已结算金额'}} + ¥{{formatMoney(pageTotalAmount)}} + 当前列表共 {{total}} 个账单日 + + + + + + + {{item.billTime}} + 共 {{item.recordCount || 0}} 笔记录 - - 共0单 - + + {{item.status === 1 ? '已结算' : '待结算'}} - - - - 商品金额 - - - ¥0.00 - - - - - 餐盒费 - - - ¥0.00 - - - - - 活动成本 - - - ¥0.00 - + + + 结算基数 + ¥{{formatMoney(item.totalBaseAmount)}} - - - 平台服务费 - - - ¥0.00 - + + 平台服务费 + ¥{{formatMoney(item.totalCommissionAmount)}} - - - - 结算金额 - - - ¥0.00 - + + + 正常结算 + ¥{{formatMoney(item.positiveSettlementAmount)}} - - - 本期期初 - - - ¥0.00 - + + 退款/售后扣款 + ¥{{formatMoney(item.negativeSettlementAmount)}} - - - 实际打款金额 - - - ¥0.00 - + + + + 应结算金额 + ¥{{formatMoney(item.totalSettlementAmount)}} + + + 暂无账单记录 + {{loadStatus === 'loading' ? '加载中...' : loadStatus === 'nomore' ? '没有更多了' : '上拉加载更多'}} @@ -96,19 +87,120 @@ export default { data() { return { - menuButtonInfo: {} + menuButtonInfo: {}, + loading: false, + loadStatus: 'more', + total: 0, + pages: 1, + dataList: [], + searchForm: { + shopId: '', + regionId: '', + status: 0, + startDate: '', + endDate: '', + pageNumber: 1, + pageSize: 10 + } } }, onShow() { this.menuButtonInfo = uni.getMenuButtonBoundingClientRect() }, onLoad(option) { - + this.searchForm.shopId = option.shopId || uni.getStorageSync('shopId') || '' + this.searchForm.regionId = this.getRegionId() + this.reload() + }, + onReachBottom() { + if (this.loading || this.searchForm.pageNumber >= this.pages) return + this.searchForm.pageNumber++ + this.getDataList() + }, + computed: { + pageTotalAmount() { + return this.dataList.reduce((total, item) => total + this.toAmount(item.totalSettlementAmount), 0) + } }, methods: { - goDetail(){ + getRegionId() { + const area = uni.getStorageSync('area') + if (!area) return '' + if (typeof area === 'object') return area.id || '' + try { + return JSON.parse(area).id || '' + } catch (e) { + return '' + } + }, + switchStatus(status) { + if (this.searchForm.status === status) return + this.searchForm.status = status + this.reload() + }, + onStartDateChange(e) { + this.searchForm.startDate = e.detail.value + }, + onEndDateChange(e) { + this.searchForm.endDate = e.detail.value + }, + clearDate() { + this.searchForm.startDate = '' + this.searchForm.endDate = '' + this.reload() + }, + reload() { + this.searchForm.pageNumber = 1 + this.pages = 1 + this.dataList = [] + this.getDataList() + }, + getDataList() { + if (!this.searchForm.shopId) { + this.tui.toast('未获取到商家信息') + return + } + this.loading = true + this.loadStatus = 'loading' + this.tui.request('/mall/admin/settlement/dateSummaryList', 'POST', this.searchForm, false, false).then((res) => { + this.loading = false + if (res.code == 200) { + const result = res.result || {} + const records = Array.isArray(result.records) ? result.records : [] + this.total = result.total || records.length + this.pages = result.pages || 1 + if (this.searchForm.pageNumber == 1) { + this.dataList = records + } else { + this.dataList = this.dataList.concat(records) + } + this.loadStatus = this.searchForm.pageNumber >= this.pages ? 'nomore' : 'more' + } else { + this.loadStatus = 'more' + this.tui.toast(res.message || '获取账单失败') + } + }).catch(() => { + this.loading = false + this.loadStatus = 'more' + }) + }, + toAmount(value) { + const amount = parseFloat(value) + return isNaN(amount) ? 0 : amount + }, + formatMoney(value) { + return this.toAmount(value).toFixed(2) + }, + goDetail(item){ uni.navigateTo({ - url:'/package2/shop/shopSettlementDetail' + url:'/package2/shop/shopSettlementDetail?shopId=' + encodeURIComponent(this.searchForm.shopId) + + '®ionId=' + encodeURIComponent(this.searchForm.regionId) + + '&billTime=' + encodeURIComponent(item.billTime) + + '&status=' + this.searchForm.status + + '&recordCount=' + (item.recordCount || 0) + + '&totalSettlementAmount=' + encodeURIComponent(item.totalSettlementAmount || 0) + + '&totalBaseAmount=' + encodeURIComponent(item.totalBaseAmount || 0) + + '&totalCommissionAmount=' + encodeURIComponent(item.totalCommissionAmount || 0) }) }, back() { @@ -129,15 +221,17 @@ .page1 { width: 100%; - height: 100%; + min-height: 100%; font-size: 24rpx; position: relative; + padding-bottom: 40rpx; } .title { background: url('https://jewel-shop.oss-cn-beijing.aliyuncs.com/8bc15960c2dc40268e295d6dd23aecce.png') no-repeat; width: 100%; - height: 20%; + height: 300rpx; + background-size: 100% 100%; } .title-sreach { @@ -160,34 +254,214 @@ flex: 1; text-align: center; } - .box1 { - width: 95%; - margin: 0 auto 20rpx; + + .bill-content { + width: 92%; + margin: -90rpx auto 0; + position: relative; + z-index: 2; + } + + .filter-card, + .summary-card, + .bill-card { background: #fff; - border-radius: 20rpx; + border-radius: 28rpx; + box-shadow: 0 14rpx 34rpx rgba(0, 35, 28, 0.08); + } + + .filter-card { padding: 20rpx; + margin-bottom: 20rpx; } - .content11{ - height: 70rpx; - line-height: 70rpx; - padding-left: 40rpx; - font-size: 28rpx; + + .status-tabs { + display: flex; + padding: 8rpx; + border-radius: 999rpx; + background: #f3f8f6; + } + + .status-tab { + flex: 1; + height: 64rpx; + line-height: 64rpx; + border-radius: 999rpx; + text-align: center; + color: #6f7f79; + font-size: 26rpx; + font-weight: 800; + } + + .status-tab.active { + background: linear-gradient(90deg, #e3ff96, #a6ffea); + color: #00231C; + } + + .date-filter { + margin-top: 18rpx; + display: flex; + align-items: center; + } + + .date-box { + width: 168rpx; + height: 58rpx; + line-height: 58rpx; + border-radius: 16rpx; + background: #f6faf8; + text-align: center; + font-size: 23rpx; font-weight: 700; + color: #00231C; } - .content22{ + + .date-box.placeholder { + color: #9aa6a2; + } + + .date-split { + margin: 0 10rpx; + color: #9aa6a2; + } + + .filter-btn, + .clear-btn { + height: 58rpx; + line-height: 58rpx; + padding: 0 20rpx; + margin-left: 12rpx; + border-radius: 16rpx; + font-weight: 800; + } + + .filter-btn { + background: #00231C; + color: #a6ffea; + } + + .clear-btn { + background: #f3f6f4; + color: #6f7f79; + } + + .summary-card { + padding: 28rpx; + margin-bottom: 20rpx; + background: linear-gradient(135deg, #00231C 0%, #14564a 100%); + color: #fff; + } + + .summary-title { + font-size: 24rpx; + opacity: 0.8; + } + + .summary-amount { + margin-top: 10rpx; + font-size: 54rpx; + font-weight: 900; + color: #e3ff96; + } + + .summary-desc { + margin-top: 8rpx; + color: rgba(255,255,255,0.72); + } + + .bill-card { + padding: 24rpx; + margin-bottom: 20rpx; + } + + .bill-head, + .bill-footer, + .bill-extra view { display: flex; - height: 60rpx; - line-height: 44rpx; - border-bottom: 1px solid #eee; + align-items: center; + justify-content: space-between; + } + + .bill-date { + font-size: 32rpx; + font-weight: 900; + } + + .bill-sub { + margin-top: 8rpx; + color: #7a8582; + font-size: 23rpx; + } + + .bill-status { + padding: 8rpx 16rpx; + border-radius: 999rpx; + background: #fff2df; + color: #f08a24; + font-weight: 900; + } + + .bill-status.done { + background: #e8fff7; + color: #0b9b73; + } + + .bill-grid { + display: grid; + grid-template-columns: 1fr 1fr; + gap: 16rpx; + margin-top: 22rpx; + } + + .bill-metric { + padding: 18rpx; + border-radius: 20rpx; + background: #f7faf8; + } + + .bill-metric text, + .bill-extra text:first-child, + .bill-footer text:first-child { + color: #7a8582; + } + + .bill-metric view { + margin-top: 8rpx; + font-size: 28rpx; + font-weight: 900; + } + + .bill-extra { + margin-top: 18rpx; + padding: 16rpx 0; + border-top: 1rpx solid #eef2ef; + border-bottom: 1rpx solid #eef2ef; + } + + .bill-extra view + view { + margin-top: 12rpx; + } + + .negative { + color: #f0441f; + } + + .bill-footer { + min-height: 72rpx; font-size: 26rpx; - font-weight: 600; } - .content33{ - height: 50rpx; - line-height: 50rpx; - display: flex; + + .settle-amount { + margin-left: 18rpx; + color: #ff5722; + font-size: 34rpx; + font-weight: 900; } - .content44{ - flex: 1; + + .empty-state, + .load-state { + padding: 60rpx 0; + text-align: center; + color: #9aa6a2; } \ No newline at end of file diff --git a/package2/shop/shopSettlementDetail.vue b/package2/shop/shopSettlementDetail.vue index d56e9ec..ad0fa92 100644 --- a/package2/shop/shopSettlementDetail.vue +++ b/package2/shop/shopSettlementDetail.vue @@ -1,5 +1,5 @@ @@ -75,26 +77,96 @@ data() { return { menuButtonInfo: {}, - } - }, - filters:{ - formatISOTime(isoString) { - const date = new Date(isoString); - const year = date.getFullYear(); - const month = (date.getMonth() + 1).toString().padStart(2, '0'); - const day = date.getDate().toString().padStart(2, '0'); - const hours = date.getHours().toString().padStart(2, '0'); - const minutes = date.getMinutes().toString().padStart(2, '0'); - const seconds = date.getSeconds().toString().padStart(2, '0'); - return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; + loading: false, + query: { + shopId: '', + regionId: '', + billTime: '', + status: 0, + recordCount: 0, + totalSettlementAmount: 0, + totalBaseAmount: 0, + totalCommissionAmount: 0 + }, + detailList: [] } }, onShow() { this.menuButtonInfo = uni.getMenuButtonBoundingClientRect() }, - onLoad() { + onLoad(option) { + this.query = { + shopId: option.shopId || uni.getStorageSync('shopId') || '', + regionId: option.regionId || this.getRegionId(), + billTime: option.billTime || '', + status: Number(option.status || 0), + recordCount: Number(option.recordCount || 0), + totalSettlementAmount: option.totalSettlementAmount || 0, + totalBaseAmount: option.totalBaseAmount || 0, + totalCommissionAmount: option.totalCommissionAmount || 0 + } + this.getDetailList() }, methods: { + getRegionId() { + const area = uni.getStorageSync('area') + if (!area) return '' + if (typeof area === 'object') return area.id || '' + try { + return JSON.parse(area).id || '' + } catch (e) { + return '' + } + }, + getDetailList() { + if (!this.query.shopId || !this.query.billTime) return + this.loading = true + this.tui.request('/mall/admin/settlement/detailList', 'POST', { + regionId: this.query.regionId, + shopId: this.query.shopId, + settlementDate: this.query.billTime, + status: this.query.status + }, false, false).then((res) => { + this.loading = false + if (res.code == 200) { + this.detailList = Array.isArray(res.result) ? res.result : [] + } else { + this.tui.toast(res.message || '获取账单明细失败') + } + }).catch(() => { + this.loading = false + }) + }, + toAmount(value) { + const amount = parseFloat(value) + return isNaN(amount) ? 0 : amount + }, + absAmount(value) { + return Math.abs(this.toAmount(value)) + }, + formatMoney(value) { + return this.toAmount(value).toFixed(2) + }, + formatDateTime(value) { + if (!value) return '-' + const date = new Date(value) + if (isNaN(date.getTime())) return value + const year = date.getFullYear() + const month = String(date.getMonth() + 1).padStart(2, '0') + const day = String(date.getDate()).padStart(2, '0') + const hours = String(date.getHours()).padStart(2, '0') + const minutes = String(date.getMinutes()).padStart(2, '0') + return `${year}-${month}-${day} ${hours}:${minutes}` + }, + goOrderDetail(item) { + if (!item || !item.orderId) { + this.tui.toast('未找到订单信息') + return + } + uni.navigateTo({ + url: '/package2/shop/orderDetail?id=' + item.orderId + }) + }, back() { uni.navigateBack() } @@ -105,7 +177,7 @@ \ No newline at end of file +