Browse Source

no message

feature/v1.0
xpz2018 5 years ago
parent
commit
ba0beebbf4
34 changed files with 829 additions and 122 deletions
  1. 3
      app.json
  2. BIN
      assets/image/icon-finace.png
  3. BIN
      assets/image/icon-payment.png
  4. BIN
      assets/image/icon_checking.png
  5. BIN
      assets/image/icon_close.png
  6. BIN
      assets/image/icon_finish.png
  7. BIN
      assets/image/icon_payment.png
  8. BIN
      assets/image/icon_pricing.png
  9. BIN
      assets/image/icon_uncheck.png
  10. BIN
      assets/image/tabbar/mall-blue.png
  11. BIN
      assets/image/tabbar/mall-gray.png
  12. 90
      components/vehicle-keyboard/index.js
  13. 6
      components/vehicle-keyboard/index.json
  14. 33
      components/vehicle-keyboard/index.wxml
  15. 113
      components/vehicle-keyboard/index.wxss
  16. 5
      pages/api/request.js
  17. 4
      pages/api/saas.js
  18. 9
      pages/index/index.js
  19. 70
      pages/login/index.js
  20. 2
      pages/login/index.wxml
  21. 73
      pages/process/index/index.js
  22. 30
      pages/process/index/index.wxml
  23. 59
      pages/process/order-check/index.js
  24. 12
      pages/process/order-check/index.json
  25. 94
      pages/process/order-check/index.wxml
  26. 4
      pages/process/order-check/index.wxss
  27. 59
      pages/process/order-info/index.js
  28. 10
      pages/process/order-info/index.json
  29. 118
      pages/process/order-info/index.wxml
  30. 10
      pages/process/order-info/index.wxss
  31. 94
      pages/process/order-list/index.js
  32. 12
      pages/process/order-list/index.json
  33. 40
      pages/process/order-list/index.wxml
  34. 1
      pages/process/order-list/index.wxss

3
app.json

@ -3,6 +3,9 @@
"pages/login/index", "pages/login/index",
"pages/index/index", "pages/index/index",
"pages/home/mobile/index", "pages/home/mobile/index",
"pages/process/order-list/index",
"pages/process/order-check/index",
"pages/process/order-info/index",
"pages/home/authory/index", "pages/home/authory/index",
"pages/htmls/agreement/index", "pages/htmls/agreement/index",
"pages/message/index/index" "pages/message/index/index"

BIN
assets/image/icon-finace.png

Before After
Width: 20  |  Height: 20  |  Size: 525 B

BIN
assets/image/icon-payment.png

Before After
Width: 20  |  Height: 20  |  Size: 743 B

BIN
assets/image/icon_checking.png

Before After
Width: 68  |  Height: 68  |  Size: 920 B

BIN
assets/image/icon_close.png

Before After
Width: 68  |  Height: 68  |  Size: 1005 B

BIN
assets/image/icon_finish.png

Before After
Width: 68  |  Height: 68  |  Size: 956 B

BIN
assets/image/icon_payment.png

Before After
Width: 68  |  Height: 68  |  Size: 737 B

BIN
assets/image/icon_pricing.png

Before After
Width: 68  |  Height: 68  |  Size: 701 B

BIN
assets/image/icon_uncheck.png

Before After
Width: 40  |  Height: 40  |  Size: 511 B

BIN
assets/image/tabbar/mall-blue.png

Before After
Width: 50  |  Height: 50  |  Size: 1.2 KiB Width: 50  |  Height: 50  |  Size: 1.3 KiB

BIN
assets/image/tabbar/mall-gray.png

Before After
Width: 50  |  Height: 50  |  Size: 1.9 KiB Width: 50  |  Height: 50  |  Size: 2.1 KiB

90
components/vehicle-keyboard/index.js

@ -0,0 +1,90 @@
Component({
options: {
addGlobalClass: true,
},
properties: {
plateNumber: {
type: Array,
value: ["", "", "", "", "", "", ""]
},
safeBottom: {
type: Number,
value: 0
}
},
data: {
provinces: "京津沪冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤川青藏琼宁渝港澳台",
letters: "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
numbers: "0123456789",
visible: false,
activeIndex: -1,
type: 0,
disabled: true,
mode: 0 // 键盘模式 0 关闭状态 1 显示省份输入 2 显示数字和字母输入
},
lifetimes: {
attached: function () {
},
},
methods: {
show: function (number, type) {
var index = 0
if(number && number.length){
this.data.plateNumber = number.split('')
index = this.data.plateNumber.length - 1
}
this.data.type = type
this.updateNumber()
this.setData({ plateNumber: this.data.plateNumber, mode: index == 0 ? 1 : 2, activeIndex: index, visible: true})
},
hide: function () {
this.setData({visible: false, plateNumber: ["", "", "", "", "", "", ""]})
this.triggerEvent("change", null)
},
updateNumber: function(){
this.data.disabled = false
for (let index = 0; index < this.data.plateNumber.length; index++) {
const element = this.data.plateNumber[index]
if(element.length == 0){
this.data.disabled = true
break
}
}
this.setData({disabled: this.data.disabled, plateNumber: this.data.plateNumber})
},
inputKeyboard: function(e){
let index = typeof e === 'number' ? e : e.currentTarget.dataset.index
if(e.currentTarget && this.data.plateNumber[index].length == 0){
return
}
this.setData({ mode: index == 0 ? 1 : 2, activeIndex: index })
},
tapDelete: function(e){
let activeIndex = this.data.activeIndex
this.data.plateNumber[activeIndex] = ''
this.updateNumber()
if (activeIndex > 0) {
this.inputKeyboard(--activeIndex)
}
},
tapFinish: function(){
if(this.data.disabled){
return
}
this.setData({visible: false, activeIndex: -1 })
this.triggerEvent("change", {plateNumber: this.data.plateNumber.join(''), type: this.data.type})
},
tapKeyboard: function(e){
let val = e.currentTarget.dataset.val
let activeIndex = this.data.activeIndex
this.data.plateNumber[activeIndex] = val
this.updateNumber()
if (activeIndex < 6) {
this.inputKeyboard(++activeIndex)
} else {
this.tapFinish()
}
},
}
})

