qinxianzhangyao
2023-09-12 bb6bfe4bbe0ec84c15cd1eaebf7a55cbd11b4094
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
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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="单位名称" prop="company">
        <el-select :remote-method="getRemoteData" v-model="queryParams.company" value-key="drugManufacturerId" remote
          filterable placeholder="请选择单位名称" clearable @change="searchSelect">
          <el-option v-for="dict in CompanyList" :key="dict.drugManufacturerId" :label="dict.cnName"
            :value="dict.drugManufacturerId" />
        </el-select>
      </el-form-item>
      <!-- <el-form-item label="交易金额" prop="transactionAmount">
                <el-input v-model="queryParams.transactionAmount" placeholder="请输入交易金额" clearable
                    @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="支付方式" prop="paymentMethod">
                <el-input v-model="queryParams.paymentMethod" placeholder="请输入支付方式" clearable
                    @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="卡号" prop="cardNo">
                <el-select v-model="queryParams.cardNo" placeholder="请选择卡号(微信/支付宝填手机号;其他填银行卡号)" clearable>
                    <el-option v-for="dict in dict.type.dict_pay_type" :key="dict.value" :label="dict.label"
                        :value="dict.value" />
                </el-select>
            </el-form-item>
            <el-form-item label="交款人" prop="payer">
                <el-input v-model="queryParams.payer" placeholder="请输入交款人" clearable @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="收款人" prop="payee">
                <el-input v-model="queryParams.payee" placeholder="请输入收款人" clearable @keyup.enter.native="handleQuery" />
            </el-form-item> -->
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
 
    <!-- <el-row :gutter="10" class="mb8">
            <el-col :span="1.5">
                <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
                    v-hasPermi="['system:info:add']">新增
                </el-button>
            </el-col>
            <el-col :span="1.5">
                <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
                    v-hasPermi="['system:info:edit']">修改
                </el-button>
            </el-col>
            <el-col :span="1.5">
                <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
                    v-hasPermi="['system:info:remove']">删除
                </el-button>
            </el-col>
            <el-col :span="1.5">
                <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
                    v-hasPermi="['system:info:export']">导出
                </el-button>
            </el-col>
            <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
        </el-row> -->
 
    <el-table id="sig" v-loading="loading" :data="infoList" @selection-change="handleSelectionChange" border ref="tb"
      max-height="260px">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="部门" align="center" prop="pacName" />
      <el-table-column label="预检人数" align="center" prop="count" />
      <el-table-column label="实检人数" align="center" prop="sjCount" />
      <el-table-column label="应收金额" align="center" prop="copeWith" />
      <el-table-column label="签约金额" align="center" prop="signingPrice">
      </el-table-column>
      <el-table-column label="已付金额" align="center" prop="transactionAmount" />
      <el-table-column label="差额" align="center" prop="difference" />
      <el-table-column label="签约人" align="center" prop="payer" />
      <el-table-column label="预约时间" align="center" prop="createTime" />
    </el-table>
 
    <el-row :gutter="10" class="mb8">
      <el-col :span="16" :xs="24">
        <el-form :inline="true" :model="formInline" class="demo-form-inline" style="margin: 12px 6px">
          <el-form-item label="单位负责人">
            <el-input style="width: 120px" v-model="formInline.payer" placeholder="单位负责人"></el-input>
          </el-form-item>
          <el-form-item label="交易金额">
            <el-input style="width: 90px" v-model="formInline.price" placeholder="金额"></el-input>
          </el-form-item>
          <el-form-item label="交易类型" prop="payType">
            <el-select style="width: 160px" v-model="formInline.payType" placeholder="请选择交易类型">
              <el-option v-for="dict in dict.type.dict_pay_type" :key="dict.value" :label="dict.label"
                :value="dict.value"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item>
            <el-button style="margin-left: 15px" type="primary" size="mini" @click="SubmitEvent">收费</el-button>
          </el-form-item>
          <el-form-item>
            <el-button style="margin-left: 15px" type="primary" size="mini" @click="handleDelete">退费</el-button>
          </el-form-item>
        </el-form>
      </el-col>
    </el-row>
    <el-row :gutter="20">
      <el-col :span="12" :xs="24">
        <div class="tj">
          <span class="tj_txt">已缴费记录</span>
        </div>
 
        <el-table v-loading="loading" :data="dataList" border max-height="260px">
          <el-table-column label="交易金额" align="center" prop="transactionAmount" />
          <el-table-column label="交易方式" align="center" prop="paymentMethod" />
          <el-table-column label="交易人员" align="center" prop="payer" />
          <el-table-column label="操作人员" align="center" prop="payee">
          </el-table-column>
          <el-table-column label="操作时间" align="center" prop="createTime" />
        </el-table>
      </el-col>
      <el-col :span="12" :xs="24" style="padding: 0px 20px;">
        <div class="tj">
          <span class="tj_txt">体检人员情况表</span>
        </div>
 
        <el-table v-loading="loading" :data="peopleList" border max-height="260px">
          <el-table-column label="序号" align="center" prop="newID" />
          <el-table-column label="姓名" align="center" prop="name" />
          <el-table-column label="状态" align="center" prop="tjStatus" />
          <el-table-column label="体检时间" align="center" prop="tjTime">
          </el-table-column>
        </el-table>
      </el-col>
    </el-row>
  </div>
