| | |
| | | <div>{{ editConfig.infomation.amountTotal }}</div> |
| | | </div> |
| | | <div class="collection-view"> |
| | | <div class="label">收款计划负责人</div> |
| | | <div class="label"><span style="color: #f56c6c">*</span>收款计划负责人</div> |
| | | <el-select |
| | | v-model="editConfig.infomation.principalId" |
| | | placeholder="请选择" |
| | |
| | | :data="tableData.tableInfomation" |
| | | tooltip-effect="dark" |
| | | style="width: 100%" |
| | | max-height="375" |
| | | :header-cell-style="{ background: '#ECF4FF', color: '#666' }" |
| | | > |
| | | <el-table-column |
| | |
| | | style="width: 100%; margin-right: 5px" |
| | | @change=" |
| | | (val) => { |
| | | commonInputChange(val, item.prop, scope.row) |
| | | commonInputChange(val, item.prop, scope) |
| | | } |
| | | " |
| | | ></el-input-number> |
| | |
| | | " |
| | | ></el-input> |
| | | <div v-else-if="item.date"> |
| | | <el-date-picker v-model="scope.row[item.prop]" type="date" size="mini" style="width: 130px"> |
| | | <el-date-picker |
| | | v-model="scope.row[item.prop]" |
| | | type="date" |
| | | value-format="yyyy-MM-dd" |
| | | size="mini" |
| | | style="width: 130px" |
| | | > |
| | | </el-date-picker> |
| | | </div> |
| | | <div v-else @click="delClick(scope.row)"><i class="el-icon-delete"></i></div> |
| | |
| | | <el-option label="1" :value="1"></el-option> |
| | | <el-option label="2" :value="2"></el-option> |
| | | <el-option label="3" :value="3"></el-option> |
| | | <el-option label="5" :value="5"></el-option> |
| | | <el-option label="8" :value="8"></el-option> |
| | | <el-option label="10" :value="10"></el-option> |
| | | </el-select> |
| | | <span> 期, </span> |
| | | </div> |
| | |
| | | </div> |
| | | <div class="btn-view"> |
| | | <el-button type="primary" size="small" @click="saveClick">保存</el-button> |
| | | <el-button size="small" @click="editConfig.visible = false">取消</el-button> |
| | | <el-button size="small" @click="droppedClick">取消</el-button> |
| | | </div> |
| | | </div> |
| | | </el-dialog> |
| | |
| | | amount: 130, |
| | | sourceType: this.editCommonConfig.sourceType, // 源单类型 1销售明细2服务合同3销售发票 |
| | | sourceId: this.editCommonConfig.infomation.id, |
| | | principalId: 0, |
| | | principalId: this.getCookie('username')||0, |
| | | planAmount: 0, // 计划金额 |
| | | firstDate: this.getCurrentDate(1), |
| | | collectionType: 1, |
| | | tableInfomation: [] |
| | | tableInfomation: [], |
| | | allPercent: 0 |
| | | } |
| | | }, |
| | | created() { |
| | |
| | | this.getCommonData() |
| | | }, |
| | | methods: { |
| | | getCookie(cookieName) { |
| | | var cookieValue = null; |
| | | if (document.cookie && document.cookie !== '') { |
| | | var cookies = document.cookie.split(';'); |
| | | for (var i = 0; i < cookies.length; i++) { |
| | | var cookie = cookies[i].trim(); |
| | | // 忽略不完整的cookie |
| | | if (cookie.startsWith(cookieName + '=')) { |
| | | cookieValue = cookie.substring(cookieName.length + 1, cookie.length); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | return cookieValue; |
| | | }, |
| | | // 设置初始值 |
| | | setData() { |
| | | this.amount = |
| | |
| | | this.editConfig.infomation = { |
| | | collectionType: this.collectionType, |
| | | moneyType: "人民币", |
| | | amountTotal: this.editCommonConfig.infomation.amountTotal |
| | | amountTotal: this.editCommonConfig.infomation.amountTotal, |
| | | principalId:this.getCookie('username') |
| | | } |
| | | }, |
| | | getCommonData() { |
| | |
| | | // 保存 |
| | | saveClick() { |
| | | this.sumTotalAmount() |
| | | console.log(this.amount) |
| | | if (this.editConfig.title === "新建") { |
| | | if (this.principalId === 0) { |
| | | this.$message.error("请选择收款计划负责人") |
| | | } else if (this.amount === 0) { |
| | | this.$message.error("收款金额不能为0") |
| | | } else if (this.amount !== this.planAmount) { |
| | | this.$message.error("收款计划和未计划金额不一致,请重算") |
| | | } else if (this.allPercent > 100) { |
| | | this.$message.error("收款比例(%)总和大于100,请重新输入") |
| | | } else { |
| | | const params = this.saveParams() |
| | | addCollectionPlan(params).then((res) => { |
| | |
| | | }) |
| | | } |
| | | } |
| | | }, |
| | | droppedClick() { |
| | | this.editConfig.visible = false |
| | | this.$parent.getData() |
| | | }, |
| | | // 计算计划总额 |
| | | sumTotalAmount() { |
| | |
| | | }, |
| | | handleClose() { |
| | | this.editConfig.visible = false |
| | | this.$parent.getData() |
| | | }, |
| | | setTableForm() { |
| | | this.setTableInfomation(this.firstDate) |
| | | this.setTableInfomation(this.allTerms, this.firstDate) |
| | | this.tableData = { |
| | | tableInfomation: this.tableInfomation, |
| | | tableColumn: [ |
| | |
| | | ] |
| | | } |
| | | }, |
| | | setTableInfomation(date) { |
| | | console.log(this.sourceId) |
| | | this.tableInfomation = [ |
| | | { |
| | | amount: this.amount, |
| | | amountReceivable: this.amount * 0.3, |
| | | amountReceived: 0, |
| | | amountTotal: this.amount, |
| | | collectionDate: this.setDate(date, 0), |
| | | collectionType: this.editConfig.infomation.collectionType, |
| | | fileId: 0, |
| | | id: 0, |
| | | moneyType: "人民币", |
| | | percent: 30, |
| | | principalId: this.principalId, |
| | | remark: "", |
| | | sourceId: this.sourceId, |
| | | sourceType: this.sourceType, |
| | | status: 1, |
| | | term: 1 |
| | | }, |
| | | { |
| | | amount: this.amount, |
| | | amountReceivable: this.amount * 0.5, |
| | | amountReceived: 0, |
| | | amountTotal: this.amount, |
| | | collectionDate: this.setDate(date, 1), |
| | | collectionType: this.editConfig.infomation.collectionType, |
| | | fileId: 0, |
| | | id: 0, |
| | | moneyType: "人民币", |
| | | percent: 50, |
| | | principalId: this.principalId, |
| | | remark: "", |
| | | sourceId: this.sourceId, |
| | | sourceType: this.sourceType, |
| | | status: 1, |
| | | term: 2 |
| | | }, |
| | | { |
| | | amount: this.amount, |
| | | amountReceivable: this.amount * 0.2, |
| | | amountReceived: 0, |
| | | amountTotal: this.amount, |
| | | collectionDate: this.setDate(date, 2), |
| | | collectionType: this.editConfig.infomation.collectionType, |
| | | fileId: 0, |
| | | id: 0, |
| | | moneyType: "人民币", |
| | | percent: 20, |
| | | principalId: this.principalId, |
| | | remark: "", |
| | | sourceId: this.sourceId, |
| | | sourceType: this.sourceType, |
| | | status: 1, |
| | | term: 3 |
| | | // 收款计划列表内容计算 |
| | | setTableInfomation(allTerms, date) { |
| | | let arr = [] |
| | | for (let i = 0; i < allTerms; i++) { |
| | | let ratio = 1 |
| | | if (allTerms == 3) { |
| | | ratio = i == 0 ? 30 : i == 1 ? 50 : 20 |
| | | } else { |
| | | ratio = 100 / allTerms |
| | | } |
| | | ] |
| | | let data = { |
| | | amount: this.amount, |
| | | amountReceivable: (this.amount * ratio) / 100, |
| | | amountReceived: 0, |
| | | amountTotal: this.amount, |
| | | collectionDate: this.setDate(date, i), |
| | | collectionType: this.editConfig.infomation.collectionType, |
| | | fileId: 0, |
| | | id: 0, |
| | | moneyType: "人民币", |
| | | percent: ratio, |
| | | principalId: this.principalId, |
| | | remark: "", |
| | | sourceId: this.sourceId, |
| | | sourceType: this.sourceType, |
| | | status: 1, |
| | | term: i + 1 |
| | | } |
| | | arr.push(data) |
| | | } |
| | | this.tableInfomation = [...arr] |
| | | }, |
| | | // 重算 |
| | | recalculateClick() { |
| | | console.log(this.allTerms) |
| | | this.tableData.tableInfomation = [] |
| | | if (this.allTerms === 1) { |
| | | console.log("aaa") |
| | | this.tableData.tableInfomation = [ |
| | | { |
| | | amount: this.amount, |
| | | amountReceivable: this.amount, |
| | | amountReceived: 0, |
| | | amountTotal: this.amount, |
| | | collectionDate: this.setDate(this.firstDate, 0), |
| | | collectionType: this.editConfig.infomation.collectionType, |
| | | fileId: 0, |
| | | id: 0, |
| | | moneyType: "人民币", |
| | | percent: 100, |
| | | principalId: this.principalId, |
| | | remark: "", |
| | | sourceId: this.sourceId, |
| | | sourceType: this.sourceType, |
| | | status: 1, |
| | | term: 1 |
| | | } |
| | | ] |
| | | } else if (this.allTerms === 2) { |
| | | this.tableData.tableInfomation = [ |
| | | { |
| | | amount: this.amount, |
| | | amountReceivable: this.amount * 0.5, |
| | | amountReceived: 0, |
| | | amountTotal: this.amount, |
| | | collectionDate: this.setDate(this.firstDate, 0), |
| | | collectionType: this.editConfig.infomation.collectionType, |
| | | fileId: 0, |
| | | id: 0, |
| | | moneyType: "人民币", |
| | | percent: 50, |
| | | principalId: this.principalId, |
| | | remark: "", |
| | | sourceId: this.sourceId, |
| | | sourceType: this.sourceType, |
| | | status: 1, |
| | | term: 1 |
| | | }, |
| | | { |
| | | amount: this.amount, |
| | | amountReceivable: this.amount * 0.5, |
| | | amountReceived: 0, |
| | | amountTotal: this.amount, |
| | | collectionDate: this.setDate(this.firstDate, 1), |
| | | collectionType: this.editConfig.infomation.collectionType, |
| | | fileId: 0, |
| | | id: 0, |
| | | moneyType: "人民币", |
| | | percent: 50, |
| | | principalId: this.principalId, |
| | | remark: "", |
| | | sourceId: this.sourceId, |
| | | sourceType: this.sourceType, |
| | | status: 1, |
| | | term: 2 |
| | | } |
| | | ] |
| | | } else if (this.allTerms === 3) { |
| | | this.setTableInfomation(this.firstDate) |
| | | this.tableData.tableInfomation = this.tableInfomation |
| | | } |
| | | this.setTableInfomation(this.allTerms, this.firstDate) |
| | | this.tableData.tableInfomation = this.tableInfomation |
| | | }, |
| | | delClick(row) { |
| | | console.log(row) |
| | |
| | | commonInputChange(val, prop, row) { |
| | | console.log(val, prop) |
| | | console.log(row) |
| | | const array = this.tableData.tableInfomation |
| | | array.map((item) => { |
| | | this.allPercent += item.percent |
| | | }) |
| | | console.log(this.allPercent) |
| | | }, |
| | | // 获取当前日期 |
| | | getCurrentDate(monthNumber) { |
| | |
| | | }, |
| | | // 日期处理 |
| | | setDate(str, monthNumber) { |
| | | console.log(str) |
| | | console.log(str.split("-")) |
| | | let dateArr = str.split("-") |
| | | let year = parseInt(dateArr[0]) |
| | | let month = parseInt(dateArr[1]) + monthNumber |
| | | // 月份和 |
| | | let monthCount = parseInt(dateArr[1]) + monthNumber |
| | | // 年 |
| | | let year = monthCount > 12 ? parseInt(dateArr[0]) + 1 : parseInt(dateArr[0]) |
| | | // 月 |
| | | let month = monthCount > 12 ? monthCount - 12 : monthCount |
| | | // 日 |
| | | let day = parseInt(dateArr[2]) |
| | | |
| | | return year + "-" + month + "-" + day |
| | | }, |
| | | principalClick(val) { |
| | | this.principalId = val |
| | | this.setTableInfomation(this.firstDate) |
| | | this.setTableInfomation(this.allTerms, this.firstDate) |
| | | this.tableData.tableInfomation = this.tableInfomation |
| | | } |
| | | } |