Browse Source

no message

feature/v1.0
xpz2018 5 years ago
parent
commit
d3afb71078
6 changed files with 31 additions and 47 deletions
  1. 2
      components/dialog/dialog.js
  2. 44
      pages/home/index/index.js
  3. 3
      pages/index/index.json
  4. 2
      pages/process/index/index.js
  5. 21
      pages/process/order-list/index.js
  6. 6
      pages/process/order-list/index.wxml

2
components/dialog/dialog.js

@ -27,7 +27,7 @@ Dialog.defaultOptions = {
title: '', title: '',
width: null, width: null,
message: '', message: '',
zIndex: 100,
zIndex: 60,
overlay: true, overlay: true,
selector: '#van-dialog', selector: '#van-dialog',
className: '', className: '',

44
pages/home/index/index.js

@ -2,7 +2,8 @@
import Dialog from '../../../components/dialog/dialog' import Dialog from '../../../components/dialog/dialog'
import { finalizeToken } from "../../api/user" import { finalizeToken } from "../../api/user"
const util = require('../../../utils/util') const util = require('../../../utils/util')
const event = require('../../../utils/event.js')
const event = require('../../../utils/event')
const storage = require('../../../utils/storage')
const app = getApp() const app = getApp()
Component({ Component({
@ -33,7 +34,6 @@ Component({
// resume的处理; // resume的处理;
onRestart: function () { onRestart: function () {
this.setUserInfo() this.setUserInfo()
this.fetchCreditInfo()
this.data.firstShow = true this.data.firstShow = true
}, },
onEvent: function (message) { onEvent: function (message) {
@ -44,53 +44,43 @@ Component({
} }
}, },
setUserInfo: function(){ setUserInfo: function(){
if(!app.accountInfo){
if(!app.userInfo){
return return
} }
var nickname = '' var nickname = ''
if(app.accountInfo.isAuth) {
nickname = app.accountInfo.realName.substring(0, 14)
} else if(!util.isEmpty(app.accountInfo.nickname)){
nickname = app.accountInfo.nickname.substring(0, 14)
} else if(!util.isEmpty(app.accountInfo.realName)){
nickname = app.accountInfo.realName.substring(0, 14)
if(app.userInfo.isAuth) {
nickname = app.userInfo.realName.substring(0, 14)
} else if(!util.isEmpty(app.userInfo.nickname)){
nickname = app.userInfo.nickname.substring(0, 14)
} else if(!util.isEmpty(app.userInfo.realName)){
nickname = app.userInfo.realName.substring(0, 14)
} }
this.setData({ this.setData({
avatarUrl: util.isEmpty(app.accountInfo.avatarUrl) ? '/assets/image/ygImg.png' : app.accountInfo.avatarUrl,
userInfo: app.accountInfo,
avatarUrl: util.isEmpty(app.userInfo.avatarUrl) ? '/assets/image/ygImg.png' : app.userInfo.avatarUrl,
userInfo: app.userInfo,
userName: nickname, userName: nickname,
height: app.globalData.safeFragmentHeight height: app.globalData.safeFragmentHeight
}) })
}, },
toUserInfo: function(){ toUserInfo: function(){
if(!app.accountInfo){
if(!app.userInfo){
return return
} }
if(!app.accountInfo.isAuth){
if(!app.userInfo.isAuth){
wx.navigateTo({ url: '/pages/home/authory/index' }) wx.navigateTo({ url: '/pages/home/authory/index' })
} }
}, },
fetchCreditInfo: function(){
if(!app.accountInfo || util.isEmpty(app.accountInfo.enterpriseId)){
return
}
getCreditInfo({enterpriseId: app.accountInfo.enterpriseId}).then(result => {
this.setData({ creditInfo: result.data })
}).catch(error => { })
},
orderList: function(){ orderList: function(){
wx.navigateTo({ url: '/pages/mall/order-list/index' }) wx.navigateTo({ url: '/pages/mall/order-list/index' })
}, },
tipApply: function(){
wx.navigateTo({ url: '/pages/htmls/credit/index' })
},
loginOut: function () { loginOut: function () {
Dialog.confirm({ title: '温馨提示', message: '确定退出云印通账号?' }).then(() => { Dialog.confirm({ title: '温馨提示', message: '确定退出云印通账号?' }).then(() => {
wx.removeStorageSync('Authorization')
storage.remove('Authorization')
app.globalData.token = null app.globalData.token = null
app.accountInfo = null
this.setData({ userInfo: null, avatarUrl: '/assets/image/ygImg.png', creditInfo: { availableCreditLine: 0, creditLine: 0, usedCreditLine: 0.00 }})
app.userInfo = null
this.setData({ userInfo: null, avatarUrl: '/assets/image/ygImg.png' })
finalizeToken() finalizeToken()
wx.redirectTo({ url: '/pages/login/index' })
event.emit('EventMessage', { what: 888, desc: 'Logout' }) event.emit('EventMessage', { what: 888, desc: 'Logout' })
}) })
} }

3
pages/index/index.json

@ -5,6 +5,7 @@
"van-tabbar-item": "/components/tabbar-item/index", "van-tabbar-item": "/components/tabbar-item/index",
"mall": "/pages/mall/index/index", "mall": "/pages/mall/index/index",
"workbench": "/pages/process/index/index", "workbench": "/pages/process/index/index",
"home": "/pages/home/index/index"
"home": "/pages/home/index/index",
"van-dialog": "/components/dialog/index"
} }
} }

2
pages/process/index/index.js

@ -16,7 +16,7 @@ Component({
tabList: [ tabList: [
{ status: 1, badge: 2, name: '定价', icon: '/assets/image/icon_pricing.png' }, { status: 1, badge: 2, name: '定价', icon: '/assets/image/icon_pricing.png' },
{ status: 2, badge: 4, name: '过磅审核', icon: '/assets/image/icon_checking.png' }, { status: 2, badge: 4, name: '过磅审核', icon: '/assets/image/icon_checking.png' },
{ status: 3, badge: '', name: '付款', icon: '/assets/image/icon_payment.png' },
{ status: 3, badge: '', name: '付款', icon: '/assets/image/icon_payment.png' },
{ status: 4, badge: '', name: '已完成', icon: '/assets/image/icon_finish.png' }, { status: 4, badge: '', name: '已完成', icon: '/assets/image/icon_finish.png' },
{ status: 5, badge: '', name: '已关闭', icon: '/assets/image/icon_close.png' } { status: 5, badge: '', name: '已关闭', icon: '/assets/image/icon_close.png' }
] ]

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

@ -6,10 +6,7 @@ const util = require('../../../utils/util')
const app = getApp() const app = getApp()
Page({ Page({
/**
* 页面的初始数据
*/
// * 页面的初始数据
data: { data: {
height: app.globalData.fragmentHeight, height: app.globalData.fragmentHeight,
loading: true, loading: true,
@ -23,22 +20,20 @@ Page({
}, },
title: '全部' title: '全部'
}, },
/**
* 生命周期函数--监听页面加载
*/
// * 生命周期函数--监听页面加载
onLoad: function (options) { onLoad: function (options) {
if(options.status){ if(options.status){
this.data.form.status = Number(options.status) this.data.form.status = Number(options.status)
if(this.data.form.status == 1){ if(this.data.form.status == 1){
this.data.title = '定价列表'
this.data.title = '待定价订单'
} else if(this.data.form.status == 2){ } else if(this.data.form.status == 2){
this.data.title = '过磅审核'
this.data.title = '过磅审核订单'
} else if(this.data.form.status == 3){ } else if(this.data.form.status == 3){
this.data.title = '代付款'
this.data.title = '待付款订单'
} else if(this.data.form.status == 4){ } else if(this.data.form.status == 4){
this.data.title = '已完成'
this.data.title = '已完成订单'
} else if(this.data.form.status == 5){ } else if(this.data.form.status == 5){
this.data.title = '已关闭'
this.data.title = '已关闭订单'
} }
} }
event.on('OrderMessage', this, this.onEvent) event.on('OrderMessage', this, this.onEvent)
@ -114,7 +109,7 @@ Page({
}) })
}, },
priceOrder: function(e){ priceOrder: function(e){
wx.navigateTo({ url: '/pages/process/order-info/index?id=' })
wx.navigateTo({ url: '/pages/process/order-info/index?id=' + e.currentTarget.dataset.id })
}, },
onUnload: function(){ onUnload: function(){
event.remove('OrderMessage', this) event.remove('OrderMessage', this)

6
pages/process/order-list/index.wxml

@ -21,10 +21,8 @@
<view class="text-sm text-gray">毛重:2000.00KG</view> <view class="text-sm text-gray">毛重:2000.00KG</view>
</view> </view>
<view class="flex flex-center"> <view class="flex flex-center">
<van-button plain type="default" custom-style="height:64rpx;width:132rpx" bind:click="cancelOrder">取消
</van-button>
<van-button plain type="info" custom-style="margin-left:24rpx;height:64rpx;width:132rpx"
bind:click="priceOrder">定价</van-button>
<van-button plain type="default" custom-style="height:64rpx;width:132rpx" data-id="{{item.id}}" bind:click="cancelOrder">取消</van-button>
<van-button plain type="info" custom-style="margin-left:24rpx;height:64rpx;width:132rpx" data-id="{{item.id}}" bind:click="priceOrder">定价</van-button>
</view> </view>
</view> </view>
</van-cell> </van-cell>

Loading…
Cancel
Save