tangning преди 2 години
родител
ревизия
10f9d939be

+ 123 - 0
src/views/account/overview/AddDownModal.vue

@@ -0,0 +1,123 @@
+<template>
+  <BasicModal
+    v-bind="$attrs"
+    @register="register"
+    title="新增下载"
+    @visible-change="handleVisibleChange"
+    @cancel="resetFields"
+    @ok="handleSubmit"
+  >
+    <div class="pt-2px pr-3px">
+      <BasicForm @register="registerForm">
+        <template #text="{ model, field }">
+          {{ model[field]  }}{{fileFlow.type}}
+        </template>
+      </BasicForm>
+    </div>
+  </BasicModal>
+</template>
+<script lang="ts">
+  import { defineComponent, nextTick, onMounted, reactive, computed } from 'vue';
+  import { BasicModal, useModalInner } from '/@/components/Modal';
+  import { BasicForm, FormSchema, useForm } from '/@/components/Form/index';
+  import { useMessage } from '/@/hooks/web/useMessage';
+  import { InvoiceRegister } from '/@/api/order';
+  import { useI18n } from '/@/hooks/web/useI18n';
+  import { uploadApi } from '/@/api/product/index';
+  import { ResultEnum } from '/@/enums/httpEnum';
+  import { DetailsApi, dincrementList, AddUserIncrementApi, AddDownNumApi } from '/@/api/account';
+  import dayjs from 'dayjs';
+  import { otherInfoStore } from '/@/store/modules/other'
+
+  const { t } = useI18n();
+  export default defineComponent({
+    components: { BasicModal, BasicForm },
+    props: {
+      userData: { type: Object },
+    },
+    emits: ['update', 'register'],
+    setup(props, { emit }) {
+      const otherInfo = otherInfoStore();
+      const overviewInfo = computed(() => otherInfo.getOverviewInfo);
+      // const overviewInfo = getOverviewInfo() || {}
+      const fileFlow = reactive({
+        file:null,
+        id:'',
+        type:'down',//down-下载,equity-权益
+      })
+      const { createMessage } = useMessage();
+      const schemas: FormSchema[] = [
+          {
+            field: 'id',
+            component: 'Input',
+            show:false,
+            label: 'id',
+          },
+          {
+            field: 'count',
+            component: 'InputNumber',
+            label: '新增次数',
+            required: true,
+            componentProps: {
+              min:1,
+            },
+            colProps: {
+              span: 22,
+            },
+          }
+      ];
+
+      const [registerForm, { validate, resetFields, setFieldsValue, updateSchema }] = useForm({
+        labelWidth: 120,
+        schemas:schemas,
+        showActionButtonGroup: false,
+        actionColOptions: {
+          span: 24,
+        },
+      });
+      onMounted(() => {});
+      let addListFunc = () => {};
+      const [register, { closeModal }] = useModalInner((data) => {
+        data && onDataReceive(data);
+      });
+      async function onDataReceive(data) {
+        const res = await dincrementList();
+        console.log('onDataReceive',data,res)
+        resetFields();
+        fileFlow.type = data.type
+        fileFlow.id = data.id
+        setFieldsValue(data);
+      }
+      const handleSubmit = async () => {
+        const submitUrl = AddDownNumApi
+        try {
+          const params = await validate();
+          console.log('validate',params)
+          const res = await submitUrl({userId:params.id,...params});
+          overviewInfo.value.surDownNum = overviewInfo.value.surDownNum + params.count
+          console.log('res', res);
+          otherInfo.updateOverviewInfo()
+          closeModal();
+          resetFields();
+          createMessage.success(t('common.optSuccess'));
+          emit('update');
+        } catch (error) {
+          console.log('not passing', error);
+        }
+      };
+      function handleVisibleChange(v) {
+        v && props.userData && nextTick(() => onDataReceive(props.userData));
+      }
+      return {
+        register,
+        registerForm,
+        fileFlow,
+        handleVisibleChange,
+        handleSubmit,
+        addListFunc,
+        resetFields,
+        t,
+      };
+    },
+  });
+</script>

+ 6 - 34
src/views/account/overview/AddModal.vue

@@ -2,7 +2,7 @@
   <BasicModal
     v-bind="$attrs"
     @register="register"
-    :title="fileFlow.type=='equity'?'新增权益':'新增下载'"
+    title="新增权益"
     @visible-change="handleVisibleChange"
     @cancel="resetFields"
     @ok="handleSubmit"
@@ -51,8 +51,7 @@
             field: 'id',
             component: 'Input',
             show:false,
