pay.service.js 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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 source 领取渠道 1 小程序 2 网站
  105. *@param userId 用户Id
  106. *@param couponId 优惠券Id
  107. */
  108. WeChatPayCouponBeans (data = {}) {
  109. return this.AjaxService.post({
  110. url:'/order/pay/coupon/beans',
  111. data,
  112. isLoading: true ,
  113. loadText:'请求抵扣中...'
  114. })
  115. }
  116. /**
  117. *生成支付链接
  118. *@param unpaidAmount 本次待付款金额
  119. *@param orderId 主订单ID
  120. */
  121. PayOrderPayLink (data = {}) {
  122. return this.AjaxService.post({
  123. url:'/order/pay/link',
  124. data, isLoading: true ,
  125. })
  126. }
  127. /**
  128. *@param 二手发布支付
  129. *@param orderId 主订单ID
  130. */
  131. SecondHandPay (data = {}) {
  132. return this.AjaxService.post({
  133. url:'/order/pay/second/wechat',
  134. data,
  135. isLoading: true ,
  136. })
  137. }
  138. /**
  139. *@param 采美豆抵扣开通超级会员
  140. *@param orderId 主订单ID
  141. */
  142. getUserRegisterSuperBeans (data = {}) {
  143. return this.AjaxService.get({
  144. url:'/user/register/super/beans',
  145. data,
  146. isLoading: true ,
  147. })
  148. }
  149. /**
  150. *@在线支付开通超级会员
  151. */
  152. getUserRegisterSuperPay (data = {}) {
  153. return this.AjaxService.get({
  154. url:'/user/register/super/pay',
  155. data,
  156. isLoading: true,
  157. })
  158. }
  159. /**
  160. *@param 微信支付开通超级会员
  161. *@param vipId 套餐ID
  162. *@param userId 用户D
  163. *@param code wechatCode
  164. */
  165. PayOrderVipWechat (data = {}) {
  166. return this.AjaxService.post({
  167. url:'/order/pay/vip/wechat',
  168. data,
  169. isLoading: true ,
  170. })
  171. }
  172. /**
  173. *@param 订单支付大额网银转账
  174. *@param payAmount 转账金额
  175. *@param orderId 订单ID
  176. */
  177. PayOrderTransferUnion (data = {}) {
  178. return this.AjaxService.post({
  179. url:'/order/pay/transfer/union',
  180. data,
  181. isLoading: true ,
  182. })
  183. }
  184. /**
  185. *@param 校验是否网银转账成功
  186. *@param mbOrderId 交易订单号
  187. */
  188. PayOrderFindOrderStatus (data = {}) {
  189. return this.AjaxService.get({
  190. url:'/order/pay/result/json',
  191. data,
  192. isLoading: true ,
  193. })
  194. }
  195. }