|
@@ -1,5 +1,5 @@
|
|
|
<template>
|
|
|
- <div style="overflow: hidden; width: 100%; height: 600px">
|
|
|
+ <div style="overflow: hidden; width: 100%; height: 600px" v-loading="tableLoading">
|
|
|
<vxe-grid v-bind="gridOptions">
|
|
|
<template #toolbar_buttons>
|
|
|
<span>
|
|
@@ -18,8 +18,16 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { reactive, ref } from 'vue'
|
|
|
+import { reactive, ref, inject, onBeforeUnmount, onMounted,watch } from 'vue'
|
|
|
import { VXETable } from 'vxe-table'
|
|
|
+import { getTableDataForSKU, getTableDataForProductLine } from '/@/views/productCenter/productList/api'
|
|
|
+import emitter from '/@/utils/emitter'
|
|
|
+import { skuColumns, productLineColumns } from '/@/views/productCenter/productList/utils/index'
|
|
|
+
|
|
|
+const profile = inject('profile')
|
|
|
+const dateRange = inject('dateRange')
|
|
|
+
|
|
|
+const tableLoading = ref(false)
|
|
|
|
|
|
const gridOptions = reactive({
|
|
|
height: 'auto',
|
|
@@ -34,53 +42,22 @@ const gridOptions = reactive({
|
|
|
buttons: 'toolbar_buttons',
|
|
|
},
|
|
|
},
|
|
|
- columns: [
|
|
|
- { field: 'name', title: 'Name', align: 'center', width: 130, slots: { default: 'name_default' } },
|
|
|
- { field: 'sex', title: 'Sex', align: 'center', width: 80, slots: { default: 'sex_default' } },
|
|
|
- { field: 'name', title: '产品线', align: 'left', fixed: 'left', width: 180, sortable: true },
|
|
|
- { field: 'sex', title: '总销售额', align: 'right', width: 130, sortable: true },
|
|
|
- { field: 'age', title: '总订单数', align: 'right', width: 130, sortable: true },
|
|
|
- { field: 'time', title: '总销量', align: 'right', width: 130, sortable: true },
|
|
|
- { field: 'address', title: '单均价', align: 'right', width: 130, sortable: true },
|
|
|
- { field: 'address', title: '广告销售额', align: 'right', width: 130, sortable: true },
|
|
|
- { field: 'address', title: '本商品广告销售额', align: 'right', width: 180, sortable: true },
|
|
|
- { field: 'address', title: '广告订单数', align: 'right', width: 130, sortable: true },
|
|
|
- { field: 'address', title: '本商品广告订单数', align: 'right', width: 180, sortable: true },
|
|
|
- { field: 'address', title: '广告销量', align: 'right', width: 130, sortable: true },
|
|
|
- { field: 'address', title: '本商品广告销量', align: 'right', width: 180, sortable: true },
|
|
|
- { field: 'address', title: '花费', align: 'right', width: 130, sortable: true, showOverflow: true },
|
|
|
- { field: 'address', title: 'ACOS', align: 'right', width: 130, sortable: true },
|
|
|
- { field: 'address', title: 'ROAS', align: 'right', width: 130, sortable: true },
|
|
|
- { field: 'address', title: 'TACOS', align: 'right', width: 130, sortable: true },
|
|
|
- { field: 'address', title: '转化率', align: 'right', width: 130, sortable: true },
|
|
|
- { field: 'address', title: '点击率', align: 'right', width: 130, sortable: true },
|
|
|
- { field: 'address', title: '点击成本', align: 'right', width: 130, sortable: true },
|
|
|
- { field: 'address', title: '总订单成本', align: 'right', width: 130, sortable: true },
|
|
|
- { field: 'address', title: '广告订单成本', align: 'right', width: 180, sortable: true },
|
|
|
- { field: 'address', title: '曝光量', align: 'right', width: 130, sortable: true },
|
|
|
- { field: 'address', title: '点击量', align: 'right', width: 130, sortable: true },
|
|
|
- { field: 'address', title: '会话次数', align: 'right', width: 150, sortable: true },
|
|
|
- { field: 'address', title: '商品会话百分比', align: 'right', width: 150, sortable: true },
|
|
|
- { field: 'address', title: '页面浏览量', align: 'right', width: 130, sortable: true },
|
|
|
- { field: 'address', title: '推荐报价(购买按钮)百分比', align: 'right', width: 180, sortable: true, showHeaderOverflow: true },
|
|
|
- { field: 'address', title: 'FBA库存', align: 'right', width: 130, sortable: true },
|
|
|
- { field: 'address', title: 'FBM库存', align: 'right', width: 130, sortable: true, showHeaderOverflow: true },
|
|
|
- ],
|
|
|
+ columns: [],
|
|
|
data: [
|
|
|
- { id: 10001, name: 'Test1', role: 'Develop', sex: '0', age: 28, num: 234, address: 'test abc' },
|
|
|
- { id: 10002, name: 'Test2', role: 'Test', sex: '1', age: 22, num: 34, address: 'Guangzhou' },
|
|
|
- { id: 10003, name: 'Test3', role: 'PM', sex: '0', age: 32, num: 12, address: 'Shanghai' },
|
|
|
- { id: 10003, name: 'Test3', role: 'PM', sex: '0', age: 32, num: 12, address: 'Shanghai' },
|
|
|
- { id: 10003, name: 'Test3', role: 'PM', sex: '0', age: 32, num: 12, address: 'Shanghai' },
|
|
|
- { id: 10003, name: 'Test3', role: 'PM', sex: '0', age: 32, num: 12, address: 'Shanghai' },
|
|
|
- { id: 10003, name: 'Test3', role: 'PM', sex: '0', age: 32, num: 12, address: 'Shanghai' },
|
|
|
- { id: 10003, name: 'Test3', role: 'PM', sex: '0', age: 32, num: 12, address: 'Shanghai' },
|
|
|
- { id: 10003, name: 'Test3', role: 'PM', sex: '0', age: 32, num: 12, address: 'Shanghai' },
|
|
|
- { id: 10003, name: 'Test3', role: 'PM', sex: '0', age: 32, num: 12, address: 'Shanghai' },
|
|
|
- { id: 10003, name: 'Test3', role: 'PM', sex: '0', age: 32, num: 12, address: 'Shanghai' },
|
|
|
- { id: 10003, name: 'Test3', role: 'PM', sex: '0', age: 32, num: 12, address: 'Shanghai' },
|
|
|
- { id: 10003, name: 'Test3', role: 'PM', sex: '0', age: 32, num: 12, address: 'Shanghai' },
|
|
|
- { id: 10003, name: 'TestLast', role: 'PM', sex: '0', age: 32, num: 12, address: 'Shanghai' },
|
|
|
+ // { id: 10001, name: 'Test1', role: 'Develop', sex: '0', age: 28, num: 234, address: 'test abc' },
|
|
|
+ // { id: 10002, name: 'Test2', role: 'Test', sex: '1', age: 22, num: 34, address: 'Guangzhou' },
|
|
|
+ // { id: 10003, name: 'Test3', role: 'PM', sex: '0', age: 32, num: 12, address: 'Shanghai' },
|
|
|
+ // { id: 10003, name: 'Test3', role: 'PM', sex: '0', age: 32, num: 12, address: 'Shanghai' },
|
|
|
+ // { id: 10003, name: 'Test3', role: 'PM', sex: '0', age: 32, num: 12, address: 'Shanghai' },
|
|
|
+ // { id: 10003, name: 'Test3', role: 'PM', sex: '0', age: 32, num: 12, address: 'Shanghai' },
|
|
|
+ // { id: 10003, name: 'Test3', role: 'PM', sex: '0', age: 32, num: 12, address: 'Shanghai' },
|
|
|
+ // { id: 10003, name: 'Test3', role: 'PM', sex: '0', age: 32, num: 12, address: 'Shanghai' },
|
|
|
+ // { id: 10003, name: 'Test3', role: 'PM', sex: '0', age: 32, num: 12, address: 'Shanghai' },
|
|
|
+ // { id: 10003, name: 'Test3', role: 'PM', sex: '0', age: 32, num: 12, address: 'Shanghai' },
|
|
|
+ // { id: 10003, name: 'Test3', role: 'PM', sex: '0', age: 32, num: 12, address: 'Shanghai' },
|
|
|
+ // { id: 10003, name: 'Test3', role: 'PM', sex: '0', age: 32, num: 12, address: 'Shanghai' },
|
|
|
+ // { id: 10003, name: 'Test3', role: 'PM', sex: '0', age: 32, num: 12, address: 'Shanghai' },
|
|
|
+ // { id: 10003, name: 'TestLast', role: 'PM', sex: '0', age: 32, num: 12, address: 'Shanghai' },
|
|
|
],
|
|
|
})
|
|
|
|
|
@@ -95,7 +72,78 @@ function openDetail(row) {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+const activeButton = inject('activeButton')
|
|
|
+
|
|
|
+watch(activeButton, () => {
|
|
|
+ console.log('value', activeButton.value)
|
|
|
+ switch (activeButton.value) {
|
|
|
+ case '产品线':
|
|
|
+ fetchTableDataForProductLine()
|
|
|
+ break
|
|
|
+ case '父ASIN':
|
|
|
+ console.log('case:父ASIN')
|
|
|
+ break
|
|
|
+ case 'ASIN':
|
|
|
+ console.log('case:ASIN')
|
|
|
+ break
|
|
|
+ case 'SKU':
|
|
|
+ fetchTableDataForSKU()
|
|
|
+ break
|
|
|
+
|
|
|
+ default:
|
|
|
+ break
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
+async function fetchTableDataForProductLine() {
|
|
|
+ tableLoading.value = true
|
|
|
+ const query = {
|
|
|
+ startDate: dateRange.value[0],
|
|
|
+ endDate: dateRange.value[1],
|
|
|
+ profileId: profile.value.profile_id,
|
|
|
+ }
|
|
|
+ gridOptions.columns = productLineColumns
|
|
|
+ try {
|
|
|
+ const response = await getTableDataForProductLine(query)
|
|
|
+ gridOptions.data = response.data
|
|
|
+ } catch (error) {
|
|
|
+ console.log('error:', error)
|
|
|
+ } finally {
|
|
|
+ tableLoading.value = false
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+async function fetchTableDataForSKU() {
|
|
|
+ tableLoading.value = true
|
|
|
+ const query = {
|
|
|
+ startDate: dateRange.value[0],
|
|
|
+ endDate: dateRange.value[1],
|
|
|
+ profileId: profile.value.profile_id,
|
|
|
+ }
|
|
|
+ gridOptions.columns = skuColumns
|
|
|
+ try {
|
|
|
+ const response = await getTableDataForSKU(query)
|
|
|
+ gridOptions.data = response.data
|
|
|
+ } catch (error) {
|
|
|
+ console.log('error:', error)
|
|
|
+ } finally {
|
|
|
+ tableLoading.value = false
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
const isCompare = ref(false)
|
|
|
+
|
|
|
+onMounted(() => {
|
|
|
+ fetchTableDataForProductLine()
|
|
|
+})
|
|
|
+
|
|
|
+// onUnBeforeMount(() => {
|
|
|
+// emitter.all.clear()
|
|
|
+// })
|
|
|
+onBeforeUnmount(() => {
|
|
|
+ emitter.all.clear()
|
|
|
+})
|
|
|
+
|
|
|
</script>
|
|
|
|
|
|
<style scoped></style>
|