6
components/vehicle-keyboard/index.json

@ -0,0 +1,6 @@
{
"component": true,
"usingComponents": {
"van-popup": "../popup/index"
}
}

33
components/vehicle-keyboard/index.wxml

@ -0,0 +1,33 @@
<van-popup position="bottom" show="{{ visible }}" bind:close="hide" z-index="29">
<view class="flex flex-justify license-number" style="padding:24rpx 32rpx">
<view class="item {{activeIndex == 0 ? 'active':''}}" bindtap="inputKeyboard" data-index="0">{{plateNumber[0]}}</view>
<view class="item {{activeIndex == 1 ? 'active':''}}" bindtap="inputKeyboard" data-index="1">{{plateNumber[1]}}</view>
<view class="item item-dot"><view class="dot"></view></view>
<view class="item {{activeIndex == 2 ? 'active':''}}" bindtap="inputKeyboard" data-index="2">{{plateNumber[2]}}</view>
<view class="item {{activeIndex == 3 ? 'active':''}}" bindtap="inputKeyboard" data-index="3">{{plateNumber[3]}}</view>
<view class="item {{activeIndex == 4 ? 'active':''}}" bindtap="inputKeyboard" data-index="4">{{plateNumber[4]}}</view>
<view class="item {{activeIndex == 5 ? 'active':''}}" bindtap="inputKeyboard" data-index="5">{{plateNumber[5]}}</view>
<view class="item {{activeIndex == 6 ? 'active':''}}" bindtap="inputKeyboard" data-index="6">{{plateNumber[6]}}</view>
</view>
<view class="kb-keyboard" style="background: #d9d9d9">
<view class="kb-keyboard-provs flex-brick" hidden="{{!(mode==1)}}">
<view class="kb-keyboard_td" wx:for="{{provinces}}" bindtap="tapKeyboard" data-val="{{item}}" wx:key="index"> {{item}}</view>
</view>
<view class="kb-keyboard-nums flex-brick" hidden="{{!(mode==2)}}">
<view class="kb-keyboard_td {{activeIndex == 1 ? 'disabled' : '' }}" wx:for="{{numbers}}" bindtap="tapKeyboard"
data-val="{{item}}" wx:key="index">{{item}}</view>
</view>
<view class="kb-keyboard-letters flex-brick" hidden="{{!(mode==2)}}">
<view class="kb-keyboard_td {{activeIndex < 1 ? 'disabled' : '' }}" wx:for="{{letters}}"
bindtap="tapKeyboard" data-val="{{item}}" wx:key="index">{{item}}</view>
</view>
<view class="kb-keyboard-action flex-brick">
<view class="kb-keyboard_td kb-keyboard__del {{activeIndex == 0 && !plateNumber[0] ? 'disabled':''}}" bindtap="tapDelete">
<view class="ico-del"></view>
</view>
<view class="kb-keyboard_td kb-keyboard__finished {{disabled ? 'disabled':''}}" bindtap="tapFinish">确定</view>
</view>
</view>
<view style="height:{{safeBottom}}rpx"></view>
</van-popup>

113
components/vehicle-keyboard/index.wxss