</template>
 
<script>
import { getInfo } from "@/api/login";
import { getCompany, queryCompany, getTeamTjPeopleList } from "@/api/team/tuanti";
 
import {
  listInfo,
  getpay,
  delInfo,
  addInfo,
  updateInfo,
} from "@/api/system/info";
 
export default {
  name: "Info",
  dicts: ["dict_pay_type"],
  data() {
    return {
      // 绑定单选按钮
      tjStatus: "0",
      formInline: {
        payer: "",
        price: "",
      },
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      tjCompPayId: "",
      // 总条数
      total: 0,
      // 体检单位缴费明细表格数据
      infoList: [],
      copeWith: "",
      transactionAmount: "",
      dataList: [],
      tableList: [],
      peopleList: [],
      // 弹出层标题
      title: "",
      CompanyList: [],
      // 是否显示弹出层
      open: false,
      compId: "",
      teamNo: "",
      // 登陆人名字
      tollCollectorName: "",
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        company: null,
        transactionAmount: null,
        paymentMethod: null,
        cardNo: null,
        payer: null,
        payee: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {},
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询体检单位缴费明细列表 */
    getList() {
      // this.loading = true;
      // listInfo(this.queryParams).then(response => {
      //     this.infoList = response.data;
      //     this.loading = false;
      // });
 
      // 获取单位信息集合
      getCompany(this.queryParam).then((response) => {
        this.CompanyList = response.data;
        this.loading = false;
      });
      // 获取登录人信息
      getInfo().then((response) => {
        this.tollCollectorName = response.user.nickName;
        this.loading = false;
      });
    },
 
    // 选框数据
    searchSelect(val) {
      this.compId = val;
    },
 
    // 体检公司拼音搜索
    getRemoteData(query) {
      if (query) {
        let compName = query;
        queryCompany(compName).then((response) => {
          this.CompanyList = response.data;
        });
      }
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        tjCompPayId: null,
        transactionAmount: null,
        paymentMethod: null,
        cardNo: null,
        payer: null,
        payee: null,
        createTime: null,
        createBy: null,
        updateTime: null,
        updateBy: null,
        deleted: null,
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.loading = true;
      listInfo(this.compId).then((response) => {
        this.infoList = response.data;
        if (this.infoList.length != 0) {
          this.infoList.forEach((item) => {
            this.$nextTick(() => {
              this.$refs.tb.toggleRowSelection(item, true);
            });
          });
        } else {
          this.$refs.tb.clearSelection();
        }
        this.infoList.forEach((item) => {
          this.copeWith = item.copeWith;
          this.transactionAmount = item.transactionAmount;
          this.formInline.price = item.copeWith - item.transactionAmount;
          if (item.payInfo != null) {
            this.tjCompPayId = item.payInfo.tjCompPayId;
          }
 
          this.formInline.payer = item.payer;
          if (item.payInfoList != null) {
            this.dataList = item.payInfoList;
            this.dataList.forEach((item) => {
              if (item.paymentMethod === 0) {
                item.paymentMethod = "现金支付";
              } else if (item.paymentMethod === 1) {
                item.paymentMethod = "刷卡支付";
              } else if (item.paymentMethod === 2) {
                item.paymentMethod = "支付宝";
              } else if (item.paymentMethod === 3) {
                item.paymentMethod = "微信";
              } else if (item.paymentMethod === 4) {
                item.paymentMethod = "云闪付";
              }
            });
          }
        });
        this.loading = false;
      });
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.tableList = selection;
      this.teamNo = ""
      this.tableList.forEach((item) => {
        this.teamNo = item.teamNo
        this.copeWith = item.copeWith;
        this.transactionAmount = item.transactionAmount;
        this.formInline.price = item.copeWith - item.transactionAmount;
        if (item.payInfo != null) {
          this.tjCompPayId = item.payInfo.tjCompPayId;
        }
        if (item.payInfoList != null) {
          this.dataList = item.payInfoList;
          this.dataList.forEach((item) => {
            if (item.paymentMethod === 0) {
              item.paymentMethod = "现金支付";
            } else if (item.paymentMethod === 1) {
              item.paymentMethod = "刷卡支付";
            } else if (item.paymentMethod === 2) {
              item.paymentMethod = "支付宝";
            } else if (item.paymentMethod === 3) {
              item.paymentMethod = "微信";
            } else if (item.paymentMethod === 4) {
              item.paymentMethod = "云闪付";
            }
          });
        }
      });
      if (this.teamNo) {
        getTeamTjPeopleList(this.teamNo).then(res => {
          if (res.data) {
            this.peopleList = res.data
            res.data.forEach((item, index) => {
              item.newID =
                (this.queryParams.pageNum - 1) * this.queryParams.pageSize +
                index +
                1;
            });
          }
 
        })
      }
      if (selection.length > 1) {
        let del_row = selection.shift();
        this.$refs.tb.toggleRowSelection(del_row, false); //设置这一行取消选中
      }
      this.ids = selection.map((item) => item.id);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
    },
    /** 新增按钮操作 */
    // handleAdd() {
    //   this.reset();
    //   this.open = true;
    //   this.title = "添加体检单位缴费明细";
    // },
 
    // 单选按钮
    radioChange(val) { },
 
    /** 收费提交按钮 */
    SubmitEvent() {
      if (this.formInline.price != 0) {
 
        let data = {
          paymentMethod: this.formInline.payType,
          transactionAmount: this.formInline.price,
          payee: this.tollCollectorName, // 收款人
          tjCompPayId: this.tjCompPayId,
          payer: this.formInline.payer,
        };
        getpay(data).then((response) => {
          this.$modal.msgSuccess("操作成功");
          this.handleQuery();
          const tjnumber = this.waterId;
          const viewNum = this.mobanId;
          const params = { viewNum, tjnumber };
          this.$tab.openPage("团检小票", "/report/charge", params);
        });
 
      } else {
        this.$message.error("交易金额不能为0");
      }
    },
 
    /** 退费按钮操作 */
    handleDelete() {
      if (this.formInline.price != 0) {
        if (this.formInline.price < this.transactionAmount) {
          let data = {
            paymentMethod: this.formInline.payType,
            transactionAmount: this.formInline.price,
            payee: this.tollCollectorName, // 收款人
            tjCompPayId: this.tjCompPayId,
            payer: this.formInline.payer,
          };
          addInfo(data).then((response) => {
            this.$modal.msgSuccess("操作成功");
            this.handleQuery();
          });
        } else {
          this.$message.error("超出已付金额,退费失败");
        }
      } else {
        this.$message.error("退费金额不能为0");
      }
    },
    /** 导出按钮操作 */
    handleExport() { },
  },
};
</script>
 
<style>
#sig .el-table__header-wrapper .el-checkbox {
  display: none;
}
 
.mb8 {
  margin-top: 10px;
}
 
.tj {
  margin-top: 8px;
}
 
.tj_txt {
  display: flex;
  justify-content: center;
  margin-bottom: 15px;
}
</style>