diff --git a/src/common/http.api.js b/src/common/http.api.js index eff85a2..d652423 100644 --- a/src/common/http.api.js +++ b/src/common/http.api.js @@ -20,6 +20,11 @@ const GOODS_DETAIOL_URL = '/goods/detail' // 获取用户token const USERS_WXLOGIN_URL = '/users/wxlogin' +// 创建订单 +const MY_ORDERS_CREATE_URL = '/my/orders/create' + +const token = uni.getStorageSync('token') || '' + // 此处第二个参数vm,就是我们在页面使用的this,你可以通过vm获取vuex等操作 const install = (Vue, vm) => { // 首页 @@ -44,7 +49,13 @@ const install = (Vue, vm) => { getCategories, getGoods, getGoodsDetail, - getUserToken: (params = {}) => vm.$u.post(USERS_WXLOGIN_URL, params) + // 获取token + getUserToken: (params = {}) => vm.$u.post(USERS_WXLOGIN_URL, params), + // 创建订单 + createOrders: (params = {}) => vm.$u.post(MY_ORDERS_CREATE_URL, params, { + Authorization: token + }), + } }