@cpzxrobot/sdk 1.2.18 → 1.2.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26,18 +26,6 @@ export class ContractGateway extends Object {
26
26
  }
27
27
 
28
28
 
29
- addForProject(args: any) {
30
- return this.context.ready.then((axios) => {
31
- return axios.post(`/api/v2/coremde-sale/contract/project/add`, args);
32
- });
33
- }
34
-
35
- addForProduct(args: any) {
36
- return this.context.ready.then((axios) => {
37
- return axios.post(`/api/v2/coremde-sale/contract/product/add`, args);
38
- });
39
- }
40
-
41
29
  add(args: any) {
42
30
  return this.context.ready.then((axios) => {
43
31
  return axios.post(`/api/v2/coremde-sale/contract/add`, args);
@@ -72,4 +60,66 @@ export class ContractGateway extends Object {
72
60
  });
73
61
  }
74
62
 
63
+ get project() {
64
+ return {
65
+ addContract: (args: any) => {
66
+ return this.context.ready.then((axios) => {
67
+ return axios.post(`/api/v2/coremde-sale/contract/project/add`, args);
68
+ });
69
+ },
70
+ addPayment: (args: {
71
+ createTime: string;
72
+ createUserId: number;
73
+ updateTime: string;
74
+ updateUserId: number;
75
+ companyId: number;
76
+ contractId: number;
77
+ receivedPayments: number;
78
+ receivedPerson: string;
79
+ receiveDate: string;
80
+ remark: string;
81
+ }) => {
82
+ return this.context.ready.then((axios) => {
83
+ return axios.post(`/api/v2/coremde-sale/contract/project/payment/add`, args);
84
+ });
85
+ },
86
+ listPayments: (id: number) => {
87
+ return this.context.ready.then((axios) => {
88
+ return axios.get(`/api/v2/coremde-sale/contract/project/payment/list?id=${id}`);
89
+ });
90
+ }
91
+ }
92
+ }
93
+
94
+ get product() {
95
+ return {
96
+ addContract: (args: any) => {
97
+ return this.context.ready.then((axios) => {
98
+ return axios.post(`/api/v2/coremde-sale/contract/product/add`, args);
99
+ });
100
+ },
101
+ addPayment: (args: {
102
+ createTime: string;
103
+ createUserId: number;
104
+ updateTime: string;
105
+ updateUserId: number;
106
+ companyId: number;
107
+ contractId: number;
108
+ receivedPayments: number;
109
+ receivedPerson: string;
110
+ receiveDate: string;
111
+ remark: string;
112
+ }) => {
113
+ return this.context.ready.then((axios) => {
114
+ return axios.post(`/api/v2/coremde-sale/contract/product/payment/add`, args);
115
+ });
116
+ },
117
+ listPayments: (id: number) => {
118
+ return this.context.ready.then((axios) => {
119
+ return axios.get(`/api/v2/coremde-sale/contract/product/payment/list?id=${id}`);
120
+ });
121
+ }
122
+ }
123
+ }
124
+
75
125
  }
@@ -73,6 +73,13 @@ export class CustomerGateway extends Object {
73
73
  });
74
74
  }
75
75
 
