order.js 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  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) {
  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. */
  90. export function orderData() {
  91. return request.get('order/data')
  92. }
  93. /**
  94. * 订单取消
  95. * @param string id
  96. *
  97. */
  98. export function orderCancel(id) {
  99. return request.post('order/cancel', {
  100. id: id
  101. });
  102. }
  103. /**
  104. * 删除已完成订单
  105. * @param string uni
  106. *
  107. */
  108. export function orderDel(uni) {
  109. return request.post('order/del', {
  110. uni: uni
  111. });
  112. }
  113. /**
  114. * 订单详情
  115. * @param string uni
  116. */
  117. export function getOrderDetail(uni, cart_id) {
  118. return request.get('order/detail/' + uni + `${cart_id ? `/${cart_id}`:''}`);
  119. }
  120. /**
  121. * 退款订单详情
  122. * @param string uni
  123. */
  124. export function getRefundOrderDetail(uni, cart_id) {
  125. return request.get('order/refund_detail/' + uni + `${cart_id ? `/${cart_id}`:''}`);
  126. }
  127. /**
  128. * 再次下单
  129. * @param string uni
  130. *
  131. */
  132. export function orderAgain(uni) {
  133. return request.post('order/again', {
  134. uni: uni
  135. });
  136. }
  137. /**
  138. * 订单收货
  139. * @param string uni
  140. *
  141. */
  142. export function orderTake(uni) {
  143. return request.post('order/take', {
  144. uni: uni
  145. });
  146. }
  147. /**
  148. * 订单查询物流信息
  149. * @returns {*}
  150. */
  151. export function express(uni, type) {
  152. return request.get("order/express/" + uni + `${type?'/refund':''}`);
  153. }
  154. /**
  155. * 获取退款理由
  156. *
  157. */
  158. export function ordeRefundReason() {
  159. return request.get('order/refund/reason');
  160. }
  161. /**
  162. * 订单退款审核
  163. * @param object data
  164. */
  165. export function orderRefundVerify(data) {
  166. return request.post('order/refund/verify', data);
  167. }
  168. /**
  169. * 订单确认获取订单详细信息
  170. * @param string cartId
  171. */
  172. export function orderConfirm(cartId, news, addressId,shipping_type) {
  173. return request.post('order/confirm', {
  174. cartId,
  175. 'new': news,
  176. addressId,
  177. shipping_type
  178. });
  179. }
  180. /**
  181. * 获取当前金额能使用的优惠卷
  182. * @param string price
  183. *
  184. */
  185. export function getCouponsOrderPrice(price, data) {
  186. return request.get('coupons/order/' + price, data)
  187. }
  188. /**
  189. * 订单创建
  190. * @param string key
  191. * @param object data
  192. *
  193. */
  194. export function orderCreate(key, data) {
  195. return request.post('order/create/' + key, data);
  196. }
  197. /**
  198. * 计算订单金额
  199. * @param key
  200. * @param data
  201. * @returns {*}
  202. */
  203. export function postOrderComputed(key, data) {
  204. return request.post("order/computed/" + key, data);
  205. }
  206. /**
  207. * 订单优惠券
  208. * @param key
  209. * @param data
  210. * @returns {*}
  211. */
  212. export function orderCoupon(orderId) {
  213. return request.post("v2/order/product_coupon/" + orderId);
  214. }
  215. /**
  216. * 计算会员线下付款金额
  217. * @param {Object} data
  218. */
  219. export function offlineCheckPrice(data) {
  220. return request.post("order/offline/check/price", data);
  221. }
  222. /**
  223. * 线下扫码付款
  224. * @param {Object} data
  225. */
  226. export function offlineCreate(data) {
  227. return request.post("order/offline/create", data);
  228. }
  229. /**
  230. * 支付方式开关
  231. */
  232. export function orderOfflinePayType() {
  233. return request.get('order/offline/pay/type');
  234. }
  235. /**
  236. * 开票记录
  237. */
  238. export function orderInvoiceList(data) {
  239. return request.get('v2/order/invoice_list', data);
  240. }
  241. /**
  242. * 开票订单详情
  243. * @param {Object} id
  244. */
  245. export function orderInvoiceDetail(id) {
  246. return request.get(`v2/order/invoice_detail/${id}`);
  247. }
  248. /**
  249. * 支付宝支付
  250. * @param {Object} key
  251. * @param {Object} quitUrl
  252. */
  253. export function aliPay(key, quitUrl) {
  254. return request.get('ali_pay', {
  255. key,
  256. quitUrl
  257. }, {
  258. noAuth: true
  259. });
  260. }
  261. /**
  262. * 退货物流单号提交
  263. * @param {Object} data
  264. */
  265. export function refundExpress(data) {
  266. return request.post("order/refund/express", data);
  267. }
  268. /**
  269. * 分类购物车列表
  270. */
  271. export function vcartList() {
  272. return request.get("v2/cart_list");
  273. }
  274. /**
  275. * 退款商品列表
  276. */
  277. export function refundGoodsList(orderId) {
  278. return request.get(`order/refund/cart_info/${orderId}`);
  279. }
  280. /**
  281. * 申请退款商品列表
  282. */
  283. export function postRefundGoods(data) {
  284. return request.post(`order/refund/cart_info`, data);
  285. }
  286. /**
  287. * 退款商品提交
  288. */
  289. export function returnGoodsSubmit(id, data) {
  290. return request.post(`order/refund/apply/${id}`, data);
  291. }
  292. /**
  293. * 新订单列表 2.1版本
  294. * @param object data
  295. */
  296. export function getNewOrderList(data) {
  297. return request.get('order/refund/list', data);
  298. }
  299. /**
  300. * 退款订单详情
  301. * @param string uni
  302. */
  303. export function refundOrderDetail(uni) {
  304. return request.get('order/refund/detail/' + uni);
  305. }
  306. /**
  307. * 放弃申请退款
  308. * @param string uni
  309. */
  310. export function cancelRefundOrder(uni) {
  311. return request.post('order/refund/cancel/' + uni);
  312. }