三元财务UI

AddWorkolder.js 7.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. mui.init({
  2. swipeBack: false,
  3. })
  4. mui.init({
  5. statusBarBackground:"#FF0000"
  6. });
  7. mui.plusReady(function() {
  8. var wv = plus.webview.currentWebview();
  9. var usercode = localStorage.getItem("user"); //获取本地存储
  10. var files;
  11. var Str = '';
  12. var str_ary;
  13. var reg = /,$/gi;
  14. //提交按钮
  15. $('#submit').on('tap', function() {
  16. $(".image-box").each(function(i, n) {
  17. var a = $(n).attr("indexs");
  18. if(a) {
  19. Str += a + ',';
  20. }
  21. })
  22. str_ary = Str.substring(0, Str.length - 1);
  23. // alert(str_ary);
  24. var myreg = /^[1][3,4,5,7,8][0-9]{9}$/;
  25. // /^(([0\+]\d{2,3}-)?((0\d{2,3}))?(-)?)?(\d{7,8})(-(\d{3,}))?$/
  26. var myreg11 = /^(([0\+]\d{2,3}-)?((0\d{2,3}))?(-)?)?(\d{7,8})(-(\d{3,}))?$/;
  27. var stre = $("#phone").val();
  28. var stre2 = $("#conphone").val();
  29. var stre3 = $("#conphone").val() == '';
  30. if($('#name').val() == '') {
  31. mui.alert('请输入姓名!')
  32. } else if($('#phone').val() == '') {
  33. mui.alert('请输入投诉电话!')
  34. } else if(!myreg.test(stre)&&!myreg11.test(stre)) {
  35. mui.alert('手机号格式不正确!')
  36. }else if($('#conphone').val() == '') {
  37. mui.alert('请输入联系电话!')
  38. } else if(!myreg.test(stre2)&&!myreg11.test(stre2)) {
  39. mui.alert('手机号格式不正确!')
  40. } else if($('#title').val() == '') {
  41. mui.alert('请输入诉求主题!')
  42. } else if($('.content').val() == '') {
  43. mui.alert('请输入诉求内容!')
  44. } else if($('#zhuTiResult').val() == '') {
  45. mui.alert('请选择主题词!')
  46. } else {
  47. $.ajax({
  48. type: "post",
  49. dataType: 'json',
  50. url: huayi.config.callcenter_url + '/APP/AddWorkOrder',
  51. async: true,
  52. data: {
  53. type: $('#userResult').attr('data-index'), //诉求类型
  54. keys: $('#zhuTiResult').attr('data-index'), //关键词
  55. isprotect: $('input[name="secret"]:checked').val(), //(0普通1保密)
  56. level: $('input[name="jinji"]:checked').val(), //=(1普通2紧急)
  57. cussex: $('input[name="cussex"]:checked').val(), //=(1男2女)
  58. title: $('#title').val(), //投诉主题
  59. email: $("#email").val(),//邮箱
  60. zipcode: $("#zipcode").val(),//邮编
  61. content: $('.content').val(), //投诉内容
  62. cusname: $('#name').val(), //投诉人姓名
  63. cusphone: $('#phone').val(), //投诉人电话
  64. conphone: $("#conphone").val(),//联系电话
  65. sourcearea: $('#cityResult3').attr('data-index'), //事发地域id
  66. sourceaddress: $('#detail_address').val(), //详细地址
  67. //issubmit:1, //=(0保存1保存并提交)
  68. files: str_ary,
  69. usercode: usercode,
  70. },
  71. success: function(data) {
  72. if(data.state == "success") {
  73. mui.toast('投诉成功');
  74. $("#name").val('');
  75. $("#phone").val('');
  76. $("#conphone").val();
  77. $("#title").val('');
  78. $(".content").val('');
  79. $("#cityResult3").val('');
  80. $("#zhuTiResult").val('');
  81. $("#userResult").val('');
  82. $("#source").val('');
  83. $('#detail_address').val('');
  84. $("#email").val('');
  85. $("#zipcode").val('');
  86. $('input[name="secret"][value="0"]').prop("checked", "checked");
  87. $('input[name="jinji"][value="0"]').prop("checked", "checked");
  88. $('input[name="cussex"][value="0"]').prop("checked", "checked");
  89. window.location.reload();
  90. } else {
  91. mui.toast(data.message);
  92. }
  93. }
  94. });
  95. }
  96. })
  97. // $(".space").on("click", function() {
  98. // if($(".image-box").length == 6) {
  99. // $(".space").hide();
  100. // } else {
  101. // $(".space").show();
  102. // }
  103. // });
  104. // $(".image-close").on("click", function() {
  105. // alert("ddd")
  106. // if($(".image-box").length < 6) {
  107. // $(".space").show();
  108. // }
  109. // });
  110. //工单类型
  111. var typeList = [];
  112. $.ajax({
  113. type: "get",
  114. url: huayi.config.callcenter_url + 'Dictionary/GetDicValueListById?',
  115. async: false,
  116. data: {
  117. id: 2
  118. },
  119. dataType: 'json',
  120. success: function(data) {
  121. var type_data = data.data;
  122. $(type_data).each(function(i, n) {
  123. var obj = {};
  124. obj.value = n.F_ValueId;
  125. obj.text = n.F_Value;
  126. typeList.push(obj)
  127. })
  128. }
  129. });
  130. //事发地域
  131. var areaList = [];
  132. $.ajax({
  133. type: "get",
  134. url: huayi.config.callcenter_url + 'web/GetWebAreaList',
  135. async: false,
  136. data: {},
  137. dataType: 'json',
  138. success: function(data) {
  139. var area_data = data.data;
  140. // area_data = JSON.stringify(area_data);
  141. console.log(area_data);
  142. $(area_data).each(function(i, n) {
  143. var obj = {};
  144. obj.value = n.F_AreaId;
  145. obj.text = n.F_AreaName;
  146. areaList.push(obj)
  147. console.log(obj);
  148. })
  149. }
  150. });
  151. //主题词
  152. var keyList = [];
  153. $.ajax({
  154. type: "get",
  155. url: huayi.config.callcenter_url + 'Dictionary/GetDicValueListById?',
  156. async: false,
  157. data: {
  158. id: 3
  159. },
  160. dataType: 'json',
  161. success: function(data) {
  162. var key_data = data.data;
  163. $(key_data).each(function(i, n) {
  164. var obj = {};
  165. obj.value = n.F_ValueId;
  166. obj.text = n.F_Value;
  167. keyList.push(obj)
  168. })
  169. }
  170. });
  171. (function($, doc) {
  172. $.init();
  173. $.ready(function() {
  174. //诉求类型
  175. var userPicker = new $.PopPicker();
  176. userPicker.setData(typeList);
  177. var showUserPickerButton = doc.getElementById('showUserPicker');
  178. var userResult = doc.getElementById('userResult');
  179. showUserPickerButton.addEventListener('tap', function(event) {
  180. userPicker.show(function(items) {
  181. console.log(items)
  182. userResult.value = items[0].text;
  183. userResult.setAttribute("data-index", items[0].value);
  184. //返回 false 可以阻止选择框的关闭
  185. //return false;
  186. });
  187. }, false);
  188. //主题词
  189. var zhuTiPicker = new $.PopPicker();
  190. zhuTiPicker.setData(keyList);
  191. var showZhuTiPickerButton = doc.getElementById('showZhuTiPicker');
  192. var zhuTiResult = doc.getElementById('zhuTiResult');
  193. showZhuTiPickerButton.addEventListener('tap', function(event) {
  194. zhuTiPicker.show(function(items) {
  195. console.log(items)
  196. zhuTiResult.value = items[0].text;
  197. zhuTiResult.setAttribute("data-index", items[0].value);
  198. //返回 false 可以阻止选择框的关闭
  199. //return false;
  200. });
  201. }, false);
  202. //事件地址
  203. var cityPicker3 = new $.PopPicker();
  204. cityPicker3.setData(areaList);
  205. var showCityPickerButton = doc.getElementById('showCityPicker3');
  206. var cityResult3 = doc.getElementById('cityResult3');
  207. showCityPickerButton.addEventListener('tap', function(event) {
  208. cityPicker3.show(function(items) {
  209. cityResult3.value = items[0].text;
  210. cityResult3.setAttribute("data-index", items[0].value);
  211. //返回 false 可以阻止选择框的关闭
  212. //return false;
  213. });
  214. }, false);
  215. })
  216. })(mui, document);
  217. });