思念食品 UI

AddWorkOrder.js 8.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. 
  2. $(document).ready(function () {
  3. var groupcode = $('#groupcode', top.document).val();
  4. if (groupcode == 'SCZ') {
  5. $("#usedate").text("饮用日期:");
  6. $("#vipid").text("对接人:");
  7. $("#vipphone").text("对接人电话:");
  8. }
  9. var id = helper.request.queryString("id");
  10. var phone = helper.request.queryString("phone");
  11. var name = helper.request.queryString("name");
  12. laydate.render({
  13. elem: '.userDate',
  14. theme: '#1ab394',
  15. calendar: 'true'
  16. });
  17. laydate.render({
  18. elem: '.buyDate',
  19. theme: '#1ab394',
  20. calendar: 'true'
  21. });
  22. laydate.render({
  23. elem: '#productDate',
  24. theme: '#1ab394',
  25. calendar: 'true'
  26. });
  27. //工单来源
  28. getOrderSource();
  29. //工单类型
  30. getOrderType();
  31. //投诉类型
  32. complaintType();
  33. //产品类别
  34. getProductType();
  35. //区域
  36. getAreaType();
  37. //客诉专员
  38. ComplaintVip();
  39. ////编辑器配置 客服部
  40. //KindEditor.ready(function(K) {
  41. // window.changeEditor = K.create('#feedBackCon'); //修改弹出框编辑器
  42. //})
  43. ////编辑器配置 市场部 备注
  44. //KindEditor.ready(function(K) {
  45. // window.marketEditor = K.create('#remark_market');
  46. //})
  47. //保存
  48. $('.customerSubmit').click(function() {
  49. saveCustomer();
  50. })
  51. if(id) {
  52. $("#CallID").val(id);
  53. $("#tel").val(phone);
  54. $("#tel_market").val(phone);
  55. if(unescape(decodeURI(name)) != 'null' && unescape(decodeURI(name)) != 'undefined') {
  56. $("#name_market").val(unescape(decodeURI(name)));
  57. $("#name").val(unescape(decodeURI(name)));
  58. }
  59. }
  60. $('.areaDown').click(function () {
  61. if ($('.treeList1').css('display') == 'block') {
  62. $('.treeList1').css('display', 'none')
  63. } else {
  64. $('.treeList1').css('display', 'block')
  65. }
  66. })
  67. $('#typeclass').click(function () {
  68. $('.treeList1').css('display', 'block')
  69. })
  70. $('.treeList1').mouseleave(function () {
  71. $(this).css('display', 'none')
  72. })
  73. $(".orderType").change(function () {
  74. if ($(".orderType option:selected").text() != "投诉") {
  75. $(".complainDiv").hide();
  76. } else {
  77. $(".complainDiv").show();
  78. }
  79. });
  80. //获取专员手机号
  81. $("#vipName").change(function () {
  82. $("#vipTel").val($("#vipName option:selected").attr("index"));
  83. $("#areaInps").val($("#vipName option:selected").attr("areaText"));
  84. $("#typeclass").val($("#vipName option:selected").attr("province") + "/" + $("#vipName option:selected").attr("city"));
  85. $(".inps2").val($("#vipName option:selected").attr("province"));
  86. $(".inps3").val($("#vipName option:selected").attr("city"));
  87. });
  88. })
  89. //工单类型
  90. function getOrderType() {
  91. $.get(huayi.config.callcenter_url + 'Dictionary/GetDicValueListByFlag', {
  92. "token": $.cookie("token"),
  93. flag: "GDLX"
  94. }, function(result) {
  95. result = $.parseJSON(result);
  96. var Count = result.data;
  97. $(Count).each(function(i, n) {
  98. $('<option value="' + n.F_DictionaryValueId + '">' + n.F_Name + '</option>').appendTo($(".orderType"));
  99. })
  100. });
  101. }
  102. //工单类型
  103. function complaintType() {
  104. $.get(huayi.config.callcenter_url + 'Dictionary/GetDicValueListByFlag', {
  105. "token": $.cookie("token"),
  106. flag: "TSLX"
  107. }, function(result) {
  108. result = $.parseJSON(result);
  109. var Count = result.data;
  110. $(Count).each(function(i, n) {
  111. $('<option value="' + n.F_DictionaryValueId + '">' + n.F_Name + '</option>').appendTo($(".complaintType"));
  112. })
  113. });
  114. }
  115. //产品类别
  116. function getProductType() {
  117. $.get(huayi.config.callcenter_url + 'Dictionary/GetDicValueListByFlag', {
  118. "token": $.cookie("token"),
  119. flag: "CPLB"
  120. }, function(result) {
  121. result = $.parseJSON(result);
  122. var Count = result.data;
  123. $(Count).each(function(i, n) {
  124. $('<option value="' + n.F_DictionaryValueId + '">' + n.F_Name + '</option>').appendTo($(".productType"));
  125. })
  126. });
  127. }
  128. //区域
  129. function getAreaType() {
  130. $.get(huayi.config.callcenter_url + 'Area/GetAreaList', {
  131. "token": $.cookie("token"),
  132. }, function(result) {
  133. result = $.parseJSON(result);
  134. $.fn.zTree.init($("#TreeDemo1"), setting, result.data); //实例化树形图
  135. });
  136. }
  137. var setting = {
  138. data: {
  139. key: {
  140. name: "F_AreaName"
  141. },
  142. simpleData: {
  143. enable: true,
  144. idKey: "F_Id",
  145. pIdKey: "F_ParentId",
  146. rootPId: 0
  147. }
  148. },
  149. callback: {
  150. onClick: changeTreeClick
  151. }
  152. }
  153. function changeTreeClick(event, treeId, treeNode) {
  154. var areaParent = treeNode.getPath();
  155. if (areaParent[1]) {
  156. areaParent1=areaParent[0].F_AreaName
  157. areaParent2=areaParent[1].F_AreaName
  158. $('#typeclass').val(areaParent1+"/"+areaParent2);
  159. $('.inps2').val(areaParent1);
  160. $('.inps3').val(areaParent2);
  161. ComplaintVip();
  162. }else{
  163. layer.msg("请选择最下级菜单");
  164. }
  165. $('.addTree1').hide();
  166. };
  167. //工单来源
  168. function getOrderSource(obj) {
  169. $.ajax({
  170. type: "get",
  171. url: huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag",
  172. dataType: 'json',
  173. async: true,
  174. data: {
  175. token: $.cookie("token"),
  176. flag: "GDLY"
  177. },
  178. success: function(data) {
  179. var Count = data.data;
  180. $(Count).each(function(i, n) {
  181. $('<option value="' + n.F_DictionaryValueId + '">' + n.F_Name + '</option>').appendTo($("#DicValueList"));
  182. })
  183. }
  184. });
  185. }
  186. //客诉专员
  187. function ComplaintVip() {
  188. $.ajax({
  189. type: "get",
  190. url: huayi.config.callcenter_url + "Customer/GetAllList",
  191. dataType: 'json',
  192. async: true,
  193. data: {
  194. token: $.cookie("token"),
  195. type: 2,
  196. province: $('.inps2').val(), //省
  197. city: $('.inps3').val() //市
  198. },
  199. success: function(data) {
  200. $("#vipName").empty();
  201. var Count = data.data;
  202. $('<option value="">请选择专员</option>').appendTo($("#vipName"));
  203. $(Count).each(function (i, n) {
  204. $('<option value="' + n.F_Id
  205. + '" index="' + n.F_Phone
  206. + '" areaText="' + n.F_Area
  207. + '" province="' + n.F_Province
  208. + '" city="' + n.F_City + '">' + n.F_Name
  209. + '</option>').appendTo($("#vipName"));
  210. })
  211. }
  212. });
  213. }
  214. //保存
  215. function saveCustomer() {
  216. if(!$('#name').val()) {
  217. layer.confirm('请输入姓名!', {
  218. icon: 2,
  219. btn: ['确定']
  220. });
  221. return;
  222. }
  223. if(!$('#tel').val()) {
  224. layer.confirm('请输入电话!', {
  225. icon: 2,
  226. btn: ['确定']
  227. });
  228. return;
  229. }
  230. if(!$('#DicValueList').val()) {
  231. layer.confirm('请选择工单来源!', {
  232. icon: 2,
  233. btn: ['确定']
  234. });
  235. return;
  236. }
  237. if (!$('.orderType').val()) {
  238. layer.confirm('请选择工单类型!', {
  239. icon: 2,
  240. btn: ['确定']
  241. });
  242. return;
  243. }
  244. $.ajax({
  245. type: "post",
  246. url: huayi.config.callcenter_url + "WorkOrder/AddWorkOrder",
  247. dataType: 'json',
  248. async: true,
  249. beforeSend: function() { //触发ajax请求开始时执行
  250. $('.customerSubmit').attr("disabled", true);
  251. $('.customerSubmit').text('保存中...');
  252. },
  253. data: {
  254. token: $.cookie("token"),
  255. cusname: $('#name').val(), //姓名
  256. cusphone: $('#tel').val(), //号码
  257. productdate: $('#productDate').val(),
  258. buydate: $('.buyDate').val(), //购买日期
  259. productname: $('#productname').val(), //产品名称
  260. buyaddress: $('#buyAddress').val(), //购买地址
  261. producttype: $('#productType').val(), //产品类别
  262. batchnumber: $('#batchNumber').val(), //生产批号
  263. userdate: $('.userDate').val(), //使用日期 userDate
  264. source: $('#DicValueList').val(), //工单来源
  265. type: $('.orderType').val(), //工单类型id
  266. smalltype:$(".complaintType").val(), //投诉类型
  267. area: $('#areaInps').val(), //区域
  268. province: $('.inps2').val(), //省
  269. city: $('.inps3').val(), //市
  270. content:$('#content').val(), //事件描述
  271. vipid: $('#vipName').val(), //专员id
  272. vipphone: $('#vipTel').val(), //专员号码
  273. isback: $('input[name="sendBack"]:checked').val(),
  274. callid: $("#CallID").val()
  275. },
  276. success: function(data) {
  277. if(data.state.toLowerCase() == 'success') {
  278. layer.msg("保存成功!");
  279. window.location.reload()
  280. $('.customerSubmit').attr("disabled", false);
  281. $('.customerSubmit').text('保存');
  282. }
  283. }
  284. });
  285. }
  286. function clear() {
  287. $('#name').val('');
  288. $('#tel').val(''); //号码
  289. $('#orderSource').val(''); //工单来源
  290. $('#typeclassId').val(''); //工单类型id
  291. $('.orderType').val(''); //工单状态id
  292. $('.DicValueList').val(''); //反馈内容
  293. $('.buyDate').val(''); //快递信息
  294. $('#productDate').val(''); //快递信息
  295. $('#productname').val(''); //备注一
  296. $('#buyAddress').val(''); //备注二
  297. $('#productType').val(''); //备注三
  298. $('#batchNumber').val('');
  299. $('.userDate').val('');
  300. $('.complaintType').val('');
  301. $('.inps2').val('');
  302. $('.inps3').val('');
  303. $('#content').val('');
  304. $('#vipName').val('');
  305. $('#vipTel').val('');
  306. $('#CallID').val('');
  307. }