Преглед на файлове

RING:公众号管理-修改-站点和计划比例后刷新列表

ringcode преди 3 години
родител
ревизия
24156c2951
променени са 2 файла, в които са добавени 19 реда и са изтрити 8 реда
  1. 2 1
      src/components/tool-bar/index.vue
  2. 17 7
      src/views/account/account.vue

+ 2 - 1
src/components/tool-bar/index.vue

@@ -54,7 +54,7 @@ const ToolBar = defineComponent({
       default: false,
     },
   },
-  emits: ["update:loading", "confirm"],
+  emits: ["update:loading", "confirm", "cancel"],
   setup(props, { emit, slots }) {
     let fields = ref<{ [key: string]: string }>({});
     let loading = ref(props.loading);
@@ -79,6 +79,7 @@ const ToolBar = defineComponent({
       props.text.forEach((field) => {
         fields.value[field] = "";
       });
+      emit("cancel");
     };
     return { fields, showPickerSlots, loading, onConfirm, reset };
   },

+ 17 - 7
src/views/account/account.vue

@@ -5,6 +5,7 @@
       :label="['公众号名称']"
       v-model:loading="searching"
       @confirm="onSearch"
+      @cancel="onCancel"
     >
       <!-- <div class="tool-bar-item">
         <p class="label">小说平台</p>
@@ -20,7 +21,7 @@
       <div class="tool-bar-item">
         <p class="label">回传状态</p>
         <a-select class="full-width" v-model:value="query.report_status">
-          <a-select-option :key="10086" :value="10086">全部</a-select-option>
+          <a-select-option :key="-1" :value="-1">全部</a-select-option>
           <a-select-option :key="1" :value="1">开启</a-select-option>
           <a-select-option :key="0" :value="0">关闭</a-select-option>
         </a-select>
@@ -28,7 +29,7 @@
       <div class="tool-bar-item">
         <p class="label">回传方式</p>
         <a-select class="full-width" v-model:value="query.report_module">
-          <a-select-option key="all" :value="null">全部</a-select-option>
+          <a-select-option key="all" :value="''">全部</a-select-option>
           <a-select-option key="channel" value="channel"
             >按站点回传</a-select-option
           >
@@ -257,7 +258,7 @@ const Account = defineComponent({
         official_name: "",
         platform: "",
         page: 1,
-        report_status: ref<string | undefined>(undefined),
+        report_status: -1,
         report_module: "",
       },
       hasPopFormData: false,
@@ -290,11 +291,18 @@ const Account = defineComponent({
       state.query.official_name = name;
       onLoadOfficials();
     };
+    const onCancel = () => {
+      state.query.report_status = -1;
+      state.query.report_module = "";
+      onSearch({ name: "" });
+    };
 
     const onLoadOfficials = (query?: { current: number }) => {
-      let params = state.query;
+      let params = JSON.parse(JSON.stringify(state.query));
       if (query) params.page = query.current;
       loading.value = true;
+      if (state.query.report_status === -1) delete params.report_status;
+      if (state.query.report_module === "") delete params.report_module;
       getOfficialAccounts(params).then(({ data }) => {
         state.list = data.list;
         meta.value = data.meta;
@@ -337,6 +345,7 @@ const Account = defineComponent({
     const onRateChange = () => {
       const { rate, channel_id } = state.ad_config;
       setChannelRate({ rate, channel_id }).then((res) => {
+        onLoadOfficials()
         message.success("修改回传比例成功!");
         state.visible = false;
       });
@@ -347,14 +356,14 @@ const Account = defineComponent({
         state.report_channel_id,
         state.report_module
       ).then((_) => {
+        onLoadOfficials()
         message.success("修改回传方式成功!");
       });
     };
 
     const onSaveConfig = () => {
-      let { id, back_on, rate, condition, price, float_rate } = state.popForm[
-        state.currentTab
-      ];
+      let { id, back_on, rate, condition, price, float_rate } =
+        state.popForm[state.currentTab];
       if (float_rate && float_rate >= rate) {
         message.error("浮动比例必须小于固定回传比例");
         return;
@@ -390,6 +399,7 @@ const Account = defineComponent({
       loading,
       tablePageOptions,
       onSearch,
+      onCancel,
       onLoadOfficials,
       initBackData,
       onTabChange,