Blame view

src/views/fee/roomOweFeeCallableList.vue 4.41 KB
92c405db   wuxw   优化业务受理中部分选项打不开bug
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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
106
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
147
148
149
150
151
152
153
154
155
156
157
158
159
  <template>
    <div class="room-owe-fee-callable-container">
      <el-card class="box-card">
        <div slot="header" class="flex justify-between">
          <span>{{ $t('roomOweFeeCallable.title') }}</span>
        </div>
        
        <el-row :gutter="20">
          <el-col :span="24">
            <el-form label-position="right" label-width="120px" class="text-left">
              <el-form-item :label="$t('roomOweFeeCallable.callableWay')">
                <el-select 
                  v-model="roomOweFeeCallableInfo.callableWay" 
                  style="width:100%"
                  :placeholder="$t('roomOweFeeCallable.selectCallableWay')">
                  <el-option 
                    disabled 
                    value=""
                    :label="$t('roomOweFeeCallable.selectCallableWay')"/>
                  <el-option 
                    label="微信模板消息" 
                    value="WECHAT"/>
                  <el-option 
                    label="短信" 
                    value="SMS"/>
                </el-select>
              </el-form-item>
              
              <el-form-item :label="$t('roomOweFeeCallable.callableFees')">
                <el-checkbox-group v-model="roomOweFeeCallableInfo.feeIds">
                  <el-checkbox 
                    v-for="(item,index) in roomOweFeeCallableInfo.fees" 
                    :key="index" 
                    :label="item.feeId">
                    {{item.feeName}}
                  </el-checkbox>
                </el-checkbox-group>
              </el-form-item>
              
              <el-form-item :label="$t('roomOweFeeCallable.remark')">
                <el-input
                  type="textarea"
                  :rows="5"
                  v-model="roomOweFeeCallableInfo.remark"
                  :placeholder="$t('roomOweFeeCallable.inputRemark')">
                </el-input>
              </el-form-item>
            </el-form>
          </el-col>
        </el-row>
        
        <div class="footer-buttons">
          <el-button 
            type="primary" 
            @click="_saveOweFeeCallable">
            <i class="el-icon-check"></i>
            {{ $t('common.submit') }}
          </el-button>
          <el-button 
            type="warning" 
            @click="$router.go(-1)">
            {{ $t('common.cancel') }}
          </el-button>
        </div>
      </el-card>
    </div>
  </template>
  
  <script>
  import { saveOweFeeCallable, listFee } from '@/api/fee/roomOweFeeCallableApi'
  import { getCommunityId } from '@/api/community/communityApi'
  
  export default {
    name: 'RoomOweFeeCallableList',
    data() {
      return {
        roomOweFeeCallableInfo: {
          callableWay: '',
          remark: '',
          communityId: '',
          feeIds: [],
          roomId: '',
          roomIds: [],
          fees: []
        }
      }
    },
    created() {
      this.roomOweFeeCallableInfo.communityId = getCommunityId()
      this.roomOweFeeCallableInfo.roomId = this.$route.query.roomId
      this.roomOweFeeCallableInfo.roomIds.push(this.$route.query.roomId)
      this._loadRoomOweFees()
    },
    methods: {
      roomOweFeeCallableValidate() {
        if (!this.roomOweFeeCallableInfo.callableWay) {
          this.$message.error(this.$t('roomOweFeeCallable.callableWayRequired'))
          return false
        }
        return true
      },
      async _saveOweFeeCallable() {
        if (!this.roomOweFeeCallableValidate()) {
          return
        }
        
        try {
          const res = await saveOweFeeCallable(this.roomOweFeeCallableInfo)
          if (res.code === 0) {
            this.$message.success(this.$t('common.submitSuccess'))
            this.$router.go(-1)
          } else {
            this.$message.error(res.msg)
          }
        } catch (error) {
          this.$message.error(this.$t('common.submitError'))
        }
      },
      async _loadRoomOweFees() {
        try {
          const params = {
            page: 1,
            row: 100,
            communityId: this.roomOweFeeCallableInfo.communityId,
            payerObjId: this.roomOweFeeCallableInfo.roomId,
            state: '2008001'
          }
          const { fees } = await listFee(params)
          this.roomOweFeeCallableInfo.fees = fees || []
        } catch (error) {
          this.$message.error(this.$t('roomOweFeeCallable.fetchFeeError'))
        }
      }
    }
  }
  </script>
  
  <style lang="scss" scoped>
  .room-owe-fee-callable-container {
    padding: 20px;
    
    .box-card {
      margin-bottom: 20px;
    }
    
    .footer-buttons {
      text-align: right;
      margin-top: 20px;
      
      .el-button {
        margin-left: 10px;
      }
    }
    
    .el-checkbox {
      margin-right: 15px;
    }
  }
  </style>