微信小程序
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.

136 line
2.4 KiB

  1. // pages/contract/list/add.js
  2. import * as UTIL from '../../../utils/util.js';
  3. import * as API from '../../../utils/API.js';
  4. let EVN_CONFIG = require('../../../env/env');
  5. const app = getApp();
  6. Page({
  7. /**
  8. * 页面的初始数据
  9. */
  10. data: {
  11. isIPX: app.globalData.isIPX,
  12. name:'',
  13. remark:''
  14. },
  15. onChange(event){
  16. console.log(event);
  17. this.setData({
  18. [event.currentTarget.dataset.formname]: event.detail,
  19. })
  20. },
  21. goKeep(){
  22. var that = this;
  23. if (that.data.name == '') {
  24. UTIL.showToastNoneIcon('请填写合同名称!');
  25. return;
  26. }
  27. wx.showLoading({
  28. title: '正在保存',
  29. mask:true
  30. })
  31. let data = {
  32. name:that.data.name,
  33. remark:that.data.remark,
  34. buildingTime:that.data.buildingTime,
  35. id:that.data.id,
  36. method:'POST'
  37. }
  38. UTIL.httpRequest(API.URL_GET_GETFILLEDIT, data, {
  39. success: (res) => {
  40. wx.showToast({
  41. title: "保存成功!",
  42. duration: 2000,
  43. icon:"success",
  44. mask:true
  45. })
  46. setTimeout(function(){
  47. wx.hideLoading();
  48. wx.navigateBack({
  49. delta:1
  50. })
  51. },2000)
  52. }
  53. })
  54. },
  55. bindDateChange: function(e) {
  56. console.log('picker发送选择改变,携带值为', e.detail.value)
  57. this.setData({
  58. [e.currentTarget.dataset.value]: e.detail.value
  59. })
  60. },
  61. back:function(){
  62. wx.navigateBack({
  63. delta: 1
  64. })
  65. },
  66. /**
  67. * 生命周期函数--监听页面加载
  68. */
  69. onLoad(options) {
  70. let data = {
  71. method:'GET'
  72. }
  73. var that = this;
  74. UTIL.httpRequest(API.URL_GET_GETFILLGET + options.id, data, {
  75. success: (res) => {
  76. that.setData({
  77. name: res.data.name,
  78. buildingTime: res.data.buildingTime,
  79. remark: res.data.remark,
  80. id:options.id
  81. })
  82. }
  83. })
  84. },
  85. /**
  86. * 生命周期函数--监听页面初次渲染完成
  87. */
  88. onReady() {
  89. },
  90. /**
  91. * 生命周期函数--监听页面显示
  92. */
  93. onShow() {
  94. },
  95. /**
  96. * 生命周期函数--监听页面隐藏
  97. */
  98. onHide() {
  99. },
  100. /**
  101. * 生命周期函数--监听页面卸载
  102. */
  103. onUnload() {
  104. },
  105. /**
  106. * 页面相关事件处理函数--监听用户下拉动作
  107. */
  108. onPullDownRefresh() {
  109. },
  110. /**
  111. * 页面上拉触底事件的处理函数
  112. */
  113. onReachBottom() {
  114. },
  115. /**
  116. * 用户点击右上角分享
  117. */
  118. onShareAppMessage() {
  119. }
  120. })