gjy 2 vuotta sitten
vanhempi
commit
e0ecfd8878
2 muutettua tiedostoa jossa 200 lisäystä ja 6 poistoa
  1. 6 0
      src/views/profitable/cashout.vue
  2. 194 6
      src/views/profitable/contractprofitsdetails.vue

+ 6 - 0
src/views/profitable/cashout.vue

@@ -30,6 +30,12 @@
                 <ws-option label="保证金" value="保证金" style="color: #8890b1" />
             </ws-select>
           </el-form-item>
+          <el-form-item label-width='100px' v-if='deptBudgetList.purpose=="库点费用"' label="仓储费" span="1" prop="contractNo" class="readonly">
+            <ws-select v-model="deptBudgetList.type" placeholder="" class="typeselect" >
+                <ws-option label="否" value="否" style="color: #8890b1" />
+                <ws-option label="是" value="是" style="color: #8890b1" />
+            </ws-select>
+          </el-form-item>
           <el-form-item label-width='100px' v-if='deptBudgetList.purpose=="合同费用"' label="合同编号" span="1" prop="contractNo" class="readonly">
             <el-select v-model="deptBudgetList.contractNo" filterable clearable placeholder="选择合同" class="typeselect" @change="selectcontract">
               <el-option v-for="item in contractList" :key="item.id" :label="item.contractNo" :value="item.contractNo"

+ 194 - 6
src/views/profitable/contractprofitsdetails.vue

@@ -32,6 +32,7 @@
           <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">
@@ -45,6 +46,7 @@
           <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">
 
@@ -62,17 +64,23 @@
               <span v-else>{{ scope.$index + 1 }}</span>
             </template>
           </el-table-column>
-          <el-table-column prop="contractNo" label="合同编号"></el-table-column>
+          <el-table-column prop="contractNo" label="合同编号">
+            <template slot-scope="scope">
+              <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>
             </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 prop="buyer" label="买方/收购方"></el-table-column>
+          <el-table-column prop="seller" label="卖方/合营方"></el-table-column>
           <el-table-column prop="surplus" label="剩余(吨)">
              <template slot-scope="scope">
               <span v-if='scope.row.agreementType=="销售合同"'>-</span>
@@ -83,8 +91,11 @@
           </el-table-column>
           <el-table-column prop="status" label="状态"></el-table-column>
           <el-table-column prop="signingDate" label="签订日期"></el-table-column>
-          <el-table-column prop="address" label="操作" width="200">
+          <el-table-column prop="address" label="操作" width="300">
             <template slot-scope="scope">
+              <!-- <el-button @click="finalstatement(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>
             </template>
@@ -96,11 +107,65 @@
         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="30%"
+  :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 col-bgc">合同类型</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 col-bgc">卖方</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 col-bgc">合计利润(元)</td>
+            <td class="col">{{tableData.profit}}</td>
+          </tr>
+          <tr class="row">
+            <td class="col col-bgc">关联合同</td>
+            <td class="col col-bgc">结算单价(元/吨)</td>
+            <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>
+        </table>
+    </div>
+</el-dialog>
   </div>
 </template>
 <script>
   import {
-    getcontractdetails
+    getcontractdetails,
+    getrelationcontract,
+    editcontract
   } from '@/model/profitable/index'
   export default {
     components: {},
@@ -108,6 +173,8 @@
       return {
         value: "",
         tableData: [],
+        show:false,
+        correlationshow:false,
         deptBudgetTotal: 0,
         currentPage: 1,
         pageSize: 10,
@@ -121,12 +188,31 @@
         endDate:"",
         outtotal:0,
         intotal:0,
+        contractList:[],
+        tableData:{},
+        compId:localStorage.getItem('ws-pf_compId'),
       }
     },
     activated() {
       this.getPassYearFormatDate()
     },
     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()
@@ -135,6 +221,62 @@
         this.searchTypeCon= num
         this.getList()
       },
+      closeaccount(row){
+        var data=getrelationcontract({
+          agreementType:row.agreementType,contractNo:row.contractNo,compId:this.compId})
+            .toPromise()
+                  var weightprice=0
+                  for (let i = 0; i < data.length; i++) {
+                    // if(data[i].status=='已完成'){
+                      weightprice+=(data[i].weight*data[i].settlementPrice)
+                    // }else{
+                    //   this.$message({
+                    //         message: data[i].contractNo+'尚未完成!',
+                    //         type: 'warning',
+                    //   })
+                    // }
+                    // weightprice1-=(data[i].weight*data[i].settlementPrice)
+                  }
+                  if(row.agreementType=='收购合同'||row.agreementType=='采购合同'){
+                    row.profit=weightprice-(row.weight*row.settlementPrice)
+                  }else if(row.agreementType=='销售合同'){
+                    row.profit=(row.weight*row.settlementPrice)-weightprice
+                  }
+        this.$confirm('结算后当前合同和相关合同不可再进行费用相关操作', '提示', {
+            confirmButtonText: '确定',
+            cancelButtonText: '取消',
+            type: 'warning'
+          })
+          .then(() => {
+            editcontract({flag:2,id:row.id,profit:row.profit}).toPromise()
+          .then(response => {
+            this.$message({
+                message: '结算成功!',
+                type: 'success',
+          })
+          }).catch(()=>{
+            this.$message({
+                message: '结算失败!',
+                type: 'warning',
+          })
+          })
+          })
+      },
+      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
+        getrelationcontract({
+          agreementType:row.agreementType,contractNo:row.contractNo,compId:this.compId})
+          .toPromise()
+          .then(response => {
+            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}})
       },
@@ -178,7 +320,7 @@
             this.getList()
           })
         },
-      getList() {
+      async getList() {
          getcontractdetails({
             // warehouseType: 1,
             agreementType: this.agreementType,
@@ -195,6 +337,22 @@
           .then(response => {
             if(response.records.length){
               for (let i = 0; i < response.records.length; i++) {
+                if(response.records[i].status=='已结算'){
+                  var data=getrelationcontract({
+                  agreementType:response.records[i].agreementType,contractNo:response.records[i].contractNo,compId:this.compId})
+                  .toPromise()
+                  var weightprice=0
+                  var weightprice1=0
+                  for (let i = 0; i < data.length; i++) {
+                    weightprice+=(data[i].weight*data[i].settlementPrice)
+                    // weightprice1-=(data[i].weight*data[i].settlementPrice)
+                  }
+                  if(response.records[i].agreementType=='收购合同'||response.records[i].agreementType=='采购合同'){
+                    response.records[i].profit=weightprice-(response.records[i].weight*response.records[i].settlementPrice)
+                  }else if(response.records[i].agreementType=='销售合同'){
+                    response.records[i].profit=(response.records[i].weight*response.records[i].settlementPrice)-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))
               }
@@ -236,6 +394,36 @@
   }
 </script>
 <style lang="scss" scoped>
+ table,
+      table tr th,
+      table tr td {
+        border: 2px solid #333333;
+        padding: 5px 0;
+        height: 55px;
+      }
+
+      .content {
+        width: 1000px;
+        padding: 70px 20px 20px 20px;
+        font-size: 22px;
+        position: absolute;
+        top: 0;
+        bottom: 0;
+        left: 0;
+        right: 0;
+      }
+
+      table {
+        width: 100%;
+        text-align: center;
+        border-collapse: collapse;
+        border: 3px solid #333333;
+      }
+
+      .col-bgc {
+        background: #f6f7fb;
+      }
+
   .container {
     background: #E8ECF6;
   }