siteServiceFeedback.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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. remark: [{ required: true, message: '内容必填', trigger: 'blur' }],
  11. },
  12. // 新增/编辑
  13. create: {
  14. dialogStatus: '',
  15. temp: {
  16. payDate: '',
  17. remark: '',
  18. created: util.getToday(),
  19. id:"",
  20. },
  21. }
  22. },
  23. onLoad: function (options) {
  24. // 表单初始化
  25. wx.lin.initValidateForm(this)
  26. var id = options.id;
  27. this.setData({
  28. id:id,
  29. ['create.temp.id']:id
  30. })
  31. },
  32. //保存
  33. submit:function(e){
  34. var detail_value = e.detail.values
  35. var detail_errors = e.detail.errors
  36. var detail_errors = e.detail.errors
  37. console.log("detail_value",detail_value)
  38. console.log("create.temp",this.data.create.temp)
  39. const submit_data = Object.assign({}, this.data.create.temp, detail_value)
  40. console.log("保存发送:",submit_data)
  41. submit_data.createrId = app.globalData.g_createrId
  42. var send_data = {
  43. "name":"insertServiceFeedback",
  44. "page":1,"offset":1,
  45. "pagecount":1000,
  46. "returntype":"Map",
  47. "parammaps":{
  48. "serviceId":this.data.id,
  49. "createrId":app.globalData.g_createrId,
  50. "remark":submit_data.remark,
  51. }
  52. }
  53. console.log("send_data",JSON.stringify(send_data))
  54. //验证必填项是否为空
  55. if(submit_data.costStatus == ""){
  56. wx.showToast({title: '款项状态必填',icon: 'none',duration: 2000})
  57. } else {
  58. if( wx.getStorageSync('isLoading') == "true"){
  59. wx.showToast({
  60. title: '正在保存中,请稍等!',
  61. icon: 'none',
  62. duration: 2000
  63. })
  64. } else {
  65. util.postDataByName(send_data, this.getListSuccess)
  66. }
  67. }
  68. },
  69. getListSuccess: function (res) {
  70. console.log('table数据======>', res)
  71. if (res.msg !== 'fail') {
  72. wx.showToast({
  73. title: '保存成功',
  74. icon: 'success',
  75. duration: 2000,
  76. success: function(){
  77. setTimeout(() => {
  78. wx.redirectTo({ url:"../siteService/siteService"})
  79. }, 1500)
  80. }
  81. })
  82. } else {
  83. wx.showToast({
  84. title: '保存失败'+res.data,
  85. icon: 'error',
  86. duration: 2000,
  87. })
  88. }
  89. },
  90. onReady: function () {
  91. },
  92. onShow: function () {
  93. },
  94. onHide: function () {
  95. },
  96. onUnload: function () {
  97. },
  98. /**
  99. * 页面相关事件处理函数--监听用户下拉动作
  100. */
  101. onPullDownRefresh: function () {
  102. },
  103. /**
  104. * 页面上拉触底事件的处理函数
  105. */
  106. onReachBottom: function () {
  107. },
  108. onShareAppMessage: function () {
  109. }
  110. })