@ -0,0 +1,113 @@
.license-number .item {
width: 64rpx;
height: 72rpx;
line-height: 72rpx;
text-align: center;
border: 1rpx solid #999590;
border-radius: 8rpx;
display: flex;
font-size: 28rpx;
align-items: center;
justify-content: center;
}
.license-number .item.item-new-energy {
line-height: 1em;
display: flex;
align-items: center;
border: 1rpx dashed #999590;
}
.license-number .item.item-new-energy .ico {
line-height: 1em;
font-size: 36rpx;
margin-bottom: -5rpx;
color: #777;
}
.license-number .item.item-new-energy .tit {
font-size: 12px;
transform: scale(0.7);
color: #777;
}
.license-number .item.active {
border: 1rpx solid #008AFF;
color:#008AFF;
}
.license-number .item.item-dot {
border: none;
width: auto;
padding: 0 6rpx;
}
.license-number .item.item-dot .dot {
width: 12rpx;
height: 12rpx;
background: #a09c96;
border-radius: 10rpx;
}
.kb-keyboard {
padding: 6rpx;
position: relative;
}
.flex-brick {
display: flex;
flex-flow: row wrap;
}
.kb-keyboard-action {
display: flex;
justify-content: space-between;
position: absolute;
bottom: 6rpx;
right: 6rpx;
}
.kb-keyboard_td {
color: #1e1e1e;
box-shadow: 1rpx 1rpx 1rpx #919191;
background: #fff;
display: flex;
align-items: center;
justify-content: center;
width: calc((100vw - 12rpx) / 10 - 12rpx);
font-size: 18px;
height: 48px;
margin: 6rpx;
border-radius:5px;
}
.kb-keyboard_td.disabled {
opacity: 0.5;
pointer-events: none;
}
.kb-keyboard_td:active {
background: #f2f2f2;
}
.kb-keyboard__del {
align-self: flex-end;
width: calc(((100vw - 12rpx) / 10 - 12rpx) * 1.8);
height: 48px;
display: flex;
justify-content: center;
align-items: center;
padding-right: 1rpx;
}
.kb-keyboard__del .ico-del {
width: 44rpx;
height: 30rpx;
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAeCAMAAABg6AyVAAAAclBMVEUAAAAwMDAxMTEMDAwpKSkpKSkwMDAqKioxMTExMTEpKSkqKiokJCQpKSkpKSkqKioqKioqKioqKioqKiopKSkoKCgoKCgnJycqKioqKioqKioqKioqKioqKioqKiorKysrKysoKCgqKioAAAAlJSUqKipvWYGQAAAAJXRSTlMA/lcC+OyZhmk+lioH8OXd1MlOPzQZDCDcvr2ysaWjajsTEgEiwq/YugAAAM9JREFUOMud1McWgyAQBdABKxp7S+/v/38xDUPAY/DwNs7iLoQZhoycCswkiFY69RL8SaTbA/yaZnJGQD9Z7ZA1NBuAVPoNgpaW4UuFPKVluCuxHmgZHgqUnTxmHAqSEWHsTXCao7rKOmaM8U/Jn2Vs4jbAtieZkL30aFlo4CbDXrVHsLeWlgkd1z6O3teOiMsPaZj7SG5EE62swqkvm25qZRWOkNAkfLTu2P4bzge0X51rU+ztdh0kmbtlRC3D7/Cs3B+s6yqwLxnX9WVfjA8P3SLCPZZ7QgAAAABJRU5ErkJggg==);
background-size: 100% 100%;
}
.kb-keyboard__finished {
width: calc(((100vw - 12rpx) / 10 - 12rpx) * 1.8);
}
@keyframes breath {
from {
border-color:rgba(11, 245, 183, 0.3);
}
40% { border-color: #0bf5b7c2; }
60% { border-color: #0bf5b7c2; }
to { border-color: rgba(11, 245, 183, 0.3); }
}

5
pages/api/request.js

@ -4,6 +4,7 @@
import axios from "./axios" import axios from "./axios"
const event = require('../../utils/event') const event = require('../../utils/event')
const storage = require('../../utils/storage')
const app = getApp() const app = getApp()
/** /**
* axios defaults 配置 * axios defaults 配置
@ -91,8 +92,8 @@ function handleResult(result) {
} }
if (result.code === 401) { if (result.code === 401) {
app.globalData.token = null app.globalData.token = null
app.globalData.userToken = null
wx.removeStorageSync('Authorization')
app.userInfo = null
storage.remove('Authorization')
event.emit('EventMessage', { what: 666, desc: 'Logout' }) event.emit('EventMessage', { what: 666, desc: 'Logout' })
let pages = getCurrentPages() //当前页面栈 let pages = getCurrentPages() //当前页面栈
let prevPage = pages[pages.length - 1] //当前页面 let prevPage = pages[pages.length - 1] //当前页面

4
pages/api/saas.js

@ -10,9 +10,11 @@ const sconfig = {
// *****************************************账户业务********************************************** // *****************************************账户业务**********************************************
const loginToken = (params) => mPost(`/recycle-user-center/authorize/get/product-line-token/by/login-token`, params, sconfig) const loginToken = (params) => mPost(`/recycle-user-center/authorize/get/product-line-token/by/login-token`, params, sconfig)
const getBaseInfo = () => mGet(`/ztb-factory/get/self-enterprise-profile-detail`, null, sconfig) const getBaseInfo = () => mGet(`/ztb-factory/get/self-enterprise-profile-detail`, null, sconfig)
const getOrderList = (params) => mGet(`/ztb-factory/get/self-enterprise-profile-detail`, params, sconfig)
export { export {
sconfig, sconfig,
loginToken, loginToken,
getBaseInfo
getBaseInfo,
getOrderList
} }

9
pages/index/index.js

@ -9,11 +9,11 @@ Page({
safeBottom: app.globalData.safeBottom, safeBottom: app.globalData.safeBottom,
fragment: app.globalData.safeFragmentHeight, fragment: app.globalData.safeFragmentHeight,
tabList: [ tabList: [
{ index: 0, value: 'mall', badge: 0, name: '商城', blue: '/assets/image/tabbar/mall-blue.png', gray: '/assets/image/tabbar/mall-gray.png' },
{ index: 0, value: 'mall', badge: 0, name: '消息', blue: '/assets/image/tabbar/mall-blue.png', gray: '/assets/image/tabbar/mall-gray.png' },
{ index: 1, value: 'work', badge: 0, name: '工作台', blue: '/assets/image/tabbar/process-blue.png', gray: '/assets/image/tabbar/process-gray.png' }, { index: 1, value: 'work', badge: 0, name: '工作台', blue: '/assets/image/tabbar/process-blue.png', gray: '/assets/image/tabbar/process-gray.png' },
{ index: 2, value: 'home', badge: 0, name: '我的', blue: '/assets/image/tabbar/home-blue.png', gray: '/assets/image/tabbar/home-gray.png' } { index: 2, value: 'home', badge: 0, name: '我的', blue: '/assets/image/tabbar/home-blue.png', gray: '/assets/image/tabbar/home-gray.png' }
], ],
tabIndex: 0
tabIndex: 1
}, },
/************************************** 初始化流程 ********************************************/ /************************************** 初始化流程 ********************************************/
onLoad: function (options) { onLoad: function (options) {
@ -27,9 +27,6 @@ Page({
}, },
/************************************** 生命周期函数--监听页面初次渲染完成 ********************************************/ /************************************** 生命周期函数--监听页面初次渲染完成 ********************************************/
onShow: function () { onShow: function () {
this.onResume()
},
onResume: function(){
var pageView = this.selectComponent('#' + this.data.tabList[this.data.tabIndex].value) var pageView = this.selectComponent('#' + this.data.tabList[this.data.tabIndex].value)
if (pageView && this.data.inited) { if (pageView && this.data.inited) {
pageView.onRestart() pageView.onRestart()
@ -37,7 +34,7 @@ Page({
}, },
onChange: function ({detail}) { onChange: function ({detail}) {
this.setData({ tabIndex: detail }) this.setData({ tabIndex: detail })
this.onResume()
this.onShow()
}, },
stopTouchMove: function(e){ stopTouchMove: function(e){
return false return false

70
pages/login/index.js

@ -64,10 +64,13 @@ Page({
app.globalData.safeFragmentHeight = windowHeight - statusBarHeight - app.globalData.safeBottom app.globalData.safeFragmentHeight = windowHeight - statusBarHeight - app.globalData.safeBottom
app.globalData.windowWidth = e.windowWidth app.globalData.windowWidth = e.windowWidth
var authorization = app.globalData.token || storage.get('Authorization')
if(this.data.code){ if(this.data.code){
this.fetchQrCode(this.data.code) this.fetchQrCode(this.data.code)
} else {
this.fetchUserInfo()
} else if(!util.isEmpty(authorization)){
wx.showLoading({ title: '登录中', mask: true })
this.setData({ loging: true})
this.fetchUserInfo(authorization)
} }
} }
}) })
@ -82,29 +85,26 @@ Page({
return false return false
}, },
/************************************** 获取用户信息,进行登录 ********************************************/ /************************************** 获取用户信息,进行登录 ********************************************/
fetchUserInfo: function(){
var authorization = app.globalData.token || storage.get('Authorization')
if (util.isEmpty(authorization)) {
return
}
fetchUserInfo: function(authorization){
app.globalData.token = authorization app.globalData.token = authorization
storage.put('Authorization', authorization)
config.header = { 'Authorization': 'QNT ' + authorization } config.header = { 'Authorization': 'QNT ' + authorization }
this.setData({ loging: true})
loginToken({loginToken: app.globalData.token}).then(result => { loginToken({loginToken: app.globalData.token}).then(result => {
sconfig.header = { 'Authorization': 'QNT ' + result.data.token }
getBaseInfo().then(result => {
this.setData({ loging: false})
app.userInfo = result.data
wx.hideLoading()
wx.redirectTo({ url: '/pages/index/index' })
}).catch(err => {
wx.hideLoading()
util.showToast(err)
app.globalData.token = null
storage.remove('Authorization')
config.header = null
this.setData({ loging: false})
})
sconfig.header = { 'Authorization': 'QNT ' + result.data }
wx.redirectTo({ url: '/pages/index/index' })
// getBaseInfo().then(result => {
// this.setData({ loging: false})
// app.userInfo = result.data
// wx.hideLoading()
// wx.redirectTo({ url: '/pages/index/index' })
// }).catch(err => {
// wx.hideLoading()
// util.showToast(err)
// app.globalData.token = null
// storage.remove('Authorization')
// config.header = null
// this.setData({ loging: false})
// })
}).catch(err => { }).catch(err => {
wx.hideLoading() wx.hideLoading()
util.showToast(err) util.showToast(err)
@ -162,9 +162,10 @@ Page({
this.countDown = this.countDown || this.selectComponent('.count-down') this.countDown = this.countDown || this.selectComponent('.count-down')
this.countDown.reset() this.countDown.reset()
this.countDown.start() this.countDown.start()
}).catch(error => {
}).catch(err => {
wx.hideLoading() wx.hideLoading()
util.showToast(error)
console.log(err)
util.showToast(err)
}) })
}, },
registAccount: function(){ registAccount: function(){
@ -184,22 +185,19 @@ Page({
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 => {
storage.put('Authorization', result.data.token)
app.globalData.token = result.data.token
this.fetchUserInfo()
this.fetchUserInfo(result.data.token)
}).catch(error => { }).catch(error => {
wx.hideLoading() wx.hideLoading()
console.log(error)
util.showToast(error) util.showToast(error)
this.setData({ loging: false })
}) })
} else { } else {
loginPwd(this.data.form).then(result => { loginPwd(this.data.form).then(result => {
storage.put('Authorization', result.data.token)
app.globalData.token = result.data.token
this.fetchUserInfo()
this.fetchUserInfo(result.data.token)
}).catch(error => { }).catch(error => {
wx.hideLoading() wx.hideLoading()
util.showToast(error) util.showToast(error)
this.setData({ loging: false })
}) })
} }
}, },
@ -212,23 +210,25 @@ Page({
}, },
/************************************** 二维码流程 ********************************************/ /************************************** 二维码流程 ********************************************/
fetchQrCode: function(code){ fetchQrCode: function(code){
wx.showLoading({ title: '处理中', mask: 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来获取用户信息;并且直接登录 // 根据userId来获取用户信息;并且直接登录
app.globalData.token = result.data.metaData.token
storage.put('Authorization', app.globalData.token)
this.fetchUserInfo()
this.fetchUserInfo(result.data.metaData.token)
} else { } else {
wx.hideLoading() wx.hideLoading()
this.setData({ loging: false})
if(!result.data.message){ if(!result.data.message){
result.data.message = '二维码解析失败,请重新扫码' result.data.message = '二维码解析失败,请重新扫码'
} }
util.showToast(result.data.message) util.showToast(result.data.message)
} }
}).catch(err => { }).catch(err => {
//异常回调
wx.hideLoading() wx.hideLoading()
util.showToast(err)
this.setData({ loging: false})
}) })
} }
}) })

