纸通宝SAAS仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

74 lines
2.4 KiB

// pages/process/order-check/index.js
import Scene from '../../index/scene'
import Dialog from '../../../components/dialog/dialog'
import { checkSideOrder, getSideOrderInfo, printOrder} from "../../../api/saas"
const event = require('../../../utils/event')
const util = require('../../../utils/util')
const app = getApp()
Scene({
/**
* 页面的初始数据
*/
data: {
id: null,
form: null
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
if(options.id){
this.data.id = options.id
wx.showLoading({ title: '正在获取', mask: true })
getSideOrderInfo({id: options.id}).then(result => {
wx.hideLoading()
for (let index = 0; index < result.data.productCategoryInfos.length; index++) {
const element = result.data.productCategoryInfos[index]
element.fileList = []
for (let k = 0; k < element.weightNoteImages.length; k++) {
element.fileList.push({url: element.weightNoteImages[k]})
}
}
this.setData({ form: result.data, admin: app.userInfo.type && app.userInfo.type.indexOf('ADMIN') >= 0 })
}).catch(err => {
wx.hideLoading()
util.showToast(err)
})
}
},
printOrder: function(){
wx.showLoading({ title: '正在获取', mask: true })
printOrder({id: this.data.id}).then(result => {
wx.hideLoading()
util.showToast('即将打印,请稍后')
}).catch(err => {
wx.hideLoading()
util.showToast(err)
})
},
checkForm: function(){
wx.redirectTo({url: `/pages/process/outside-check/index?id=${this.data.id}` })
},
submitForm: function(){
if(this.data.form.grossWeight) {
this.checkPass()
} else {
var message = '此订单没有厂内毛重数据,按照正常流程请刷卡过磅,获取厂内毛重数据,如果已经无法获取,请仔细查验纸品,确定没有问题后,进行审核。'
Dialog.confirm({ title: '温馨提示', message, confirmButtonText: '确定审核' }).then(() => {
this.checkPass()
})
}
},
checkPass: function(){
wx.showLoading({ title: '处理中', mask: true })
checkSideOrder(this.data.form).then(result => {
wx.hideLoading()
util.showBackToast('审核成功')
event.emit('OrderMessage', { what: 12, desc: 'pricingOrder' })
}).catch(err => {
wx.hideLoading()
util.showToast(err)
})
}
})