diff --git a/api/request.js b/api/request.js index e7940ec..05076a9 100644 --- a/api/request.js +++ b/api/request.js @@ -72,8 +72,8 @@ function handleResponse({ data, status }) { "401"() { return Promise.reject('请求未授权') }, - "403"() { - return Promise.reject(data) + "401"() { + return Promise.reject('请求未授权') }, "404"() { return Promise.reject('URL错误') @@ -118,6 +118,8 @@ function handleResult(result) { message = result.message } return Promise.reject(message) + } else if (result.code === 200101) { + return Promise.reject(result) } var message = '数据错误' if (result.message) { diff --git a/app.js b/app.js index 68d51be..dbe5e0f 100644 --- a/app.js +++ b/app.js @@ -1,6 +1,6 @@ //app.js App({ - evn: 0, // 0: 开发版本;1:测试版本;2:生产版本 + evn: 2, // 0: 开发版本;1:测试版本;2:生产版本 tmplIds: ['AFoM5TOfsgERsfcetNSB0UlmEixnLF1ySXr54Bqno2M', 'lOQ8Gvyy_dTk68bYGpRVnVA0M7DsYYrV81Gd39GUPBA'], version: '2.0.0', xAppId: '503258978847953926', diff --git a/pages/home/index/index.wxml b/pages/home/index/index.wxml index f6175dd..79bcc66 100644 --- a/pages/home/index/index.wxml +++ b/pages/home/index/index.wxml @@ -46,9 +46,9 @@ - + diff --git a/pages/login/index.js b/pages/login/index.js index 4fac4ec..9081918 100644 --- a/pages/login/index.js +++ b/pages/login/index.js @@ -205,7 +205,7 @@ Page({ }) } }).catch(err => { - if(err.code == 400){ + if(err.code == 200101){ util.showToast('获取用户信息失败,请注册登录') this.setData({ loging: false, regist: true}) } else { diff --git a/xtends/statics/purchase-report/index.js b/xtends/statics/purchase-report/index.js index fec9be7..507e2ea 100644 --- a/xtends/statics/purchase-report/index.js +++ b/xtends/statics/purchase-report/index.js @@ -1,4 +1,5 @@ import Scene from '../../../pages/index/scene' +import util from '../../../utils/util' const app = getApp() Scene({ @@ -7,6 +8,7 @@ Scene({ */ data: { height: app.globalData.fragmentHeight, + form: {}, columns: [ { key: 'catname', title: '品类', width: 100, fixed: 'left', align: 'center' }, { key: 'product_title', width: 80, fixed: 'left', title: '重量(公斤)' }, @@ -51,11 +53,43 @@ Scene({ {catname: '黄纸皮A级', product_bar_code: '35000.00', product_title: '87500.00', quantity: '2.500'}, {catname: '黄纸皮A级', product_bar_code: '35000.00', product_title: '187500.00', quantity: '2.500'}, ], + show: false }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - this.setData({ height: app.globalData.fragmentHeight }) + var min = new Date() + min.setFullYear(min.getFullYear() - 1, min.getMonth(), min.getDate()) + min.setHours(0, 0, 0) + var minDate = min.getTime() + var max = new Date(new Date().getTime() + 24 * 60 * 60 * 1000) + max.setHours(0, 0, 0) + var maxDate = max.getTime() + var today = new Date() + today.setHours(0, 0, 0) + var vdate = [today.getTime(), maxDate] + var vdateString = util.formatDate(new Date(), 'Y-M-D') + '至' + util.formatDate(max, 'Y-M-D') + this.data.form.startTime = util.formatDate(today, 'Y-M-D') + ' 00:00:00' + this.data.form.endTime = util.formatDate(max, 'Y-M-D') + ' 00:00:00' + this.setData({ height: app.globalData.fragmentHeight - 80, minDate, maxDate, vdate, vdateString }) + }, + showCalendar: function(){ + this.setData({ show: true }) + }, + onClose: function() { + this.setData({ show: false }) + }, + onSelect: function({detail}) { + var start = new Date(detail[0]) + var end = new Date(detail[1]) + var vdateString = util.formatDate(start, 'Y-M-D') + '至' + util.formatDate(end, 'Y-M-D') + this.data.form.startTime = util.formatDate(start, 'Y-M-D') + ' 00:00:00' + this.data.form.endTime = util.formatDate(end, 'Y-M-D') + ' 00:00:00' + this.setData({ show: false, vdateString }) + this.fetchStatisticsInfo() + }, + fetchStatisticsInfo: function(){ + } }) \ No newline at end of file diff --git a/xtends/statics/purchase-report/index.json b/xtends/statics/purchase-report/index.json index 4f92c26..4209c60 100644 --- a/xtends/statics/purchase-report/index.json +++ b/xtends/statics/purchase-report/index.json @@ -1,6 +1,8 @@ { "usingComponents": { + "van-icon": "/components/icon/index", "van-table": "/components/table/index", + "van-calendar": "/components/calendar/index", "notification": "/pages/message/notification/index" } } \ No newline at end of file diff --git a/xtends/statics/purchase-report/index.wxml b/xtends/statics/purchase-report/index.wxml index 37c15b2..ec93ff8 100644 --- a/xtends/statics/purchase-report/index.wxml +++ b/xtends/statics/purchase-report/index.wxml @@ -3,6 +3,18 @@ 采购报表 + + + + 出货信息 + + + {{vdateString}} + + + + +