<template> <div> <el-dialog v-loading="loading" :show-close="false" :close-on-click-modal="false" :visible.sync="isShow" :title="curObj.id ? '编辑成交' : '新增成交'" :fullscreen="false" width="700px" custom-class="xl-dialog" center > <base-form ref="ruleForm" class="lib-edit" :data="formData" :is-inline="false" label-width="110px"> <div slot="footer" style="padding-top: 20px;"> <el-button class="xl-form-btn t2" @click="close">关 闭</el-button> <el-button class="xl-form-btn t1" @click="close('confirm')">确定</el-button> </div> </base-form> </el-dialog> </div> </template> <script> export default { components: { }, mixins, props: { isShow: Boolean, curObj: Object }, inject: ['parentData'], data() { return { formData: [], loading: true, cObj: {}, curEstateList: [], } }, watch: { isShow: function(val) { if (val) { this.getDef() } }, }, methods: { getDef() { let params = {...this.curObj} if (!params.deal_clerk) { const uObj = JSON.parse(this.$storage('fp_user')) params.deal_clerk = uObj.nickname } this.formData = [ { label: '成交楼盘', key: 'deal_item', class: 'c-2', rules: 1 }, { label: '房屋类型', key: 'house_type', class: 'c-2', rules: 1, type: 'select', options: this.$dictData.trade_house_type, rules: 1 }, { label: '成交店员', key: 'deal_clerk', class: 'c-2', rules: 1 }, { label: '成交类型', key: 'deal_type', class: 'c-2', rules: 1, type: 'select', options: this.$dictData.trade_deal_type, rules: 1 }, { label: '成交日期', key: 'deal_at', class: 'c-2', type: 'datePicker', type2: 'date', rules: 1}, { label: '客户姓名', key: 'customer_name', class: 'c-2', rules: 1 }, { label: '客户电话', key: 'customer_phone', class: 'c-2', rules: 1 }, { label: '房号', key: 'house_no', class: 'c-2', rules: 1 }, { label: '面积', key: 'area', class: 'c-2', type: 'inputFont', appendFont: '㎡', rules: 1 }, { label: '总价', key: 'price', class: 'c-2', type: 'inputFont', appendFont: '万元', rules: 1 }, { label: '报备渠道', key: 'report_dept', class: 'c-2', rules: 1 }, { label: '折扣体系', key: 'discount', class: 'c-2' }, { label: '佣金', key: 'brokerage', class: 'c-2' }, { label: '返佣', key: 'rebate', class: 'c-2' }, { label: '佣金凭证', key: 'housbrokerage_imge_no', type: 'uploads', class: 'c-2'}, { label: '备注', key: 'remark', type: 'textarea' }, ] this.setDefaultValue(params) }, close(str) { if (str === 'confirm') { this.$refs['ruleForm'].$refs['baseForm'].validate((valid) => { if (valid) { const oldform = this.$refs.ruleForm.baseForm const newForm = { ...oldform } if (this.curObj.id) { newForm.id = this.curObj.id } let apiStr = 'admtradeadd' if (newForm.id) apiStr = 'admtradeedit' newForm.phone_type = 1 this.$api.cust[apiStr](newForm).then(data => { this.$msgs(newForm.id ? '编辑成功' : '新增成功') this.$emit('close', newForm) }) } }) } else { this.$emit('close') this.setDefaultValue() } } } } </script> <style lang="scss" scoped> @import '../../../../styles/libEdit.scss'; .lib-edit { padding-top: 0; ::v-deep .el-form-item { margin-bottom: 10px; } ::v-deep .el-date-editor.el-input { width: 100%; } } </style>