order.js 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384
  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. * @returns {*}
  165. */
  166. export function adminExpress(uni, type) {
  167. return request.get("admin/order/express/" + uni + `${type?'/refund':''}`);
  168. }
  169. /**
  170. * 获取退款理由
  171. *
  172. */
  173. export function ordeRefundReason() {
  174. return request.get('order/refund/reason');
  175. }
  176. /**
  177. * 订单退款审核
  178. * @param object data
  179. */
  180. export function orderRefundVerify(data) {
  181. return request.post('order/refund/verify', data);
  182. }
  183. /**
  184. * 订单确认获取订单详细信息
  185. * @param string cartId
  186. */
  187. export function orderConfirm(cartId, news, addressId, shipping_type) {
  188. return request.post('order/confirm', {
  189. cartId,
  190. 'new': news,
  191. addressId,
  192. shipping_type
  193. });
  194. }
  195. /**
  196. * 获取确认订单页面是否展示快递配送和到店自提
  197. * @param string cartId
  198. */
  199. export function checkShipping(cartId, news) {
  200. return request.post('order/check_shipping', {
  201. cartId,
  202. 'new': news
  203. });
  204. }
  205. /**
  206. * 获取当前金额能使用的优惠卷
  207. * @param string price
  208. *
  209. */
  210. export function getCouponsOrderPrice(price, data) {
  211. return request.get('coupons/order/' + price, data)
  212. }
  213. /**
  214. * 订单创建
  215. * @param string key
  216. * @param object data
  217. *
  218. */
  219. export function orderCreate(key, data) {
  220. return request.post('order/create/' + key, data);
  221. }
  222. /**
  223. * 计算订单金额
  224. * @param key
  225. * @param data
  226. * @returns {*}
  227. */
  228. export function postOrderComputed(key, data) {
  229. return request.post("order/computed/" + key, data);
  230. }
  231. /**
  232. * 订单优惠券
  233. * @param key
  234. * @param data
  235. * @returns {*}
  236. */
  237. export function orderCoupon(orderId) {
  238. return request.post("v2/order/product_coupon/" + orderId);
  239. }
  240. /**
  241. * 计算会员线下付款金额
  242. * @param {Object} data
  243. */
  244. export function offlineCheckPrice(data) {
  245. return request.post("order/offline/check/price", data);
  246. }
  247. /**
  248. * 线下扫码付款
  249. * @param {Object} data
  250. */
  251. export function offlineCreate(data) {
  252. return request.post("order/offline/create", data);
  253. }
  254. /**
  255. * 支付方式开关
  256. */
  257. export function orderOfflinePayType() {
  258. return request.get('order/offline/pay/type');
  259. }
  260. /**
  261. * 开票记录
  262. */
  263. export function orderInvoiceList(data) {
  264. return request.get('v2/order/invoice_list', data);
  265. }
  266. /**
  267. * 开票订单详情
  268. * @param {Object} id
  269. */
  270. export function orderInvoiceDetail(id) {
  271. return request.get(`v2/order/invoice_detail/${id}`);
  272. }
  273. /**
  274. * 支付宝支付
  275. * @param {Object} key
  276. * @param {Object} quitUrl
  277. */
  278. export function aliPay(key, quitUrl) {
  279. return request.get('ali_pay', {
  280. key,
  281. quitUrl
  282. }, {
  283. noAuth: true
  284. });
  285. }
  286. /**
  287. * 退货物流单号提交
  288. * @param {Object} data
  289. */
  290. export function refundExpress(data) {
  291. return request.post("order/refund/express", data);
  292. }
  293. /**
  294. * 分类购物车列表
  295. */
  296. export function vcartList() {
  297. return request.get("v2/cart_list");
  298. }
  299. /**
  300. * 退款商品列表
  301. */
  302. export function refundGoodsList(orderId) {
  303. return request.get(`order/refund/cart_info/${orderId}`);
  304. }
  305. /**
  306. * 申请退款商品列表
  307. */
  308. export function postRefundGoods(data) {
  309. return request.post(`order/refund/cart_info`, data);
  310. }
  311. /**
  312. * 退款商品提交
  313. */
  314. export function returnGoodsSubmit(id, data) {
  315. return request.post(`order/refund/apply/${id}`, data);
  316. }
  317. /**
  318. * 新订单列表 2.1版本
  319. * @param object data
  320. */
  321. export function getNewOrderList(data) {
  322. return request.get('order/refund/list', data);
  323. }
  324. /**
  325. * 退款订单详情
  326. * @param string uni
  327. */
  328. export function refundOrderDetail(uni) {
  329. return request.get('order/refund/detail/' + uni);
  330. }
  331. /**
  332. * 放弃申请退款
  333. * @param string uni
  334. */
  335. export function cancelRefundOrder(uni) {
  336. return request.post('order/refund/cancel/' + uni);
  337. }
  338. /**
  339. * 收银台订单信息
  340. * @param object data
  341. */
  342. export function getCashierOrder(orderId, type) {
  343. return request.get(`order/cashier/${orderId}/${type}`);
  344. }