10 changed files with 318 additions and 35 deletions
Split View
Diff Options
-
1app.json
-
2pages/agent/index/index.wxml
-
19pages/process/check-list/index.js
-
175pages/process/order-check/index.js
-
14pages/process/order-check/index.json
-
94pages/process/order-check/index.wxml
-
8pages/process/order-check/index.wxss
-
21pages/process/order-info/index.js
-
1pages/process/order-info/index.json
-
18pages/process/order-info/index.wxml
@ -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 }) |
|||
} |
|||
} |
|||
}) |
|||
@ -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" |
|||
} |
|||
} |
|||
@ -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"/> |
|||
@ -0,0 +1,8 @@ |
|||
/* pages/process/order-check/index.wxss */ |
|||
.page-icon { |
|||
margin-right: 24rpx; |
|||
} |
|||
|
|||
.big-icon{ |
|||
margin-top: 24rpx; |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save