order.js 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403
  1. // +----------------------------------------------------------------------
  2. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  3. // +----------------------------------------------------------------------
  4. // | Copyright (c) 2016~2024 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 getGiftOrderDetail(id) {
  126. return request.get('order/gift_detail/' + id);
  127. }
  128. /**
  129. * 订单详情
  130. * @param string uni
  131. */
  132. export function getOrderDetail(uni, cart_id) {
  133. return request.get('order/detail/' + uni + `${cart_id ? `/${cart_id}`:''}`);
  134. }
  135. /**
  136. * 退款订单详情
  137. * @param string uni
  138. */
  139. export function getRefundOrderDetail(uni, cart_id) {
  140. return request.get('order/refund_detail/' + uni + `${cart_id ? `/${cart_id}`:''}`);
  141. }
  142. /**
  143. * 再次下单
  144. * @param string uni
  145. *
  146. */
  147. export function orderAgain(uni) {
  148. return request.post('order/again', {
  149. uni: uni
  150. });
  151. }
  152. /**
  153. * 订单收货
  154. * @param string uni
  155. *
  156. */
  157. export function orderTake(uni) {
  158. return request.post('order/take', {
  159. uni: uni
  160. });
  161. }
  162. /**
  163. * 订单查询物流信息
  164. * @returns {*}
  165. */
  166. export function express(uni, type) {
  167. return request.get("order/express/" + uni + `${type?'/refund':''}`);
  168. }
  169. /**
  170. * 订单查询物流信息
  171. * @returns {*}
  172. */
  173. export function adminExpress(uni, type) {
  174. return request.get("admin/order/express/" + uni + `${type?'/refund':''}`);
  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(data) {
  195. return request.post('order/confirm', data);
  196. }
  197. /**
  198. * 获取确认订单页面是否展示快递配送和到店自提
  199. * @param string cartId
  200. */
  201. export function checkShipping(cartId, news) {
  202. return request.post('order/check_shipping', {
  203. cartId,
  204. 'new': news
  205. });
  206. }
  207. /**
  208. * 获取当前金额能使用的优惠卷
  209. * @param string price
  210. *
  211. */
  212. export function getCouponsOrderPrice(price, data) {
  213. return request.get('coupons/order/' + price, data)
  214. }
  215. /**
  216. * 订单创建
  217. * @param string key
  218. * @param object data
  219. *
  220. */
  221. export function orderCreate(key, data) {
  222. return request.post('order/create/' + key, data);
  223. }
  224. /**
  225. * 计算订单金额
  226. * @param key
  227. * @param data
  228. * @returns {*}
  229. */
  230. export function postOrderComputed(key, data) {
  231. return request.post("order/computed/" + key, data);
  232. }
  233. /**
  234. * 订单优惠券
  235. * @param key
  236. * @param data
  237. * @returns {*}
  238. */
  239. export function orderCoupon(orderId) {
  240. return request.post("v2/order/product_coupon/" + orderId);
  241. }
  242. /**
  243. * 计算会员线下付款金额
  244. * @param {Object} data
  245. */
  246. export function offlineCheckPrice(data) {
  247. return request.post("order/offline/check/price", data);
  248. }
  249. /**
  250. * 线下扫码付款
  251. * @param {Object} data
  252. */
  253. export function offlineCreate(data) {
  254. return request.post("order/offline/create", data);
  255. }
  256. /**
  257. * 支付方式开关
  258. */
  259. export function orderOfflinePayType() {
  260. return request.get('order/offline/pay/type');
  261. }
  262. /**
  263. * 开票记录
  264. */
  265. export function orderInvoiceList(data) {
  266. return request.get('v2/order/invoice_list', data);
  267. }
  268. /**
  269. * 开票订单详情
  270. * @param {Object} id
  271. */
  272. export function orderInvoiceDetail(id) {
  273. return request.get(`v2/order/invoice_detail/${id}`);
  274. }
  275. /**
  276. * 支付宝支付
  277. * @param {Object} key
  278. * @param {Object} quitUrl
  279. */
  280. export function aliPay(key, quitUrl) {
  281. return request.get('ali_pay', {
  282. key,
  283. quitUrl
  284. }, {
  285. noAuth: true
  286. });
  287. }
  288. /**
  289. * 退货物流单号提交
  290. * @param {Object} data
  291. */
  292. export function refundExpress(data) {
  293. return request.post("order/refund/express", data);
  294. }
  295. /**
  296. * 分类购物车列表
  297. */
  298. export function vcartList() {
  299. return request.get("v2/cart_list");
  300. }
  301. /**
  302. * 退款商品列表
  303. */
  304. export function refundGoodsList(orderId) {
  305. return request.get(`order/refund/cart_info/${orderId}`);
  306. }
  307. /**
  308. * 申请退款商品列表
  309. */
  310. export function postRefundGoods(data) {
  311. return request.post(`order/refund/cart_info`, data);
  312. }
  313. /**
  314. * 退款商品提交
  315. */
  316. export function returnGoodsSubmit(id, data) {
  317. return request.post(`order/refund/apply/${id}`, data);
  318. }
  319. /**
  320. * 新订单列表 2.1版本
  321. * @param object data
  322. */
  323. export function getNewOrderList(data) {
  324. return request.get('order/refund/list', data);
  325. }
  326. /**
  327. * 退款订单详情
  328. * @param string uni
  329. */
  330. export function refundOrderDetail(uni) {
  331. return request.get('order/refund/detail/' + uni);
  332. }
  333. /**
  334. * 放弃申请退款
  335. * @param string uni
  336. */
  337. export function cancelRefundOrder(uni) {
  338. return request.post('order/refund/cancel/' + uni);
  339. }
  340. /**
  341. * 收银台订单信息
  342. * @param object data
  343. */
  344. export function getCashierOrder(orderId, type) {
  345. return request.get(`order/cashier/${orderId}/${type}`);
  346. }
  347. /**
  348. * 发票地址获取
  349. * @param object data
  350. */
  351. export function getInvoiceLink(id) {
  352. return request.get(`v2/order/down_invoice/${id}`);
  353. }
  354. /**
  355. * 领取礼物
  356. * @param orderId
  357. * @param data
  358. */
  359. export function orderReceiveGift(orderId, data) {
  360. return request.post("order/receive_gift/" + orderId, data);
  361. }