diff --git a/common/api/account.js b/common/api/account.js index 9d87e9b..0aeac40 100644 --- a/common/api/account.js +++ b/common/api/account.js @@ -2,19 +2,19 @@ * @Author: ch * @Date: 2022-03-17 16:38:39 * @LastEditors: ch - * @LastEditTime: 2022-04-02 09:58:50 + * @LastEditTime: 2022-04-06 09:59:52 * @Description: file content */ import {ToAsyncAwait, MsbRequest} from '@/common/utils'; -import orderList from '@/mock/orderList' +const BASE_URL = '/uc' const ApiGetCurrentUser = () => - ToAsyncAwait(MsbRequest.get('/user/current')); + ToAsyncAwait(MsbRequest.get(`${BASE_URL}/user/current`)); const ApiPutUser = (data) => - ToAsyncAwait(MsbRequest.put('/user/', data)) + ToAsyncAwait(MsbRequest.put(`${BASE_URL}/user/`, data)) export { // 获取当前登录用户信息 ApiGetCurrentUser, diff --git a/common/api/cart.js b/common/api/cart.js new file mode 100644 index 0000000..28191cc --- /dev/null +++ b/common/api/cart.js @@ -0,0 +1,38 @@ +/* + * @Author: ch + * @Date: 2022-04-06 10:14:03 + * @LastEditors: ch + * @LastEditTime: 2022-04-06 15:49:07 + * @Description: file content + */ + +import {ToAsyncAwait, MsbRequest} from '@/common/utils'; + +const BASE_URL = '/mall/product'; + +/** + * 设置购物车数量 + * @param {id,number} data + */ +export const ApiPutCartNum = (data) => + ToAsyncAwait(MsbRequest.put(`${BASE_URL}/shoppingCart/number`, data)); + +/** + * 往购物车中添加商品 + * @param {prodcutId, productSkuId, number} data + */ +export const ApiPutAddCart = (data) => + ToAsyncAwait(MsbRequest.put(`${BASE_URL}/shoppingCart/increase`, data)); +/** + * 删除购物车中的商品 + * @param {idList} data + */ +export const ApiDeleteCartGoods = (data) => + ToAsyncAwait(MsbRequest.delete(`${BASE_URL}/shoppingCart?idList=${data.idList}`, data)); +/** + * 获取购物车列表 + */ +export const ApiGetCartList = () => + ToAsyncAwait(MsbRequest.get(`${BASE_URL}/shoppingCart`)); + + \ No newline at end of file diff --git a/common/api/category.js b/common/api/category.js deleted file mode 100644 index f20bec0..0000000 --- a/common/api/category.js +++ /dev/null @@ -1,7 +0,0 @@ -/* - * @Author: ch - * @Date: 2022-03-17 16:38:26 - * @LastEditors: ch - * @LastEditTime: 2022-03-17 16:38:26 - * @Description: file content - */ diff --git a/common/api/goods.js b/common/api/goods.js index 4eb0c48..e8cb67d 100644 --- a/common/api/goods.js +++ b/common/api/goods.js @@ -2,26 +2,27 @@ * @Author: ch * @Date: 2022-04-02 09:54:53 * @LastEditors: ch - * @LastEditTime: 2022-04-02 15:17:20 + * @LastEditTime: 2022-04-06 10:15:32 * @Description: file content */ import {ToAsyncAwait, MsbRequest} from '@/common/utils'; +const BASE_URL = '/mall/product'; /** * 获取商品,瀑布流 * @param {*} params */ export const ApiGetGoodsList = (params) => - ToAsyncAwait(MsbRequest.get('/app/product/page', params)); + ToAsyncAwait(MsbRequest.get(`${BASE_URL}/app/product/page`, params)); /** * 获取商品详情 * @param {*} params */ export const ApiGetGoodsDetail = (params) => - ToAsyncAwait(MsbRequest.get(`/app/product/${params.id}`)); + ToAsyncAwait(MsbRequest.get(`${BASE_URL}/app/product/${params.id}`)); /** * 获取商品sku信息 * @param {*} productId */ export const ApiGetGoodsSkus = (params) => -ToAsyncAwait(MsbRequest.get('/app/product/sku',params)); \ No newline at end of file +ToAsyncAwait(MsbRequest.get(`${BASE_URL}/app/product/sku`,params)); \ No newline at end of file diff --git a/common/api/index.js b/common/api/index.js index f76cbdc..6bf12b0 100644 --- a/common/api/index.js +++ b/common/api/index.js @@ -2,28 +2,23 @@ * @Author: ch * @Date: 2022-03-17 16:37:45 * @LastEditors: ch - * @LastEditTime: 2022-04-02 09:58:40 + * @LastEditTime: 2022-04-06 10:02:29 * @Description: file content */ import {MsbRequest, ToAsyncAwait} from '@/common/utils'; -/** - * 获取测试信息 - * @param {*} params - */ -export const ApiGetBannerData = (params) => - ToAsyncAwait(MsbRequest.get('/edu-course/carousel/app',params)); +const BASE_URL = '/uc'; /** * 登录 * @param {*} data */ -export const ApiPostLogin = (data) => ToAsyncAwait(MsbRequest.post('/user/login', data)); +export const ApiPostLogin = (data) => ToAsyncAwait(MsbRequest.post(`${BASE_URL}/user/login`, data)); /** * 获取手机验证码 * @param {*} params */ -export const ApiGetCode = (params) => ToAsyncAwait(MsbRequest.get('/user/login/verificationCode', params)); +export const ApiGetCode = (params) => ToAsyncAwait(MsbRequest.get(`${BASE_URL}/user/login/verificationCode`, params)); \ No newline at end of file diff --git a/common/api/order.js b/common/api/order.js index a3baf70..0e5d817 100644 --- a/common/api/order.js +++ b/common/api/order.js @@ -2,49 +2,51 @@ * @Author: ch * @Date: 2022-03-29 17:38:17 * @LastEditors: ch - * @LastEditTime: 2022-04-02 09:58:29 + * @LastEditTime: 2022-04-06 10:01:40 * @Description: file content */ import {ToAsyncAwait, MsbRequest} from '@/common/utils'; +const BASE_URL = '/mall/trade'; + /** * 获取订单 * @param {*} params */ export const ApiGetOrderList = (params) => - ToAsyncAwait(MsbRequest.get('/app/tradeOrder/page', params)); + ToAsyncAwait(MsbRequest.get(`${BASE_URL}/app/tradeOrder/page`, params)); /** * 获取预订单 * @param {*} data */ export const ApiGetBeforeOrder = (data) => - ToAsyncAwait(MsbRequest.get('/app/tradeOrder/buyAdvanceOrder', data)); + ToAsyncAwait(MsbRequest.get(`${BASE_URL}/app/tradeOrder/buyAdvanceOrder`, data)); /** * 订单详情 * @param {*} id */ export const ApiGetOrderDetail = (id) => - ToAsyncAwait(MsbRequest.get(`/app/tradeOrder/${id}`)); + ToAsyncAwait(MsbRequest.get(`${BASE_URL}/app/tradeOrder/${id}`)); /** * 提交订单 * @param {*} data */ export const ApiPostSubmitOrder = (data) => - ToAsyncAwait(MsbRequest.post('/app/tradeOrder/submitOrder', data)); + ToAsyncAwait(MsbRequest.post(`${BASE_URL}/app/tradeOrder/submitOrder`, data)); /** * 取消订单 * @param {*} data */ export const ApiPutCancelOrder = (data) => - ToAsyncAwait(MsbRequest.post('/app/tradeOrder/cancel', data)); + ToAsyncAwait(MsbRequest.post(`${BASE_URL}/app/tradeOrder/cancel`, data)); /** * 获取支付参数 * @param {*} data */ export const ApiPostWxPay = (data) => - ToAsyncAwait(MsbRequest.post('/pay/wxPay/app', data)); + ToAsyncAwait(MsbRequest.post(`${BASE_URL}/pay/wxPay/app`, data)); \ No newline at end of file diff --git a/common/plugins/msbUniRequest.js b/common/plugins/msbUniRequest.js index a74f58a..fe10dc7 100644 --- a/common/plugins/msbUniRequest.js +++ b/common/plugins/msbUniRequest.js @@ -86,7 +86,7 @@ class MsbUniRequest { put(url, data, header){ return this.method({method : 'PUT', url, data, header}); } - delete(url, data){ + delete(url, data, header){ return this.method({method : 'DELETE', url, data, header}); } } diff --git a/manifest.json b/manifest.json index 4de9baa..0ca764a 100644 --- a/manifest.json +++ b/manifest.json @@ -75,17 +75,17 @@ }, "devServer" : { "proxy" : { - "/user/" : { - "target": "http://192.168.10.251:4500/" + "/uc/" : { + "target": "http://192.168.10.20:8090/" }, - "/app/tradeOrder/" : { - "target": "http://192.168.10.109:4001/" + "/mall/trade/" : { + "target": "http://192.168.10.20:8090/" }, "/pay/" : { - "target": "http://192.168.10.109:4001/" + "target": "http://192.168.10.20:8090/" }, - "/app/product/" : { - "target" : "http://192.168.10.67:4002/" + "/mall/product/" : { + "target" : "http://192.168.10.20:8090/" } } } diff --git a/pages/account/cart.vue b/pages/account/cart.vue index 25bc737..ecaefd3 100644 --- a/pages/account/cart.vue +++ b/pages/account/cart.vue @@ -2,41 +2,49 @@ - - -