qx
9 小时以前 ad54cf427ee94e01e8c72a01f738615eb2b6569d
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
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
<template>
  <div class="app-container">
    <div class="grid-content bg-purple">
      <el-form
        :inline="true"
        ref="form"
        :model="form"
        class="demo-form-inline"
        label-width="78px"
      >
        <el-form-item label="姓名" prop="tjName">
          <el-input v-model="form.tjName" placeholder="请输入姓名" />
        </el-form-item>
 
        <el-form-item label="体检号" prop="tjNum">
          <el-input
            ref="inputName"
            v-model="form.tjNum"
            placeholder="请输入体检号"
            @keyup.enter.native="submitFormchanck"
            @blur="hb"
          />
        </el-form-item>
 
        <el-form-item label="联系电话" prop="tjPhone">
          <el-input v-model="form.tjPhone" placeholder="请输入联系电话" />
        </el-form-item>
 
        <el-form-item>
          <el-button
            style="margin-left: 40px"
            type="primary"
            size="mini"
            @click="submitFormchanck"
            >搜索</el-button
          >
          <el-button
            style="margin-left: 10px"
            type="primary"
            size="mini"
            @click="resetQuery"
            >重置</el-button
          >
        </el-form-item>
      </el-form>
    </div>
 
    <el-table
      id="sig"
      v-loading="loading"
      :data="tableData"
      @selection-change="handleSelect"
      tooltip-effect="dark"
      ref="multipleTable"
      border
    >
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column
        label="姓名"
        align="center"
        prop="tjName"
        width="110px"
      />
      <el-table-column label="性别" align="center" prop="sex" width="100px" />
      <el-table-column
        label="身份证"
        align="center"
        prop="idCard"
        width="170px"
        :show-overflow-tooltip="true"
      ></el-table-column>
      <el-table-column
        label="手机号"
        align="center"
        prop="tjPhone"
        width="120px"
        :show-overflow-tooltip="true"
      ></el-table-column>
      <el-table-column
        label="体检号"
        align="center"
        prop="tjNumber"
        width="160px"
      />
      <el-table-column
        label="登记时间"
        align="center"
        prop="tjFlowingWater.createTime"
        :show-overflow-tooltip="true"
      ></el-table-column>
      <el-table-column
        label="单位名称"
        align="center"
        prop="tjComp"
      ></el-table-column>
      <el-table-column
        label="体检类型"
        align="center"
        prop="tjType"
        width="80px"
      ></el-table-column>
      <el-table-column
        label="订单流水号"
        align="center"
        prop="tjFlowingWater.waterId"
        width="230px"
      />
      <el-table-column
        label="收费员"
        align="center"
        prop="tjFlowingWater.updateBy"
        width="100px"
      />
    </el-table>
 
    <el-radio-group
      v-model="tjStatus"
      @input="radioChange"
      style="margin: 12px 6px"
    >
      <el-radio-button label="0">未缴费</el-radio-button>
      <el-radio-button label="1">已缴费</el-radio-button>
    </el-radio-group>
 
    <el-form
      :inline="true"
      :model="formInline"
      class="demo-form-inline"
      label-width="96px"
    >
      <el-row>
        <el-col :span="7">
          <el-form-item label="应收金额" style="display: flex">
            <el-input
              :value="formInline.price + '.00'"
              placeholder="金额"
              :disabled="true"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="优惠" style="display: flex">
            <!-- <el-input style="width: 90px" type="number" v-model="discount" :value="discount"></el-input> -->
            <el-input-number
              style="width: 100%"
              v-model="discount"
              :precision="2"
              :step="0.1"
              :max="10"
              :min="1"
              @change="numberChange"
              :disabled="isfalse"
            ></el-input-number>
          </el-form-item>
        </el-col>
 
        <!-- <el-form-item label="折扣">
                        <el-input style="width:100px" type="number"  v-model="formInline.discount" placeholder="请输入折扣"></el-input>
                    </el-form-item> -->
        <el-col :span="7">
          <el-form-item label="实收金额" style="display: flex">
            <el-input v-model="formInline.paidIn" placeholder="实付">
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :span="7">
          <el-form-item label="付款类型" prop="payType" style="display: flex">
            <el-select
              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-col>
        <el-col :span="3">
          <el-form-item>
            <el-button
              type="primary"
              size="mini"
              :disabled="disabled == 1 ? true : false"
              @click="SubmitEvent"
              >收费</el-button
            >
          </el-form-item>
          <!-- <el-form-item>
            <el-button
              type="primary"
              size="mini"
              :disabled="disabled == 0 ? true : false"
              @click="tuifei"
              >退费</el-button
            >
          </el-form-item> -->
        </el-col>
      </el-row>
    </el-form>
 
    <el-table v-loading="loading" :data="tableList" border>
      <el-table-column type="index" width="50"> </el-table-column>
      <el-table-column label="项目名称" align="center" prop="proName" />
      <el-table-column label="应收金额" align="center" prop="proOrdPrice" />
      <el-table-column label="实收金额" align="center" prop="proPrice" />
    </el-table>
  </div>
