IndexEdit.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <template>
  2. <div>
  3. <el-dialog
  4. v-loading="loading"
  5. :show-close="false"
  6. :close-on-click-modal="false"
  7. :visible.sync="isShow"
  8. :title="curObj.id ? '编辑成交' : '新增成交'"
  9. :fullscreen="false"
  10. width="700px"
  11. custom-class="xl-dialog"
  12. center
  13. >
  14. <base-form ref="ruleForm" class="lib-edit" :data="formData" :is-inline="false" label-width="110px">
  15. <div slot="footer" style="padding-top: 20px;">
  16. <el-button class="xl-form-btn t2" @click="close">关 闭</el-button>
  17. <el-button class="xl-form-btn t1" @click="close('confirm')">确定</el-button>
  18. </div>
  19. </base-form>
  20. </el-dialog>
  21. </div>
  22. </template>
  23. <script>
  24. export default {
  25. components: { },
  26. mixins,
  27. props: {
  28. isShow: Boolean,
  29. curObj: Object
  30. },
  31. inject: ['parentData'],
  32. data() {
  33. return {
  34. formData: [],
  35. loading: true,
  36. cObj: {},
  37. curEstateList: [],
  38. }
  39. },
  40. watch: {
  41. isShow: function(val) {
  42. if (val) {
  43. this.getDef()
  44. }
  45. },
  46. },
  47. methods: {
  48. getDef() {
  49. let params = {...this.curObj}
  50. if (!params.deal_clerk) {
  51. const uObj = JSON.parse(this.$storage('fp_user'))
  52. params.deal_clerk = uObj.nickname
  53. }
  54. this.formData = [
  55. { label: '成交楼盘', key: 'deal_item', class: 'c-2', rules: 1 },
  56. { label: '房屋类型', key: 'house_type', class: 'c-2', rules: 1, type: 'select', options: this.$dictData.trade_house_type, rules: 1 },
  57. { label: '成交店员', key: 'deal_clerk', class: 'c-2', rules: 1 },
  58. { label: '成交类型', key: 'deal_type', class: 'c-2', rules: 1, type: 'select', options: this.$dictData.trade_deal_type, rules: 1 },
  59. { label: '成交日期', key: 'deal_at', class: 'c-2', type: 'datePicker', type2: 'date', rules: 1},
  60. { label: '客户姓名', key: 'customer_name', class: 'c-2', rules: 1 },
  61. { label: '客户电话', key: 'customer_phone', class: 'c-2', rules: 1 },
  62. { label: '房号', key: 'house_no', class: 'c-2', rules: 1 },
  63. { label: '面积', key: 'area', class: 'c-2', type: 'inputFont', appendFont: '㎡', rules: 1 },
  64. { label: '总价', key: 'price', class: 'c-2', type: 'inputFont', appendFont: '万元', rules: 1 },
  65. { label: '报备渠道', key: 'report_dept', class: 'c-2', rules: 1 },
  66. { label: '折扣体系', key: 'discount', class: 'c-2' },
  67. { label: '佣金', key: 'brokerage', class: 'c-2' },
  68. { label: '返佣', key: 'rebate', class: 'c-2' },
  69. { label: '佣金凭证', key: 'housbrokerage_imge_no', type: 'uploads', class: 'c-2'},
  70. { label: '备注', key: 'remark', type: 'textarea' },
  71. ]
  72. this.setDefaultValue(params)
  73. },
  74. close(str) {
  75. if (str === 'confirm') {
  76. this.$refs['ruleForm'].$refs['baseForm'].validate((valid) => {
  77. if (valid) {
  78. const oldform = this.$refs.ruleForm.baseForm
  79. const newForm = { ...oldform }
  80. if (this.curObj.id) {
  81. newForm.id = this.curObj.id
  82. }
  83. let apiStr = 'admtradeadd'
  84. if (newForm.id) apiStr = 'admtradeedit'
  85. newForm.phone_type = 1
  86. this.$api.cust[apiStr](newForm).then(data => {
  87. this.$msgs(newForm.id ? '编辑成功' : '新增成功')
  88. this.$emit('close', newForm)
  89. })
  90. }
  91. })
  92. } else {
  93. this.$emit('close')
  94. this.setDefaultValue()
  95. }
  96. }
  97. }
  98. }
  99. </script>
  100. <style lang="scss" scoped>
  101. @import '../../../../styles/libEdit.scss';
  102. .lib-edit {
  103. padding-top: 0;
  104. ::v-deep .el-form-item {
  105. margin-bottom: 10px;
  106. }
  107. ::v-deep .el-date-editor.el-input {
  108. width: 100%;
  109. }
  110. }
  111. </style>