Browse Source

no message

feature/v1.1
xpz2018 5 years ago
parent
commit
f540d51e2e
2 changed files with 22 additions and 11 deletions
  1. 25
      pages/process/order-price/index.js
  2. 8
      pages/process/order-price/index.wxml

25
pages/process/order-price/index.js

@ -3,6 +3,7 @@ import Dialog from '../../../components/dialog/dialog'
import { pricingOrder, cancelOrder, getFactoryOrderInfo, getPaperList} from "../../../api/saas"
const event = require('../../../utils/event')
const util = require('../../../utils/util')
const math = require('../../../utils/math')
const app = getApp()
Page({
@ -13,7 +14,6 @@ Page({
safeBottom: app.globalData.safeBottom,
paperList: null,
form: null,
deductType: 1,
columns: [],
focus: 0,
visible: false,
@ -39,6 +39,7 @@ Page({
})
getFactoryOrderInfo(options.id).then(result => {
wx.hideLoading()
result.data.sign = 1
this.setData({ form: result.data })
}).catch(err => {
wx.hideLoading()
@ -68,14 +69,23 @@ Page({
this.setData({ visible: false })
},
changeDeductType: function(e){
if(Number(e.currentTarget.dataset.type) == 1){
this.setData({ deductType: e.currentTarget.dataset.type, ['form.deductPercent']: null, focus: e.currentTarget.dataset.type})
} else {
this.setData({ deductType: e.currentTarget.dataset.type, ['form.deductWeight']: null, focus: e.currentTarget.dataset.type })
}
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.setData({ ['form.deductWeight']: null })
} else {
this.setData({ ['form.deductWeight']: math.divide(math.times(this.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.setData({ ['form.deductPercent']: null })
} else {
this.setData({ ['form.deductPercent']: math.times(math.divide(Number(e.detail.value), this.form.totalWeight), 100).toFixed(2) })
}
}
},
paddingOrder: function(){
this.setData({ ['form.isWithoutTare']: !this.data.form.isWithoutTare })
@ -124,7 +134,8 @@ Page({
var data = {id: this.data.form.id}
if(Number(this.data.form.deductWeight) > 0){
data.deductWeight = Number(this.data.form.deductWeight)
} else if(Number(this.data.form.deductPercent) > 0){
}
if(Number(this.data.form.deductPercent) > 0){
data.deductPercent = Number(this.data.form.deductPercent)
}
data.plateNumber = this.data.form.plateNumber

8
pages/process/order-price/index.wxml

@ -40,19 +40,19 @@
<van-cell>
<view slot="title" class="flex flex-justify">
<view class="flex flex-center text-black" data-type="1" bindtap="changeDeductType">
<van-checkbox value="{{ deductType == 1 }}" icon-size="32rpx"></van-checkbox>
<van-checkbox value="{{ form.sign == 1 }}" icon-size="32rpx"></van-checkbox>
<text style="margin-left:8rpx">扣重(KG)</text>
</view>
<input id="deductWeight" type="digit" disabled="{{deductType == 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"/>
<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="{{ deductType == 2 }}" icon-size="32rpx"></van-checkbox>
<van-checkbox value="{{ form.sign == 2 }}" icon-size="32rpx"></van-checkbox>
<text style="margin-left:8rpx">扣点(%)</text>
</view>
<input id="deductPercent" type="digit" disabled="{{deductType == 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"/>
<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 bind:click="paddingOrder">

Loading…
Cancel
Save