思念食品 UI

xgWork.js 16KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534
  1. var ns;
  2. var id = helper.request.queryString("id");
  3. var phone = helper.request.queryString("phone");
  4. var objs = {};
  5. laydate.render({
  6. elem: '#userDate',
  7. theme: '#1ab394',
  8. calendar: 'true'
  9. //type: 'datetime',
  10. //max : 31,
  11. //min: 0,
  12. });
  13. laydate.render({
  14. elem: '#buyDate',
  15. theme: '#1ab394',
  16. calendar: 'true'
  17. //type: 'datetime',
  18. //max : 31,
  19. //min: 0,
  20. });
  21. laydate.render({
  22. elem: '#proDuctdate',
  23. theme: '#1ab394',
  24. calendar: 'true'
  25. //type: 'datetime',
  26. //max : 31,
  27. //min: 0,
  28. });
  29. $.ajax({
  30. type: "get",
  31. url: huayi.config.callcenter_url + "CallInScreen/GetCurrUserDep",
  32. dataType: 'json',
  33. async: false,
  34. data: {
  35. token: $.cookie("token")
  36. },
  37. success: function(data) {
  38. if(data.state.toLowerCase() == 'success') {
  39. if(data.data.groname == '思念组') {
  40. $('.customerService').show();
  41. $('.market').remove();
  42. ns = 1;
  43. } else {
  44. $('.market').show();
  45. $('.customerService').remove();
  46. ns = 2;
  47. }
  48. }
  49. }
  50. });
  51. if(id) {
  52. $("#tel").val(phone);
  53. $("#tel_market").val(phone);
  54. $("#CallID").val(id);
  55. }
  56. $('#testInput1').comboSelect();
  57. $('#testInput2').comboSelect();
  58. $('#testInput3').comboSelect();
  59. $('#testInput4').comboSelect();
  60. $(function() {
  61. //保存
  62. $('.customerSubmit').click(function() {
  63. saveCustomer();
  64. });
  65. $('.marketSubmit').click(function() {
  66. saveMarket();
  67. });
  68. })
  69. //编辑器配置
  70. KindEditor.ready(function(K) {
  71. // XQ();
  72. })
  73. //编辑器配置
  74. KindEditor.ready(function(K) {
  75. window.changeMarket = K.create('#remark_market'); //修改弹出框编辑器
  76. })
  77. // XQ();
  78. // })
  79. XQ();
  80. GDLY(); //工单来源
  81. State(); //工单状态
  82. getProductType(); //产品类别
  83. getOrderType(); //工单类型
  84. getOrderType1();
  85. ComplaintVip();//客诉专员
  86. complaintType();// 投诉类型
  87. //工单状态
  88. function State() {
  89. $.ajax({
  90. url: huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag",
  91. type: 'get',
  92. async: false,
  93. data: {
  94. flag: 'GDZT',
  95. token: $.cookie("token")
  96. },
  97. dataType: "json",
  98. success: function(res) {
  99. if(res.state == "success") {
  100. $('<option value="">全部</option>').appendTo($("#State"));
  101. $(res.data).each(function(i, n) {
  102. $('<option value="' + n.F_DictionaryValueId + '">' + n.F_Name + '</option>').appendTo($("#State"));
  103. })
  104. //
  105. }
  106. }
  107. })
  108. }
  109. //工单类型
  110. function complaintType() {
  111. $.get(huayi.config.callcenter_url + 'Dictionary/GetDicValueListByFlag', {
  112. "token": $.cookie("token"),
  113. flag: "TSLX"
  114. }, function(result) {
  115. result = $.parseJSON(result);
  116. var Count = result.data;
  117. $('<option value="">全部</option>').appendTo($(".complaintType"));
  118. $(Count).each(function(i, n) {
  119. $('<option value="' + n.F_DictionaryValueId + '">' + n.F_Name + '</option>').appendTo($(".complaintType"));
  120. })
  121. });
  122. }
  123. //产品类别
  124. function getProductType() {
  125. $.get(huayi.config.callcenter_url + 'Dictionary/GetDicValueListByFlag', {
  126. "token": $.cookie("token"),
  127. flag: "CPLB"
  128. }, function(result) {
  129. result = $.parseJSON(result);
  130. var Count = result.data;
  131. $('<option value="">全部</option>').appendTo($(".productType1"));
  132. $(Count).each(function(i, n) {
  133. if(ns==1){
  134. $('<option value="' + n.F_DictionaryValueId + '">' + n.F_Name + '</option>').appendTo($(".productType1"));
  135. }else if(ns==2){
  136. $('<option value="' + n.F_DictionaryValueId + '">' + n.F_Name + '</option>').appendTo($(".productType2"));
  137. }
  138. })
  139. });
  140. }
  141. $("#orderType1").change(function() {
  142. if($("#orderType1 option:selected").text()=="咨询"){
  143. $(".complainDiv").hide();
  144. }else{
  145. $(".complainDiv").show();
  146. }
  147. });
  148. $(".orderType2").change(function() {
  149. if($(".orderType2 option:selected").text()=="咨询"){
  150. $(".complainDiv").hide();
  151. }else{
  152. $(".complainDiv").show();
  153. }
  154. });
  155. //客诉专员
  156. function ComplaintVip() {
  157. var customerType;
  158. if(ns==1){
  159. customerType=2
  160. }else if(ns==2){
  161. customerType=2
  162. }
  163. $.ajax({
  164. type: "get",
  165. url: huayi.config.callcenter_url + "Customer/GetAllList",
  166. dataType: 'json',
  167. async: true,
  168. data: {
  169. token: $.cookie("token"),
  170. type: customerType
  171. },
  172. success: function(data) {
  173. var Count = data.data;
  174. if (ns==1) {
  175. $('<option value="">全部</option>').appendTo($("#vipName"));
  176. $(Count).each(function(i, n) {
  177. $('<option value="' + n.F_Id
  178. + '" index="'+n.F_Phone
  179. +'" areaText="'+n.F_Area
  180. +'" province="'+n.F_Province
  181. +'" city="'+n.F_City+'">' + n.F_Name
  182. + '</option>').appendTo($("#vipName"));
  183. })
  184. $("#vipTel").val($("#vipName option:selected").attr("index"));
  185. $("#areaInps").val($("#vipName option:selected").attr("areaText"));
  186. $("#typeclass1").val($("#vipName option:selected").attr("province")+"/"+$("#vipName option:selected").attr("city"));
  187. $(".inps2").val($("#vipName option:selected").attr("province"));
  188. $(".inps3").val($("#vipName option:selected").attr("city"));
  189. } else if(ns==2){
  190. $(Count).each(function(i, n) {
  191. $('<option value="' + n.F_Id
  192. + '" index="'+n.F_Phone
  193. +'" areaText="'+n.F_Area
  194. +'" province="'+n.F_Province
  195. +'" city="'+n.F_City+'">' + n.F_Name
  196. + '</option>').appendTo($("#customerName"));
  197. })
  198. $("#customerTel").val($("#customerName option:selected").attr("index"));
  199. $("#areaInps").val($("#customerName option:selected").attr("areaText"));
  200. $("#typeclass_market1").val($("#customerName option:selected").attr("province")+"/"+$("#customerName option:selected").attr("city"));
  201. $(".inps2").val($("#customerName option:selected").attr("province"));
  202. $(".inps3").val($("#customerName option:selected").attr("city"));
  203. }
  204. }
  205. });
  206. }
  207. //获取专员手机号
  208. $("#vipName").change(function() {
  209. $("#vipTel").val($("#vipName option:selected").attr("index"));
  210. $("#areaInps").val($("#vipName option:selected").attr("areaText"));
  211. $("#typeclass1").val($("#vipName option:selected").attr("province")+"/"+$("#vipName option:selected").attr("city"));
  212. $(".inps2").val($("#vipName option:selected").attr("province"));
  213. $(".inps3").val($("#vipName option:selected").attr("city"));
  214. });
  215. $("#customerName").change(function() {
  216. $("#customerTel").val($("#customerName option:selected").attr("index"));
  217. $("#areaInps").val($("#customerName option:selected").attr("areaText"));
  218. $("#typeclass_market1").val($("#customerName option:selected").attr("province")+"/"+$("#customerName option:selected").attr("city"));
  219. $(".inps2").val($("#customerName option:selected").attr("province"));
  220. $(".inps3").val($("#customerName option:selected").attr("city"));
  221. });
  222. //工单来源
  223. function GDLY() {
  224. $.ajax({
  225. type: "get",
  226. url: huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag",
  227. dataType: 'json',
  228. async: true,
  229. data: {
  230. token: $.cookie("token"),
  231. flag: "GDLY"
  232. },
  233. success: function(data) {
  234. var Count = data.data;
  235. $('<option value="">全部</option>').appendTo($("#DicValueList"));
  236. $(Count).each(function(i, n) {
  237. if(n.F_DictionaryValueId == "468") {
  238. $('<option value="' + n.F_DictionaryValueId + '" selected="selected">' + n.F_Name + '</option>').appendTo($("#DicValueList"));
  239. $('<option value="' + n.F_DictionaryValueId + '" selected="selected">' + n.F_Name + '</option>').appendTo($("#DicValueList_market"));
  240. } else {
  241. $('<option value="' + n.F_DictionaryValueId + '">' + n.F_Name + '</option>').appendTo($("#DicValueList"));
  242. $('<option value="' + n.F_DictionaryValueId + '">' + n.F_Name + '</option>').appendTo($("#DicValueList_market"));
  243. }
  244. })
  245. }
  246. });
  247. }
  248. //工单类型
  249. function getOrderType() {
  250. $.get(huayi.config.callcenter_url + 'Dictionary/GetDicValueListByFlag', {
  251. "token": $.cookie("token"),
  252. flag: "GDLX"
  253. }, function(result) {
  254. result = $.parseJSON(result);
  255. var Count = result.data;
  256. //$("#orderType1").empty();
  257. $('<option value="">全部</option>').appendTo($("#orderType1"));
  258. $(Count).each(function(i, n) {
  259. if(ns==1){
  260. $('<option value="' + n.F_DictionaryValueId + '">' + n.F_Name + '</option>').appendTo($("#orderType1"));
  261. }else if(ns==2){
  262. $('<option value="' + n.F_DictionaryValueId + '">' + n.F_Name + '</option>').appendTo($(".orderType2"));
  263. }
  264. })
  265. });
  266. }
  267. //获取详情
  268. function XQ() {
  269. $.ajax({
  270. type: "get",
  271. url: huayi.config.callcenter_url + "WorkOrder/GetWorkOrder",
  272. dataType: 'json',
  273. async: true,
  274. cache: false,
  275. data: {
  276. "workid": id,
  277. "token": $.cookie("token")
  278. },
  279. success: function(result) {
  280. if(result.data.data.length > 0) {
  281. var data = result.data.data[0];
  282. $('#name').val(data.F_CusName); //姓名
  283. $('#tel').val(data.F_CusPhone); //号码
  284. $('#proDuctdate').val(data.F_ProductDate); //购买日期
  285. $('#buyDate').val(data.F_BuyDate); //购买日期
  286. $('.complaintType option:selected').text(data.SmallTypeName); //工单来源
  287. $('.complaintType').val(data.F_SmallType)
  288. $('#orderType1 option:selected').text(data.TypeName); //工单类型
  289. $('#orderType1').val(data.F_Type); //工单类型ID
  290. $('#productname').val(data.F_ProductName); //产品名称
  291. $('#buyAddress').val(data.F_BuyAddress); //购买地址 data.
  292. $('#productType option:selected').text(data.ProductTypeName); //产品类别
  293. $('#productType').val(data.F_ProductType); //产品类别ID
  294. $('#batchNumber').val(data.F_BatchNumber); //生产批号
  295. $('#userDate').val(data.F_UserDate); //使用日期
  296. $('#DicValueList option:selected').text(data.SourceName); //工单来源
  297. $('#DicValueList').val(data.F_Source); //工单来源
  298. $('#typeclass').val(data.TypeName); //工单类型id
  299. $("#areaInps").val(data.F_Area);
  300. $('#typeclass1').val(data.F_Province+"/"+data.F_City); //区域
  301. $('.inps2').val(data.F_Province); //省
  302. $('.inps3').val(data.F_City); //市
  303. $('#content').val(data.F_Content); //事件描述
  304. $('#vipName option:selected').text(data.F_VIPName); //专员姓名
  305. $('#vipTel').val(data.F_VIPPhone); //专员号码
  306. $('#customerName option:selected').text(data.F_VIPName); //专员姓名
  307. $('#customerTel').val(data.F_VIPPhone); //专员号码
  308. if($("#orderType1 option:selected").text()=="咨询"){
  309. $(".complainDiv").hide();
  310. }else{
  311. $(".complainDiv").show();
  312. }
  313. }
  314. }
  315. });
  316. }
  317. //区域
  318. function getOrderType1() {
  319. $.get(huayi.config.callcenter_url + 'Area/GetAreaList', {
  320. // $.get('http://192.168.4.18:4625/Area/GetAreaList', {
  321. "token": $.cookie("token"),
  322. }, function(result) {
  323. result = $.parseJSON(result);
  324. $.fn.zTree.init($("#TreeDemo1"), setting4, result.data); //实例化树形图
  325. $.fn.zTree.init($("#TreeDemo_market1"), setting4, result.data); //实例化树形图
  326. });
  327. }
  328. var setting4 = {
  329. data: {
  330. key: {
  331. name: "F_AreaName"
  332. },
  333. simpleData: {
  334. enable: true,
  335. idKey: "F_Id",
  336. pIdKey: "F_ParentId",
  337. rootPId: 0
  338. }
  339. },
  340. callback: {
  341. onClick: changeTreeClick1
  342. }
  343. }
  344. function changeTreeClick1(event, treeId, treeNode) {
  345. chanId = treeNode.F_Id;
  346. changeName = treeNode.F_AreaName;
  347. areaParent = treeNode.getPath();
  348. if(areaParent[1]) {
  349. areaParent1 = areaParent[0].F_AreaName
  350. areaParent2 = areaParent[1].F_AreaName
  351. $('#typeclass1').val(areaParent1 + "/" + areaParent2 );
  352. $('#typeclass_market1').val(areaParent1 + "/" + areaParent2);
  353. $('.inps2').val(areaParent1);
  354. $('.inps3').val(areaParent2);
  355. } else {
  356. layer.msg("请选择最下级菜单");
  357. }
  358. $('.addTree1').hide();
  359. };
  360. $('.areaDown').click(function() {
  361. if($('.treeList1').css('display') == 'block') {
  362. $('.treeList1').css('display', 'none')
  363. } else {
  364. $('.treeList1').css('display', 'block')
  365. }
  366. })
  367. $('#typeclass1').click(function() {
  368. $('.treeList1').css('display', 'block')
  369. })
  370. $('.treeList1').mouseleave(function() {
  371. $(this).css('display', 'none')
  372. })
  373. $('#typeclass_market1').click(function() {
  374. $('.treeList_market1').css('display', 'block')
  375. })
  376. $('.treeList_market1').mouseleave(function() {
  377. $(this).css('display', 'none')
  378. })
  379. //客服部保存
  380. function saveCustomer() {
  381. $.ajax({
  382. type: "post",
  383. url: huayi.config.callcenter_url + "WorkOrder/EditWorkOrder",
  384. dataType: 'json',
  385. async: true,
  386. data: {
  387. token: $.cookie("token"),
  388. workid: id,
  389. cusname: $('#name').val(), //姓名
  390. cusphone: $('#tel').val(), //号码
  391. buydate: $('#buyDate').val(), //购买日期
  392. productname: $('#productname').val(), //产品名称
  393. buyaddress: $('#buyAddress').val(), //购买地址
  394. producttype: $('#productType').val(), //产品类别
  395. batchnumber: $('#batchNumber').val(), //生产批号
  396. userdate: $('#userDate').val(), //使用日期 userDate
  397. source: $('#DicValueList').val(), //工单来源
  398. type: $('#orderType1').val(), //工单类型id
  399. smalltype:$(".complaintType").val(),
  400. area: $('#areaInps').val(), //区域
  401. province: $('.inps2').val(), //省
  402. city: $('.inps3').val(), //市
  403. content:$('#content').val(), //事件描述
  404. vipid: $('#vipName').val(), //专员号码
  405. vipphone: $('#vipTel').val(), //专员号码
  406. callid: $("#CallID").val()
  407. },
  408. success: function(data) {
  409. if(data.state.toLowerCase() == 'success') {
  410. layer.msg("保存成功!");
  411. var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  412. parent.layer.close(index); //再执行关闭
  413. parent.$('#workorderlist').bootstrapTable('refresh');
  414. parent.layer.msg("修改成功!");
  415. //clear();
  416. }
  417. }
  418. });
  419. }
  420. //杜康组保存
  421. function saveMarket() {
  422. if($('#name_market').val() == '') {
  423. layer.confirm('请输入姓名!', {
  424. icon: 2,
  425. btn: ['确定']
  426. });
  427. return;
  428. }
  429. if($('#tel_market').val() == '') {
  430. layer.confirm('请输入电话!', {
  431. icon: 2,
  432. btn: ['确定']
  433. });
  434. return;
  435. }
  436. if($('#testInput3_input').val() == '') {
  437. layer.confirm('请选择来电单位!', {
  438. icon: 2,
  439. btn: ['确定']
  440. });
  441. return;
  442. }
  443. $.ajax({
  444. type: "post",
  445. url: huayi.config.callcenter_url + "WorkOrder/EditWorkOrder",
  446. dataType: 'json',
  447. async: true,
  448. data: {
  449. token: $.cookie("token"),
  450. workid: id,
  451. cusname: $('#name').val(), //姓名
  452. cusphone: $('#tel').val(), //号码
  453. area: $('#areaInps').val(), //区域
  454. vipid: $("#customerName").val(), //专员id
  455. vipphone:$("#customerTel").val(), //专员号码
  456. source: $('#DicValueList').val(), //工单来源
  457. producttype: $('#productType').val(), //产品类别
  458. smalltype:$(".complaintType").val(),
  459. productname: $('#productname').val(), //产品名称
  460. batchnumber: $('#batchNumber').val(), //生产批号
  461. buyaddress: $('#buyAddress').val(), //购买地址
  462. productdate: $('#proDuctdate').val(), //生产日期
  463. buydate: $('#buyDate').val(), //购买日期
  464. userdate: $('#userDate').val(), //使用日期 userDate
  465. type: $('.orderType2').val(), //工单类型id
  466. province: $('.inps2').val(), //省
  467. city: $('.inps3').val(), //市
  468. content:$('#content').val(), //事件描述
  469. isback:$("#sendBack").val(),
  470. callid: $("#CallID").val()
  471. },
  472. success: function(data) {
  473. if(data.state.toLowerCase() == 'success') {
  474. layer.msg("保存成功!");
  475. var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  476. parent.layer.close(index); //再执行关闭
  477. parent.$('#workorderlist_').bootstrapTable('refresh');
  478. parent.layer.msg("修改成功!");
  479. //clear();
  480. }
  481. }
  482. });
  483. }
  484. function clear() {
  485. if(ns == 1) {
  486. $('#name').val('');
  487. $('#tel').val(''); //号码
  488. $('#testInput1_input').val(''); //来电单位
  489. $('#testInput2_input').val(''); //反馈单位
  490. $('#orderSource').val(''); //工单来源
  491. $('#typeclassId').val(''); //工单类型id
  492. $('#State').val(''); //工单状态id
  493. $('#express').val(''); //快递信息
  494. $('#remark1').val(''); //备注一
  495. $('#remark2').val(''); //备注二
  496. $('#remark3').val(''); //备注三
  497. } else {
  498. $('#name_market').val('');
  499. $('#tel_market').val(''); //号码
  500. $('#testInput3_input').val(''); //来电单位
  501. $('#testInput4_input').val(''); //反馈单位
  502. $('#typeclassId_market').val(''); //工单类型id
  503. // $('#remark_market').val(''); //备注内容
  504. }
  505. }