| @@ -1,52 +1,64 @@ | |||||
| var config = { | var config = { | ||||
| name: "富茂", | name: "富茂", | ||||
| url: "https://ciformall.youlane.cn/C/api", | |||||
| url: "https://ciformall.youlane.cn/C", | |||||
| //url: "http://dac6735a.ngrok.io/C/api", | //url: "http://dac6735a.ngrok.io/C/api", | ||||
| api: { | api: { | ||||
| /** | /** | ||||
| * 接口用途:login | * 接口用途:login | ||||
| */ | */ | ||||
| login: '/user/login', | |||||
| login: '/api/user/login', | |||||
| /** | /** | ||||
| * 授权后获取用户的昵称,unionId等信息 | * 授权后获取用户的昵称,unionId等信息 | ||||
| */ | */ | ||||
| getUserInfo: '/user/getUserInfo', | |||||
| getUserInfo: '/api/user/getUserInfo', | |||||
| /** | /** | ||||
| * 接口用途:授权后获取用户的手机号 | * 接口用途:授权后获取用户的手机号 | ||||
| */ | */ | ||||
| getUserPhone: '/user/getUserPhone', | |||||
| getUserPhone: '/api/user/getUserPhone', | |||||
| /** | /** | ||||
| * 检查用户授权状态 | * 检查用户授权状态 | ||||
| */ | */ | ||||
| checkUserStatus: '/user/checkUserStatus', | |||||
| checkUserStatus: '/api/user/checkUserStatus', | |||||
| /** | /** | ||||
| * 优惠券查询 | * 优惠券查询 | ||||
| */ | */ | ||||
| couponList: '/wxCoupon/list', | |||||
| couponList: '/api/wxCoupon/list', | |||||
| /** | /** | ||||
| * 优惠券详情 | * 优惠券详情 | ||||
| */ | */ | ||||
| couponDetail: '/wxCoupon/findById', | |||||
| couponDetail: '/api/wxCoupon/findById', | |||||
| /** | /** | ||||
| * 业态查询 | * 业态查询 | ||||
| */ | */ | ||||
| couponChannelList: '/wxCouponChannel/list', | |||||
| couponChannelList: '/api/wxCouponChannel/list', | |||||
| /** | /** | ||||
| * 下订单 | * 下订单 | ||||
| */ | */ | ||||
| orderSave: '/order/save', | |||||
| orderSave: '/api/order/save', | |||||
| /** | /** | ||||
| * 支付订单 | * 支付订单 | ||||
| */ | */ | ||||
| payOrderCreate: '/pay/create', | |||||
| payOrderCreate: '/api/pay/create', | |||||
| /** | /** | ||||
| * 订单状态更新 | * 订单状态更新 | ||||
| */ | */ | ||||
| payOrderUpdate: '/pay/updatePayOrder', | |||||
| payOrderUpdate: '/api/pay/updatePayOrder', | |||||
| /** | /** | ||||
| * 订单列表 | * 订单列表 | ||||
| */ | */ | ||||
| orderList: '/order/list', | |||||
| orderList: '/api/order/list', | |||||
| /** | |||||
| * 券包 | |||||
| */ | |||||
| couponOrderList: '/api/couponOrder/list', | |||||
| /** | |||||
| * 验证码发送 | |||||
| */ | |||||
| sendValidationCode: '/wxMsgValidationcode/sendvalidationcode', | |||||
| /** | |||||
| * 验证码确认 | |||||
| */ | |||||
| validationCode: '/wxMsgValidationcode/hasvalidationcode', | |||||
| }, | }, | ||||
| weapp: { | weapp: { | ||||
| @@ -1,7 +1,6 @@ | |||||
| let Http = require('../../../utils/http.js') | |||||
| let format = require('../../../utils/util.js') | let format = require('../../../utils/util.js') | ||||
| let app = getApp() | let app = getApp() | ||||
| const Http = require("../../../utils/HttpBasics") | |||||
| //1535126400000 | //1535126400000 | ||||
| Page({ | Page({ | ||||
| data: { | data: { | ||||
| @@ -30,18 +29,24 @@ Page({ | |||||
| this.getList(0) | this.getList(0) | ||||
| }, | }, | ||||
| getList(key) { | getList(key) { | ||||
| Http.getResquest('/api/couponOrder/list', app.globalData.token, '加载中', { | |||||
| pageNum: 1, | |||||
| pageSize: 10, | |||||
| orderStatus: key | |||||
| }, (res) => { | |||||
| Http.get({ | |||||
| url: config.api.couponOrderList, | |||||
| data: { | |||||
| pageNum: 1, | |||||
| pageSize: 10, | |||||
| orderStatus: key | |||||
| } | |||||
| }) | |||||
| .then(function(res) { | |||||
| console.log(res) | |||||
| res.data.list.map(file => { | res.data.list.map(file => { | ||||
| file.expiredTime = format.formatTime(file.expiredTime, 'yyyy-MM-dddd hh:mm:ss') | file.expiredTime = format.formatTime(file.expiredTime, 'yyyy-MM-dddd hh:mm:ss') | ||||
| }) | }) | ||||
| this.setData({ | this.setData({ | ||||
| list: res.data.list | list: res.data.list | ||||
| }) | }) | ||||
| console.log(res) | |||||
| },function(error){ | |||||
| }) | }) | ||||
| }, | }, | ||||
| handleChange({ | handleChange({ | ||||
| @@ -1,5 +1,6 @@ | |||||
| // pages/forgetpwd/forgetpwd.js | // pages/forgetpwd/forgetpwd.js | ||||
| const Http = require('../../../utils/http.js') | |||||
| let config = require('../../../config/config.js') | |||||
| let Http = require('../../../utils/HttpBasics') | |||||
| const app = getApp() | const app = getApp() | ||||
| Page({ | Page({ | ||||
| @@ -18,23 +19,22 @@ Page({ | |||||
| }, | }, | ||||
| next() { | next() { | ||||
| console.log(this.data.yzm) | console.log(this.data.yzm) | ||||
| Http.getResquest('/wxMsgValidationcode/hasvalidationcode', '', '加载中', { | |||||
| phone: this.data.phone, | |||||
| code: this.data.yzm, | |||||
| type: 1, | |||||
| appid: app.globalData.appId | |||||
| }, (res) => { | |||||
| console.log(res) | |||||
| if (res.code == 200) { | |||||
| //wx.navigateTo({ | |||||
| // url: `../setpwd/setpwd?phone=${this.data.phone}&code=${this.data.yzm}` | |||||
| //}) | |||||
| } else { | |||||
| wx.showToast({ | |||||
| title: res.res, | |||||
| }) | |||||
| Http.get({ | |||||
| url: config.api.validationCode, | |||||
| data: { | |||||
| phone: this.data.phone, | |||||
| code: this.data.yzm, | |||||
| type: 1, | |||||
| appid: app.globalData.appId | |||||
| } | } | ||||
| }) | }) | ||||
| .then(function(res){ | |||||
| },function(error){ | |||||
| wx.showToast({ | |||||
| title: error.data, | |||||
| }) | |||||
| }) | |||||
| }, | }, | ||||
| send() { | send() { | ||||
| var phoneReg = /(^1[3|4|5|7|8]\d{9}$)|(^09\d{8}$)/; | var phoneReg = /(^1[3|4|5|7|8]\d{9}$)|(^09\d{8}$)/; | ||||
| @@ -43,30 +43,35 @@ Page({ | |||||
| flag: false, | flag: false, | ||||
| retry: true | retry: true | ||||
| }) | }) | ||||
| Http.getResquest('/wxMsgValidationcode/sendvalidationcode', '', '加载中', { | |||||
| phone: this.data.phone, | |||||
| type: 1, | |||||
| appid: app.globalData.appId | |||||
| }, (res) => { | |||||
| Http.get({ | |||||
| url: config.api.validationCode, | |||||
| data: { | |||||
| phone: this.data.phone, | |||||
| code: this.data.yzm, | |||||
| type: 1, | |||||
| appid: app.globalData.appId | |||||
| } | |||||
| }) | |||||
| .then(function(res){ | |||||
| console.log(res) | console.log(res) | ||||
| var timer = setInterval(() => { | var timer = setInterval(() => { | ||||
| this.data.time-- | this.data.time-- | ||||
| this.setData({ | |||||
| time: this.data.time | |||||
| }) | |||||
| this.setData({ | |||||
| time: this.data.time | |||||
| }) | |||||
| if (this.data.time == 0) { | if (this.data.time == 0) { | ||||
| clearInterval(timer) | clearInterval(timer) | ||||
| this.setData({ | this.setData({ | ||||
| flag: true, | flag: true, | ||||
| retry: false, | retry: false, | ||||
| time:60 | |||||
| time: 60 | |||||
| }) | }) | ||||
| } | } | ||||
| }, 1000) | }, 1000) | ||||
| }) | |||||
| } else { | |||||
| wx.showToast({ | |||||
| title: '请输入有效手机号', | |||||
| }, function(error){ | |||||
| wx.showToast({ | |||||
| title: '请输入有效手机号', | |||||
| }) | |||||
| }) | }) | ||||
| } | } | ||||
| } | } | ||||
| @@ -53,14 +53,15 @@ Component({ | |||||
| }, | }, | ||||
| ready() { | ready() { | ||||
| Http.get({ | Http.get({ | ||||
| url: config.api.couponChannelList, data: { | |||||
| url: config.api.couponChannelList, | |||||
| data: { | |||||
| pageNum: 1, | pageNum: 1, | ||||
| pageSize: 10 | pageSize: 10 | ||||
| } | } | ||||
| }).then(res=>{ | |||||
| }).then(res => { | |||||
| this.setData({ | this.setData({ | ||||
| list: res.list | list: res.list | ||||
| }) | }) | ||||
| }) | }) | ||||
| } | } | ||||
| }) | |||||
| }) | |||||
| @@ -21,26 +21,26 @@ Page({ | |||||
| current_scroll: '1' | current_scroll: '1' | ||||
| }, | }, | ||||
| onLoad(e) { | onLoad(e) { | ||||
| this.getList(e.id) | |||||
| this.getList(e.id, 1) | |||||
| this.setData({ | this.setData({ | ||||
| current_scroll: e.id | current_scroll: e.id | ||||
| }); | }); | ||||
| }, | }, | ||||
| getList(key) { | |||||
| getList(key, pageNum) { | |||||
| wx.showLoading({ | wx.showLoading({ | ||||
| title: 'loading...', | title: 'loading...', | ||||
| }) | }) | ||||
| Http.get({ | Http.get({ | ||||
| url: '/api/order/list', | |||||
| url: config.api.orderList, | |||||
| data: { | data: { | ||||
| pageNum: 1, | |||||
| pageSize: 10, | |||||
| pageNum: pageNum, | |||||
| pageSize: 3, | |||||
| orderStatus: key | orderStatus: key | ||||
| } | } | ||||
| }).then((res) => { | }).then((res) => { | ||||
| wx.hideLoading(); | wx.hideLoading(); | ||||
| this.setData({ | this.setData({ | ||||
| list: res.list | |||||
| list: res.data.list | |||||
| }) | }) | ||||
| }) | }) | ||||
| }, | }, | ||||
| @@ -50,7 +50,7 @@ Page({ | |||||
| }); | }); | ||||
| }, | }, | ||||
| handleChangeScroll({ detail }) { | handleChangeScroll({ detail }) { | ||||
| this.getList(detail.key) | |||||
| this.getList(detail.key, 1) | |||||
| this.setData({ | this.setData({ | ||||
| current_scroll: detail.key | current_scroll: detail.key | ||||
| }); | }); | ||||
| @@ -1,70 +0,0 @@ | |||||
| let host = 'https://ciformall.youlane.cn/C' | |||||
| const postResquest = (url, token, message, postData, doSuccess, doFail) => { | |||||
| let body = { ...postData }; | |||||
| if (message != "") { | |||||
| wx.showLoading({ | |||||
| title: message, | |||||
| }) | |||||
| } | |||||
| wx.request({ | |||||
| //项目的真正接口,通过字符串拼接方式实现 | |||||
| url: host + url, | |||||
| header: { | |||||
| "content-type": "application/json;charset=UTF-8", | |||||
| "token": token | |||||
| }, | |||||
| data: body, | |||||
| method: 'POST', | |||||
| success: function (res) { | |||||
| //参数值为res.data,直接将返回的数据传入 | |||||
| if (message != "") { | |||||
| wx.hideLoading() | |||||
| }; | |||||
| doSuccess(res.data); | |||||
| }, | |||||
| fail: function (res) { | |||||
| if (message != "") { | |||||
| wx.hideLoading() | |||||
| }; | |||||
| wx.showToast({ | |||||
| title: '网络错误', | |||||
| }) | |||||
| }, | |||||
| }) | |||||
| } | |||||
| const getResquest = (url, token, message, getData, doSuccess, doFail) => { | |||||
| let body = { ...getData }; | |||||
| if (message != "") { | |||||
| wx.showLoading({ | |||||
| title: message, | |||||
| }) | |||||
| } | |||||
| wx.request({ | |||||
| url: host + url, | |||||
| header: { | |||||
| "content-type": "application/json;charset=UTF-8", | |||||
| "token": token | |||||
| }, | |||||
| data: body, | |||||
| method: 'GET', | |||||
| success: function (res) { | |||||
| if (message != "") { | |||||
| wx.hideLoading() | |||||
| }; | |||||
| doSuccess(res.data); | |||||
| }, | |||||
| fail: function (res) { | |||||
| if (message != "") { | |||||
| wx.hideLoading() | |||||
| }; | |||||
| wx.showToast({ | |||||
| title: '网络错误', | |||||
| }) | |||||
| }, | |||||
| }) | |||||
| } | |||||
| module.exports = { | |||||
| postResquest: postResquest, | |||||
| getResquest: getResquest | |||||
| } | |||||