2
pages/login/index.wxml

@ -31,7 +31,7 @@
</view> </view>
</view> </view>
<view style="margin-top:80rpx;padding:40rpx 80rpx">
<view style="margin-top:20rpx;padding:40rpx 80rpx">
<van-button block type="info" loading="{{loging}}" loading-text="登录中..." disabled="{{loginEnable}}" bind:click="registAccount">登录</van-button> <van-button block type="info" loading="{{loging}}" loading-text="登录中..." disabled="{{loginEnable}}" bind:click="registAccount">登录</van-button>
</view> </view>

73
pages/process/index/index.js

@ -12,15 +12,13 @@ Component({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
userInfo: app.accountInfo,
height: app.globalData.fragmentHeight - 100,
tabIndex: 0,
tabList: [ tabList: [
{id: 0, name: '供货单', badge: 0, value: 'supply' },
{id: 1, name: '采购单', badge: 0, value: 'purchase'},
{id: 2, name: '生产单', badge: 0, value: 'production' }
],
loading: true
{ status: 0, badge: 2, name: '定价', icon: '/assets/image/icon_pricing.png' },
{ status: 1, badge: 4, name: '过磅审核', icon: '/assets/image/icon_checking.png' },
{ status: 2, badge: '', name: '代付款', icon: '/assets/image/icon_payment.png' },
{ status: 3, badge: '', name: '已完成', icon: '/assets/image/icon_finish.png' },
{ status: 4, badge: '', name: '已关闭', icon: '/assets/image/icon_close.png' }
]
}, },
lifetimes: { lifetimes: {
// 生命周期函数,可以为函数,或一个在methods段中定义的方法名 // 生命周期函数,可以为函数,或一个在methods段中定义的方法名
@ -33,67 +31,14 @@ Component({
}, },
methods: { methods: {
onRestart: function () { onRestart: function () {
if(this.data.loading){
this.initAccountInfo()
}
var fragment = this.selectComponent('#' + this.data.tabList[this.data.tabIndex].value)
if (fragment) {
fragment.onRestart()
}
}, },
onEvent: function (message) { onEvent: function (message) {
if (message.what == 888) { if (message.what == 888) {
this.initAccountInfo()
}
},
initAccountInfo: function(){
if(app.accountInfo && app.accountInfo.position == 'ORDINARY'){
this.setData({
loading: false,
userInfo: app.accountInfo, height: app.globalData.safeFragmentHeight - 100,
tabList: [
{id: 0, name: '生产中', badge: 0, value: 'supply', status: 0 },
{id: 1, name: '待生产', badge: 0, value: 'purchase', status: 1 },
{id: 2, name: '已完成', badge: 0, value: 'production', status: 3 },
{id: 3, name: '已终止', badge: 0, value: 'termination', status: 6 }
]
})
} else {
this.setData({ loading: false, userInfo: app.accountInfo, height: app.globalData.safeFragmentHeight - 100 })
}
// 您的申请正在处理,请等待,轮询去查询userInfo
if(app.accountInfo && app.accountInfo.applicationStatus == 0){
this.fetchUserInfo()
} }
}, },
onTabChange: function (event) {
if (this.data.tabIndex == Number(event.detail.index)) {
return
}
this.setData({ tabIndex: event.detail.index})
var fragment = this.selectComponent('#' + this.data.tabList[this.data.tabIndex].value)
if (fragment) {
fragment.onRestart()
}
},
fetchUserInfo: function(){
getUserInfo().then(result => {
app.accountInfo = result.data
if(result.data.enterpriseId && result.data.applicationStatus == 1){
this.initAccountInfo()
} else {
var that = this
setTimeout(function () { that.fetchUserInfo() }, 3000)
}
}).catch(err => {
console.log(err)
})
},
loginFrom: function(){
wx.navigateTo({ url: '/pages/index/index' })
},
applyFrom: function(){
wx.navigateTo({ url: '/pages/htmls/saas/index' })
toOrderList: function (e) {
wx.navigateTo({ url: '/pages/process/order-list/index?status=' + e.currentTarget.dataset.status })
} }
} }
}) })

