From bbab09950b17ae0e12845d50478d4f30afa48073 Mon Sep 17 00:00:00 2001 From: "jqtmviyu@gmail.com" Date: Sat, 6 Mar 2021 21:38:48 +0800 Subject: [PATCH] =?UTF-8?q?bugfix:=20ORDERS=5FCREATE=5FUR=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3=E4=B8=BA=20MY=5FORDERS=5FCREATE=5FURL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/http.api.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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 + }), + } }