Browse Source

no message

feature/v1.4
xpz2018 4 years ago
parent
commit
b4748f643e
10 changed files with 318 additions and 35 deletions
  1. 1
      app.json
  2. 2
      pages/agent/index/index.wxml
  3. 19
      pages/process/check-list/index.js
  4. 175
      pages/process/order-check/index.js
  5. 14
      pages/process/order-check/index.json
  6. 94
      pages/process/order-check/index.wxml
  7. 8
      pages/process/order-check/index.wxss
  8. 21
      pages/process/order-info/index.js
  9. 1
      pages/process/order-info/index.json
  10. 18
      pages/process/order-info/index.wxml

1
app.json

@ -13,6 +13,7 @@
"pages/process/check-list/index",
"pages/process/order-list/index",
"pages/process/order-price/index",
"pages/process/order-check/index",
"pages/process/order-info/index",
"pages/process/payment-list/index",
"pages/process/payment/index",

2
pages/agent/index/index.wxml

@ -49,7 +49,7 @@
<view style="flex:1;padding:0rpx 32rpx;margin-right:12rpx">
<view class="flex flex-center" style="justify-content: flex-start">
<view style="height:24rpx;width:6rpx;background:#007AFF"></view>
<view class="text-black text-sm" style="margin-left: 12rpx">未提现余额</view>
<view class="text-black text-sm" style="margin-left: 12rpx">账户余额</view>
</view>
<view class="text-xxl text-bold text-price" style="margin:12rpx 0rpx">{{banlanceInfo.accountMoney}}</view>
</view>

19
pages/process/check-list/index.js

@ -99,24 +99,7 @@ Scene({
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
})
}
this.setData({ [nowList]: respList, ['form.pageNum']: (num + 1), finished, requesting: false, loading: false })
} else {
this.setData({ finished: true, requesting: false, loading: false })
}

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

