property.ts 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. import request from '@/config/axios'
  2. /**
  3. * 商品属性
  4. */
  5. export interface PropertyVO {
  6. id?: number
  7. /** 名称 */
  8. name: string
  9. /** 备注 */
  10. remark?: string
  11. }
  12. /**
  13. * 属性值
  14. */
  15. export interface PropertyValueVO {
  16. id?: number
  17. /** 属性项的编号 */
  18. propertyId?: number
  19. /** 名称 */
  20. name: string
  21. /** 备注 */
  22. remark?: string
  23. }
  24. /**
  25. * 商品属性值的明细
  26. */
  27. export interface PropertyValueDetailVO {
  28. /** 属性项的编号 */
  29. propertyId: number // 属性的编号
  30. /** 属性的名称 */
  31. propertyName: string
  32. /** 属性值的编号 */
  33. valueId: number
  34. /** 属性值的名称 */
  35. valueName: string
  36. }
  37. // ------------------------ 属性项 -------------------
  38. // 创建属性项
  39. export const createProperty = (data: PropertyVO) => {
  40. return request.post({ url: '/product/property/create', data })
  41. }
  42. // 更新属性项
  43. export const updateProperty = (data: PropertyVO) => {
  44. return request.put({ url: '/product/property/update', data })
  45. }
  46. // 删除属性项
  47. export const deleteProperty = (id: number) => {
  48. return request.delete({ url: `/product/property/delete?id=${id}` })
  49. }
  50. // 获得属性项
  51. export const getProperty = (id: number): Promise<PropertyVO> => {
  52. return request.get({ url: `/product/property/get?id=${id}` })
  53. }
  54. // 获得属性项分页
  55. export const getPropertyPage = (params: PageParam) => {
  56. return request.get({ url: '/product/property/page', params })
  57. }
  58. // 获得属性项列表
  59. export const getPropertyList = (params: any) => {
  60. return request.get({ url: '/product/property/list', params })
  61. }
  62. // 获得属性项列表
  63. export const getPropertyListAndValue = (data: any) => {
  64. return request.post({ url: '/product/property/get-value-list', data })
  65. }
  66. // ------------------------ 属性值 -------------------
  67. // 获得属性值分页
  68. export const getPropertyValuePage = (params: PageParam & any) => {
  69. return request.get({ url: '/product/property/value/page', params })
  70. }
  71. // 获得属性值
  72. export const getPropertyValue = (id: number): Promise<PropertyValueVO> => {
  73. return request.get({ url: `/product/property/value/get?id=${id}` })
  74. }
  75. // 创建属性值
  76. export const createPropertyValue = (data: PropertyValueVO) => {
  77. return request.post({ url: '/product/property/value/create', data })
  78. }
  79. // 更新属性值
  80. export const updatePropertyValue = (data: PropertyValueVO) => {
  81. return request.put({ url: '/product/property/value/update', data })
  82. }
  83. // 删除属性值
  84. export const deletePropertyValue = (id: number) => {
  85. return request.delete({ url: `/product/property/value/delete?id=${id}` })
  86. }