mall.js 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. export const useMallApi = (Vue, vm) => {
  2. return {
  3. // 查询商城轮播图
  4. getMallSwiperAjax: () => vm.$u.post('/client/index/getBaseElementList',{element_type:1}),
  5. // 2=按钮组(金刚区)
  6. getMallMenuAjax: () => vm.$u.post('/client/index/getBaseElementList',{element_type:2}),
  7. // 三图接口
  8. getSelfElementListAjax: () => vm.$u.post('/client/index/getSelfElementList'),
  9. // 查询分类
  10. getCateListAjax: () => vm.$u.post('/client/index/getCateList'),
  11. // 获取购物车数量
  12. getCartNumsAjax: () => vm.$u.post('/client/shop_cart/getCartNums'),
  13. /**商品列表
  14. * id 否 string 商品id
  15. * title 否 string 书名
  16. * cate_id 否 string 分类列表中的id 不是分类列表中的cate_id
  17. * tags_type 是 string 标签类型: default=默认,hot=热门,recommend=推荐
  18. * price_sc 否 string desc=降序 asc=升序 (不传默认综合排序)
  19. * sales_sc否 string desc=降序 asc=升序 (不传默认综合排序)
  20. * page 否 int 页码
  21. **/
  22. getGoodsListAjax: (json) => vm.$u.post('/client/shopGoods/getList',json),
  23. /* // 热门商品,便于维护,分开来写,同商品列表接口,tags_type字段传 host
  24. getHotListAjax: (json) => vm.$u.post('/client/shopGoods/getList',{
  25. ...json,
  26. tags_type:'hot',
  27. }),
  28. // 推荐商品,便于维护,分开来写,同商品列表接口,tags_type字段传 host
  29. getRecommendListAjax: (json) => vm.$u.post('/client/shopGoods/getList',{
  30. ...json,
  31. tags_type:'recommend',
  32. }), */
  33. // 商品详情
  34. getGoodsDetailAjax: (id) => vm.$u.post('/client/shopGoods/getGoodsDetail',{id:id}),
  35. // 提交订单
  36. submitOrderAjax: (json) => vm.$u.post('/client/shop_order/submitOrder',json),
  37. // 发起支付
  38. payAjax: (order_no) => vm.$u.post('/client/pay/pay',{order_no:order_no}),
  39. // 加入购物车
  40. addCartAjax: (json) => vm.$u.post('/client/shop_cart/addCart',json),
  41. // 新版加入购物车
  42. addShopCartAjax: (json) => vm.$u.post('/token/shop/cart/add',json),
  43. // 购物车列表
  44. getCartListAjax: (page) => vm.$u.post('/client/shop_cart/getCartList',{page:page}),
  45. // 变更购物车数量
  46. updateCartNumsAjax: (json) => vm.$u.post('/client/shop_cart/updateCartNums',json),
  47. // 删除购物车商品
  48. delCartGoodsAjax: (ids) => vm.$u.post('/client/shop_cart/delCartGoods',{cart_ids:ids}),
  49. /**
  50. * 提交购物车订单
  51. * address_id 地址id
  52. * cart_ids 购物车id串
  53. * remark 备注
  54. * user_coupon_id 用户优惠券id
  55. **/
  56. submitCartOrderAjax: (json) => vm.$u.post('/client/shop_order/submitCartOrder',json),
  57. /**
  58. * 订单列表
  59. * status string 订单状态 不传则输出所有订单,10=待付款, 11=待发货, 12=待收货, 13=已完成,
  60. * page int 页码
  61. **/
  62. getOrderListAjax: ({status,page}) => vm.$u.post('/client/shop_order/getOrderList',{status,page}),
  63. /**
  64. * 订单详情
  65. * order_id int 订单id
  66. **/
  67. getOrderDetailAjax: (order_id) => vm.$u.post('/client/shop_order/getOrderDetail',{order_id:order_id}),
  68. /**
  69. * 取消订单
  70. * order_id int 订单id
  71. **/
  72. cancelOrderAjax: (order_id) => vm.$u.post('/client/shop_order/cancelOrder',{order_id:order_id}),
  73. /**
  74. * 申请售后
  75. * order_id int 订单id
  76. * order_detail_ids string 订单详情id串 用逗号隔开 1,2
  77. * refund_type int 售后类型:1=仅退款,2=退货
  78. * reason string 退款原因
  79. */
  80. refundOrderAjax: (json) => vm.$u.post('/client/shop_order/refundOrder',json),
  81. /**
  82. * 设置退货快递单号
  83. * order_detail_id int 订单详情id
  84. * expressCode string 快递单号
  85. **/
  86. setExpressCodeAjax: (json) => vm.$u.post('/client/shop_order/setExpressCode',json),
  87. /**
  88. * 退款/售后订单列表
  89. * status string 订单状态: 不传则输出所有订单 10=待付款, 11=待发货, 12=待收货, 13=已完成,
  90. * page int 页码
  91. *
  92. * 返回事例: 子订单状态sub_status:
  93. * 10=正常(非售后订单),20=仅退款,21=卖家同意,22=卖家驳回,30=退货退款,
  94. * 31=卖家同意(用户填写退货单号),32=卖家驳回,33=等待卖家收货确认中,
  95. * 34=卖家确认收货,验货没问题金额已原路退回
  96. **/
  97. getRefundOrderListAjax: (json) => vm.$u.post('/client/shop_order/getRefundOrderList',json),
  98. /**
  99. * 查看物流
  100. * order_id int 订单id
  101. **/
  102. getExpressDetailAjax: (order_id) => vm.$u.post('/client/shop_order/getExpressDetail',{order_id:order_id}),
  103. /**确认收货
  104. * order_id 是 int 订单id
  105. order_detail_ids 是 string 确认收货的订单详情id串 多个用逗号隔开
  106. */
  107. orderConfirmAjax: (json) => vm.$u.post('/client/shop_order/orderConfirm',json),
  108. /**
  109. * 收藏商品列表
  110. */
  111. collectionListAjax: (json) => vm.$u.post('/client/shopGoods/getCollectionList'),
  112. /**
  113. * 收藏/取消收藏商品列表
  114. */
  115. collectonAjax: (id) => vm.$u.post('/client/shopGoods/collection',{goods_id:id}),
  116. /**
  117. * 批量删除收藏
  118. * ids :收藏列表id串,多个用逗号隔开
  119. **/
  120. delCollectionAjax: (ids) => vm.$u.post('/client/shopGoods/delCollection',{ids:ids}),
  121. /**
  122. * 售后详情
  123. * id :退款售后列表中的id
  124. **/
  125. getRefundOrderDetailAjax: (id) => vm.$u.post('/client/shopOrder/getRefundOrderDetail',{id:id}),
  126. // 热门搜索列表
  127. getHotSearchListAjax: () => vm.$u.get('/token/shop/user/hotSearchList'),
  128. // 用户搜索历史
  129. getSearchHistoryAjax: () => vm.$u.get('/token/shop/user/searchList'),
  130. // 用户搜索 (结果列表)
  131. getSearchKeywordAjax: (params) => vm.$u.get('/token/shop/user/searchKeyword', params),
  132. // 购物车列表
  133. getShopCartListAjax: (params) => vm.$u.post('/token/shop/cart/list', params),
  134. // 修改购物车商品品相
  135. updateCartConditionAjax: (params) => vm.$u.post('/token/shop/cart/updateConditionType', params),
  136. // 修改购物车商品数量
  137. updateCartNumAjax: (params) => vm.$u.post('/token/shop/cart/updateNum', params),
  138. // 删除购物车商品
  139. deleteCartItemAjax: (id) => vm.$u.post(`/token/shop/cart/deleteItem/${id}`),
  140. // 清空购物车
  141. clearCartAjax: () => vm.$u.post('/token/shop/cart/clearCart'),
  142. // 买书订单预览 (预提交)
  143. preSubmitOrderAjax: (data) => vm.$u.post('/token/shop/order/preSubmit', data),
  144. // 确认提交订单 (买书)
  145. submitShopOrderAjax: (data) => vm.$u.post('/token/shop/order/submitOrder', data),
  146. // 图书商品详情页面
  147. getBookDetailAjax: (params) => vm.$u.get('/token/shop/bookDetail', params),
  148. // 订单支付
  149. payShopOrderAjax: (data) => vm.$u.post('/token/shop/order/orderPay', data),
  150. }
  151. }