liupopo 2 years ago
parent
commit
6b95d2c5f6
  1. 170
      supervise-customer-ui/src/views/daydataupload/cash/cashedit.vue

170
supervise-customer-ui/src/views/daydataupload/cash/cashedit.vue

@ -34,7 +34,7 @@
<el-table-column label="财务到账金额" align="center" width="120" prop="inaccountAmount" />
<el-table-column label="到账差额" align="center" width="120" prop="differentAmount" />
<el-table-column label="差额预计到账时间" align="center" width="150" prop="antipateDifferentDate" />
<el-table-column label="备注" prop="remarks" />
<el-table-column label="备注" show-overflow-tooltip prop="remarks" />
</el-table>
</el-collapse-item>
</el-collapse>
@ -45,7 +45,10 @@
<div>
<span style="padding-right: 20px">合计数量:{{ incomelist.length }}</span>
<span style="padding-right: 20px">合计金额:{{ sumIncomeAmount }}</span>
<span style="padding-right: 20px"> <el-button plain size="small" type="primary" icon="el-icon-plus" @click="showIncomeAdd">填写回款记录</el-button></span>
<span style="padding-right: 20px">
<el-button plain size="small" type="primary" icon="el-icon-plus" @click="showIncomeAdd">填写回款记录</el-button>
<el-button plain size="small" type="danger" icon="el-icon-circle-check" @click="incomeListSave">保存回款记录</el-button>
</span>
</div>
</div>
<el-table :data="incomelist" border style="width: 100%">
@ -54,7 +57,13 @@
<el-table-column label="回款渠道" align="center" width="140" prop="collectionChannelName" />
<el-table-column label="回款金额(元)" align="center" width="140" prop="amount" />
<el-table-column label="销售日期" align="center" width="120" prop="saleDate" />
<el-table-column label="备注" prop="remarks" />
<el-table-column label="备注" show-overflow-tooltip prop="remarks" />
<el-table-column fixed="right" width="180" label="操作" align="center">
<template slot-scope="scope">
<el-button type="success" size="mini" icon="el-icon-edit" @click="toEdit(scope.row)">修改</el-button>
<el-button type="warning" size="mini" icon="el-icon-delete" @click="toDele(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
</el-collapse-item>
</el-collapse>
@ -80,7 +89,7 @@
<el-table-column label="回款金额" align="center" width="150" prop="cashedAmount" />
<el-table-column label="回款差额" align="center" width="150" prop="differentAmount" />
<el-table-column label="差额预计到账日期" align="center" width="150" prop="antipateDifferentDate" />
<el-table-column label="备注" align="center" width="150" prop="remarks" />
<el-table-column label="备注" show-overflow-tooltip align="center" width="150" prop="remarks" />
</el-table>
</el-collapse-item>
</el-collapse>
@ -95,7 +104,7 @@
<span>回款日期</span>
</el-col>
<el-col :span="18" class="trightb">
<el-form-item> <el-date-picker v-model="incomeObj.dataDate" type="date" placeholder="选择日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd" /></el-form-item>
<el-form-item prop="dataDate"> <el-date-picker v-model="incomeObj.dataDate" type="date" placeholder="选择日期" value-format="yyyy-MM-dd" /></el-form-item>
</el-col>
</el-row>
<el-row>
@ -103,7 +112,7 @@
<span>回款渠道</span>
</el-col>
<el-col :span="18" class="trightb">
<el-form-item> <el-select v-model="incomeObj.collectionChannelSid" placeholder="请选择">
<el-form-item prop="collectionChannelSid"> <el-select v-model="incomeObj.collectionChannelSid" placeholder="请选择">
<el-option v-for="item in collectionChannelList" :key="item.sid" :label="item.name" :value="item.sid" />
</el-select></el-form-item>
</el-col>
@ -113,7 +122,13 @@
<span>回款金额</span>
</el-col>
<el-col :span="18" class="trightb">
<el-form-item><el-input v-model="incomeObj.amount" placeholder="" class="addinputw" clearable /></el-form-item>
<el-form-item prop="amount"><el-input
v-model="incomeObj.amount"
oninput="value=value.replace(/[^0-9.]/g,'')"
placeholder=""
class="addinputw"
clearable
/></el-form-item>
</el-col>
</el-row>
<el-row>
@ -121,7 +136,7 @@
<span>销售日期</span>
</el-col>
<el-col :span="18" class="trightb">
<el-form-item> <el-date-picker v-model="incomeObj.saleDate" type="date" placeholder="选择日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd" /></el-form-item>
<el-form-item prop="saleDate"> <el-date-picker v-model="incomeObj.saleDate" type="date" placeholder="选择日期" value-format="yyyy-MM-dd" /></el-form-item>
</el-col>
</el-row>
<el-row>
@ -143,11 +158,30 @@
<script>
import req from '@/api/customer/csmcash'
import { formatTime } from '@/utils/index'
import {
parseTime
} from '@/utils/index'
export default {
components: {},
data() {
var checkIsNumberAge = (rule, value, callback) => {
if (!value) { // 使text
callback(new Error(rule.text ? rule.text : '请输入'))
} else {
// const reg = /^[0-9]*$/
const reg = /^[+-]?\d+(?:\.\d{1,4})?$/
if (reg.test(value) && value >= 0) {
callback()
} else {
if (!String(value).indexOf('.') + 1) {
callback(new Error('请输入数字!'))
} else {
callback(new Error('仅支持小数点后4位!'))
}
}
}
}
return {
collectionChannelList: [{
sid: '1',
@ -191,29 +225,51 @@ import { formatTime } from '@/utils/index'
incomelist: [],
differentlist: [],
incomeObj: {
dataDate: formatTime(new Date(), '{y}-{m}-{d}'), //
dataDate: parseTime(new Date(), '{y}-{m}-{d}'), //
collectionChannelSid: '1', //
collectionChannelName: '', //
amount: '', //
saleDate: new Date(), //
saleDate: parseTime(new Date(), '{y}-{m}-{d}'), //
remarks: '', //
logsid: ''
logsid: '',
serialNumber: 0
},
rules: {}
incomeCurrent: null,
rules: {
dataDate: [{
required: true,
message: '请选择回款日期',
trigger: 'blur'
}],
collectionChannelSid: [{
required: true,
message: '请选择回款渠道',
trigger: 'blur'
}],
amount: [{
validator: checkIsNumberAge,
trigger: 'blur'
}],
saleDate: [{
required: true,
message: '请选择销售日期',
trigger: 'blur'
}]
}
}
},
computed: {
sumSalesAmount() {
let p = 0
this.saleslist.forEach(x => {
p += x.amount
p += Number(x.amount)
})
return Number(p).toFixed(2)
},
sumIncomeAmount() {
let p = 0
this.incomelist.forEach(x => {
p += x.amount
p += Number(x.amount)
})
return Number(p).toFixed(2)
}
@ -257,41 +313,83 @@ import { formatTime } from '@/utils/index'
showIncomeAdd() {
this.dialogVisible = true
},
incomeListSave() {
req.incomeListSave(this.incomelist)
.then(resp => {
this.differentlist = resp.data
})
.catch(e => {
console.log('loadListDifferent -- error: ', e)
})
},
incomeClose() {
this.incomeObj.dataDate = new Date() //
this.incomeObj.dataDate = parseTime(new Date(), '{y}-{m}-{d}') //
this.incomeObj.collectionChannelSid = '1' //
this.incomeObj.collectionChannelName = '' //
this.incomeObj.amount = '' //
this.incomeObj.saleDate = new Date() //
this.incomeObj.saleDate = parseTime(new Date(), '{y}-{m}-{d}') //
this.incomeObj.remarks = '' //
this.incomeObj.logsid = ''
this.incomeObj.serialNumber = 0
this.$refs['form_income'].resetFields()
this.dialogVisible = false
},
incomeListAdd() {
const income = {
dataDate: this.incomeObj.dataDate, //
collectionChannelSid: this.incomeObj.collectionChannelSid, //
collectionChannelName: '', //
amount: this.incomeObj.amount, //
saleDate: this.incomeObj.saleDate, //
remarks: this.incomeObj.remarks, //
logsid: this.formobj.sid
}
this.$refs['form_income'].validate((valid) => {
if (valid) {
for (var v in this.collectionChannelList) {
if (this.collectionChannelList[v].sid === this.incomeObj.collectionChannelSid) {
this.incomeObj.collectionChannelName = this.collectionChannelList[v].name
break
}
}
for (const v in this.collectionChannelList) {
if (this.collectionChannelList[v].sid === income.collectionChannelSid) {
income.collectionChannelName = this.collectionChannelList[v].name
break
if (this.incomeObj.serialNumber === 0) {
const income = {
dataDate: this.incomeObj.dataDate, //
collectionChannelSid: this.incomeObj.collectionChannelSid, //
collectionChannelName: this.incomeObj.collectionChannelName, //
amount: this.incomeObj.amount, //
saleDate: this.incomeObj.saleDate, //
remarks: this.incomeObj.remarks, //
serialNumber: this.incomelist.length + 1,
logsid: this.formobj.sid
}
this.incomelist.push(income)
} else {
const i = this.incomeObj.serialNumber - 1
this.incomelist[i].dataDate = this.incomeObj.dataDate //
this.incomelist[i].collectionChannelSid = this.incomeObj.collectionChannelSid //
this.incomelist[i].collectionChannelName = this.incomeObj.collectionChannelName //
this.incomelist[i].amount = this.incomeObj.amount //
this.incomelist[i].saleDate = this.incomeObj.saleDate //
this.incomelist[i].remarks = this.incomeObj.remarks //
}
console.log('incomelist: ', this.incomelist)
this.incomeClose()
} else {
console.log('error submit!!')
return false
}
}
this.incomelist.push(income)
})
},
toEdit(row) {
this.incomeObj.dataDate = row.dataDate
this.incomeObj.collectionChannelSid = row.collectionChannelSid
this.incomeObj.collectionChannelName = row.collectionChannelName
this.incomeObj.amount = row.amount
this.incomeObj.saleDate = row.saleDate
this.incomeObj.remarks = row.remarks
this.incomeObj.logsid = row.logsid
this.incomeObj.serialNumber = row.serialNumber
for (const v in this.incomelist) {
this.dialogVisible = true
},
toDele(row) {
this.incomelist = this.incomelist.filter(t => t.serialNumber !== row.serialNumber)
for (var v in this.incomelist) {
this.incomelist[v].serialNumber = Number(v) + 1
}
console.log('incomelist: ', this.incomelist)
this.incomeClose()
},
formatNum(e) {
e.target.value = e.target.value.replace(/[^\d.]/g, '') // ."-"

Loading…
Cancel
Save