123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170 |
- const app = getApp()
- const util = require("../../../utils/jmsUtil.js");
- const api = require('../../../api/jms.js');
- import moment from 'moment'
- Page({
- data: {
- bookno:'',
- recordList:[],
- showPicker:false,
- currentItem:'',
- supplyList:[{name:'',num:1},{name:'',num:1}],
- columns:['超时补差','携带大型设备'],
- },
-
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- if(options.bookno){
- this.setData({
- bookno:options.bookno
- });
-
- }
- },
- goAddDiff(){
- app.globalData.diffId=0;
- wx.navigateTo({
- url: '/pages/temp/serviceSupply/serviceSupply?bookno='+this.data.bookno,
- });
- },
- getDiffOrderList(){
- wx.showLoading({
- title: '加载中...',
- });
- util.request(api.getDiffOrderList, {
- bookDetailId:this.data.bookno
-
- }, 'GET').then(res => {
- wx.hideLoading();
- if (res.errno === 0) {
- this.setData({
- recordList:res.data
- });
- }
- }).catch(err => {
- wx.hideLoading();
- });
- },
-
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- goDetail(e){
- let id=e.currentTarget.dataset.id
- wx.navigateTo({
- url: '/pages/temp/supplyDetail/supplyDetail?id='+id,
- })
- },
- 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,
- });
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- console.log('onShow')
- this.getDiffOrderList();
- },
-
- onHide: function () {
- },
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- },
- })
|