receiveCoupon.ts 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import { http } from '@/http/alova'
  2. import { ContentTypeEnum } from '@/http/tools/enum'
  3. export function getReceiveCouponDetail(couponId: string) {
  4. return http.Get('/couponCenter/APP/shareRecord/queryTemplateBySendUserId', {
  5. params: {
  6. id: couponId,
  7. }
  8. })
  9. }
  10. // 新增:获取优惠券分享短链的接口
  11. export function getCouponShareLink(params) {
  12. return http.Get('/couponCenter/APP/shareRecord/createShareWechatUrl', {
  13. params: {
  14. templateId: params.templateId,
  15. pathUrl: params.pathUrl,
  16. }
  17. })
  18. }
  19. // 生成微信小程序码
  20. export function getWxacode(token, id) {
  21. return uni.request({
  22. url: `https://api.weixin.qq.com/wxa/getwxacode?access_token=${token}`,
  23. method: 'POST',
  24. data: {
  25. "path": `pages/home/home?couponCenter_shareId=${id}`,
  26. "env_version": 'release',
  27. "width": 280,
  28. },
  29. contentType: ContentTypeEnum.JSON,
  30. responseType: 'arraybuffer',
  31. })
  32. }
  33. export function getWxToken() {
  34. return uni.request({
  35. url: 'https://api.weixin.qq.com/cgi-bin/token',
  36. method: 'GET',
  37. data: {
  38. "grant_type": 'client_credential',
  39. "appid": 'wxab9634bf98628a03',
  40. "secret": 'b0f8b0c5372fb825be9cf3d89c3fb28c',
  41. },
  42. })
  43. }
  44. export function getWxQcCode(params) {
  45. return http.Post('/couponCenter/APP/shareRecord/createQRCode', params, {
  46. responseType: 'arraybuffer',
  47. cacheFor: null,
  48. meta: {
  49. returnResponse: true,
  50. }
  51. })
  52. }