Files
temu-plugin/src/components/AiProductDetail.vue

82 lines
2.0 KiB
Vue
Raw Normal View History

2023-10-13 15:40:16 +08:00
<template>
<ai-detail class="audit">
<template slot="content">
<ai-card title="基本信息">
2023-10-15 22:09:33 +08:00
<ai-product-drop-down v-if="info" :params="info" slot="right"></ai-product-drop-down>
2023-10-13 15:40:16 +08:00
<template #content>
2023-10-15 22:09:33 +08:00
<div class="flex">
<ai-avatar v-model="info.imgUrl" :editable="false" :preview="true"/>
<ai-wrapper
label-width="120px" class="fill">
<ai-info-item label="价格:" :value="'$' + info.price"></ai-info-item>
<ai-info-item label="销量:" :value="info.saleTotal"></ai-info-item>
</ai-wrapper>
</div>
2023-10-13 15:40:16 +08:00
</template>
</ai-card>
<ai-card title="趋势信息">
<template #content>
2023-10-16 10:18:31 +08:00
<div id="dataChart"></div>
2023-10-13 15:40:16 +08:00
</template>
</ai-card>
</template>
</ai-detail>
</template>
<script>
2023-10-15 22:09:33 +08:00
import AiProductDropDown from './AiProductDropDown.vue'
import { DualAxes } from '@antv/g2plot'
2023-10-13 15:40:16 +08:00
export default {
name: "AiProductDetail",
2023-11-24 01:04:54 +08:00
props: ['params', 'url'],
2023-10-15 22:09:33 +08:00
components: {
AiProductDropDown
},
2023-10-13 15:40:16 +08:00
data() {
return {
info: {}
}
},
computed: {
},
2023-10-16 10:18:31 +08:00
mounted() {
// this.info = this.params
this.$nextTick(() => {
this.init()
})
2023-10-13 15:40:16 +08:00
},
methods: {
2023-10-16 10:18:31 +08:00
init() {
2023-11-24 01:04:54 +08:00
this.$http.post(this.url ? this.url: '/api/monitorDetail/queryProductDetail',null,{
2023-10-13 15:40:16 +08:00
params: {
2023-10-16 10:18:31 +08:00
goodsId: this.params.goodsId,
monitorId: this.params.monitorId
2023-10-13 15:40:16 +08:00
}
}).then(res => {
this.info = res.data
2023-10-16 10:18:31 +08:00
const dualAxes = new DualAxes('dataChart', {
2023-10-15 22:09:33 +08:00
data: [this.info.priceAndSale, this.info.priceAndSale],
xField: '日期',
yField: ['价格', '销量'],
geometryOptions: [
{
geometry: 'line',
color: '#5B8FF9',
},
{
geometry: 'line',
color: '#5AD8A6',
}
],
});
dualAxes.render();
2023-10-13 15:40:16 +08:00
})
}
}
}
</script>
<style scoped lang="scss">
</style>