LAPTOP-FO2T5SIU\35838 8 ay önce
ebeveyn
işleme
1476dc158e

+ 73 - 7
src/views/receiveRefundsManagement/refundManagement/addRefund.vue

@@ -30,7 +30,7 @@
                     placeholder=""
                     filterable
                     clearable
-                    @change="getHouseList"
+                    @change="identityCardChange"
                   >
                     <el-option
                       v-for="item in idNumberOption"
@@ -117,7 +117,7 @@
                   border
                   @selection-change="handleSelectionChange"
                 >
-                  <el-table-column type="selection" width="55" />
+                  <el-table-column type="selection" width="55" :selectable="selectEnable" />
                   <el-table-column type="index" width="60" label="序号" />
                   <el-table-column label="款项" prop="type" />
                   <el-table-column label="已收(元)" prop="receivedAmount" width="200" />
@@ -238,7 +238,16 @@ export default {
             dc_key: ['CHECK_OUT_REASON'],
             form: { ...form },
             rules: {
-
+                approvalNumber: [{ required: true, message: '请输入关联审批单号', trigger: 'blur' }],
+                applicant: [{ required: true, message: '请输入申请人', trigger: 'blur' }],
+                identityCard: [{ required: true, message: '请输入身份证号', trigger: 'blur' }],
+                reason: [{ required: true, message: '请选择退房原因', trigger: 'change' }],
+                houseId: [{ required: true, message: '请选择所退房屋', trigger: 'change' }],
+                buyerName: [{ required: true, message: '请输入买受人', trigger: 'blur' }],
+                refundAmount: [{ required: true, message: '请输入应退金额', trigger: 'blur' }],
+                deductible: [{ required: true, message: '请输入扣除金额', trigger: 'blur' }],
+                actualRefundAmount: [{ required: true, message: '请输入实退金额', trigger: 'blur' }],
+                bankNumber: [{ required: true, message: '请输入收款账号', trigger: 'blur' }]
             },
             AllData: [],
             loading: false,
@@ -269,6 +278,30 @@ export default {
             this.contractId = data.contractId
             this.initDict(this.dc_key).then(res => {
                 this.getIdentityCardList()
+                if (data.id) {
+                    this.getById(data)
+                }
+            })
+        },
+        getById(data) {
+            const postData = {
+                id: data.id
+            }
+            this.baseRequest('getById', postData).then((res) => {
+                if (res.data) {
+                    this.form = res.data
+                    if (this.form.fileList) {
+                        this.fileList = JSON.parse(this.form.fileList)
+                    }
+                    if (this.form.reason) {
+                        this.form.reason = this.form.reason + ''
+                    }
+                    this.dateStr = this.form.createdAt
+                    this.username = this.form.createdName
+                    this.getHouseList()
+                    this.getPaymentListById()
+                }
+            }).catch((e) => {
             })
         },
         getIdentityCardList() {
@@ -287,12 +320,16 @@ export default {
             }).catch((e) => {
             })
         },
-        getHouseList() {
+        identityCardChange() {
             const _this = this
             _this.houseOption = []
             _this.form.houseId = ''
             _this.form.customerManagementId = ''
             _this.form.buyerName = ''
+            _this.getHouseList()
+        },
+        getHouseList() {
+            const _this = this
             const postData = {
                 identityCard: this.form.identityCard
             }
@@ -351,21 +388,50 @@ export default {
             }).catch((e) => {
             })
         },
+        // 回显
+        getPaymentListById() {
+            const _this = this
+            _this.AllData = []
+            _this.loading = true
+            const postData = {
+                refundManageId: this.form.id
+            }
+            this.baseDetailRequest('listAll', postData).then((res) => {
+                if (res.data) {
+                    res.data.forEach(item => {
+                        const json = _this.getItemJson(item)
+                        _this.AllData.push(json)
+                    })
+                }
+                _this.loading = false
+            }).catch((e) => {
+            })
+        },
         getItemJson: function(item) {
             item.isSelected = false
             return item
         },
+        selectEnable() {
+            if (!this.isView) {
+                // 启用选择
+                return true
+            } else {
+                // 禁用选择
+                return false
+            }
+        },
         confirmSubmit() {
             const _this = this
             this.$refs.form.validate(valid => {
                 if (valid) {
                     const extraData = {
                         // 退款详情
-                        detailInfo: JSON.stringify(_this.paymentOptions),
-                        fileList: JSON.stringify(_this.fileList)
+                        refundDetailInfoStr: JSON.stringify(_this.paymentOptions),
+                        fileList: JSON.stringify(_this.fileList),
+                        contractId: this.contractId
                     }
                     const postData = Object.assign({}, _this.form, extraData)
-                    this.baseRequest('', postData).then(res => {
+                    this.baseRequest('add', postData).then(res => {
                         const data = res.data
                         if (data.code == 200) {
                             this.$notify({