Przeglądaj źródła

work-jyf 结算单

jiayufei 3 lat temu
rodzic
commit
fbf9f1f706

+ 2 - 2
src/utils/request.js

@@ -19,8 +19,8 @@ else if (process.env.NODE_ENV === 'debug') {
 }
 else if (process.env.NODE_ENV === 'production') {
 	// axios.defaults.baseURL = 'http://apipre.tjyourong.com.cn/jeecg-boot'; // 预生产
-    // axios.defaults.baseURL = 'http://gateway.tjyourong.com.cn/jeecg-boot'; // 测试
-	axios.defaults.baseURL = 'http://api.tjyourong.com.cn/jeecg-boot'; // 生产环境
+    axios.defaults.baseURL = 'http://gateway.tjyourong.com.cn/jeecg-boot'; // 测试
+	// axios.defaults.baseURL = 'http://api.tjyourong.com.cn/jeecg-boot'; // 生产环境
 }
 const service = axios.create({
 	// baseURL: '/jeecg-boot', // api base_url

+ 10 - 2
src/views/modules/Statistics/newHome.vue

@@ -680,9 +680,17 @@ export default {
               total.cp=(total.cost/total.click).toFixed(2)
               total.cpm=(total.cost/total.showNum*1000).toFixed(2)
               if(afterData.length>0){
-                this.tableData=[total,...afterData]
+                const defaultAfterData = afterData;
+                defaultAfterData.forEach(item => {
+                  item.clickRate = Number(item.clickRate) + '%';
+                });
+                this.tableData=[total,...defaultAfterData]
               }else{
-                this.tableData=[total,...res.result.list]
+                const defaultData = res.result.list;
+                defaultData.forEach(item => {
+                  item.clickRate = Number(item.clickRate) + '%';
+                });
+                this.tableData=[total,...defaultData]
               }
               
             }

+ 2 - 2
src/views/modules/settlement-account/settlement-account-server.js

@@ -5,7 +5,7 @@
 
 //  export const urlAcount = 'http://118.24.244.213:8808'; // 线上
 //  export const urlAcount = 'http://gateway.tjyourong.com.cn'; // 测试
-// export const urlAcount = 'http://192.168.1.43:9999'; // 子安
- export const urlAcount = 'http://gateway.tjyourong.com.cn'; // 测试
+export const urlAcount = 'http://192.168.1.43:9999'; // 子安
+//  export const urlAcount = 'http://gateway.tjyourong.com.cn'; // 测试
 // export const urlAcount = 'http://192.168.1.8:9999'; // 学超
  

+ 1 - 0
src/views/modules/settlement-account/settlement-account.vue

@@ -528,6 +528,7 @@ export default {
                     paramsData.append('mediaId', mediaId);
                     paramsData.append('operateType', operateType);
                     paramsData.append('file', fileList[0]);
+                    paramsData.append('createUserId', this.userInfo().id);
                     this.confirmLoading = true;
                     postFileAction(urlAcount + '/finance/settLementController/settlementAccountImport', paramsData, {
                         headers: {

+ 142 - 40
src/views/modules/settlement-information/settlement-information.vue

@@ -5,13 +5,16 @@
                 <span class="policy-export-btn">结算单信息</span>
                 <span>
                     <a-tooltip>
-                        <template slot="title">显示运营人员上传账户消耗截图,运营人员可查看自己所上传数据,销售人员可查看自己所负责产品的消耗截图数据</template>
+                        <template slot="title">
+                            显示运营人员上传账户消耗截图,运营人员可查看自己所上传数据,销售人员可查看自己所负责产品的消耗截图数据
+                        </template>
                         <a-icon class="settlement-header-icon" type="question-circle"/>
                     </a-tooltip>
                     显示列表信息,销售人员只能操作与自己相关的项目
                 </span>
             </div>
             <div>
+                <!-- v-if="userInfo().roleName !== '财务'" -->
                 <span class="add-acount-policy-btn"><a-button @click="handleDownloadProfit">下载利润表</a-button></span>
                 <span class="add-acount-policy-btn"><a-button @click="handleDownloadSettlement">下载结算单</a-button></span>
                 <span class="add-acount-policy-btn"><a-button type="primary" @click="handleUploadAccount">上传截图</a-button></span>
@@ -221,37 +224,59 @@
                     :label-col="labelCol"
                     :wrapper-col="wrapperCol"
                 >
-                    <a-form-model-item label="选择广告主公司名称" prop="name6">
-                        <a-select v-model="settlementModalForm.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="settlementModalForm.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="settlementModalForm.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="settlementModalForm.productId"
+                            placeholder="请选择产品名称"
+                            :filter-option="handleFilterOption"
+                            show-search
+                            @change="handleProductIdChange"
+                        >
+                            <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="settlementModalForm.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="settlementModalForm.mediaId" button-style="solid" @change="handleMediaIdChange">
+                            <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="settlementModalForm.time"
+                            v-model="settlementModalForm.uploadYears"
                             format="YYYY-MM"
                             placeholder="请选择时间"
-                            @change="handleLaunchData"
+                            @change="handleUploadYears"
                         />
                     </a-form-model-item>
                     <a-form-model-item label="账户数量">
-                        <span>23</span>
+                        <span>{{ downLoadAccountNum }}</span>
                     </a-form-model-item>
                     <a-form-model-item label="截图已上传">
-                        <span>20</span>
+                        <span>{{ downLoadImgNum }}</span>
                     </a-form-model-item>
                 </a-form-model>
             </div>
@@ -275,9 +300,9 @@
                     :wrapper-col="wrapperCol"
                 >
                     <a-form-model-item label="选择媒体">
-                        <a-radio-group v-model="profitModalForm.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="profitModalForm.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="launchDateRange">
@@ -309,13 +334,17 @@ export default {
     name: 'settlement-information',
     data() {
         return {
+            userOperateList: ['快手运营总监', '运营助理', '运营专员', '头条运营经理', '外部运营经理', '快手运营', '商务运营', '运营总经理', '直播运营', '头条运营总监', '快手运营助理', '快手运营经理', '头条运营', '头条运营助理'],
+            userSaleList: ['外部销售', '销售总监', '销售', '销售助理', '销售支持经理', '销售AM'],
+            downLoadAccountNum: 0,
+            downLoadImgNum: 0,
             mode2: ['month', 'month'],
             allAdverListOption: [],
             allProductListOption: [],
             controlLoading: false,
             allSaleListOption: [],
             profitModalForm: {
-                name9: 'a',
+                mediaId: 1,
                 launchDateRange: []
             },
             profitModalRules: {
@@ -326,18 +355,16 @@ export default {
             labelCol: {span: 7},
             wrapperCol: {span: 14},
             settlementModalForm: {
-                name6: undefined,
-                name7: undefined,
-                name8: undefined,
-                name9: 'a',
-                name10: 'a',
-                time: ''
+                advertiserId: undefined,
+                productId: undefined,
+                mediaId: 1,
+                uploadYears: ''
             },
             settlementModalRules: {
-                name6: [{required: true, message: '请选择广告主公司名称', trigger: 'change'}],
-                name7: [{required: true, message: '请选择产品名称', trigger: 'change'}],
+                advertiserId: [{required: true, message: '请选择广告主公司名称', trigger: 'change'}],
+                productId: [{required: true, message: '请选择产品名称', trigger: 'change'}],
                 name8: [{required: true, message: '请选择项目名称', trigger: 'change'}],
-                time: [{required: true, message: '请选择时间', trigger: 'change'}]
+                uploadYears: [{required: true, message: '请选择时间', trigger: 'change'}]
             },
             policyOperationForm: {
                 advertiserId: undefined,
@@ -435,6 +462,32 @@ export default {
             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]];
         },
+        handleProductIdChange(e) {
+            this.handleGetDownLoadAllNum();
+        },
+        handleMediaIdChange(e) {
+            this.handleGetDownLoadAllNum();
+        },
+        handleGetDownLoadAllNum() {
+            const {advertiserId, productId, mediaId, uploadYears} = this.settlementModalForm;
+            const paramsData = {
+                advertiserId,
+                productId,
+                mediaId,
+                uploadYears: uploadYears ? moment(uploadYears).format('YYYY-MM') : ''
+            };
+            postAction(urlAcount + '/finance/settLementFileController/getAccountNumAndImgNum', paramsData).then(result => {
+                if (result.success) {
+                    this.downLoadAccountNum = result.result.accountNum;
+                    this.downLoadImgNum = result.result.imageNum;
+                }
+                else {
+                    this.$message.error(result.message);
+                }
+            }).catch(error => {
+                console.log(error, 'eeee');
+            });
+        },
         // 获取所有的广告主列表
         handleGetAllAdverList() {
             const paramsData = {
@@ -454,6 +507,7 @@ export default {
         },
         handleAdverOptionChange(e) {
             this.policyOperationForm.productId = undefined;
+            this.settlementModalForm.productId = undefined;
             const paramsData = {
                 pageNo: 1,
                 pageSize: 1000,
@@ -525,12 +579,29 @@ export default {
             });
         },
         handleLaunchDateRange(date, dateString) {
-            this.profitModalForm.launchDateRange = dateString;
+            this.profitModalForm.launchDateRange = dateString[0] ? dateString : [];
         },
         handleProfitModalSure() {
             this.$refs.profitModalForm.validate(valid => {
                 if (valid) {
-                    console.log('条件完全');
+                    const {mediaId, launchDateRange} = this.profitModalForm;
+                    const paramsData = {
+                        mediaId,
+                        startTime: launchDateRange[0],
+                        endTime: launchDateRange[1]
+                    };
+                    const urlData = mediaId === 1 ? '/finance/exportReportController/porfitReportBytedance' : '/finance/exportReportController/porfitReportKuaiShou';
+                    getAction(urlAcount + urlData, paramsData).then(result => {
+                        if (result.code === -1) {
+                            this.$message.error(result.message);
+                        }
+                        else {
+                            window.location.href = `${urlAcount}${urlData}?startTime=${paramsData.startTime}&endTime=${paramsData.endTime}`;
+                            this.handleSettlementModalnCancel();
+                        }
+                    }).catch(error => {
+                        console.log(error, 'eeee');
+                    });
                 }
                 else {
                     console.log('error submit!!');
@@ -542,24 +613,50 @@ export default {
             this.profitModalStatus = false;
         },
         handleSettlementModalSure() {
-            console.log(this.settlementModalForm, '下载结算单确定按钮');
             this.$refs.settlementModalForm.validate(valid => {
                 if (valid) {
-                    console.log('条件完全');
+                    const {advertiserId, productId, mediaId, uploadYears} = this.settlementModalForm;
+                    const paramsData = {
+                        advertiserId,
+                        productId,
+                        mediaId,
+                        uploadYears: moment(uploadYears).format('YYYY-MM')
+                    };
+                    const urlData = mediaId === 1 ? '/finance/exportReportController/settlementReportBytedance' : '/finance/exportReportController/settlementReportKuaiShou';
+                    getAction(urlAcount + urlData, paramsData).then(result => {
+                        if (result.code === -1) {
+                            this.$message.error(result.message);
+                        }
+                        else {
+                            window.location.href = `${urlAcount}${urlData}?advertiserId=${advertiserId}&productId=${productId}&mediaId=${mediaId}&uploadYears=${paramsData.uploadYears}`;
+                            this.handleSettlementModalnCancel();
+                        }
+                    }).catch(error => {
+                        console.log(error, 'eeee');
+                    });
                 }
                 else {
-                    console.log('error submit!!');
                     return false;
                 }
             });
         },
         handleSettlementModalnCancel() {
+            this.settlementModalForm = {
+                advertiserId: undefined,
+                productId: undefined,
+                mediaId: 1,
+                uploadYears: ''
+            };
             this.settlementModalStatus = false;
         },
         // 月份时间选择器
         handleLaunchData(date, dateString) {
             this.policyOperationForm.uploadYears = dateString;
         },
+        handleUploadYears(date, dateString) {
+            this.settlementModalForm.uploadYearss = dateString;
+            this.handleGetDownLoadAllNum();
+        },
         // 查询的按钮
         handleQueryList() {
             this.tablePag = {
@@ -589,11 +686,18 @@ export default {
             this.policyOperationForm.settlementList = formData.filter(item => file.uid !== item.uid);
         },
         beforeUpload(file) {
+            let reg = /[\u4E00-\u9FA5]|[A-Za-z]/g;
+            const name = file.name.split('.')[0];
+            let finallyResult = name.match(reg);
             const isZip = file.type.includes('png') || file.type.includes('jpeg');
             if (!isZip) {
                 this.$message.error('请上传正确的图片');
                 return;
             }
+            if (finallyResult && finallyResult.length) {
+                this.$message.error('请修改正确的图片名称');
+                return;
+            }
             this.cosUpload(file);
         },
         handleMd5(file) {
@@ -664,7 +768,7 @@ export default {
                         uid: file.name,
                         name: file.name,
                         status: 'done',
-                        url: '//' + data.Location
+                        url: 'https://' + data.Location
                     });
                     // that.handleMd5(file);
                 }
@@ -740,7 +844,8 @@ export default {
                 productId: list.productId,
                 mediaId: list.mediaId,
                 uploadYears: list.uploadYears,
-                operateUserId: list.operateUserId
+                createUserId: list.operateUserId,
+                accountId: list.accountId
             };
             this.$confirm({
                 title: '提示',
@@ -762,17 +867,14 @@ export default {
         },
         // 下载利润单
         handleDownloadProfit() {
-            console.log('下载利润单');
             this.profitModalStatus = true;
         },
         // 下载结算单
         handleDownloadSettlement() {
-            console.log('下载结算单');
             this.settlementModalStatus = true;
         },
         // 上传截图
         handleUploadAccount() {
-            console.log('上传截图');
             this.policyOperationStatus = true;
         }
     }