123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171 |
- const app = getApp()
- const util = require("../../../utils/jmsUtil.js");
- const api = require('../../../api/jms.js');
- import moment from 'moment'
- Page({
- data: {
- id:'',
- orderInfo:{
- state:'',
- },
- itemList:[],
- showPicker:false,
- currentItem:'',
- supplyList:[{name:'',num:1},{name:'',num:1}],
- columns:['超时补差','携带大型设备'],
- },
-
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- console.log(options);
- if(options.id){
- this.setData({
- id:options.id
- });
-
- }
- },
- getDiffOrderDetail(){
- wx.showLoading({
- title: '加载中...',
- });
- util.request(api.getDiffDetail, {
- diffOrderId:this.data.id
-
- }, 'GET').then(res => {
- wx.hideLoading();
- if (res.errno === 0) {
- this.setData({
- orderInfo:res.data,
- itemList:res.data.itemList
- });
- }
- }).catch(err => {
- wx.hideLoading();
- });
- },
-
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- goEdit(){
- app.globalData.diffId=this.data.id;
- wx.navigateTo({
- url: '/pages/temp/serviceSupply/serviceSupply?id='+this.data.id,
- });
- },
- 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.orderInfo.qrUrl, // 当前显示图片的http链接
- urls: [this.data.orderInfo.qrUrl] // 需要预览的图片http链接列表
- })
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- this.getDiffOrderDetail();
- },
-
- onHide: function () {
- },
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- },
- })
|