mall.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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. getCartListAjax: (page) => vm.$u.post('/client/shop_cart/getCartList',{page:page}),
  43. // 变更购物车数量
  44. updateCartNumsAjax: (json) => vm.$u.post('/client/shop_cart/updateCartNums',json),
  45. // 删除购物车商品
  46. delCartGoodsAjax: (ids) => vm.$u.post('/client/shop_cart/delCartGoods',{cart_ids:ids}),
  47. /**
  48. * 提交购物车订单
  49. * address_id 地址id
  50. * cart_ids 购物车id串
  51. * remark 备注
  52. * user_coupon_id 用户优惠券id
  53. **/
  54. submitCartOrderAjax: (json) => vm.$u.post('/client/shop_order/submitCartOrder',json),
  55. /**
  56. * 订单列表
  57. * status string 订单状态 不传则输出所有订单,10=待付款, 11=待发货, 12=待收货, 13=已完成,
  58. * page int 页码
  59. **/
  60. getOrderListAjax: ({status,page}) => vm.$u.post('/client/shop_order/getOrderList',{status,page}),
  61. /**
  62. * 订单详情
  63. * order_id int 订单id
  64. **/
  65. getOrderDetailAjax: (order_id) => vm.$u.post('/client/shop_order/getOrderDetail',{order_id:order_id}),
  66. /**
  67. * 取消订单
  68. * order_id int 订单id
  69. **/
  70. cancelOrderAjax: (order_id) => vm.$u.post('/client/shop_order/cancelOrder',{order_id:order_id}),
  71. /**
  72. * 申请售后
  73. * order_id int 订单id
  74. * order_detail_ids string 订单详情id串 用逗号隔开 1,2
  75. * refund_type int 售后类型:1=仅退款,2=退货
  76. * reason string 退款原因
  77. */
  78. refundOrderAjax: (json) => vm.$u.post('/client/shop_order/refundOrder',json),
  79. /**
  80. * 设置退货快递单号
  81. * order_detail_id int 订单详情id
  82. * expressCode string 快递单号
  83. **/
  84. setExpressCodeAjax: (json) => vm.$u.post('/client/shop_order/setExpressCode',json),
  85. /**
  86. * 退款/售后订单列表
  87. * status string 订单状态: 不传则输出所有订单 10=待付款, 11=待发货, 12=待收货, 13=已完成,
  88. * page int 页码
  89. *
  90. * 返回事例: 子订单状态sub_status:
  91. * 10=正常(非售后订单),20=仅退款,21=卖家同意,22=卖家驳回,30=退货退款,
  92. * 31=卖家同意(用户填写退货单号),32=卖家驳回,33=等待卖家收货确认中,
  93. * 34=卖家确认收货,验货没问题金额已原路退回
  94. **/
  95. getRefundOrderListAjax: (json) => vm.$u.post('/client/shop_order/getRefundOrderList',json),
  96. /**
  97. * 查看物流
  98. * order_id int 订单id
  99. **/
  100. getExpressDetailAjax: (order_id) => vm.$u.post('/client/shop_order/getExpressDetail',{order_id:order_id}),
  101. /**确认收货
  102. * order_id 是 int 订单id
  103. order_detail_ids 是 string 确认收货的订单详情id串 多个用逗号隔开
  104. */
  105. orderConfirmAjax: (json) => vm.$u.post('/client/shop_order/orderConfirm',json),
  106. /**
  107. * 收藏商品列表
  108. */
  109. collectionListAjax: (json) => vm.$u.post('/client/shopGoods/getCollectionList'),
  110. /**
  111. * 收藏/取消收藏商品列表
  112. */
  113. collectonAjax: (id) => vm.$u.post('/client/shopGoods/collection',{goods_id:id}),
  114. /**
  115. * 批量删除收藏
  116. * ids :收藏列表id串,多个用逗号隔开
  117. **/
  118. delCollectionAjax: (ids) => vm.$u.post('/client/shopGoods/delCollection',{ids:ids}),
  119. /**
  120. * 售后详情
  121. * id :退款售后列表中的id
  122. **/
  123. getRefundOrderDetailAjax: (id) => vm.$u.post('/client/shopOrder/getRefundOrderDetail',{id:id}),
  124. }
  125. }