feat: ai店铺添加柱状图
This commit is contained in:
@@ -1,14 +1,15 @@
|
||||
<template>
|
||||
<l-echart ref="chartRef"></l-echart>
|
||||
<l-echart ref="chartRef" class="chart"></l-echart>
|
||||
</template>
|
||||
|
||||
|
||||
<script setup lang="ts">
|
||||
<script setup>
|
||||
import { onMounted, ref, onBeforeUnmount, nextTick, watch } from 'vue';
|
||||
import * as echarts from 'echarts';
|
||||
|
||||
const chartRef = ref(null)
|
||||
const myChart = ref(null)
|
||||
let hasSetOption = false
|
||||
|
||||
const props = defineProps({
|
||||
options: {
|
||||
@@ -21,14 +22,19 @@
|
||||
const initChart = async () => {
|
||||
if (!chartRef.value) return
|
||||
|
||||
// 初始化echart
|
||||
myChart.value = await chartRef.value.init(echarts)
|
||||
if (!myChart.value) {
|
||||
myChart.value = await chartRef.value.init(echarts)
|
||||
}
|
||||
|
||||
// 默认获取容器尺寸
|
||||
myChart.value.resize();
|
||||
|
||||
// 设置true清空echart缓存
|
||||
myChart.value?.setOption(props.options, true);
|
||||
if (!hasSetOption) {
|
||||
myChart.value?.setOption(props.options, true);
|
||||
hasSetOption = true
|
||||
return
|
||||
}
|
||||
myChart.value?.setOption(props.options);
|
||||
}
|
||||
|
||||
|
||||
@@ -55,6 +61,14 @@
|
||||
onBeforeUnmount(() => {
|
||||
if (myChart.value) {
|
||||
echarts.dispose(myChart.value);
|
||||
myChart.value = null;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.chart {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -48,7 +48,8 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-row ju-flex-end" v-if="props.index != 5">
|
||||
<view class="discount-row flex-between" v-if="props.index != 5">
|
||||
<view class="size24 c_999">{{ formatCreateTime(props.data.createTime) }}</view>
|
||||
<view class="size24 c32">已优惠¥{{ fen2yuan(props.data.randomDiscountPrice) }}</view>
|
||||
</view>
|
||||
<view class="flex-row ju-flex-end" v-if="props.index != 5">
|
||||
@@ -91,6 +92,7 @@
|
||||
import card_orderBan from '@/components/card_orderBan/card_orderBan.vue';
|
||||
import AiOrderActionBar from '@/components/orderItem/AiOrderActionBar.vue';
|
||||
import AfterSaleApi from '@/sheep/api/trade/afterSale';
|
||||
import sheep from '@/sheep';
|
||||
import {
|
||||
aiDelayedShipment,
|
||||
aiPendingShipment,
|
||||
@@ -118,6 +120,13 @@
|
||||
const onCopy = (no) => {
|
||||
proxy.$sheep.$helper.copyText(no);
|
||||
};
|
||||
const formatCreateTime = (value) => {
|
||||
if (!value) return '';
|
||||
const s = sheep?.$helper?.timeFormat
|
||||
? sheep.$helper.timeFormat(value, 'yyyy-mm-dd hh:MM:ss')
|
||||
: String(value);
|
||||
return s || '';
|
||||
};
|
||||
const onApply = () => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
@@ -254,6 +263,10 @@
|
||||
margin-bottom: 32rpx;
|
||||
}
|
||||
|
||||
.discount-row {
|
||||
margin-top: 8rpx;
|
||||
}
|
||||
|
||||
.price {
|
||||
color: #ee0a24;
|
||||
font-size: 24rpx;
|
||||
|
||||
Reference in New Issue
Block a user