30
pages/process/index/index.wxml

@ -3,16 +3,20 @@
<view slot="content" style="color:black;font-size:36rpx">工作台</view> <view slot="content" style="color:black;font-size:36rpx">工作台</view>
</cu-custom> </cu-custom>
<van-cell-group>
<van-cell is-link value="查看全部订单" link-type="navigateTo" url="/pages/mall/order-list/index">
<view class="flex" slot="title" style="align-items: center">
<text class="text-sg" style="margin-left:12rpx">收货管理</text>
</view>
</van-cell>
</van-cell-group>
<van-grid square clickable column-num="4">
<van-grid-item icon="cash-back-record" url="/pages/mall/order-list/index?index=1" text="待付款" />
<van-grid-item icon="clock-o" url="/pages/mall/order-list/index?index=2" text="待发货" />
<van-grid-item icon="logistics" url="/pages/mall/order-list/index?index=3" text="待收货" />
<van-grid-item icon="notes-o" url="/pages/mall/order-list/index?index=4" text="已完成" />
</van-grid>
<view style="height:250rpx;background-color:#008AFF;border-radius: 0rpx 0rpx 12rpx 12rpx;">
<view class="flex flex-center" style="padding:32rpx 28rpx;justify-content: flex-start">
<image style="width:100rpx;height:100rpx" src="/assets/image/icon_logo.png"></image>
<view class="text-xxl text-bold" style="color:white;margin-left:32rpx">钟落潭打包厂</view>
</view>
</view>
<view style="padding: 0rpx 28rpx;margin-top:-90rpx">
<view class="bg-white" style="border-radius: 20rpx;padding: 24rpx 0rpx">
<view class="text-black text-sg text-bold" style="padding: 0rpx 28rpx 12rpx 28rpx">收货订单</view>
<van-grid column-num="5" border="{{fasle}}">
<van-grid-item wx:for="{{ tabList }}" wx:key="index" data-status="{{item.status}}" bind:click="toOrderList" text="{{item.name}}">
<van-icon slot="icon" name="{{ item.icon }}" size="68rpx" info="{{item.badge}}" />
</van-grid-item>
</van-grid>
</view>
</view>

59
pages/process/order-check/index.js

@ -0,0 +1,59 @@
// pages/process/order-check/index.js
import Dialog from '../../../components/dialog/dialog'
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
safeBottom: app.globalData.safeBottom,
form: {
plateNumber: null
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
safeBottom: app.globalData.safeBottom
})
},
showPlate: function (e) {
this.keyboard = this.keyboard || this.selectComponent('#wux-keyboard')
this.keyboard.show(this.data.form.plateNumber, 0)
},
onPlatenumber: function({detail}){
if(detail && detail.plateNumber){
this.setData({ ['form.plateNumber']: detail.plateNumber })
}
},
showCategory: function(){
},
bindInput: function (e) {
this.data.form[e.target.id] = e.detail.value
},
onChange: function({ detail }) {
// 需要手动对 checked 状态进行更新
this.setData({ ['form.isDefault']: detail ? 1 : 0 })
},
paddingOrder: function(){
this.setData({ ['form.checking']: !this.data.form.checking })
},
cancelOrder: function(e){
Dialog.confirm({ title: '温馨提示', message: '确定取消该订单?' }).then(() => {
})
},
viewImage: function (e) {
var imgList = []
for (let index = 0; index < this.data.imgList.length; index++) {
if (this.data.imgList[index].indexOf('.mp4') >= 0) {
continue
}
imgList.push(this.data.imgList[index])
}
wx.previewImage({ urls: imgList, current: e.currentTarget.dataset.url })
}
})

