<template> <view class="page" :style="{'min-height':(h-th)+'px','padding-top':mt+'px'}"> <c-nav-bar title="交易账单"></c-nav-bar> <view class="query"> <u-icon @click="show=true" name="calendar" label="自定义查询" labelPos="right" labelColor="#666" color="#666" size="25px"></u-icon> </view> <view class="list"> <view class="time"> <text v-if="date==cdate">今日</text> <text>{{date}}</text> </view> <view class="money"> <view> <text>收入金额</text> <text class="in">+{{merchantType==10?info.paymentAmount||0:info.orderAmount||0}}</text> <text>{{merchantType==10?info.paymentCount:info.orders||0}}笔</text> </view> <view> <text>退款金额</text> <text>{{merchantType==10?info.refundAmount:info.refundOrderAmount||0}}</text> <text>{{merchantType==10?info.refundCount:info.refundOrders||0}}笔</text> </view> </view> <template v-if="merchantType==10"> <view class="li" v-for="(item,index) in info.pageData.list" :key="index" @click="detail(item)"> <view class="left"> <text>{{item.playDate}} {{item.playTime}}出发/{{item.orderType==2?'包船':'拼船'}}/{{item.boatNo}}</text> <text>{{item.payTime}}</text> </view> <view class="right">{{item.realPrice}}</text> </view> </view> </template> <template v-if="merchantType==4"> <view class="li" v-for="(item,index) in info.merchantOrderDTOS" :key="index" @click="detail(item)"> <view class="left"> <text>{{item.productName}}</text> <text>{{item.orderTime}}</text> </view> <view class="right">{{item.realityPay}}</text> </view> </view> </template> </view> <u-datetime-picker @confirm="confirmDate" @cancel="show=false" :show="show" v-model="value1" mode="date"></u-datetime-picker> </view> </template> <script> export default { data() { return { cdate: new Date().Format('yyyy-MM-dd'), date: new Date().Format('yyyy-MM-dd'), show: false, value1: Number(new Date()), mt: uni.getSystemInfoSync().statusBarHeight + 44, info: { orderAmount: 0, orders: 0, refundOrderAmount: 0, fishermanOrderDTOS: [], refundOrders: 0, }, merchantId: uni.getStorageSync('merchantId'), merchantType: uni.getStorageSync('merchantType'), } }, onLoad() { if (this.merchantType == 10) { this.getList() } else { this.getList2() } }, methods: { confirmDate(e) { // 创建一个Date对象并传入时间戳 const date = new Date(e.value); // 使用Date对象的方法获取年、月、日、小时、分钟和秒 const year = date.getFullYear(); const month = ('0' + (date.getMonth() + 1)).slice(-2); const day = ('0' + date.getDate()).slice(-2); // 格式化时间 const formattedTime = `${year}-${month}-${day}`; this.date = formattedTime; if (this.merchantType == 10) { this.getList() } else { this.getList2() } this.show = false; }, //渔家乐 getList() { this.$api.get('/scenic/order/tradeBills', { startDate: this.date, endDate: '', dateType: '1', merchantId: uni.getStorageSync('merchantId') }).then(res => { console.log(res.data) if (res.data.code === 0) { this.info = res.data.data; } else { this.info = { pageData: { list: [] }, paymentAmount: 0, paymentCount: 0, refundAmount: 0, refundCount: 0, } } }) }, //餐饮 getList2() { this.$api.post('/api/merchant/food/getMerchantFoodDeal', { dateTime: this.date, dateType: '1', merchantId: uni.getStorageSync('merchantId') }).then(res => { console.log(res.data) if (res.data.code === 0) { this.info = res.data.data; } else { this.info = { orderAmount: 0, orders: 0, refundOrderAmount: 0, fishermanOrderDTOS: [], refundOrders: 0, } } }) }, detail(item) { let info = encodeURIComponent(JSON.stringify(item)); uni.navigateTo({ url: "/pagesHouse/home/orderBillDetail?info=" + info }) } }, } </script> <style lang="less" scoped> .page { background: #F3F4F4; padding-bottom: 40rpx; box-sizing: border-box; .query { height: 100rpx; display: flex; align-items: center; padding-left: 30rpx; background-color: #fff; } .list { width: calc(100% - 36rpx); margin: 20rpx auto; padding: 36rpx 24rpx; background-color: #fff; border-radius: 24rpx; .time { text { &:first-child { font-size: 40rpx; font-weight: bold; color: #666; margin-right: 10rpx; } } margin-bottom: 30rpx; } .money { display: flex; align-items: center; &>view { width: 50%; text { display: block; font-weight: bold; &:first-child { color: #111; font-size: 28rpx; } &:nth-child(2) { font-size: 40rpx; margin: 14rpx 0 16rpx; } &:last-child { color: #999; font-size: 26rpx; font-weight: inherit; } } .in { color: #FEA400; } } } .li { display: flex; justify-content: space-between; padding: 30rpx 0; border-bottom: 1rpx solid #EFEFEF; .left { text { &:first-child { font-size: 28rpx; color: #111; margin-bottom: 15rpx; } display: block; color: #999; font-size: 26rpx; } } .right { color: #FEA400; font-size: 36rpx; font-weight: bold; } } } } </style>