dacang.ts 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. import { defHttp } from '~/utils/http'
  2. import type {
  3. DcBannerDataModel,
  4. DcHomeMerchantModel, DcHomeProductModel, DcIntroduce, DcMemberProductResult, DcModel, DcProductClassifyModel,
  5. DcProductModel, DcSeckillModel, QueryDcHomeParams, QueryDcMemberProductListParams,
  6. QueryDcProductListParams
  7. } from "~/apis/model/dacang.model";
  8. enum API {
  9. DC_BANNER= '/api/newhome/nologin/banner/da_cang',
  10. // 一元购
  11. DC_BANNER_ONE_YUAN_PAY = '/api/newhome/nologin/banner/one_yuan_pay',
  12. // 大仓金刚区
  13. DC_HOME_MERCHANT = '/api/dacang/nologin/dc_home_merchant',
  14. // 大仓秒杀商品
  15. DC_SECKILL = '/api/dacang/nologin/seckill',
  16. DC_SECKILL_INDEX_TIME ='/api/store/product/seckill/select',
  17. // 大仓商品列表
  18. DC_PRODUCT_LIST = '/api/dacang/nologin/da_cang_product_lst',
  19. // 大仓会员商品
  20. DC_MEMBER_PRODUCT_LIST = '/api/store/product/dacang_lst',
  21. // 大仓列表
  22. DC_LIST = '/api/dacang/nologin/da_cang_lst',
  23. // 大仓介绍
  24. DC_INTRODUCE = '/api/dacang/nologin/introduce',
  25. // 单个大仓商品列表
  26. DC_HOME_PRODUCT_LIST = '/api/dacang/nologin/dc_home_product',
  27. // 大仓商品列表分类
  28. DC_CLASSIFY = '/api/dacang/nologin/classify',
  29. }
  30. export function getSeckillIndexTime() {
  31. return defHttp.get({
  32. url: API.DC_SECKILL_INDEX_TIME
  33. })
  34. }
  35. /**
  36. * 大仓 banner 列表
  37. */
  38. export function getDcBanner(): Promise<Array<DcBannerDataModel>> {
  39. return defHttp.get({
  40. url: API.DC_BANNER
  41. })
  42. }
  43. export function getDcBannerOneYuanPay(): Promise<Array<DcBannerDataModel>> {
  44. return defHttp.get({
  45. url: API.DC_BANNER_ONE_YUAN_PAY
  46. })
  47. }
  48. /**
  49. * 大仓首页数据(金刚区)
  50. * @param id
  51. */
  52. export function getDcHomeMerchant(id: string): Promise<Array<DcHomeMerchantModel>> {
  53. return defHttp.get({
  54. url: `${API.DC_HOME_MERCHANT}/${id}`
  55. })
  56. }
  57. /**
  58. * 大仓商品列表
  59. *
  60. */
  61. export function getDcProductList(params: QueryDcProductListParams): Promise<Array<DcProductModel>> {
  62. return defHttp.get({
  63. url: API.DC_PRODUCT_LIST,
  64. data: {
  65. ...params
  66. }
  67. })
  68. }
  69. /**
  70. * 大仓秒杀商品
  71. */
  72. export function getDcSeckill(): Promise<Array<DcSeckillModel>> {
  73. return defHttp.get({
  74. url: API.DC_SECKILL,
  75. })
  76. }
  77. /**
  78. * 大仓会员商品列表
  79. * @param params
  80. */
  81. export function getDcMemberProductList(params: QueryDcMemberProductListParams): Promise<DcMemberProductResult> {
  82. return defHttp.get({
  83. url: API.DC_MEMBER_PRODUCT_LIST,
  84. data: {
  85. ...params
  86. }
  87. })
  88. }
  89. /**
  90. * 大仓列表
  91. */
  92. export function getDcList(): Promise<Array<DcModel>> {
  93. return defHttp.get({
  94. url: API.DC_LIST
  95. })
  96. }
  97. /**
  98. * 大仓介绍
  99. * @param id
  100. */
  101. export function getDcIntroduce(id: string): Promise<DcIntroduce> {
  102. return defHttp.get({
  103. url: `${API.DC_INTRODUCE}/${id}`
  104. })
  105. }
  106. /**
  107. * 单个大仓的商品列表
  108. * @param id
  109. * @param params
  110. */
  111. export function getDcHomeProductList(id: string, params: QueryDcHomeParams): Promise<Array<DcHomeProductModel>> {
  112. return defHttp.get({
  113. url: `${API.DC_HOME_PRODUCT_LIST}/${id}`,
  114. data: {
  115. ...params
  116. }
  117. })
  118. }
  119. /**
  120. * 大仓商品分类
  121. */
  122. export function getDcProductClassify(): Promise<DcProductClassifyModel> {
  123. return defHttp.get({
  124. url: API.DC_CLASSIFY
  125. })
  126. }