12
pages/process/order-check/index.json

@ -0,0 +1,12 @@
{
"usingComponents": {
"van-index-anchor": "/components/index-anchor/index",
"van-cell": "/components/cell/index",
"van-button": "/components/button/index",
"van-checkbox": "/components/checkbox/index",
"van-loading": "/components/loading/index",
"van-image": "/components/image/index",
"van-dialog": "/components/dialog/index",
"vehicle-keyboard": "/components/vehicle-keyboard/index"
}
}

94
pages/process/order-check/index.wxml

@ -0,0 +1,94 @@
<!--pages/process/order-check/index.wxml-->
<cu-custom bgColor="bg-white" isBack="{{true}}">
<view slot="content">定价详情</view>
</cu-custom>
<van-index-anchor index="订单信息" />
<van-cell>
<view slot="title" class="flex flex-justify">
<view class="text-black">客户姓名</view>
<view class="text-gray">客户姓名</view>
</view>
</van-cell>
<van-cell bind:click="showPlate">
<view slot="title" class="flex flex-justify">
<view class="text-black">车牌号码</view>
<view class="text-gray">{{form.plateNumber || '请输入车牌号码'}}</view>
</view>
</van-cell>
<van-cell bind:click="showCategory">
<view slot="title" class="flex flex-justify">
<view class="text-black">
<text>废纸品类</text>
<text class="text-red text-xl">*</text>
</view>
<view class="text-gray">请选择废纸品类</view>
</view>
</van-cell>
<van-index-anchor index="定价信息" />
<van-cell>
<view slot="title" class="flex flex-justify">
<view class="text-black">
<text>单价(元/KG)</text>
<text class="text-red text-xl">*</text>
</view>
<input id="price" type="number" placeholder-style="color:#aaa" style="text-align: right" maxlength="8"
placeholder="请输单价" value="{{form.price}}" bindinput="bindInput" />
</view>
</van-cell>
<van-cell>
<view slot="title" class="flex flex-justify">
<view class="text-black">
<text>扣重(KG)</text>
<text class="text-red text-xl">*</text>
</view>
<input id="weight" type="number" placeholder-style="color:#aaa" style="text-align: right" maxlength="8"
placeholder="请输入扣重重量" value="{{form.account}}" bindinput="bindInput" />
</view>
</van-cell>
<van-cell>
<view slot="title" class="flex flex-justify">
<view class="text-black">
<text>扣点(%)</text>
<text class="text-red text-xl">*</text>
</view>
<input id="weight" type="number" placeholder-style="color:#aaa" style="text-align: right" maxlength="8"
placeholder="请输入扣点比例" value="{{form.account}}" bindinput="bindInput" />
</view>
</van-cell>
<van-cell bind:click="paddingOrder">
<view slot="title" class="flex flex-justify">
<view class="text-black">是否无皮过磅</view>
<van-checkbox value="{{ form.checking }}"></van-checkbox>
</view>
</van-cell>
<van-index-anchor index="过磅信息" />
<van-cell>
<view slot="title" class="flex flex-justify">
<view class="text-black">毛重(KG)</view>
<view class="text-gray">2000.00</view>
</view>
</van-cell>
<van-cell>
<view slot="title" class="flex flex-justify">
<view class="text-black">
<view>过毛重照片</view>
<view class="flex" style="margin-top:18rpx"></view>
<van-image use-loading-slot width="100" height="100" custom-class="page-icon" src="{{'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fa3.att.hudong.com%2F02%2F38%2F01300000237560123245382609951.jpg&refer=http%3A%2F%2Fa3.att.hudong.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1613740606&t=80056f95b1e837a4d0f770c72a09cfe5'}}" bind:click="viewImage">
<view class="image-load" slot="loading"><van-loading type="spinner" size="32" /></view>
</van-image>
<van-image use-loading-slot width="100" height="100" custom-class="page-icon" src="{{'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fa3.att.hudong.com%2F02%2F38%2F01300000237560123245382609951.jpg&refer=http%3A%2F%2Fa3.att.hudong.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1613740606&t=80056f95b1e837a4d0f770c72a09cfe5'}}" bind:click="viewImage">
<view class="image-load" slot="loading"><van-loading type="spinner" size="32" /></view>
</van-image>
</view>
</view>
</van-cell>
<view style="height:{{136 + safeBottom}}rpx;"></view>
<view class="cu-bar bg-white foot" style="height:{{120 + safeBottom}}rpx;padding:0rpx 32rpx {{safeBottom}}rpx 32rpx;" wx:if="{{form}}">
<van-button plain type="default" custom-style="height:88rpx;width:254rpx" bind:click="cancelOrder">取消</van-button>
<van-button type="info" custom-style="margin-left:32rpx;height:88rpx;width:400rpx" bind:click="priceOrder">提交</van-button>
</view>
<van-dialog id="van-dialog" />
<vehicle-keyboard id="wux-keyboard" safeBottom="{{safeBottom}}" bind:change="onPlatenumber"></vehicle-keyboard>

4
pages/process/order-check/index.wxss

@ -0,0 +1,4 @@
/* pages/process/order-check/index.wxss */
.page-icon {
margin-right: 24rpx;
}

59
pages/process/order-info/index.js

