index.ts 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. import { http } from '@/utils/http'
  2. import type { Coupon1Type } from '@/types/coupon1'
  3. import type { Coupon2Type } from '@/types/coupon2'
  4. import type { ListType, ListResponseType } from '@/types/list'
  5. // import { parseQueryValues } from '@/utils'
  6. /** 获取商品可用优惠券列表 */
  7. export const getCouponListApi = (params: Partial<Coupon1Type>, page: Partial<ListType>) => {
  8. return http.get<ListResponseType<Coupon1Type>>('/api/query/list?pagevalue=33', {
  9. ...page,
  10. // ...parseQueryValues(params),
  11. 'couponproductids.like': params.couponproductids,
  12. })
  13. }
  14. /** 领取优惠券下单tel 旧 已弃用 */
  15. export const receiveCouponApi = (params: {
  16. couponid: string
  17. coupon2phone: string
  18. coupon2productids: string
  19. }) => {
  20. return http.get<any>('/api/nlua/call?pagevalue=98', {
  21. couponid: params.couponid, // 优惠券id
  22. coupon2phone: params.coupon2phone, // 手机号
  23. coupon2productids: params.coupon2productids, // 选择的商品id
  24. })
  25. }
  26. /** 领取优惠券下单tel new */
  27. export const receiveCouponApiNew = (params: {
  28. // smscode: string // 2025-05-20 16:14:54 要求去掉验证码
  29. couponid: string // 优惠券id
  30. userstype: string // 个人,企业
  31. usersidcardnumber: string // 身份证号
  32. usersshtyxydm: string // 企业统一吗
  33. usersname: string // 姓名
  34. usersaddress: string // 地址
  35. coupon2productids: string // 产品id
  36. coupon2phone: string // 手机号
  37. filesid: string // 图片id
  38. coupon2merchantid: string // 商家id
  39. }) => {
  40. return http.get<any>('/api/nlua/call?pagevalue=98', {
  41. couponid: params.couponid,
  42. userstype: params.userstype,
  43. usersidcardnumber: params.usersidcardnumber,
  44. usersshtyxydm: params.usersshtyxydm,
  45. usersname: params.usersname,
  46. usersaddress: params.usersaddress,
  47. coupon2productids: params.coupon2productids,
  48. coupon2phone: params.coupon2phone,
  49. filesid: params.filesid,
  50. coupon2merchantid: params.coupon2merchantid,
  51. })
  52. }
  53. /** 领取优惠劵,获取验证码 */
  54. export const getCoupon2smsApi = (params: { coupon2phone: string }) => {
  55. return http.get<any>('/api/nlua/call?pagevalue=103', {
  56. phone: params.coupon2phone, // 手机号
  57. })
  58. }
  59. /** 获取该用户下,已领取的优惠劵id,用于判断是否可以领取 */
  60. export const getCoupon2idApi = (
  61. params: Partial<Coupon2Type> & {
  62. coupon2userid: string
  63. coupon2isused: number
  64. coupon2productids: string
  65. },
  66. ) => {
  67. return http.get<any>('/api/query/list?pagevalue=38', {
  68. 'coupon2userid.value': params.coupon2userid, // 用户id
  69. 'coupon2isused.value': params.coupon2isused, // 0:未使用 1:已使用
  70. 'coupon2productids.like': params.coupon2productids, // 产品id
  71. })
  72. }
  73. /** 获取已关联到当前用户的优惠券列表 */
  74. export const getCoupon2ListApi = (params: Partial<Coupon2Type>, page: Partial<ListType>) => {
  75. return http.get<any>('/api/query/list?pagevalue=100', {
  76. ...page,
  77. 'coupon2userid.value': params.coupon2userid, // 用户id
  78. 'coupon2adddatetime.Sort': '1', // desc
  79. })
  80. }