order.js 7.0 KB

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