@ -0,0 +1,59 @@
// pages/process/order-check/index.js
import Dialog from '../../../components/dialog/dialog'
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
safeBottom: app.globalData.safeBottom,
form: {
plateNumber: null
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
safeBottom: app.globalData.safeBottom
})
},
showPlate: function (e) {
this.keyboard = this.keyboard || this.selectComponent('#wux-keyboard')
this.keyboard.show(this.data.form.plateNumber, 0)
},
onPlatenumber: function({detail}){
if(detail && detail.plateNumber){
this.setData({ ['form.plateNumber']: detail.plateNumber })
}
},
showCategory: function(){
},
bindInput: function (e) {
this.data.form[e.target.id] = e.detail.value
},
onChange: function({ detail }) {
// 需要手动对 checked 状态进行更新
this.setData({ ['form.isDefault']: detail ? 1 : 0 })
},
paddingOrder: function(){
this.setData({ ['form.checking']: !this.data.form.checking })
},
cancelOrder: function(e){
Dialog.confirm({ title: '温馨提示', message: '确定取消该订单?' }).then(() => {
})
},
viewImage: function (e) {
var imgList = []
for (let index = 0; index < this.data.imgList.length; index++) {
if (this.data.imgList[index].indexOf('.mp4') >= 0) {
continue
}
imgList.push(this.data.imgList[index])
}
wx.previewImage({ urls: imgList, current: e.currentTarget.dataset.url })
}
})

10
pages/process/order-info/index.json

@ -0,0 +1,10 @@
{
"usingComponents": {
"van-index-anchor": "/components/index-anchor/index",
"van-cell": "/components/cell/index",
"van-button": "/components/button/index",
"van-loading": "/components/loading/index",
"van-image": "/components/image/index",
"van-dialog": "/components/dialog/index"
}
}

118
pages/process/order-info/index.wxml

@ -0,0 +1,118 @@
<!--pages/process/order-check/index.wxml-->
<cu-custom bgColor="bg-white" isBack="{{true}}">
<view slot="content">过磅详情</view>
</cu-custom>
<view class="flex flex-center info_status" style="justify-content: flex-start;">
<image style="height:42rpx;width:42rpx" src="/assets/image/icon_uncheck.png"></image>
<view class="text-white text-sg" style="margin-left:12rpx">待过磅审核</view>
</view>
<van-cell>
<view slot="title" class="flex flex-justify">
<view class="text-black">客户姓名</view>
<view class="text-gray">刘财顺</view>
</view>
</van-cell>
<van-cell>
<view slot="title" class="flex flex-justify">
<view class="text-black">车牌号码</view>
<view class="text-gray">{{form.plateNumber || '请输入车牌号码'}}</view>
</view>
</van-cell>
<van-cell>
<view slot="title" class="flex flex-justify">
<view class="text-black">废纸品类</view>
<view class="text-gray">黄纸板</view>
</view>
</van-cell>
<van-cell>
<view slot="title" class="flex flex-justify">
<view class="text-black">毛重(KG)</view>
<view class="text-gray">黄纸板</view>
</view>
</van-cell>
<van-cell>
<view slot="title" class="flex flex-justify">
<view class="text-black">皮重(KG)</view>
<view class="text-gray">黄纸板</view>
</view>
</van-cell>
<van-cell>
<view slot="title" class="flex flex-justify">
<view class="text-black">净重(KG)</view>
<view class="text-gray">黄纸板</view>
</view>
</van-cell>
<van-cell>
<view slot="title" class="flex flex-justify">
<view class="text-black">定价员</view>
<view class="text-gray">黄纸板</view>
</view>
</van-cell>
<van-cell>
<view slot="title" class="flex flex-justify">
<view class="text-black">定价时间</view>
<view class="text-gray">2021年1月20日 21:46:27</view>
</view>
</van-cell>
<van-cell>
<view slot="title" class="flex flex-justify">
<view class="text-black">
<view>过毛重照片</view>
<view class="flex" style="margin-top:18rpx"></view>
<van-image use-loading-slot width="100" height="100" custom-class="page-icon" src="{{'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fa3.att.hudong.com%2F02%2F38%2F01300000237560123245382609951.jpg&refer=http%3A%2F%2Fa3.att.hudong.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1613740606&t=80056f95b1e837a4d0f770c72a09cfe5'}}" bind:click="viewImage">
<view class="image-load" slot="loading"><van-loading type="spinner" size="32" /></view>
</van-image>
<van-image use-loading-slot width="100" height="100" custom-class="page-icon" src="{{'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fa3.att.hudong.com%2F02%2F38%2F01300000237560123245382609951.jpg&refer=http%3A%2F%2Fa3.att.hudong.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1613740606&t=80056f95b1e837a4d0f770c72a09cfe5'}}" bind:click="viewImage">
<view class="image-load" slot="loading"><van-loading type="spinner" size="32" /></view>
</van-image>
</view>
</view>
</van-cell>
<van-cell>
<view slot="title" class="flex flex-justify">
<view class="text-black">
<view>过皮重照片</view>
<view class="flex" style="margin-top:18rpx"></view>
<van-image use-loading-slot width="100" height="100" custom-class="page-icon" src="{{'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fa3.att.hudong.com%2F02%2F38%2F01300000237560123245382609951.jpg&refer=http%3A%2F%2Fa3.att.hudong.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1613740606&t=80056f95b1e837a4d0f770c72a09cfe5'}}" bind:click="viewImage">
<view class="image-load" slot="loading"><van-loading type="spinner" size="32" /></view>
</van-image>
<van-image use-loading-slot width="100" height="100" custom-class="page-icon" src="{{'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fa3.att.hudong.com%2F02%2F38%2F01300000237560123245382609951.jpg&refer=http%3A%2F%2Fa3.att.hudong.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1613740606&t=80056f95b1e837a4d0f770c72a09cfe5'}}" bind:click="viewImage">
<view class="image-load" slot="loading"><van-loading type="spinner" size="32" /></view>
</van-image>
</view>
</view>
</van-cell>
<van-index-anchor index="订单信息" />
<van-cell>
<view slot="title" class="flex flex-justify">
<view class="text-black">单价(元/KG)</view>
<view class="text-gray">1.80</view>
</view>
</van-cell>
<van-cell>
<view slot="title" class="flex flex-justify">
<view class="text-black">金额(元)</view>
<view class="text-gray">47001.80</view>
</view>
</van-cell>
<van-cell>
<view slot="title" class="flex flex-justify">
<view class="text-black">订单时间</view>
<view class="text-gray">2021年1月20日 21:46:27</view>
</view>
</van-cell>
<van-cell>
<view slot="title" class="flex flex-justify">
<view class="text-black">订单编号</view>
<view class="text-gray">XXP123456709978957</view>
</view>
</van-cell>
<view style="height:{{136 + safeBottom}}rpx;"></view>
<view class="cu-bar bg-white foot" style="height:{{120 + safeBottom}}rpx;padding:0rpx 32rpx {{safeBottom}}rpx 32rpx;" wx:if="{{form}}">
<van-button plain type="default" custom-style="height:88rpx;width:254rpx" bind:click="cancelOrder">重新过皮重</van-button>
<van-button type="info" custom-style="margin-left:32rpx;height:88rpx;width:400rpx" bind:click="priceOrder">通过审核</van-button>
</view>
<van-dialog id="van-dialog" />

