This commit is contained in:
GaoHao
2025-03-10 17:26:39 +08:00
parent 490c513f48
commit cc97b6acca
26 changed files with 258 additions and 305 deletions

View File

@@ -10,36 +10,20 @@
<view class="pageSalesSummaryContent">
<view class="">
<view class="">
实收金额()
</view>
<view class="">
{{list.sale?list.sale.incomeAmountAll:0}}
</view>
<view class=""> 实收金额() </view>
<view class=""> {{list.sale?list.sale.incomeAmountAll:0}} </view>
</view>
<view class="">
<view class="">
优惠金额()
</view>
<view class="">
{{list.count?list.count.saveAmount:0}}
</view>
<view class=""> 优惠金额() </view>
<view class=""> {{list.count?list.count.saveAmount:0}} </view>
</view>
<view class="">
<view class="">
客单价()
</view>
<view class="">
{{list.count?list.count.unitPrice:0}}
</view>
<view class=""> 客单价() </view>
<view class=""> {{list.count?list.count.unitPrice:0}} </view>
</view>
<view class="">
<view class="">
会员消费()
</view>
<view class="">
{{list.vip?list.vip.useAmount:0}}
</view>
<view class=""> 会员消费() </view>
<view class=""> {{list.vip?list.vip.useAmount:0}} </view>
</view>
<view class="">
<view class="">
@@ -59,34 +43,6 @@
</view>
</view>
<view class="table-scroll">
<!-- <table class="table" cellspacing="0">
<thead class="thead">
<tr style="background-color: #aebad2;color: #fff;" height='41'>
<th style="width: 540rpx;">商品名称</th>
<th style="width: 215rpx;">总数量</th>
<th>金额</th>
</tr>
</thead>
<tbody class="tbody">
<tr v-for="(item,index) in tableList" :key="item.productId">
<td style="width: 500rpx;padding-left: 16rpx;">
<image v-if="index==0" src="../pageTable/index/images/1.png" style="width: 22rpx;height: 30rpx;"
mode=""></image>
<image v-else-if="index==1" src="../pageTable/index/images/2.png"
style="width: 22rpx;height: 30rpx;" mode=""></image>
<image v-else-if="index==2" src="../pageTable/index/images/3.png"
style="width: 22rpx;height: 30rpx;" mode=""></image>
<span v-else>{{index}}</span>
&nbsp;&nbsp;{{item.productName}}
</td>
<td style="padding-left: 16rpx;">{{item.num}}</td>
<td style="padding-left: 16rpx;">{{item.salesAmount}}</td>
</tr>
</tbody>
</table>
-->
<template>
<view class="color-333 u-font-28 bg-gray default-box-padding" style="padding-top:80px;">
<scroll-view :scroll-x="true" class="bg-fff table u-text-center">
@@ -114,7 +70,6 @@
</view>
</view>
</scroll-view>
<!-- <view style="height: 100px;"></view> -->
</view>
</template>
</view>
@@ -125,20 +80,11 @@
</template>
<script setup>
import { onMounted, getCurrentInstance, ref } from 'vue';
import datePickerview from './components/my-date-pickerview.vue'
import {
summaryTrade,
dateProduct
} from '@/http/yskApi/requestAll.js';
import {
onMounted,
getCurrentInstance,
ref
} from 'vue';
import dayjs from 'dayjs' //时间格式库
import go from '@/commons/utils/go.js'
import { productSaleDate } from '@/api/summary.js'
import { getTrade, productSaleDate } from '@/api/summary.js'
const timeList = [{
label: '今天',
@@ -165,13 +111,16 @@
const currentInstance = getCurrentInstance()
let tableList = ref([])
let day = ref(1)
function toUrl() {
go.to('PAGES_PRODUCT_SALES_RANKING', {
day: day.value
})
}
onMounted(() => {
getlist()
gettableData()
})
/**
* 获取营业数据
* @param {Object} start
* @param {Object} end
*/
function getlist(start, end) {
let startTime, endTime;
if (selected.value == 'today') {
@@ -200,37 +149,17 @@
startTime = s + ' 00:00:00'
endTime = e + ' 23:59:59'
}
summaryTrade({
shopId: uni.getStorageSync('shopId'),
startTime,
endTime,
getTrade({
beginTime: startTime,
endTime: endTime,
}).then((res) => {
list.value = res
})
}
onMounted(() => {
getlist()
gettableData()
})
function datePickerConfirm(e) {
getlist(e.start, e.end)
// gettableData() day如日期不能是1 7 30 就回报错
}
function changeTime(e) {
selected.value = e
if (e == 'custom') {
currentInstance.ctx.$refs.datePicker.toggle()
} else {
getlist()
gettableData()
}
}
// 获取表格数据
/**
* 获取销售数据
*/
function gettableData() {
if (selected.value == 'today') {
day.value = 1
@@ -248,11 +177,14 @@
page: 1,
size: 5
}).then((res) => {
tableList.value = res.productList.content
tableList.value = res.productList.records
})
}
// 获取当前时间
/**
* 获取当前时间
*/
function getdate() {
const dt = new Date();
const y = dt.getFullYear();
@@ -263,7 +195,10 @@
const ss = (dt.getSeconds() + "").padStart(2, "0");
return `${y}-${m}-${d}`;
}
// 获取昨天时间
/**
* 获取昨天时间
*/
const formatTime = () => {
let strDate = getdate()
let dateFormat = new Date(strDate);
@@ -274,6 +209,39 @@
let d = dateFormat.getDate().toString().padStart(2, '0')
return `${y}-${m}-${d}`
}
/**
* 时间切换
* @param {Object} e
*/
function changeTime(e) {
selected.value = e
if (e == 'custom') {
currentInstance.ctx.$refs.datePicker.toggle()
} else {
getlist()
gettableData()
}
}
/**
* 自定义确认
* @param {Object} e
*/
function datePickerConfirm(e) {
getlist(e.start, e.end)
}
/**
* 更多
*/
function toUrl() {
go.to('PAGES_PRODUCT_SALES_RANKING', {
day: day.value
})
}
</script>
<style>
page {

View File

@@ -1,22 +1,4 @@
<template>
<!-- <view class="table-scroll">
<table cellspacing="0">
<thead>
<tr style="background-color: #aebad2;color: #fff;" height='41'>
<th>商品名称</th>
<th>数量</th>
<th>金额</th>
</tr>
</thead>
<tbody>
<tr v-for="(item,index) in tableList" :key="item.productId">
<td style="padding-left: 16rpx;">{{item.productName}}</td>
<td style="padding-left: 16rpx;">{{item.num}}</td>
<td style="padding-left: 16rpx;">{{item.salesAmount}}</td>
</tr>
</tbody>
</table>
</view> -->
<template>
<view class="color-333 u-font-28 bg-gray default-box-padding" >
<scroll-view :scroll-x="true" class="bg-fff table u-text-center">
@@ -36,40 +18,36 @@
</view>
</view>
</scroll-view>
<!-- <view style="height: 100px;"></view> -->
</view>
</template>
</template>
<script setup>
import {
onMounted,
ref
} from 'vue';
import {
summaryTrade,
dateProduct
} from '@/http/yskApi/requestAll.js';
import { onMounted, ref } from 'vue';
import { productSaleDate } from '@/api/summary.js'
let tableList = ref([])
let props = defineProps({
day: {
type: Number
}
})
onMounted(() => {
gettableData()
})
// 获取表格数据
/**
* 获取销售数据
*/
function gettableData() {
dateProduct({
shopId: uni.getStorageSync('shopId'),
productSaleDate({
day: props.day,
page: 0,
size: 50
}).then((res) => {
tableList.value = res.productList.content
tableList.value = res.productList.records
})
}
</script>