jiayufei 3 rokov pred
rodič
commit
1c71961794

+ 1 - 1
src/views/modules/settlement-information/settlement-information.less

@@ -46,7 +46,7 @@
     }
 }
 /deep/ .information-modal-class {
-    width: 700px !important;
+    width: 750px !important;
     .upload-txt-rules {
         margin: 0;
     }

+ 295 - 98
src/views/modules/settlement-information/settlement-information.vue

@@ -47,12 +47,20 @@
                         <a-input v-model="configForm.accountName" placeholder="请输入账户名称"/>
                     </a-form-item>
                     <a-form-item label="运营:">
-                        <a-select v-model="configForm.createUserName" style="width: 100px">
-                            <a-select-option :value="2">不限</a-select-option>
-                            <a-select-option value="CREATIVE_IMAGE_MODE_VIDEO_VERTICAL">竖版视频</a-select-option>
-                            <a-select-option value="CREATIVE_IMAGE_MODE_LARGE">大图横图</a-select-option>
-                            <a-select-option value="CREATIVE_IMAGE_MODE_LARGE_VERTICAL">大图竖图</a-select-option>
-                            <a-select-option value="CREATIVE_IMAGE_MODE_UNION_SPLASH">开屏</a-select-option>
+                        <a-select
+                            v-model="configForm.createUserName"
+                            style="width: 140px"
+                            :filter-option="handleFilterOption"
+                            show-search
+                            allow-clear
+                        >
+                            <a-select-option
+                                v-for="item in allSaleListOption"
+                                :key="item.id"
+                                :value="item.realName"
+                            >
+                                {{ item.realName }}
+                            </a-select-option>
                         </a-select>
                     </a-form-item>
                 </a-row>
@@ -70,8 +78,12 @@
                         :colon="false"
                     >
                         <a-range-picker
+                            :placeholder="['开始月份', '结束月份']"
+                            format="YYYY-MM"
                             v-model="configForm.time"
-                            format="YYYY-MM-DD"
+                            :mode="mode2"
+                            @panelChange="handlePanelChange2"
+                            @change="handleAddTimesChange"
                         />
                     </a-form-item>
                     <a-form-item class="form-handle-btn">
@@ -89,12 +101,15 @@
                 :columns="settlementColumns"
                 :dataSource="dataSource"
                 :pagination="false"
-                :scroll="{x: 1300}"
+                :loading="controlLoading"
             >
+                <span slot="mediaId" slot-scope="text">
+                    <span>{{ text === 1 ? '头条' : '快手' }}</span>
+                </span>
                 <span slot="actions" slot-scope="text, record">
                     <a @click="handleSettleDel(record)">删除</a>
                     <a-divider type="vertical"/>
-                    <a>更多</a>
+                    <a disabled>更多</a>
                 </span>
             </a-table>
             <a-pagination
@@ -111,7 +126,7 @@
         <!-- 上传截图 -->
         <a-modal
             v-if="policyOperationStatus"
-            title="账户上传"
+            title="账户截图上传"
             :visible="policyOperationStatus"
             dialog-class="information-modal-class"
             @ok="handlePolicyOperationSure"
@@ -126,27 +141,48 @@
                     :label-col="labelCol"
                     :wrapper-col="wrapperCol"
                 >
-                    <a-form-model-item label="选择广告主公司名称" prop="name6">
-                        <a-select v-model="policyOperationForm.name6" placeholder="请选择广告主公司名称">
-                            <a-select-option :value="1">快手</a-select-option>
-                            <a-select-option :value="2">头条</a-select-option>
+                    <a-form-model-item label="选择广告主公司名称" prop="advertiserId">
+                        <a-select
+                            v-model="policyOperationForm.advertiserId"
+                            placeholder="请选择广告主名称"
+                            :filter-option="handleFilterOption"
+                            show-search
+                            @change="handleAdverOptionChange"
+                        >
+                            <a-select-option
+                                v-for="item in allAdverListOption"
+                                :key="item.id"
+                                :value="item.id"
+                            >
+                                {{ item.name }}
+                            </a-select-option>
                         </a-select>
                     </a-form-model-item>
-                    <a-form-model-item label="选择产品名称" prop="name7">
-                        <a-select v-model="policyOperationForm.name7" placeholder="请选择产品名称">
-                            <a-select-option :value="1">快手</a-select-option>
-                            <a-select-option :value="2">头条</a-select-option>
+                    <a-form-model-item label="选择产品名称" prop="productId">
+                        <a-select
+                            v-model="policyOperationForm.productId"
+                            placeholder="请选择产品名称"
+                            :filter-option="handleFilterOption"
+                            show-search
+                        >
+                            <a-select-option
+                                v-for="item in allProductListOption"
+                                :key="item.id"
+                                :value="item.id"
+                            >
+                                {{ item.productName }}
+                            </a-select-option>
                         </a-select>
                     </a-form-model-item>
                     <a-form-model-item label="选择媒体">
-                        <a-radio-group v-model="policyOperationForm.name9" button-style="solid">
-                            <a-radio-button value="a">头条</a-radio-button>
-                            <a-radio-button value="b">快手</a-radio-button>
+                        <a-radio-group v-model="policyOperationForm.mediaId" button-style="solid">
+                            <a-radio-button :value="1">头条</a-radio-button>
+                            <a-radio-button :value="2">快手</a-radio-button>
                         </a-radio-group>
                     </a-form-model-item>
-                    <a-form-model-item label="时间" prop="time">
+                    <a-form-model-item label="时间" prop="uploadYears">
                         <a-month-picker
-                            v-model="policyOperationForm.time"
+                            v-model="policyOperationForm.uploadYears"
                             format="YYYY-MM"
                             placeholder="请选择时间"
                             @change="handleLaunchData"
@@ -155,13 +191,13 @@
                     <a-form-model-item label="附件上传">
                         <a-upload
                             name="file"
-                            :file-list="fileList"
+                            :file-list="policyOperationForm.settlementList"
                             :before-upload="beforeUpload"
                             :remove="handleFileRemove"
                         >
                             <a-button><a-icon type="upload"/>文件上传</a-button>
                         </a-upload>
-                        <p class="upload-txt-rules">1、支持扩展名:.jpg</p>
+                        <p class="upload-txt-rules">1、支持扩展名:.jpg、.png</p>
                         <p>2、上传图片名称账户ID,若有多个图片则账户ID-1、账户ID-2</p>
                     </a-form-model-item>
                 </a-form-model>
@@ -273,6 +309,11 @@ export default {
     name: 'settlement-information',
     data() {
         return {
+            mode2: ['month', 'month'],
+            allAdverListOption: [],
+            allProductListOption: [],
+            controlLoading: false,
+            allSaleListOption: [],
             profitModalForm: {
                 name9: 'a',
                 launchDateRange: []
@@ -282,7 +323,6 @@ export default {
             },
             profitModalStatus: false,
             settlementModalStatus: false,
-            fileList: [],
             labelCol: {span: 7},
             wrapperCol: {span: 14},
             settlementModalForm: {
@@ -297,25 +337,23 @@ export default {
                 name6: [{required: true, message: '请选择广告主公司名称', trigger: 'change'}],
                 name7: [{required: true, message: '请选择产品名称', trigger: 'change'}],
                 name8: [{required: true, message: '请选择项目名称', trigger: 'change'}],
-                time: [{required: true, message: '请选择时间', trigger: 'change'}],
+                time: [{required: true, message: '请选择时间', trigger: 'change'}]
             },
             policyOperationForm: {
-                name6: undefined,
-                name7: undefined,
-                name8: undefined,
-                name9: 'a',
-                name10: 'a',
-                time: ''
+                advertiserId: undefined,
+                productId: undefined,
+                mediaId: 1,
+                uploadYears: '',
+                settlementList: []
             },
             policyOperationRules: {
-                name6: [{required: true, message: '请选择广告主公司名称', trigger: 'change'}],
-                name7: [{required: true, message: '请选择产品名称', trigger: 'change'}],
-                name8: [{required: true, message: '请选择项目名称', trigger: 'change'}],
-                time: [{required: true, message: '请选择时间', trigger: 'change'}],
+                advertiserId: [{required: true, message: '请选择广告主公司名称', trigger: 'change'}],
+                productId: [{required: true, message: '请选择产品名称', trigger: 'change'}],
+                uploadYears: [{required: true, message: '请选择时间', trigger: 'change'}]
             },
             policyOperationStatus: false,
             tablePag: {
-                page: 1, 
+                page: 1,
                 size: 10
             },
             totalAll: 100,
@@ -324,43 +362,43 @@ export default {
                 {
                     title: '广告主主体名称',
                     align: 'center',
-                    dataIndex: 'advertiserName',
-                    width: 180
+                    dataIndex: 'advertiserName'
                 },
                 {
                     title: '产品名称',
                     align: 'center',
                     dataIndex: 'productName',
-                    width: 180
+                    width: 220
                 },
                 {
-                    title: '媒体',
+                    title: '账户名称',
                     align: 'center',
-                    dataIndex: 'mediaId',
-                    width: 150
+                    dataIndex: 'accountName',
+                    width: 220
                 },
                 {
-                    title: '上传人',
+                    title: '媒体',
                     align: 'center',
-                    dataIndex: 'createUserName',
-                    width: 150
+                    dataIndex: 'mediaId',
+                    width: 200,
+                    scopedSlots: {customRender: 'mediaId'}
                 },
                 {
-                    title: '账户数量',
-                    dataIndex: 'name5',
+                    title: '上传人',
                     align: 'center',
+                    dataIndex: 'operateUserName',
                     width: 150
                 },
                 {
                     title: '上传数量',
-                    dataIndex: 'name6',
+                    dataIndex: 'imgNum',
                     align: 'center',
                     width: 150
                 },
                 {
-                    title: '上传时间',
+                    title: '时间',
                     align: 'center',
-                    dataIndex: 'name7',
+                    dataIndex: 'uploadYears',
                     width: 150
                 },
                 {
@@ -373,12 +411,11 @@ export default {
                 }
             ],
             configForm: {
-                creativeAdvance: '',
                 productName: '',
                 projectName: '',
                 accountName: '',
-                creativeSale: 2,
-                mediaId: 2,
+                createUserName: undefined,
+                mediaId: 'no',
                 time: []
             }
         };
@@ -386,15 +423,111 @@ export default {
     created() {
         this.searchForm = this.$form.createForm(this);
     },
+    mounted() {
+        this.handleInitTable();
+        this.handleGetAllSaleList();
+        this.handleGetAllAdverList();
+    },
     methods: {
-        // this.userInfo()
         ...mapGetters(['userInfo']),
         moment,
+        handlePanelChange2(value, mode) {
+            this.configForm.time = [moment(value[0]).format('YYYY-MM'), moment(value[1]).format('YYYY-MM')];
+            this.mode2 = [mode[0] === 'date' ? 'month' : mode[0], mode[1] === 'date' ? 'month' : mode[1]];
+        },
+        // 获取所有的广告主列表
+        handleGetAllAdverList() {
+            const paramsData = {
+                pageNo: 1,
+                pageSize: 1000
+            };
+            getAction('/ctop/advertiser/list', paramsData).then(result => {
+                if (result.success) {
+                    this.allAdverListOption = result.result.records || [];
+                }
+                else {
+                    this.$message.error(result.message);
+                }
+            }).catch(error => {
+                console.log(error, 'eeee');
+            });
+        },
+        handleAdverOptionChange(e) {
+            this.policyOperationForm.productId = undefined;
+            const paramsData = {
+                pageNo: 1,
+                pageSize: 1000,
+                advertiserId: e
+            };
+            getAction('/ctop/product/list', paramsData).then(result => {
+                if (result.success) {
+                    this.allProductListOption = result.result.records || [];
+                }
+                else {
+                    this.$message.error(result.message);
+                }
+            }).catch(error => {
+                console.log(error, 'eeee');
+            });
+        },
+        handleAddTimesChange(data) {
+            this.configForm.time = data;
+        },
+        // 获取所有的媒体 枚举值
+        handleGetAllSaleList() {
+            const paramsData = {
+                userId: this.userInfo().id
+            };
+            getAction(urlAcount + '/finance/settLementController/getAllOperationUser', paramsData).then(result => {
+                if (result.code === 0) {
+                    this.allSaleListOption = result.result || [];
+                }
+                else {
+                    this.$message.error(result.message);
+                }
+            }).catch(error => {
+                console.log(error, 'eeee');
+            });
+        },
+        handleFilterOption(input, option) {
+            return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0;
+        },
+         // 获取默认的列表数据
+        handleInitTable() {
+            this.controlLoading = true;
+            const paramsData = {
+                userId: this.userInfo().id,
+                productName: this.configForm.productName,
+                projectName: this.configForm.projectName,
+                accountName: this.configForm.accountName,
+                createUserName: this.configForm.createUserName,
+                mediaId: this.configForm.mediaId === 'no' ? '' : this.configForm.mediaId,
+                startTime: this.configForm.time[0],
+                endTime: this.configForm.time[1],
+                pageNo: this.tablePag.page,
+                pageSize: this.tablePag.size
+            };
+            getAction(urlAcount + '/finance/settLementFileController/getSettlementSheetList', paramsData).then(result => {
+                if (result.code === 0) {
+                    let defaultList = result.result.list;
+                    this.dataSource = defaultList;
+                    this.totalAll = result.result.total;
+                }
+                else {
+                    this.dataSource = [];
+                    this.totalAll = 0;
+                    this.$message.error(result.message);
+                }
+            }).catch(error => {
+                console.log(error, 'eeee');
+            }).finally(() => {
+                this.controlLoading = false;
+            });
+        },
         handleLaunchDateRange(date, dateString) {
             this.profitModalForm.launchDateRange = dateString;
         },
         handleProfitModalSure() {
-            console.log(this.profitModalForm, '下载利润表确认按钮');
             this.$refs.profitModalForm.validate(valid => {
                 if (valid) {
                     console.log('条件完全');
@@ -421,27 +554,46 @@ export default {
             });
         },
         handleSettlementModalnCancel() {
-            console.log('下载结算单取消按钮');
             this.settlementModalStatus = false;
         },
         // 月份时间选择器
         handleLaunchData(date, dateString) {
-            this.policyOperationForm.time = dateString;
+            this.policyOperationForm.uploadYears = dateString;
         },
         // 查询的按钮
         handleQueryList() {
-            console.log(this.configForm, '搜索的按钮');
+            this.tablePag = {
+                page: 1,
+                size: 10
+            };
+            this.handleInitTable();
         },
         // 重置的按钮
         handleResetList() {
-            console.log(this.configForm, '重置的按钮');
+            this.configForm = {
+                productName: '',
+                projectName: '',
+                accountName: '',
+                createUserName: undefined,
+                mediaId: 'no',
+                time: [moment().subtract(6, 'days').format('YYYY-MM-DD'), moment().format('YYYY-MM-DD')]
+            };
+            this.tablePag = {
+                page: 1,
+                size: 10
+            };
+            this.handleInitTable();
         },
         handleFileRemove(file) {
-            console.log(file, this.fileList, '-----');
-            let formData = this.fileList;
-            this.fileList= formData.filter(item => file.uid !== item.uid);
+            let formData = this.policyOperationForm.settlementList;
+            this.policyOperationForm.settlementList = formData.filter(item => file.uid !== item.uid);
         },
         beforeUpload(file) {
+            const isZip = file.type.includes('png') || file.type.includes('jpeg');
+            if (!isZip) {
+                this.$message.error('请上传正确的图片');
+                return;
+            }
             this.cosUpload(file);
         },
         handleMd5(file) {
@@ -449,24 +601,24 @@ export default {
             let that = this;
             return new Promise(function (resolve, reject) {
                 bmf.md5(file, (err, md5) => {
-                    getAction('kuaishouPopulationPackage/checkPopulationPackage', {signature: md5}).then(result => {
-                        if (result.code === 200) {
-                            that.personNameDisabled = false;
-                            that.personResourceDisabled = false;
-                            resolve();
-                        }
-                        else if (result.code === 201) {
-                            that.$message.error(result.message);
-                            that.personForm.name = result.result.orientationName;
-                            that.personForm.resource = result.result.type;
-                            that.personNameDisabled = true;
-                            that.personResourceDisabled = true;
-                            reject();
-                        }
-                    }).catch(error => {
-                        console.log(error, 'eeee');
-                        reject();
-                    });
+                    // getAction('kuaishouPopulationPackage/checkPopulationPackage', {signature: md5}).then(result => {
+                    //     if (result.code === 200) {
+                    //         that.personNameDisabled = false;
+                    //         that.personResourceDisabled = false;
+                    //         resolve();
+                    //     }
+                    //     else if (result.code === 201) {
+                    //         that.$message.error(result.message);
+                    //         that.personForm.name = result.result.orientationName;
+                    //         that.personForm.resource = result.result.type;
+                    //         that.personNameDisabled = true;
+                    //         that.personResourceDisabled = true;
+                    //         reject();
+                    //     }
+                    // }).catch(error => {
+                    //     console.log(error, 'eeee');
+                    //     reject();
+                    // });
                 });
             });
         },
@@ -508,31 +660,52 @@ export default {
                         return;
                     }
                     that.loadingElse = false;
-                    that.fileList.push({
+                    that.policyOperationForm.settlementList.push({
                         uid: file.name,
                         name: file.name,
                         status: 'done',
                         url: '//' + data.Location
                     });
-                    const isZip = file.type.includes('png') || file.type.includes('jpeg');
-                    if (!isZip) {
-                        that.$message.error('请上传正确的图片');
-                        return;
-                    }
                     // that.handleMd5(file);
                 }
             );
         },
         // 上传确定按钮操作
         handlePolicyOperationSure() {
-            console.log(this.policyOperationForm, '上传确定按钮操作');
-            if (!this.fileList.length) {
-                this.$message.error('请上传附件');
-                return;
-            }
+            const {advertiserId, productId, mediaId, uploadYears, settlementList} = this.policyOperationForm;
+            const changeFile = settlementList.map(item => {
+                item.fileUrl = item.url;
+                item.fileName = item.name;
+                return item;
+            });
             this.$refs.policyOperationForm.validate(valid => {
                 if (valid) {
-                    console.log('条件完全');
+                    if (!settlementList.length) {
+                        this.$message.error('请上传图片');
+                        return;
+                    }
+                    const paramsData = {
+                        advertiserId,
+                        productId,
+                        mediaId,
+                        uploadYears,
+                        settlementList: changeFile,
+                        createUserId: this.userInfo().id
+                    };
+                    postAction(urlAcount + '/finance/settLementFileController/insertAccountImages', paramsData).then(result => {
+                        if (result.code === 0) {
+                            this.$message.success(result.message);
+                            this.handlePolicyOperationCancel();
+                            this.handleInitTable();
+                        }
+                        else {
+                            this.$message.error(result.message);
+                        }
+                    }).catch(error => {
+                        console.log(error, 'eeee');
+                    }).finally(() => {
+                        this.confirmLoading = false;
+                    });
                 }
                 else {
                     console.log('error submit!!');
@@ -542,7 +715,13 @@ export default {
         },
         // 上传取消按钮操作
         handlePolicyOperationCancel() {
-            console.log('上传取消按钮操作');
+            this.policyOperationForm = {
+                advertiserId: undefined,
+                productId: undefined,
+                mediaId: 1,
+                uploadYears: '',
+                settlementList: []
+            };
             this.policyOperationStatus = false;
         },
         // 分页操作按钮
@@ -551,16 +730,34 @@ export default {
                 page: current,
                 size: pageSize
             };
-            // this.handleInitTable();
+            this.handleInitTable();
         },
         // 删除操作
         handleSettleDel(list) {
-            console.log(list, '删除操作');
             let that = this;
+            const paramsData = {
+                advertiserId: list.advertiserId,
+                productId: list.productId,
+                mediaId: list.mediaId,
+                uploadYears: list.uploadYears,
+                operateUserId: list.operateUserId
+            };
             this.$confirm({
                 title: '提示',
                 content: '确认删除该条数据',
-                onOk() {}
+                onOk() {
+                    getAction(urlAcount + '/finance/settLementFileController/deleteSettlementFile', paramsData).then(result => {
+                        if (result.code === 0) {
+                            that.handleInitTable();
+                            that.$message.success('删除成功');
+                        }
+                        else {
+                            that.$message.error(result.message);
+                        }
+                    }).catch(error => {
+                        console.log(error, 'eeee');
+                    });
+                }
             });
         },
         // 下载利润单