const app = getApp() const util = require("../../../utils/jmsUtil.js"); const api = require('../../../api/jms.js'); import moment from 'moment' Page({ data: { diffItem:[], diffOrder:{}, bookno:'', showPicker:false, currentItem:'', supplyList:[{name:'',num:1},{name:'',num:1}], columns:['超时补差','携带大型设备'], }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { this.setData({ diffItem:app.globalData.diffItem, diffOrder:app.globalData.diffOrder, }); }, getDiffOrderList(){ wx.showLoading({ title: '加载中...', }); util.request(api.getDiffOrderList, { bookDetailId:this.data.bookno }, 'GET').then(res => { wx.hideLoading(); if (res.errno === 0) { this.setData({ }); } }).catch(err => { wx.hideLoading(); }); }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, goEdit(){ wx.navigateBack(); }, minusNum(e){ let index=e.currentTarget.dataset.index; let num=e.currentTarget.dataset.num; if(num<=1){ wx.showToast({ title: '数量不能再少了', icon: 'none', duration: 3000 }); return false; }else{ let item='supplyList['+index+']'+'.num'; this.setData({ [item]:num-1, }); } }, addNum(e){ let index=e.currentTarget.dataset.index; let num=e.currentTarget.dataset.num; let item='supplyList['+index+']'+'.num'; this.setData({ [item]:num+1, }); }, delItem(e){ let index=e.currentTarget.dataset.index; let supplyList=this.data.supplyList; supplyList.splice(index, 1); this.setData({ supplyList: supplyList }); }, addItem(){ this.setData({ supplyList: this.data.supplyList.concat({name:''}), }) }, pickerCancel(){ this.setData({ showPicker:false }); }, showTypePicker(e){ let index=e.currentTarget.dataset.index; this.setData({ currentItem:index, showPicker:true }) }, pickerConfirm(e){ let value=e.detail.value; let index=e.detail.index; let item1='supplyList['+this.data.currentItem+']'+'.name'; this.setData({ [item1]:value, showPicker:false, }); }, previewImage: function () { wx.previewImage({ current: this.data.diffOrder.qrUrl, // 当前显示图片的http链接 urls: [this.data.diffOrder.qrUrl] // 需要预览的图片http链接列表 }) }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, onHide: function () { }, onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { }, })