orderService.js 1.68 KB
/**
 * orderService.js
 *@author dennis
 *@createtime 2018/10/29
 *@description 订单相关网络请求
 */

import BaseService from '../../libs/services/baseService'

const CREATE_PAYMENTINFO = 'ufo.order.payment'
const BUYER_GETADDRESS = 'app.address.gethidden'
const BUYER_SUBMIT = 'ufo.order.submit'
const BUYER_PREPAY = 'ufo.order.pay'
const COMPUTE_COMPENSATE = 'ufo.buyer.computeCompensate'
const PRODUCT_RECOMMEND = 'ufo.product.data.search.recommend'

export default class orderService extends BaseService {
  constructor(options) {
    super(options)
  }

  async createPaymentInfo(params, complete) {
    return await this.GET(
      {
        ...params,
        method: CREATE_PAYMENTINFO,
      },
      {
        path: '/shopping',
        complete
      }
    )
  }

  async buyerGetAddress(params, complete) {

    return await this.GET({
      ...params,
      method:BUYER_GETADDRESS
    },{
      complete
    })
  }

  async buyerSubmit(skup,channelNo='2919',addressId, complete) {

    return await this.GET({
      method: BUYER_SUBMIT,
      skup,
      channelNo,
      addressId,
    },{
      path: '/shopping',
      complete
    })
  }

  async prePay( orderCode, openId, complete) {

    return await this.GET({
      orderCode,
      openid: openId,
      payment: 3,
      method:BUYER_PREPAY,
    },{
      path: '/payment',
      complete
    })
  }

  async getComputeCompensate(orderCode, complete) {

    return await this.GET({
      orderCode,
      method:COMPUTE_COMPENSATE,
    }, {
      complete
    })
  }

  async getRecommendList(product_id, complete) {

    return await this.GET({
      product_id,
      method: PRODUCT_RECOMMEND,
    },{
      complete
    })
  }


}