order.js 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. // +----------------------------------------------------------------------
  2. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  3. // +----------------------------------------------------------------------
  4. // | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
  5. // +----------------------------------------------------------------------
  6. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  7. // +----------------------------------------------------------------------
  8. // | Author: CRMEB Team <admin@crmeb.com>
  9. // +----------------------------------------------------------------------
  10. import request from "@/utils/request.js";
  11. /**
  12. * 获取购物车列表
  13. * @param numType boolean true 购物车数量,false=购物车产品数量
  14. */
  15. export function getCartCounts(numType) {
  16. return request.get("cart/count", {
  17. numType: numType === undefined ? 0 : numType
  18. });
  19. }
  20. /**
  21. * 获取购物车列表
  22. *
  23. */
  24. export function getCartList(data) {
  25. return request.get("cart/list", data);
  26. }
  27. /**
  28. * 修改购物车
  29. *
  30. */
  31. export function getResetCart(data) {
  32. return request.post("v2/reset_cart", data);
  33. }
  34. /**
  35. * 修改购物车数量
  36. * @param int cartId 购物车id
  37. * @param int number 修改数量
  38. */
  39. export function changeCartNum(cartId, number) {
  40. return request.post("cart/num", {
  41. id: cartId,
  42. number: number
  43. });
  44. }
  45. /**
  46. * 清除购物车
  47. * @param object ids join(',') 切割成字符串
  48. */
  49. export function cartDel(ids) {
  50. if (typeof ids === 'object')
  51. ids = ids.join(',');
  52. return request.post('cart/del', {
  53. ids: ids
  54. });
  55. }
  56. /**
  57. * 订单列表
  58. * @param object data
  59. */
  60. export function getOrderList(data) {
  61. return request.get('order/list', data);
  62. }
  63. /**
  64. * 订单产品信息
  65. * @param string unique
  66. */
  67. export function orderProduct(unique) {
  68. return request.post('order/product', {
  69. unique: unique
  70. });
  71. }
  72. /**
  73. * 订单评价
  74. * @param object data
  75. *
  76. */
  77. export function orderComment(data) {
  78. return request.post('order/comment', data);
  79. }
  80. /**
  81. * 订单支付
  82. * @param object data
  83. */
  84. export function orderPay(data) {
  85. return request.post('order/pay', data);
  86. }
  87. /**
  88. * 订单统计数据
  89. */
  90. export function orderData() {
  91. return request.get('order/data')
  92. }
  93. /**
  94. * 订单取消
  95. * @param string id
  96. *
  97. */
  98. export function orderCancel(id) {
  99. return request.post('order/cancel', {
  100. id: id
  101. });
  102. }
  103. /**
  104. * 删除已完成订单
  105. * @param string uni
  106. *
  107. */
  108. export function orderDel(uni) {
  109. return request.post('order/del', {
  110. uni: uni
  111. });
  112. }
  113. /**
  114. * 订单详情
  115. * @param string uni
  116. */
  117. export function getOrderDetail(uni) {
  118. return request.get('order/detail/' + uni);
  119. }
  120. /**
  121. * 再次下单
  122. * @param string uni
  123. *
  124. */
  125. export function orderAgain(uni) {
  126. return request.post('order/again', {
  127. uni: uni
  128. });
  129. }
  130. /**
  131. * 订单收货
  132. * @param string uni
  133. *
  134. */
  135. export function orderTake(uni) {
  136. return request.post('order/take', {
  137. uni: uni
  138. });
  139. }
  140. /**
  141. * 订单查询物流信息
  142. * @returns {*}
  143. */
  144. export function express(uni) {
  145. return request.get("order/express/" + uni);
  146. }
  147. /**
  148. * 获取退款理由
  149. *
  150. */
  151. export function ordeRefundReason() {
  152. return request.get('order/refund/reason');
  153. }
  154. /**
  155. * 订单退款审核
  156. * @param object data
  157. */
  158. export function orderRefundVerify(data) {
  159. return request.post('order/refund/verify', data);
  160. }
  161. /**
  162. * 订单确认获取订单详细信息
  163. * @param string cartId
  164. */
  165. export function orderConfirm(cartId, news) {
  166. return request.post('order/confirm', {
  167. cartId: cartId,
  168. 'new': news
  169. });
  170. }
  171. /**
  172. * 获取当前金额能使用的优惠卷
  173. * @param string price
  174. *
  175. */
  176. export function getCouponsOrderPrice(price, data) {
  177. return request.get('coupons/order/' + price, data)
  178. }
  179. /**
  180. * 订单创建
  181. * @param string key
  182. * @param object data
  183. *
  184. */
  185. export function orderCreate(key, data) {
  186. return request.post('order/create/' + key, data);
  187. }
  188. /**
  189. * 计算订单金额
  190. * @param key
  191. * @param data
  192. * @returns {*}
  193. */
  194. export function postOrderComputed(key, data) {
  195. return request.post("order/computed/" + key, data);
  196. }
  197. /**
  198. * 订单优惠券
  199. * @param key
  200. * @param data
  201. * @returns {*}
  202. */
  203. export function orderCoupon(orderId) {
  204. return request.post("v2/order/product_coupon/" + orderId);
  205. }
  206. /**
  207. * 计算会员线下付款金额
  208. * @param {Object} data
  209. */
  210. export function offlineCheckPrice(data) {
  211. return request.post("order/offline/check/price", data);
  212. }
  213. /**
  214. * 线下扫码付款
  215. * @param {Object} data
  216. */
  217. export function offlineCreate(data) {
  218. return request.post("order/offline/create", data);
  219. }
  220. /**
  221. * 支付方式开关
  222. */
  223. export function orderOfflinePayType() {
  224. return request.get('order/offline/pay/type');
  225. }
  226. /**
  227. * 开票记录
  228. */
  229. export function orderInvoiceList(data) {
  230. return request.get('v2/order/invoice_list', data);
  231. }
  232. /**
  233. * 开票订单详情
  234. * @param {Object} id
  235. */
  236. export function orderInvoiceDetail(id) {
  237. return request.get(`v2/order/invoice_detail/${id}`);
  238. }
  239. /**
  240. * 支付宝支付
  241. * @param {Object} key
  242. * @param {Object} quitUrl
  243. */
  244. export function aliPay(key, quitUrl) {
  245. return request.get('ali_pay', {
  246. key,
  247. quitUrl
  248. }, {
  249. noAuth: true
  250. });
  251. }