order.js 6.1 KB

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