pay.service.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /**
  2. * 这是支付相关的业务逻辑的服务
  3. */
  4. export default class PayService {
  5. constructor(AjaxService) {
  6. Object.assign(this, { AjaxService })
  7. this.name = 'PayService'
  8. }
  9. /* 小程序支付-查询线上支付开关状态 */
  10. PayOrderOnLineSwitch (data = {}) {
  11. return this.AjaxService.get({
  12. url:'/order/pay/online/switch',
  13. data,
  14. isLoading: false ,
  15. })
  16. }
  17. /* 小程序支付-初始化收银台 */
  18. PayOrderCheckoutCounter (data = {}) {
  19. return this.AjaxService.get({
  20. url:'/order/pay/checkout/counter',
  21. data,
  22. isLoading: true ,
  23. })
  24. }
  25. /**
  26. *小程序支付-微信支付
  27. *@param amount支付金额,单位分,必须大于2
  28. *@param payWay银联:UNIONPAY,微信:WEIXIN,支付宝:ALIPAY
  29. *@param payType 微信小程序支付: MINIAPP_WEIXIN ,微信公众号支付: JSAPI_WEIXIN
  30. *@param code 微信小程序code,微信小程序支付使用
  31. *@param orderId 主订单ID
  32. */
  33. WeChatMiniWxPay (data = {}) {
  34. return this.AjaxService.post({
  35. url:'/order/pay/wechat',
  36. data,
  37. isLoading: true ,
  38. loadText:'请求支付中...'
  39. })
  40. }
  41. /**
  42. *小程序支付-微信支付
  43. *@param payWay银联:UNIONPAY,微信:WEIXIN,支付宝:ALIPAY
  44. *@param payType 微信小程序支付: MINIAPP_WEIXIN ,微信公众号支付: JSAPI_WEIXIN
  45. *@param code 微信小程序code,微信小程序支付使用
  46. *@param userId 用户Id
  47. *@param couponId 优惠券Id
  48. */
  49. WeChatCouponMiniWxPay (data = {}) {
  50. return this.AjaxService.post({
  51. url:'/order/pay/coupon/wechat',
  52. data,
  53. isLoading: true ,
  54. loadText:'请求支付中...'
  55. })
  56. }
  57. /**
  58. *生成支付链接
  59. *@param unpaidAmount 本次待付款金额
  60. *@param orderId 主订单ID
  61. */
  62. PayOrderPayLink (data = {}) {
  63. return this.AjaxService.post({
  64. url:'/order/pay/link',
  65. data, isLoading: true ,
  66. })
  67. }
  68. /**
  69. *@param 二手发布支付
  70. *@param orderId 主订单ID
  71. */
  72. SecondHandPay (data = {}) {
  73. return this.AjaxService.post({
  74. url:'/order/pay/second/wechat',
  75. data,
  76. isLoading: true ,
  77. })
  78. }
  79. /**
  80. *@param 采美豆抵扣开通超级会员
  81. *@param orderId 主订单ID
  82. */
  83. getUserRegisterSuperBeans (data = {}) {
  84. return this.AjaxService.get({
  85. url:'/user/register/super/beans',
  86. data,
  87. isLoading: true ,
  88. })
  89. }
  90. /**
  91. *@在线支付开通超级会员
  92. */
  93. getUserRegisterSuperPay (data = {}) {
  94. return this.AjaxService.get({
  95. url:'/user/register/super/pay',
  96. data,
  97. isLoading: true,
  98. })
  99. }
  100. /**
  101. *@param 微信支付开通超级会员
  102. *@param vipId 套餐ID
  103. *@param userId 用户D
  104. *@param code wechatCode
  105. */
  106. PayOrderVipWechat (data = {}) {
  107. return this.AjaxService.post({
  108. url:'/order/pay/vip/wechat',
  109. data,
  110. isLoading: true ,
  111. })
  112. }
  113. }