Açıklama Yok

Work-Add.js 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532
  1. mui.init({
  2. swipeBack: false,
  3. beforeback: function() {    
  4. var list = plus.webview.currentWebview().opener();    
  5. //refresh是A页面自定义事件
  6. mui.fire(list, 'refreshPer');
  7. //返回true,继续页面关闭逻辑
  8. return true;
  9. }
  10. })
  11. mui.plusReady(function() {
  12. var wv = plus.webview.currentWebview();
  13. var usercode = localStorage.getItem("user"); //获取本地存储
  14. var files;
  15. var Str = '';
  16. var str_ary;
  17. var reg = /,$/gi;
  18. //提交按钮
  19. $('#submit').on('tap', function() {
  20. $(".image-box").each(function(i, n) {
  21. var a = $(n).attr("indexs");
  22. if(a) {
  23. Str += a + ',';
  24. }
  25. })
  26. var addresText=$("#choworder_rengin").val()+'-'
  27. +$("#shouorder_shi").val()+'-'
  28. +$("#chouorder_xian").val()+'-'
  29. +$("#textarea").val();
  30. if($('#F_CusName').val() == '') {
  31. mui.alert('请输入姓名!')
  32. } else if($('#F_CusPhone').val() == '') {
  33. mui.alert('请输入联系电话!')
  34. } else if($('#F_QualityProblem').val() == '') {
  35. mui.alert('请输入质量问题!')
  36. } else {
  37. $.ajax({
  38. type: "post",
  39. dataType: 'json',
  40. url: huayi.config.callcenter_url + '/WorkorderApp/AddWorkOrder',
  41. async: true,
  42. data: {
  43. F_Type: $('#F_Type').attr('data-index'), //工单类型
  44. F_CusName: $('#F_CusName').val(), //姓名
  45. F_CusPhone: $('#F_CusPhone').val(), //电话
  46. F_AddRess:addresText,//地址
  47. F_ProductType:$('#F_ProductType').val(), //产品代码
  48. F_ProductName:$('#F_ProductName').val(), //产品名称
  49. F_Specifications:$('#F_Specifications').val(), //规格
  50. F_ProductDate:$('#F_ProductDate').val(), //生产日期
  51. F_BatchNumber:$('#F_BatchNumber').val(), //产品编码
  52. F_Manufacturer:$('#F_Manufacturer').val(), //生产厂家
  53. F_ProblemCode:$('#F_ProblemCode').val(), //问题代码
  54. F_QualityProblem:$('#F_QualityProblem').val(), //质量问题
  55. F_DealTimely:$('#F_DealTimely').val(), //工单等级
  56. F_DealTimelyyy:$('#F_DealTimelyyy').val(), //工单等级原因
  57. IsAssign:0,
  58. //F_QualityProblem: $('input[name="opinion"]:checked').val(), //=(1普通2紧急)
  59. //F_Area:$('#F_Area').val(), //大区
  60. //clid:$('#F_Clid').val(), //提交人
  61. F_Content:$('#F_Content').val(), //备注
  62. token:localStorage.getItem("token")
  63. },
  64. success: function(data) {
  65. if(data.state == "success") {
  66. mui.toast('投诉成功!');
  67. $("#name").val('');
  68. $("#phone").val('');
  69. $("#title").val('');
  70. $(".content").val('');
  71. $("#cityResult3").val('');
  72. $("#zhuTiResult").val('');
  73. $("#F_Type").val('');
  74. $('#detail_address').val('');
  75. $('input[name="secret"][value="0"]').prop("checked", "checked");
  76. window.location.reload();
  77. } else {
  78. mui.toast(data.message);
  79. }
  80. }
  81. });
  82. }
  83. })
  84. //工单类型
  85. var typeList = [{
  86. value: '1',
  87. text: '咨询'
  88. }, {
  89. value: '2',
  90. text: '投诉'
  91. }, {
  92. value: '3',
  93. text: '重复'
  94. },
  95. // {
  96. // value: '5',
  97. // text: '生鲜品'
  98. // }, {
  99. // value: '6',
  100. // text: '禽产品'
  101. // }, {
  102. // value: '7,
  103. // text: '综合事业部'
  104. // }, {
  105. // value: '8',
  106. // text: '餐饮事业部'
  107. // }, {
  108. // value: '9',
  109. // text: '400热线接听'
  110. // }, {
  111. // value: '10',
  112. // text: '线上投诉'
  113. // }, {
  114. // value: '11',
  115. // text: '市场监管局投诉'
  116. // }, {
  117. // value: '12',
  118. // text: '电商投诉'
  119. // },
  120. ]
  121. // 产品代码
  122. var Product = [];
  123. $.ajax({
  124. type: "get",
  125. url: huayi.config.callcenter_url + 'Dictionary/GetDicValueListByFlag',
  126. async: false,
  127. data: {
  128. flag: "CPDM",
  129. token:localStorage.getItem("token")
  130. },
  131. dataType: 'json',
  132. success: function(res) {
  133. if(res.state.toLowerCase() === "success") {
  134. res = res.data;
  135. if(res && res.length > 0) {
  136. res.forEach(function(v, i) {
  137. var obj = {};
  138. obj.value = v.F_DictionaryValueId;
  139. obj.text = v.F_Name;
  140. Product.push(obj);
  141. });
  142. }
  143. }
  144. }
  145. });
  146. // 问题代码
  147. var Problem = [];
  148. $.ajax({
  149. type: "get",
  150. url: huayi.config.callcenter_url + 'Dictionary/GetDicValueListByFlag',
  151. async: false,
  152. data: {
  153. flag: "WTDM",
  154. token:localStorage.getItem("token")
  155. },
  156. dataType: 'json',
  157. success: function(res) {
  158. if(res.state.toLowerCase() === "success") {
  159. res = res.data;
  160. if(res && res.length > 0) {
  161. res.forEach(function(v, i) {
  162. var obj = {};
  163. obj.value = v.F_DictionaryValueId;
  164. obj.text = v.F_Name;
  165. Problem.push(obj);
  166. });
  167. }
  168. }
  169. }
  170. });
  171. // 工单等级
  172. var DealTimely = [];
  173. $.ajax({
  174. type: "get",
  175. url: huayi.config.callcenter_url + 'Dictionary/GetDicValueListByFlag',
  176. async: false,
  177. data: {
  178. flag: "GDDJ",
  179. token:localStorage.getItem("token")
  180. },
  181. dataType: 'json',
  182. success: function(res) {
  183. if(res.state.toLowerCase() === "success") {
  184. res = res.data;
  185. if(res && res.length > 0) {
  186. res.forEach(function(v, i) {
  187. var obj = {};
  188. obj.value = v.F_DictionaryValueId;
  189. obj.text = v.F_Name;
  190. DealTimely.push(obj);
  191. });
  192. }
  193. }
  194. }
  195. });
  196. function gddjyy(){
  197. var DealTimelyyy = []
  198. var flagDJ;
  199. if ($("#F_DealTimely").val()=="普通工单") {
  200. flagDJ="PGYY"
  201. } else if ($("#F_DealTimely").val()=="Ⅰ级") {
  202. flagDJ="YJYY"
  203. } else if ($("#F_DealTimely").val()=="Ⅱ级") {
  204. flagDJ="EJYY"
  205. }
  206. $.ajax({
  207. url: huayi.config.callcenter_url + 'Dictionary/GetDicValueListByFlag',
  208. type: 'get',
  209. data: {
  210. flag: flagDJ,
  211. token:localStorage.getItem("token")
  212. },
  213. dataType: "json",
  214. async: true,
  215. success: function(res) {
  216. if(res.state.toLowerCase() === "success") {
  217. res = res.data;
  218. if(res && res.length >0) {
  219. res.forEach(function(v, i) {
  220. var obj = {};
  221. obj.value = v.F_DictionaryValueId;
  222. obj.text = v.F_Name;
  223. DealTimelyyy.push(obj);
  224. //$('<option value="' + v.F_UserId + '">' + v.F_UserName + '</option>').appendTo('#order_recive');
  225. });
  226. userPicker5.setData(DealTimelyyy);
  227. }
  228. }
  229. },
  230. });
  231. }
  232. // 大区
  233. var Area = [];
  234. $.ajax({
  235. type: "get",
  236. url: huayi.config.callcenter_url + 'Department/GetCusAreaList',
  237. async: false,
  238. data: {
  239. pid: 1,
  240. F_Layer: 1,
  241. token:localStorage.getItem("token")
  242. },
  243. dataType: 'json',
  244. success: function(res) {
  245. if(res.state.toLowerCase() === "success") {
  246. res = res.data;
  247. if(res && res.length > 0) {
  248. res.forEach(function(v, i) {
  249. var obj = {};
  250. obj.value = v.F_DeptId;
  251. obj.text = v.F_DeptName;
  252. Area.push(obj);
  253. });
  254. }
  255. }
  256. }
  257. });
  258. //市
  259. function getClid(){
  260. var Clid = []
  261. $.ajax({
  262. url: huayi.config.callcenter_url + 'UserAccount/GetList',
  263. type: 'get',
  264. data: {
  265. type: 1,
  266. dptid: $('#F_Area').attr('data-index'),
  267. token:localStorage.getItem("token")
  268. },
  269. dataType: "json",
  270. async: true,
  271. success: function(res) {
  272. res = res.rows;
  273. if(res && res.length >0) {
  274. res.forEach(function(v, i) {
  275. var obj = {};
  276. obj.value = v.F_UserName;
  277. obj.text = v.F_UserName;
  278. Clid.push(obj);
  279. });
  280. userPicker7.setData(Clid);
  281. }
  282. },
  283. });
  284. }
  285. // 咨询省市县乡
  286. var recives = [];
  287. $.ajax({
  288. type: "get",
  289. url: huayi.config.callcenter_url + 'RegionCategory/GetCountyList',
  290. async: false,
  291. data: {
  292. pid:0,
  293. token:localStorage.getItem("token")
  294. },
  295. dataType: 'json',
  296. success: function(res) {
  297. if(res.state.toLowerCase() === "success") {
  298. res = res.data;
  299. if(res && res.length > 0) {
  300. res.forEach(function(v, i) {
  301. var obj = {};
  302. obj.value = v.F_RegionId;
  303. obj.text = v.F_RegionName;
  304. recives.push(obj);
  305. });
  306. }
  307. }
  308. }
  309. });
  310. //市
  311. function getRece(){
  312. var renyuann = []
  313. $.ajax({
  314. url: huayi.config.callcenter_url + 'RegionCategory/GetCountyList',
  315. type: 'get',
  316. data: {
  317. pid:$('#choworder_rengin').attr('data-index'),
  318. token:localStorage.getItem("token")
  319. },
  320. dataType: "json",
  321. async: true,
  322. success: function(res) {
  323. if(res.state.toLowerCase() === "success") {
  324. res = res.data;
  325. if(res && res.length >0) {
  326. res.forEach(function(v, i) {
  327. var obj = {};
  328. obj.value = v.F_RegionId;
  329. obj.text = v.F_RegionName;
  330. renyuann.push(obj);
  331. //$('<option value="' + v.F_UserId + '">' + v.F_UserName + '</option>').appendTo('#order_recive');
  332. });
  333. RCiPickee1.setData(renyuann);
  334. }
  335. }
  336. },
  337. });
  338. }
  339. //区/县
  340. function getReee(){
  341. var rennn = []
  342. $.ajax({
  343. url: huayi.config.callcenter_url + 'RegionCategory/GetCountyList',
  344. type: 'get',
  345. data: {
  346. pid:$('#shouorder_shi').attr('data-index'),
  347. token:localStorage.getItem("token")
  348. },
  349. dataType: "json",
  350. async: true,
  351. success: function(res) {
  352. if(res.state.toLowerCase() === "success") {
  353. res = res.data;
  354. if(res && res.length >0) {
  355. res.forEach(function(v, i) {
  356. var obj = {};
  357. obj.value = v.F_RegionId;
  358. obj.text = v.F_RegionName;
  359. rennn.push(obj);
  360. //$('<option value="' + v.F_UserId + '">' + v.F_UserName + '</option>').appendTo('#order_recive');
  361. });
  362. RCiPi1.setData(rennn);
  363. }
  364. }
  365. },
  366. });
  367. }
  368. (function($, doc) {
  369. $.init();
  370. $.ready(function() {
  371. //工单类型
  372. var userPicker1 = new $.PopPicker();
  373. userPicker1.setData(typeList);
  374. var showUserPickerButton1 = doc.getElementById('showUserPicker');
  375. var F_Type = doc.getElementById('F_Type');
  376. showUserPickerButton1.addEventListener('tap', function(event) {
  377. userPicker1.show(function(items) {
  378. console.log(items)
  379. F_Type.value = items[0].text;
  380. F_Type.setAttribute("data-index", items[0].value);
  381. //返回 false 可以阻止选择框的关闭
  382. //return false;
  383. });
  384. }, false);
  385. //产品代码
  386. var userPicker2 = new $.PopPicker();
  387. userPicker2.setData(Product);
  388. var showUserPickerButton2 = doc.getElementById('showUserPickerProduct');
  389. var F_Product = doc.getElementById('F_ProductType');
  390. showUserPickerButton2.addEventListener('tap', function(event) {
  391. userPicker2.show(function(items) {
  392. F_Product.value = items[0].text;
  393. F_Product.setAttribute("data-index", items[0].value);
  394. });
  395. }, false);
  396. //问题代码
  397. var userPicker3 = new $.PopPicker();
  398. userPicker3.setData(Problem);
  399. var showUserPickerButton3 = doc.getElementById('showUserPickerProblem');
  400. var F_Problem = doc.getElementById('F_ProblemCode');
  401. showUserPickerButton3.addEventListener('tap', function(event) {
  402. userPicker3.show(function(items) {
  403. F_Problem.value = items[0].text;
  404. F_Problem.setAttribute("data-index", items[0].value);
  405. });
  406. }, false);
  407. //工单等级
  408. var userPicker4 = new $.PopPicker();
  409. userPicker4.setData(DealTimely);
  410. var showUserPickerButton4 = doc.getElementById('showUserPickerDealTimely');
  411. var F_DealTimely = doc.getElementById('F_DealTimely');
  412. showUserPickerButton4.addEventListener('tap', function(event) {
  413. userPicker4.show(function(items) {
  414. F_DealTimely.value = items[0].text;
  415. F_DealTimely.setAttribute("data-index", items[0].value);
  416. });
  417. }, false);
  418. //工单等级原因
  419. userPicker5 = new $.PopPicker({
  420. F_Layer: 1,
  421. });
  422. var showUserPickerButton5 = doc.getElementById('showUserPickerDealTimelyyy');
  423. var F_DealTimelyyy = doc.getElementById('F_DealTimelyyy');
  424. showUserPickerButton5.addEventListener('tap', function(event) {
  425. gddjyy();
  426. userPicker5.show(function(items) {
  427. doc.getElementById('chouorder_xian').value="";
  428. if (items[0].text!=undefined) {
  429. F_DealTimelyyy.value =items[0].text
  430. F_DealTimelyyy.setAttribute("data-index", items[0].value);
  431. }
  432. });
  433. }, false);
  434. //大区
  435. var userPicker6 = new $.PopPicker({
  436. F_Layer: 1,
  437. });
  438. userPicker6.setData(Area);
  439. var showUserPickerButton6 = doc.getElementById('showUserPickerArea');
  440. var F_Area = doc.getElementById('F_Area');
  441. showUserPickerButton6.addEventListener('tap', function(event) {
  442. userPicker6.show(function(items) {
  443. F_Area.value =items[0].text
  444. F_Area.setAttribute("data-index", items[0].value);
  445. });
  446. }, false);
  447. //提交人
  448. userPicker7 = new $.PopPicker({
  449. F_Layer: 1,
  450. });
  451. var showUserPickerButton7 = doc.getElementById('showUserPickeClid');
  452. var F_Clid = doc.getElementById('F_Clid');
  453. showUserPickerButton7.addEventListener('tap', function(event) {
  454. getClid();
  455. userPicker7.show(function(items) {
  456. if (items[0].text!=undefined) {
  457. F_Clid.value =items[0].text
  458. F_Clid.setAttribute("data-index", items[0].value);
  459. }
  460. });
  461. }, false);
  462. //咨询省
  463. var RCiP = new $.PopPicker({
  464. F_Layer: 1,
  465. });
  466. RCiP.setData(recives);
  467. var RCss1 = doc.getElementById('chouhuTi');
  468. var RCResultss = doc.getElementById('choworder_rengin');
  469. RCss1.addEventListener('tap', function(event) {
  470. doc.getElementById('shouorder_shi').value="";
  471. doc.getElementById('chouorder_xian').value="";
  472. RCiP.show(function(items) {
  473. RCResultss.value =items[0].text
  474. RCResultss.setAttribute("data-index", items[0].value);
  475. });
  476. }, false);
  477. //市
  478. RCiPickee1 = new $.PopPicker({
  479. F_Layer: 1,
  480. });
  481. var RCss2 = doc.getElementById('chowZhuTiPicker');
  482. var RCResultss2 = doc.getElementById('shouorder_shi');
  483. RCss2.addEventListener('tap', function(event) {
  484. getRece();
  485. RCiPickee1.show(function(items) {
  486. doc.getElementById('chouorder_xian').value="";
  487. if (items[0].text!=undefined) {
  488. RCResultss2.value =items[0].text
  489. RCResultss2.setAttribute("data-index", items[0].value);
  490. }
  491. });
  492. }, false);
  493. //区/县
  494. RCiPi1 = new $.PopPicker({
  495. F_Layer: 1,
  496. });
  497. var RCs22 = doc.getElementById('chowcounty');
  498. var RCResults22 = doc.getElementById('chouorder_xian');
  499. RCs22.addEventListener('tap', function(event) {
  500. getReee();
  501. RCiPi1.show(function(items) {
  502. if (items[0].text!=undefined) {
  503. RCResults22.value =items[0].text
  504. RCResults22.setAttribute("data-index", items[0].value);
  505. }
  506. });
  507. }, false);
  508. })
  509. })(mui, document);
  510. });