10
pages/process/order-info/index.wxss

@ -0,0 +1,10 @@
/* pages/process/order-check/index.wxss */
.page-icon {
margin-right: 24rpx;
}
.info_status{
background-image: linear-gradient(90deg, #FF4D2E 6%, #FF952F 100%);
height:90rpx;
padding: 0rpx 32rpx;
}

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

@ -0,0 +1,94 @@
// pages/process/order-list/index.js
import Dialog from '../../../components/dialog/dialog'
import { getOrderList, cancelOrder, receiptOrder} from "../../api/saas"
const event = require('../../../utils/event')
const util = require('../../../utils/util')
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
height: app.globalData.fragmentHeight,
loading: true,
requesting: false,
finished: false,
top: 0,
orderList: [],
form: {
status: 0,
pageNum: 1
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
if(options.status){
this.data.form.status = Number(options.status)
}
this.setData({ height: app.globalData.fragmentHeight })
this.fetchOrderList()
},
onRefreshList: function () {
this.setData({
orderList: [],
['form.pageNum']: 1,
loading: true,
finished: false
})
this.fetchOrderList()
},
fetchOrderList: function () {
if (this.data.requesting || this.data.finished) {
return
}
if (this.data.loading) {
this.data.requesting = true
} else {
this.setData({ requesting: true })
}
getOrderList(this.data.form).then(result => {
if (result.data.records.length) {
var respList = result.data.records
let nowList = `orderList[${this.data.orderList.length}]`
var num = this.data.form.pageNum
var finished = ((num - 1) * this.data.form.pageSize + respList.length) >= result.data.total
if(this.data.form.pageNum == 1){
this.setData({
[nowList]: respList,
['form.pageNum']: (num + 1),
top: 0,
finished,
requesting: false,
loading: false
})
} else {
this.setData({
[nowList]: respList,
['form.pageNum']: (num + 1),
finished,
requesting: false,
loading: false
})
}
} else {
this.setData({ finished: true, requesting: false, loading: false })
}
}).catch(err => {
//异常回调
this.setData({ requesting: false, loading: false })
util.showToast(err)
})
},
cancelOrder: function(e){
Dialog.confirm({ title: '温馨提示', message: '确定取消该订单?' }).then(() => {
})
},
priceOrder: function(e){
wx.navigateTo({ url: '/pages/process/order-info/index?id=' })
}
})

12
pages/process/order-list/index.json

@ -0,0 +1,12 @@
{
"usingComponents": {
"refresh-view": "/components/refresher/index",
"van-button": "/components/button/index",
"van-index-bar": "/components/index-bar/index",
"van-index-anchor": "/components/index-anchor/index",
"van-cell": "/components/cell/index",
"van-divider": "/components/divider/index",
"van-loading": "/components/loading/index",
"van-dialog": "/components/dialog/index"
}
}

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

@ -0,0 +1,40 @@
<!--pages/process/order-list/index.wxml-->
<cu-custom bgColor="bg-white" isBack="{{true}}">
<view slot="content">定价列表</view>
</cu-custom>
<refresh-view bind:refresh="onRefreshList" height="{{height}}" triggered="{{requesting}}" scrollTop="{{top}}" bind:scrolltolower="fetchOrderList">
<view class="list-empty" style="height:{{height}}rpx" wx:if="{{!orderList.length}}">
<view style="margin-bottom:24px" wx:if="{{loading}}">
<van-loading type="spinner" size="32" />
</view>
<image class="img-empty" src="/assets/image/list_empty.png" wx:else></image>
<view class="text-empty">{{loading? '正在加载' : '暂无数据'}}</view>
</view>
<van-index-bar index-list="{{null}}" wx:else>
<view wx:for="{{6}}" wx:key="index">
<van-index-anchor index="01月13日" />
<van-cell wx:for="{{4}}" wx:key="index">
<view slot="title" class="flex flex-justify">
<view>
<view class="text-sg text-black">客户名称:刘财顺</view>
<view class="text-sm text-gray">毛重:2000.00KG</view>
</view>
<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>
</view>
</view>
</van-cell>
</view>
</van-index-bar>
<!--加载更多的UI-->
<van-divider content-position="center" wx:if="{{ form.pageNum > 1}}" custom-style="padding:0rpx 120rpx">
<van-loading type="spinner" size="16" wx:if="{{!finished}}" />
<text class="text-sm" style="margin-left:8rpx">{{finished?'到底啦~':'加载中...'}}</text>
</van-divider>
</refresh-view>
<van-dialog id="van-dialog" />

1
pages/process/order-list/index.wxss

@ -0,0 +1 @@
/* pages/process/order-list/index.wxss */
Loading…
Cancel
Save