order.js 6.5 KB

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