supplyOrder.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. const app = getApp()
  2. const util = require("../../utils/jmsUtil.js");
  3. const api = require('../../api/jms.js');
  4. import moment from 'moment'
  5. Page({
  6. data: {
  7. diffItem:[],
  8. diffOrder:{},
  9. bookno:'',
  10. showPicker:false,
  11. currentItem:'',
  12. supplyList:[{name:'',num:1},{name:'',num:1}],
  13. columns:['超时补差','携带大型设备'],
  14. },
  15. /**
  16. * 生命周期函数--监听页面加载
  17. */
  18. onLoad: function (options) {
  19. this.setData({
  20. diffItem:app.globalData.diffItem,
  21. diffOrder:app.globalData.diffOrder,
  22. });
  23. },
  24. getDiffOrderList(){
  25. wx.showLoading({
  26. title: '加载中...',
  27. });
  28. util.request(api.getDiffOrderList, {
  29. bookDetailId:this.data.bookno
  30. }, 'GET').then(res => {
  31. wx.hideLoading();
  32. if (res.errno === 0) {
  33. this.setData({
  34. });
  35. }
  36. }).catch(err => {
  37. wx.hideLoading();
  38. });
  39. },
  40. /**
  41. * 生命周期函数--监听页面初次渲染完成
  42. */
  43. onReady: function () {
  44. },
  45. goEdit(){
  46. wx.navigateBack();
  47. },
  48. minusNum(e){
  49. let index=e.currentTarget.dataset.index;
  50. let num=e.currentTarget.dataset.num;
  51. if(num<=1){
  52. wx.showToast({
  53. title: '数量不能再少了',
  54. icon: 'none',
  55. duration: 3000
  56. });
  57. return false;
  58. }else{
  59. let item='supplyList['+index+']'+'.num';
  60. this.setData({
  61. [item]:num-1,
  62. });
  63. }
  64. },
  65. addNum(e){
  66. let index=e.currentTarget.dataset.index;
  67. let num=e.currentTarget.dataset.num;
  68. let item='supplyList['+index+']'+'.num';
  69. this.setData({
  70. [item]:num+1,
  71. });
  72. },
  73. delItem(e){
  74. let index=e.currentTarget.dataset.index;
  75. let supplyList=this.data.supplyList;
  76. supplyList.splice(index, 1);
  77. this.setData({
  78. supplyList: supplyList
  79. });
  80. },
  81. addItem(){
  82. this.setData({
  83. supplyList: this.data.supplyList.concat({name:''}),
  84. })
  85. },
  86. pickerCancel(){
  87. this.setData({
  88. showPicker:false
  89. });
  90. },
  91. showTypePicker(e){
  92. let index=e.currentTarget.dataset.index;
  93. this.setData({
  94. currentItem:index,
  95. showPicker:true
  96. })
  97. },
  98. pickerConfirm(e){
  99. let value=e.detail.value;
  100. let index=e.detail.index;
  101. let item1='supplyList['+this.data.currentItem+']'+'.name';
  102. this.setData({
  103. [item1]:value,
  104. showPicker:false,
  105. });
  106. },
  107. previewImage: function () {
  108. wx.previewImage({
  109. current: this.data.diffOrder.qrUrl, // 当前显示图片的http链接
  110. urls: [this.data.diffOrder.qrUrl] // 需要预览的图片http链接列表
  111. })
  112. },
  113. /**
  114. * 生命周期函数--监听页面显示
  115. */
  116. onShow: function () {
  117. },
  118. onHide: function () {
  119. },
  120. onUnload: function () {
  121. },
  122. /**
  123. * 页面相关事件处理函数--监听用户下拉动作
  124. */
  125. onPullDownRefresh: function () {
  126. },
  127. /**
  128. * 页面上拉触底事件的处理函数
  129. */
  130. onReachBottom: function () {
  131. },
  132. /**
  133. * 用户点击右上角分享
  134. */
  135. onShareAppMessage: function () {
  136. },
  137. })