-            label: '发票编号',
-            required: true,
+            label: 'id',
           },
           {
             field: 'incrementTypeId',
@@ -180,18 +179,6 @@
                 return current && current < dayjs().endOf('day');
               },
             },
-          },
-          {
-            field: 'count',
-            component: 'InputNumber',
-            label: '新增次数',
-            required: true,
-            componentProps: {
-              min:1,
-            },
-            colProps: {
-              span: 22,
-            },
           }
       ];
 
@@ -215,36 +202,21 @@
         fileFlow.type = data.type
         fileFlow.id = data.id
         setFieldsValue(data);
-        updateSchema([
-          {field: 'count',ifShow:fileFlow.type == 'down',},
-          {field: 'incrementEndTime',ifShow:fileFlow.type == 'equity',},
-          {field: 'counts',ifShow:fileFlow.type == 'equity',},
-          {field: 'monthQy',ifShow:false,},
-          {field: 'incrementTypeId',ifShow:fileFlow.type == 'equity',},
-        ])
       }
       const handleSubmit = async () => {
-        const submitUrl = fileFlow.type == 'equity'?AddUserIncrementApi:AddDownNumApi
+        const submitUrl = AddUserIncrementApi
         try {
           const params = await validate();
           console.log('validate',params)
-          const apiData = fileFlow.type == 'equity'?{
+          const apiData = {
               ...params,
               userId:params.id,
               incrementEndTime:params.incrementEndTime,
               count:params.counts,
-            }:{
-              userId:params.id,
-              count:params.count,
-            // file:params.file[0],
             }
           const res = await submitUrl(apiData);
-          if(fileFlow.type == 'equity'){
-            overviewInfo.value.incrementCount = overviewInfo.value.incrementCount + apiData.count
-          }else{
-            overviewInfo.value.surDownNum = overviewInfo.value.surDownNum + apiData.count
-          }
-          console.log('res', overviewInfo.value);
+          overviewInfo.value.incrementCount = overviewInfo.value.incrementCount + apiData.count
+          console.log('res', res);
           otherInfo.updateOverviewInfo()
           closeModal();
           resetFields();

+ 14 - 2
src/views/account/overview/index.vue

@@ -48,6 +48,7 @@
     </div>
     <a-divider />
     <AddModal @register="registerAddModal" />
+    <AddDownModal @register="registerAddDowmModal" />
     <interesModal @register="registerInteres" />
     <caremModal @register="registerCarem" />
   </div>
@@ -61,6 +62,7 @@
   import { Divider, Button } from 'ant-design-vue';
   import { otherInfoStore } from '/@/store/modules/other'
   import AddModal from './AddModal.vue';
+  import AddDownModal from './AddDownModal.vue';
   import caremModal from './caremModal.vue';
   import interesModal from './interesModal.vue';
   import { useModal } from '/@/components/Modal';
@@ -73,20 +75,29 @@
     personData,
   } from './data';
   export default defineComponent({
-    components: { Icon, Button,interesModal, Description, AddModal, caremModal,  BasicTable, PageWrapper, [Divider.name]: Divider },
+    components: { Icon, Button,interesModal, Description, AddModal, AddDownModal, caremModal,  BasicTable, PageWrapper, [Divider.name]: Divider },
     setup() {
       const otherInfo = otherInfoStore();
       const [registerAddModal, { openModal: openAddModal }] = useModal();
+      const [registerAddDowmModal, { openModal: openAddDowmModal }] = useModal();
       const [registerInteres, { openModal: openInteresModal }] = useModal();
       const [registerCarem, { openModal: openCaremModal }] = useModal();
       const overviewInfo = computed(() => otherInfo.getOverviewInfo);
       const permissionStore = usePermissionStore();
       const { getCheckPerm } = permissionStore;
       function handleAddEquity(type:string){
-        openAddModal(true, {
+        console.log('type',type)
+        if(type == 'down'){
+          openAddDowmModal(true, {
           ...overviewInfo.value,
           type,
         });
+        }else{
+          openAddModal(true, {
+          ...overviewInfo.value,
+          type,
+        });
+        }
       }
       function handleSetEquity(){
         openInteresModal(true, {
@@ -96,6 +107,7 @@
       return {
         registerAddModal,
         registerInteres,
+        registerAddDowmModal,
         registerCarem,
         openAddModal,
         openInteresModal,

+ 1 - 1
src/views/statistics/components/orderEchart.vue

@@ -33,8 +33,8 @@
   }
   function expor(val){
     // emit('expor',val)
-    console.log('数量',val.value)
     let hader = ['时间', ...nameList.value]
+    console.log('数量',hader)
     let fields  = {
       'time':'日期',
       '1':hader[1],