This commit is contained in:
Ankkaya 2024-09-19 16:23:19 +08:00
parent 6f0d928fb2
commit 4f7b20b257
8 changed files with 596 additions and 454 deletions

View File

@ -17,18 +17,21 @@
<view class="statistic ss-m-t-24">
<view class="title ss-font-24 ss-m-b-20">
{{ `今日收款金额(成功收款${state.statistic?.todayPaymentCount || 0}笔)` }}
{{ `今日收款金额` }}
</view>
<view class="income flex justify-between align-center">
<view class="left flex align-center">
<view class="unit self-start"></view>
<view class="sincome ss-font-60">{{ fen2yuan(state.statistic.todayPaymentAmount || 0) }}</view>
<view class="sincome ss-font-60">{{ fen2yuan(state.statistic.todaySales || 0) }}</view>
</view>
<!-- <button class="right-btn ss-reset-button">查看详情</button> -->
</view>
<view class="des ss-m-t-20">
总销售额 {{ fen2yuan(state.statistic.totalSalesAmount) }} | 成功退款 {{ state.statistic.refundCount }} |
退款金额 {{ fen2yuan(state.statistic.refundAmount) }}
总订单数 {{ state.statistic.total }} | 已完成订单 {{ state.statistic.countCompleted }} | 总付款额
{{ fen2yuan(state.statistic.totalPayPrice) }}
</view>
<view class="des ss-m-t-20">
取消订单 {{ state.statistic.countCanceled }} | 退款金额 {{ fen2yuan(state.statistic.totalRefundPrice) }}
</view>
</view>
@ -37,13 +40,13 @@
<view class="items">
<view class="item" v-for="(item, index) in state.now" :key="item.name">
<view class="label">{{ item.name }}</view>
<view class="value">{{ index !== 0 ? item.value : fen2yuan(item.value) }}</view>
<view class="value">{{ index.name?.includes('金额') ? fen2yuan(item.value) : item.value }}</view>
<!-- <view class="last"> 昨日 {{ index === 0 ? fen2yuan(item.last) : item.last ? item.last : 0 }} </view> -->
</view>
</view>
</view>
<view class="more ss-m-t-40">
<view class="more ss-m-t-40" style="margin-bottom: 40rpx">
<view class="title ss-m-b-30">昨日数据</view>
<view class="items">
<view class="item" v-for="(item, index) in state.yesterday" :key="item.name">
@ -75,43 +78,59 @@ const bgStyle = {
const state = ref({
statistic: {
todayPaymentCount: 0,
todayPaymentAmount: 0,
totalSalesAmount: 0,
refundCount: 0,
refundAmount: 0,
todaySales: 0,
countCompleted: 0, //
total: 0, //
totalPayPrice: 0, //
countCanceled: 0, //
totalRefundPrice: 0, // 退
},
now: [
{
name: '销售金额',
key: 'Amount',
key: 'todaySales',
value: 0,
},
{
name: '订单数',
key: 'orderCount',
key: 'todayOrders',
value: 0,
},
{
name: '待支付订单',
key: 'countPayTodo',
value: 0,
},
{
name: '待核销',
key: 'verificationOrderCount',
key: 'countTodoUnverified',
value: 0,
},
{
name: '待配送',
key: 'deliveryOrderCount',
key: 'countTodoWaitingDelivery',
value: 0,
},
{
name: '退款笔数',
key: 'todayRefunds',
value: 0,
},
],
yesterday: [
{
name: '销售金额',
key: 'Amount',
key: 'yesterdaySales',
value: 0,
},
{
name: '订单数',
key: 'orderCount',
key: 'yesterdayOrders',
value: 0,
},
{
name: '退款金额',
key: 'yesterdayRefunds',
value: 0,
},
],
@ -129,12 +148,13 @@ async function getStatistic() {
state.value.statistic[key] = res.data[key]
}
state.value.now[0].value = res.data.todayPaymentAmount ?? 0
state.value.yesterday[0].value = res.data.yesterdaySalesAmount ?? 0
state.value.now[1].value = res.data.orderCount
state.value.yesterday[1].value = res.data.yesterdayOrderCount
state.value.now[2].value = res.data.verificationOrderCount
state.value.now[3].value = res.data.deliveryOrderCount
for (let obj of state.value.now) {
obj.value = res.data[obj.key] ?? 0
}
for (let obj of state.value.yesterday) {
obj.value = res.data[obj.key] ?? 0
}
}
/**
@ -200,7 +220,7 @@ onShow(() => {
}
.statistic {
height: 200rpx;
// height: 200rpx;
background-color: #fffefe;
opacity: 0.9;
border-radius: 26rpx;

View File

@ -9,7 +9,21 @@
:leftIcon="''"
>
<pb-sticky bgColor="#fff">
<pb-tabs :list="tabMaps" :scrollable="false" @change="onTabsChange" :current="state.currentTab" />
<pb-tabs :list="tabMaps" :scrollable="false" @change="onTabsChange" :current="state.currentTab">
<template #right>
<uni-icons
type="search"
size="20"
:color="state.searchStatus ? '#ff3000' : '#000'"
:style="{
position: 'relative',
top: '2px',
'margin-right': '20rpx',
}"
@click="onSearch"
></uni-icons>
</template>
</pb-tabs>
</pb-sticky>
<p-empty v-if="state.pagination.total === 0" icon="/static/order-empty.png" text="暂无订单" bgColor="transparent" />
<view v-if="state.pagination.total > 0">
@ -25,6 +39,11 @@
{{ formatOrderStatus(order) }}
</view>
</view>
<view class="ss-p-x-20">
<view class="order-no">收货人{{ order?.user.nickname }}</view>
<view class="order-no">联系电话{{ order?.user.mobile }}</view>
<view class="order-no">下单时间{{ formatDate(order.createTime) }}</view>
</view>
<view class="border-bottom" v-for="item in order.items" :key="item.id">
<p-goods-item
:img="item.picUrl"
@ -112,6 +131,29 @@
:status="state.loadStatus"
:content-text="{ contentdown: '上拉加载更多' }"
/>
<uni-popup type="right" ref="filterPopupRef" background-color="#fff">
<view class="query-form">
<uni-forms v-model="state.queryForm">
<uni-forms-item name="userNickname" label="昵称">
<uni-easyinput type="text" v-model="state.queryForm.userNickname" placeholder="请输入昵称" clearable />
</uni-forms-item>
<uni-forms-item label="联系电话" name="userMobile">
<uni-easyinput type="number" v-model="state.queryForm.userMobile" placeholder="请输入联系电话" />
</uni-forms-item>
<uni-forms-item name="no" label="订单号">
<uni-easyinput type="text" v-model="state.queryForm.no" placeholder="请输入订单号" clearable />
</uni-forms-item>
<uni-forms-item name="createTime" label="创建时间">
<uni-datetime-picker v-model="state.queryForm.createTime" type="daterange" />
</uni-forms-item>
</uni-forms>
<view class="btns">
<button class="ss-reset-button query-btn shadow" @tap="onSubmit">查询</button>
<button class="ss-reset-button reset-btn shadow" @tap="reset">重置</button>
</view>
</view>
</uni-popup>
</pb-layout>
</template>
@ -122,7 +164,7 @@ import { onLoad, onShow, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-
import { fen2yuan, formatOrderColor, formatOrderStatus, handleOrderButtons } from '@/peach/hooks/useGoods'
import peach from '@/peach'
import _, { isEmpty } from 'lodash'
import { resetPagination } from '@/peach/utils'
import { resetPagination, formatDate } from '@/peach/utils'
const bgStyle = {
backgroundColor: 'var(--ui-BG-1)',
@ -138,8 +180,17 @@ const state = ref({
pageSize: 6,
},
loadStatus: '',
queryForm: {
userNickname: '',
userMobile: '',
no: '',
createTime: [],
},
searchStatus: false,
})
const filterPopupRef = ref(null)
const tabMaps = [
{
name: '全部',
@ -192,6 +243,34 @@ function totalPricePerOrder(order) {
}
}
function onSearch() {
filterPopupRef.value.open()
}
function onSubmit() {
state.value.pagination.list = []
filterPopupRef.value.close()
state.value.searchStatus = true
getOrderList()
}
function resetFields() {
state.value.queryForm = {
userNickname: '',
userMobile: '',
no: '',
createTime: [],
}
}
function reset() {
state.value.pagination.list = []
state.value.searchStatus = false
filterPopupRef.value.close()
resetFields()
getOrderList()
}
//
function onTabsChange(e) {
if (state.value.currentTab === e.index) {
@ -224,6 +303,7 @@ async function getOrderList() {
? false
: true
: undefined,
...state.value.queryForm,
})
data.list.forEach((item) => {
@ -263,6 +343,8 @@ onReachBottom(() => {
//
onPullDownRefresh(() => {
resetPagination(state.value.pagination)
state.value.searchStatus = false
resetFields()
getOrderList()
setTimeout(function () {
uni.stopPullDownRefresh()
@ -311,8 +393,7 @@ onPullDownRefresh(() => {
.order-list-card-box {
.order-card-header {
height: 80rpx;
padding-top: 20rpx;
.order-no {
font-size: 26rpx;
font-weight: 500;
@ -370,6 +451,29 @@ onPullDownRefresh(() => {
}
}
.query-form {
width: 600rpx;
margin-top: 230rpx;
padding: 0 20rpx;
.btns {
display: flex;
gap: 20px;
.query-btn {
flex: 1;
height: 80rpx;
border-radius: 40rpx;
background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
color: $white;
}
.reset-btn {
flex: 1;
height: 80rpx;
border-radius: 40rpx;
border: 1px solid #000;
}
}
}
:deep(.uni-tooltip-popup) {
background: var(--ui-BG);
}

View File

@ -364,8 +364,9 @@ function getProduct(id) {
richValues.value = res.data.description ? res.data.description + '<p><br/></p>' : ''
// categoryList formData.value.categoryId
let tempCategory = categoryList.value.find((item) => {
return item.children.find((child) => {
return item.children?.find((child) => {
return child.id === formData.value.categoryId
})
})
@ -378,6 +379,7 @@ function getProduct(id) {
}).name
// brandList, formData.value.brandId
let tempBrand = brandList.value.find((item) => {
return item.id === formData.value.brandId
})

View File

@ -135,7 +135,7 @@
<script setup>
import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import sheep from '@/peach'
import peach from '@/peach'
import $store from '@/peach/store'
import UserApi from '@/peach/api/member/user'
import { mobile, idCard, bankName, bankCode } from '@/peach/validate/form'
@ -292,7 +292,7 @@ const rules = {
},
}
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2
const statusBarHeight = peach.$platform.device.statusBarHeight * 2
const timeSlotRef = ref(null)
const formRef = ref(null)

View File

@ -56,6 +56,10 @@ const UserUtil = {
url: '/shop/particulars/update',
method: 'PUT',
data,
custom: {
successMsg: '修改成功',
auth: true,
},
})
},

View File

@ -3,10 +3,27 @@ import request from '@/peach/request'
const OrderUtil = {
// 获取订单列表
getOrderPage: (data) => {
for (let key in data) {
if (!data[key]) {
delete data[key]
}
}
let temp = JSON.parse(JSON.stringify(data))
if (temp.createTime.length > 0) {
temp['createTime[0]'] = data.createTime[0] + ' 00:00:00'
temp['createTime[1]'] = data.createTime[1] + ' 00:00:00'
}
delete temp.createTime
const queryString = Object.keys(temp)
.map((key) => encodeURIComponent(key) + '=' + temp[key])
.join('&')
return request({
url: '/trade/order/page',
url: `/trade/order/page?${queryString}`,
method: 'GET',
params: data,
})
},

View File

@ -64,7 +64,7 @@ const http = new Request({
http.interceptors.request.use(
(config) => {
console.log(config)
// console.log(config)
// 自定义处理【auth 授权】:必须登录的接口,否则提示登录
if (config.custom.auth && !$store('user').isLogin) {
// 处理登录

View File

@ -20,10 +20,7 @@
@tap="clickHandler(item, index)"
:ref="`u-tabs__wrapper__nav__item-${index}`"
:style="[addStyle(itemStyle), { flex: scrollable ? '' : 1 }]"
:class="[
`u-tabs__wrapper__nav__item-${index}`,
item.disabled && 'u-tabs__wrapper__nav__item--disabled',
]"
:class="[`u-tabs__wrapper__nav__item-${index}`, item.disabled && 'u-tabs__wrapper__nav__item--disabled']"
>
<text
:class="[item.disabled && 'u-tabs__wrapper__nav__item__text--disabled']"
@ -205,8 +202,7 @@ export default {
return (index) => {
const style = {}
//
const customeStyle =
index === this.innerCurrent ? addStyle(this.activeStyle) : addStyle(this.inactiveStyle)
const customeStyle = index === this.innerCurrent ? addStyle(this.activeStyle) : addStyle(this.inactiveStyle)
// nvuestyle!import
if (this.list[index].disabled) {
style.color = '#c8c9cc'
@ -221,7 +217,8 @@ export default {
methods: {
$uGetRect(selector, all) {
return new Promise((resolve) => {
uni.createSelectorQuery()
uni
.createSelectorQuery()
.in(this)
[all ? 'selectAll' : 'select'](selector)
.boundingClientRect((rect) => {
@ -241,9 +238,7 @@ export default {
return
}
//
let lineOffsetLeft = this.list
.slice(0, this.innerCurrent)
.reduce((total, curr) => total + curr.rect.width, 0)
let lineOffsetLeft = this.list.slice(0, this.innerCurrent).reduce((total, curr) => total + curr.rect.width, 0)
// 线px
const lineWidth = getPx(this.lineWidth)
this.lineOffsetLeft = lineOffsetLeft + (tabItem.rect.width - lineWidth) / 2