Parcourir la source

合同利润 导出

zhongtianhaoyuan il y a 1 an
Parent
commit
5ad595c69c

+ 5 - 1
src/api/V2/profitable/index.js

@@ -115,4 +115,8 @@ export const API_IMPORT_FIXED ='/fixedAssetsInfo/api/importFixedAssets'
 //煤款列表
 export const API_GET_COALPARAGRAPH = '/coalPaymentInfo/selectCoalInfo'
 //煤款记录
-export const API_GET_COALPARAGRAPH_RECORD = '/expenseInfo/selectRequestRecordInfo'
+export const API_GET_COALPARAGRAPH_RECORD = '/expenseInfo/selectRequestRecordInfo'
+//导出
+export const API_GET_EXPORT_TEXT = '/contractManagementInfo/settlementExport'
+//查看附件
+export const API_GET_LOOK_ANNEX = '/appendix/query/getFileList'

+ 7 - 1
src/model/profitable/index.js

@@ -58,7 +58,9 @@ import {
   API_IMPORT_FIXED,
   API_POST_UPLOADIMAGE,
   API_GET_COALPARAGRAPH,
-  API_GET_COALPARAGRAPH_RECORD
+  API_GET_COALPARAGRAPH_RECORD,
+  API_GET_EXPORT_TEXT,
+  API_GET_LOOK_ANNEX
 } from '@/api/V2/profitable'
 //收支明细列表
 export const getInOutDetailed = appRx.get(API_GET_INOUTDETAILED, errorCatcher, errorHandle, filter)
