Browse Source

no message

feature/v2.1
xpz2018 4 years ago
parent
commit
5d746343cf
7 changed files with 57 additions and 7 deletions
  1. 6
      api/request.js
  2. 2
      app.js
  3. 4
      pages/home/index/index.wxml
  4. 2
      pages/login/index.js
  5. 36
      xtends/statics/purchase-report/index.js
  6. 2
      xtends/statics/purchase-report/index.json
  7. 12
      xtends/statics/purchase-report/index.wxml

6
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) {

2
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',

4
pages/home/index/index.wxml

@ -46,9 +46,9 @@
<van-grid-item text="智能绑卡" url="/pages/message/card-list/index">
<van-icon slot="icon" name="/assets/home/icon-card.png" size="76rpx" />
</van-grid-item>
<van-grid-item text="智能报表" url="/xtends/statics/index/index" wx:if="{{isAdmin}}">
<!-- <van-grid-item text="智能报表" url="/xtends/statics/index/index" wx:if="{{isAdmin}}">
<van-icon slot="icon" name="/assets/home/icon-card.png" size="76rpx" />
</van-grid-item>
</van-grid-item> -->
</van-grid>
</view>
</view>

2
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 {

36
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(){
}
})

2
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"
}
}

12
xtends/statics/purchase-report/index.wxml

@ -3,6 +3,18 @@
<view slot="content">采购报表</view>
</cu-custom>
<view class="bg-white flex flex-justify" style="height:80rpx;padding: 0rpx 32rpx" bindtap="showCalendar">
<view class="flex flex-center" bindtap="showCalendar">
<view style="height:24rpx;width:6rpx;background-image: linear-gradient(180deg, #007AFF 0%, #027BFF 15%, #5AABFF 45%, #CAF4FE 100%);"></view>
<view class="text-black text-sg text-bold" style="margin-left: 12rpx">出货信息</view>
</view>
<view class="flex flex-center" style="padding: 2rpx 0rpx">
<view class="text-black text-df" style="margin-right:8rpx">{{vdateString}}</view>
<van-icon name="{{show ? 'arrow-up' : 'arrow-down'}}" />
</view>
</view>
<van-table columns="{{columns}}" height="{{height}}" data="{{data}}"></van-table>
<van-calendar show="{{ show }}" type="range" row-height="50" color="#008AFF" z-index="22" min-date="{{ minDate }}" max-date="{{ maxDate }}" default-date="{{ vdate }}" title="日期范围选择" show-subtitle="{{ false }}" show-confirm="{{ false }}" bind:close="onClose" bind:confirm="onSelect"/>
<notification id="qn-notification"/>
Loading…
Cancel
Save