流水统计请求
This commit is contained in:
1 parent
d2f3ab2cc0
commit
2a2ba187e8
4 files changed
+105
-102
No files matched your search
@@ -149,7 +149,7 @@ const handlePay = () => {
|
||||
})
|
||||
}
|
||||
|
||||
// handle pay
|
||||
// 支付
|
||||
const pay = async () => {
|
||||
try {
|
||||
uni.showLoading({ title: "支付中...", mask: true })
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<view class="h-30rpx" />
|
||||
<view class="bg-white rounded-12rpx p-20rpx flex justify-between items-center">
|
||||
<text class="text-30 font-600">流水统计</text>
|
||||
<tm-text color="#999999">{{ state.formatVal }}</tm-text>
|
||||
<tm-text color="#999999">{{ formatVal }}</tm-text>
|
||||
<view class="flex items-center cursor-pointer">
|
||||
<tm-between-time
|
||||
start="2020-1-1"
|
||||
@@ -51,38 +51,42 @@
|
||||
<view class="h-20rpx" />
|
||||
|
||||
<view class="bg-white rounded-16rpx p-2 mb-2 shadow-md" v-for="(v, i) in list" :key="i">
|
||||
<view class="text-28 text-gray-800 font-medium px-2 mb-2">
|
||||
{{ "2022-01-01" }}
|
||||
<view class="flex justify-between items-center text-sm text-gray-800 mb-1">
|
||||
<view class="flex items-center">
|
||||
<image class="w-50rpx h-50rpx rounded-8rpx" :src="filePath(v.logoPic)" mode="aspectFill" />
|
||||
<view>{{ v.merchantName }}</view>
|
||||
</view>
|
||||
<view>{{ v.day }}</view>
|
||||
</view>
|
||||
<view class="bg-gray-100 rounded-12rpx p-2">
|
||||
<view class="flex justify-between mb-2">
|
||||
<view class="flex-1 flex items-center p-2 bg-white rounded-8rpx mr-1">
|
||||
<text class="flex-1 text-center text-gray-600">流水金额</text>
|
||||
<text class="flex-1 text-center text-26 text-gray-800 font-medium">¥{{ 1145 }}</text>
|
||||
<view class="bg-gray-100 rounded-12rpx p-1">
|
||||
<view class="flex justify-between mb-1">
|
||||
<view class="flex-1 flex items-center p-1 bg-white rounded-8rpx">
|
||||
<text class="flex-1 text-sm text-center text-gray-600">流水金额</text>
|
||||
<text class="flex-1 text-sm text-center text-gray-800">¥ {{ hooks.useMoney(v.totalPayPrice) }}</text>
|
||||
</view>
|
||||
<view class="flex-1 flex items-center p-2 bg-white rounded-8rpx ml-1">
|
||||
<text class="flex-1 text-center text-gray-600">流水次数</text>
|
||||
<text class="flex-1 text-center text-26 text-gray-800 font-medium">{{ 1145 }}</text>
|
||||
<view class="flex-1 flex items-center p-1 bg-white rounded-8rpx ml-1">
|
||||
<text class="flex-1 text-sm text-center text-gray-600">流水次数</text>
|
||||
<text class="flex-1 text-sm text-center text-gray-800">{{ v.totalPayCount }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex justify-between mb-2">
|
||||
<view class="flex-1 flex items-center p-2 bg-white rounded-8rpx mr-1">
|
||||
<text class="flex-1 text-center text-gray-600">退款金额</text>
|
||||
<text class="flex-1 text-center text-26 text-red-500 font-medium">¥{{ 1145 }}</text>
|
||||
<view class="flex justify-between mb-1">
|
||||
<view class="flex-1 flex items-center p-1 bg-white rounded-8rpx">
|
||||
<text class="flex-1 text-sm text-center text-gray-600">盈利金额</text>
|
||||
<text class="flex-1 text-sm text-center text-green-500">¥ {{ hooks.useMoney(v.totalProfitPrice) }}</text>
|
||||
</view>
|
||||
<view class="flex-1 flex items-center p-2 bg-white rounded-8rpx ml-1">
|
||||
<text class="flex-1 text-center text-gray-600">退款次数</text>
|
||||
<text class="flex-1 text-center text-26 text-red-500 font-medium">{{ 1145 }}</text>
|
||||
<view class="flex-1 flex items-center p-1 bg-white rounded-8rpx ml-1">
|
||||
<text class="flex-1 text-sm text-center text-gray-600">盈利次数</text>
|
||||
<text class="flex-1 text-sm text-center text-green-500">{{ v.totalProfitCount }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex justify-between mb-0">
|
||||
<view class="flex-1 flex items-center p-2 bg-white rounded-8rpx mr-1">
|
||||
<text class="flex-1 text-center text-gray-600">盈利金额</text>
|
||||
<text class="flex-1 text-center text-26 text-green-500 font-medium">¥{{ 1145 }}</text>
|
||||
<view class="flex-1 flex items-center p-1 bg-white rounded-8rpx">
|
||||
<text class="flex-1 text-sm text-center text-gray-600">退款金额</text>
|
||||
<text class="flex-1 text-sm text-center text-red-500">¥ {{ hooks.useMoney(v.totalRefundPrice) }}</text>
|
||||
</view>
|
||||
<view class="flex-1 flex items-center p-2 bg-white rounded-8rpx ml-1">
|
||||
<text class="flex-1 text-center text-gray-600">盈利次数</text>
|
||||
<text class="flex-1 text-center text-26 text-green-500 font-medium">{{ 1145 }}</text>
|
||||
<view class="flex-1 flex items-center p-1 bg-white rounded-8rpx ml-1">
|
||||
<text class="flex-1 text-sm text-center text-gray-600">退款次数</text>
|
||||
<text class="flex-1 text-sm text-center text-red-500">{{ v.totalRefundCount || 0 }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -92,9 +96,10 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive } from "vue"
|
||||
import { onShow } from "@dcloudio/uni-app"
|
||||
import { ref, reactive, computed } from "vue"
|
||||
import { onLoad, onShow } from "@dcloudio/uni-app"
|
||||
import { hooks } from "@@/index"
|
||||
import { filePath } from "@@/utils/file"
|
||||
import { flowStatisticsApi } from "@@/api"
|
||||
|
||||
const pageRef = ref<any>(null)
|
||||
@@ -105,8 +110,13 @@ const state = reactive<any>({
|
||||
formatVal: "",
|
||||
date: "",
|
||||
})
|
||||
const { list, startPage, scroll } = hooks.usePage(pageRef, flowStatisticsApi.page, null, "data.records")
|
||||
const formatVal = computed(() => (state.date.length === 2 ? state.formatVal : ""))
|
||||
const { list, startPage, scroll } = hooks.usePage(pageRef, flowStatisticsApi.page, null, "data")
|
||||
|
||||
onLoad(() => {
|
||||
const app = getApp()
|
||||
app._initTabbar()
|
||||
})
|
||||
onShow(() => {
|
||||
const isLogin = hooks.useCheckLogin()
|
||||
if (!isLogin) return
|
||||
@@ -121,8 +131,6 @@ const query = (page: number, pagesize: number) => {
|
||||
// 时间范围选择器确认
|
||||
const datePickerConfirm = (date: any) => {
|
||||
state.pa.createTimeList = date.map((v: any) => hooks.useTime(v, "{y}-{m}-{d}"))
|
||||
console.log("xx", state.pa.createTimeList)
|
||||
|
||||
pageRef.value.reload(false)
|
||||
}
|
||||
</script>
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive } from "vue"
|
||||
import { ref, reactive, computed } from "vue"
|
||||
import { onLoad, onShow } from "@dcloudio/uni-app"
|
||||
|
||||
import { hooks, router } from "@@/index"
|
||||
@@ -24,7 +24,10 @@ const state = reactive<any>({
|
||||
},
|
||||
})
|
||||
|
||||
onLoad(() => {})
|
||||
onLoad(() => {
|
||||
const app = getApp()
|
||||
app._initTabbar()
|
||||
})
|
||||
onShow(async () => {
|
||||
const isLogin = await hooks.useCheckLogin()
|
||||
if (!isLogin) return
|
||||
@@ -108,13 +111,11 @@ const doRefund = (v: any) => {
|
||||
{{ hooks.useTime(v.createTime, "{y}-{m}-{d} {h}:{i}:{s}") }}
|
||||
</text>
|
||||
</view>
|
||||
<!-- <view class="second-text-22">
|
||||
{{ hooks.useEnum("hardwareRefundStatusEnum", v.refundStatus) }}
|
||||
</view> -->
|
||||
<view class="second-text-22">{{ hooks.useEnum("hardwareRefundStatusEnum", v.refundStatus) }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="relative h-0rpx m-t-[-10rpx] flex justify-end items-center">
|
||||
<view class="relative h-0rpx m-t-[20rpx] flex justify-end items-center">
|
||||
<!-- <view class="absolute top-0 right-0 bottom-0 left-0 h-180rpx">
|
||||
<scroll-view scroll-x class="flex-row-center whitespace-nowrap">
|
||||
<view class="flex-row items-center">
|
||||
@@ -152,5 +153,3 @@ const doRefund = (v: any) => {
|
||||
</z-paging>
|
||||
</crud-layout>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
+60
-64
@@ -1,70 +1,66 @@
|
||||
export const useMoney = (num) => {
|
||||
if (typeof num === "undefined") return "0.00";
|
||||
const parsedNumber = typeof num === "string" ? parseFloat(num) : num;
|
||||
return (parsedNumber / 100.0).toFixed(1);
|
||||
};
|
||||
if (typeof num === "undefined") return "0.00"
|
||||
const parsedNumber = typeof num === "string" ? parseFloat(num) : num
|
||||
return (parsedNumber / 100.0).toFixed(2)
|
||||
}
|
||||
|
||||
export function useFormatNum(
|
||||
prefix: string,
|
||||
type: "exact" | string,
|
||||
num: number
|
||||
) {
|
||||
num = num || 0;
|
||||
if (type === "exact") {
|
||||
return prefix + num;
|
||||
}
|
||||
if (num < 10) {
|
||||
return `${prefix}≤10`;
|
||||
}
|
||||
// 情况三:大于 10,除第一位外,其它位都显示为0
|
||||
// 例如:100 - 199 显示为 100+
|
||||
// 9000 - 9999 显示为 9000+
|
||||
const numStr = num.toString();
|
||||
const first = numStr[0];
|
||||
const other = "0".repeat(numStr.length - 1);
|
||||
return `${prefix}${first}${other}+`;
|
||||
export function useFormatNum(prefix: string, type: "exact" | string, num: number) {
|
||||
num = num || 0
|
||||
if (type === "exact") {
|
||||
return prefix + num
|
||||
}
|
||||
if (num < 10) {
|
||||
return `${prefix}≤10`
|
||||
}
|
||||
// 情况三:大于 10,除第一位外,其它位都显示为0
|
||||
// 例如:100 - 199 显示为 100+
|
||||
// 9000 - 9999 显示为 9000+
|
||||
const numStr = num.toString()
|
||||
const first = numStr[0]
|
||||
const other = "0".repeat(numStr.length - 1)
|
||||
return `${prefix}${first}${other}+`
|
||||
}
|
||||
|
||||
export function useTime(time, pattern) {
|
||||
if (arguments.length === 0 || !time) {
|
||||
return null;
|
||||
}
|
||||
const format = pattern || "{y}-{m}-{d} {h}:{i}:{s}";
|
||||
let date;
|
||||
if (typeof time === "object") {
|
||||
date = time;
|
||||
} else {
|
||||
if (typeof time === "string" && /^[0-9]+$/.test(time)) {
|
||||
time = parseInt(time);
|
||||
} else if (typeof time === "string") {
|
||||
time = time
|
||||
.replace(new RegExp(/-/gm), "/")
|
||||
.replace("T", " ")
|
||||
.replace(new RegExp(/\.[\d]{3}/gm), "");
|
||||
}
|
||||
if (typeof time === "number" && time.toString().length === 10) {
|
||||
time = time * 1000;
|
||||
}
|
||||
date = new Date(time);
|
||||
}
|
||||
const formatObj = {
|
||||
y: date.getFullYear(),
|
||||
m: date.getMonth() + 1,
|
||||
d: date.getDate(),
|
||||
h: date.getHours(),
|
||||
i: date.getMinutes(),
|
||||
s: date.getSeconds(),
|
||||
a: date.getDay(),
|
||||
};
|
||||
const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
|
||||
let value = formatObj[key];
|
||||
if (key === "a") {
|
||||
return ["日", "一", "二", "三", "四", "五", "六"][value];
|
||||
}
|
||||
if (result.length > 0 && value < 10) {
|
||||
value = "0" + value;
|
||||
}
|
||||
return value || 0;
|
||||
});
|
||||
return time_str;
|
||||
if (arguments.length === 0 || !time) {
|
||||
return null
|
||||
}
|
||||
const format = pattern || "{y}-{m}-{d} {h}:{i}:{s}"
|
||||
let date
|
||||
if (typeof time === "object") {
|
||||
date = time
|
||||
} else {
|
||||
if (typeof time === "string" && /^[0-9]+$/.test(time)) {
|
||||
time = parseInt(time)
|
||||
} else if (typeof time === "string") {
|
||||
time = time
|
||||
.replace(new RegExp(/-/gm), "/")
|
||||
.replace("T", " ")
|
||||
.replace(new RegExp(/\.[\d]{3}/gm), "")
|
||||
}
|
||||
if (typeof time === "number" && time.toString().length === 10) {
|
||||
time = time * 1000
|
||||
}
|
||||
date = new Date(time)
|
||||
}
|
||||
const formatObj = {
|
||||
y: date.getFullYear(),
|
||||
m: date.getMonth() + 1,
|
||||
d: date.getDate(),
|
||||
h: date.getHours(),
|
||||
i: date.getMinutes(),
|
||||
s: date.getSeconds(),
|
||||
a: date.getDay(),
|
||||
}
|
||||
const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
|
||||
let value = formatObj[key]
|
||||
if (key === "a") {
|
||||
return ["日", "一", "二", "三", "四", "五", "六"][value]
|
||||
}
|
||||
if (result.length > 0 && value < 10) {
|
||||
value = "0" + value
|
||||
}
|
||||
return value || 0
|
||||
})
|
||||
return time_str
|
||||
}
|
||||
Reference in new issue
Block a user