</template>
 
<script>
import {
  getByTjNum,
  getfindTj,
  getwaterSupper,
  getpay,
} from "@/api/hosp/customer";
import { getInfo } from "@/api/login";
export default {
  dicts: ["dict_pay_type"],
  name: "Tijian",
 
  data() {
    return {
      tjnumber: "",
      formInline: {
        price: "0",
        payType: "0",
        paidIn: "0.00",
      },
      discount: 10,
      tjProIds: [],
      customer: {},
      refundPros: [],
      standard: {},
      adviceList: [],
      // 遮罩层
      loading: false,
      disabled: 0,
      isDisabled: false,
      // 绑定单选按钮
      tjStatus: "0",
      OrderId: "",
      tcShow: false,
      // 套餐提交按钮
      confirm: false,
      TotalPrice: 0,
      // 表格
      tableData: [],
      activeName: "1",
      DataList: [],
      tableList: [],
      list: [],
      // 选中数组
      ids: [],
      getInfodis: "",
      // 显示搜索条件
      showSearch: true,
      socket: null,
      waterId: "",
      tollCollectorName: "",
      tjSerialNumber: "",
      isfalse: false,
      // 表单参数
      form: {
        tjNum: "",
        tjName: "",
        tjPhone: "",
      },
    };
  },
  created() {
    this.getList();
  },
  methods: {
    getList() {
      this.$nextTick(() => {
        this.$refs.inputName.focus();
      });
      getInfo().then((response) => {
        this.getInfodis = response.user.discount;
        if (this.getInfodis === null) {
          this.isfalse = true;
        }
      });
    },
    hb() {
      console.log(this.form.tjNum);
      if (this.form.tjNum != "") {
        this.submitFormchanck();
      }
    },
    submitFormchanck() {
      this.loading = true;
      getfindTj(this.form).then((response) => {
        if (response.data != []) {
          this.tableData = response.data;
          this.tableData.forEach((item1) => {
            this.tjnumber = item1.tjNumber;
          });
          if (this.tableData.length != 0) {
            this.$nextTick(() => {
              this.$refs.multipleTable.toggleRowSelection(
                this.tableData[0],
                true
              );
            });
          } else {
            this.$refs.multipleTable.clearSelection();
          }
          this.tableData.forEach((item) => {
            if (item.isAdditionCollectFees === "N") {
              item.isAdditionCollectFees = "否";
            } else {
              item.isAdditionCollectFees = "是";
            }
            if (item.tjType === "2") {
              item.tjType = "个人";
            } else {
              item.tjType = "团队";
            }
            if (item.sex === "0") {
              item.sex = "男";
            } else if (item.sex === "1") {
              item.sex = "女";
            } else {
              item.sex = "未知";
            }
          });
        } else {
          this.tableData = [];
          this.disabled = 1;
        }
 
        this.loading = false;
      });
    },
    //重置按钮
    resetQuery() {
      this.$tab.refreshPage();
    },
 
    // 表格单选
    handleSelect(selection, val) {
      this.DataList = this.$refs.multipleTable.selection;
      this.DataList.forEach((item) => {
        this.OrderId = item.tjOrderId;
        if (item.tjFlowingWater != null) {
          this.waterId = item.tjFlowingWater.waterId;
          this.tollCollectorName = item.tjFlowingWater.updateBy;
          this.tjSerialNumber = item.tjFlowingWater.tjSerialNumber;
        }
        this.customer = {
          cusIdcard: item.idCard,
          cusName: item.tjName,
          cusPhone: item.tjPhone,
          cusSex: item.sex === "男" ? "0" : "1",
        };
        if (item.tjComp != null) {
          this.standard = {
            company: item.tjComp,
            tjType: item.tjType === "团队" ? "1" : "2",
          };
        } else {
          this.standard = {
            tjType: item.tjType === "团队" ? "1" : "2",
          };
        }
      });
      if (selection.length > 1) {
        let del_row = selection.shift();
        this.$refs.multipleTable.toggleRowSelection(del_row, false);
      }
      let data = {
        type: this.tjStatus,
        OrderId: this.OrderId,
        tjSerialNumber: this.tjSerialNumber,
      };
      getByTjNum(data).then((response) => {
        if (response.data) {
          this.tableList = response.data;
          this.formInline.price = 0;
          this.adviceList = [];
          if (this.tableList.length != 0) {
            this.tableList.forEach((item) => {
              this.adviceList.push({
                proId: item.proId,
                proName: item.proName,
              });
              if (this.formInline.price) {
                this.formInline.price += item.proOrdPrice;
                this.formInline.paidIn += item.proPrice;
              } else {
                this.formInline.price = item.proOrdPrice;
                this.formInline.paidIn = item.proPrice;
              }
            });
            const r = /^\+?[0-9][0-9]*$/; //正整数(可以以打头)
            //const r=/^\+?[1-9][0-9]*$/;//正整数
            if (r.test(this.formInline.paidIn)) {
              this.formInline.paidIn = this.formInline.paidIn + ".00";
            }
            this.discount =
              (this.formInline.paidIn / this.formInline.price) * 10;
            if (this.discount <= this.getInfodis) {
              this.discount = this.getInfodis;
            }
          } else {
            this.discount = 10;
            this.formInline.paidIn = "0.00";
          }
 
          this.total = response.data.total;
        } else {
          this.tableList = [];
        }
      });
    },
 
    // 折扣
    numberChange(currentValue, oldValue) {
      this.discount = currentValue;
      if (this.discount <= this.getInfodis) {
        this.discount = this.getInfodis;
      }
      this.formInline.paidIn = (
        this.formInline.price *
        (this.discount / 10)
      ).toFixed(2);
      const r = /^\+?[0-9][0-9]*$/; //正整数(可以以打头)
      //const r=/^\+?[1-9][0-9]*$/;//正整数
      if (r.test(this.formInline.paidIn)) {
        this.formInline.paidIn = this.formInline.paidIn + ".00";
      }
    },
 
    // 单选按钮
    radioChange(val) {
      this.disabled = val;
      if (this.tableData.length != 0) {
        let data = {
          type: this.tjStatus,
          OrderId: this.OrderId,
          tjSerialNumber: this.tjSerialNumber,
        };
        getByTjNum(data).then((response) => {
          if (response.data) {
            this.tableList = response.data;
            this.formInline.price = 0;
            this.adviceList = [];
            if (this.tableList.length != 0) {
              this.tableList.forEach((item) => {
                this.adviceList.push({
                  proId: item.proId,
                  proName: item.proName,
                });
                if (this.formInline.price) {
                  this.formInline.price += item.proOrdPrice;
                  this.formInline.paidIn += item.proPrice;
                } else {
                  this.formInline.price = item.proOrdPrice;
                  this.formInline.paidIn = item.proPrice;
                }
              });
              const r = /^\+?[0-9][0-9]*$/; //正整数(可以以打头)
              //const r=/^\+?[1-9][0-9]*$/;//正整数
              if (r.test(this.formInline.paidIn)) {
                this.formInline.paidIn = this.formInline.paidIn + ".00";
              }
              this.discount =
                (this.formInline.paidIn / this.formInline.price) * 10;
            } else {
              this.discount = 10;
              this.formInline.paidIn = "0.00";
            }
 
            this.total = response.data.total;
          } else {
            this.tableList = [];
          }
        });
      } else {
        this.$message({
          type: "warning ",
          message: "请先查询客户信息!",
        });
      }
    },
 
    // 表单重置
    reset() {
      this.form = {
        tjNum: null,
        tjName: null,
        tjPhone: null,
      };
      this.resetForm("form");
    },
 
    // 收费
    SubmitEvent() {
      if (this.tableData.length != 0) {
        this.refundPros.push(
          { standard: this.standard },
          { adviceList: this.adviceList }
        );
        let data = {
          paidIn: this.formInline.paidIn,
          discount: this.discount,
          copeWith: this.formInline.price,
          waterId: this.waterId,
          tollCollectorName: this.tollCollectorName,
          tjSerialNumber: this.tjSerialNumber,
          payType: this.formInline.payType,
          customer: this.customer,
          refundPros: this.refundPros,
          orderId: this.OrderId,
        };
        getwaterSupper(data).then((res) => {
          if (res.msg != "该订单已付款 无须再付") {
            this.$modal.msgSuccess("操作成功");
            this.disabled = 1;
            if (res.data) {
              this.mobanId = res.data.mobanId;
              this.waterId = res.data.waterId;
              const tjnumber = this.waterId;
              const viewNum = this.mobanId;
              const params = { viewNum, tjnumber };
              this.$tab.openPage("收款小票", "/report/charge", params);
            }
          } else {
            this.$message({
              type: "warning ",
              message: "res.msg",
            });
          }
        });
      } else {
        this.$message({
          type: "warning ",
          message: "请先查询客户信息!",
        });
      }
    },
    // 退费
    tuifei() {},
  },
};
</script>
 
<style>
#sig .el-table__header-wrapper .el-checkbox {
  display: none;
}
</style>