joinapply.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. var util = require('../../../../utils/util.js');
  2. var check = require('../../../../utils/check.js');
  3. var api = require('../../../../config/api.js');
  4. var app = getApp();
  5. Page({
  6. data: {
  7. content: '',
  8. contentLength: 0,
  9. mobile: '',
  10. code:'',
  11. applyName:'',
  12. join:{},
  13. applyType:'请选择',
  14. type:'',
  15. showPicker:false,
  16. applyNid:'',//申请人身份证
  17. columns:['小家政合伙人', '自营门店','阿姨小哥','大客户','公司BD','引荐人']
  18. },
  19. mobileInput: function(e) {
  20. this.setData({
  21. mobile: e.detail.value
  22. });
  23. },
  24. codeInput:function(e){
  25. this.setData({
  26. code: e.detail.value
  27. });
  28. },
  29. applyNameInput:function(e){
  30. this.setData({
  31. applyName: e.detail.value
  32. });
  33. },
  34. contentInput: function(e) {
  35. this.setData({
  36. contentLength: e.detail.cursor,
  37. content: e.detail.value,
  38. });
  39. },
  40. clearMobile: function(e) {
  41. this.setData({
  42. mobile: ''
  43. });
  44. },
  45. clearCode: function(e) {
  46. this.setData({
  47. code: ''
  48. });
  49. },
  50. getList(){
  51. let that = this;
  52. util.request(api.JoinApplyList, {
  53. page: that.data.content,
  54. limit: that.data.mobile
  55. }).then(function(res) {
  56. if (res.errno === 0) {
  57. console.log(res.data);
  58. that.setData({
  59. join: res.data
  60. });
  61. }
  62. });
  63. },
  64. showPicker(){
  65. this.setData({
  66. showPicker:true
  67. });
  68. },
  69. onCancel: function () {
  70. this.setData({
  71. showPicker: false,
  72. });
  73. },
  74. onConfirm: function (event) {
  75. this.setData({
  76. type: event.detail.index,
  77. applyType:event.detail.value,
  78. showPicker: false,
  79. });
  80. },
  81. submitFeedback: function(e) {
  82. if (!app.globalData.hasLogin) {
  83. wx.navigateTo({
  84. url: "/pages/auth/login/login"
  85. });
  86. }
  87. let that = this;
  88. if (that.data.content == '') {
  89. util.showErrorToast('请输入申请理由');
  90. return false;
  91. }
  92. if (that.data.applyType == '请选择') {
  93. util.showErrorToast('请选择申请人类型');
  94. return false;
  95. }
  96. if (that.data.mobile == '') {
  97. util.showErrorToast('请输入手机号码');
  98. return false;
  99. }
  100. if (that.data.applyName == '') {
  101. util.showErrorToast('请输入名称');
  102. return false;
  103. }
  104. if (!check.isValidPhone(this.data.mobile)) {
  105. // this.setData({
  106. // mobile: ''
  107. // });
  108. util.showErrorToast('请输入正确的手机号码');
  109. return false;
  110. }
  111. wx.showLoading({
  112. title: '提交中...',
  113. mask: true,
  114. success: function() {
  115. }
  116. });
  117. util.request(api.JoinApply, {
  118. mobile: that.data.mobile,
  119. content: that.data.content,
  120. code:that.data.code,
  121. type:that.data.type,
  122. applyName:that.data.applyName,
  123. applyNid:that.data.applyNid
  124. }, 'GET').then(function(res) {
  125. wx.hideLoading();
  126. if (res.errno === 0) {
  127. wx.showToast({
  128. title: '感谢您的申请!',
  129. icon: 'success',
  130. duration: 2000,
  131. complete: function() {
  132. that.setData({
  133. content: '',
  134. contentLength: 0,
  135. mobile: '',
  136. code:"",
  137. join:{applyTime:util.formatTime(new Date()),applyStatusText:'处理中',applyStatus:1}
  138. });
  139. }
  140. });
  141. } else {
  142. util.showErrorToast(res.errmsg);
  143. }
  144. });
  145. },
  146. onLoad: function(options) {
  147. },
  148. onReady: function() {
  149. },
  150. onShow: function() {
  151. this.getList();
  152. },
  153. onHide: function() {
  154. // 页面隐藏
  155. },
  156. onUnload: function() {
  157. // 页面关闭
  158. }
  159. })