order.js 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377
  1. // +----------------------------------------------------------------------
  2. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  3. // +----------------------------------------------------------------------
  4. // | Copyright (c) 2016~2023 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 cartId
  191. */
  192. export function checkShipping(cartId, news) {
  193. return request.post('order/check_shipping', {
  194. cartId,
  195. 'new': news
  196. });
  197. }
  198. /**
  199. * 获取当前金额能使用的优惠卷
  200. * @param string price
  201. *
  202. */
  203. export function getCouponsOrderPrice(price, data) {
  204. return request.get('coupons/order/' + price, data)
  205. }
  206. /**
  207. * 订单创建
  208. * @param string key
  209. * @param object data
  210. *
  211. */
  212. export function orderCreate(key, data) {
  213. return request.post('order/create/' + key, data);
  214. }
  215. /**
  216. * 计算订单金额
  217. * @param key
  218. * @param data
  219. * @returns {*}
  220. */
  221. export function postOrderComputed(key, data) {
  222. return request.post("order/computed/" + key, data);
  223. }
  224. /**
  225. * 订单优惠券
  226. * @param key
  227. * @param data
  228. * @returns {*}
  229. */
  230. export function orderCoupon(orderId) {
  231. return request.post("v2/order/product_coupon/" + orderId);
  232. }
  233. /**
  234. * 计算会员线下付款金额
  235. * @param {Object} data
  236. */
  237. export function offlineCheckPrice(data) {
  238. return request.post("order/offline/check/price", data);
  239. }
  240. /**
  241. * 线下扫码付款
  242. * @param {Object} data
  243. */
  244. export function offlineCreate(data) {
  245. return request.post("order/offline/create", data);
  246. }
  247. /**
  248. * 支付方式开关
  249. */
  250. export function orderOfflinePayType() {
  251. return request.get('order/offline/pay/type');
  252. }
  253. /**
  254. * 开票记录
  255. */
  256. export function orderInvoiceList(data) {
  257. return request.get('v2/order/invoice_list', data);
  258. }
  259. /**
  260. * 开票订单详情
  261. * @param {Object} id
  262. */
  263. export function orderInvoiceDetail(id) {
  264. return request.get(`v2/order/invoice_detail/${id}`);
  265. }
  266. /**
  267. * 支付宝支付
  268. * @param {Object} key
  269. * @param {Object} quitUrl
  270. */
  271. export function aliPay(key, quitUrl) {
  272. return request.get('ali_pay', {
  273. key,
  274. quitUrl
  275. }, {
  276. noAuth: true
  277. });
  278. }
  279. /**
  280. * 退货物流单号提交
  281. * @param {Object} data
  282. */
  283. export function refundExpress(data) {
  284. return request.post("order/refund/express", data);
  285. }
  286. /**
  287. * 分类购物车列表
  288. */
  289. export function vcartList() {
  290. return request.get("v2/cart_list");
  291. }
  292. /**
  293. * 退款商品列表
  294. */
  295. export function refundGoodsList(orderId) {
  296. return request.get(`order/refund/cart_info/${orderId}`);
  297. }
  298. /**
  299. * 申请退款商品列表
  300. */
  301. export function postRefundGoods(data) {
  302. return request.post(`order/refund/cart_info`, data);
  303. }
  304. /**
  305. * 退款商品提交
  306. */
  307. export function returnGoodsSubmit(id, data) {
  308. return request.post(`order/refund/apply/${id}`, data);
  309. }
  310. /**
  311. * 新订单列表 2.1版本
  312. * @param object data
  313. */
  314. export function getNewOrderList(data) {
  315. return request.get('order/refund/list', data);
  316. }
  317. /**
  318. * 退款订单详情
  319. * @param string uni
  320. */
  321. export function refundOrderDetail(uni) {
  322. return request.get('order/refund/detail/' + uni);
  323. }
  324. /**
  325. * 放弃申请退款
  326. * @param string uni
  327. */
  328. export function cancelRefundOrder(uni) {
  329. return request.post('order/refund/cancel/' + uni);
  330. }
  331. /**
  332. * 收银台订单信息
  333. * @param object data
  334. */
  335. export function getCashierOrder(orderId, type) {
  336. return request.get(`order/cashier/${orderId}/${type}`);
  337. }