Explorar el Código

✨ feat(pushReport): 调整业务

dodo hold hace 1 año
padre
commit
97d1319f37
Se han modificado 4 ficheros con 63 adiciones y 8 borrados
  1. 1 0
      src/api/jd.ts
  2. 6 1
      src/api/pdd.ts
  3. 22 3
      src/views/jd/list.vue
  4. 34 4
      src/views/pdd/list.vue

+ 1 - 0
src/api/jd.ts

@@ -43,6 +43,7 @@ export interface JdPoolRecord {
     nodeName: string;
     enable_parse: boolean;
     enable_coupon: boolean;
+    enable_sync_report: boolean;
     enable_sync_order: boolean;
     site_id: number;
     unionid: string;

+ 6 - 1
src/api/pdd.ts

@@ -4,7 +4,8 @@ import type { ListRes } from './base';
 export interface FormRes {
     msg: string;
     code: number;
-    success: boolean;
+    success?: boolean;
+    count?: number;
 }
 
 export interface PddUpdateAccountModel {
@@ -133,3 +134,7 @@ export function queryPddEstimateRevenueTotal(data: PddEstimateRevenueParams) {
 export function queryPddEstimateRevenue(data: PddEstimateRevenueParams) {
     return axios.post<PddEstimateRevenueRes>('/api/PddUnion/estimate_revenue', data);
 }
+
+export function rechargeAllOnlineAccountUsage() {
+    return axios.get<FormRes>('/api/PddUnion/RechargeAllOnlineAccountUsage');
+}

+ 22 - 3
src/views/jd/list.vue

@@ -162,6 +162,25 @@
                             优惠券
                         </a-tag>
                     </span>
+                    <a-tag v-if="record.enable_sync_report" size="small" bordered color="blue"
+                        @click="changeAttr(record.id, 'enable_sync_report', false)">
+                        同步收益
+                    </a-tag>
+                    <a-tag v-else size="small" bordered color="gray"
+                        @click="changeAttr(record.id, 'enable_sync_report', true)">
+                        同步收益
+                    </a-tag>
+                    <span style="margin:0 5px;">
+                        <a-tag v-if="record.enable_sync_order" size="small" bordered color="arcoblue"
+                            @click="changeAttr(record.id, 'enable_sync_order', false)">
+                            同步订单
+                        </a-tag>
+                        <a-tag v-else size="small" bordered color="gray"
+                            @click="changeAttr(record.id, 'enable_sync_order', true)">
+                            同步订单
+                        </a-tag>
+                    </span>
+
                 </template>
                 <template #tags="{ record }">
                     <a-tag v-if="record.parse_type" size="small" bordered color="blue">
@@ -543,10 +562,10 @@ const search = () => {
     } as unknown as JdPoolParams);
 };
 const onPageChange = (current: number) => {
-    fetchData({ 
-        ...basePagination, 
+    fetchData({
+        ...basePagination,
         ...formModel.value,
-        current 
+        current
     } as unknown as JdPoolParams);
 };
 

+ 34 - 4
src/views/pdd/list.vue

@@ -48,6 +48,9 @@
                             </template>
                             {{ $t('searchTable.operation.create') }}
                         </a-button>
+                        <a-button type="outline" @click="handleRechargeAllOnlineAccountUsage">
+                            重置账号当日分配权重
+                        </a-button>
                     </a-space>
                 </a-col>
                 <a-col :span="12" style="
@@ -289,7 +292,7 @@ import { computed, ref, reactive, watch, nextTick } from 'vue';
 import { useI18n } from 'vue-i18n';
 import dayjs from 'dayjs';
 import useLoading from '@/hooks/loading';
-import { queryPddPool, PddPoolRecord, PddPoolParams, PddUpdateAccountModel, PddUpdateAccount, UpdateCookieWithIdModel, updateCookiesWithId } from '@/api/pdd';
+import { queryPddPool, PddPoolRecord, PddPoolParams, PddUpdateAccountModel, PddUpdateAccount, UpdateCookieWithIdModel, updateCookiesWithId, rechargeAllOnlineAccountUsage } from '@/api/pdd';
 import { Pagination } from '@/types/global';
 import { Modal, Message } from '@arco-design/web-vue';
 import type { SelectOptionData } from '@arco-design/web-vue/es/select/interface';
@@ -574,10 +577,10 @@ const search = () => {
     } as unknown as PddPoolParams);
 };
 const onPageChange = (current: number) => {
-    fetchData({ 
-        ...basePagination, 
+    fetchData({
+        ...basePagination,
         ...formModel.value,
-        current 
+        current
     } as unknown as PddPoolParams);
 };
 
@@ -695,6 +698,33 @@ const handleCookieCancel = () => {
     cookieFormRef.value?.resetFields();
 };
 
+const handleRechargeAllOnlineAccountUsage = async () => {
+    Modal.confirm({
+        title: '确认提示',
+        content: '确定要重置所有账号当日分配权重吗?',
+        okText: '确认',
+        cancelText: '取消',
+        async onOk() {
+            setLoading(true);
+            try {
+                const data = await rechargeAllOnlineAccountUsage();
+                console.log(data);
+                if (data.code === 200) {
+                    Message.success(`重置成功!共处理 ${data.count} 个账号`);
+                    search(); // 刷新列表
+                } else {
+                    Message.error(data.msg || '重置失败');
+                }
+            } catch (err) {
+                console.error(err);
+                Message.error('重置失败');
+            } finally {
+                setLoading(false);
+            }
+        }
+    });
+};
+
 watch(
     () => columns.value,
     (val) => {