@ -0,0 +1,175 @@
// pages/process/order-check/index.js
import Scene from '../../index/scene'
import { checkingOrder, getFactoryOrderInfo, getPaperList} from "../../../api/saas"
const event = require('../../../utils/event')
const util = require('../../../utils/util')
const math = require('../../../utils/math')
const app = getApp()
Scene({
/**
* 页面的初始数据
*/
data: {
safeBottom: app.globalData.safeBottom,
paperList: null,
form: null,
columns: [],
focus: 0,
visible: false,
amout: 0,
nowItem: null
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
if(options.id){
wx.showLoading({ title: '正在获取', mask: true })
getPaperList({pageNum: 1, pageSize: 100}).then(result => {
this.data.paperList = result.data.records
this.data.columns = []
for (let index = 0; index < this.data.paperList.length; index++) {
this.data.columns.push(this.data.paperList[index].name)
}
this.setData({ safeBottom: app.globalData.safeBottom, columns: this.data.columns })
}).catch(err => {
this.setData({ safeBottom: app.globalData.safeBottom })
util.showToast(err)
})
getFactoryOrderInfo(options.id).then(result => {
wx.hideLoading()
result.data.sign = 1
if(Number(result.data.deductPercent) <= 0){
result.data.deductPercent = null
}
this.data.amout = math.times(result.data.settleWeight, result.data.unitPrice)
this.setData({ form: result.data, amout: this.data.amout })
}).catch(err => {
wx.hideLoading()
util.showToast(err)
})
}
},
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(){
this.setData({ visible: true })
},
onConfirm: function({detail}){
this.data.nowItem = this.data.paperList[detail.index]
this.data.form.productId = this.data.nowItem.id
this.data.form.unitPrice = this.data.nowItem.defaultUnitPrice
this.data.form.productName = detail.value
this.statAmount()
},
onHide: function(){
this.setData({ visible: false })
},
changeDeductType: function(e){
this.setData({ ['form.sign']: e.currentTarget.dataset.type, focus: e.currentTarget.dataset.type })
},
bindInput: function (e) {
this.data.form[e.target.id] = e.detail.value
if(e.target.id == 'deductPercent'){
if(util.isEmpty(e.detail.value) || Number(e.detail.value) <= 0){
this.data.form.deductWeight = null
this.data.form.deductPercent = null
} else {
this.data.form.deductWeight = math.divide(math.times(this.data.form.totalWeight, Number(e.detail.value)), 100).toFixed(2)
// this.setData({ ['form.deductWeight']: math.divide(math.times(this.data.form.totalWeight, Number(e.detail.value)), 100).toFixed(3) })
}
} else if(e.target.id == 'deductWeight'){
if(util.isEmpty(e.detail.value) || Number(e.detail.value) <= 0){
this.data.form.deductWeight = null
this.data.form.deductPercent = null
} else {
this.data.form.deductPercent = math.times(math.divide(Number(e.detail.value), this.data.form.totalWeight), 100).toFixed(2)
// this.setData({ ['form.deductPercent']: math.times(math.divide(Number(e.detail.value), this.data.form.totalWeight), 100).toFixed(2) })
}
}
this.statAmount()
},
onChange: function(e) {
this.data.form.inspectionRemark = e.detail
},
statAmount: function(){
this.data.form.settleWeight = this.data.form.netWeight
if(!util.isEmpty(this.data.form.deductWeight)){
this.data.form.settleWeight = math.minus(this.data.form.netWeight, this.data.form.deductWeight)
}
if(!util.isEmpty(this.data.form.unitPrice) && Number(this.data.form.unitPrice) > 0){
this.data.amout = math.times(this.data.form.settleWeight, this.data.form.unitPrice)
} else {
this.data.amout = null
}
this.setData({ visible: false, form: this.data.form, amout: this.data.amout })
},
checkOrder: function(){
if(util.isEmpty(this.data.form.productId) || Number(this.data.form.productId) <= 0){
util.showToast('请选择废纸品类')
return
}
if(util.isEmpty(this.data.form.unitPrice) || Number(this.data.form.unitPrice) <= 0){
util.showToast('请输入单价')
return
}
if(this.data.nowItem){
if(this.data.nowItem.highestUnitPrice && Number(this.data.form.unitPrice) > Number(this.data.nowItem.highestUnitPrice)){
util.showToast('输入单价过高,价格范围:' + this.data.nowItem.lowestUnitPrice + '元/公斤-'+ this.data.nowItem.highestUnitPrice + '元/公斤')
return
}
if(this.data.nowItem.lowestUnitPrice && Number(this.data.form.unitPrice) < Number(this.data.nowItem.lowestUnitPrice)){
util.showToast('输入单价过低,价格范围:' + this.data.nowItem.lowestUnitPrice + '元/公斤-'+ this.data.nowItem.highestUnitPrice + '元/公斤')
return
}
}
if(!util.isEmpty(this.data.form.deductWeight) && Number(this.data.form.deductWeight) >= Number(this.data.form.totalWeight)){
util.showToast('扣重不得超过皮重')
return
}
if(!util.isEmpty(this.data.form.deductPercent) && Number(this.data.form.deductPecent) >= 100){
util.showToast('扣点范围:0-100')
return
}
wx.showLoading({ title: '处理中', mask: true })
var data = {id: this.data.form.id}
if(Number(this.data.form.deductWeight) > 0){
data.deductWeight = Number(this.data.form.deductWeight)
}
if(Number(this.data.form.deductPercent) > 0){
data.deductPercent = Number(this.data.form.deductPercent)
}
data.plateNumber = this.data.form.plateNumber
data.productId = this.data.form.productId
data.sign = this.data.form.sign
data.unitPrice = Number(this.data.form.unitPrice)
checkingOrder(data).then(result => {
wx.hideLoading()
event.emit('OrderMessage', { what: 12, desc: 'checkingOrder' })
util.showBackToast('订单审核已通过')
}).catch(err => {
wx.hideLoading()
util.showToast(err)
})
},
viewImage: function (e) {
var imgList = []
for (let index = 0; index < this.data.form.totalWeighingPicture.length; index++) {
var url = this.data.form.totalWeighingPicture[index].url
if(!util.isEmpty(url) && 'error' != url){
imgList.push(url)
}
}
if(imgList.length){
wx.previewImage({ urls: imgList, current: e.currentTarget.dataset.url })
}
}
})

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

