order.js 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  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,cart_id) {
  118. return request.get('order/detail/' + uni +`${cart_id ? `/${cart_id}`:''}` );
  119. }
  120. /**
  121. * 退款订单详情
  122. * @param string uni
  123. */
  124. export function getRefundOrderDetail(uni,cart_id) {
  125. return request.get('order/refund_detail/' + uni +`${cart_id ? `/${cart_id}`:''}` );
  126. }
  127. /**
  128. * 再次下单
  129. * @param string uni
  130. *
  131. */
  132. export function orderAgain(uni) {
  133. return request.post('order/again', {
  134. uni: uni
  135. });
  136. }
  137. /**
  138. * 订单收货
  139. * @param string uni
  140. *
  141. */
  142. export function orderTake(uni) {
  143. return request.post('order/take', {
  144. uni: uni
  145. });
  146. }
  147. /**
  148. * 订单查询物流信息
  149. * @returns {*}
  150. */
  151. export function express(uni) {
  152. return request.get("order/express/" + uni);
  153. }
  154. /**
  155. * 获取退款理由
  156. *
  157. */
  158. export function ordeRefundReason() {
  159. return request.get('order/refund/reason');
  160. }
  161. /**
  162. * 订单退款审核
  163. * @param object data
  164. */
  165. export function orderRefundVerify(data) {
  166. return request.post('order/refund/verify', data);
  167. }
  168. /**
  169. * 订单确认获取订单详细信息
  170. * @param string cartId
  171. */
  172. export function orderConfirm(cartId, news, addressId) {
  173. return request.post('order/confirm', {
  174. cartId,
  175. 'new': news,
  176. addressId
  177. });
  178. }
  179. /**
  180. * 获取当前金额能使用的优惠卷
  181. * @param string price
  182. *
  183. */
  184. export function getCouponsOrderPrice(price, data) {
  185. return request.get('coupons/order/' + price, data)
  186. }
  187. /**
  188. * 订单创建
  189. * @param string key
  190. * @param object data
  191. *
  192. */
  193. export function orderCreate(key, data) {
  194. return request.post('order/create/' + key, data);
  195. }
  196. /**
  197. * 计算订单金额
  198. * @param key
  199. * @param data
  200. * @returns {*}
  201. */
  202. export function postOrderComputed(key, data) {
  203. return request.post("order/computed/" + key, data);
  204. }
  205. /**
  206. * 订单优惠券
  207. * @param key
  208. * @param data
  209. * @returns {*}
  210. */
  211. export function orderCoupon(orderId) {
  212. return request.post("v2/order/product_coupon/" + orderId);
  213. }
  214. /**
  215. * 计算会员线下付款金额
  216. * @param {Object} data
  217. */
  218. export function offlineCheckPrice(data) {
  219. return request.post("order/offline/check/price", data);
  220. }
  221. /**
  222. * 线下扫码付款
  223. * @param {Object} data
  224. */
  225. export function offlineCreate(data) {
  226. return request.post("order/offline/create", data);
  227. }
  228. /**
  229. * 支付方式开关
  230. */
  231. export function orderOfflinePayType() {
  232. return request.get('order/offline/pay/type');
  233. }
  234. /**
  235. * 开票记录
  236. */
  237. export function orderInvoiceList(data) {
  238. return request.get('v2/order/invoice_list', data);
  239. }
  240. /**
  241. * 开票订单详情
  242. * @param {Object} id
  243. */
  244. export function orderInvoiceDetail(id) {
  245. return request.get(`v2/order/invoice_detail/${id}`);
  246. }
  247. /**
  248. * 支付宝支付
  249. * @param {Object} key
  250. * @param {Object} quitUrl
  251. */
  252. export function aliPay(key, quitUrl) {
  253. return request.get('ali_pay', {
  254. key,
  255. quitUrl
  256. }, {
  257. noAuth: true
  258. });
  259. }
  260. /**
  261. * 退货物流单号提交
  262. * @param {Object} data
  263. */
  264. export function refundExpress(data) {
  265. return request.post("order/refund/express", data);
  266. }
  267. /**
  268. * 分类购物车列表
  269. */
  270. export function vcartList() {
  271. return request.get("v2/cart_list");
  272. }