From 4f7b20b25742935df1f661e2ff666fdced4208fe Mon Sep 17 00:00:00 2001 From: Ankkaya Date: Thu, 19 Sep 2024 16:23:19 +0800 Subject: [PATCH] fix --- pages/index/index.vue | 68 +-- pages/index/order.vue | 112 ++++- pages/product/manageGoods.vue | 4 +- pages/user/info/index.vue | 4 +- peach/api/member/user.js | 4 + peach/api/trade/order.js | 95 +++-- peach/request/index.js | 2 +- peach/ui/pb-tabs/pb-tabs.vue | 761 +++++++++++++++++----------------- 8 files changed, 596 insertions(+), 454 deletions(-) diff --git a/pages/index/index.vue b/pages/index/index.vue index 371f92c..2270f91 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -17,18 +17,21 @@ - {{ `今日收款金额(成功收款${state.statistic?.todayPaymentCount || 0}笔)` }} + {{ `今日收款金额` }} - {{ fen2yuan(state.statistic.todayPaymentAmount || 0) }} + {{ fen2yuan(state.statistic.todaySales || 0) }} - 总销售额 {{ fen2yuan(state.statistic.totalSalesAmount) }} 元 | 成功退款 {{ state.statistic.refundCount }} 笔 | - 退款金额 {{ fen2yuan(state.statistic.refundAmount) }} 元 + 总订单数 {{ state.statistic.total }} 笔 | 已完成订单 {{ state.statistic.countCompleted }} 笔 | 总付款额 + {{ fen2yuan(state.statistic.totalPayPrice) }} 元 + + + 取消订单 {{ state.statistic.countCanceled }} 笔 | 退款金额 {{ fen2yuan(state.statistic.totalRefundPrice) }} 元 @@ -37,13 +40,13 @@ {{ item.name }} - {{ index !== 0 ? item.value : fen2yuan(item.value) }} + {{ index.name?.includes('金额') ? fen2yuan(item.value) : item.value }} - + 昨日数据 @@ -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; diff --git a/pages/index/order.vue b/pages/index/order.vue index 6acb997..4e4bc1e 100644 --- a/pages/index/order.vue +++ b/pages/index/order.vue @@ -9,7 +9,21 @@ :leftIcon="''" > - + + + @@ -25,6 +39,11 @@ {{ formatOrderStatus(order) }} + + 收货人:{{ order?.user.nickname }} + 联系电话:{{ order?.user.mobile }} + 下单时间:{{ formatDate(order.createTime) }} + + + + + + + + + + + + + + + + + + + + + + + + @@ -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); } diff --git a/pages/product/manageGoods.vue b/pages/product/manageGoods.vue index 037ed6c..f8529b2 100644 --- a/pages/product/manageGoods.vue +++ b/pages/product/manageGoods.vue @@ -364,8 +364,9 @@ function getProduct(id) { richValues.value = res.data.description ? res.data.description + '


' : '' // 循环遍历 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 }) diff --git a/pages/user/info/index.vue b/pages/user/info/index.vue index 6d4f7a1..cb80c65 100644 --- a/pages/user/info/index.vue +++ b/pages/user/info/index.vue @@ -135,7 +135,7 @@