Browse Source

优化

feature/v1.5
xpz2018 4 years ago
parent
commit
c610901e6e
12 changed files with 89 additions and 78 deletions
  1. 6
      pages/agent/index/index.js
  2. 2
      pages/agent/index/index.wxml
  3. 4
      pages/home/index/index.js
  4. 6
      pages/index/index.wxml
  5. 26
      pages/login/index.js
  6. 8
      pages/login/index.wxml
  7. 47
      pages/process/index/index.js
  8. 1
      pages/process/index/index.json
  9. 2
      pages/process/index/index.wxml
  10. 2
      pages/process/order-list/index.js
  11. 61
      pages/storage/index/index.js
  12. 2
      pages/storage/index/index.wxml

6
pages/agent/index/index.js

@ -13,6 +13,7 @@ Component({
/** 页面的初始数据 */ /** 页面的初始数据 */
data: { data: {
userInfo: app.userInfo, userInfo: app.userInfo,
firstShow: false,
height: app.globalData.safeFragmentHeight - 100, height: app.globalData.safeFragmentHeight - 100,
tabList: [ tabList: [
{ status: 50, badge: '', name: '待预约', icon: '/assets/agent/icon-dyy.png' }, { status: 50, badge: '', name: '待预约', icon: '/assets/agent/icon-dyy.png' },
@ -24,7 +25,6 @@ Component({
}, },
lifetimes: { lifetimes: {
attached: function () { attached: function () {
this.setData({userInfo: app.userInfo, height: app.globalData.safeFragmentHeight - 100 })
event.on('EventMessage', this, this.onEvent) event.on('EventMessage', this, this.onEvent)
}, },
detached: function () { detached: function () {
@ -33,12 +33,16 @@ Component({
}, },
methods: { methods: {
onRestart: function () { onRestart: function () {
if(!this.data.firstShow) {
this.setData({userInfo: app.userInfo, height: app.globalData.safeFragmentHeight - 100 })
}
getBalanceInfo().then(result => { getBalanceInfo().then(result => {
if(result.data){ if(result.data){
result.data.accountMoney = math.minus(result.data.accountMoney, result.data.frozenMoney) result.data.accountMoney = math.minus(result.data.accountMoney, result.data.frozenMoney)
this.setData({ banlanceInfo: result.data }) this.setData({ banlanceInfo: result.data })
} }
}).catch(err => { }) }).catch(err => { })
this.data.firstShow = true
}, },
onEvent: function (message) { onEvent: function (message) {
if (message.what == 888) { if (message.what == 888) {

2
pages/agent/index/index.wxml

@ -1,7 +1,7 @@
<!--pages/process/index.wxml--> <!--pages/process/index.wxml-->
<wxs module="formate" src="../../formate.wxs"></wxs> <wxs module="formate" src="../../formate.wxs"></wxs>
<cu-custom bgColor="bg-blue"> <cu-custom bgColor="bg-blue">
<view slot="right" class="text-white text-xl" style="padding-left:32rpx">{{userInfo.factoryName || '未注册工厂'}}</view>
<view slot="right" class="text-white text-xl" style="padding-left:32rpx">{{ userInfo ? (userInfo.factoryName || '未注册工厂') : ''}}</view>
</cu-custom> </cu-custom>
<scroll-view scroll-y style="height: {{height}}rpx;"> <scroll-view scroll-y style="height: {{height}}rpx;">

4
pages/home/index/index.js

@ -25,7 +25,6 @@ Component({
lifetimes: { lifetimes: {
// 生命周期函数,可以为函数,或一个在methods段中定义的方法名 // 生命周期函数,可以为函数,或一个在methods段中定义的方法名
attached: function () { attached: function () {
this.setData({CustomBar: app.globalData.CustomBar || (app.globalData.isIos ? 64 : 80), height: app.globalData.safeFragmentHeight - 100})
event.on('EventMessage', this, this.onEvent) event.on('EventMessage', this, this.onEvent)
}, },
detached: function () { detached: function () {
@ -35,6 +34,9 @@ Component({
methods: { methods: {
// resume的处理; // resume的处理;
onRestart: function () { onRestart: function () {
if(!this.data.firstShow) {
this.setData({CustomBar: app.globalData.CustomBar || (app.globalData.isIos ? 64 : 80), height: app.globalData.safeFragmentHeight - 100})
}
this.setUserInfo() this.setUserInfo()
this.data.firstShow = true this.data.firstShow = true
}, },

6
pages/index/index.wxml

@ -13,6 +13,12 @@
<home id="{{tabList[3].value}}"/> <home id="{{tabList[3].value}}"/>
</swiper-item> </swiper-item>
</swiper> </swiper>
<!-- <view style="height:{{fragment}}rpx">
<process id="{{tabList[0].value}}" bind:zIndex="onPopupChange" wx:if="{{tabIndex == 0}}"/>
<storage id="{{tabList[1].value}}" bind:zIndex="onPopupChange" wx:elif="{{tabIndex == 1}}"/>
<agent id="{{tabList[2].value}}" wx:elif="{{tabIndex == 2}}"/>
<home id="{{tabList[3].value}}" wx:elif="{{tabIndex == 3}}"/>
</view> -->
<view class="cu-bar foot" style="height:{{100 + safeBottom}}rpx;padding-bottom:{{safeBottom}}rpx;z-index:{{zIndex}}"> <view class="cu-bar foot" style="height:{{100 + safeBottom}}rpx;padding-bottom:{{safeBottom}}rpx;z-index:{{zIndex}}">
<van-tabbar active="{{ tabIndex }}" fixed="{{false}}" bind:change="onChange"> <van-tabbar active="{{ tabIndex }}" fixed="{{false}}" bind:change="onChange">

26
pages/login/index.js

@ -24,7 +24,7 @@ Page({
captcha: null captcha: null
}, },
loging: false, loging: false,
regist: false,
regist: true,
metaData: null, metaData: null,
code: null code: null
// code: '?mark=ztb_saas&QrCodeRecordId=589851945913683968' // code: '?mark=ztb_saas&QrCodeRecordId=589851945913683968'
@ -77,7 +77,6 @@ Page({
if(this.data.code){ if(this.data.code){
this.fetchQrCode(this.data.code) this.fetchQrCode(this.data.code)
} else if(!util.isEmpty(authorization)){ } else if(!util.isEmpty(authorization)){
wx.showLoading({ title: '登录中', mask: true })
this.setData({ loging: true}) this.setData({ loging: true})
this.fetchUserInfo(authorization) this.fetchUserInfo(authorization)
} }
@ -103,7 +102,6 @@ Page({
zconfig.header = { 'Authorization': 'QNT ' + result.data } zconfig.header = { 'Authorization': 'QNT ' + result.data }
mconfig.header = { 'Authorization': 'QNT ' + result.data } mconfig.header = { 'Authorization': 'QNT ' + result.data }
getUserInfo().then(result => { getUserInfo().then(result => {
wx.hideLoading()
app.userInfo = result.data app.userInfo = result.data
app.globalData.token = authorization app.globalData.token = authorization
storage.put('Authorization', app.globalData.token) storage.put('Authorization', app.globalData.token)
@ -138,7 +136,6 @@ Page({
}) })
} }
}).catch(err => { }).catch(err => {
wx.hideLoading()
if(err.code == 400){ if(err.code == 400){
util.showToast('获取用户信息失败,请注册登录') util.showToast('获取用户信息失败,请注册登录')
this.setData({ loging: false, regist: true}) this.setData({ loging: false, regist: true})
@ -149,7 +146,6 @@ Page({
config.header = null config.header = null
}) })
}).catch(err => { }).catch(err => {
wx.hideLoading()
if(err !== null && err instanceof Object) { if(err !== null && err instanceof Object) {
util.showToast('服务器错误') util.showToast('服务器错误')
} else { } else {
@ -170,6 +166,9 @@ Page({
}, },
/************************************** 注册流程 ********************************************/ /************************************** 注册流程 ********************************************/
readAgreement: function () { readAgreement: function () {
if(this.data.loging){
return
}
wx.navigateTo({ url: '/pages/htmls/agreement/index' }) wx.navigateTo({ url: '/pages/htmls/agreement/index' })
}, },
onGetUserProfile: function(){ onGetUserProfile: function(){
@ -265,13 +264,11 @@ Page({
util.showToast('请输入密码') util.showToast('请输入密码')
return return
} }
wx.showLoading({ title: '登录中', mask: true })
this.setData({ loging: true }) this.setData({ loging: true })
if (this.data.type == 1) { if (this.data.type == 1) {
loginCaptcha(this.data.form).then(result => { loginCaptcha(this.data.form).then(result => {
this.fetchUserInfo(result.data.token) this.fetchUserInfo(result.data.token)
}).catch(error => { }).catch(error => {
wx.hideLoading()
util.showToast(error) util.showToast(error)
this.setData({ loging: false }) this.setData({ loging: false })
}) })
@ -279,7 +276,6 @@ Page({
loginPwd(this.data.form).then(result => { loginPwd(this.data.form).then(result => {
this.fetchUserInfo(result.data.token) this.fetchUserInfo(result.data.token)
}).catch(error => { }).catch(error => {
wx.hideLoading()
util.showToast(error) util.showToast(error)
this.setData({ loging: false }) this.setData({ loging: false })
}) })
@ -293,6 +289,9 @@ Page({
} }
}, },
changePwd: function () { changePwd: function () {
if(this.data.loging){
return
}
if (this.data.pwdType === 'password') { if (this.data.pwdType === 'password') {
this.setData({ pwdType: 'text' }) this.setData({ pwdType: 'text' })
} else { } else {
@ -301,29 +300,25 @@ Page({
}, },
/************************************** 二维码流程 ********************************************/ /************************************** 二维码流程 ********************************************/
fetchQrCode: function(code){ fetchQrCode: function(code){
wx.showLoading({ title: '处理中', mask: true })
this.setData({ loging: true}) this.setData({ loging: true})
verifyCode(code).then(result => { verifyCode(code).then(result => {
this.data.code = null this.data.code = null
if(result.data.redirectUrl == '/login'){ if(result.data.redirectUrl == '/login'){
// 根据userId来获取用户信息;并且直接登录
this.fetchUserInfo(result.data.metaData.token) this.fetchUserInfo(result.data.metaData.token)
} else { } else {
wx.hideLoading()
this.data.metaData = result.data.metaData this.data.metaData = result.data.metaData
this.data.metaData.qrPage = result.data.redirectUrl this.data.metaData.qrPage = result.data.redirectUrl
this.setData({ loging: false}) this.setData({ loging: false})
} }
}).catch(err => { }).catch(err => {
wx.hideLoading()
util.showToast('二维码解析失败,请重新扫码') util.showToast('二维码解析失败,请重新扫码')
this.setData({ loging: false}) this.setData({ loging: false})
}) })
}, },
submitForm: function(){ submitForm: function(){
this.setData({loging: true})
if(this.data.metaData.qrPage == '/page/index/yaoqing'){ if(this.data.metaData.qrPage == '/page/index/yaoqing'){
bindingAdmin(this.data.metaData).then(result => { bindingAdmin(this.data.metaData).then(result => {
wx.hideLoading()
storage.put('Authorization', app.globalData.token) storage.put('Authorization', app.globalData.token)
app.userInfo.factoryId = this.data.metaData.factoryId app.userInfo.factoryId = this.data.metaData.factoryId
app.userInfo.factoryName = this.data.metaData.factoryName app.userInfo.factoryName = this.data.metaData.factoryName
@ -331,20 +326,17 @@ Page({
this.setData({loging: false}) this.setData({loging: false})
wx.redirectTo({ url: '/pages/index/index' }) wx.redirectTo({ url: '/pages/index/index' })
}).catch(error => { }).catch(error => {
wx.hideLoading()
this.setData({loging: false}) this.setData({loging: false})
util.showToast(error) util.showToast(error)
}) })
} else if(this.data.metaData.qrPage == '/page/index/shenqing'){ } else if(this.data.metaData.qrPage == '/page/index/shenqing'){
applyEmplyee(this.data.metaData).then(result => { applyEmplyee(this.data.metaData).then(result => {
this.data.metaData = null this.data.metaData = null
wx.hideLoading()
this.setData({loging: false}) this.setData({loging: false})
Dialog.alert({ title: '温馨提示', message: '您的申请已经提交,待管理员审核通过之后在进行登录。' }).then(() => { Dialog.alert({ title: '温馨提示', message: '您的申请已经提交,待管理员审核通过之后在进行登录。' }).then(() => {
// wx.redirectTo({ url: '/pages/index/index' }) // wx.redirectTo({ url: '/pages/index/index' })
}) })
}).catch(error => { }).catch(error => {
wx.hideLoading()
this.setData({loging: false}) this.setData({loging: false})
util.showToast(error) util.showToast(error)
}) })
@ -352,11 +344,9 @@ Page({
this.data.metaData.factorycustomerId = this.data.metaData.factoryCustomerId this.data.metaData.factorycustomerId = this.data.metaData.factoryCustomerId
bindCustomer(this.data.metaData).then(result => { bindCustomer(this.data.metaData).then(result => {
this.data.metaData = null this.data.metaData = null
wx.hideLoading()
this.setData({loging: false}) this.setData({loging: false})
wx.redirectTo({ url: '/pages/client/index/index' }) wx.redirectTo({ url: '/pages/client/index/index' })
}).catch(error => { }).catch(error => {
wx.hideLoading()
this.setData({loging: false}) this.setData({loging: false})
util.showToast(error) util.showToast(error)
}) })

8
pages/login/index.wxml

@ -24,22 +24,22 @@
<text class="label" style="margin-left:24rpx">手机号码</text> <text class="label" style="margin-left:24rpx">手机号码</text>
</view> </view>
<view class="cu-form-group" style="min-height:120rpx;border-bottom:1rpx solid #eee;padding:0rpx"> <view class="cu-form-group" style="min-height:120rpx;border-bottom:1rpx solid #eee;padding:0rpx">
<input id="account" type="number" placeholder-style="color:#aaa" maxlength="11" placeholder="请输入手机号" value="{{form.account}}" bindinput="bindInput" />
<input id="account" type="number" placeholder-style="color:#aaa" maxlength="11" disabled="{{loging}}" placeholder="请输入手机号" value="{{form.account}}" bindinput="bindInput" />
</view> </view>
<view class="flex" style="margin-top: 40rpx"> <view class="flex" style="margin-top: 40rpx">
<image style="width:40rpx;height:40rpx" src="{{type == 1 ? '/assets/image/icon_code.png' : '/assets/image/icon_pwd.png'}}"></image> <image style="width:40rpx;height:40rpx" src="{{type == 1 ? '/assets/image/icon_code.png' : '/assets/image/icon_pwd.png'}}"></image>
<text class="label" style="margin-left:12rpx">{{type == 1 ? '验证码' : '密码'}}</text> <text class="label" style="margin-left:12rpx">{{type == 1 ? '验证码' : '密码'}}</text>
</view> </view>
<view wx:if="{{type == 1}}" class="cu-form-group" style="min-height:120rpx;border-bottom:1rpx solid #eee;padding:0rpx;border-top:0rpx solid #eee;"> <view wx:if="{{type == 1}}" class="cu-form-group" style="min-height:120rpx;border-bottom:1rpx solid #eee;padding:0rpx;border-top:0rpx solid #eee;">
<input id="captcha" type="number" placeholder-style="color:#aaa" maxlength="6" placeholder="请输入验证码" bindinput="bindInput" />
<van-button size="small" plain type="info" custom-style="width:220rpx" disabled="{{!mobileEnable || !codeEnable}}" bind:click="fetchCaptcha">
<input id="captcha" type="number" placeholder-style="color:#aaa" disabled="{{loging}}" maxlength="6" placeholder="请输入验证码" bindinput="bindInput" />
<van-button size="small" plain type="info" custom-style="width:220rpx" disabled="{{!mobileEnable || !codeEnable || loging}}" bind:click="fetchCaptcha">
<van-count-down class="count-down" time="{{ 60000 }}" use-slot auto-start="{{false}}" bind:change="onCountChange" bind:finish="onFinished"> <van-count-down class="count-down" time="{{ 60000 }}" use-slot auto-start="{{false}}" bind:change="onCountChange" bind:finish="onFinished">
<text class="text-sm">{{second}}</text> <text class="text-sm">{{second}}</text>
</van-count-down> </van-count-down>
</van-button> </van-button>
</view> </view>
<view wx:else class="cu-form-group" style="min-height:120rpx;border-bottom:1rpx solid #eee;padding:0rpx"> <view wx:else class="cu-form-group" style="min-height:120rpx;border-bottom:1rpx solid #eee;padding:0rpx">
<input id="password" placeholder-style="color:#aaa" type="{{pwdType}}" maxlength="20" placeholder="请输入验密码" bindinput="bindInput" bindfocus="inputFocus" />
<input id="password" placeholder-style="color:#aaa" type="{{pwdType}}" maxlength="20" placeholder="请输入验密码" bindinput="bindInput" bindfocus="inputFocus" disabled="{{loging}}"/>
<text class="cuIcon-{{pwdType == 'password' ? 'attention': 'attentionforbid'}}" bindtap="changePwd" style="font-size:22px"></text> <text class="cuIcon-{{pwdType == 'password' ? 'attention': 'attentionforbid'}}" bindtap="changePwd" style="font-size:22px"></text>
</view> </view>
<view style="margin-top:24rpx;text-align:end;"> <view style="margin-top:24rpx;text-align:end;">

47
pages/process/index/index.js

@ -13,7 +13,7 @@ Component({
}, },
/** 页面的初始数据 */ /** 页面的初始数据 */
data: { data: {
userInfo: app.userInfo,
userInfo: null,
height: app.globalData.safeFragmentHeight, height: app.globalData.safeFragmentHeight,
customBar: app.globalData.CustomBar || (app.globalData.isIos ? 64 : 60), customBar: app.globalData.CustomBar || (app.globalData.isIos ? 64 : 60),
tabList: [ tabList: [
@ -64,26 +64,7 @@ Component({
}, },
lifetimes: { lifetimes: {
attached: function () { attached: function () {
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'
var height = app.globalData.safeFragmentHeight - 100
var customBar = app.globalData.CustomBar || (app.globalData.isIos ? 64 : 60)
if(app.userInfo.type && app.userInfo.type.indexOf('ADMIN') >= 0){
this.setData({userInfo: app.userInfo, height, minDate, maxDate, vdate, vdateString, customBar})
} else {
this.setData({userInfo: app.userInfo, height, minDate, maxDate, vdate, vdateString, customBar })
}
wx.showLoading({ title: '加载中', mask: true })
event.on('EventMessage', this, this.onEvent) event.on('EventMessage', this, this.onEvent)
}, },
detached: function () { detached: function () {
@ -92,6 +73,30 @@ Component({
}, },
methods: { methods: {
onRestart: function () { onRestart: function () {
if(!this.data.firstShow) {
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'
var height = app.globalData.safeFragmentHeight - 100
var customBar = app.globalData.CustomBar || (app.globalData.isIos ? 64 : 60)
if(app.userInfo.type && app.userInfo.type.indexOf('ADMIN') >= 0){
this.setData({userInfo: app.userInfo, height, minDate, maxDate, vdate, vdateString, customBar})
} else {
this.setData({userInfo: app.userInfo, height, minDate, maxDate, vdate, vdateString, customBar })
}
wx.hideLoading()
}
this.data.firstShow = true
this.fetchStatisticsInfo() this.fetchStatisticsInfo()
}, },
onEvent: function (message) { onEvent: function (message) {

1
pages/process/index/index.json

@ -1,6 +1,7 @@
{ {
"component": true, "component": true,
"usingComponents": { "usingComponents": {
"van-loading": "/components/loading/index",
"van-grid": "/components/grid/index", "van-grid": "/components/grid/index",
"van-grid-item": "/components/grid-item/index", "van-grid-item": "/components/grid-item/index",
"van-cell": "/components/cell/index", "van-cell": "/components/cell/index",

2
pages/process/index/index.wxml

@ -1,7 +1,7 @@
<!--pages/process/index.wxml--> <!--pages/process/index.wxml-->
<wxs module="formate" src="../../formate.wxs"></wxs> <wxs module="formate" src="../../formate.wxs"></wxs>
<cu-custom bgColor="bg-blue"> <cu-custom bgColor="bg-blue">
<view slot="right" class="text-white text-xl" style="padding-left:32rpx">{{userInfo.factoryName || '未注册工厂'}}</view>
<view slot="right" class="text-white text-xl" style="padding-left:32rpx">{{ userInfo ? (userInfo.factoryName || '未注册工厂') : ''}}</view>
</cu-custom> </cu-custom>
<scroll-view scroll-y style="height: {{height}}rpx;"> <scroll-view scroll-y style="height: {{height}}rpx;">

2
pages/process/order-list/index.js

@ -21,7 +21,7 @@ Scene({
{id: 5, name: '代付中', badge: 0, status: 41 }, {id: 5, name: '代付中', badge: 0, status: 41 },
{id: 6, name: '待结算', badge: 0, status: 42 }, {id: 6, name: '待结算', badge: 0, status: 42 },
{id: 7, name: '已完成', badge: 0, status: 5 }, {id: 7, name: '已完成', badge: 0, status: 5 },
// {id: 8, name: '已取消', badge: 0, status: 6 }
{id: 8, name: '已取消', badge: 0, status: 6 }
], ],
loading: true, loading: true,
requesting: false, requesting: false,

61
pages/storage/index/index.js

@ -40,35 +40,6 @@ Component({
}, },
lifetimes: { lifetimes: {
attached: function () { attached: function () {
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')
var height = app.globalData.safeFragmentHeight - 100
var customBar = app.globalData.CustomBar || (app.globalData.isIos ? 64 : 60)
if(app.userInfo.type && app.userInfo.type.indexOf('ADMIN') >= 0){
var tabList2 = [
{ status: 1, badge: '', name: '磅单信息', icon: '/assets/image/icon_pound.png' },
{ status: 2, badge: '', name: '出货审核', icon: '/assets/image/icon_outcheck.png' },
{ status: 3, badge: '', name: '待收款', icon: '/assets/image/icon_payback.png' },
{ status: 4, badge: '', name: '已完成', icon: '/assets/image/icon_complete.png' }
]
this.setData({userInfo: app.userInfo, height, minDate, maxDate, vdate, vdateString, tabList2, customBar})
} else {
var tabList2 = [
{ status: 1, badge: '', name: '磅单信息', icon: '/assets/image/icon_pound.png' },
{ status: 3, badge: '', name: '待收款', icon: '/assets/image/icon_payback.png' },
{ status: 4, badge: '', name: '已完成', icon: '/assets/image/icon_complete.png' }
]
this.setData({userInfo: app.userInfo, height, minDate, maxDate, vdate, vdateString, tabList2, customBar })
}
event.on('EventMessage', this, this.onEvent) event.on('EventMessage', this, this.onEvent)
}, },
detached: function () { detached: function () {
@ -77,7 +48,39 @@ Component({
}, },
methods: { methods: {
onRestart: function () { onRestart: function () {
if(!this.data.firstShow) {
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')
var height = app.globalData.safeFragmentHeight - 100
var customBar = app.globalData.CustomBar || (app.globalData.isIos ? 64 : 60)
if(app.userInfo.type && app.userInfo.type.indexOf('ADMIN') >= 0){
var tabList2 = [
{ status: 1, badge: '', name: '磅单信息', icon: '/assets/image/icon_pound.png' },
{ status: 2, badge: '', name: '出货审核', icon: '/assets/image/icon_outcheck.png' },
{ status: 3, badge: '', name: '待收款', icon: '/assets/image/icon_payback.png' },
{ status: 4, badge: '', name: '已完成', icon: '/assets/image/icon_complete.png' }
]
this.setData({userInfo: app.userInfo, height, minDate, maxDate, vdate, vdateString, tabList2, customBar})
} else {
var tabList2 = [
{ status: 1, badge: '', name: '磅单信息', icon: '/assets/image/icon_pound.png' },
{ status: 3, badge: '', name: '待收款', icon: '/assets/image/icon_payback.png' },
{ status: 4, badge: '', name: '已完成', icon: '/assets/image/icon_complete.png' }
]
this.setData({userInfo: app.userInfo, height, minDate, maxDate, vdate, vdateString, tabList2, customBar })
}
}
this.fetchStatisticsInfo(this.data.vdate) this.fetchStatisticsInfo(this.data.vdate)
this.data.firstShow = true
}, },
onEvent: function (message) { onEvent: function (message) {
if (message.what == 888) { if (message.what == 888) {

2
pages/storage/index/index.wxml

@ -1,7 +1,7 @@
<!--pages/process/index.wxml--> <!--pages/process/index.wxml-->
<wxs module="formate" src="../../formate.wxs"></wxs> <wxs module="formate" src="../../formate.wxs"></wxs>
<cu-custom bgColor="bg-blue"> <cu-custom bgColor="bg-blue">
<view slot="right" class="text-white text-xl" style="padding-left:32rpx">{{userInfo.factoryName || '未注册工厂'}}</view>
<view slot="right" class="text-white text-xl" style="padding-left:32rpx">{{ userInfo ? (userInfo.factoryName || '未注册工厂') : ''}}</view>
</cu-custom> </cu-custom>
<scroll-view scroll-y style="height: {{height}}rpx;"> <scroll-view scroll-y style="height: {{height}}rpx;">

Loading…
Cancel
Save