pay.service.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. isHost:true
  16. })
  17. }
  18. /* 小程序支付-初始化收银台 */
  19. PayOrderCheckoutCounter (data = {}) {
  20. return this.AjaxService.get({
  21. url:'/order/pay/checkout/counter',
  22. data,
  23. isLoading: true ,
  24. isHost:true
  25. })
  26. }
  27. /**
  28. *小程序支付-微信支付
  29. *@param amount支付金额,单位分,必须大于2
  30. *@param payWay银联:UNIONPAY,微信:WEIXIN,支付宝:ALIPAY
  31. *@param payType 微信小程序支付: MINIAPP_WEIXIN ,微信公众号支付: JSAPI_WEIXIN
  32. *@param code 微信小程序code,微信小程序支付使用
  33. *@param orderId 主订单ID
  34. */
  35. WeChatMiniWxPay (data = {}) {
  36. return this.AjaxService.post({
  37. url:'/order/pay/wechat',
  38. data,
  39. isLoading: true ,
  40. isHost:true
  41. })
  42. }
  43. /**
  44. *生成支付链接
  45. *@param unpaidAmount 本次待付款金额
  46. *@param orderId 主订单ID
  47. */
  48. PayOrderPayLink (data = {}) {
  49. return this.AjaxService.post({
  50. url:'/order/pay/link',
  51. data, isLoading: true ,
  52. isHost:true
  53. })
  54. }
  55. /**
  56. *@param 二手发布支付
  57. *@param orderId 主订单ID
  58. */
  59. SecondHandPay (data = {}) {
  60. return this.AjaxService.post({
  61. url:'/order/pay/second/wechat',
  62. data,
  63. isLoading: true ,
  64. isHost:true
  65. })
  66. }
  67. /**
  68. *@param 采美豆抵扣开通超级会员
  69. *@param orderId 主订单ID
  70. */
  71. getUserRegisterSuperBeans (data = {}) {
  72. return this.AjaxService.get({
  73. url:'/user/register/super/beans',
  74. data,
  75. isLoading: true ,
  76. isHost:true
  77. })
  78. }
  79. /**
  80. *@在线支付开通超级会员
  81. */
  82. getUserRegisterSuperPay (data = {}) {
  83. return this.AjaxService.get({
  84. url:'/user/register/super/pay',
  85. data,
  86. isLoading: true,
  87. isHost:true
  88. })
  89. }
  90. /**
  91. *@param 微信支付开通超级会员
  92. *@param vipId 套餐ID
  93. *@param userId 用户D
  94. *@param code wechatCode
  95. */
  96. PayOrderVipWechat (data = {}) {
  97. return this.AjaxService.post({
  98. url:'/order/pay/vip/wechat',
  99. data,
  100. isLoading: true ,
  101. isHost:true
  102. })
  103. }
  104. }