@ -0,0 +1,14 @@
{
"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-picker": "/components/picker/index",
"van-popup": "/components/popup/index",
"vehicle-keyboard": "/components/vehicle-keyboard/index",
"notification": "/pages/message/notification/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>
<view wx:if="{{form}}">
<van-index-anchor index="订单信息" />
<van-cell>
<view slot="title" class="flex flex-justify">
<view class="text-black">客户姓名</view>
<view class="text-black">{{form.factoryCustomerName}}</view>
</view>
</van-cell>
<van-cell clickable center is-link bind:click="showPlate">
<view slot="title" class="flex flex-justify">
<view class="text-black">车牌号码</view>
<view class="{{form.plateNumber ? 'text-black' : '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">{{form.totalWeight}}</view>
</view>
</van-cell>
<van-cell>
<view slot="title" class="flex flex-justify">
<view class="text-black">皮重(公斤)</view>
<view class="text-gray">{{form.emptyWeight || '- -'}}</view>
</view>
</van-cell>
<van-index-anchor index="定价信息" />
<van-cell clickable center is-link bind:click="showCategory">
<view slot="title" class="flex flex-justify">
<view class="flex flex-center text-black">
<view class="text-red text-xl" style="line-height: 10px; padding-top: 8px">*</view>
<text>废纸品类</text>
</view>
<view class="{{form.productName ? 'text-black' : 'text-gray'}}">{{form.productName || '请选择废纸品类'}}</view>
</view>
</van-cell>
<van-cell>
<view slot="title" class="flex flex-justify">
<view class="flex flex-center text-black">
<view class="text-red text-xl" style="line-height: 10px; padding-top: 8px">*</view>
<text>单价(元/公斤)</text>
</view>
<input id="unitPrice" type="digit" placeholder-style="color:#aaa" style="text-align: right" maxlength="8"
placeholder="请输单价" value="{{form.unitPrice || ''}}" bindinput="bindInput" />
</view>
</van-cell>
<van-cell>
<view slot="title" class="flex flex-justify">
<view class="flex flex-center text-black" data-type="1" bindtap="changeDeductType">
<van-checkbox value="{{ form.sign == 1 }}" icon-size="32rpx"></van-checkbox>
<text style="margin-left:8rpx">扣重(公斤)</text>
</view>
<input id="deductWeight" type="digit" disabled="{{form.sign == 2}}" focus="{{focus == 1}}"
placeholder-style="color:#aaa" style="text-align: right" maxlength="10" placeholder="请输入扣重重量"
value="{{form.deductWeight || ''}}" bindinput="bindInput" data-type="1" bindtap="changeDeductType" />
</view>
</van-cell>
<van-cell>
<view slot="title" class="flex flex-justify">
<view class="flex flex-center text-black" data-type="2" bindtap="changeDeductType">
<van-checkbox value="{{ form.sign == 2 }}" icon-size="32rpx"></van-checkbox>
<text style="margin-left:8rpx">扣点(%)</text>
</view>
<input id="deductPercent" type="digit" disabled="{{form.sign == 1}}" focus="{{focus == 2}}"
placeholder-style="color:#aaa" style="text-align: right" maxlength="10" placeholder="请输入扣点比例"
value="{{form.deductPercent}}" bindinput="bindInput" data-type="2" bindtap="changeDeductType" />
</view>
</van-cell>
<van-cell>
<view slot="title" class="flex flex-justify">
<view class="text-black">结算重量(公斤)</view>
<view class="text-gray">{{form.settleWeight || '- -'}}</view>
</view>
</van-cell>
</view>
<view style="height:{{136 + safeBottom}}rpx;" wx:if="{{form}}"></view>
<view class="cu-bar bg-white foot flex-justify" style="height:{{120 + safeBottom}}rpx;padding:0rpx 32rpx {{safeBottom}}rpx 32rpx;" wx:if="{{form}}">
<view class="flex flex-center">
<text class="text-lg" wx:if="{{amout}}">金额:</text>
<text class="text-xxl text-price text-red" wx:if="{{amout}}">{{amout}}</text>
</view>
<van-button type="info" custom-style="height:88rpx;width:300rpx" bind:click="checkOrder">通过审核</van-button>
</view>
<vehicle-keyboard id="wux-keyboard" safeBottom="{{safeBottom}}" triplet="{{1}}" bind:change="onPlatenumber"></vehicle-keyboard>
<van-popup position="bottom" show="{{ visible }}" bind:close="onHide" z-index="29">
<van-picker show-toolbar title="选择纸品" columns="{{ columns }}" bind:cancel="onHide" bind:confirm="onConfirm" />
</van-popup>
<notification id="qn-notification"/>

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

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

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

@ -1,7 +1,7 @@
// pages/process/order-check/index.js
import Scene from '../../index/scene'
import Dialog from '../../../components/dialog/dialog'
import { repeatOrder, repeatPrice, getFactoryOrderInfo, checkingOrder, printOrder} from "../../../api/saas"
import { repeatOrder, getFactoryOrderInfo, checkingOrder, printOrder} from "../../../api/saas"
const event = require('../../../utils/event')
const util = require('../../../utils/util')
const app = getApp()
@ -26,6 +26,12 @@ Scene({
if(options.id){
this.fetchOrderInfo(options.id)
}
event.on('OrderMessage', this, this.onEvent)
},
onEvent: function(message){
if (message.what == 12) {
wx.navigateBack()
}
},
fetchOrderInfo(id){
wx.showLoading({ title: '正在获取', mask: true })
@ -102,15 +108,7 @@ Scene({
})
},
priceOrder: function(e){
wx.showLoading({ title: '正在处理', mask: true })
repeatPrice(this.data.form.id).then(result => {
wx.hideLoading()
util.showBackToast('订单已处理')
event.emit('OrderMessage', { what: 12, desc: 'checkingOrder' })
}).catch(err => {
wx.hideLoading()
util.showToast(err)
})
wx.navigateTo({ url: `/pages/process/order-check/index?id=${this.data.form.id}` })
},
checkOrder: function(e){
wx.showLoading({ title: '正在处理', mask: true })
@ -135,5 +133,8 @@ Scene({
}
}
wx.previewImage({ urls: imgList, current: e.currentTarget.dataset.url })
},
onUnload: function(){
event.remove('OrderMessage', this)
}
})

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