76
+ ///contact/list
77
+ contact(id: number) {
78
+ return this.context.ready.then((axios) => {
79
+ return axios.get(`/api/v2/coremde-sale/customer/contact/list?id=${id}`);
80
+ });
81
+ }
82
+
76
83
  get visit() {
77
84
  return {
78
85
  add: (args: any) => {
@@ -16,16 +16,6 @@ class ContractGateway extends Object {
16
16
  return axios.get(`/api/v2/coremde-sale/contract/get?id=${id}`);
17
17
  });
18
18
  }
19
- addForProject(args) {
20
- return this.context.ready.then((axios) => {
21
- return axios.post(`/api/v2/coremde-sale/contract/project/add`, args);
22
- });
23
- }
24
- addForProduct(args) {
25
- return this.context.ready.then((axios) => {
26
- return axios.post(`/api/v2/coremde-sale/contract/product/add`, args);
27
- });
28
- }
29
19
  add(args) {
30
20
  return this.context.ready.then((axios) => {
31
21
  return axios.post(`/api/v2/coremde-sale/contract/add`, args);
@@ -55,5 +45,43 @@ class ContractGateway extends Object {
55
45
  return axios.get(`/api/v2/coremde-sale/contract/types`);
56
46
  });
57
47
  }
48
+ get project() {
49
+ return {
50
+ addContract: (args) => {
51
+ return this.context.ready.then((axios) => {
52
+ return axios.post(`/api/v2/coremde-sale/contract/project/add`, args);
53
+ });
54
+ },
55
+ addPayment: (args) => {
56
+ return this.context.ready.then((axios) => {
57
+ return axios.post(`/api/v2/coremde-sale/contract/project/payment/add`, args);
58
+ });
59
+ },
60
+ listPayments: (id) => {
61
+ return this.context.ready.then((axios) => {
62
+ return axios.get(`/api/v2/coremde-sale/contract/project/payment/list?id=${id}`);
63
+ });
64
+ }
65
+ };
66
+ }
67
+ get product() {
68
+ return {
69
+ addContract: (args) => {
70
+ return this.context.ready.then((axios) => {
71
+ return axios.post(`/api/v2/coremde-sale/contract/product/add`, args);
72
+ });
73
+ },
74
+ addPayment: (args) => {
75
+ return this.context.ready.then((axios) => {
76
+ return axios.post(`/api/v2/coremde-sale/contract/product/payment/add`, args);
77
+ });
78
+ },
79
+ listPayments: (id) => {
80
+ return this.context.ready.then((axios) => {
81
+ return axios.get(`/api/v2/coremde-sale/contract/product/payment/list?id=${id}`);
82
+ });
83
+ }
84
+ };
85
+ }
58
86
  }
59
87
  exports.ContractGateway = ContractGateway;
@@ -54,6 +54,12 @@ class CustomerGateway extends Object {
54
54
  });
55
55
  });
56
56
  }
