pay.service.js 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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. PayOrderShoporders (data = {}) {
  19. return this.AjaxService.get({
  20. url:'/order/pay/shoporders',
  21. data,
  22. isLoading: true ,
  23. })
  24. }
  25. /* 小程序支付-初始化收银台 */
  26. PayOrderCheckoutCounter (data = {}) {
  27. return this.AjaxService.get({
  28. url:'/order/pay/checkout/counter',
  29. data,
  30. isLoading: true ,
  31. })
  32. }
  33. /* 小程序支付-初始化子订单收银台 shopOrderId*/
  34. PayOrderCheckoutShoporders (data = {}) {
  35. return this.AjaxService.get({
  36. url:'/order/pay/checkout/shoporders',
  37. data,
  38. isLoading: true ,
  39. })
  40. }
  41. /**
  42. *小程序支付-米花微信支付
  43. *@param amount支付金额,单位分,必须大于2
  44. *@param payWay银联:UNIONPAY,微信:WEIXIN,支付宝:ALIPAY
  45. *@param payType 微信小程序支付: MINIAPP_WEIXIN ,微信公众号支付: JSAPI_WEIXIN
  46. *@param code 微信小程序code,微信小程序支付使用
  47. *@param orderId 主订单ID
  48. */
  49. WeChatMiniWxPay (data = {}) {
  50. return this.AjaxService.post({
  51. url:'/order/pay/wechat',
  52. data,
  53. isLoading: true ,
  54. loadText:'请求支付中...'
  55. })
  56. }
  57. /**
  58. *小程序支付-合利宝微信支付
  59. *@param amount支付金额,单位分,必须大于2
  60. *@param payWay银联:UNIONPAY,微信:WEIXIN,支付宝:ALIPAY
  61. *@param payType 微信小程序支付: MINIAPP_WEIXIN ,微信公众号支付: JSAPI_WEIXIN
  62. *@param code 微信小程序code,微信小程序支付使用
  63. *@param orderId 主订单ID
  64. */
  65. WeChatScanMiniWxPay (data = {}) {
  66. console.log('合利宝微信支付')
  67. return this.AjaxService.post({
  68. url:'/order/pay/online',
  69. data,
  70. isLoading: true ,
  71. loadText:'请求支付中...'
  72. })
  73. }
  74. /**
  75. *小程序支付-微信支付
  76. *@param payWay银联:UNIONPAY,微信:WEIXIN,支付宝:ALIPAY
  77. *@param payType 微信小程序支付: MINIAPP_WEIXIN ,微信公众号支付: JSAPI_WEIXIN
  78. *@param code 微信小程序code,微信小程序支付使用
  79. *@param userId 用户Id
  80. *@param couponId 优惠券Id
  81. */
  82. WeChatCouponMiniWxPay (data = {}) {
  83. return this.AjaxService.post({
  84. url:'/order/pay/coupon/wechat',
  85. data,
  86. isLoading: true ,
  87. loadText:'请求支付中...'
  88. })
  89. }
  90. /**
  91. *购买优惠券生成记录Id
  92. *@param userId 用户Id
  93. *@param couponId 优惠券Id
  94. */
  95. WeChatCouponRecord (data = {}) {
  96. return this.AjaxService.post({
  97. url:'/order/pay/coupon/record',
  98. data,
  99. isLoading: false ,
  100. })
  101. }
  102. /**
  103. *生成支付链接
  104. *@param unpaidAmount 本次待付款金额
  105. *@param orderId 主订单ID
  106. */
  107. PayOrderPayLink (data = {}) {
  108. return this.AjaxService.post({
  109. url:'/order/pay/link',
  110. data, isLoading: true ,
  111. })
  112. }
  113. /**
  114. *@param 二手发布支付
  115. *@param orderId 主订单ID
  116. */
  117. SecondHandPay (data = {}) {
  118. return this.AjaxService.post({
  119. url:'/order/pay/second/wechat',
  120. data,
  121. isLoading: true ,
  122. })
  123. }
  124. /**
  125. *@param 采美豆抵扣开通超级会员
  126. *@param orderId 主订单ID
  127. */
  128. getUserRegisterSuperBeans (data = {}) {
  129. return this.AjaxService.get({
  130. url:'/user/register/super/beans',
  131. data,
  132. isLoading: true ,
  133. })
  134. }
  135. /**
  136. *@在线支付开通超级会员
  137. */
  138. getUserRegisterSuperPay (data = {}) {
  139. return this.AjaxService.get({
  140. url:'/user/register/super/pay',
  141. data,
  142. isLoading: true,
  143. })
  144. }
  145. /**
  146. *@param 微信支付开通超级会员
  147. *@param vipId 套餐ID
  148. *@param userId 用户D
  149. *@param code wechatCode
  150. */
  151. PayOrderVipWechat (data = {}) {
  152. return this.AjaxService.post({
  153. url:'/order/pay/vip/wechat',
  154. data,
  155. isLoading: true ,
  156. })
  157. }
  158. /**
  159. *@param 订单支付大额网银转账
  160. *@param payAmount 转账金额
  161. *@param orderId 订单ID
  162. */
  163. PayOrderTransferUnion (data = {}) {
  164. return this.AjaxService.post({
  165. url:'/order/pay/transfer/union',
  166. data,
  167. isLoading: true ,
  168. })
  169. }
  170. /**
  171. *@param 校验是否网银转账成功
  172. *@param mbOrderId 交易订单号
  173. */
  174. PayOrderFindOrderStatus (data = {}) {
  175. return this.AjaxService.get({
  176. url:'/order/pay/result/json',
  177. data,
  178. isLoading: true ,
  179. })
  180. }
  181. }