yj
2024-12-05 ac3234c308e86f20cc63465573f321561ee00690
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
import request from '@/utils/request'
import Qs from 'qs'
 
export function getSpuBigTree() {
  return request({
    method: 'get',
    params: {
      _gp: 'admin.product',
      _mt: 'getSpuBigTree'
    }
  })
}
 
/**
 * 通过CategoryId, 列举出商品Id和商品标题
 * @param {int} categoryId
 */
export function listProductIdAndTitleByCategoryId(categoryId) {
  return request({
    method: 'get',
    params: {
      _gp: 'admin.product',
      _mt: 'listByCategory',
      categoryId
    }
  })
}
 
export function listProduct(query) {
  return request({
    method: 'get',
    params: {
      _gp: 'admin.product',
      _mt: 'list',
      ...query
    }
  })
}
 
export function editProduct(data) {
  return request({
    method: 'post',
    data: Qs.stringify({
      _gp: 'admin.product',
      _mt: 'edit',
      spuDTO: JSON.stringify(data)
    })
  })
}
 
export function deleteProduct(id) {
  return request({
    method: 'post',
    params: {
      _gp: 'admin.product',
      _mt: 'delete',
      spuId: id
    }
  })
}
 
export function batchDeleteProduct(ids) {
  return request({
    method: 'post',
    data: Qs.stringify({
      _gp: 'admin.product',
      _mt: 'batchDelete',
      ids: JSON.stringify(ids)
    })
  })
}
 
export function createProduct(data) {
  return request({
    method: 'post',
    data: Qs.stringify({
      _gp: 'admin.product',
      _mt: 'create',
      spuDTO: JSON.stringify(data)
    })
  })
}
 
export function detailProduct(id) {
  return request({
    method: 'get',
    params: {
      _gp: 'admin.product',
      _mt: 'detail',
      spuId: id
    }
  })
}
 
export function freezeOrActivtion(id, status) {
  return request({
    method: 'post',
    data: Qs.stringify({
      _gp: 'admin.product',
      _mt: 'freezeOrActivation',
      spuId: id,
      status: status
    })
  })
}
 
export function rebuildProductCache() {
  return request({
    method: 'post',
    data: Qs.stringify({
      _gp: 'admin.product',
      _mt: 'rebuildProductCache'
    })
  })
}