12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- <template>
- <div class="hui-flex hui-dialog">
- <div class="hui-flex-box hui-dialog-content">
- <el-form ref="form" label-position="top" :model="form">
- <el-form-item label="付款名称" prop="name" :rules="[{required: true, message: '请输入付款名称'}]">
- <el-input type="text" v-model="form.name" placeholder="请输入付款名称"></el-input>
- </el-form-item>
- <el-form-item label="回执单" class="hui-textarea">
- <upload ref="upload" :list="responsibility" type="insert" accept=".png, .jpg, .jpeg, .pdf"
- text="上传回执单">
- </upload>
- </el-form-item>
- </el-form>
- </div>
- <div class="hui-dialog-submit">
- <el-button size="medium" @click="$emit('callback')">取 消</el-button>
- <el-button size="medium" type="primary" @click="submit">保 存</el-button>
- </div>
- </div>
- </template>
- <script>
- import upload from '@/components/common/upload'
- import {
- insertPaymentRecord,
- putPaymentStatus
- } from '@/httpApi/contract'
- import {
- updatePayment
- } from '@/httpApi/bill'
- export default {
- props: ['itemId', 'type'],
- data() {
- return {
- form: {
- name: '',
- data: '{}'
- },
- responsibility: []
- }
- },
- created() {
- this.form[this.type + 'Id'] = this.itemId;
- },
- methods: {
- submit() {
- this.$refs.form.validate((valid) => {
- if (valid) {
- if (this.$refs.upload.fileList.length === 0) return this.$message.warning('请上传回执单');
- let postData = JSON.parse(JSON.stringify(this.form));
- postData['attachment'] = JSON.stringify(this.$refs.upload.fileList);
- insertPaymentRecord(postData).then(res => {
- if (res.state) {
- if (this.type === 'payment') {
- putPaymentStatus(this.itemId, 1);
- } else {
- updatePayment({
- id: this.itemId,
- status: 1
- })
- }
- this.$message.success('操作成功');
- this.$emit('callback', 'init');
- }
- })
- } else {
- return false;
- }
- });
- }
- },
- components: {
- upload
- },
- }
- </script>
- <style>
- </style>
|