思念食品 UI

xgWork.js 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  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: '#buyAddress',
  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. GDLY(); //工单来源
  62. State(); //工单状态
  63. getOrderType(); //工单类型
  64. getOrderType1();
  65. ComplaintVip();//客诉专员
  66. //保存
  67. $('.customerSubmit').click(function() {
  68. saveCustomer();
  69. });
  70. $('.marketSubmit').click(function() {
  71. saveMarket();
  72. });
  73. })
  74. //编辑器配置
  75. KindEditor.ready(function(K) {
  76. XQ();
  77. })
  78. //编辑器配置
  79. KindEditor.ready(function(K) {
  80. window.changeMarket = K.create('#remark_market'); //修改弹出框编辑器
  81. })
  82. // XQ();
  83. // })
  84. //工单状态
  85. function State() {
  86. $.ajax({
  87. url: huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag",
  88. type: 'get',
  89. async: false,
  90. data: {
  91. flag: 'GDZT',
  92. token: $.cookie("token")
  93. },
  94. dataType: "json",
  95. success: function(res) {
  96. if(res.state == "success") {
  97. $(res.data).each(function(i, n) {
  98. $('<option value="' + n.F_DictionaryValueId + '">' + n.F_Name + '</option>').appendTo($("#State"));
  99. })
  100. //
  101. }
  102. }
  103. })
  104. }
  105. //客诉专员
  106. function ComplaintVip() {
  107. var customerType;
  108. if(ns==1){
  109. customerType=2
  110. }else if(ns==2){
  111. customerType=1
  112. }
  113. $.ajax({
  114. type: "get",
  115. url: huayi.config.callcenter_url + "Customer/GetAllList",
  116. dataType: 'json',
  117. async: true,
  118. data: {
  119. token: $.cookie("token"),
  120. type: customerType
  121. },
  122. success: function(data) {
  123. var Count = data.data;
  124. if (ns==1) {
  125. $(Count).each(function(i, n) {
  126. $('<option value="' + n.F_Id
  127. + '" index="'+n.F_Phone+'">' + n.F_Name
  128. + '</option>').appendTo($("#vipName"));
  129. })
  130. } else if(ns==2){
  131. $(Count).each(function(i, n) {
  132. $('<option value="' + n.F_Id
  133. + '" index="'+n.F_Phone+'">' + n.F_Name
  134. + '</option>').appendTo($("#customerName"));
  135. })
  136. }
  137. }
  138. });
  139. }
  140. //获取专员手机号
  141. $("#vipName").change(function() {
  142. $("#vipTel").val($("#vipName option:selected").attr("index"));
  143. });
  144. $("#customerName").change(function() {
  145. $("#customerTel").val($("#customerName option:selected").attr("index"));
  146. });
  147. //工单来源
  148. function GDLY() {
  149. $.ajax({
  150. type: "get",
  151. url: huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag",
  152. dataType: 'json',
  153. async: true,
  154. data: {
  155. token: $.cookie("token"),
  156. flag: "GDLY"
  157. },
  158. success: function(data) {
  159. var Count = data.data;
  160. $('<option value="">全部</option>').appendTo($("#DicValueList"));
  161. $(Count).each(function(i, n) {
  162. if(n.F_DictionaryValueId == "468") {
  163. $('<option value="' + n.F_DictionaryValueId + '" selected="selected">' + n.F_Name + '</option>').appendTo($("#DicValueList"));
  164. $('<option value="' + n.F_DictionaryValueId + '" selected="selected">' + n.F_Name + '</option>').appendTo($("#DicValueList_market"));
  165. } else {
  166. $('<option value="' + n.F_DictionaryValueId + '">' + n.F_Name + '</option>').appendTo($("#DicValueList"));
  167. $('<option value="' + n.F_DictionaryValueId + '">' + n.F_Name + '</option>').appendTo($("#DicValueList_market"));
  168. }
  169. })
  170. }
  171. });
  172. }
  173. //获取详情
  174. function XQ() {
  175. $.ajax({
  176. type: "get",
  177. url: huayi.config.callcenter_url + "WorkOrder/GetWorkOrder",
  178. dataType: 'json',
  179. async: true,
  180. cache: false,
  181. data: {
  182. "workid": id,
  183. "token": $.cookie("token")
  184. },
  185. success: function(result) {
  186. if(result.data.data.length > 0) {
  187. var data = result.data.data[0];
  188. $('#name').val(data.F_CusName); //姓名
  189. $('#tel').val(data.F_CusPhone); //号码
  190. $('#proDuctdate').val(data.F_ProductDate); //购买日期
  191. $('#buyDate').val(data.F_BuyDate); //购买日期
  192. $('#productname').val(data.F_ProductName); //产品名称
  193. $('#buyAddress').val(data.F_BuyAddress); //购买地址 data.
  194. $('#productType').val(data.F_ProductType); //产品类别
  195. $('#batchNumber').val(data.F_BatchNumber); //生产批号
  196. $('#userDate').val(data.F_UserDate); //使用日期
  197. $('#DicValueList option:selected').text(data.SourceName); //工单来源
  198. $('#typeclass').val(data.TypeName); //工单类型id
  199. $('#typeclass1').val(data.F_Area+"/"+data.F_Province+"/"+data.F_City); //区域
  200. $('.inps2').val(data.F_Area); //区域
  201. $('.inps3').val(data.F_Province); //省
  202. $('.inps4').val(data.F_City); //市
  203. $('#content').val(data.F_Content); //事件描述
  204. $('#vipName option:selected').text(data.F_VIPName); //专员姓名
  205. $('#vipTel').val(data.F_VIPPhone); //专员号码
  206. $('#customerName option:selected').text(data.F_VIPName); //专员姓名
  207. $('#customerTel').val(data.F_VIPPhone); //专员号码
  208. }
  209. }
  210. });
  211. }
  212. //工单类型
  213. function getOrderType() {
  214. $.get(huayi.config.callcenter_url + 'Dictionary/GetDicValueListByFlag', {
  215. "token": $.cookie("token"),
  216. flag: "GDLX"
  217. }, function(result) {
  218. result = $.parseJSON(result);
  219. var Count = result.data;
  220. $(Count).each(function(i, n) {
  221. if(ns==1){
  222. if(n.F_DictionaryValueId == "468") {
  223. $('<option value="' + n.F_DictionaryValueId + '" selected="selected">' + n.F_Name + '</option>').appendTo($(".orderType1"));
  224. } else {
  225. $('<option value="' + n.F_DictionaryValueId + '">' + n.F_Name + '</option>').appendTo($(".orderType1"));
  226. }
  227. }else if(ns==2){
  228. if(n.F_DictionaryValueId == "468") {
  229. $('<option value="' + n.F_DictionaryValueId + '" selected="selected">' + n.F_Name + '</option>').appendTo($(".orderType2"));
  230. } else {
  231. $('<option value="' + n.F_DictionaryValueId + '">' + n.F_Name + '</option>').appendTo($(".orderType2"));
  232. }
  233. }
  234. })
  235. });
  236. }
  237. //区域
  238. function getOrderType1() {
  239. $.get(huayi.config.callcenter_url + 'Area/GetAreaList', {
  240. // $.get('http://192.168.4.18:4625/Area/GetAreaList', {
  241. "token": $.cookie("token"),
  242. }, function(result) {
  243. result = $.parseJSON(result);
  244. $.fn.zTree.init($("#TreeDemo1"), setting4, result.data); //实例化树形图
  245. $.fn.zTree.init($("#TreeDemo_market1"), setting4, result.data); //实例化树形图
  246. });
  247. }
  248. var setting4 = {
  249. data: {
  250. key: {
  251. name: "F_AreaName"
  252. },
  253. simpleData: {
  254. enable: true,
  255. idKey: "F_Id",
  256. pIdKey: "F_ParentId",
  257. rootPId: 0
  258. }
  259. },
  260. callback: {
  261. onClick: changeTreeClick1
  262. }
  263. }
  264. function changeTreeClick1(event, treeId, treeNode) {
  265. chanId = treeNode.F_Id;
  266. changeName = treeNode.F_AreaName;
  267. areaParent = treeNode.getPath();
  268. if(areaParent[2]) {
  269. areaParent1 = areaParent[0].F_AreaName
  270. areaParent2 = areaParent[1].F_AreaName
  271. areaParent3 = areaParent[2].F_AreaName
  272. $('#typeclass1').val(areaParent1 + "/" + areaParent2 + "/" + areaParent3);
  273. $('#typeclass_market1').val(areaParent1 + "/" + areaParent2 + "/" + areaParent3);
  274. $('.inps2').val(areaParent1);
  275. $('.inps3').val(areaParent2);
  276. $('.inps4').val(areaParent3);
  277. } else {
  278. layer.msg("请选择最下级菜单");
  279. }
  280. $('.addTree1').hide();
  281. };
  282. $('.areaDown').click(function() {
  283. if($('.treeList1').css('display') == 'block') {
  284. $('.treeList1').css('display', 'none')
  285. } else {
  286. $('.treeList1').css('display', 'block')
  287. }
  288. })
  289. $('#typeclass1').click(function() {
  290. $('.treeList1').css('display', 'block')
  291. })
  292. $('.treeList1').mouseleave(function() {
  293. $(this).css('display', 'none')
  294. })
  295. $('#typeclass_market1').click(function() {
  296. $('.treeList_market1').css('display', 'block')
  297. })
  298. $('.treeList_market1').mouseleave(function() {
  299. $(this).css('display', 'none')
  300. })
  301. //客服部保存
  302. function saveCustomer() {
  303. $.ajax({
  304. type: "post",
  305. url: huayi.config.callcenter_url + "WorkOrder/EditWorkOrder",
  306. dataType: 'json',
  307. async: true,
  308. data: {
  309. token: $.cookie("token"),
  310. workid: id,
  311. cusname: $('#name').val(), //姓名
  312. cusphone: $('#tel').val(), //号码
  313. buydate: $('#buyDate').val(), //购买日期
  314. productname: $('#productname').val(), //产品名称
  315. buyaddress: $('#buyAddress').val(), //购买地址
  316. producttype: $('#productType').val(), //产品类别
  317. batchnumber: $('#batchNumber').val(), //生产批号
  318. userdate: $('#userDate').val(), //使用日期 userDate
  319. source: $('#DicValueList').val(), //工单来源
  320. type: $('.orderType1').val(), //工单类型id
  321. area: $('.inps2').val(), //区域
  322. province: $('.inps3').val(), //省
  323. city: $('.inps4').val(), //市
  324. content:$('#content').val(), //事件描述
  325. vipid: $('#vipName').val(), //专员号码
  326. vipphone: $('#vipTel').val(), //专员号码
  327. callid: $("#CallID").val()
  328. },
  329. success: function(data) {
  330. if(data.state.toLowerCase() == 'success') {
  331. layer.msg("保存成功!");
  332. var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  333. parent.layer.close(index); //再执行关闭
  334. parent.$('#workorderlist').bootstrapTable('refresh');
  335. parent.layer.msg("修改成功!");
  336. //clear();
  337. }
  338. }
  339. });
  340. }
  341. //市场部保存
  342. function saveMarket() {
  343. alert("dfd");
  344. if($('#name_market').val() == '') {
  345. layer.confirm('请输入姓名!', {
  346. icon: 2,
  347. btn: ['确定']
  348. });
  349. return;
  350. }
  351. if($('#tel_market').val() == '') {
  352. layer.confirm('请输入电话!', {
  353. icon: 2,
  354. btn: ['确定']
  355. });
  356. return;
  357. }
  358. if($('#testInput3_input').val() == '') {
  359. layer.confirm('请选择来电单位!', {
  360. icon: 2,
  361. btn: ['确定']
  362. });
  363. return;
  364. }
  365. $.ajax({
  366. type: "post",
  367. url: huayi.config.callcenter_url + "WorkOrder/EditWorkOrder",
  368. dataType: 'json',
  369. async: true,
  370. data: {
  371. token: $.cookie("token"),
  372. workid: id,
  373. cusname: $('#name').val(), //姓名
  374. cusphone: $('#tel').val(), //号码
  375. area: $('.inps2').val(), //区域
  376. vipid: $("#customerName").val(), //专员id
  377. vipphone:$("#customerTel").val(), //专员号码
  378. source: $('#DicValueList').val(), //工单来源
  379. productname: $('#productname').val(), //产品名称
  380. batchnumber: $('#batchNumber').val(), //生产批号
  381. buyaddress: $('#buyAddress').val(), //购买地址
  382. productdate: $('#proDuctdate').val(),
  383. buydate: $('.buyDate').val(), //购买日期
  384. userdate: $('.userDate').val(), //使用日期 userDate
  385. type: $('.orderType2').val(), //工单类型id
  386. province: $('.inps3').val(), //省
  387. city: $('.inps4').val(), //市
  388. content:$('#content').val(), //事件描述
  389. isback:$("#sendBack").val(),
  390. callid: $("#CallID").val()
  391. },
  392. success: function(data) {
  393. if(data.state.toLowerCase() == 'success') {
  394. layer.msg("保存成功!");
  395. var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  396. parent.layer.close(index); //再执行关闭
  397. parent.$('#workorderlist_').bootstrapTable('refresh');
  398. parent.layer.msg("修改成功!");
  399. //clear();
  400. }
  401. }
  402. });
  403. }
  404. function clear() {
  405. if(ns == 1) {
  406. $('#name').val('');
  407. $('#tel').val(''); //号码
  408. $('#testInput1_input').val(''); //来电单位
  409. $('#testInput2_input').val(''); //反馈单位
  410. $('#orderSource').val(''); //工单来源
  411. $('#typeclassId').val(''); //工单类型id
  412. $('#State').val(''); //工单状态id
  413. $('#express').val(''); //快递信息
  414. $('#remark1').val(''); //备注一
  415. $('#remark2').val(''); //备注二
  416. $('#remark3').val(''); //备注三
  417. } else {
  418. $('#name_market').val('');
  419. $('#tel_market').val(''); //号码
  420. $('#testInput3_input').val(''); //来电单位
  421. $('#testInput4_input').val(''); //反馈单位
  422. $('#typeclassId_market').val(''); //工单类型id
  423. // $('#remark_market').val(''); //备注内容
  424. }
  425. }