Browse Source

no message

feature/v1.5
xpz2018 4 years ago
parent
commit
c2708dd3ae
15 changed files with 331 additions and 236 deletions
  1. 7
      api/saas.js
  2. 87
      pages/process/outside-check-item/index.js
  3. 10
      pages/process/outside-check-item/index.json
  4. 65
      pages/process/outside-check-item/index.wxml
  5. 23
      pages/process/outside-check-item/index.wxss
  6. 130
      pages/process/outside-check/index.js
  7. 6
      pages/process/outside-check/index.json
  8. 72
      pages/process/outside-check/index.wxml
  9. 10
      pages/process/outside-item/index.js
  10. 7
      pages/process/outside-item/index.wxml
  11. 7
      pages/process/outside-list/index.js
  12. 2
      pages/process/outside-list/index.wxml
  13. 58
      pages/process/outside-price/index.js
  14. 60
      pages/process/outside-price/index.wxml
  15. 23
      pages/process/outside-price/index.wxss

7
api/saas.js

@ -70,9 +70,10 @@ const getSideOrderList = (params) => mGet(`/ztb-factory/get/scrap-paper-offsite-
const createSideOrder = (params) => mPost(`/ztb-factory/create/scrap-paper-offsite-receipt-order`, params, sconfig) const createSideOrder = (params) => mPost(`/ztb-factory/create/scrap-paper-offsite-receipt-order`, params, sconfig)
const getSideOrderInfo = (params) => mGet(`/ztb-factory/get/scrap-paper-offsite-receipt-order-detail`, params, sconfig) const getSideOrderInfo = (params) => mGet(`/ztb-factory/get/scrap-paper-offsite-receipt-order-detail`, params, sconfig)
const editSideOrder = (params) => mPost(`/ztb-factory/modify/scrap-paper-offsite-receipt-order`, params, sconfig) const editSideOrder = (params) => mPost(`/ztb-factory/modify/scrap-paper-offsite-receipt-order`, params, sconfig)
const saveSideOrder = (params) => mPost(`/ztb-factory/save/scrap-paper-offsite-receipt-weight-note`, params, sconfig)
const poundSideOrder = (params) => mPost(`/ztb-factory/submit/scrap-paper-offsite-receipt-weight-note`, params, sconfig) const poundSideOrder = (params) => mPost(`/ztb-factory/submit/scrap-paper-offsite-receipt-weight-note`, params, sconfig)
const priceSideOrder = (params) => mPost(`/ztb-factory/submit/scrap-paper-offsite-receipt-order-price`, params, sconfig) const priceSideOrder = (params) => mPost(`/ztb-factory/submit/scrap-paper-offsite-receipt-order-price`, params, sconfig)
const repeatSideOrder = (params) => mPost(`/ztb-factory/submit/scrap-paper-offsite-receipt-order-price`, params, sconfig)
export { export {
sconfig, sconfig,
@ -135,6 +136,8 @@ export {
getSideOrderInfo, getSideOrderInfo,
editSideOrder, editSideOrder,
getSideOrderList, getSideOrderList,
saveSideOrder,
poundSideOrder, poundSideOrder,
priceSideOrder
priceSideOrder,
repeatSideOrder
} }

87
pages/process/outside-check-item/index.js

@ -0,0 +1,87 @@
// pages/message/index.js
const util = require('../../../utils/util')
const math = require('../../../utils/math')
Component({
options: {
addGlobalClass: true,
multipleSlots: true
},
properties: {
form: { type: Object, value: null },
item: { type: Object, value: null },
index: { type: Number, value: 0 },
list: { type: Array, value: [] },
columns: { type: Array, value: [] },
status: { type: Number, value: 0 }
},
data: {
visible: false,
focus: 0
},
methods: {
showCategory: function(){
this.setData({ visible: true })
},
onConfirm: function({detail}){
var nowItem = this.data.paperList[detail.index]
for (var i = 0; i < this.data.form.productCategoryInfos.length; i++) {
if (this.data.form.productCategoryInfos[i].productId == nowItem.id){
this.setData({ visible: false })
util.showToast('纸品已经存在,请不要重复添加')
return
}
}
this.data.item.productId = nowItem.id
this.data.item.settleUnitPrice = nowItem.defaultUnitPrice
this.data.item.highestUnitPrice = nowItem.highestUnitPrice
this.data.item.lowestUnitPrice = nowItem.lowestUnitPrice
this.data.item.productCategoryName = detail.value
this.statAmount()
},
onHide: function(){
this.setData({ visible: false })
},
bindInput: function (e) {
this.data.item[e.currentTarget.id] = e.detail.value
if(e.currentTarget.id == 'deductPercent'){
if(util.isEmpty(e.detail.value) || Number(e.detail.value) <= 0){
this.data.item.deductWeight = null
this.data.item.deductPercent = null
} else {
this.data.item.deductWeight = math.divide(math.times(this.data.item.netWeight, Number(e.detail.value)), 100).toFixed(2)
}
this.statAmount()
} else if(e.currentTarget.id == 'deductWeight'){
if(util.isEmpty(e.detail.value) || Number(e.detail.value) <= 0){
this.data.item.deductWeight = null
this.data.item.deductPercent = null
} else {
this.data.item.deductPercent = math.times(math.divide(Number(e.detail.value), this.data.item.netWeight), 100).toFixed(2)
}
this.statAmount()
} else if(e.currentTarget.id == 'settleUnitPrice'){
this.statAmount()
}
wx.nextTick(() => {
this.triggerEvent('change', {index: this.data.index, item: this.data.item});
})
},
statAmount: function(){
this.data.item.settleWeight = this.data.item.netWeight
if(!util.isEmpty(this.data.item.deductWeight)){
this.data.item.settleWeight = math.minus(this.data.item.netWeight, this.data.item.deductWeight)
}
if(!util.isEmpty(this.data.item.settleUnitPrice) && Number(this.data.item.settleUnitPrice) > 0){
this.data.item.settlePrice = math.times(this.data.item.settleWeight, this.data.item.settleUnitPrice)
} else {
this.data.item.settlePrice = null
}
this.setData({ item: this.data.item })
},
changeDeductType: function(e){
this.setData({ ['item.sign']: e.currentTarget.dataset.type, focus: e.currentTarget.dataset.type })
}
}
})

10
pages/process/outside-check-item/index.json

@ -0,0 +1,10 @@
{
"component": true,
"usingComponents": {
"van-cell": "/components/cell/index",
"van-checkbox": "/components/checkbox/index",
"van-picker": "/components/picker/index",
"van-popup": "/components/popup/index",
"van-uploader": "/components/uploader/index"
}
}

65
pages/process/outside-check-item/index.wxml

@ -0,0 +1,65 @@
<!--pages/message/index.wxml-->
<view style="height:16rpx" wx:if="{{index != 0 }}"></view>
<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>废纸品类{{index + 1}}</text>
</view>
<view class="{{item.productCategoryName ? 'text-black' : 'text-gray'}}">{{item.productCategoryName || '请选择废纸品类'}}</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="settleUnitPrice" data-index="{{index}}" type="digit" placeholder-style="color:#aaa" style="text-align: right"
maxlength="8" placeholder="请输入结算单价" value="{{item.settleUnitPrice || ''}}" bindinput="bindInput" />
</view>
</van-cell>
<van-cell>
<view slot="title" class="flex flex-justify">
<view class="text-black">净重(公斤)</view>
<view class="{{item.netWeight ? 'text-black' : 'text-gray'}}">{{item.netWeight || ''}}</view>
</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="{{ !item.sign || item.sign == 1 }}" icon-size="32rpx"></van-checkbox>
<text style="margin-left:8rpx">扣重(公斤)</text>
</view>
<input id="deductWeight" type="digit" disabled="{{item.sign == 2}}" focus="{{focus == 1}}"
placeholder-style="color:#aaa" style="text-align: right" maxlength="10" placeholder="请输入扣重重量"
value="{{item.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="{{ item.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="{{item.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="{{item.settleWeight ? 'text-black' : 'text-gray'}}">{{ item.settleWeight || item.netWeight }}</view>
</view>
</van-cell>
<van-cell>
<view slot="title" class="flex flex-justify">
<view class="text-black">结算金额(元)</view>
<view class="{{item.settlePrice ? 'text-black' : 'text-gray'}}">{{ item.settlePrice || '- -' }}</view>
</view>
</van-cell>
<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>

23
pages/process/outside-check-item/index.wxss

@ -0,0 +1,23 @@
/* pages/mall/shops/index.wxss */
.item-content {
background: rgba(255, 255, 255, 1);
padding: 32rpx;
}
.item-cate {
flex: 5;
padding: 10rpx 30rpx;
border-radius: 10rpx;
border: 1rpx solid #f3f3f3;
background-color: #f3f3f3;
}
.cate-tag {
background-color: #e6f7ff;
border: 1rpx solid #1890ff;
}
.transform {
transform-origin: 50% 50%;
transform: rotate(180deg);
}

130
pages/process/outside-check/index.js

@ -1,6 +1,6 @@
// pages/process/order-check/index.js // pages/process/order-check/index.js
import Scene from '../../index/scene' import Scene from '../../index/scene'
import { checkingOrder, getPaperList, getSideOrderInfo} from "../../../api/saas"
import { repeatSideOrder, getPaperList, getSideOrderInfo} from "../../../api/saas"
const event = require('../../../utils/event') const event = require('../../../utils/event')
const util = require('../../../utils/util') const util = require('../../../utils/util')
const math = require('../../../utils/math') const math = require('../../../utils/math')
@ -13,14 +13,8 @@ Scene({
data: { data: {
safeBottom: app.globalData.safeBottom, safeBottom: app.globalData.safeBottom,
paperList: null, paperList: null,
form: {
orderPapers: [{ productId: '', productName: '', unitPrice: ''}],
appointDate: null
},
columns: [],
focus: 0,
visible: false,
amout: 20
form: null,
columns: []
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
@ -34,7 +28,7 @@ Scene({
for (let index = 0; index < this.data.paperList.length; index++) { for (let index = 0; index < this.data.paperList.length; index++) {
this.data.columns.push(this.data.paperList[index].name) this.data.columns.push(this.data.paperList[index].name)
} }
this.setData({ safeBottom: app.globalData.safeBottom, columns: this.data.columns })
this.setData({ safeBottom: app.globalData.safeBottom, columns: this.data.columns, paperList: this.data.paperList })
}).catch(err => { }).catch(err => {
this.setData({ safeBottom: app.globalData.safeBottom }) this.setData({ safeBottom: app.globalData.safeBottom })
util.showToast(err) util.showToast(err)
@ -53,116 +47,36 @@ Scene({
}) })
} }
}, },
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) })
onProductChange: function({detail}){
this.data.form.productCategoryInfos[detail.index] = detail.item
var estimatedAmount = 0
for (let index = 0; index < this.data.form.productCategoryInfos.length; index++) {
const element = this.data.form.productCategoryInfos[index]
if(!util.isEmpty(element.settlePrice) && Number(element.settlePrice) > 0){
estimatedAmount = math.plus(estimatedAmount, element.settlePrice)
} }
} }
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 })
this.setData({ ['form.settleTotalAmount']: estimatedAmount.toFixed(2) })
}, },
checkOrder: function(){ 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 + '元/公斤')
var weightNoteList = []
for (let index = 0; index < this.data.form.productCategoryInfos.length; index++) {
const element = this.data.form.productCategoryInfos[index]
if(util.isEmpty(element.settleUnitPrice) || Number(element.settleUnitPrice) <= 0){
util.showToast('请输入第' + (index + 1) + '项废纸品类结算单价')
return return
} }
var item = {grossWeight: element.grossWeight, tareWeight: element.tareWeight,weightNoteImage: element.weightNoteImage }
item.scrapPaperPurchaseOrderId = element.scrapPaperPurchaseOrderId
weightNoteList.push(item)
} }
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({ id: this.data.form.id, editOrderPriceDto: data }).then(result => {
repeatSideOrder({ id: this.data.form.id, editOrderPriceDto: data }).then(result => {
wx.hideLoading() wx.hideLoading()
event.emit('OrderMessage', { what: 12, desc: 'checkingOrder' })
event.emit('OrderMessage', { what: 12, desc: 'repeatSideOrder' })
util.showBackToast('订单审核已通过') util.showBackToast('订单审核已通过')
}).catch(err => { }).catch(err => {
wx.hideLoading() wx.hideLoading()
util.showToast(err) 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 })
}
} }
}) })

6
pages/process/outside-check/index.json

@ -3,11 +3,7 @@
"van-index-anchor": "/components/index-anchor/index", "van-index-anchor": "/components/index-anchor/index",
"van-cell": "/components/cell/index", "van-cell": "/components/cell/index",
"van-button": "/components/button/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",
"outside-check-item": "/pages/process/outside-check-item/index",
"submit-layout": "/components/submit-layout/index", "submit-layout": "/components/submit-layout/index",
"notification": "/pages/message/notification/index" "notification": "/pages/message/notification/index"
} }

72
pages/process/outside-check/index.wxml

@ -23,80 +23,18 @@
<view class="{{form.driverName ? 'text-black' : 'text-gray'}}">{{form.driverName || '请选择司机'}}</view> <view class="{{form.driverName ? 'text-black' : 'text-gray'}}">{{form.driverName || '请选择司机'}}</view>
</view> </view>
</van-cell> </van-cell>
<van-index-anchor index="定价信息" />
<view wx:for="{{form.orderPapers}}" wx:key="index">
<van-cell clickable center is-link data-index="{{index}}" 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>废纸品类{{index + 1}}</text>
</view>
<view class="{{item.productName ? 'text-black' : 'text-gray'}}">{{item.productName || '请选择废纸品类'}}</view>
</view>
</van-cell>
<van-cell center>
<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 data-index="{{index}}" type="digit" placeholder-style="color:#aaa" style="text-align: right" maxlength="8"
placeholder="请输入单价" value="{{item.unitPrice || ''}}" bindinput="bindInput" />
</view>
</van-cell>
<van-cell>
<view slot="title" class="flex flex-justify">
<view class="text-black">净重(公斤)</view>
<view class="{{item.netWeight ? 'text-black' : 'text-gray'}}">{{item.netWeight || ''}}</view>
</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="{{ item.sign == 1 }}" icon-size="32rpx"></van-checkbox>
<text style="margin-left:8rpx">扣重(公斤)</text>
</view>
<input id="deductWeight" type="digit" disabled="{{item.sign == 2}}" focus="{{focus == 1}}"
placeholder-style="color:#aaa" style="text-align: right" maxlength="10" placeholder="请输入扣重重量"
value="{{item.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="{{ item.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>
<van-cell>
<view slot="title" class="flex flex-justify">
<view class="text-black">结算金额(元)</view>
<view class="text-gray">{{form.settleWeight || '- -'}}</view>
</view>
</van-cell>
<van-index-anchor index="纸品信息" />
<view wx:for="{{form.productCategoryInfos}}" wx:key="index">
<outside-check-item form="{{form}}" item="{{item}}" index="{{index}}" list="{{paperList}}" columns="{{columns}}" bind:change="onProductChange"/>
</view> </view>
</view> </view>
<submit-layout wx:if="{{form}}"> <submit-layout wx:if="{{form}}">
<view class="flex flex-center" style="flex:1;justify-content: flex-start"> <view class="flex flex-center" style="flex:1;justify-content: flex-start">
<text class="text-lg" wx:if="{{amout}}">金额:</text>
<text class="text-xxl text-price text-red" wx:if="{{amout}}">{{amout}}</text>
<text class="text-lg" wx:if="{{form.settleTotalAmount}}">金额:</text>
<text class="text-xxl text-price text-red" wx:if="{{form.settleTotalAmount}}">{{form.settleTotalAmount}}</text>
</view> </view>
<van-button type="info" custom-style="height:88rpx;width:300rpx" bind:click="checkOrder">通过审核</van-button> <van-button type="info" custom-style="height:88rpx;width:300rpx" bind:click="checkOrder">通过审核</van-button>
</submit-layout> </submit-layout>
<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"/> <notification id="qn-notification"/>

10
pages/process/outside-item/index.js

@ -23,10 +23,10 @@ Component({
}, },
methods: { methods: {
setValues: function(value){ setValues: function(value){
if(value && value.weightNoteImage){
if(value && value.weightNoteImages){
this.data.fileList = [] this.data.fileList = []
for (let index = 0; index < value.weightNoteImage.length; index++) {
this.data.fileList.push({url: value.weightNoteImage[index]})
for (let index = 0; index < value.weightNoteImages.length; index++) {
this.data.fileList.push({url: value.weightNoteImages[index]})
} }
this.setData({fileList: this.data.fileList}) this.setData({fileList: this.data.fileList})
} }
@ -54,7 +54,7 @@ Component({
this.data.item.deductWeight = null this.data.item.deductWeight = null
this.data.item.deductPercent = null this.data.item.deductPercent = null
} else { } else {
this.data.item.deductWeight = math.divide(math.times(this.data.item.totalWeight, Number(e.detail.value)), 100).toFixed(2)
this.data.item.deductWeight = math.divide(math.times(this.data.item.netWeight, Number(e.detail.value)), 100).toFixed(2)
} }
this.statAmount() this.statAmount()
} else if(e.currentTarget.id == 'deductWeight'){ } else if(e.currentTarget.id == 'deductWeight'){
@ -62,7 +62,7 @@ Component({
this.data.item.deductWeight = null this.data.item.deductWeight = null
this.data.item.deductPercent = null this.data.item.deductPercent = null
} else { } else {
this.data.item.deductPercent = math.times(math.divide(Number(e.detail.value), this.data.item.totalWeight), 100).toFixed(2)
this.data.item.deductPercent = math.times(math.divide(Number(e.detail.value), this.data.item.netWeight), 100).toFixed(2)
} }
this.statAmount() this.statAmount()
} else if(e.currentTarget.id == 'settleUnitPrice'){ } else if(e.currentTarget.id == 'settleUnitPrice'){

7
pages/process/outside-item/index.wxml

@ -1,4 +1,5 @@
<!--pages/message/index.wxml--> <!--pages/message/index.wxml-->
<view style="height:16rpx" wx:if="{{index != 0 }}"></view>
<van-cell clickable center> <van-cell clickable center>
<view slot="title" class="flex flex-justify"> <view slot="title" class="flex flex-justify">
<view class="text-black">废纸品类{{index + 1}}</view> <view class="text-black">废纸品类{{index + 1}}</view>
@ -51,7 +52,7 @@
</view> </view>
<text class="text-gray">3-6张,每图片大小限制5M</text> <text class="text-gray">3-6张,每图片大小限制5M</text>
</view> </view>
<van-uploader file-list="{{ item.fileList }}" multiple max-count="6" deletable="{{status == 0}}" show-upload="{{status == 0}}"
<van-uploader file-list="{{ fileList }}" multiple max-count="6" deletable="{{status == 0}}" show-upload="{{status == 0}}"
max-size="{{1024 * 1024 * 5}}" bind:file-change="fileChange" /> max-size="{{1024 * 1024 * 5}}" bind:file-change="fileChange" />
</view> </view>
<van-cell wx:if="{{status == 1}}"> <van-cell wx:if="{{status == 1}}">
@ -89,12 +90,12 @@
<van-cell wx:if="{{status == 1}}"> <van-cell wx:if="{{status == 1}}">
<view slot="title" class="flex flex-justify"> <view slot="title" class="flex flex-justify">
<view class="text-black">结算重量(公斤)</view> <view class="text-black">结算重量(公斤)</view>
<view class="text-gray">{{form.settleWeight || '- -'}}</view>
<view class="{{item.settleWeight ? 'text-black' : 'text-gray'}}">{{ item.settleWeight || item.netWeight }}</view>
</view> </view>
</van-cell> </van-cell>
<van-cell wx:if="{{status == 1}}"> <van-cell wx:if="{{status == 1}}">
<view slot="title" class="flex flex-justify"> <view slot="title" class="flex flex-justify">
<view class="text-black">结算金额(元)</view> <view class="text-black">结算金额(元)</view>
<view class="text-gray">{{form.settlePrice || '- -'}}</view>
<view class="{{item.settlePrice ? 'text-black' : 'text-gray'}}">{{ item.settlePrice || '- -' }}</view>
</view> </view>
</van-cell> </van-cell>

7
pages/process/outside-list/index.js

@ -56,7 +56,12 @@ Scene({
} }
} }
event.on('OrderMessage', this, this.onEvent) event.on('OrderMessage', this, this.onEvent)
this.setData({ height: app.globalData.fragmentHeight - 90, title: this.data.title, tabIndex: this.data.tabIndex })
this.setData({
height: app.globalData.fragmentHeight - 90,
title: this.data.title,
tabIndex: this.data.tabIndex,
admin: app.userInfo.type && app.userInfo.type.indexOf('ADMIN') >= 0
})
this.fetchOrderList() this.fetchOrderList()
}, },
onEvent: function(message){ onEvent: function(message){

2
pages/process/outside-list/index.wxml

@ -52,7 +52,7 @@
</van-divider> </van-divider>
</refresh-view> </refresh-view>
<view style="border-radius: 50rpx;position: fixed;bottom:160rpx;right:50rpx">
<view style="border-radius: 50rpx;position: fixed;bottom:160rpx;right:50rpx" wx:if="{{admin}}">
<van-button round type="info" icon="plus" bind:click="addOutside" custom-style="width: 100rpx;height: 100rpx;"></van-button> <van-button round type="info" icon="plus" bind:click="addOutside" custom-style="width: 100rpx;height: 100rpx;"></van-button>
</view> </view>

58
pages/process/outside-price/index.js

@ -1,7 +1,7 @@
// pages/process/order-check/index.js // pages/process/order-check/index.js
import Scene from '../../index/scene' import Scene from '../../index/scene'
import Dialog from '../../../components/dialog/dialog' import Dialog from '../../../components/dialog/dialog'
import { poundSideOrder, getSideOrderInfo} from "../../../api/saas"
import { poundSideOrder, getSideOrderInfo, saveSideOrder, priceSideOrder } from "../../../api/saas"
const event = require('../../../utils/event') const event = require('../../../utils/event')
const util = require('../../../utils/util') const util = require('../../../utils/util')
const math = require('../../../utils/math') const math = require('../../../utils/math')
@ -43,18 +43,31 @@ Scene({
}, },
onProductChange: function({detail}){ onProductChange: function({detail}){
this.data.form.productCategoryInfos[detail.index] = detail.item this.data.form.productCategoryInfos[detail.index] = detail.item
var netWeight = 0
var totalNetWeight = 0
var estimatedAmount = 0 var estimatedAmount = 0
for (let index = 0; index < this.data.form.productCategoryInfos.length; index++) { for (let index = 0; index < this.data.form.productCategoryInfos.length; index++) {
const element = this.data.form.productCategoryInfos[index] const element = this.data.form.productCategoryInfos[index]
if(!util.isEmpty(element.netWeight) && Number(element.netWeight) > 0){
netWeight = math.plus(netWeight, element.netWeight)
}
if(!util.isEmpty(element.estimatedAmount) && Number(element.estimatedAmount) > 0){
estimatedAmount = math.plus(estimatedAmount, element.estimatedAmount)
if(this.data.form.orderStatus == 0){
if(!util.isEmpty(element.netWeight) && Number(element.netWeight) > 0){
totalNetWeight = math.plus(totalNetWeight, element.netWeight)
}
if(!util.isEmpty(element.estimatedAmount) && Number(element.estimatedAmount) > 0){
estimatedAmount = math.plus(estimatedAmount, element.estimatedAmount)
}
} else {
if(!util.isEmpty(element.settleWeight) && Number(element.settleWeight) > 0){
totalNetWeight = math.plus(totalNetWeight, element.settleWeight)
}
if(!util.isEmpty(element.settlePrice) && Number(element.settlePrice) > 0){
estimatedAmount = math.plus(estimatedAmount, element.settlePrice)
}
} }
} }
this.setData({ ['form.netWeight']: netWeight, ['form.estimatedAmount']: estimatedAmount.toFixed(2) })
if(this.data.form.orderStatus == 0){
this.setData({ ['form.totalNetWeight']: totalNetWeight, ['form.estimatedAmount']: estimatedAmount.toFixed(2) })
} else {
this.setData({ ['form.settleTotalWeight']: totalNetWeight, ['form.settleTotalAmount']: estimatedAmount.toFixed(2) })
}
}, },
bindInput: function (e) { bindInput: function (e) {
this.data.param[e.currentTarget.id] = e.detail.value this.data.param[e.currentTarget.id] = e.detail.value
@ -85,10 +98,10 @@ Scene({
} }
this.data.param.weightNoteList = weightNoteList this.data.param.weightNoteList = weightNoteList
wx.showLoading({ title: '处理中', mask: true }) wx.showLoading({ title: '处理中', mask: true })
poundSideOrder(this.data.param).then(result => {
saveSideOrder(this.data.param).then(result => {
wx.hideLoading() wx.hideLoading()
util.showBackToast('保存成功')
event.emit('OrderMessage', { what: 12, desc: 'pricingOrder' })
util.showToast('保存成功')
// event.emit('OrderMessage', { what: 12, desc: 'saveSideOrder' })
}).catch(err => { }).catch(err => {
wx.hideLoading() wx.hideLoading()
util.showToast(err) util.showToast(err)
@ -138,7 +151,28 @@ Scene({
wx.redirectTo({url: `/pages/process/outside-check/index?id=${this.data.id}` }) wx.redirectTo({url: `/pages/process/outside-check/index?id=${this.data.id}` })
}, },
priceForm: function(){ priceForm: function(){
var productCategorySettleInfoDtoList = []
for (let index = 0; index < this.data.form.productCategoryInfos.length; index++) {
const element = this.data.form.productCategoryInfos[index]
if(util.isEmpty(element.settleUnitPrice) || Number(element.settleUnitPrice) <= 0){
util.showToast('请输入第' + (index + 1) + '项废纸品类结算单价')
return
}
var item = {deductWeight: element.deductWeight, deductPercent: element.deductPercent,productId: element.productId }
item.settleUnitPrice = element.settleUnitPrice
productCategorySettleInfoDtoList.push(item)
}
var data = {scrapPaperReceiptId: this.data.form.scrapPaperReceiptId }
data.productCategorySettleInfoDtoList = productCategorySettleInfoDtoList
wx.showLoading({ title: '处理中', mask: true })
priceSideOrder(data).then(result => {
wx.hideLoading()
util.showBackToast('定价成功')
event.emit('OrderMessage', { what: 12, desc: 'pricingOrder' })
}).catch(err => {
wx.hideLoading()
util.showToast(err)
})
}, },
checkForm: function(){ checkForm: function(){

60
pages/process/outside-price/index.wxml

@ -4,6 +4,29 @@
</cu-custom> </cu-custom>
<view wx:if="{{form}}"> <view wx:if="{{form}}">
<view class="flex flex-justify info_status" wx:if="{{form.orderStatus == 0}}">
<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="eidtForm">修改订单</view>
</view>
<view class="flex flex-center info_status" style="justify-content: flex-start;" wx:elif="{{form.orderStatus == 4}}">
<image style="height:42rpx;width:42rpx" src="/assets/image/icon_payfor.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.orderStatus == 41}}">
<image style="height:42rpx;width:42rpx" src="/assets/image/icon_payfor.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.orderStatus == 42}}">
<image style="height:42rpx;width:42rpx" src="/assets/image/icon_payfor.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.orderStatus == 5}}">
<image style="height:42rpx;width:42rpx" src="/assets/image/icon_payfor.png"></image>
<view class="text-white text-sg" style="margin-left:12rpx">已完成</view>
</view>
<van-index-anchor index="订单信息" /> <van-index-anchor index="订单信息" />
<van-cell clickable center> <van-cell clickable center>
<view slot="title" class="flex flex-justify"> <view slot="title" class="flex flex-justify">
@ -44,46 +67,57 @@
<outside-item item="{{item}}" index="{{index}}" status="{{form.orderStatus}}" bind:change="onProductChange"></outside-item> <outside-item item="{{item}}" index="{{index}}" status="{{form.orderStatus}}" bind:change="onProductChange"></outside-item>
</view> </view>
<van-index-anchor index="汇总信息" /> <van-index-anchor index="汇总信息" />
<van-cell clickable center>
<van-cell clickable center wx:if="{{form.orderStatus > 0}}">
<view slot="title" class="flex flex-justify">
<view class="text-black">结算总重量(公斤)</view>
<view class="{{form.settleTotalWeight ? 'text-black' : 'text-gray'}}">{{form.settleTotalWeight || '- -'}}</view>
</view>
</van-cell>
<van-cell clickable center wx:else>
<view slot="title" class="flex flex-justify"> <view slot="title" class="flex flex-justify">
<view class="text-black">总净重(公斤)</view> <view class="text-black">总净重(公斤)</view>
<view class="{{form.netWeight ? 'text-black' : 'text-gray'}}">{{form.netWeight || ''}}</view>
<view class="{{form.totalNetWeight ? 'text-black' : 'text-gray'}}">{{form.totalNetWeight || '- -'}}</view>
</view> </view>
</van-cell> </van-cell>
<van-cell clickable center>
<van-cell clickable center wx:if="{{form.orderStatus > 0}}">
<view slot="title" class="flex flex-justify">
<view class="text-black">结算总金额(元)</view>
<view class="{{form.settleTotalAmount ? 'text-black' : 'text-gray'}}">{{form.settleTotalAmount || '- -'}}</view>
</view>
</van-cell>
<van-cell clickable center wx:else>
<view slot="title" class="flex flex-justify"> <view slot="title" class="flex flex-justify">
<view class="text-black">预计总金额(元)</view> <view class="text-black">预计总金额(元)</view>
<view class="{{form.estimatedAmount ? 'text-black' : 'text-gray'}}">{{form.estimatedAmount || ''}}</view>
<view class="{{form.estimatedAmount ? 'text-black' : 'text-gray'}}">{{form.estimatedAmount || '- -'}}</view>
</view> </view>
</van-cell> </van-cell>
<van-cell> <van-cell>
<view slot="title" class="flex flex-justify"> <view slot="title" class="flex flex-justify">
<view class="flex flex-center text-black"> <view class="flex flex-center text-black">
<view class="text-red text-xl" style="line-height: 10px; padding-top: 8px">*</view>
<view class="text-red text-xl" style="line-height: 10px; padding-top: 8px" wx:if="{{ form.orderStatus == 0}}">*</view>
<text>厂外皮重(公斤)</text> <text>厂外皮重(公斤)</text>
</view> </view>
<input id="offsiteTareWeight" type="digit" placeholder-style="color:#aaa" <input id="offsiteTareWeight" type="digit" placeholder-style="color:#aaa"
style="text-align: right" maxlength="8" placeholder="请输入厂外皮重" value="{{form.offsiteTareWeight || ''}}" style="text-align: right" maxlength="8" placeholder="请输入厂外皮重" value="{{form.offsiteTareWeight || ''}}"
bindinput="bindInput" />
bindinput="bindInput" disabled="{{ form.orderStatus != 0}}" />
</view> </view>
</van-cell> </van-cell>
<van-cell> <van-cell>
<view slot="title" class="flex flex-justify"> <view slot="title" class="flex flex-justify">
<view class="flex flex-center text-black"> <view class="flex flex-center text-black">
<view class="text-red text-xl" style="line-height: 10px; padding-top: 8px">*</view>
<view class="text-red text-xl" style="line-height: 10px; padding-top: 8px" wx:if="{{ form.orderStatus == 0}}">*</view>
<text>厂外毛重(公斤)</text> <text>厂外毛重(公斤)</text>
</view> </view>
<input id="offsiteGrossWeight" type="digit" placeholder-style="color:#aaa" <input id="offsiteGrossWeight" type="digit" placeholder-style="color:#aaa"
style="text-align: right" maxlength="8" placeholder="请输入厂外毛重" value="{{form.offsiteGrossWeight || ''}}" style="text-align: right" maxlength="8" placeholder="请输入厂外毛重" value="{{form.offsiteGrossWeight || ''}}"
bindinput="bindInput" />
bindinput="bindInput" disabled="{{ form.orderStatus != 0}}"/>
</view> </view>
</van-cell> </van-cell>
</view> </view>
<submit-layout wx:if="{{admin && form && form.orderStatus == 0}}"> <submit-layout wx:if="{{admin && form && form.orderStatus == 0}}">
<van-button plain type="default" custom-style="height:88rpx;width:120rpx" bind:click="cancelForm">取消</van-button>
<van-button type="info" custom-style="margin-left:32rpx;height:88rpx;width:175rpx;padding-left:0;padding-right:0;" bind:click="eidtForm">修改订单</van-button>
<van-button type="info" custom-style="margin-left:32rpx;height:88rpx;width:120rpx" bind:click="saveForm">保存</van-button>
<van-button type="info" custom-style="margin-left:32rpx;height:88rpx;width:175rpx;padding-left:0;padding-right:0;" bind:click="submitForm">提交订单</van-button>
<van-button plain type="default" custom-style="height:88rpx;width:186rpx" bind:click="cancelForm">取消</van-button>
<van-button type="info" custom-style="margin-left:32rpx;height:88rpx;width:218rpx" bind:click="saveForm">保存</van-button>
<van-button type="info" custom-style="margin-left:32rpx;height:88rpx;width:218rpx;" bind:click="submitForm">提交订单</van-button>
</submit-layout> </submit-layout>
<submit-layout wx:elif="{{form && form.orderStatus == 0}}"> <submit-layout wx:elif="{{form && form.orderStatus == 0}}">
<van-button plain type="default" custom-style="height:88rpx;width:254rpx" bind:click="saveForm">保存</van-button> <van-button plain type="default" custom-style="height:88rpx;width:254rpx" bind:click="saveForm">保存</van-button>
@ -91,7 +125,7 @@
</submit-layout> </submit-layout>
<submit-layout wx:if="{{admin && form && form.orderStatus == 1}}"> <submit-layout wx:if="{{admin && form && form.orderStatus == 1}}">
<van-button plain type="default" custom-style="height:88rpx;width:254rpx" bind:click="cancelForm">取消</van-button> <van-button plain type="default" custom-style="height:88rpx;width:254rpx" bind:click="cancelForm">取消</van-button>
<van-button type="info" custom-style="margin-left:32rpx;height:88rpx;width:400rpx" bind:click="priceForm">确认</van-button>
<van-button type="info" custom-style="margin-left:32rpx;height:88rpx;width:400rpx" bind:click="priceForm">确认定价</van-button>
</submit-layout> </submit-layout>
<submit-layout wx:if="{{admin && form && form.orderStatus == 3}}"> <submit-layout wx:if="{{admin && form && form.orderStatus == 3}}">
<van-button plain type="default" custom-style="height:88rpx;width:254rpx" bind:click="repeatForm">重新定价</van-button> <van-button plain type="default" custom-style="height:88rpx;width:254rpx" bind:click="repeatForm">重新定价</van-button>

23
pages/process/outside-price/index.wxss

@ -1,21 +1,6 @@
/* pages/process/order-check/index.wxss */ /* pages/process/order-check/index.wxss */
.cate-list {
margin: 24rpx 30rpx;
border: 1rpx solid #dcdcdc;
}
.cate-header {
min-height: 76rpx;
background-color: #dcdcdc;
padding: 0rpx 30rpx;
}
.cate-index {
width: 32rpx;
height: 32rpx;
line-height: 32rpx;
text-align: center;
border-radius: 5000rpx;
border: 1px solid #666666;
margin-left: 12rpx
.info_status{
background-image: linear-gradient(90deg, #FF4D2E 6%, #FF952F 100%);
height:90rpx;
padding: 0rpx 32rpx;
} }
Loading…
Cancel
Save