123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506 |
- <template>
- <div class="app-container">
- <el-row class="title-style">
- <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()">返回</el-button>
- <el-button type="primary" size="small" @click="editData">提交</el-button>
- </el-col>
- </el-row>
- <el-form
- ref="dataForm"
- :rules="rules"
- :model="dataForm"
- status-icon
- label-position="left"
- label-width="200px"
- class="position"
- >
- <div class="small-title" style="font-size: 16px">基本信息</div>
- <div class="ws-info-table">
- <el-form-item label="id" prop="id" hidden>
- <el-input v-model="dataForm.id"/>
- </el-form-item>
- <el-form-item label="编号:" prop="payNo" style="margin-right:50px">
- <el-input v-model="dataForm.payNo" class="input-width" disabled="true"/>
- </el-form-item>
- <el-form-item label="客户:" prop="customer" style="margin-right:50px">
- <el-input v-model="dataForm.customer" class="input-width" disabled="true"/>
- </el-form-item>
- <el-form-item label="单据类型:" prop="businessType" style="margin-right:50px">
- <el-select v-model="dataForm.businessType" placeholder="请选择单据类型" class="input-width" disabled="true">
- <el-option
- v-for="item in djList"
- :label="item.label"
- :value="item.value"
- :key="item.value"
- />
- </el-select>
- </el-form-item>
- <el-form-item label="结账日期" prop="closingDate" style="margin-right:50px">
- <el-date-picker
- v-model="dataForm.closingDate"
- type="date"
- value-format="yyyy-MM-dd"
- style="width:200px"
- />
- </el-form-item>
- <el-form-item label="应付金额:" prop="amountIng" style="margin-right:50px">
- <el-input v-model="dataForm.amountIng" class="input-width"/>
- </el-form-item>
- <el-form-item label="已付金额:" prop="amountPaid" style="margin-right:50px">
- <el-input v-model="dataForm.amountPaid" class="input-width"/>
- </el-form-item>
- <el-form-item label="未付金额:" prop="unpaidAmount" style="margin-right:50px">
- <el-input v-model="dataForm.unpaidAmount" class="input-width"/>
- </el-form-item>
- <el-form-item label="备注1:" prop="remarks" style="margin-right:50px">
- <el-input v-model="dataForm.remarks" class="input-width"/>
- </el-form-item>
- <el-form-item label="备注2:" prop="remark" style="margin-right:50px">
- <el-input v-model="dataForm.remark" class="input-width"/>
- </el-form-item>
- <el-form-item label="状态:" prop="status" style="margin-right:50px">
- <el-select v-model="dataForm.status" placeholder="请选择收款状态" class="input-width">
- <el-option
- v-for="item in skList"
- :label="item.label"
- :value="item.value"
- :key="item.value"
- />
- </el-select>
- </el-form-item>
- </div>
- <div class="small-title" style="font-size: 16px">详情</div>
- <el-button style="margin-bottom:20px" @click="addDetail">添加</el-button>
- <el-table
- v-loading="listLoading"
- :data="list"
- :summary-method="getSummaries"
- size="small"
- element-loading-text="正在查询中。。。"
- border
- fit
- highlight-current-row
- show-summary
- @selection-change="handleSelectionChange"
- >
- <el-table-column :selectable="selectInit" type="selection" style="width:30px" />
- <el-table-column type="index" label="序号">
- <template scope="scope">
- <span v-if="scope.$index < 9">0{{ scope.$index + 1 }}</span>
- <span v-else>{{ scope.$index + 1 }}</span>
- </template>
- </el-table-column>
- <el-table-column align="center" label="柜号" prop="cabinetNo">
- <template slot-scope="scope">
- <el-input v-model="scope.row.cabinetNo" />
- </template>
- </el-table-column>
- <el-table-column align="center" label="到港日期" prop="arrivalDate" width="170px">
- <template slot-scope="scope">
- <el-date-picker
- v-model="scope.row.arrivalDate"
- type="date"
- value-format="yyyy-MM-dd"
- style="width:140px"
- />
- </template>
- </el-table-column>
- <el-table-column align="center" label="送货地点" prop="deliveryPlace">
- <template slot-scope="scope">
- <el-input v-model="scope.row.deliveryPlace" />
- </template>
- </el-table-column>
- <el-table-column align="center" label="产品" prop="product">
- <template slot-scope="scope">
- <el-input v-model="scope.row.product" />
- </template>
- </el-table-column>
- <el-table-column align="center" label="重量" prop="weight">
- <template slot-scope="scope">
- <el-input v-model="scope.row.weight" />
- </template>
- </el-table-column>
- <el-table-column align="center" label="清关费" prop="clearanceFee">
- <template slot-scope="scope">
- <el-input v-model="scope.row.clearanceFee" />
- </template>
- </el-table-column>
- <el-table-column align="center" label="清关成本" prop="clearanceCost">
- <template slot-scope="scope">
- <el-input v-model="scope.row.clearanceCost" />
- </template>
- </el-table-column>
- <el-table-column align="center" label="卡车" prop="truck">
- <template slot-scope="scope">
- <el-input v-model="scope.row.truck" />
- </template>
- </el-table-column>
- <el-table-column align="center" label="卡车成本" prop="truckCost">
- <template slot-scope="scope">
- <el-input v-model="scope.row.truckCost" />
- </template>
- </el-table-column>
- <el-table-column align="center" label="其他费用" prop="otherExpenses">
- <template slot-scope="scope">
- <el-input v-model="scope.row.otherExpenses" />
- </template>
- </el-table-column>
- <el-table-column align="center" label="其他成本" prop="otherCost">
- <template slot-scope="scope">
- <el-input v-model="scope.row.otherCost" />
- </template>
- </el-table-column>
- <el-table-column align="center" label="应付金额" prop="pricePayable">
- <template slot-scope="scope">
- <el-input v-model="scope.row.pricePayable" />
- </template>
- </el-table-column>
- <el-table-column align="center" label="成本价格" prop="cost">
- <template slot-scope="scope">
- <el-input v-model="scope.row.cost" />
- </template>
- </el-table-column>
- <el-table-column align="center" label="备注1" prop="remarks">
- <template slot-scope="scope">
- <el-input v-model="scope.row.remarks" />
- </template>
- </el-table-column>
- <!-- <el-table-column align="center" label="备注2" prop="remark">
- <template slot-scope="scope">
- <el-input v-model="scope.row.remark" />
- </template>
- </el-table-column>-->
- <!-- <el-table-column align="center" label="状态" prop="status">
- <template slot-scope="scope">
- <el-input v-model="scope.row.status" />
- </template>
- </el-table-column>-->
- <el-table-column align="center" label="操作" class-name="small-padding fixed-width">
- <template slot-scope="scope">
- <el-button type="danger" size="mini" @click.native.prevent="deleteRow(scope.$index, list)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- </el-form>
- </div>
- </template>
- <script>
- import {
- listCustomerBillingInfo,
- createCustomerBillingInfo,
- editCustomerBillingInfo,
- updateCustomerBillingInfo,
- deleteCustomerBillingInfo
- } from '@/api/customerBillingInfo'
- import { listCustomerBillingDetail } from '@/api/customerBillingDetail'
- import Pagination from '@/components/Pagination'
- export default {
- name: 'CustomerBillingInfo',
- components: { Pagination },
- data() {
- return {
- djList: [
- {
- value: '1',
- label: '正常单据'
- },
- {
- value: '2',
- label: '结转单据'
- }
- ],
- skList: [
- {
- value: 1,
- label: '未收款'
- },
- {
- value: 2,
- label: '部分收款'
- },
- {
- value: 3,
- label: '已收款'
- }
- ],
- billDetailList: [
- {
- payNo: '11',
- businessType: '1',
- closingDate: '1',
- amountPaid: '1',
- unpaidAmount: '1',
- remarks: '1',
- remark: '1',
- status: '1'
- }
- ],
- list: null,
- total: 0,
- listLoading: false,
- listQuery: {
- page: 1,
- limit: 100
- },
- dataForm: {
- id: undefined
- },
- dialogFormVisible: false,
- submiting: false,
- dialogStatus: '',
- textMap: {
- update: '编辑',
- create: '创建'
- },
- rules: {}
- }
- },
- created() { debugger
- this.listQuery.id = this.$route.query.id
- this.getList()
- },
- methods: {
- getList() {
- this.listLoading = true
- listCustomerBillingDetail(this.listQuery)
- .then(response => {
- debugger
- this.dataForm = response.data.data
- this.list = response.data.data.customerBillingDetailDOList
- this.total = response.data.data.total
- this.listLoading = false
- })
- .catch(() => {
- this.list = []
- this.total = 0
- this.listLoading = false
- })
- },
- returnsales() {
- this.$router.push({
- path: 'customerBilling'
- })
- },
- handleSelectionChange(val) {
- this.modification = val
- },
- selectInit(row) {
- return true
- },
- getSummaries(param) {
- const { columns, data } = param
- const sums = []
- columns.forEach((column, index) => {
- if (index === 0) {
- sums[index] = '合计'
- return
- } else if (
- index == 7 ||
- index == 8 ||
- index == 10 ||
- index == 11 ||
- index == 12||
- index == 13||
- index == 14
- ) {
- const values = data.map(item => Number(item[column.property]))
- if (!values.every(value => isNaN(value))) {
- sums[index] = values.reduce((prev, curr) => {
- const value = Number(curr)
- if (!isNaN(value)) {
- return prev + curr
- } else {
- return prev
- }
- }, 0)
- sums[index] += ''
- } else {
- sums[index] = '--'
- }
- } else {
- // sums[index] = "--";
- }
- })
- return sums
- },
- addDetail() {
- console.log('add')
- this.list.push({
- cabinetNo: '',
- arrivalDate: '',
- deliveryPlace: '',
- product: '',
- weight: '',
- clearanceFee: '',
- clearanceCost: '',
- truck: '',
- truckCost: '',
- otherExpenses: '',
- otherCost: '',
- pricePayable: '',
- cost: '',
- remarks: '',
- remark: '',
- status: ''
- })
- },
- handleFilter() {
- this.listQuery.page = 1
- this.getList()
- },
- resetForm() {
- this.dataForm = {
- id: undefined
- }
- },
- handleCreate() {
- this.resetForm()
- this.dialogStatus = 'create'
- this.dialogFormVisible = true
- this.$nextTick(() => {
- this.$refs['dataForm'].clearValidate()
- })
- },
- editData() {
- this.$refs['dataForm'].validate(valid => {
- if (valid) {
- this.submiting = true
- this.dataForm.customerBillingDetailDTOS = this.list
- editCustomerBillingInfo(this.dataForm)
- .then(response => {
- // this.list.unshift(response.data.data)
- this.dialogFormVisible = false
- this.$notify.success({
- title: '成功',
- message: '添加成功'
- })
- this.submiting = false
- this.returnsales()
- })
- .catch(response => {
- this.$notify.error({
- title: '失败',
- message: response.data.errmsg
- })
- this.submiting = false
- })
- }
- })
- },
- handleUpdate(row) {
- this.dataForm = Object.assign({}, row)
- this.dialogStatus = 'update'
- this.dialogFormVisible = true
- this.$nextTick(() => {
- this.$refs['dataForm'].clearValidate()
- })
- },
- updateData() {
- this.$refs['dataForm'].validate(valid => {
- if (valid) {
- this.submiting = true
- updateCustomerBillingInfo(this.dataForm)
- .then(() => {
- for (const v of this.list) {
- if (v.id === this.dataForm.id) {
- const index = this.list.indexOf(v)
- this.list.splice(index, 1, this.dataForm)
- break
- }
- }
- this.dialogFormVisible = false
- this.submiting = false
- this.$notify.success({
- title: '成功',
- message: '更新成功'
- })
- })
- .catch(response => {
- this.$notify.error({
- title: '失败',
- message: response.data.errmsg
- })
- this.submiting = false
- })
- }
- })
- },
- deleteRow(index, rows) {
- rows.splice(index, 1)
- }
- }
- }
- </script>
- <style lang="scss">
- .bg-left {
- padding-left: 30px;
- }
- .bg-right {
- padding-right: 10px;
- text-align: right;
- }
- .bg-bottom {
- margin: 15px 0px;
- }
- .title-style {
- background: #f6f7fc;
- border-radius: 5px;
- }
- .app-container {
- // background: ;
- }
- .title::before {
- content: "";
- display: inline-block;
- width: 5px;
- height: 30px;
- background: #5473e8;
- position: absolute;
- left: 0;
- }
- .position {
- position: relative;
- }
- .small-title {
- position: relative;
- padding: 10px;
- font-weight: 600;
- margin: 20px 0;
- }
- .small-title::before {
- position: absolute;
- content: "";
- display: block;
- background: #5473e8;
- width: 4px;
- height: 14px;
- left: 0px;
- top: 13px;
- }
- .el-form {
- padding: 0 40px;
- }
- .ws-info-table {
- display: -webkit-box;
- display: -ms-flexbox;
- display: flex;
- -ms-flex-wrap: wrap;
- flex-wrap: wrap;
- border-left: 1px solid #ccc;
- border-top: 1px solid #ccc;
- position: relative;
- border-left: 0;
- border-top: 0;
- }
- .input-width{
- width: 200px;
- }
- </style>
|