siteServiceRevoke.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. var util = require('../../../utils/util.js')
  2. const app = getApp();
  3. Page({
  4. data: {
  5. allDisabled:true,//有客户下拉时临时用来控制其他下拉不显示
  6. c_txt_Show:false,
  7. customerShow:false,
  8. id:"",
  9. rules: {
  10. revokeReason: [{ required: true, message: '反馈内容必填', trigger: 'blur' }],
  11. },
  12. // 新增/编辑
  13. create: {
  14. dialogStatus: '',
  15. temp: {
  16. revokeReason: '',
  17. created: util.getToday(),
  18. id:"",
  19. },
  20. }
  21. },
  22. onLoad: function (options) {
  23. // 表单初始化
  24. wx.lin.initValidateForm(this)
  25. var id = options.id;
  26. this.setData({
  27. id:id,
  28. ['create.temp.id']:id
  29. })
  30. },
  31. //保存
  32. submit:function(e){
  33. var detail_value = e.detail.values
  34. var detail_errors = e.detail.errors
  35. var detail_errors = e.detail.errors
  36. console.log("detail_value",detail_value)
  37. console.log("create.temp",this.data.create.temp)
  38. const submit_data = Object.assign({}, this.data.create.temp, detail_value)
  39. console.log("保存发送:",submit_data)
  40. var send_data = {
  41. "name":"revokeService",
  42. "parammaps":{
  43. "revokeReason":submit_data.revokeReason,
  44. "id":this.data.id
  45. }
  46. }
  47. console.log("send_data",JSON.stringify(send_data))
  48. //验证必填项是否为空
  49. if(submit_data.revokeReason == ""){
  50. wx.showToast({title: '撤销内容必填',icon: 'none',duration: 2000})
  51. } else {
  52. if( wx.getStorageSync('isLoading') == "true"){
  53. wx.showToast({
  54. title: '正在保存中,请稍等!',
  55. icon: 'none',
  56. duration: 2000
  57. })
  58. } else {
  59. util.postDataByName(send_data, this.getListSuccess)
  60. }
  61. }
  62. },
  63. getListSuccess: function (res) {
  64. console.log('table数据======>', res)
  65. if (res.msg !== 'fail') {
  66. wx.showToast({
  67. title: '保存成功',
  68. icon: 'success',
  69. duration: 2000,
  70. success: function(){
  71. setTimeout(() => {
  72. wx.redirectTo({ url:"../siteService/siteService"})
  73. }, 1500)
  74. }
  75. })
  76. } else {
  77. wx.showToast({
  78. title: '保存失败'+res.data,
  79. icon: 'error',
  80. duration: 2000,
  81. })
  82. }
  83. },
  84. onReady: function () {
  85. },
  86. onShow: function () {
  87. },
  88. onHide: function () {
  89. },
  90. onUnload: function () {
  91. },
  92. /**
  93. * 页面相关事件处理函数--监听用户下拉动作
  94. */
  95. onPullDownRefresh: function () {
  96. },
  97. /**
  98. * 页面上拉触底事件的处理函数
  99. */
  100. onReachBottom: function () {
  101. },
  102. onShareAppMessage: function () {
  103. }
  104. })