Blame view

src/views/community/communitySpacePersonManageList.vue 8.74 KB
b25b036d   wuxw   v1.9 优化日期
1
  <template>
34fbc487   wuxw   完成预约功能
2
3
4
5
6
7
8
9
10
11
    <div class="app-container">
      <!-- 查询条件 -->
      <el-card class="box-card">
        <div slot="header" class=" flex justify-between">
          <span>{{ $t('communitySpacePersonManage.searchConditions') }}</span>
          <el-button type="text" style="float: right; padding: 3px 0" @click="moreCondition = !moreCondition">{{
            moreCondition ? $t('communitySpacePersonManage.hide') : $t('communitySpacePersonManage.more') }}</el-button>
        </div>
        <el-row :gutter="20">
          <el-col :span="6">
b25b036d   wuxw   v1.9 优化日期
12
13
            <el-date-picker v-model="conditions.appointmentTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"            :placeholder="$t('communitySpacePersonManage.appointmentTimePlaceholder')" style="width:100%;"
               />
34fbc487   wuxw   完成预约功能
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
          </el-col>
          <el-col :span="6">
            <el-input v-model="conditions.personName"
              :placeholder="$t('communitySpacePersonManage.appointmentPersonPlaceholder')" clearable />
          </el-col>
          <el-col :span="6">
            <el-input v-model="conditions.personTel"
              :placeholder="$t('communitySpacePersonManage.appointmentTelPlaceholder')" clearable />
          </el-col>
          <el-col :span="6">
            <el-button type="primary" @click="_queryCommunitySpacePersonMethod">{{ $t('communitySpacePersonManage.search')
            }}</el-button>
            <el-button @click="_resetCommunitySpacePersonMethod">{{ $t('communitySpacePersonManage.reset') }}</el-button>
          </el-col>
        </el-row>
        <el-row v-show="moreCondition" :gutter="20" style="margin-top: 20px;">
          <el-col :span="6">
            <el-select v-model="conditions.state" :placeholder="$t('communitySpacePersonManage.statePlaceholder')" clearable
              style="width:100%;">
              <el-option v-for="(value, key) in stateOptions" :key="key" :label="value" :value="key" />
            </el-select>
          </el-col>
          <el-col :span="6">
            <el-select v-model="conditions.spaceId" :placeholder="$t('communitySpacePersonManage.spacePlaceholder')"
              clearable style="width:100%;">
              <el-option v-for="item in spaces" :key="item.spaceId" :label="item.name" :value="item.spaceId" />
            </el-select>
          </el-col>
        </el-row>
      </el-card>
  
      <!-- 预约订单列表 -->
      <el-card class="box-card" style="margin-top:20px;">
        <div slot="header" class="flex justify-between">
          <span>{{ $t('communitySpacePersonManage.appointmentOrder') }}</span>
        </div>
        <el-table v-loading="loading" :data="communitySpacePersons" border style="width: 100%">
          <el-table-column prop="cspId" :label="$t('communitySpacePersonManage.orderId')" align="center" />
          <el-table-column prop="venueName" :label="$t('communitySpacePersonManage.venue')" align="center" />
          <el-table-column prop="spaceName" :label="$t('communitySpacePersonManage.space')" align="center" />
          <el-table-column prop="personName" :label="$t('communitySpacePersonManage.appointmentPerson')" align="center" />
          <el-table-column prop="personTel" :label="$t('communitySpacePersonManage.appointmentTel')" align="center" />
          <el-table-column prop="appointmentTime" :label="$t('communitySpacePersonManage.appointmentDate')"
            align="center" />
          <el-table-column :label="$t('communitySpacePersonManage.appointmentTime')" align="center">
            <template slot-scope="scope">
              <div v-for="(time, index) in scope.row.times" :key="index">
2e006672   wuxw   v1.9 测试业主认证到发票 一些...
61
                <span> {{ time.hours }}({{ time.state == 'W'? $t('communitySpacePersonManage.stateWaitConfirm'): $t('communitySpacePersonManage.stateConfirm') }})</span>
