order.js 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377
  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. * 新订单列表 2.1版本
  65. * @param object data
  66. */
  67. export function getNewOrderList(data) {
  68. return request.get('order/refund/list', data);
  69. }
  70. /**
  71. * 订单产品信息
  72. * @param string unique
  73. */
  74. export function orderProduct(unique) {
  75. return request.post('order/product', {
  76. unique: unique
  77. });
  78. }
  79. /**
  80. * 订单评价
  81. * @param object data
  82. *
  83. */
  84. export function orderComment(data) {
  85. return request.post('order/comment', data);
  86. }
  87. /**
  88. * 订单支付
  89. * @param object data
  90. */
  91. export function orderPay(data) {
  92. return request.post('order/pay', data);
  93. }
  94. /**
  95. * 订单统计数据
  96. */
  97. export function orderData() {
  98. return request.get('order/data')
  99. }
  100. /**
  101. * 订单取消
  102. * @param string id
  103. *
  104. */
  105. export function orderCancel(id) {
  106. return request.post('order/cancel', {
  107. id: id
  108. });
  109. }
  110. /**
  111. * 删除已完成订单
  112. * @param string uni
  113. *
  114. */
  115. export function orderDel(uni) {
  116. return request.post('order/del', {
  117. uni: uni
  118. });
  119. }
  120. /**
  121. * 删除已退款和拒绝退款的订单
  122. * @param string uni
  123. *
  124. */
  125. export function refundOrderDel(uni) {
  126. return request.get('order/refund/del/' + uni, {});
  127. }
  128. /**
  129. * 订单详情
  130. * @param string uni
  131. */
  132. export function getOrderDetail(uni) {
  133. return request.get('order/detail/' + uni);
  134. }
  135. /**
  136. * 退款订单详情
  137. * @param string uni
  138. */
  139. export function getRefundOrderDetail(uni) {
  140. return request.get('order/refund/detail/' + uni);
  141. }
  142. /**
  143. * 放弃申请退款
  144. * @param string uni
  145. */
  146. export function cancelRefundOrder(uni) {
  147. return request.post('order/refund/cancel/' + uni);
  148. }
  149. /**
  150. * 再次下单
  151. * @param string uni
  152. *
  153. */
  154. export function orderAgain(uni) {
  155. return request.post('order/again', {
  156. uni: uni
  157. });
  158. }
  159. /**
  160. * 订单收货
  161. * @param string uni
  162. *
  163. */
  164. export function orderTake(uni) {
  165. return request.post('order/take', {
  166. uni: uni
  167. });
  168. }
  169. /**
  170. * 订单查询物流信息
  171. * @returns {*}
  172. */
  173. export function express(uni, type) {
  174. return request.get("order/express/" + uni + (type ? '/' + type : ''));
  175. }
  176. /**
  177. * 获取退款理由
  178. *
  179. */
  180. export function ordeRefundReason() {
  181. return request.get('order/refund/reason');
  182. }
  183. /**
  184. * 订单退款审核
  185. * @param object data
  186. */
  187. export function orderRefundVerify(data) {
  188. return request.post('order/refund/verify', data);
  189. }
  190. /**
  191. * 订单确认获取订单详细信息
  192. * @param string cartId
  193. */
  194. export function orderConfirm(cartId, news, addressId, shippingType, store_id, couponId) {
  195. return request.post('order/confirm', {
  196. cartId,
  197. 'new': news,
  198. addressId,
  199. 'shipping_type': shippingType,
  200. store_id,
  201. 'couponId':couponId
  202. });
  203. }
  204. /**
  205. * 获取当前金额能使用的优惠卷
  206. * @param string price
  207. *
  208. */
  209. export function getCouponsOrderPrice(price, data) {
  210. return request.get('coupons/order/' + price, data)
  211. }
  212. /**
  213. * 订单创建
  214. * @param string key
  215. * @param object data
  216. *
  217. */
  218. export function orderCreate(key, data) {
  219. return request.post('order/create/' + key, data);
  220. }
  221. /**
  222. * 计算订单金额
  223. * @param key
  224. * @param data
  225. * @returns {*}
  226. */
  227. export function postOrderComputed(key, data) {
  228. return request.post("order/computed/" + key, data);
  229. }
  230. /**
  231. * 订单优惠券
  232. * @param key
  233. * @param data
  234. * @returns {*}
  235. */
  236. export function orderCoupon(orderId) {
  237. return request.post("v2/order/product_coupon/" + orderId);
  238. }
  239. /**
  240. * 计算会员线下付款金额
  241. * @param {Object} data
  242. */
  243. export function offlineCheckPrice(data) {
  244. return request.post("order/offline/check/price", data);
  245. }
  246. /**
  247. * 线下扫码付款
  248. * @param {Object} data
  249. */
  250. export function offlineCreate(data) {
  251. return request.post("order/offline/create", data);
  252. }
  253. /**
  254. * 支付方式开关
  255. */
  256. export function orderOfflinePayType() {
  257. return request.get('order/offline/pay/type');
  258. }
  259. /**
  260. * 开票记录
  261. */
  262. export function orderInvoiceList(data) {
  263. return request.get('v2/order/invoice_list', data);
  264. }
  265. /**
  266. * 开票订单详情
  267. * @param {Object} id
  268. */
  269. export function orderInvoiceDetail(id) {
  270. return request.get(`v2/order/invoice_detail/${id}`);
  271. }
  272. /**
  273. * 支付宝支付
  274. * @param {Object} key
  275. * @param {Object} quitUrl
  276. */
  277. export function aliPay(key, quitUrl) {
  278. return request.get('ali_pay', {
  279. key,
  280. quitUrl
  281. }, {
  282. noAuth: true
  283. });
  284. }
  285. /**
  286. * 退货物流单号提交
  287. * @param {Object} data
  288. */
  289. export function refundExpress(data) {
  290. return request.post("order/refund/express", data);
  291. }
  292. /**
  293. * 分类购物车列表
  294. */
  295. export function vcartList() {
  296. return request.get("v2/cart_list");
  297. }
  298. /**
  299. * 支付订单
  300. */
  301. export function payCashier(storeId) {
  302. return request.get(`order/pay_cashier?store_id=${storeId}`);
  303. }
  304. /**
  305. * 退款商品列表
  306. */
  307. export function refundGoodsList(orderId) {
  308. return request.get(`order/refund/cart_info/${orderId}`);
  309. }
  310. /**
  311. * 申请退款商品列表
  312. */
  313. export function postRefundGoods(data) {
  314. return request.post(`order/refund/cart_info`, data);
  315. }
  316. /**
  317. * 退款商品提交
  318. */
  319. export function returnGoodsSubmit(id, data) {
  320. return request.post(`order/refund/apply/${id}`, data);
  321. }
  322. /**
  323. * 确认订单详情(是否显示快递配送)
  324. */
  325. export function checkShipping(data) {
  326. return request.post(`order/check_shipping`, data);
  327. }
  328. /**
  329. * 配送订单详情
  330. */
  331. export function deliveryDetail(id) {
  332. return request.get(`delivery_order/detail/${id}`);
  333. }