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.
90 lines
2.8 KiB
90 lines
2.8 KiB
// pages/process/order-check/index.js
|
|
import Dialog from '../../../components/dialog/dialog'
|
|
import { cancelOrder, getFactoryOrderInfo, checkingOrder} from "../../../api/saas"
|
|
const event = require('../../../utils/event')
|
|
const util = require('../../../utils/util')
|
|
const app = getApp()
|
|
|
|
Page({
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
safeBottom: app.globalData.safeBottom,
|
|
form: null
|
|
},
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
if(options.id){
|
|
wx.showLoading({ title: '正在获取', mask: true })
|
|
getFactoryOrderInfo(options.id).then(result => {
|
|
wx.hideLoading()
|
|
this.setData({ safeBottom: app.globalData.safeBottom, form: result.data })
|
|
}).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(){
|
|
|
|
},
|
|
bindInput: function (e) {
|
|
this.data.form[e.target.id] = e.detail.value
|
|
},
|
|
onChange: function({ detail }) {
|
|
// 需要手动对 checked 状态进行更新
|
|
this.setData({ ['form.isDefault']: detail ? 1 : 0 })
|
|
},
|
|
paddingOrder: function(){
|
|
this.setData({ ['form.checking']: !this.data.form.checking })
|
|
},
|
|
cancelOrder: function(e){
|
|
Dialog.confirm({ title: '温馨提示', message: '确定取消该订单?' }).then(() => {
|
|
wx.showLoading({ title: '正在获取', mask: true })
|
|
cancelOrder({ id: this.data.form.id }).then(result => {
|
|
wx.hideLoading()
|
|
util.showBackToast('订单已经删除')
|
|
event.emit('OrderMessage', { what: 12, desc: 'cancelOrder' })
|
|
}).catch(err => {
|
|
wx.hideLoading()
|
|
util.showToast(err)
|
|
})
|
|
})
|
|
},
|
|
checkOrder: function(){
|
|
wx.showLoading({ title: '正在获取', mask: true })
|
|
checkingOrder({ id: this.data.form.id }).then(result => {
|
|
wx.hideLoading()
|
|
util.showBackToast('订单审核已通过')
|
|
event.emit('OrderMessage', { what: 12, desc: 'checkingOrder' })
|
|
}).catch(err => {
|
|
wx.hideLoading()
|
|
util.showToast(err)
|
|
})
|
|
},
|
|
viewImage: function (e) {
|
|
var imgList = []
|
|
if(e.currentTarget.dataset.type == 0){
|
|
for (let index = 0; index < this.data.form.preWeighingPicture.length; index++) {
|
|
imgList.push(this.data.this.data.form.preWeighingPicture[index].url)
|
|
}
|
|
} else {
|
|
for (let index = 0; index < this.data.form.aftWeighingPicture.length; index++) {
|
|
imgList.push(this.data.this.data.form.aftWeighingPicture[index].url)
|
|
}
|
|
}
|
|
wx.previewImage({ urls: imgList, current: e.currentTarget.dataset.url })
|
|
}
|
|
})
|