34fbc487   wuxw   完成预约功能
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
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
228
229
230
231
              </div>
            </template>
          </el-table-column>
          <el-table-column prop="receivableAmount" :label="$t('communitySpacePersonManage.receivableAmount')"
            align="center" />
          <el-table-column prop="receivedAmount" :label="$t('communitySpacePersonManage.receivedAmount')" align="center" />
          <el-table-column prop="payWayName" :label="$t('communitySpacePersonManage.payWay')" align="center" />
          <el-table-column prop="stateName" :label="$t('communitySpacePersonManage.state')" align="center" />
          <el-table-column prop="createTime" :label="$t('communitySpacePersonManage.createTime')" align="center" />
          <el-table-column prop="remark" :label="$t('communitySpacePersonManage.remark')" align="center" />
          <el-table-column :label="$t('communitySpacePersonManage.operation')" align="center" width="150">
            <template slot-scope="scope">
              <el-button v-if="scope.row.state === 'S'" type="text" size="small"
                @click="_openDeleteCommunitySpacePersonModel(scope.row)">
                {{ $t('communitySpacePersonManage.cancelAppointment') }}
              </el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-pagination :current-page="page.current" :page-sizes="[10, 20, 30, 50]" :page-size="page.size"
          layout="total, sizes, prev, pager, next, jumper" :total="page.total" @size-change="handleSizeChange"
          @current-change="handleCurrentChange" />
      </el-card>
  
      <!-- 删除确认对话框 -->
      <delete-community-space-person ref="deleteDialog" @success="handleSuccess" />
    </div>
  </template>
  
  <script>
  import DeleteCommunitySpacePerson from '@/components/community/deleteCommunitySpacePerson'
  import { listCommunitySpacePerson, listCommunitySpace } from '@/api/community/communitySpacePersonManageApi'
  import { getCommunityId } from '@/api/community/communityApi'
  
  export default {
    name: 'CommunitySpacePersonManageList',
    components: {
      DeleteCommunitySpacePerson
    },
    data() {
      return {
        loading: false,
        moreCondition: false,
        conditions: {
          spaceId: '',
          personName: '',
          personTel: '',
          appointmentTime: '',
          state: '',
          communityId: ''
        },
        communitySpacePersons: [],
        spaces: [],
        page: {
          current: 1,
          size: 10,
          total: 0
        },
        stateOptions: {
          'S': this.$t('communitySpacePersonManage.stateOptions.S'),
          'F': this.$t('communitySpacePersonManage.stateOptions.F'),
          'W': this.$t('communitySpacePersonManage.stateOptions.W'),
          'P': this.$t('communitySpacePersonManage.stateOptions.P')
        }
      }
    },
    created() {
      this.conditions.communityId = getCommunityId()
      this._listCommunitySpacePersonCommunitySpaces()
      this._listCommunitySpacePersons(this.page.current, this.page.size)
    },
    methods: {
      // 获取预约订单列表
      async _listCommunitySpacePersons(page, size) {
        this.loading = true
        try {
          const params = {
            ...this.conditions,
            page,
            row: size
          }
          const res = await listCommunitySpacePerson(params )
          this.communitySpacePersons = res.data
          this.page.total = res.total
          this.page.current = page
        } catch (error) {
          this.$message.error(error.message || this.$t('common.fetchError'))
        } finally {
          this.loading = false
        }
      },
      // 获取场地列表
      async _listCommunitySpacePersonCommunitySpaces() {
        try {
          const params = {
            page: 1,
            row: 100,
            communityId: this.conditions.communityId
          }
          const res = await listCommunitySpace( params )
          this.spaces = res.data
        } catch (error) {
          this.$message.error(error.message || this.$t('common.fetchError'))
        }
      },
      // 查询
      _queryCommunitySpacePersonMethod() {
        this.page.current = 1
        this._listCommunitySpacePersons(this.page.current, this.page.size)
      },
      // 重置
      _resetCommunitySpacePersonMethod() {
        this.conditions = {
          spaceId: '',
          personName: '',
          personTel: '',
          appointmentTime: '',
          state: '',
          communityId: this.conditions.communityId
        }
        this._queryCommunitySpacePersonMethod()
      },
      // 打开删除确认模态框
      _openDeleteCommunitySpacePersonModel(row) {
        this.$refs.deleteDialog.open(row)
      },
      // 删除成功后刷新列表
      handleSuccess() {
        this._listCommunitySpacePersons(this.page.current, this.page.size)
      },
      // 分页大小改变
      handleSizeChange(val) {
        this.page.size = val
        this._listCommunitySpacePersons(this.page.current, val)
      },
      // 当前页改变
      handleCurrentChange(val) {
        this.page.current = val
        this._listCommunitySpacePersons(val, this.page.size)
      },
      formatTimes(times) {
        return times.map(t => t.hours).join(', ');
      }
    }
  }
  </script>
  
  <style lang="scss" scoped>
  .app-container {
    padding: 20px;
  }
  
  .clearfix:before,
  .clearfix:after {
    display: table;
    content: "";
  }
  
  .clearfix:after {
    clear: both;
  }
  
  .box-card {
    margin-bottom: 20px;
  }
  
  .el-row {
    margin-bottom: 10px;
  }
  </style>