|
@@ -0,0 +1,743 @@
|
|
|
|
+//请款
|
|
|
|
+<template>
|
|
|
|
+ <div class="container">
|
|
|
|
+ <el-row class="row_top">
|
|
|
|
+ <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-button></el-col>
|
|
|
|
+ </el-row>
|
|
|
|
+ <div class="center">
|
|
|
|
+
|
|
|
|
+ <div>
|
|
|
|
+ <el-form label-position="left"><div style='margin:30px 0 30px;'>基本信息</div>
|
|
|
|
+ <el-form-item label-width='100px' label="用途" span="1" prop="purpose" class="readonly">
|
|
|
|
+ <ws-select v-model="deptBudgetList.purpose" placeholder="" class="typeselect" >
|
|
|
|
+ <ws-option label="合同费用" value="合同费用"
|
|
|
|
+ style="color: #8890b1" />
|
|
|
|
+ <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">
|
|
|
|
+ <ws-select v-model="deptBudgetList.type" placeholder="" class="typeselect" >
|
|
|
|
+ <ws-option label="粮款" value="粮款" style="color: #8890b1" />
|
|
|
|
+ <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" placeholder="选择合同" class="typeselect" @change="selectcontract">
|
|
|
|
+ <el-option v-for="item in contractList" :key="item.contractNo" :label="item.contractNo" :value="item.contractNo"
|
|
|
|
+ style="color: #8890b1" />
|
|
|
|
+ </el-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.warehouseName" placeholder="选择仓库" class="typeselect" @change="selectwarehouse">
|
|
|
|
+ <el-option v-for="item in warehouseList" :key="item.warehouseName" :label="item.warehouseName" :value="item.warehouseName"
|
|
|
|
+ style="color: #8890b1" />
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label-width='100px' label="费用名称" span="1" prop="settlementMethod">
|
|
|
|
+ <el-input class='input50 input_css' placeholder="输入费用名称,1-15个字" v-model="deptBudgetList.expenseName"></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label-width='100px' label="金额" span="1" prop="contractNo" class="readonly">
|
|
|
|
+ <el-input class='input50 input_css' placeholder="输入请款金额" v-model="deptBudgetList.amountMoney"></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label-width='100px' label="备注" span="1" prop="settlementMethod">
|
|
|
|
+ <el-input
|
|
|
|
+ type="textarea"
|
|
|
|
+ :rows="5"
|
|
|
|
+ placeholder="选填,不超过50个字"
|
|
|
|
+ v-model="deptBudgetList.remark">
|
|
|
|
+ </el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label-width='100px' label="附件">
|
|
|
|
+ <el-upload ref='uploadfiles' :file-list='dataList' action="https://www.zthymaoyi.com/upload/admin" list-type="picture-card"
|
|
|
|
+ :on-success="handlefujian" :on-remove="handleRemove" class="photo2">
|
|
|
|
+ <i class="el-icon-plus"></i>
|
|
|
|
+ </el-upload>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-form>
|
|
|
|
+ <div v-if='deptBudgetList.purpose=="合同费用"&&deptBudgetList.type=="非粮款"||deptBudgetList.purpose=="库点费用"' class='expensetitle'>费用分配</div>
|
|
|
|
+ <div v-if='deptBudgetList.purpose=="合同费用"&&deptBudgetList.type=="非粮款"||deptBudgetList.purpose=="库点费用"' style='margin:0 auto 10px;width:90%;'>
|
|
|
|
+ <ws-select v-model="mode" placeholder="费用分配方式" @change="modeselect">
|
|
|
|
+ <ws-option v-for="item in modeList" :key="item.value" :label="item.value" :value="item.value"
|
|
|
|
+ style="color: #8890b1" />
|
|
|
|
+ </ws-select>
|
|
|
|
+ <!-- <ws-select v-if='deptBudgetList.purpose==1' v-model="ware" placeholder="费用分配仓库" class="typeselect" @change="selectwareType"
|
|
|
|
+ :value="searchType">
|
|
|
|
+ <ws-option v-for="item in wareList" :key="item.value" :label="item.value" :value="item.value"
|
|
|
|
+ style="color: #8890b1" />
|
|
|
|
+ </ws-select>
|
|
|
|
+ <ws-select v-if='deptBudgetList.purpose==2' v-model="goods" placeholder="费用分配产品" class="typeselect" @change="selectproductType"
|
|
|
|
+ :value="searchType">
|
|
|
|
+ <ws-option v-for="item in goodsList" :key="item.value" :label="item.value" :value="item.value"
|
|
|
|
+ style="color: #8890b1" />
|
|
|
|
+ </ws-select>
|
|
|
|
+ <ws-select v-model="dates" placeholder="费用分配日期" class="typeselect" @change="selecttaskType"
|
|
|
|
+ :value="searchType">
|
|
|
|
+ <ws-option v-for="item in datesList" :key="item.value" :label="item.value" :value="item.value"
|
|
|
|
+ style="color: #8890b1" />
|
|
|
|
+ </ws-select> -->
|
|
|
|
+ <ws-select :disabled='disabled' v-model="moneys" placeholder="费用分配金额">
|
|
|
|
+ <ws-option v-for="item in moneysList" :key="item.value" :label="item.value" :value="item.value"
|
|
|
|
+ style="color: #8890b1" />
|
|
|
|
+ </ws-select>
|
|
|
|
+ <span v-if='mode!="暂不分配"'>合计分配:{{amount}}元</span>
|
|
|
|
+ </div>
|
|
|
|
+ <el-table v-if='deptBudgetList.purpose=="合同费用"&&deptBudgetList.type=="非粮款"&&mode!="暂不分配"||deptBudgetList.purpose=="库点费用"&&mode!="暂不分配"' :data="feeDetailsDistributions" style="width: 90%;margin:0 auto;">
|
|
|
|
+ <el-table-column v-if='deptBudgetList.purpose=="合同费用"' prop="date" label="仓库名称" min-width="110">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <ws-select v-model="scope.row.warehouseName" placeholder="选择仓库" @change="((value)=>{selectware(value, scope.row)})">
|
|
|
|
+ <ws-option v-for="item in warehouseList" :key="item.warehouseName" :label="item.warehouseName" :value="item.warehouseName"
|
|
|
|
+ style="color: #8890b1" />
|
|
|
|
+ </ws-select>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column v-if='deptBudgetList.purpose=="合同费用"' prop="date" label="日期">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <ws-select v-model="scope.row.receiptDocDate" placeholder="选择日期" @change="((value)=>{selecttime(value, scope.row)})">
|
|
|
|
+ <ws-option v-for="item in datelist" :key="item.time" :label="item.time" :value="item.time"
|
|
|
|
+ style="color: #8890b1" />
|
|
|
|
+ </ws-select>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column v-if='deptBudgetList.purpose=="库点费用"' prop="date" label="日期">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <el-date-picker @change="receiptDocDatechange" v-model="scope.row.receiptDocDate" type="date" placeholder="请选择日期"
|
|
|
|
+ value-format="yyyy-MM-dd" ></el-date-picker>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column v-if='deptBudgetList.purpose=="库点费用"' prop="date" label="货源">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <ws-select v-model="scope.row.orderId" placeholder="选择货源" @change="((value)=>{selectgoodsSource(value, scope.row)})">
|
|
|
|
+ <ws-option v-for="item in goodsourcelist" :key="item.id" :label="item.goodsSource" :value="item.id"
|
|
|
|
+ style="color: #8890b1" />
|
|
|
|
+ </ws-select>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column v-if='deptBudgetList.purpose=="库点费用"' prop="date" label="货名">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <span>{{scope.row.goodsName?scope.row.goodsName:'自动获取'}}</span>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column prop="inWarehouseWeight" label="入库量(吨)">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <span>{{scope.row.inWarehouseWeight?scope.row.inWarehouseWeight:'自动获取'}}</span>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column prop="date" label="分配金额(元)">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <el-input placeholder="输入费用名称,1-15个字" class="input_css" v-model="scope.row.distributionMoney"></el-input>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column prop="address" label="操作" width="200">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <img class='add' @click='addlist()' src="../../../public/img/add.png" alt="">
|
|
|
|
+ <img class='del' @click='dellist(scope.row)' src="../../../public/img/del.png" alt="">
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ </el-table>
|
|
|
|
+ <div style='text-align:right;margin-right:30px;'>
|
|
|
|
+ <el-button class="bg-bottom" type="primary" size="small" @click="submit()">提交
|
|
|
|
+ </el-button>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+</template>
|
|
|
|
+<script>
|
|
|
|
+ import {setexpense,getcontract,getwarehouse,addexenseinfo,getwarehousingorder} from '@/model/profitable/index'
|
|
|
|
+ export default {
|
|
|
|
+ components: {},
|
|
|
|
+ data() {
|
|
|
|
+ return {
|
|
|
|
+ value: [],
|
|
|
|
+ profitList: [{
|
|
|
|
+ name: "玉米",
|
|
|
|
+ count: 2000,
|
|
|
|
+ }],
|
|
|
|
+ mode:'全部分配',
|
|
|
|
+ moneys:'按重量自动分配',
|
|
|
|
+ dataList:[],
|
|
|
|
+ goodsList:[],
|
|
|
|
+ disabled:false,
|
|
|
|
+ warecontractList:[],
|
|
|
|
+ dateRange: this.disabledDate(),
|
|
|
|
+ feeDetailsDistributions:[{receiptDocDate:'',inWarehouseWeight:0,distributionMoney:0,warehouseName:'',goodsName:'',goodsSource:'',index:0}],
|
|
|
|
+ deptBudgetList:{purpose:"合同费用",type:'粮款'},
|
|
|
|
+ makeWordData: {},
|
|
|
|
+ warehouseList:[],
|
|
|
|
+ contractList:[],
|
|
|
|
+ choosablewareList:[],
|
|
|
|
+ paymentScreenshot:[],
|
|
|
|
+ goodsourcelist:[],
|
|
|
|
+ signingDate:'',
|
|
|
|
+ datelist:[],
|
|
|
|
+ modeList:[{key:1,value:'全部分配'},{key:2,value:'部分分配'},{key:3,value:'暂不分配'}],
|
|
|
|
+ wareList:[{key:1,value:'指定仓库'},{key:2,value:'全部仓库'}],
|
|
|
|
+ datesList:[{key:1,value:'固定日期'},{key:2,value:'指定日期'}],
|
|
|
|
+ moneysList:[{key:1,value:'按重量自动分配'},{key:2,value:'指定分配金额'}],
|
|
|
|
+ goodsList:[{key:1,value:'全部货品'},{key:2,value:'指定货品'}],
|
|
|
|
+
|
|
|
|
+ valueData: [{
|
|
|
|
+ date: 10
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ date: 20
|
|
|
|
+ }
|
|
|
|
+ ], //货值
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ activated() {
|
|
|
|
+ // this.makeWordData = this.getData(2)
|
|
|
|
+ // this.initCharts()
|
|
|
|
+ // this.getPassYearFormatDate()
|
|
|
|
+ this.getList()
|
|
|
|
+ },
|
|
|
|
+ computed: {
|
|
|
|
+ // 计算属性的 getter
|
|
|
|
+ amount: function () {
|
|
|
|
+ // `this` 指向 vm 实例
|
|
|
|
+ var num=0
|
|
|
|
+ for (let i = 0; i < this.feeDetailsDistributions.length; i++) {
|
|
|
|
+ if(this.feeDetailsDistributions[i].distributionMoney){
|
|
|
|
+ num+=Number(this.feeDetailsDistributions[i].distributionMoney)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return num
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ selectwarehouse(e){
|
|
|
|
+ },
|
|
|
|
+ disabledDate() {
|
|
|
|
+ let that = this
|
|
|
|
+ return {
|
|
|
|
+ disabledDate(time) {
|
|
|
|
+ var firstDay = new Date(new Date(that.signingDate).getTime());
|
|
|
|
+ var lastDay = new Date(new Date().getTime());
|
|
|
|
+ lastDay.setFullYear(lastDay.getFullYear() + 1);
|
|
|
|
+ firstDay = that.timeFun(firstDay) //转格式 yyyy-MM-dd
|
|
|
|
+ lastDay = that.timeFun(lastDay) //转格式 yyyy-MM-dd
|
|
|
|
+ return time.getTime() < new Date(firstDay).getTime()
|
|
|
|
+ ||
|
|
|
|
+ time.getTime() > new Date(lastDay).getTime()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ timeFun(unixtimestamp) {
|
|
|
|
+ var unixtimestamp = new Date(unixtimestamp);
|
|
|
|
+ var year = 1900 + unixtimestamp.getYear();
|
|
|
|
+ var month = "0" + (unixtimestamp.getMonth() + 1);
|
|
|
|
+ var date = "0" + unixtimestamp.getDate();
|
|
|
|
+ return year + "-" + month.substring(month.length - 2, month.length) + "-" + date.substring(date.length - 2,date.length)
|
|
|
|
+ },
|
|
|
|
+ selectware(e,item){
|
|
|
|
+ this.datelist=[]
|
|
|
|
+ getwarehousingorder({contractNo:this.deptBudgetList.contractNo,warehouseName:e}).toPromise()
|
|
|
|
+ .then(response => {
|
|
|
|
+ for (let i = 0; i < response.length; i++) {
|
|
|
|
+ this.datelist.push({time:response[i].issuingTime,id:response[i].id,weight:response[i].inWarehouseWeight})
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ selectgoodsSource(e,item){
|
|
|
|
+ var weight=0
|
|
|
|
+ console.log(e)
|
|
|
|
+ var money=0
|
|
|
|
+ if(!this.deptBudgetList.amountMoney&&this.moneys=='按重量自动分配'){
|
|
|
|
+ for (let i = 0; i < this.feeDetailsDistributions.length; i++) {
|
|
|
|
+ if(this.feeDetailsDistributions[i].orderId==e){
|
|
|
|
+ this.feeDetailsDistributions[i].orderId=''
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ this.$message({
|
|
|
|
+ message: '请输入金额之后进行操作',
|
|
|
|
+ type: 'warning',
|
|
|
|
+ })
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ for (let i = 0; i < this.goodsourcelist.length; i++) {
|
|
|
|
+ if(this.goodsourcelist[i].id==e){
|
|
|
|
+ item.goodsSource=this.goodsourcelist[i].goodsSource
|
|
|
|
+ item.inWarehouseWeight=this.goodsourcelist[i].weight
|
|
|
|
+ item.goodsName=this.goodsourcelist[i].goodsName
|
|
|
|
+ item.goodsNameKey=this.goodsourcelist[i].goodsNameKey
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(this.moneys=='按重量自动分配'){
|
|
|
|
+ for (let i = 0; i < this.feeDetailsDistributions.length; i++) {
|
|
|
|
+ weight+=this.feeDetailsDistributions[i].inWarehouseWeight
|
|
|
|
+ }
|
|
|
|
+ for (let i = 0; i < this.feeDetailsDistributions.length; i++) {
|
|
|
|
+ // console.log(weight,this.feeDetailsDistributions[i].inWarehouseWeight)
|
|
|
|
+ if(i=this.feeDetailsDistributions.length-1&&i!=0){
|
|
|
|
+ console.log(i)
|
|
|
|
+ this.feeDetailsDistributions[i].distributionMoney=this.deptBudgetList.amountMoney-money
|
|
|
|
+ }else{
|
|
|
|
+ this.feeDetailsDistributions[i].distributionMoney=Math.round((this.feeDetailsDistributions[i].inWarehouseWeight/weight)*this.deptBudgetList.amountMoney)
|
|
|
|
+ money+=this.feeDetailsDistributions[i].distributionMoney
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ selecttime(e,item){
|
|
|
|
+ var weight=0
|
|
|
|
+ var money=0
|
|
|
|
+ if(!this.deptBudgetList.amountMoney&&this.moneys=='按重量自动分配'){
|
|
|
|
+ for (let i = 0; i < this.feeDetailsDistributions.length; i++) {
|
|
|
|
+ if(this.feeDetailsDistributions[i].receiptDocDate==e){
|
|
|
|
+ this.feeDetailsDistributions[i].receiptDocDate=''
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ this.$message({
|
|
|
|
+ message: '请输入金额之后进行操作',
|
|
|
|
+ type: 'warning',
|
|
|
|
+ })
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ for (let i = 0; i < this.datelist.length; i++) {
|
|
|
|
+ if(this.datelist[i].time==e){
|
|
|
|
+ item.orderId=this.datelist[i].id
|
|
|
|
+ item.inWarehouseWeight=this.datelist[i].weight
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(this.moneys=='按重量自动分配'){
|
|
|
|
+ for (let i = 0; i < this.feeDetailsDistributions.length; i++) {
|
|
|
|
+ weight+=this.feeDetailsDistributions[i].inWarehouseWeight
|
|
|
|
+ }
|
|
|
|
+ for (let i = 0; i < this.feeDetailsDistributions.length; i++) {
|
|
|
|
+ // console.log(weight,this.feeDetailsDistributions[i].inWarehouseWeight)
|
|
|
|
+ if(i=this.feeDetailsDistributions.length-1&&i!=0){
|
|
|
|
+ this.feeDetailsDistributions[i].distributionMoney=this.deptBudgetList.amountMoney-money
|
|
|
|
+ }else{
|
|
|
|
+ this.feeDetailsDistributions[i].distributionMoney=Math.round((this.feeDetailsDistributions[i].inWarehouseWeight/weight)*this.deptBudgetList.amountMoney)
|
|
|
|
+ money+=this.feeDetailsDistributions[i].distributionMoney
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // console.log(this.feeDetailsDistributions)
|
|
|
|
+ },
|
|
|
|
+ receiptDocDatechange(e){
|
|
|
|
+ this.goodsourcelist=[]
|
|
|
|
+ getwarehousingorder({warehouseName:this.deptBudgetList.warehouseName,receiptDocDate:e}).toPromise()
|
|
|
|
+ .then(response => {
|
|
|
|
+ for (let i = 0; i < response.length; i++) {
|
|
|
|
+ this.goodsourcelist.push({goodsSource:response[i].goodsSource,id:response[i].id,weight:response[i].inWarehouseWeight,goodsName:response[i].goodsName,goodsNameKey:response[i].goodsNameKey})
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ selectcontent(e){
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ selectcontract(e){
|
|
|
|
+ console.log(e)
|
|
|
|
+ for (let i = 0; i < this.contractList.length; i++) {
|
|
|
|
+ console.log(this.contractList[i])
|
|
|
|
+ if(this.contractList[i].contractNo==e){
|
|
|
|
+ this.signingDate=this.contractList[i].signingDate
|
|
|
|
+ // this.disabledDate()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ returnsales(){
|
|
|
|
+ this.$router.go(-1)
|
|
|
|
+ },
|
|
|
|
+ handlefujian(file) {
|
|
|
|
+ // console.log(file)
|
|
|
|
+ this.paymentScreenshot.push(file.url)
|
|
|
|
+ // this.dialogVisible = true
|
|
|
|
+ },
|
|
|
|
+ handleRemove(file) {
|
|
|
|
+ // console.log(file)
|
|
|
|
+ for (let i = 0; i < this.paymentScreenshot.length; i++) {
|
|
|
|
+ if(this.paymentScreenshot[i]==response.url){
|
|
|
|
+ this.paymentScreenshot.splice(i, 1)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 获取当前年月日
|
|
|
|
+ getdate() {
|
|
|
|
+ var date = new Date()
|
|
|
|
+ var year = date.getFullYear() //获取完整的年份(4位)
|
|
|
|
+ var mouth = date.getMonth() + 1 //获取当前月份(0-11,0代表1月)
|
|
|
|
+ var datetime = date.getDate() //获取当前日(1-31)
|
|
|
|
+ var hour = date.getHours()
|
|
|
|
+ var minutes = date.getMinutes()
|
|
|
|
+ var seconds = date.getSeconds()
|
|
|
|
+ if (mouth < 10) {
|
|
|
|
+ mouth = '0' + mouth
|
|
|
|
+ }
|
|
|
|
+ if (datetime < 10) {
|
|
|
|
+ datetime = '0' + datetime
|
|
|
|
+ }
|
|
|
|
+ if (hour < 10) {
|
|
|
|
+ hour = '0' + hour
|
|
|
|
+ }
|
|
|
|
+ if (minutes < 10) {
|
|
|
|
+ minutes = '0' + minutes
|
|
|
|
+ }
|
|
|
|
+ if (seconds < 10) {
|
|
|
|
+ seconds = '0' + seconds
|
|
|
|
+ }
|
|
|
|
+ return year + '' + mouth + datetime + hour + minutes + seconds
|
|
|
|
+ },
|
|
|
|
+ MathRand() {
|
|
|
|
+ var Num = ''
|
|
|
|
+ for (var i = 0; i < 4; i++) {
|
|
|
|
+ Num += Math.floor(Math.random() * 10)
|
|
|
|
+ }
|
|
|
|
+ return Num
|
|
|
|
+ },
|
|
|
|
+ submit(){
|
|
|
|
+ this.deptBudgetList.compId=localStorage.getItem('ws-pf_compId')
|
|
|
|
+ this.deptBudgetList.agent=localStorage.getItem('ws-pf_staffName')
|
|
|
|
+ if(this.deptBudgetList.purpose=='合同费用'&&this.deptBudgetList.type=='非粮款'||this.deptBudgetList.purpose=='库点费用'){
|
|
|
|
+ for (let i = 0; i < this.feeDetailsDistributions.length; i++) {
|
|
|
|
+ if(!this.feeDetailsDistributions[i].distributionMoney){
|
|
|
|
+ this.$message({
|
|
|
|
+ message: '分配金额不能为空!',
|
|
|
|
+ type: 'warning',
|
|
|
|
+ })
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ if(this.feeDetailsDistributions[i].distributionMoney<0){
|
|
|
|
+ this.$message({
|
|
|
|
+ message: '分配金额应大于0!',
|
|
|
|
+ type: 'warning',
|
|
|
|
+ })
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ if((String(this.feeDetailsDistributions[i].distributionMoney).indexOf('.') != -1 &&
|
|
|
|
+ String(this.feeDetailsDistributions[i].distributionMoney).length -
|
|
|
|
+ (String(this.feeDetailsDistributions[i].distributionMoney).indexOf('.') + 1) >
|
|
|
|
+ 2)){
|
|
|
|
+ this.$message({
|
|
|
|
+ message: '分配金额最多保留两位小数!',
|
|
|
|
+ type: 'warning',
|
|
|
|
+ })
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ this.deptBudgetList.totalDistribution=this.amount
|
|
|
|
+ if(this.deptBudgetList.purpose=='合同费用'){
|
|
|
|
+ this.deptBudgetList.expensesPurpose=1
|
|
|
|
+ this.deptBudgetList.costNo='HTF'+this.getdate()+this.MathRand()
|
|
|
|
+ }else if(this.deptBudgetList.purpose=='库点费用'){
|
|
|
|
+ this.deptBudgetList.expensesPurpose=3
|
|
|
|
+ this.deptBudgetList.expenseAllocationInfoList=this.feeDetailsDistributions
|
|
|
|
+ this.deptBudgetList.costNo='KDF'+this.getdate()+this.MathRand()
|
|
|
|
+ }else if(this.deptBudgetList.purpose=='经营性费用'){
|
|
|
|
+ this.deptBudgetList.expensesPurpose=5
|
|
|
|
+ this.deptBudgetList.costNo='JYF'+this.getdate()+this.MathRand()
|
|
|
|
+ }
|
|
|
|
+ if(this.deptBudgetList.expensesPurpose==1){
|
|
|
|
+ if(this.deptBudgetList.type=='粮款'){
|
|
|
|
+ this.deptBudgetList.costType=1
|
|
|
|
+ this.deptBudgetList.expenseAllocationInfoList=[]
|
|
|
|
+ }else if(this.deptBudgetList.type=='非粮款'){
|
|
|
|
+ this.deptBudgetList.costType=3
|
|
|
|
+ this.deptBudgetList.expenseAllocationInfoList=this.feeDetailsDistributions
|
|
|
|
+ }else if(this.deptBudgetList.type=='保证金'){
|
|
|
|
+ this.deptBudgetList.expensesPurpose=5
|
|
|
|
+ this.deptBudgetList.expenseAllocationInfoList=[]
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(this.deptBudgetList.expensesPurpose==1){
|
|
|
|
+ var data=[]
|
|
|
|
+ for (let i = 0; i < this.feeDetailsDistributions.length; i++) {
|
|
|
|
+ if(data.length==0){
|
|
|
|
+ data.push(this.feeDetailsDistributions[i])
|
|
|
|
+ }else{
|
|
|
|
+ var repetition=data.filter((item,index)=>{
|
|
|
|
+ return this.feeDetailsDistributions[i].orderId==item.orderId&&this.feeDetailsDistributions[i].receiptDocDate==item.receiptDocDate
|
|
|
|
+ })
|
|
|
|
+ if(repetition.length==0){
|
|
|
|
+ data.push(this.feeDetailsDistributions[i])
|
|
|
|
+ }else{
|
|
|
|
+ this.$message({
|
|
|
|
+ message: '货源重复!',
|
|
|
|
+ type: 'warning',
|
|
|
|
+ })
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ // for (let q = 0; q < data.length; q++) {
|
|
|
|
+ // if(data[q].warehouseName==this.feeDetailsDistributions[i].warehouseName&&this.feeDetailsDistributions[i].receiptDocDate==data[q].receiptDocDate){
|
|
|
|
+ // this.$message({
|
|
|
|
+ // message: '请不要选择一样的入库单!',
|
|
|
|
+ // type: 'warning',
|
|
|
|
+ // })
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(this.deptBudgetList.expensesPurpose==3){
|
|
|
|
+ var data=[]
|
|
|
|
+ for (let i = 0; i < this.feeDetailsDistributions.length; i++) {
|
|
|
|
+ if(data.length==0){
|
|
|
|
+ data.push(this.feeDetailsDistributions[i])
|
|
|
|
+ }else{
|
|
|
|
+ var repetition=data.filter((item,index)=>{
|
|
|
|
+ return this.feeDetailsDistributions[i].warehouseName==item.warehouseName&&this.feeDetailsDistributions[i].receiptDocDate==item.receiptDocDate
|
|
|
|
+ })
|
|
|
|
+ if(repetition.length==0){
|
|
|
|
+ data.push(this.feeDetailsDistributions[i])
|
|
|
|
+ }else{
|
|
|
|
+ this.$message({
|
|
|
|
+ message: '货源重复!',
|
|
|
|
+ type: 'warning',
|
|
|
|
+ })
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ // for (let q = 0; q < data.length; q++) {
|
|
|
|
+ // if(data[q].warehouseName==this.feeDetailsDistributions[i].warehouseName&&this.feeDetailsDistributions[i].receiptDocDate==data[q].receiptDocDate){
|
|
|
|
+ // this.$message({
|
|
|
|
+ // message: '请不要选择一样的入库单!',
|
|
|
|
+ // type: 'warning',
|
|
|
|
+ // })
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ this.deptBudgetList.expensesType=2
|
|
|
|
+ if(!this.deptBudgetList.contractNo&&this.deptBudgetList.expensesPurpose==1){
|
|
|
|
+ this.$message({
|
|
|
|
+ message: '合同编号不能为空!',
|
|
|
|
+ type: 'warning',
|
|
|
|
+ })
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ if(!this.deptBudgetList.warehouse&&this.deptBudgetList.expensesPurpose==3){
|
|
|
|
+ this.$message({
|
|
|
|
+ message: '仓库名称不能为空!',
|
|
|
|
+ type: 'warning',
|
|
|
|
+ })
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(this.deptBudgetList.expensesPurpose==1&&this.deptBudgetList.costType==3&&this.mode=='全部分配'||this.deptBudgetList.expensesPurpose==3&&this.mode=='全部分配'){
|
|
|
|
+ if(this.amount!=this.deptBudgetList.amountMoney){
|
|
|
|
+ this.$message({
|
|
|
|
+ message: '请款金额与分配金额不相等!',
|
|
|
|
+ type: 'warning',
|
|
|
|
+ })
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(this.deptBudgetList.expensesPurpose==1&&this.deptBudgetList.costType==3&&this.mode=='部分分配'||this.deptBudgetList.expensesPurpose==3&&this.mode=='部分分配'){
|
|
|
|
+ if(this.amount>this.deptBudgetList.amountMoney){
|
|
|
|
+ this.$message({
|
|
|
|
+ message: '分配金额不可超过请款金额!',
|
|
|
|
+ type: 'warning',
|
|
|
|
+ })
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(!this.deptBudgetList.expenseName){
|
|
|
|
+ this.$message({
|
|
|
|
+ message: '费用名称不能为空!',
|
|
|
|
+ type: 'warning',
|
|
|
|
+ })
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ if(this.deptBudgetList.expenseName.length<1||this.deptBudgetList.expenseName.length>15){
|
|
|
|
+ this.$message({
|
|
|
|
+ message: '费用名称输入错误!',
|
|
|
|
+ type: 'warning',
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ if(!this.deptBudgetList.amountMoney){
|
|
|
|
+ this.$message({
|
|
|
|
+ message: '金额不能为空!',
|
|
|
|
+ type: 'warning',
|
|
|
|
+ })
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ if(this.deptBudgetList.amountMoney<0.01||this.deptBudgetList.amountMoney>100000000){
|
|
|
|
+ this.$message({
|
|
|
|
+ message: '金额输入错误!',
|
|
|
|
+ type: 'warning',
|
|
|
|
+ })
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ this.deptBudgetList.addressUrl=this.paymentScreenshot.toString()
|
|
|
|
+ this.$confirm('确定提交请款信息', '提示', {
|
|
|
|
+ confirmButtonText: '确定',
|
|
|
|
+ cancelButtonText: '取消',
|
|
|
|
+ type: 'warning'
|
|
|
|
+ })
|
|
|
|
+ .then(() => {
|
|
|
|
+ addexenseinfo(this.deptBudgetList).toPromise()
|
|
|
|
+ .then(response => {
|
|
|
|
+ this.$message({
|
|
|
|
+ message: '提交成功!',
|
|
|
|
+ type: 'success',
|
|
|
|
+ })
|
|
|
|
+ this.$router.go(-1)
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ modeselect(e){
|
|
|
|
+ if(e=='全部分配'){
|
|
|
|
+ this.moneys='按重量自动分配'
|
|
|
|
+ this.disabled=false
|
|
|
|
+ }else if(e=='部分分配'){
|
|
|
|
+ this.moneys='指定分配金额'
|
|
|
|
+ this.disabled=true
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ goodsNameselect(e){
|
|
|
|
+ console.log(e)
|
|
|
|
+ },
|
|
|
|
+ addlist(){
|
|
|
|
+ this.feeDetailsDistributions.push({proDate:'',weight:'',money:'',warehouse:'',belonging:'',index:this.feeDetailsDistributions.length})
|
|
|
|
+ },
|
|
|
|
+ dellist(row){
|
|
|
|
+ if(this.feeDetailsDistributions.length>1){
|
|
|
|
+ this.feeDetailsDistributions.splice(row.index,1)
|
|
|
|
+ }else{
|
|
|
|
+ this.$message({
|
|
|
|
+ message: '至少保留一条!',
|
|
|
|
+ type: 'warning',
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ getList() {
|
|
|
|
+ getcontract({
|
|
|
|
+ compId:localStorage.getItem('ws-pf_compId'),
|
|
|
|
+ })
|
|
|
|
+ .toPromise()
|
|
|
|
+ .then((response) => {
|
|
|
|
+ this.contractList=response
|
|
|
|
+ })
|
|
|
|
+ getwarehouse({
|
|
|
|
+ compId:localStorage.getItem('ws-pf_compId'),
|
|
|
|
+ warehouseType:1
|
|
|
|
+ })
|
|
|
|
+ .toPromise()
|
|
|
|
+ .then((response) => {
|
|
|
|
+ this.warehouseList=response
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ detail(){
|
|
|
|
+ this.$router.push({name:'contractprofitsdetails'})
|
|
|
|
+ },
|
|
|
|
+ pickerOptions() {
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ }
|
|
|
|
+</script>
|
|
|
|
+<style lang="scss" scoped>
|
|
|
|
+ .container {
|
|
|
|
+ background: #E8ECF6;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .center {
|
|
|
|
+ margin: 0 auto;
|
|
|
|
+ background: #ffffff;
|
|
|
|
+ height: calc(100vh - 13vh);
|
|
|
|
+ border-radius: 4px;
|
|
|
|
+ margin-top: 10px;
|
|
|
|
+ overflow:scroll;
|
|
|
|
+ }
|
|
|
|
+ .expensetitle{
|
|
|
|
+ margin:0 auto 10px;width:90%;border-top:1px solid #D8DCE6;padding-top:30px;
|
|
|
|
+ }
|
|
|
|
+ /deep/.input50>.el-input__inner{
|
|
|
|
+ width:50%;
|
|
|
|
+ }
|
|
|
|
+ /deep/.typeselect.el-select{
|
|
|
|
+ width:50%;
|
|
|
|
+ }
|
|
|
|
+ .row_top {
|
|
|
|
+ // background: #F6F7FC;
|
|
|
|
+ border-radius: 4px;
|
|
|
|
+
|
|
|
|
+ .bg-left {
|
|
|
|
+ padding-left: 30px;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .bg-right {
|
|
|
|
+ padding-right: 10px;
|
|
|
|
+ text-align: right;
|
|
|
|
+ height:60px;
|
|
|
|
+ padding-top:15px;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .title {
|
|
|
|
+ position: relative;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .title::before {
|
|
|
|
+ content: '';
|
|
|
|
+ display: inline-block;
|
|
|
|
+ width: 5px;
|
|
|
|
+ height: 30px;
|
|
|
|
+ background: #5473e8;
|
|
|
|
+ position: absolute;
|
|
|
|
+ left: 0;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .datascreen {
|
|
|
|
+ // margin-top: 10px;
|
|
|
|
+ width: 500px;
|
|
|
|
+ height: 60px;
|
|
|
|
+ line-height: 60px;
|
|
|
|
+ margin-left: 30px;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .chart_css {
|
|
|
|
+ display: flex;
|
|
|
|
+ height: 410px;
|
|
|
|
+
|
|
|
|
+ .table {
|
|
|
|
+ width: 70%;
|
|
|
|
+ height: 410px;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .makeWord_css {
|
|
|
|
+ width: 30%;
|
|
|
|
+ height: 410px;
|
|
|
|
+ margin-left: 30px;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .table_css {
|
|
|
|
+
|
|
|
|
+ text-align:center;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ /deep/.el-form{
|
|
|
|
+ width:90%;
|
|
|
|
+ margin:0 auto;
|
|
|
|
+ .el-form-item__label{
|
|
|
|
+ color:#8890B1;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /deep/.el-form-item {
|
|
|
|
+ width: 50%;
|
|
|
|
+}
|
|
|
|
+.add,.del{
|
|
|
|
+ width:25px;height:25px;
|
|
|
|
+}
|
|
|
|
+</style>
|