Browse Source

H5-商品购买接口整理

panyong 3 years ago
parent
commit
bd8fcaf61e

+ 53 - 0
htmldev/dashboard/src/views/sell/goods/api/index.js

@@ -23,3 +23,56 @@ export const apiProductDetail = (id) => request({
     id
   }
 })
+
+/**
+ * 购物车商品列表
+ * @param id 酒吧ID
+ * @param page 第几页
+ * @param pageSize 每页数量
+ */
+export const apiCartList = (id, page, pageSize = 20) => request({
+  method: 'GET',
+  url: '/api/v1/user/cart/list',
+  params: {
+    id,
+    page,
+    page_size: pageSize
+  }
+})
+
+/**
+ * 清空购物车
+ * @param id 酒吧ID
+ */
+export const apiCartClear = (id) => request({
+  method: 'GET',
+  url: '/api/v1/user/cart/clear',
+  params: {
+    id
+  }
+})
+
+/**
+ * 更新购物车
+ * @param id 购物车数据ID
+ * @param type 类型(0减少1增加)
+ */
+export const apiCartUpdate = (id, type) => request({
+  method: 'POST',
+  url: '/api/v1/user/cart/update',
+  data: {
+    id,
+    type
+  }
+})
+/**
+ * 添加商品到购物车
+ * @param postData
+ */
+export const apiCartAdd = (postData) => request({
+  method: 'POST',
+  url: '/api/v1/user/cart/add',
+  data: {
+    postData
+  }
+})

+ 8 - 6
htmldev/dashboard/src/views/sell/pay/api/index.js

@@ -2,32 +2,34 @@ import request from '@/api/request'
 
 /**
  * 获取预付款
+ * @param id 酒吧ID
  */
 export const apiBarList = (id) => request({
   method: 'GET',
   url: '/api/v1/user/prepare/order/list',
   params: {
-    bar_id: id // 酒吧ID
+    bar_id: id
   }
 })
 
 /**
  * 获取优惠券
+ * @param id 酒吧ID
  */
 export const apiCouponList = (id) => request({
   method: 'GET',
   url: '/api/v1/user/coupon/list',
   params: {
-    bar_id: id // 酒吧ID
+    bar_id: id
   }
 })
 
 /**
- * 创建订座
- * @param postData 表单提交
+ * 创建购买商品订单
+ * @param postData
  */
-export const apiPlacePreOrder = (postData) => request({
+export const apiAddOrder = (postData) => request({
   method: 'POST',
-  url: '/api/v1/user/preorder/create',
+  url: '/api/v1/user/order/add',
   data: postData
 })