57
+ ///contact/list
58
+ contact(id) {
59
+ return this.context.ready.then((axios) => {
60
+ return axios.get(`/api/v2/coremde-sale/customer/contact/list?id=${id}`);
61
+ });
62
+ }
57
63
  get visit() {
58
64
  return {
59
65
  add: (args) => {
package/dist/index.js CHANGED
@@ -25,6 +25,7 @@ const company_gateway_1 = require("./company_gateway");
25
25
  const news_gateway_1 = require("./news_gateway");
26
26
  const logs_gateway_1 = require("./logs_gateway");
27
27
  const robot_gateway_1 = require("./robot_gateway");
28
+ const quotation_gateway_1 = require("./quotation_gateway");
28
29
  class Cpzxrobot {
29
30
  constructor(appCode) {
30
31
  this.pigfarm = new pigfarm_gateway_1.PigfarmGateway(this);
@@ -42,6 +43,7 @@ class Cpzxrobot {
42
43
  this.news = new news_gateway_1.NewsGateway(this);
43
44
  this.logs = new logs_gateway_1.LogsGateway(this);
44
45
  this.robot = new robot_gateway_1.RobotGateway(this);
46
+ this.quotation = new quotation_gateway_1.QuotationGateway(this);
45
47
  //获取当前浏览器的域名
46
48
  this.ready = new Promise((resolve, reject) => {
47
49
  this.resolveReady = resolve;
@@ -362,7 +364,7 @@ class Cpzxrobot {
362
364
  const token = localStorage.getItem("token");
363
365
  if (token) {
364
366
  this.token = token;
365
- this.initAxios(baseURL);
367
+ this.initAxios("https://www.cpzxrobot.com");
366
368
  this.axios.get("/api/v1/user/auth").then((res) => {
367
369
  if (res.data.Error) {
368
370
  window.location.href = "/login.html?error=" + res.data.Error;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.QuotationGateway = void 0;
4
+ class QuotationGateway extends Object {
5
+ constructor(context) {
6
+ super();
7
+ this.context = context;
8
+ }
9
+ list(args) {
10
+ return this.context.ready.then((axios) => {
11
+ return axios.post(`/api/v2/coremde-sale/quotation/list`, args);
12
+ });
13
+ }
14
+ add(args) {
15
+ return this.context.ready.then((axios) => {
16
+ return axios.post(`/api/v2/coremde-sale/quotation/add`, args);
17
+ });
18
+ }
19
+ get(id) {
20
+ return this.context.ready.then((axios) => {
21
+ return axios.get(`/api/v2/coremde-sale/quotation/get?id=${id}`);
22
+ });
23
+ }
24
+ update(args) {
25
+ return this.context.ready.then((axios) => {
26
+ return axios.post(`/api/v2/coremde-sale/quotation/update`, args);
27
+ });
28
+ }
29
+ delete(id) {
30
+ return this.context.ready.then((axios) => {
31
+ return axios.get(`/api/v2/coremde-sale/quotation/delete?id=${id}`);
32
+ });
33
+ }
34
+ transform(id) {
35
+ return this.context.ready.then((axios) => {
36
+ return axios.get(`/api/v2/coremde-sale/quotation/transform?id=${id}`);
37
+ });
38
+ }
39
+ }
40
+ exports.QuotationGateway = QuotationGateway;
package/index.ts CHANGED
@@ -20,6 +20,7 @@ import { CompanyGateway } from "./company_gateway";
20
20
  import { NewsGateway } from "./news_gateway";
21
21
  import { LogsGateway } from "./logs_gateway";
22
22
  import { RobotGateway } from "./robot_gateway";
23
+ import { QuotationGateway } from "./quotation_gateway";
23
24
 
24
25
  export class Cpzxrobot {
25
26
  device: DeviceGateway;
@@ -70,6 +71,7 @@ export class Cpzxrobot {
70
71
  news: NewsGateway = new NewsGateway(this);
71
72
  logs: LogsGateway = new LogsGateway(this);
72
73
  robot: RobotGateway = new RobotGateway(this);
74
+ quotation: QuotationGateway = new QuotationGateway(this);
73
75
 
74
76
 
75
77
  constructor(appCode: string) {
@@ -414,7 +416,7 @@ export class Cpzxrobot {
414
416
  const token = localStorage.getItem("token");
415
417
  if (token) {
416
418
  this.token = token;
417
- this.initAxios(baseURL);
419
+ this.initAxios("https://www.cpzxrobot.com");
418
420
  this.axios.get("/api/v1/user/auth").then((res) => {
419
421
  if (res.data.Error) {
420
422
  window.location.href = "/login.html?error=" + res.data.Error;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.2.18",
3
+ "version": "1.2.20",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -0,0 +1,52 @@
1
+
2
+ import { Cpzxrobot } from "./types";
3
+
4
+ export class QuotationGateway extends Object {
5
+ context: Cpzxrobot;
6
+
7
+ constructor(context: Cpzxrobot) {
8
+ super();
9
+ this.context = context;
10
+ }
11
+
12
+ list(args: {
13
+ pageNo: number;
14
+ pageSize: number;
15
+ name?: string;
16
+ companyId?: number;
17
+ }) {
18
+ return this.context.ready.then((axios) => {
19
+ return axios.post(`/api/v2/coremde-sale/quotation/list`, args);
20
+ });
21
+ }
22
+
23
+ add(args: any) {
24
+ return this.context.ready.then((axios) => {
25
+ return axios.post(`/api/v2/coremde-sale/quotation/add`, args);
26
+ });
27
+ }
28
+
29
+ get(id: number) {
30
+ return this.context.ready.then((axios) => {
31
+ return axios.get(`/api/v2/coremde-sale/quotation/get?id=${id}`);
32
+ });
33
+ }
34
+
35
+ update(args: any) {
36
+ return this.context.ready.then((axios) => {
37
+ return axios.post(`/api/v2/coremde-sale/quotation/update`, args);
38
+ });
39
+ }
40
+
41
+ delete(id: number) {
42
+ return this.context.ready.then((axios) => {
43
+ return axios.get(`/api/v2/coremde-sale/quotation/delete?id=${id}`);
44
+ });
45
+ }
46
+
47
+ transform(id: number) {
48
+ return this.context.ready.then((axios) => {
49
+ return axios.get(`/api/v2/coremde-sale/quotation/transform?id=${id}`);
50
+ });
51
+ }
52
+ }
package/readme.md CHANGED
@@ -534,6 +534,23 @@ cpzxrobot().product.price.add({
534
534
  })
535
535
  ```
536
536
 
537
+ ### 报价单管理
538
+ #### 报价单基础操作
539
+ ```javascript
540
+ // 获取报价单列表
541
+ cpzxrobot().quotation.list({
542
+ pageNo: number,
543
+ pageSize: number,
544
+ name?: string,
545
+ companyId?: number
546
+ })
547
+
548
+ // 创建报价单
549
+ cpzxrobot().quotation.add({
550
+ // 报价单数据
551
+ })
552
+ ```
553
+
537
554
  ### 合同管理
538
555
  #### 合同基础操作
539
556
  ```javascript
@@ -793,8 +810,8 @@ baseURL: "/"
793
810
  | cpzxrobot().user.list | 列出用户(传入工厂) |
794
811
  | cpzxrobot().user.info | 获取用户信息,传入userId参数 |
795
812
  | cpzxrobot().user.listByRole | 列出用户(传入公司和角色) |
796
- | cpzxrobot().user.approval.list | 获取用户审批列表,传入userId和status参数 |
797
- | cpzxrobot().user.approval.count | 获取用户审批列表的数量,传入userId和status参数 |
813
+ | cpzxrobot().user.approval.count | 获list | 获取用户审批列表,传入userId和status参数 |
814
+ | cpzxrobot().user.approval.取用户审批列表的数量,传入userId和status参数 |
798
815
  | cpzxrobot().user.approval.submits | 获取已提交的用户审批 |
799
816
  | cpzxrobot().user.checkin.add | 添加用户签到记录,传入userId和address参数 |
800
817
  | cpzxrobot().user.checkin.list | 列出用户签到记录,传入userId和date参数 |
@@ -866,6 +883,7 @@ baseURL: "/"
866
883
  | cpzxrobot().customer.stat.totalCount | 统计客户总数 |
867
884
  | cpzxrobot().customer.stat.amount | 统计追踪、在建阶段的项目金额 |
868
885
  | cpzxrobot().customer.stat.project | 追踪项目统计 |
886
+ | cpzxrobot().customer.contact | 获取客户联系人信息 |
869
887
  | cpzxrobot().company.list | 获得公司列表,传入必要的分页参数 |
870
888
  | cpzxrobot().company.rank.byRevenue | 按公司营收获取排名,传入必要的分页参数 |
871
889
  | cpzxrobot().company.rank.byProfit | 按公司利润获取排名,传入必要的分页参数 |
package/types.d.ts CHANGED
@@ -15,6 +15,7 @@ import { CustomerGateway } from "@cpzxrobot/sdk/customer_gateway";
15
15
  import { CompanyGateway } from "@cpzxrobot/sdk/company_gateway";
16
16
  import { LogsGateway } from "@cpzxrobot/sdk/logs_gateway";
17
17
  import { RobotGateway } from "@cpzxrobot/sdk/robot_gateway";
18
+ import { QuotationGateway } from "./quotation_gateway";
18
19
 
19
20
  type Device = {
20
21
  id: number;
@@ -333,6 +334,7 @@ class Cpzxrobot {
333
334
  company: CompanyGateway;
334
335
  logs: LogsGateway;
335
336
  robot: RobotGateway;
337
+ quotation: QuotationGateway;
336
338
  dict: (key: string) => any;
337
339
  _getSelectedFarmFromMiniApp: () => Promise<Factory>;
338
340
  _getSelectedUnitFromMiniApp: () => Promise<Unit>;