wangzhibo
4 天以前 c19f1f7e21c93d1f13b4f44a8a615f65af577559
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
import {
  CoolController,
  BaseController,
  CoolUrlTag,
  TagTypes,
  CoolTag,
} from '@cool-midway/core';
import { Body, Inject, Post } from '@midwayjs/core';
import { ShopSorterService } from '../../service/sorter';
 
/**
 * 分拣员 App
 */
@CoolUrlTag()
@CoolController()
export class AppShopSorterController extends BaseController {
  @Inject()
  shopSorterService: ShopSorterService;
 
  @CoolTag(TagTypes.IGNORE_TOKEN)
  @Post('/checkUser', { summary: '扫描回收码校验平台用户' })
  async checkUser(@Body('unionid') unionid: string) {
    return this.ok(await this.shopSorterService.checkUser(unionid));
  }
 
  @CoolTag(TagTypes.IGNORE_TOKEN)
  @Post('/checkIn', { summary: '打卡积分' })
  async checkIn(
    @Body() body: { unionid: string; sorterId: string }
  ) {
    return this.ok(await this.shopSorterService.checkIn(body));
  }
 
  @CoolTag(TagTypes.IGNORE_TOKEN)
  @Post('/itemList', { summary: '回收品类列表' })
  async itemList(@Body('sorterId') sorterId: string) {
    return this.ok(await this.shopSorterService.itemList(sorterId));
  }
 
  @CoolTag(TagTypes.IGNORE_TOKEN)
  @Post('/saveOrder', { summary: '保存现场或预约回收清单' })
  async saveOrder(
    @Body()
    body: {
      sorterId: string;
      unionid: string;
      appointmentId?: number;
      items: any[];
    }
  ) {
    return this.ok(await this.shopSorterService.saveOrder(body));
  }
 
  @CoolTag(TagTypes.IGNORE_TOKEN)
  @Post('/appointmentPage', { summary: '预约回收订单分页' })
  async appointmentPage(@Body() body) {
    return this.ok(await this.shopSorterService.appointmentPage(body));
  }
 
  @CoolTag(TagTypes.IGNORE_TOKEN)
  @Post('/confirmAppointment', { summary: '确认预约单' })
  async confirmAppointment(
    @Body() body: { id: number; sorterId: string }
  ) {
    return this.ok(await this.shopSorterService.confirmAppointment(body));
  }
 
  @CoolTag(TagTypes.IGNORE_TOKEN)
  @Post('/claimAppointment', { summary: '领取预约单到自己名下' })
  async claimAppointment(
    @Body() body: { id: number; sorterId: string }
  ) {
    return this.ok(await this.shopSorterService.claimAppointment(body));
  }
 
  @CoolTag(TagTypes.IGNORE_TOKEN)
  @Post('/scanAppointment', { summary: '扫描预约单' })
  async scanAppointment(
    @Body('appointmentNo') appointmentNo: string,
    @Body('sorterId') sorterId: string
  ) {
    return this.ok(
      await this.shopSorterService.scanAppointment(appointmentNo, sorterId)
    );
  }
}