Blame view

src/api/work/finishRepairApi.js 1.92 KB
72de60dc   wuxw   优化报修完成
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 request from '@/utils/request'
  import { getCommunityId } from '@/api/community/communityApi'
  
  // 获取资源类型列表
  export function listResourceStoreTypes(params) {
    return new Promise((resolve, reject) => {
      const communityId = getCommunityId()
      request({
        url: '/resourceStoreType.listResourceStoreTypes',
        method: 'get',
        params: {
          ...params,
          communityId
        }
      }).then(response => {
        const res = response.data
        resolve(res)
      }).catch(error => {
        reject(error)
      })
    })
  }
  
  // 获取用户仓库商品列表
  export function listUserStorehouses(params) {
    return new Promise((resolve, reject) => {
      const communityId = getCommunityId()
      request({
        url: '/resourceStore.listUserStorehouses',
        method: 'get',
        params: {
          ...params,
          communityId
        }
      }).then(response => {
        const res = response.data
        resolve(res)
      }).catch(error => {
        reject(error)
      })
    })
  }
  
  // 完成报修
  export function repairFinish(data) {
    return new Promise((resolve, reject) => {
      const communityId = getCommunityId()
      request({
        url: '/ownerRepair.repairFinish',
        method: 'post',
        data: {
          ...data,
          communityId
        }
      }).then(response => {
        const res = response.data
        resolve(res)
      }).catch(error => {
        reject(error)
      })
    })
  }
  
  // 上传文件
  export function uploadFile(data) {
    return new Promise((resolve, reject) => {
      const communityId = getCommunityId()
      const formData = new FormData()
      formData.append('uploadFile', data.file)
      formData.append('communityId', communityId)
      
      request({
        url: '/uploadFile',
        method: 'post',
        data: formData,
        headers: {
          'Content-Type': 'multipart/form-data'
        }
      }).then(response => {
        const res = response.data
        resolve(res)
      }).catch(error => {
        reject(error)
      })
    })
  }