order.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. import request from "./../utils/request.js";
  2. /**
  3. *
  4. * 订单相关接口
  5. *
  6. */
  7. /**
  8. * 获取购物车列表
  9. *
  10. */
  11. export function getCartList() {
  12. return request.get("cart/list");
  13. }
  14. /**
  15. * 获取购物车列表
  16. * @param numType boolean true 购物车数量,false=购物车产品数量
  17. */
  18. export function getCartCounts(numType) {
  19. return request.get("cart/count", { numType: numType === undefined ? true : numType });
  20. }
  21. /**
  22. * 修改购物车数量
  23. * @param int cartId 购物车id
  24. * @param int number 修改数量
  25. */
  26. export function changeCartNum(cartId, number) {
  27. return request.post("cart/num", { id: cartId, number: number });
  28. }
  29. /**
  30. * 清除购物车
  31. * @param object ids join(',') 切割成字符串
  32. */
  33. export function cartDel(ids){
  34. if (typeof id === 'object')
  35. ids = ids.join(',');
  36. return request.post('cart/del', { ids: ids});
  37. }
  38. /**
  39. * 订单列表
  40. * @param object data
  41. */
  42. export function getOrderList(data){
  43. return request.get('order/list',data);
  44. }
  45. /**
  46. * 订单确认获取订单详细信息
  47. * @param string cartId
  48. */
  49. export function orderConfirm(cartId){
  50. return request.post('order/confirm', { cartId: cartId});
  51. }
  52. /**
  53. * 再次下单
  54. * @param string uni
  55. *
  56. */
  57. export function orderAgain(uni){
  58. return request.post('order/again',{uni:uni});
  59. }
  60. /**
  61. * 订单支付
  62. * @param object data
  63. */
  64. export function orderPay(data){
  65. return request.post('order/pay',data);
  66. }
  67. /**
  68. * 订单详情
  69. * @param string uni
  70. */
  71. export function getOrderDetail(uni){
  72. return request.get('order/detail/'+uni);
  73. }
  74. /**
  75. * 删除已完成订单
  76. * @param string uni
  77. *
  78. */
  79. export function orderDel(uni){
  80. return request.post('order/del',{uni:uni});
  81. }
  82. /**
  83. * 订单收货
  84. * @param string uni
  85. *
  86. */
  87. export function orderTake(uni){
  88. return request.post('order/take',{uni:uni});
  89. }
  90. /**
  91. * 订单查看物流
  92. * @param string uni
  93. */
  94. export function orderExpress(uni){
  95. return request.get('order/express/'+uni);
  96. }
  97. /**
  98. * 订单评价
  99. * @param object data
  100. *
  101. */
  102. export function orderComment(data){
  103. return request.post('order/comment',data);
  104. }
  105. /**
  106. * 订单取消
  107. * @param string id
  108. *
  109. */
  110. export function orderCancel(id){
  111. return request.post('order/cancel',{id:id});
  112. }
  113. /**
  114. * 订单产品信息
  115. * @param string unique
  116. */
  117. export function orderProduct(unique){
  118. return request.post('order/product', { unique: unique});
  119. }
  120. /**
  121. * 订单退款审核
  122. * @param object data
  123. */
  124. export function orderRefundVerify(data){
  125. return request.post('order/refund/verify',data);
  126. }
  127. /**
  128. * 获取退款理由
  129. *
  130. */
  131. export function ordeRefundReason(){
  132. return request.get('order/refund/reason');
  133. }
  134. /**
  135. * 订单统计数据
  136. */
  137. export function orderData(){
  138. return request.get('order/data')
  139. }
  140. /**
  141. * 获取当前金额能使用的优惠卷
  142. * @param string price
  143. *
  144. */
  145. export function getCouponsOrderPrice(price, data){
  146. return request.get('coupons/order/' + price, data)
  147. }
  148. /**
  149. * 订单创建
  150. * @param string key
  151. * @param object data
  152. *
  153. */
  154. export function orderCreate(key,data){
  155. return request.post('order/create/'+key,data);
  156. }
  157. /**
  158. * 订单查询物流信息
  159. * @returns {*}
  160. */
  161. export function express(uni) {
  162. return request.get("order/express/" + uni);
  163. }
  164. /**
  165. * 计算订单金额
  166. * @param key
  167. * @param data
  168. * @returns {*}
  169. */
  170. export function postOrderComputed(key, data) {
  171. return request.post("/order/computed/" + key, data);
  172. }