tj
2025-06-05 bba272999cc546f65781bf3d20245a3f819af67f
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
/* eslint-disable class-methods-use-this */
import _axios, { get, put, _delete } from '@/lin/plugin/axios'
 
// 我们通过 class 这样的语法糖使模型这个概念更加具象化,其优点:耦合性低、可维护性。
class ContactInfo {
  // constructor() {}
 
  // 类中的方法可以代表一个用户行为
  async createContactInfo(data) {
    return _axios({
      method: 'post',
      url: 'v1/supplier-contact-info',
      data,
    })
  }
 
  // 在这里通过 async await 语法糖让代码同步执行
  // 1. await 一定要搭配 async 来使用
  // 2. await 后面跟的是一个 Promise 对象
  async getContactInfo(id) {
    const res = await get(`v1/supplier-contact-info/${id}`)
    return res
  }
 
  async editContactInfo(id, info) {
    const res = await put(`v1/supplier-contact-info/${id}`, info)
    return res
  }
 
  async deleteContactInfo(id) {
    const res = await _delete(`v1/supplier-contact-info/${id}`)
    return res
  }
 
  async getContactInfoList(params) {
    return _axios({
      method: 'get',
      url: 'v1/supplier-contact-info/list',
      // params:{keyword:keyword},
      params,
      handleError: true,
    })
  }
 
  async getContactInfoPage(params) {
    return _axios({
      method: 'get',
      url: 'v1/supplier-contact-info/page',
      // params:{keyword:queryForm.keyword.value,status:queryForm.status.value,stage:queryForm.stage.value,type:queryForm.type.value},
      params,
      handleError: true,
    })
  }
}
 
export default new ContactInfo()