Browse Source

Merge branch 'refs/heads/xinyan' into test

xinyan 11 months ago
parent
commit
64590cba1f

+ 1 - 1
src/views/reportManage/dataCenter/combinedDisplay/components/tableData/mainData.vue

@@ -236,7 +236,7 @@ onMounted(async () => {
   <vxe-grid :header-cell-style="cellStyleHandler" v-bind="gridOptions"
             v-on="gridEvents">
     <template #toolbar_buttons>
-      <vxe-button circle icon="vxe-icon-refresh" @click="fetchMainData"></vxe-button>
+      <!--<vxe-button circle icon="vxe-icon-refresh" @click="fetchMainData"></vxe-button>-->
       <div class="mx-3.5">
         <vxe-button circle icon="vxe-icon-download" @click="handleExport"></vxe-button>
       </div>

+ 8 - 3
src/views/reportManage/dataCenter/normalDisplay/components/DatePicker/index.vue

@@ -13,8 +13,13 @@ import { usePublicData } from '/src/stores/publicData';
 const dateType = inject<Ref>('dateDimension');
 
 //公共数据
-const publicData = usePublicData();
-const {dateRange} = storeToRefs(publicData);
+//const publicData = usePublicData();
+//const {dateRange} = storeToRefs(publicData);
+
+const dateRange = ref( [
+  dayjs().subtract(6, 'day').startOf('day').format('YYYY-MM-DD'),
+  dayjs().endOf('day').format('YYYY-MM-DD')
+]);
 
 const startWeek = ref(null);
 const endWeek = ref(null);
@@ -137,7 +142,7 @@ function setDefaultDate() {
         dayjs().endOf('day').format('YYYY-MM-DD')
       ];
       dateChange();
-      // console.log(dateRange.value);
+       console.log(dateRange.value);
       break;
     case 'week':
       startWeek.value = dayjs().locale('en').subtract(2, 'week').startOf('week').format('YYYY-MM-DD');

+ 7 - 2
src/views/reportManage/dataCenter/normalDisplay/components/TableDataDisplay.vue

@@ -26,7 +26,7 @@ const monthData = [];
 
 const gridOptions = reactive({
   border: false,
-  height: 600,
+  height: 900,
   align: null,
   round: true,
   loading: false,
@@ -42,10 +42,15 @@ const gridOptions = reactive({
     enabled: true,
     total: 20,
     currentPage: 1,
-    pageSize: 10,
+    pageSize: 20,
     pageSizes: [10, 20, 30],
   },
   toolbarConfig: {
+    custom: true,
+    zoom: {
+      iconIn: 'vxe-icon-fullscreen',
+      iconOut: 'vxe-icon-minimize'
+    },
     slots: {
       buttons: 'toolbar_buttons',
     },

+ 21 - 14
src/views/reportManage/dataCenter/normalDisplay/components/TableDataEntry.vue

@@ -128,7 +128,7 @@ interface taskDataForm {
   ad_sales_original: number,
   ad_cost_original: number,
 
-  total_sales_current_monthly: number;
+  total_sales_current_monthly_original: number;
   impression: number;
   ad_click: number;
   ad_order: number;
@@ -149,7 +149,7 @@ const taskDataForm = reactive({
   sales_original: null,
   ad_sales_original: null,
   ad_cost_original: null,
-  total_sales_current_monthly: null,
+  total_sales_current_monthly_original: null,
   impression: null,
   ad_click: null,
   ad_order: null,
@@ -172,7 +172,7 @@ const rules = reactive<FormRules>({
   sales_original: [{required: true, message: '请输入销售额', trigger: 'blur'}],
   ad_sales_original: [{required: true, message: '请输入广告销售额', trigger: 'blur'}],
   ad_cost_original: [{required: true, message: '请输入广告花费', trigger: 'blur'}],
-  total_sales_current_monthly: [{required: true, message: '请输入当月销售额', trigger: 'blur'}],
+  total_sales_current_monthly_original: [{required: true, message: '请输入当月销售额', trigger: 'blur'}],
   impression: [{required: true, message: '请输入广告展示量', trigger: 'blur'}],
   ad_click: [{required: true, message: '请输入广告点击量', trigger: 'blur'}],
   ad_order: [{required: true, message: '请输入广告订单量', trigger: 'blur'}],
@@ -201,7 +201,7 @@ interface RowVO {
   sales_original: number,
   ad_sales_original: number,
   ad_cost_original: number,
-  total_sales_current_monthly: number;
+  total_sales_current_monthly_original: number;
   impression: number;
   ad_click: number;
   ad_order: number;
@@ -369,7 +369,7 @@ const editEvent = async (row: RowVO) => {
 
 // 校验数据
 const validateNumericFields = (fields: Record<string, any>, fieldsToValidate: string[]): boolean => {
-  const numericFields = ['sales_original', 'total_sales_current_monthly', 'ad_sales_original', 'ad_cost_original', 'money_by_amazon_original', 'money_by_other_original', 'refundRate'];
+  const numericFields = ['sales_original', 'total_sales_current_monthly_original', 'ad_sales_original', 'ad_cost_original', 'money_by_amazon_original', 'money_by_other_original', 'refundRate'];
   const integerFields = ['impression', 'ad_click', 'ad_order', 'session', 'order', 'availableSalesDay', 'intransitInventory', 'overseasStorage'];
 
   for (const field of fieldsToValidate) {
@@ -408,7 +408,7 @@ const validateNumericFields = (fields: Record<string, any>, fieldsToValidate: st
 
 //创建日数据
 async function createDayData() {
-  if (!validateNumericFields(taskDataForm)) return;
+  //if (!validateNumericFields(taskDataForm)) return;
   const body = {
     sales_original: taskDataForm.sales_original,
     ad_sales_original: taskDataForm.ad_sales_original,
@@ -437,12 +437,12 @@ async function createDayData() {
 
 //创建周数据
 async function createWeekData() {
-  if (!validateNumericFields(taskDataForm)) return;
+  //if (!validateNumericFields(taskDataForm)) return;
   const body = {
     sales_original: taskDataForm.sales_original,
     ad_sales_original: taskDataForm.ad_sales_original,
     ad_cost_original: taskDataForm.ad_cost_original,
-    total_sales_current_monthly: taskDataForm.total_sales_current_monthly,
+    total_sales_current_monthly_original: taskDataForm.total_sales_current_monthly_original,
     impression: taskDataForm.impression,
     ad_click: taskDataForm.ad_click,
     ad_order: taskDataForm.ad_order,
@@ -480,7 +480,7 @@ async function createWeekData() {
 
 //创建月数据
 async function createMonthData() {
-  if (!validateNumericFields(taskDataForm)) return;
+  //if (!validateNumericFields(taskDataForm)) return;
   const body = {
     sales_original: taskDataForm.sales_original,
     ad_sales_original: taskDataForm.ad_sales_original,
@@ -516,15 +516,21 @@ const submitForm = async (formEl: FormInstance | undefined) => {
   await formEl.validate(async (valid, fields) => {
     if (valid) {
       if (dateType === 'day') {
+        const fieldsToValidate = ['sales_original', 'ad_sales_original', 'ad_cost_original'];
+        if (!validateNumericFields(taskDataForm, fieldsToValidate)) return; // 验证字段
         await createDayData();
       }
       if (dateType === 'week') {
+        const fieldsToValidate = ['sales_original', 'ad_sales_original', 'ad_cost_original', 'total_sales_current_monthly_original', 'impression', 'ad_click', 'ad_order', 'money_by_amazon_original', 'money_by_other_original', 'session', 'order', 'availableSalesDay', 'intransitInventory', 'overseasStorage', 'refundRate'];
+        if (!validateNumericFields(taskDataForm, fieldsToValidate)) return; // 验证字段
         await createWeekData();
       }
       if (dateType === 'month') {
+        const fieldsToValidate = ['sales_original', 'ad_sales_original', 'ad_cost_original', 'impression', 'ad_click', 'ad_order',];
+        if (!validateNumericFields(taskDataForm, fieldsToValidate)) return; // 验证字段
         await createMonthData();
       }
-      // taskDataFormRef.value.resetFields();
+       //taskDataFormRef.value.resetFields();
     }
   });
 };
@@ -566,7 +572,7 @@ async function updateWeekData(row: RowVO) {
       sales_original: row.sales_original,
       ad_sales_original: row.ad_sales_original,
       ad_cost_original: row.ad_cost_original,
-      total_sales_current_monthly: row.total_sales_current_monthly,
+      total_sales_current_monthly_original: row.total_sales_current_monthly_original,
       impression: row.impression,
       ad_click: row.ad_click,
       ad_order: row.ad_order,
@@ -642,11 +648,12 @@ const editRowEvent = async (row: any) => {
       if (!validateNumericFields(row, fieldsToValidate)) return; // 验证字段
       await updateDayData(row);
     } else if (dateType === 'week') {
-      const fieldsToValidate = ['sales_original', 'ad_sales_original', 'ad_cost_original', 'total_sales_current_monthly', 'impression', 'ad_click', 'ad_order', 'money_by_amazon_original', 'money_by_other_original', 'session', 'order', 'availableSalesDay', 'intransitInventory', 'overseasStorage', 'refundRate'];
+      const fieldsToValidate = ['sales_original', 'ad_sales_original', 'ad_cost_original', 'total_sales_current_monthly_original', 'impression', 'ad_click', 'ad_order', 'money_by_amazon_original', 'money_by_other_original', 'session', 'order', 'availableSalesDay', 'intransitInventory', 'overseasStorage', 'refundRate'];
       if (!validateNumericFields(row, fieldsToValidate)) return; // 验证字段
       await updateWeekData(row);
     } else if (dateType === 'month') {
       const fieldsToValidate = ['sales_original', 'ad_sales_original', 'ad_cost_original', 'impression', 'ad_click', 'ad_order',];
+      if (!validateNumericFields(row, fieldsToValidate)) return; // 验证字段
       await updateMonthData(row);
     }
     await $grid.clearEdit();
@@ -666,7 +673,7 @@ const filteredDayColumns = computed(() => {
 });
 
 const filteredWeekColumns = computed(() => {
-  return weekColumns.value.filter(item => !['平台编号', '平台名称', '国家', '品牌', '操作', '运营','销售额','广告销售额','广告花费'].includes(item.title));
+  return weekColumns.value.filter(item => !['平台编号', '平台名称', '国家', '品牌', '操作', '运营','销售额','广告销售额','广告花费','当月累计销售额','Other回款金额','Amazon回款金额'].includes(item.title));
 });
 
 const filteredMonthColumns = computed(() => {
@@ -780,7 +787,7 @@ onMounted(() => {
           <vxe-input v-model="row.ad_cost_original"></vxe-input>
         </template>
         <template #total_sales_current_monthly_edit="{ row }">
-          <vxe-input v-model="row.total_sales_current_monthly"></vxe-input>
+          <vxe-input v-model="row.total_sales_current_monthly_original"></vxe-input>
         </template>
         <template #impression_edit="{ row }">
           <vxe-input v-model="row.impression"></vxe-input>

+ 33 - 32
src/views/reportManage/dataCenter/utils/columns.ts

@@ -38,26 +38,27 @@ export const weekColumns = ref([
   {field: 'sales', title: '销售额', width: 120},
   {field: 'ad_sales', title: '广告销售额', width: 120},
   {field: 'ad_cost', title: '广告花费', width: 120},
-  {
-    field: 'total_sales_current_monthly',
-    title: '当月累计销售额',
-    editRender: {},
-    slots: {edit: 'total_sales_current_monthly_edit'},
-    width: 120
-  },
-  {field: 'sales_original', title: '销售额(本币)', editRender: {}, slots: {edit: 'sales_original_edit'}, width: 157,},
+  {field: 'total_sales_current_monthly', title: '当月累计销售额', width: 120},
+  {field: 'sales_original', title: '销售额(本币)', editRender: {}, slots: {edit: 'sales_original_edit'}, width: 122,},
   {
     field: 'ad_sales_original',
     title: '广告销售额(本币)',
     editRender: {},
     slots: {edit: 'ad_sales_original_edit'},
-    width: 180,
+    width: 151,
   },
   {
     field: 'ad_cost_original',
     title: '广告花费(本币)',
     editRender: {},
     slots: {edit: 'ad_cost_original_edit'},
+    width: 138,
+  },
+  {
+    field: 'total_sales_current_monthly_original',
+    title: '当月累计销售额(本币)',
+    editRender: {},
+    slots: {edit: 'total_sales_current_monthly_edit'},
     width: 180,
   },
   {field: 'impression', title: '广告曝光', editRender: {}, slots: {edit: 'impression_edit'}, width: 120},
@@ -107,34 +108,34 @@ export const weekColumns = ref([
 ]);
 
 export const monthColumns = ref([
-  {field: 'platformNumber', title: '平台编号'},
-  {field: 'platformName', title: '平台名称'},
-  {field: 'country', title: '国家'},
-  {field: 'brandName', title: '品牌'},
-  {field: 'user_name', title: '运营'},
+  {field: 'platformNumber', title: '平台编号',width: 90},
+  {field: 'platformName', title: '平台名称',width: 90},
+  {field: 'country', title: '国家',width: 90},
+  {field: 'brandName', title: '品牌',width: 90},
+  {field: 'user_name', title: '运营',width: 90},
 
-  {field: 'sales', title: '销售额'},
-  {field: 'ad_sales', title: '广告销售额'},
-  {field: 'ad_cost', title: '广告花费'},
-  {field: 'sales_original', title: '销售额(本币)', editRender: {}, slots: {edit: 'sales_original_edit'}, width: 157,},
+  {field: 'sales', title: '销售额',width: 90},
+  {field: 'ad_sales', title: '广告销售额',width: 91},
+  {field: 'ad_cost', title: '广告花费',width: 90},
+  {field: 'sales_original', title: '销售额(本币)', editRender: {}, slots: {edit: 'sales_original_edit'}, width: 122,},
   {
     field: 'ad_sales_original',
     title: '广告销售额(本币)',
     editRender: {},
     slots: {edit: 'ad_sales_original_edit'},
-    width: 180,
+    width: 151,
   },
   {
     field: 'ad_cost_original',
     title: '广告花费(本币)',
     editRender: {},
     slots: {edit: 'ad_cost_original_edit'},
-    width: 180,
+    width: 138,
   },
   {field: 'impression', title: '广告曝光', editRender: {}, slots: {edit: 'impression_edit'}},
   {field: 'ad_click', title: '广告点击', editRender: {}, slots: {edit: 'ad_click_edit'}},
   {field: 'ad_order', title: '广告订单', editRender: {}, slots: {edit: 'ad_order_edit'}},
-  {title: '操作', width: 300, slots: {default: 'operate'}},
+  {title: '操作', width: 120, slots: {default: 'operate'}, fixed: 'right'},
 ]);
 
 // 表格展示
@@ -150,7 +151,7 @@ export const dayDataColumns = ref([
   {field: '运营', title: '运营', fixed: 'left', width: 90},
   {field: '国家', title: '国家', fixed: 'left', width: 90},
   {field: '品牌名称', title: '品牌', fixed: 'left', width: 90},
-  {field: '货币名称', title: '汇款币种', fixed: 'left',width: 90},
+  {field: '货币名称', title: '汇款币种', fixed: 'left', width: 90},
   //{field: 'sales_original', title: '销售额(本币)', width: 104,},
   //{field: 'ad_sales_original', title: '广告销售额(本币)', width: 132,},
   //{field: 'ad_cost_original', title: '广告花费(本币)', width: 116,},
@@ -165,11 +166,11 @@ export const dayDataColumns = ref([
 ]);
 export const weekDataColumns = ref([
   {field: 'platformNumber', title: '平台编号', fixed: 'left', width: 90},
-  {field: 'platformName', title: '平台名称',  fixed: 'left', width: 90},
-  {field: 'user_name', title: '运营',  fixed: 'left', width: 90},
-  {field: 'country', title: '国家',  fixed: 'left', width: 90},
-  {field: 'brandName', title: '品牌',  fixed: 'left', width: 90},
-  {field: 'currencyCode', title: '汇款币种',  fixed: 'left', width: 90},
+  {field: 'platformName', title: '平台名称', fixed: 'left', width: 90},
+  {field: 'user_name', title: '运营', fixed: 'left', width: 90},
+  {field: 'country', title: '国家', fixed: 'left', width: 90},
+  {field: 'brandName', title: '品牌', fixed: 'left', width: 90},
+  {field: 'currencyCode', title: '汇款币种', fixed: 'left', width: 90},
   //{field: 'sales_original', title: '销售额(本币)', width: 104,},
   //{field: 'ad_sales_original', title: '广告销售额(本币)', width: 132,},
   //{field: 'ad_cost_original', title: '广告花费(本币)', width: 116,},
@@ -210,11 +211,11 @@ export const weekDataColumns = ref([
 ]);
 export const monthDataColumns = ref([
   {field: 'platformNumber', title: '平台编号', fixed: 'left', width: 90},
-  {field: 'platformName', title: '平台名称',  fixed: 'left', width: 90},
-  {field: 'user_name', title: '运营',  fixed: 'left', width: 90},
-  {field: 'country', title: '国家',  fixed: 'left', width: 90},
-  {field: 'brandName', title: '品牌',  fixed: 'left', width: 90},
-  {field: 'currencyCode', title: '汇款币种',  fixed: 'left', width: 90},
+  {field: 'platformName', title: '平台名称', fixed: 'left', width: 90},
+  {field: 'user_name', title: '运营', fixed: 'left', width: 90},
+  {field: 'country', title: '国家', fixed: 'left', width: 90},
+  {field: 'brandName', title: '品牌', fixed: 'left', width: 90},
+  {field: 'currencyCode', title: '汇款币种', fixed: 'left', width: 90},
 
   //{field: 'sales', title: '销售额'},
   //{field: 'ad_cost', title: '广告花费'},