纸通宝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.
 

61 lines
1.9 KiB

// pages/storage/index/index.js
import Scene from '../../index/scene'
import Dialog from '../../../components/dialog/dialog'
import { getOutOrderInfo, auditOutOrder } from "../../../api/saas"
const util = require('../../../utils/util')
const event = require('../../../utils/event')
const app = getApp()
Scene({
/**
* 页面的初始数据
*/
data: {
safeBottom: app.globalData.safeBottom,
form: null,
activeNames: [],
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
if(options.id){
wx.showLoading({ title: '正在获取', mask: true })
getOutOrderInfo(options.id).then(result => {
wx.hideLoading()
this.setData({ safeBottom: app.globalData.safeBottom, form: result.data })
}).catch(err => {
wx.hideLoading()
util.showToast(err)
})
}
},
onChange: function({detail}) {
this.setData({ activeNames: detail })
},
submitForm: function(e){
if(e.currentTarget.id == 'refuse'){
Dialog.confirm({ title: '温馨提示', message: '确定此出货单有问题,进行驳回?' }).then(() => {
wx.showLoading({ title: '正在处理', mask: true })
auditOutOrder({id: this.data.form.id, auditStatus: 0 }).then(result => {
wx.hideLoading()
util.showBackToast('出货单已经驳回')
event.emit('OrderMessage', { what: 21, desc: 'cancelOrder' })
}).catch(err => {
wx.hideLoading()
util.showToast(err)
})
})
} else {
wx.showLoading({ title: '正在处理', mask: true })
auditOutOrder({id: this.data.form.id, auditStatus: 1 }).then(result => {
wx.hideLoading()
util.showBackToast('出货单已经通过审核')
event.emit('OrderMessage', { what: 21, desc: 'cancelOrder' })
}).catch(err => {
wx.hideLoading()
util.showToast(err)
})
}
}
})