order.js 7.3 KB

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