@@ -177,3 +179,7 @@ export const importFixed = appRx.post(API_IMPORT_FIXED, errorCatcher, errorHandl
 export const coalPayment = appRx.get(API_GET_COALPARAGRAPH, errorCatcher, errorHandle, filter)
 // 煤款记录
 export const coalPaymentRecord = appRx.get(API_GET_COALPARAGRAPH_RECORD, errorCatcher, errorHandle, filter)
+// 导出
+export const exportText = appRx.get(API_GET_EXPORT_TEXT)
+//查看附件
+export const getAnnex = appRx.get(API_GET_LOOK_ANNEX, errorCatcher, errorHandle, filter)

+ 1 - 1
src/views/home/right-top.vue

@@ -31,7 +31,7 @@ export default {
     };
   },
   watch:{
-    crklistData(res){debugger
+    crklistData(res){
       console.log('rightyop')
       console.log(res)
       this.pageflag = true;

+ 478 - 385
src/views/profitable/contractprofitsdetails.vue

@@ -5,8 +5,9 @@
       <el-col :span="12">
         <h2 class="bg-left title">利润详情</h2>
       </el-col>
-      <el-col :span="12" class="bg-right"><el-button class="bg-bottom" type="primary" size="small" @click="returnsales()"><img width="6" height="10"
-            style="vertion-align: bottom; margin-right: 3px" src="../../../public/img/lujing.png" alt="" />返回
+      <el-col :span="12" class="bg-right"><el-button class="bg-bottom" type="primary" size="small"
+          @click="returnsales()"><img width="6" height="10" style="vertion-align: bottom; margin-right: 3px"
+            src="../../../public/img/lujing.png" alt="" />返回
         </el-button></el-col>
     </el-row>
     <div class="center">
@@ -17,9 +18,11 @@
         <el-col :span="18">
           <div style='margin-left:10px;' class="datascreen">
             <div style="display:inline-block;width:50;">
-              <el-date-picker value-format='yyyy-MM-dd' v-model="value" type="daterange" align="right" unlink-panels range-separator="至"
-              start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOptions" class="data_css" @change="changeDate" >
-            </el-date-picker></div>
+              <el-date-picker value-format='yyyy-MM-dd' v-model="value" type="daterange" align="right" unlink-panels
+                range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOptions"
+                class="data_css" @change="changeDate">
+              </el-date-picker>
+            </div>
             <el-input placeholder="可按合同编号、买方名称、卖方名称查找" class="input_css" v-model="searchKeyWord"></el-input>
             <el-button class="find" type="primary" @click="find()"><img width="16" height="16" style="left: -8px;"
                 src="../../../public/img/sousuo.png" alt="" /></el-button>
@@ -28,12 +31,13 @@
       </el-row>
       <el-row style='margin-bottom:10px;'>
         <el-col :span="18">
-          <el-button style="margin-left:10px" @click="typeChange('')" :type="searchContractType == ''?'primary':''">全部合同</el-button>
-          <el-button @click="typeChange(2)" :type="searchContractType == 2?'primary':''">采购合同</el-button>
-          <el-button @click="typeChange(1)" :type="searchContractType == 1?'primary':''">销售合同</el-button>
-          <el-button @click="typeChange(3)" :type="searchContractType == 3?'primary':''">代收合同</el-button>
-          <el-button @click="typeChange(4)" :type="searchContractType == 4?'primary':''">代储合同</el-button>
-          <el-button @click="typeChange(5)" :type="searchContractType == 5?'primary':''">收购合同</el-button>
+          <el-button style="margin-left:10px" @click="typeChange('')"
+            :type="searchContractType == '' ? 'primary' : ''">全部合同</el-button>
+          <el-button @click="typeChange(2)" :type="searchContractType == 2 ? 'primary' : ''">采购合同</el-button>
+          <el-button @click="typeChange(1)" :type="searchContractType == 1 ? 'primary' : ''">销售合同</el-button>
+          <el-button @click="typeChange(3)" :type="searchContractType == 3 ? 'primary' : ''">代收合同</el-button>
+          <el-button @click="typeChange(4)" :type="searchContractType == 4 ? 'primary' : ''">代储合同</el-button>
+          <el-button @click="typeChange(5)" :type="searchContractType == 5 ? 'primary' : ''">收购合同</el-button>
           <!-- <el-button @click="typeChange(1)" :type="searchType == 1?'primary':''">收储合同</el-button> -->
         </el-col>
         <el-col :span="6">
@@ -42,12 +46,13 @@
       </el-row>
       <el-row style='margin-bottom:10px;'>
         <el-col :span="18">
-          <el-button style="margin-left:10px" @click="typeChange1('')" :type="searchTypeCon == ''?'primary':''">全部状态</el-button>
-          <el-button @click="typeChange1(4)" :type="searchTypeCon == 4?'primary':''">待执行</el-button>
-          <el-button @click="typeChange1(1)" :type="searchTypeCon == 1?'primary':''">执行中</el-button>
-          <el-button @click="typeChange1(3)" :type="searchTypeCon == 3?'primary':''">发运结束</el-button>
-          <el-button @click="typeChange1(2)" :type="searchTypeCon == 2?'primary':''">已完成</el-button>
-          <el-button @click="typeChange1(5)" :type="searchTypeCon == 5?'primary':''">已结算</el-button>
+          <el-button style="margin-left:10px" @click="typeChange1('')"
+            :type="searchTypeCon == '' ? 'primary' : ''">全部状态</el-button>
+          <el-button @click="typeChange1(4)" :type="searchTypeCon == 4 ? 'primary' : ''">待执行</el-button>
+          <el-button @click="typeChange1(1)" :type="searchTypeCon == 1 ? 'primary' : ''">执行中</el-button>
+          <el-button @click="typeChange1(3)" :type="searchTypeCon == 3 ? 'primary' : ''">发运结束</el-button>
+          <el-button @click="typeChange1(2)" :type="searchTypeCon == 2 ? 'primary' : ''">已完成</el-button>
+          <el-button @click="typeChange1(5)" :type="searchTypeCon == 5 ? 'primary' : ''">已结算</el-button>
         </el-col>
         <el-col :span="6">
 
@@ -55,10 +60,8 @@
       </el-row>
       <div class="fromdata">
         <el-table :data="tableData" stripe style="width: 100%" @selection-change="handleSelectionChange">
-          <el-table-column
-          type="selection"
-          width="55">
-        </el-table-column>
+          <el-table-column type="selection" width="55">
+          </el-table-column>
           <el-table-column type="index" label="序号">
             <template scope="scope">
               <span v-if="scope.$index < 9">0{{ scope.$index + 1 }}</span>
@@ -67,84 +70,81 @@
           </el-table-column>
           <el-table-column prop="contractNo" label="合同编号">
             <template slot-scope="scope">
-              <span>{{scope.row.contractNo}}</span>
+              <span>{{ scope.row.contractNo }}</span>
               <i @click="correlation(scope.row)" class="el-icon-connection"></i>
             </template>
           </el-table-column>
           <el-table-column prop="contractType" label="合同类型">
             <template slot-scope="scope">
-              <span v-if='scope.row.agreementType=="销售合同"'>销售</span>
-              <span v-if='scope.row.agreementType=="采购合同"'>采购</span>
-              <span v-if='scope.row.agreementType=="代收合同"'>代收</span>
-              <span v-if='scope.row.agreementType=="代储合同"'>代储</span>
-              <span v-if='scope.row.agreementType=="收购合同"'>收购</span>
+              <span v-if='scope.row.agreementType == "销售合同"'>销售</span>
+              <span v-if='scope.row.agreementType == "采购合同"'>采购</span>
+              <span v-if='scope.row.agreementType == "代收合同"'>代收</span>
+              <span v-if='scope.row.agreementType == "代储合同"'>代储</span>
+              <span v-if='scope.row.agreementType == "收购合同"'>收购</span>
             </template>
           </el-table-column>
           <el-table-column prop="buyer" label="买方/收购方"></el-table-column>
           <el-table-column prop="seller" label="卖方/合营方"></el-table-column>
           <el-table-column width="120" prop="surplus" label="剩余(吨)">
-             <template slot-scope="scope">
-              <span v-if='scope.row.agreementType=="销售合同"'>-</span>
-              <span v-else>{{scope.row.surplus}}</span>
+            <template slot-scope="scope">
+              <span v-if='scope.row.agreementType == "销售合同"'>-</span>
+              <span v-else>{{ scope.row.surplus }}</span>
             </template>
           </el-table-column>
-           <el-table-column width="150" prop="settlementPrice" label="结算单价(元/吨)">
+          <el-table-column width="150" prop="settlementPrice" label="结算单价(元/吨)">
           </el-table-column>
           <el-table-column width="120" prop="profit" label="利润(万元)">
           </el-table-column>
           <el-table-column width="80" prop="status" label="状态"></el-table-column>
           <el-table-column width="100" prop="signingDate" label="签订日期"></el-table-column>
-          <el-table-column prop="address" label="操作" width="300">
+          <el-table-column prop="address" label="操作" width="350">
             <template slot-scope="scope">
-              <el-button v-if="scope.row.status=='已结算'" @click="finalstatement(scope.row)" type="primary">结算单</el-button>
-              <el-button v-if="scope.row.status=='已完成'" @click="closeaccount(scope.row)" type="primary">结算</el-button>
+              <el-button v-if="scope.row.status == '已结算'" @click="finalstatement(scope.row)"
+                type="primary">结算单</el-button>
+              <el-button v-if="scope.row.status == '已完成'" @click="closeaccount(scope.row)" type="primary">结算</el-button>
               <el-button @click="inventory(scope.row)" type="primary">库存</el-button>
               <el-button @click="cost(scope.row)" type="primary">费用</el-button>
+              <el-button @click="exportText(scope.row)" type="primary" v-if="scope.row.status == '已结算'">导出</el-button>
             </template>
           </el-table-column>
         </el-table>
       </div>
       <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
-        style="text-align:center" :page-size="pageSize"
-        layout="total, sizes, prev, pager, next, jumper" :total="deptBudgetTotal">
+        style="text-align:center" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper"
+        :total="deptBudgetTotal">
       </el-pagination>
     </div>
-    <el-dialog
-  title="提示"
-  :visible.sync="correlationshow"
-  width="30%"
-  :before-close="handleClose">
-  <div v-if="contractList.length>0">
-    <div style="display:flex;justify-content: space-between;" v-for="item in contractList"><div>{{item.contractNo}}</div>
-  <div><span v-if="item.status!='已完成'&&item.status!='已结算'&&item.status!='发运结束'">未完成</span><span v-else>已完成</span></div>
-     </div>
-  </div>
-  <div v-else>暂无关联合同</div>
-</el-dialog>
-<el-dialog
-  title="合同结算单"
-  :visible.sync="show"
-  width="47%"
-  :before-close="handleClose1">
-  <div>
-    <table class="table">
+    <el-dialog title="提示" :visible.sync="correlationshow" width="30%" :before-close="handleClose">
+      <div v-if="contractList.length > 0">
+        <div style="display:flex;justify-content: space-between;" v-for="(item, index) in contractList" :key="index">
+          <div>{{ item.contractNo }}</div>
+          <div><span v-if="item.status != '已完成' && item.status != '已结算' && item.status != '发运结束'">未完成</span><span
+              v-else>已完成</span>
+          </div>
+        </div>
+      </div>
+      <div v-else>暂无关联合同</div>
+    </el-dialog>
+    <el-dialog title="合同结算单" :visible.sync="show" width="47%" :before-close="handleClose1">
+      <div>
+        <table class="table">
           <tr class="row">
             <td class="col col-bgc">合同编号</td>
-            <td class="col">{{tableData.contractNo}}</td>
+            <td class="col">{{ tableData.contractNo }}</td>
             <td class="col col-bgc">合同类型</td>
-            <td  class="col">{{tableData.agreementType}}</td>
+            <td class="col">{{ tableData.agreementType }}</td>
           </tr>
           <tr class="row">
             <td class="col col-bgc">买方</td>
-            <td class="col">{{tableData.buyer}}</td>
+            <td class="col">{{ tableData.buyer }}</td>
             <td class="col col-bgc">卖方</td>
-            <td class="col">{{tableData.seller}}</td>
+            <td class="col">{{ tableData.seller }}</td>
           </tr>
           <tr class="row">
             <td class="col col-bgc">结算单价(元/吨)</td>
-            <td class="col">{{tableData.settlementPrice}}</td>
+            <td class="col">{{ tableData.settlementPrice }}</td>
             <td class="col col-bgc">合计利润(元)</td>
-            <td class="col">{{tableData.profit}}</td>
+            <td class="col">{{ tableData.profit }}</td>
           </tr>
           <tr class="row">
             <td class="col col-bgc">关联合同</td>
@@ -152,368 +152,461 @@
             <td class="col col-bgc">重量(吨)</td>
             <td class="col col-bgc">利润(元)</td>
           </tr>
-          <tr v-for="item in tableData.contractList" class="row">
-            <td class="col">{{item.contractNo}}</td>
-            <td class="col">{{item.settlementPrice}}</td>
-            <td class="col">{{item.weight}}</td>
-            <td class="col">{{item.profit}}</td>
+          <tr v-for="(item, index) in tableData.contractList" :key="index" class="row">
+            <td class="col">{{ item.contractNo }}</td>
+            <td class="col">{{ item.settlementPrice }}</td>
+            <td class="col">{{ item.weight }}</td>
+            <td class="col">{{ item.profit }}</td>
           </tr>
         </table>
-    </div>
-</el-dialog>
+      </div>
+    </el-dialog>
+    <el-dialog title="导出" :visible.sync="exportShow" width="500px" :before-close="exportClose" :show-close="true">
+      <div class="check">
+        <el-checkbox-group v-model="checkList" @change="checkChange">
+          <el-checkbox label="合同附件" :disabled="contract"></el-checkbox>
+          <el-checkbox label="发运记录"></el-checkbox>
+          <el-checkbox label="费用记录"></el-checkbox>
+          <el-checkbox label="结算单"></el-checkbox>
+        </el-checkbox-group>
+      </div>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="exportClose">取 消</el-button>
+        <el-button type="primary" @click="exportSubmit">确 定</el-button>
+      </span>
+    </el-dialog>
   </div>
 </template>
 <script>
-  import {
-    getcontractdetails,
-    getrelationcontract,
-    editcontract,
-    judgesettlement
-  } from '@/model/profitable/index'
-  export default {
-    components: {},
-    data() {
-      return {
-        value: '',
-        tableData: [],
-        show:false,
-        correlationshow:false,
-        deptBudgetTotal: 0,
-        currentPage: 1,
-        pageSize: 10,
-        agreementType:'',
-        deptCircularPage: {},
-        searchType:'',
-        searchKeyWord:'',
-        startDate:'',
-        searchContractType:'',
-        searchTypeCon:'',
-        endDate:'',
-        outtotal:0,
-        intotal:0,
-        contractList:[],
-        tableData:{},
-        datalist:{},
-        compId:localStorage.getItem('ws-pf_compId'),
+import {
+  getcontractdetails,
+  getrelationcontract,
+  editcontract,
+  judgesettlement,
+  exportText,
+  getAnnex
+} from '@/model/profitable/index'
+import {
+  downloadFile
+} from '@/utils/batchDown'
+export default {
+  components: {},
+  data() {
+    return {
+      value: '',
+      tableData: [],
+      show: false,
+      correlationshow: false,
+      deptBudgetTotal: 0,
+      currentPage: 1,
+      pageSize: 10,
+      agreementType: '',
+      deptCircularPage: {},
+      searchType: '',
+      searchKeyWord: '',
+      startDate: '',
+      searchContractType: '',
+      searchTypeCon: '',
+      endDate: '',
+      outtotal: 0,
+      intotal: 0,
+      contractList: [],
+      tableData: {},
+      datalist: {},
+      compId: localStorage.getItem('ws-pf_compId'),
+      exportShow: false,//导出
+      checkList: [],
+      exportObj: {},
+      contract: false,
+    }
+  },
+  activated() {
+    this.getPassYearFormatDate()
+  },
+  methods: {
+    async exportSubmit() {
+      const {
+        data
+      } = await exportText(
+        this.exportObj, {}, {
+        responseType: 'blob',
       }
+      ).toPromise()
+      downloadFile({
+        res: data,
+        fileName: this.exportObj.contractNo + `结算详情`,
+        type: 'doc',
+      })
+      this.exportShow = false
+      this.checkList = []
+      this.exportObj = {}
     },
-    activated() {
-      this.getPassYearFormatDate()
+    exportText(row) {//导出
+      this.exportObj.contractNo = row.contractNo
+      if (row.addressUrl) {//查看附件后返回后端
+        getAnnex({
+          appendixIds: row.addressUrl,
+        }).toPromise().then(res => {
+          let arr = []
+          if (res.length > 0) {
+            for (let i = 0; i < res.length; i++) {
+              arr.push(res[i].appendixPath)
+            }
+          }
+          if (arr.length > 0) {
+            this.exportObj.addressUrl = arr.toString()
+          } else {//合同附件为空不让勾选
+            this.contract = true
+          }
+        })
+      }
+      this.exportShow = true
     },
-    methods: {
-      handleClose(){
-        this.correlationshow=false
-      },
-      handleClose1(){
-        this.show=false
-      },
-      correlation(row){
-        getrelationcontract({
-          agreementType:row.agreementType,contractNo:row.contractNo,compId:this.compId})
-          .toPromise()
-          .then(response => {
-            this.contractList=response
-            this.correlationshow=true
-          })
-        
-      },
-      typeChange(num){
-        this.searchContractType= num
-        this.getList()
-      },
-      typeChange1(num){
-        this.searchTypeCon= num
-        this.getList()
-      },
-      async closeaccount(row){
-      
-        var data=await getrelationcontract({
-          agreementType:row.agreementType,contractNo:row.contractNo,compId:this.compId})
-            .toPromise()
-            var arr=[row].concat(data)
-            this.datalist.contractManagementInfoList=arr
-            judgesettlement(this.datalist).toPromise().then(response => {
-                         var weightprice=0
-                  for (let i = 0; i < data.length; i++) {
-                      // weightprice+=(data[i].weight*data[i].settlementPrice)
-                      if(row.agreementType=='收购合同'||row.agreementType=='采购合同'){
-                      weightprice+=(data[i].weight*(data[i].settlementPrice-row.settlementPrice))
-                    }else if(row.agreementType=='销售合同'){
-                      weightprice+=(data[i].weight*(row.settlementPrice-data[i].settlementPrice))
-                    }
-                  }
-                    row.profit=weightprice
+    checkChange(e) {
+      for (let i = 0; i < this.checkList.length; i++) {
+        switch (this.checkList[i]) {
+          case '合同附件':
+            this.exportObj.needContractUrl = 1
+            break
+          case '发运记录':
+            this.exportObj.shippingRecord = 1
+            break
+          case '费用记录':
+            this.exportObj.expenseRecord = 1
+            break
+          case '结算单':
+            this.exportObj.needSettlementUrl = 1
+            break
+        }
+      }
+    },
+    exportClose() {
+      this.checkList = []
+      this.exportShow = false
+    },
+    handleClose() {
+      this.correlationshow = false
+    },
+    handleClose1() {
+      this.show = false
+    },
+    correlation(row) {
+      getrelationcontract({
+        agreementType: row.agreementType, contractNo: row.contractNo, compId: this.compId
+      })
+        .toPromise()
+        .then(response => {
+          this.contractList = response
+          this.correlationshow = true
+        })
+    },
+    typeChange(num) {
+      this.searchContractType = num
+      this.getList()
+    },
+    typeChange1(num) {
+      this.searchTypeCon = num
+      this.getList()
+    },
+    async closeaccount(row) {
+
+      var data = await getrelationcontract({
+        agreementType: row.agreementType, contractNo: row.contractNo, compId: this.compId
+      })
+        .toPromise()
+      var arr = [row].concat(data)
+      this.datalist.contractManagementInfoList = arr
+      judgesettlement(this.datalist).toPromise().then(response => {
+        var weightprice = 0
+        for (let i = 0; i < data.length; i++) {
+          // weightprice+=(data[i].weight*data[i].settlementPrice)
+          if (row.agreementType == '收购合同' || row.agreementType == '采购合同') {
+            weightprice += (data[i].weight * (data[i].settlementPrice - row.settlementPrice))
+          } else if (row.agreementType == '销售合同') {
+            weightprice += (data[i].weight * (row.settlementPrice - data[i].settlementPrice))
+          }
+        }
+        row.profit = weightprice
         this.$confirm('结算后当前合同和相关合同不可再进行费用相关操作', '提示', {
-            confirmButtonText: '确定',
-            cancelButtonText: '取消',
-            type: 'warning'
-          })
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        })
           .then(() => {
-            editcontract({flag:2,id:row.id,profit:row.profit}).toPromise()
-          .then(response => {
-            this.$message({
-                message: '结算成功!',
-                type: 'success',
-          })
-          this.getList()
-          }).catch(()=>{
-            this.$message({
-                message: '结算失败!',
-                type: 'warning',
-          })
+            editcontract({ flag: 2, id: row.id, profit: row.profit }).toPromise()
+              .then(response => {
+                this.$message({
+                  message: '结算成功!',
+                  type: 'success',
+                })
+                this.getList()
+              }).catch(() => {
+                this.$message({
+                  message: '结算失败!',
+                  type: 'warning',
+                })
+              })
           })
-          })
-        })
-      },
-      finalstatement(row){
-        console.log(row)
-        this.tableData.contractNo=row.contractNo
-        this.tableData.agreementType=row.agreementType
-        this.tableData.buyer=row.buyer
-        this.tableData.seller=row.seller
-        this.tableData.settlementPrice=row.settlementPrice
-        this.tableData.profit=(row.profit*10000).toFixed(2)
-        getrelationcontract({
-          agreementType:row.agreementType,contractNo:row.contractNo,compId:this.compId})
-          .toPromise()
-          .then(response => {
-            for (let q = 0; q < response.length; q++) {
-              if(row.agreementType=='收购合同'||row.agreementType=='采购合同'){
-                response[q].profit=(response[q].weight*(response[q].settlementPrice-row.settlementPrice)).toFixed(2)
-              }else if(row.agreementType=='销售合同'){
-                response[q].profit=(response[q].weight*(row.settlementPrice-response[q].settlementPrice)).toFixed(2)
-              }
-              
+      })
+    },
+    finalstatement(row) {
+      this.tableData.contractNo = row.contractNo
+      this.tableData.agreementType = row.agreementType
+      this.tableData.buyer = row.buyer
+      this.tableData.seller = row.seller
+      this.tableData.settlementPrice = row.settlementPrice
+      this.tableData.profit = (row.profit * 10000).toFixed(2)
+      getrelationcontract({
+        agreementType: row.agreementType, contractNo: row.contractNo, compId: this.compId
+      })
+        .toPromise()
+        .then(response => {
+          for (let q = 0; q < response.length; q++) {
+            if (row.agreementType == '收购合同' || row.agreementType == '采购合同') {
+              response[q].profit = (response[q].weight * (response[q].settlementPrice - row.settlementPrice)).toFixed(2)
+            } else if (row.agreementType == '销售合同') {
+              response[q].profit = (response[q].weight * (row.settlementPrice - response[q].settlementPrice)).toFixed(2)
             }
-            this.tableData.contractList=response
-            this.show=true
-          })
-      },
-      inventory(row){
-        this.$router.push({name:'contractinventory',query:{contractNo:row.contractNo,contractType:row.contractType,buyer:row.buyer,seller:row.seller}})
-      },
-      returnsales(){
-        this.$router.go(-1)
-      },
-      handleSelectionChange(val) {
-        this.multipleSelection = val;
-      },
-      cost(row){
-        this.$router.push({name:'contractcost',query:{contractNo:row.contractNo,contractType:row.contractType,buyer:row.buyer,seller:row.seller}})
-      },
-      getPassYearFormatDate() {
-        var _date = new Date()
-        var nowDate = new Date()
-        nowDate.setTime(nowDate.getTime() - 24 * 60 * 60 * 1000 * 30)
-        var year = nowDate.getFullYear()
-        var year1 = _date.getFullYear()
-        var month = nowDate.getMonth() + 1
-        var month1 = _date.getMonth() + 1
-        var strDate = nowDate.getDate()
-        var strDate1 = _date.getDate()
-        if (month >= 1 && month <= 9) {
-          month = '0' + month
-        }
-        if (month1 >= 1 && month1 <= 9) {
-          month1 = '0' + month1
-        }
-        if (strDate >= 0 && strDate <= 9) {
-          strDate = '0' + strDate
-        }
-        if (strDate1 >= 0 && strDate1 <= 9) {
-          strDate1 = '0' + strDate1
-        }
-        this.startDate = year + '-' + month + '-' + strDate
-        this.endDate = year1 + '-' + month1 + '-' + strDate1
-        this.value = [this.startDate, this.endDate]
-        this.getList()
-        // })
-      },
-      async getList() {
-         var response=await getcontractdetails({
-            // warehouseType: 1,
-            agreementType: this.agreementType,
-            startDate:this.startDate,
-            endDate:this.endDate,
-            searchKeyWord:this.searchKeyWord,
-            currentPage: this.currentPage,
-            pageSize:this.pageSize ,
-            searchType:this.searchType,
-            searchContractType:this.searchContractType,
-            searchTypeCon:this.searchTypeCon
-          })
-          .toPromise()
-          
-          if(response.records.length){
-              for (let i = 0; i < response.records.length; i++) {
-                if(response.records[i].status=='已结算'){
-                  var data=await getrelationcontract({
-                  agreementType:response.records[i].agreementType,contractNo:response.records[i].contractNo,compId:this.compId})
-                  .toPromise()
-                  var weightprice=0
-                  var weightprice1=0
-                  console.log(data)
-                  for (let q = 0; q < data.length; q++) {
-                    if(response.records[i].agreementType=='收购合同'||response.records[i].agreementType=='采购合同'){
-                      weightprice+=(data[q].weight*(data[q].settlementPrice-response.records[i].settlementPrice))
-                    }else if(response.records[i].agreementType=='销售合同'){
-                      weightprice+=(data[q].weight*(response.records[i].settlementPrice-data[q].settlementPrice))
-                    }
-                    data[q].profit=data[q].weight*data[q].settlementPrice
-                    console.log(data[q],222222)
-                  }
-                    response.records[i].profit=weightprice
-                 
-                }
-                response.records[i].profit=Number(Number(response.records[i].profit/10000).toFixed(3))
-                response.records[i].surplus=Number(Number(response.records[i].surplus).toFixed(3))
+
+          }
+          this.tableData.contractList = response
+          this.show = true
+        })
+    },
+    inventory(row) {
+      this.$router.push({ name: 'contractinventory', query: { contractNo: row.contractNo, contractType: row.contractType, buyer: row.buyer, seller: row.seller } })
+    },
+    returnsales() {
+      this.$router.go(-1)
+    },
+    handleSelectionChange(val) {
+      this.multipleSelection = val;
+    },
+    cost(row) {
+      this.$router.push({ name: 'contractcost', query: { contractNo: row.contractNo, contractType: row.contractType, buyer: row.buyer, seller: row.seller } })
+    },
+    getPassYearFormatDate() {
+      var _date = new Date()
+      var nowDate = new Date()
+      nowDate.setTime(nowDate.getTime() - 24 * 60 * 60 * 1000 * 30)
+      var year = nowDate.getFullYear()
+      var year1 = _date.getFullYear()
+      var month = nowDate.getMonth() + 1
+      var month1 = _date.getMonth() + 1
+      var strDate = nowDate.getDate()
+      var strDate1 = _date.getDate()
+      if (month >= 1 && month <= 9) {
+        month = '0' + month
+      }
+      if (month1 >= 1 && month1 <= 9) {
+        month1 = '0' + month1
+      }
+      if (strDate >= 0 && strDate <= 9) {
+        strDate = '0' + strDate
+      }
+      if (strDate1 >= 0 && strDate1 <= 9) {
+        strDate1 = '0' + strDate1
+      }
+      this.startDate = year + '-' + month + '-' + strDate
+      this.endDate = year1 + '-' + month1 + '-' + strDate1
+      this.value = [this.startDate, this.endDate]
+      this.getList()
+      // })
+    },
+    async getList() {
+      var response = await getcontractdetails({
+        // warehouseType: 1,
+        agreementType: this.agreementType,
+        startDate: this.startDate,
+        endDate: this.endDate,
+        searchKeyWord: this.searchKeyWord,
+        currentPage: this.currentPage,
+        pageSize: this.pageSize,
+        searchType: this.searchType,
+        searchContractType: this.searchContractType,
+        searchTypeCon: this.searchTypeCon
+      })
+        .toPromise()
+
+      if (response.records.length) {
+        for (let i = 0; i < response.records.length; i++) {
+          if (response.records[i].status == '已结算') {
+            var data = await getrelationcontract({
+              agreementType: response.records[i].agreementType, contractNo: response.records[i].contractNo, compId: this.compId
+            })
+              .toPromise()
+            var weightprice = 0
+            var weightprice1 = 0
+            console.log(data)
+            for (let q = 0; q < data.length; q++) {
+              if (response.records[i].agreementType == '收购合同' || response.records[i].agreementType == '采购合同') {
+                weightprice += (data[q].weight * (data[q].settlementPrice - response.records[i].settlementPrice))
+              } else if (response.records[i].agreementType == '销售合同') {
+                weightprice += (data[q].weight * (response.records[i].settlementPrice - data[q].settlementPrice))
               }
+              data[q].profit = data[q].weight * data[q].settlementPrice
+              console.log(data[q], 222222)
             }
-            this.tableData = response.records
-            if(this.tableData.length > 0){
-              
-              this.intotal = Number(this.tableData[0].inContractMoney) + Number(this.tableData[0].inWarehouseMoney) + Number(this.tableData[0].inManageMoney)
-            this.outtotal = Number(this.tableData[0].outContractMoney) + Number(this.tableData[0].outWarehouseMoney) + Number(this.tableData[0].outManageMoney)
-            }
-            
-           this.deptBudgetTotal = response.total
-      },
+            response.records[i].profit = weightprice
 
-      changeDate(){
-        if(this.value){
-          this.startDate = this.value[0]
-          this.endDate = this.value[1]
+          }
+          response.records[i].profit = Number(Number(response.records[i].profit / 10000).toFixed(3))
+          response.records[i].surplus = Number(Number(response.records[i].surplus).toFixed(3))
         }
-        this.getList()
-      },
-      pickerOptions() {},
-      find() {
-        this.getList()
-
-      },
-      handleSizeChange(val) {
-        console.log(`每页 ${val} 条`)
-        this.pageSize = val
-        this.getList()
-      },
-      handleCurrentChange(val) {
-        this.currentPage = val
-        console.log(`当前页: ${val}`)
-        this.getList()
-      },
-    },
-  }
-</script>
-<style lang="scss" scoped>
- table,
-      table tr th,
-      table tr td {
-        border: 2px solid #333333;
-        padding: 5px 0;
-        height: 55px;
       }
+      this.tableData = response.records
+      if (this.tableData.length > 0) {
 
-      .content {
-        width: 1000px;
-        padding: 70px 20px 20px 20px;
-        font-size: 22px;
-        position: absolute;
-        top: 0;
-        bottom: 0;
-        left: 0;
-        right: 0;
+        this.intotal = Number(this.tableData[0].inContractMoney) + Number(this.tableData[0].inWarehouseMoney) + Number(this.tableData[0].inManageMoney)
+        this.outtotal = Number(this.tableData[0].outContractMoney) + Number(this.tableData[0].outWarehouseMoney) + Number(this.tableData[0].outManageMoney)
       }
 
-      table {
-        width: 100%;
-        text-align: center;
-        border-collapse: collapse;
-        border: 3px solid #333333;
-      }
+      this.deptBudgetTotal = response.total
+    },
 
-      .col-bgc {
-        background: #f6f7fb;
+    changeDate() {
+      if (this.value) {
+        this.startDate = this.value[0]
+        this.endDate = this.value[1]
       }
+      this.getList()
+    },
+    pickerOptions() { },
+    find() {
+      this.getList()
 
-  .container {
-    background: #E8ECF6;
-  }
+    },
+    handleSizeChange(val) {
+      console.log(`每页 ${val} 条`)
+      this.pageSize = val
+      this.getList()
+    },
+    handleCurrentChange(val) {
+      this.currentPage = val
+      console.log(`当前页: ${val}`)
+      this.getList()
+    },
+  },
+}
+</script>
+<style lang="scss" scoped>
+table,
+table tr th,
+table tr td {
+  border: 2px solid #333333;
+  padding: 5px 0;
+  height: 55px;
+}
 
-  .center {
-    margin: 0 auto;
-    background: #ffffff;
-    height: calc(100vh - 13vh);
-    border-radius: 4px;
-    padding: 20px 0;
+.content {
+  width: 1000px;
+  padding: 70px 20px 20px 20px;
+  font-size: 22px;
+  position: absolute;
+  top: 0;
+  bottom: 0;
+  left: 0;
+  right: 0;
+}
 
-    /deep/.el-table td,
-    /deep/.el-table th {
-      text-align: center;
-    }
-  }
+table {
+  width: 100%;
+  text-align: center;
+  border-collapse: collapse;
+  border: 3px solid #333333;
+}
 
-  .row_top {
-    background: #F6F7FC;
-    border-radius: 4px;
-    margin-bottom: 10px;
+.col-bgc {
+  background: #f6f7fb;
+}
 
-    .bg-left {
-      padding-left: 30px;
-    }
-
-    .bg-right {
-      padding-right: 10px;
-      text-align: right;
-    }
+.container {
+  background: #E8ECF6;
+}
 
-    .title {
-      position: relative;
-    }
+.center {
+  margin: 0 auto;
+  background: #ffffff;
+  height: calc(100vh - 215px);
+  border-radius: 4px;
+  padding: 20px 0;
 
-    .title::before {
-      content: '';
-      display: inline-block;
-      width: 5px;
-      height: 30px;
-      background: #5473e8;
-      position: absolute;
-      left: 0;
-    }
+  /deep/.el-table td,
+  /deep/.el-table th {
+    text-align: center;
   }
+}
 
-  .datascreen {
-    display: flex;
+.row_top {
+  background: #F6F7FC;
+  border-radius: 4px;
+  margin-bottom: 10px;
 
-    .data_css {
-      width: 40%;
-    }
+  .bg-left {
+    padding-left: 30px;
+  }
 
-    .input_css {
-      width: 50%;
-      margin: 0 10px;
-    }
+  .bg-right {
+    padding-right: 10px;
+    text-align: right;
+  }
 
-    .find {
-      margin-right: 10px;
-    }
+  .title {
+    position: relative;
   }
 
-  .fromdata {
-    margin: 20px 0;
-    overflow-y: scroll;
-    height: 546px;
+  .title::before {
+    content: '';
+    display: inline-block;
+    width: 5px;
+    height: 30px;
+    background: #5473e8;
+    position: absolute;
+    left: 0;
   }
-  .top_info{
-    margin: 10px 0 0 10px;
-    min-width: 712px;
-    .info_css{
-      margin-right: 20px;
-    }
+}
+
+.datascreen {
+  display: flex;
+
+  .data_css {
+    width: 40%;
   }
-  .bg-right{
-    padding-top:15px;
+
+  .input_css {
+    width: 50%;
+    margin: 0 10px;
   }
-  .el-icon-connection{
-    color:#409eff;
+
+  .find {
+    margin-right: 10px;
   }
+}
+
+.fromdata {
+  margin: 20px 0;
+  overflow-y: scroll;
+  height: 546px;
+}
+
+.top_info {
+  margin: 10px 0 0 10px;
+  min-width: 712px;
+
+  .info_css {
+    margin-right: 20px;
+  }
+}
+
+.bg-right {
+  padding-top: 15px;
+}
+
+.el-icon-connection {
+  color: #409eff;
+}
+
+.check {
+  text-align: center;
+}
 </style>

+ 3 - 1
src/views/profitable/expensemanagementdetails.vue

@@ -434,6 +434,9 @@ export default {
     }
   },
   activated() {
+    if(this.$route.query.id){//有id证从任务页面进来的  将筛选状态变成待付款
+      this.toExamineType = "2"
+    }
     this.getPassYearFormatDate()
     this.getList()
     this.xiala()
@@ -574,7 +577,6 @@ export default {
         })
     },
     getList1() {
-      console.log(this.toExamineType)
       this.currentPage = 1
       this.getList()
     },