From bd7873f85ef269e2954b6d1065d84284c420a1a2 Mon Sep 17 00:00:00 2001 From: LengYingxin Date: Sat, 18 Aug 2018 14:23:32 +0800 Subject: [PATCH] init --- app.json | 14 ++++++------- common/common.js | 49 +++++++++++++++++++++++++++++++++++++++++++ config/config.js | 11 +++++++++- pages/user/index.wxml | 6 +++--- project.config.json | 4 ++-- utils/http.js | 14 +++++++------ 6 files changed, 79 insertions(+), 19 deletions(-) diff --git a/app.json b/app.json index b475bea..e943258 100644 --- a/app.json +++ b/app.json @@ -1,15 +1,15 @@ { - "pages": [ + "pages":[ "pages/index/index", + "pages/market/index", + "pages/user/index", "pages/coupons/details/index", "pages/shop/details/index", "pages/rushToBuy/index", "pages/shop/index/index", - "pages/market/index", "pages/coupons/index/index", "pages/order/details/index", "pages/order/index/index", - "pages/user/index", "pages/success/index", "pages/login/index" ], @@ -28,15 +28,15 @@ "text": "我的" }] }, - "window": { - "backgroundTextStyle": "light", + "window":{ + "backgroundTextStyle":"light", "navigationBarBackgroundColor": "#fff", "navigationBarTitleText": "WeChat", - "navigationBarTextStyle": "black" + "navigationBarTextStyle":"black" }, "networkTimeout": { "request": 10000, "downloadFile": 10000 }, "debug": false -} \ No newline at end of file +} diff --git a/common/common.js b/common/common.js index ab14adc..385dd1c 100755 --- a/common/common.js +++ b/common/common.js @@ -212,5 +212,54 @@ const func = { }) }) }, + refundCouponOrder: function (couponOrderId) { + return new Promise((resolve, reject) => { + wx.request({ + url: config.api.refundCouponOrder, + header: { + "token": app.globalData.token + }, + data: { + couponOrderId: couponOrderId, + token: app.globalData.token + }, + method: "POST", + success: function (res) { + resolve(res) + }, + fail: function (err) { + reject(err) + }, + complete: function (res) { + console.log(res) + } + }) + }) + }, + refundOrderCreate: function (orderId, payOrderId) { + return new Promise((resolve, reject) => { + wx.request({ + url: config.api.refundOrdercCreate, + header: { + "token": app.globalData.token + }, + data: { + payOrderId: payOrderId, + orderId: orderId, + token: app.globalData.token + }, + method: "POST", + success: function (res) { + resolve(res) + }, + fail: function (err) { + reject(err) + }, + complete: function (res) { + console.log(res) + } + }) + }) + }, } module.exports = func; \ No newline at end of file diff --git a/config/config.js b/config/config.js index f4c2ae7..9fc3692 100755 --- a/config/config.js +++ b/config/config.js @@ -1,4 +1,5 @@ var url = 'https://ciformall.youlane.cn' +//var url = 'http://a8b668aa.ngrok.io' //var url = 'http://localhost:8001' var apiPrefix = url + '/C'; var config = { @@ -40,10 +41,18 @@ var config = { * 订单列表 */ orderList: '/api/order/list', + /** + * 退券 + */ + refundCouponOrder: '/api/couponOrder/refund', + /** + * 退款申请 + */ + refundOrdercCreate: '/api/refund/create', }, weapp: { - AppId: 'wx649b3be73c1afe47', + AppId: 'wx8eb8275b78db4ede', } }; diff --git a/pages/user/index.wxml b/pages/user/index.wxml index a020fb3..e18db16 100644 --- a/pages/user/index.wxml +++ b/pages/user/index.wxml @@ -7,13 +7,13 @@ - + 我的订单 全部订单 - + 待付款 @@ -21,7 +21,7 @@ - + 已完成 diff --git a/project.config.json b/project.config.json index a62cd3f..8030779 100644 --- a/project.config.json +++ b/project.config.json @@ -12,8 +12,8 @@ }, "compileType": "miniprogram", "libVersion": "2.2.2", - "appid": "wx649b3be73c1afe47", - "projectname": "C4", + "appid": "wx8eb8275b78db4ede", + "projectname": "%E5%AF%8C%E8%8C%82%E6%94%AF%E4%BB%98%E6%B5%8B%E8%AF%95", "isGameTourist": false, "condition": { "search": { diff --git a/utils/http.js b/utils/http.js index 3e6ea20..cdf3067 100644 --- a/utils/http.js +++ b/utils/http.js @@ -1,5 +1,7 @@ +let host = 'https://ciformall.youlane.cn/C' + const postResquest = (url, token, message, postData, doSuccess, doFail) => { - let body={...postData}; + let body = { ...postData }; if (message != "") { wx.showLoading({ title: message, @@ -7,7 +9,7 @@ const postResquest = (url, token, message, postData, doSuccess, doFail) => { } wx.request({ //项目的真正接口,通过字符串拼接方式实现 - url: url, + url: host + url, header: { "content-type": "application/json;charset=UTF-8", "token": token @@ -39,7 +41,7 @@ const getResquest = (url, token, message, getData, doSuccess, doFail) => { }) } wx.request({ - url: url, + url: host + url, header: { "content-type": "application/json;charset=UTF-8", "token": token @@ -63,6 +65,6 @@ const getResquest = (url, token, message, getData, doSuccess, doFail) => { }) } module.exports = { - postResquest: postResquest, - getResquest: getResquest - } \ No newline at end of file + postResquest: postResquest, + getResquest: getResquest +} \ No newline at end of file