Blame view

src/components/aCommunity/aRoomDetailCarFee.vue 8 KB
a2547628   wuxw   运营加入房屋详情页面
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
  <template>
    <div>
      <el-row class="margin-top">
        <el-col :span="4" class="text-left">
          <el-select v-model="aRoomDetailCarFeeInfo.carId" @change="changeARoomDetailCar"
            :placeholder="$t('aRoomDetailCarFee.selectCar')">
            <el-option v-for="item in aRoomDetailCarFeeInfo.ownerCars" :key="item.carId" :label="item.carNum"
              :value="item.carId">
            </el-option>
          </el-select>
        </el-col>
        <el-col :span="16" class="text-right"></el-col>
      </el-row>
      <div>
        <el-table :data="aRoomDetailCarFeeInfo.fees" style="margin-top:10px">
          <el-table-column prop="feeName" :label="$t('aRoomDetailCarFee.feeItem')" align="center">
            <template slot-scope="scope">
              <span class="hand">{{ scope.row.feeName }}</span>
              <i class="el-icon-info"></i>
            </template>
          </el-table-column>
          <el-table-column prop="feeFlagName" :label="$t('aRoomDetailCarFee.feeFlag')" align="center"></el-table-column>
          <el-table-column prop="feeTypeCdName" :label="$t('aRoomDetailCarFee.feeType')" align="center"></el-table-column>
          <el-table-column prop="amountOwed" :label="$t('aRoomDetailCarFee.amount')" align="center"></el-table-column>
          <el-table-column prop="startTime" :label="$t('aRoomDetailCarFee.createTime')" align="center"></el-table-column>
          <el-table-column :label="$t('aRoomDetailCarFee.timeRange')" align="center">
            <template slot-scope="scope">
              {{ _getEndTime(scope.row) }}~<br />{{ _getDeadlineTime(scope.row) }}
            </template>
          </el-table-column>
          <el-table-column :label="$t('aRoomDetailCarFee.description')" align="center" width="150">
            <template slot-scope="scope">
              <div v-if="scope.row.feeTypeCd == '888800010015' || scope.row.feeTypeCd == '888800010016'">
                <div>{{ $t('aRoomDetailCarFee.preDegrees') }}:{{ scope.row.preDegrees }}</div>
                <div>{{ $t('aRoomDetailCarFee.curDegrees') }}:{{ scope.row.curDegrees }}</div>
                <div>{{ $t('aRoomDetailCarFee.unitPrice') }}:{{ scope.row.squarePrice }}</div>
                <div>{{ $t('aRoomDetailCarFee.additionalFee') }}:{{ scope.row.additionalAmount }}</div>
              </div>
              <div v-else-if="scope.row.feeTypeCd == '888800010017'">
                <div>{{ $t('aRoomDetailCarFee.algorithm') }}:{{ _getAttrValue(scope.row.feeAttrs, '390005') }}</div>
                <div>{{ $t('aRoomDetailCarFee.usage') }}:{{ _getAttrValue(scope.row.feeAttrs, '390003') }}</div>
              </div>
              <div v-else>
                <div>{{ $t('aRoomDetailCarFee.unitPrice') }}:{{ scope.row.squarePrice }}</div>
                <div>{{ $t('aRoomDetailCarFee.fixedFee') }}:{{ scope.row.additionalAmount }}</div>
              </div>
            </template>
          </el-table-column>
          <el-table-column prop="stateName" :label="$t('aRoomDetailCarFee.state')" align="center"></el-table-column>
          <el-table-column :label="$t('common.operation')" align="center"></el-table-column>
        </el-table>
        <el-row>
          <el-col :span="12">
            <div>
              {{ $t('aRoomDetailCarFee.note1') }}
            </div>
            <div>
              {{ $t('aRoomDetailCarFee.note2') }}
            </div>
          </el-col>
          <el-col :span="4">
            <span> {{ $t('aRoomDetailCarFee.totalArrears') }}: {{ aRoomDetailCarFeeInfo.totalAmount }}</span>
          </el-col>
          <el-col :span="8">
            <el-pagination @current-change="handleCurrentChange" :current-page="currentPage" :page-size="pageSize"
              layout="total, prev, pager, next" :total="total">
            </el-pagination>
          </el-col>
        </el-row>
      </div>
    </div>
  </template>
  
  <script>
  import { listAdminFee, queryAdminOwnerCars } from '@/api/aCommunity/aRoomDetailCarFeeApi'
  
  export default {
    name: 'ARoomDetailCarFee',
    data() {
      return {
        aRoomDetailCarFeeInfo: {
          fees: [],
          ownerCars: [],
          ownerId: '',
          name: '',
          carNum: '',
          carId: '',
          total: 0,
          records: 1,
          areaNum: '',
          num: '',
          parkingName: '',
          totalAmount: 0.0
        },
        currentPage: 1,
        pageSize: 100,
        total: 0
      }
    },
    created() {
    },
    methods: {
      open(data) {
        if (!data.ownerId) return
        this.clearARoomDetailCarFeeInfo()
        Object.assign(this.aRoomDetailCarFeeInfo, data)
        this._listOwnerCar()
          .then(() => {
            this._listARoomDetailCarFee(this.currentPage, this.pageSize)
          })
          .catch(err => {
            this.$message.error(err)
          })
      },
      handleNotify() {
        this._listARoomDetailCarFee(this.currentPage, this.pageSize)
      },
      handleCurrentChange(val) {
        this.currentPage = val
        this._listARoomDetailCarFee(val, this.pageSize)
      },
      async _listARoomDetailCarFee(page, row) {
        if (!this.aRoomDetailCarFeeInfo.carId) return
  
        try {
          const res = await listAdminFee({
            page,
            row,
            payerObjId: this.aRoomDetailCarFeeInfo.carId
          })
          this.aRoomDetailCarFeeInfo.fees = res.fees
f9f29297   wuxw   v1.9 分页 record 传给...
132
          this.total = res.total
a2547628   wuxw   运营加入房屋详情页面
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
          let totalAmount = 0.0
          res.fees.forEach(item => {
            totalAmount += parseFloat(item.amountOwed)
          })
          this.aRoomDetailCarFeeInfo.totalAmount = totalAmount
        } catch (error) {
          console.error('请求失败:', error)
        }
      },
      _getDeadlineTime(fee) {
        if (fee.amountOwed == 0 && fee.endTime == fee.deadlineTime) {
          return "-"
        }
        if (fee.state == '2009001') {
          return "-"
        }
        return fee.deadlineTime
      },
      _getEndTime(fee) {
        if (fee.state == '2009001') {
          return "-"
        }
        return fee.endTime
      },
      async _listOwnerCar() {
        return new Promise((resolve, reject) => {
          queryAdminOwnerCars({
            page: 1,
            row: 50,
            ownerId: this.aRoomDetailCarFeeInfo.ownerId,
            carTypeCd: '1001',
          })
            .then(res => {
              this.aRoomDetailCarFeeInfo.ownerCars = res.data
              if (res.data.length > 0) {
                this.aRoomDetailCarFeeInfo.carId = res.data[0].carId
                this.aRoomDetailCarFeeInfo.carNum = res.data[0].carNum
                this.aRoomDetailCarFeeInfo.num = res.data[0].num
                this.aRoomDetailCarFeeInfo.parkingName = `${res.data[0].areaNum}${this.$t('aRoomDetailCarFee.parkingLot')}${res.data[0].num}${this.$t('aRoomDetailCarFee.parkingSpace')}`
                resolve(res.data)
                return
              }
              reject(this.$t('aRoomDetailCarFee.noParkingSpace'))
            })
            .catch(err => {
              reject(err)
            })
        })
      },
      changeARoomDetailCar() {
        const car = this.aRoomDetailCarFeeInfo.ownerCars.find(item => item.carId == this.aRoomDetailCarFeeInfo.carId)
        if (!car) return
  
        this.aRoomDetailCarFeeInfo.carNum = car.carNum
        this.aRoomDetailCarFeeInfo.num = car.num
        this.aRoomDetailCarFeeInfo.parkingName = `${car.areaNum}${this.$t('aRoomDetailCarFee.parkingLot')}${car.num}${this.$t('aRoomDetailCarFee.parkingSpace')}`
        this._listARoomDetailCarFee(this.currentPage, this.pageSize)
      },
      clearARoomDetailCarFeeInfo() {
        this.aRoomDetailCarFeeInfo = {
          fees: [],
          ownerCars: [],
          ownerId: '',
          name: '',
          carNum: '',
          carId: '',
          total: 0,
          records: 1,
          areaNum: '',
          num: '',
          parkingName: '',
          totalAmount: 0.0
        }
      },
      _simplifyCarGetFeeOwnerInfo(attrs) {
        const ownerName = this._getAttrValue(attrs, '390008')
        const ownerLink = this._getAttrValue(attrs, '390009')
        return `${this.$t('aRoomDetailCarFee.owner')}:${ownerName},${this.$t('aRoomDetailCarFee.phone')}:${ownerLink}`
      },
      _getAttrValue(attrs, attrId) {
        if (!attrs) return ''
        const attr = attrs.find(item => item.attrId == attrId)
        return attr ? attr.value : ''
      }
    }
  }
  </script>
  
  <style scoped>
  .hand {
    cursor: pointer;
  }
  
  /* Other styles same as previous components */
  </style>