@ -8,6 +8,7 @@
"van-dialog": "/components/dialog/index",
"van-popup": "/components/popup/index",
"van-picker": "/components/picker/index",
"vehicle-keyboard": "/components/vehicle-keyboard/index",
"notification": "/pages/message/notification/index"
}
}

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

@ -9,9 +9,12 @@
<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>
<view class="flex flex-center info_status" style="justify-content: flex-start;" wx:elif="{{form.status == 3}}">
<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 class="flex flex-justify info_status" wx:elif="{{form.status == 3}}">
<view class="flex">
<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>
<view class="text-white" style="padding: 12rpx 0rpx 12rpx 12rpx" bindtap="priceOrder">重新定价</view>
</view>
<view class="flex flex-center info_status" style="justify-content: flex-start;" wx:elif="{{form.status == 4}}">
<image style="height:42rpx;width:42rpx" src="/assets/image/icon_payfor.png"></image>
@ -157,9 +160,8 @@
<view style="height:120rpx;" wx:if="{{form && (form.status == 3 || form.status == 4 || form.status == 42) && !agent}}"></view>
<view class="cu-bar bg-white foot" style="height:{{120 + safeBottom}}rpx;padding:0rpx 32rpx {{safeBottom}}rpx 32rpx;"
wx:if="{{form && (form.status == 3 || form.status == 4 || form.status == 42) && !agent }}">
<van-button plain type="default" custom-style="height:88rpx;width:206rpx" bind:click="repeatOrder" wx:if="{{form.status == 3}}">重新过皮重</van-button>
<van-button plain type="danger" custom-style="margin-left:32rpx;height:88rpx;width:206rpx" bind:click="priceOrder" wx:if="{{form.status == 3}}">重新定价</van-button>
<van-button type="info" custom-style="margin-left:32rpx;height:88rpx;width:206rpx" bind:click="checkOrder" wx:if="{{form.status == 3}}">通过审核</van-button>
<van-button plain type="default" custom-style="height:88rpx;width:254rpx" bind:click="repeatOrder" wx:if="{{form.status == 3}}">重新过皮重</van-button>
<van-button type="info" custom-style="margin-left:32rpx;height:88rpx;width:400rpx" bind:click="checkOrder" wx:if="{{form.status == 3}}">通过审核</van-button>
<van-button type="info" custom-style="height:88rpx;width:686rpx" bind:click="paymentOrder" wx:if="{{form.status == 4}}">进行支付</van-button>
<van-button type="info" custom-style="height:88rpx;width:686rpx" bind:click="paymentOrder" wx:if="{{form.status == 42}}">客户结算</van-button>
</view>
@ -170,5 +172,9 @@
</view>
</view>
<vehicle-keyboard id="wux-keyboard" safeBottom="{{safeBottom}}" triplet="{{1}}" bind:change="onPlatenumber"></vehicle-keyboard>
<van-popup position="bottom" show="{{ visible }}" bind:close="onHide" z-index="29">
<van-picker show-toolbar title="选择纸品" columns="{{ columns }}" bind:cancel="onHide" bind:confirm="onConfirm" />
</van-popup>
<van-dialog id="van-dialog" />
<notification id="qn-notification"/>
Loading…
Cancel
Save