order.js 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  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, luckRecordId) {
  204. return request.post('order/confirm', {
  205. cartId,
  206. 'new': news,
  207. addressId,
  208. 'shipping_type': shippingType,
  209. store_id,
  210. 'couponId':couponId,
  211. luckRecordId
  212. });
  213. }
  214. /**
  215. * 获取当前金额能使用的优惠卷
  216. * @param string price
  217. *
  218. */
  219. export function getCouponsOrderPrice(price, data) {
  220. return request.get('coupons/order/' + price, data)
  221. }
  222. /**
  223. * 订单创建
  224. * @param string key
  225. * @param object data
  226. *
  227. */
  228. export function orderCreate(key, data) {
  229. return request.post('order/create/' + key, data);
  230. }
  231. /**
  232. * 计算订单金额
  233. * @param key
  234. * @param data
  235. * @returns {*}
  236. */
  237. export function postOrderComputed(key, data) {
  238. return request.post("order/computed/" + key, data);
  239. }
  240. /**
  241. * 订单优惠券
  242. * @param key
  243. * @param data
  244. * @returns {*}
  245. */
  246. export function orderCoupon(orderId) {
  247. return request.post("v2/order/product_coupon/" + orderId);
  248. }
  249. /**
  250. * 计算会员线下付款金额
  251. * @param {Object} data
  252. */
  253. export function offlineCheckPrice(data) {
  254. return request.post("order/offline/check/price", data);
  255. }
  256. /**
  257. * 线下扫码付款
  258. * @param {Object} data
  259. */
  260. export function offlineCreate(data) {
  261. return request.post("order/offline/create", data);
  262. }
  263. /**
  264. * 支付方式开关
  265. */
  266. export function orderOfflinePayType() {
  267. return request.get('order/offline/pay/type');
  268. }
  269. /**
  270. * 开票记录
  271. */
  272. export function orderInvoiceList(data) {
  273. return request.get('v2/order/invoice_list', data);
  274. }
  275. /**
  276. * 开票订单详情
  277. * @param {Object} id
  278. */
  279. export function orderInvoiceDetail(id) {
  280. return request.get(`v2/order/invoice_detail/${id}`);
  281. }
  282. /**
  283. * 支付宝支付
  284. * @param {Object} key
  285. * @param {Object} quitUrl
  286. */
  287. export function aliPay(key, quitUrl) {
  288. return request.get('ali_pay', {
  289. key,
  290. quitUrl
  291. }, {
  292. noAuth: true
  293. });
  294. }
  295. /**
  296. * 退货物流单号提交
  297. * @param {Object} data
  298. */
  299. export function refundExpress(data) {
  300. return request.post("order/refund/express", data);
  301. }
  302. /**
  303. * 分类购物车列表
  304. */
  305. export function vcartList(data) {
  306. return request.get("v2/cart_list",data);
  307. }
  308. /**
  309. * 支付订单
  310. */
  311. export function payCashier(storeId) {
  312. return request.get(`order/pay_cashier?store_id=${storeId}`);
  313. }
  314. /**
  315. * 退款商品列表
  316. */
  317. export function refundGoodsList(orderId) {
  318. return request.get(`order/refund/cart_info/${orderId}`);
  319. }
  320. /**
  321. * 申请退款商品列表
  322. */
  323. export function postRefundGoods(data) {
  324. return request.post(`order/refund/cart_info`, data);
  325. }
  326. /**
  327. * 退款商品提交
  328. */
  329. export function returnGoodsSubmit(id, data) {
  330. return request.post(`order/refund/apply/${id}`, data);
  331. }
  332. /**
  333. * 确认订单详情(是否显示快递配送)
  334. */
  335. export function checkShipping(data) {
  336. return request.post(`order/check_shipping`, data);
  337. }
  338. /**
  339. * 配送订单详情
  340. */
  341. export function deliveryDetail(id) {
  342. return request.get(`delivery_order/detail/${id}`);
  343. }
  344. /**
  345. * 订单核销记录
  346. * @param {Object} id
  347. */
  348. export function orderWriteRecords(id, data) {
  349. return request.get(`order/write/records/${id}`, data);
  350. }