优化本地生活商家账单

This commit is contained in:
wangxiaowei 2024-11-06 17:27:02 +08:00
parent 0fbcbd5b2c
commit 16bd2006a0
2 changed files with 164 additions and 17 deletions

@ -38,7 +38,7 @@
<view class="center">
<view class="text-center">营业额(元)</view>
<view class="u-text-center m-t-20">
<price-format weight="bold" :first-size="66" :subscript-size="46" :second-size="36" :price="info.current_day_total_amount"
<price-format weight="bold" :first-size="66" :subscript-size="46" :second-size="36" :price="info.current_report_total_amount"
:color="colorConfig.primary" />
</view>
</view>
@ -46,14 +46,12 @@
<view class="sale-info">
<view class="item">
<view class="label">共交易笔数</view>
<price-format weight="bold" :first-size="36" :subscript-size="36" :second-size="36" :price="info.count_trade"
:color="colorConfig.primary" />
<text class="trade">{{info.count_trade}}</text>
</view>
<view class="divider"></view>
<view class="item">
<view class="label">成功交易笔数</view>
<price-format weight="bold" :first-size="36" :subscript-size="36" :second-size="36" :price="info.success_trade"
:color="colorConfig.primary" />
<text class="trade">{{info.success_trade}}</text>
</view>
<view class="divider"></view>
<view class="item">
@ -67,9 +65,8 @@
<view class="block m-t-20">
<u-cell-group title="营业汇总明细" :border="false">
{{lstore_id}}
<router-link :to="{path: '/bundle_b/pages/local_shop/local_bill_order', query: {lstore_id}}">
<u-cell-item icon="order" title="订单列表" :border-bottom="false" @click="toOrder" hover-class="none"></u-cell-item>
<u-cell-item icon="order" title="账单列表" :border-bottom="false" @click="toOrder" hover-class="none"></u-cell-item>
</router-link>
</u-cell-group> </view>
@ -89,7 +86,7 @@
day: '',
report: 1,
info: [],
filterDay: []
filterDay: [],
}
},
onLoad(e) {
@ -97,12 +94,15 @@
this.lstore_id = e.lstore_id
}
const date = new Date().getTime()
this.day = this.$u.date(date, 'yyyy-mm-d')
this.setDate()
this.getData()
},
methods: {
setDate() {
const date = new Date().getTime()
this.day = this.$u.date(date, 'mm-d')
},
async getData() {
const {code, data} = await countData({
lstore_id: this.lstore_id,
@ -119,12 +119,14 @@
changeReport(type) {
this.report = type
this.filterDay = []
this.setDate()
this.getData()
},
// 获取日期
filterDate(e) {
this.day = e.startDate
this.day = `${e.startMonth}-${e.startDay}—${e.endMonth}-${e.endDay}`
this.filterDay = {
startDate: e.startDate,
endDate: e.endDate
@ -211,5 +213,11 @@
align-items: center;
padding: 20rpx;
}
.trade {
color: #FF2C3C;
font-size: 36rpx;
font-weight: bold;
}
}
</style>

@ -1,6 +1,10 @@
<template>
<view class="order">
<mescroll-uni ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :up="upOption">
<view class="all-order" @click="showPopup = true">
全部账单
<u-icon name="arrow-down" size="24" class="m-l-10"></u-icon>
</view>
<view class="list" v-for="(item, index) in list" :key="index">
<view class="info flex">
<view class="bold m-l-10">{{item.account_name}}</view>
@ -23,6 +27,35 @@
</view>
</view>
</mescroll-uni>
<u-popup v-model="showPopup" mode="top" height="50%">
<view class="filter">
<view class="m-b-20">
<view class="bold">日期</view>
<view class="flex m-t-20">
<view :class="'time-block m-r-10 ' + (filter.startTime ? 'active' : '')" @tap="filter.showStartTime = true">{{filter.startTime || '开始日期'}}</view>
<view class="border"></view>
<view :class="'time-block m-l-10 ' + (filter.endTime ? 'active' : '')" @tap="filter.showEndTime = true">{{filter.endTime || '结束日期'}}</view>
</view>
</view>
<!-- <view class="m-b-20">
<view class="bold">支付类型</view>
<view class="grid m-t-20">
<view @tap="selectPayType(item.id)" v-for="(item, index) in filter.payType" :key="index" :class="'item ' + (filter.selectPay == item.id ? 'active' : '')">
<view>{{item.text}}</view>
</view>
</view>
</view> -->
<view class="flex popup-btn-group">
<u-button type="info" hover-class="none" shape="circle" :hair-line="false" size="medium" :custom-style="{backgroundColor: '#ccc', color: '#fff'}" class="m-r-20" @click="clearFilter">清空</u-button>
<u-button type="primary" hover-class="none" shape="circle" size="medium" class="m-l-20" @click="confirmFilter">确定</u-button>
</view>
</view>
</u-popup>
<u-picker v-model="filter.showStartTime" mode="time" @confirm="confirmStartTime"></u-picker>
<u-picker v-model="filter.showEndTime" mode="time" @confirm="confirmEndTime"></u-picker>
</view>
</template>
@ -41,6 +74,18 @@
tip: '暂无数据~', // 提示
fixed: true
}
},
showPopup: false,
filter: {
showStartTime: false,
startTime: '',
showEndTime: false,
endTime: '',
payType: [
{id: 1, text: '线下支付'},
{id: 2, text: '商品支付'},
],
selectPay: 0,
}
}
},
@ -55,13 +100,17 @@
},
async upCallback(page) {
let pageNum = page.num; // 页码, 默认从1开始
let pageSize = page.size; // 页长, 默认每页10条
const startTime = this.filter.startTime
const endTime = this.filter.endTime
const selectPay = this.filter.selectPay
getLocalOrderList({
page_size: pageSize,
page_no: pageNum,
lstore_id: this.lstore_id
page_size: page.size,
page_no: page.num,
lstore_id: this.lstore_id,
start_time: startTime,
end_time: endTime,
select_pay: selectPay,
}).then(({
data
}) => {
@ -73,6 +122,38 @@
this.mescroll.endSuccess(curPageLen, hasNext);
})
},
confirmStartTime(e) {
this.filter.startTime = `${e.year}-${e.month}-${e.day}`
},
confirmEndTime(e) {
this.filter.endTime = `${e.year}-${e.month}-${e.day}`
if (this.filter.endTime < this.filter.startTime) {
this.filter.endTime = ''
this.$toast({
title: '结束日期不能小于开始日期'
})
return false
}
},
selectPayType(id) {
this.filter.selectPay = id
},
clearFilter() {
this.filter.startTime = ''
this.filter.endTime = ''
this.filter.selectPay = 0
},
confirmFilter() {
this.showPopup = false
this.refresh()
}
},
}
</script>
@ -85,6 +166,15 @@
.order {
padding: 20rpx;
.all-order {
width: 200rpx;
background-color: #ccc;
border-radius: 40rpx;
text-align: center;
padding: 10rpx;
margin: 20rpx;
}
.list {
background-color: #fff;
border-radius: 20rpx;
@ -109,5 +199,54 @@
color: #000;
}
}
.filter {
height: 100%;
padding: 20rpx;
position: relative;
.grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 24rpx;
justify-content: space-between;
align-items: center;
}
.time-block {
width: 200rpx;
text-align: center;
height: 60rpx;
line-height: 60rpx;
padding: 0;
background-color: #ccc;
border-radius: 10rpx;
color: #fff;
}
.item {
background-color: #ccc;
padding: 10rpx 20rpx;
border-radius: 10rpx;
color: #fff;
}
.border {
width: 40rpx;
height: 2rpx;
background-color: #ccc;
}
.active {
background-color: #FF2C3C;
}
.popup-btn-group {
position: absolute;
bottom: 20rpx;
left: 50%;
transform: translateX(-50%);
}
}
}
</style>