Blame view

src/components/fee/editApplyRoomDiscountRecord.vue 5.25 KB
43eaaadb   wuxw   开发房屋优惠折扣
1
  <template>
745b8235   wuxw   v1.9 优化优惠申请 bug
2
3
4
5
    <el-dialog :title="$t('applyRoomDiscount.editRecord.title')" :visible.sync="visible" width="60%" @close="handleClose">
      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
        <el-form-item :label="$t('applyRoomDiscount.editRecord.ardId')" prop="ardId">
          <el-input v-model="form.ardId" disabled />
43eaaadb   wuxw   开发房屋优惠折扣
6
7
        </el-form-item>
  
745b8235   wuxw   v1.9 优化优惠申请 bug
8
9
        <el-form-item :label="$t('applyRoomDiscount.editRecord.roomName')" prop="roomName">
          <el-input v-model="form.roomName" disabled />
43eaaadb   wuxw   开发房屋优惠折扣
10
11
        </el-form-item>
  
745b8235   wuxw   v1.9 优化优惠申请 bug
12
13
        <el-form-item :label="$t('applyRoomDiscount.editRecord.applyTypeName')" prop="applyTypeName">
          <el-input v-model="form.applyTypeName" disabled />
43eaaadb   wuxw   开发房屋优惠折扣
14
15
        </el-form-item>
  
745b8235   wuxw   v1.9 优化优惠申请 bug
16
17
        <el-form-item :label="$t('applyRoomDiscount.editRecord.createUserName')" prop="createUserName">
          <el-input v-model="form.createUserName" disabled />
43eaaadb   wuxw   开发房屋优惠折扣
18
19
        </el-form-item>
  
745b8235   wuxw   v1.9 优化优惠申请 bug
20
21
        <el-form-item :label="$t('applyRoomDiscount.editRecord.createUserTel')" prop="createUserTel">
          <el-input v-model="form.createUserTel" disabled />
43eaaadb   wuxw   开发房屋优惠折扣
22
23
        </el-form-item>
  
745b8235   wuxw   v1.9 优化优惠申请 bug
24
25
26
27
        <el-form-item :label="$t('applyRoomDiscount.editRecord.startTime')" prop="startTime">
          <el-date-picker v-model="form.startTime" type="datetime"
            :placeholder="$t('applyRoomDiscount.editRecord.startTimePlaceholder')" value-format="yyyy-MM-dd HH:mm:ss"
            style="width:100%" @change="validateDate" />
43eaaadb   wuxw   开发房屋优惠折扣
28
29
        </el-form-item>
  
745b8235   wuxw   v1.9 优化优惠申请 bug
30
31
32
33
        <el-form-item :label="$t('applyRoomDiscount.editRecord.endTime')" prop="endTime">
          <el-date-picker v-model="form.endTime" type="datetime"
            :placeholder="$t('applyRoomDiscount.editRecord.endTimePlaceholder')" value-format="yyyy-MM-dd HH:mm:ss"
            style="width:100%" @change="validateDate" />
43eaaadb   wuxw   开发房屋优惠折扣
34
35
        </el-form-item>
  
745b8235   wuxw   v1.9 优化优惠申请 bug
36
37
        <el-form-item :label="$t('applyRoomDiscount.editRecord.stateName')" prop="stateName">
          <el-input v-model="form.stateName" disabled />
43eaaadb   wuxw   开发房屋优惠折扣
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
        </el-form-item>
      </el-form>
  
      <div slot="footer" class="dialog-footer">
        <el-button @click="visible = false">
          {{ $t('common.cancel') }}
        </el-button>
        <el-button type="primary" @click="submitForm">
          {{ $t('common.save') }}
        </el-button>
      </div>
    </el-dialog>
  </template>
  
  <script>
745b8235   wuxw   v1.9 优化优惠申请 bug
53
  import { editApplyRoomDiscount } from '@/api/fee/applyRoomDiscountManageApi'
24d3590f   wuxw   房屋收费页面开发完成
54
  import { getCommunityId } from '@/api/community/communityApi'
43eaaadb   wuxw   开发房屋优惠折扣
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
  
  export default {
    name: 'EditApplyRoomDiscountRecord',
    data() {
      return {
        visible: false,
        form: {
          ardId: '',
          roomName: '',
          roomId: '',
          discountId: '',
          discountName: '',
          applyTypeName: '',
          createUserName: '',
          createUserTel: '',
          startTime: '',
          endTime: '',
          stateName: '',
          state: '',
          communityId: ''
        },
        rules: {
          ardId: [
            { required: true, message: this.$t('applyRoomDiscount.validate.ardIdRequired'), trigger: 'blur' }
          ],
          roomName: [
            { required: true, message: this.$t('applyRoomDiscount.validate.roomRequired'), trigger: 'blur' }
          ],
          applyTypeName: [
            { required: true, message: this.$t('applyRoomDiscount.validate.applyTypeRequired'), trigger: 'blur' }
          ],
          createUserName: [
            { required: true, message: this.$t('applyRoomDiscount.validate.createUserRequired'), trigger: 'blur' }
          ],
          startTime: [
            { required: true, message: this.$t('applyRoomDiscount.validate.startTimeRequired'), trigger: 'change' }
          ],
          endTime: [
            { required: true, message: this.$t('applyRoomDiscount.validate.endTimeRequired'), trigger: 'change' }
          ],
          stateName: [
            { required: true, message: this.$t('applyRoomDiscount.validate.stateRequired'), trigger: 'blur' }
          ]
        }
      }
    },
    methods: {
      open(data) {
        this.form = {
          ...this.form,
          ...data,
24d3590f   wuxw   房屋收费页面开发完成
106
          communityId: getCommunityId()
43eaaadb   wuxw   开发房屋优惠折扣
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
        }
        this.visible = true
      },
      handleClose() {
        this.$refs.form.resetFields()
        this.form = {
          ardId: '',
          roomName: '',
          roomId: '',
          discountId: '',
          discountName: '',
          applyTypeName: '',
          createUserName: '',
          createUserTel: '',
          startTime: '',
          endTime: '',
          stateName: '',
          state: '',
          communityId: ''
        }
      },
      validateDate() {
        if (this.form.startTime && this.form.endTime) {
          const start = new Date(this.form.startTime)
          const end = new Date(this.form.endTime)
          if (start >= end) {
            this.$message.error(this.$t('applyRoomDiscount.validate.dateInvalid'))
            this.form.endTime = ''
          }
        }
      },
      submitForm() {
        this.$refs.form.validate(valid => {
          if (valid) {
            this.updateApplyRoomDiscount()
          }
        })
      },
      async updateApplyRoomDiscount() {
        try {
745b8235   wuxw   v1.9 优化优惠申请 bug
147
          await editApplyRoomDiscount(this.form)
43eaaadb   wuxw   开发房屋优惠折扣
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
          this.$message.success(this.$t('applyRoomDiscount.message.updateSuccess'))
          this.visible = false
          this.$emit('success')
        } catch (error) {
          this.$message.error(error.message || this.$t('applyRoomDiscount.message.updateFailed'))
        }
      }
    }
  }
  </script>
  
  <style lang="scss" scoped>
  .el-form-item {
    margin-bottom: 22px;
  }
  </style>