feat(custom): 新增消息订阅
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-08-27 17:06:59 +08:00
parent f199320de0
commit 1d8532eccf
104 changed files with 2350 additions and 2477 deletions

View File

@@ -5,62 +5,55 @@
<view
class="item"
:class="time == 'today' ? 'on' : ''"
@click="setTime('today')"
>
@click="setTime('today')">
今天
</view>
<view
class="item"
:class="time == 'yesterday' ? 'on' : ''"
@click="setTime('yesterday')"
>
@click="setTime('yesterday')">
昨天
</view>
<view
class="item"
:class="time == 'seven' ? 'on' : ''"
@click="setTime('seven')"
>
@click="setTime('seven')">
最近7天
</view>
<view
class="item"
:class="time == 'month' ? 'on' : ''"
@click="setTime('month')"
>
@click="setTime('month')">
本月
</view>
<view
class="item"
:class="time == 'date' ? 'on' : ''"
@click="dateTitle"
>
@click="dateTitle">
自定义
</view>
</view>
</view>
<view class="wrapper">
<view class="title">
{{ title }}{{ where.type == 1 ? "营业额" : "订单量" }}
{{ title }}{{ where.type == 1 ? '营业额' : '订单量' }}
</view>
<view v-if="where.type == 1" class="money">{{ dataObj.all || 0 }}</view>
<view v-else class="money">{{ dataObj.all || 0 }}</view>
<view class="increase">
<view>
{{ time === "date" ? "" : title }}增长率<text
:class="dataObj.growthRate >= 0 ? 'red' : 'green'"
>
{{ time === 'date' ? '' : title }}增长率<text
:class="dataObj.growthRate >= 0 ? 'red' : 'green'">
{{ dataObj.growthRate }}%
<text
class="iconfont"
:class="
dataObj.growthRate >= 0 ? 'icon-xiangshang1' : 'icon-xiangxia2'
"
></text
"></text
></text>
</view>
<view>
{{ time === "date" ? "" : title }}增长<text
{{ time === 'date' ? '' : title }}增长<text
:class="dataObj.growthNumber >= 0 ? 'red' : 'green'"
>{{ dataObj.growthNumber }}
<text
@@ -69,8 +62,7 @@
dataObj.growthNumber >= 0
? 'icon-xiangshang1'
: 'icon-xiangxia2'
"
></text
"></text
></text>
</view>
</view>
@@ -82,8 +74,7 @@
:ontouch="true"
@touchstart="touchStart"
@touchmove="touchMove"
@touchend="touchEnd"
/>
@touchend="touchEnd" />
</view>
<view class="Card">
@@ -96,8 +87,7 @@
:bordered="true"
class="table"
:columns="columns"
:data="dataObj?.list"
></nut-table>
:data="dataObj?.list"></nut-table>
</view>
<nut-empty v-else description="暂无订单数据"></nut-empty>
</view>
@@ -109,20 +99,19 @@
:default-value="pickerVal"
:start-date="date_start"
@close="isVisible = false"
@choose="setChooseValue"
>
@choose="setChooseValue">
</nut-calendar>
</view>
</template>
<script setup lang="ts">
import { ref, computed, h } from "vue";
import Taro from "@tarojs/taro";
import { growthRate } from "../../../api/admin";
import dayjs from "dayjs";
import uCharts from "../../../utils/js_sdk/u-charts.min.js";
import {ref, computed, h} from 'vue';
import Taro from '@tarojs/taro';
import {growthRate} from '../../../api/admin';
import dayjs from 'dayjs';
import uCharts from '../../../utils/js_sdk/u-charts.min.js';
const time = ref("");
const time = ref('');
const isVisible = ref(false);
@@ -138,44 +127,44 @@ const chartWH = ref({
const columns = ref([
{
title: "日期",
key: "Date",
align: "center",
title: '日期',
key: 'Date',
align: 'center',
},
{
title: "订单数",
key: "TotalCount",
align: "center",
title: '订单数',
key: 'TotalCount',
align: 'center',
},
{
title: "交易额",
key: "NumberSum",
align: "center",
render: (row) => {
title: '交易额',
key: 'NumberSum',
align: 'center',
render: row => {
return h(
"view",
'view',
{
style: {
color: "red",
color: 'red',
},
},
row.NumberSum
row.NumberSum,
);
},
},
]);
const date_start = computed(() => {
return dayjs().startOf("year").format("YYYY-MM-DD");
return dayjs().startOf('year').format('YYYY-MM-DD');
});
const title = ref("");
const title = ref('');
const where = ref({
type: 1,
status: 2,
start: "",
end: "",
start: '',
end: '',
});
const dataObj = ref<any>({});
@@ -184,20 +173,20 @@ const opts = ref<any>({
categories: [],
series: [
{
name: "营业额",
name: '营业额',
data: [],
},
{
name: "订单量",
name: '订单量',
data: [],
},
],
});
const pickerVal = ref<any>([])
const pickerVal = ref<any>([]);
Taro.useLoad((options) => {
where.value.type = options.type === "price" ? 1 : 2;
Taro.useLoad(options => {
where.value.type = options.type === 'price' ? 1 : 2;
time.value = options.time;
setTime(options.time);
// getData();
@@ -210,29 +199,29 @@ Taro.useLoad((options) => {
const setTime = (type: string) => {
time.value = type;
switch (type) {
case "today":
title.value = "今日";
case 'today':
title.value = '今日';
where.value.status = 2;
where.value.start = dayjs().format("YYYY-MM-DD");
where.value.end = dayjs().format("YYYY-MM-DD");
where.value.start = dayjs().format('YYYY-MM-DD');
where.value.end = dayjs().format('YYYY-MM-DD');
break;
case "yesterday":
title.value = "昨日";
case 'yesterday':
title.value = '昨日';
where.value.status = 2;
where.value.start = dayjs().add(-1, "day").format("YYYY-MM-DD");
where.value.end = dayjs().add(-1, "day").format("YYYY-MM-DD");
where.value.start = dayjs().add(-1, 'day').format('YYYY-MM-DD');
where.value.end = dayjs().add(-1, 'day').format('YYYY-MM-DD');
break;
case "seven":
title.value = "7天";
case 'seven':
title.value = '7天';
where.value.status = 2;
where.value.start = dayjs().add(-6, "day").format("YYYY-MM-DD");
where.value.end = dayjs().format("YYYY-MM-DD");
where.value.start = dayjs().add(-6, 'day').format('YYYY-MM-DD');
where.value.end = dayjs().format('YYYY-MM-DD');
break;
case "month":
title.value = "本月";
case 'month':
title.value = '本月';
where.value.status = 1;
where.value.start = dayjs().startOf("month").format("YYYY-MM-DD");
where.value.end = dayjs().format("YYYY-MM-DD");
where.value.start = dayjs().startOf('month').format('YYYY-MM-DD');
where.value.end = dayjs().format('YYYY-MM-DD');
break;
}
getData();
@@ -240,7 +229,7 @@ const setTime = (type: string) => {
const dateTitle = () => {
where.value.status = 1;
time.value = "date";
time.value = 'date';
isVisible.value = true;
};
@@ -253,7 +242,7 @@ const setChooseValue = (ref: any) => {
const getData = async () => {
try {
const user_info = Taro.getStorageSync("userInfo");
const user_info = Taro.getStorageSync('userInfo');
const res = await growthRate({
bid: user_info.data.bid,
status: where.value.status,
@@ -273,16 +262,16 @@ const getData = async () => {
} catch (error) {
Taro.showToast({
title: error.msg,
icon: "none",
icon: 'none',
});
throw error;
}
};
const create_canvas = () => {
const ctx = Taro.createCanvasContext("myChart");
const ctx = Taro.createCanvasContext('myChart');
canvas_obj = new uCharts({
type: "column",
type: 'column',
context: ctx,
width: chartWH.value.width,
height: chartWH.value.height,
@@ -290,17 +279,17 @@ const create_canvas = () => {
series: opts.value.series,
pixelRatio: chartWH.value.pixelRatio,
animation: true,
background: "#FFFFFF",
background: '#FFFFFF',
color: [
"#1890FF",
"#91CB74",
"#FAC858",
"#EE6666",
"#73C0DE",
"#3CA272",
"#FC8452",
"#9A60B4",
"#ea7ccc",
'#1890FF',
'#91CB74',
'#FAC858',
'#EE6666',
'#73C0DE',
'#3CA272',
'#FC8452',
'#9A60B4',
'#ea7ccc',
],
padding: [15, 15, 0, 15],
enableScroll: true,
@@ -319,9 +308,9 @@ const create_canvas = () => {
},
extra: {
column: {
type: "group",
type: 'group',
width: 20,
activeBgColor: "#000000",
activeBgColor: '#000000',
activeBgOpacity: 0.08,
},
},
@@ -331,7 +320,7 @@ const create_canvas = () => {
const touchStart = (e: any) => {
canvas_obj.showToolTip(e, {
format: function (item: any, category: any) {
return category + " " + item.name + ":" + item.data;
return category + ' ' + item.name + ':' + item.data;
},
});
canvas_obj.scrollStart(e);