| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379 |
- mui.init({})
- var UserCode = helper.cookies.get("usercode");
- var openid = helper.cookies.get("openid");
- $(function() {
- var id = helper.request.queryString("id");
- var itype = helper.request.queryString("itype");
- // alert(itype);
- $('.hrefdetail').on('tap', function() {
- var index = $(this).attr('data-index');
- window.location.href = "details.html?id=" +id+'&itype='+itype ;
- });
- Ajax();
- // 获取详情
- function Ajax() {
- $.ajax({
- url: huayi.config.callcenter_url + '/WxLogin/GetWorkOrder',
- data: {
- workorderid: id, //工单编号
- openid: openid, //微信openid,
- },
- async: true,
- dataType: 'json',
- type: 'get', //HTTP请求类型
- success: function(data) {
- if(data.state.toLowerCase()== "success") {
- var result=data.data.data[0]
- // alert(result.Source)
- if (result.Source==0) {
- $(".source").hide();
- } else{
- $(".source").show();
- }
- $('input[name="form"][value="' + result.TypeClass + '"]').prop("checked", "checked");//工单类型
- $("#order_name").val(result.Customer); //客户姓名
- $("#order_tel").val(result.CustomerTel); //联系电话
- $("#order_rengin").val(result.areaname+result.proname+result.buildingname); //项目地址 proname buildingname
- $("#order_rengin").attr("data-index", result.IsUserSend), //区域名称
- $("#order_pro").attr('data-index',result.IsAdminSend), //项目名称
- $("#order_floor").attr('data-index',result.IsTimeOut), //楼号
- $("#order_room").val(result.Address); //楼层房间
- $("#ower_relationship").val(result.OwnerrelationsName); //房主关系
- $(' input[name="secret"][value="' + result.AuditState + '"]').prop("checked", "checked"); //客户反应
- $("#complaintOrder_type").val(result.ComplaintDepartment); //投诉类型
- $('#complaintOrder_type').attr('data-index',result.Source), //否 int 处理部门(投诉类型)
- $('#serviceOrder_type').attr('data-index',result.CreateUserID), //否int 客服类类型
- $('#is_quality_assurance').attr('data-index',result.ResponDept), //否 int 是,//否过质保
- // $(".order_responsible").text(result.LastDealUser); //受理人LastDealUser
- $("#order_responsible").find("option:selected").text(result.LastDealUser); //受理人
- $("#order_reception").text(result.Detail); //描述详情
-
- //跳转详情
- }
- },
- error: function(xhr, type, errorThrown) {
- //异常处理;
- }
- })
- }
-
-
- //工单有效性
- $('#order_valid').find('input[type="radio"]').on('change', function() {
- //是否有效工单项(0有效,1无效)
- if($(this).val() === "1") { //无效
- $('.order_note').show();
- } else {
- $('.order_note').hide();
- }
- });
- $('.order_type').find('input[type="radio"]').on('change', function() {
- if($(this).val() === "108") { //投诉
- $('.complaintOrder').show(); //receive
- $('.receive').hide();
- } else {
- $('.receive').show();
- $('.complaintOrder').hide();
- }
- });
- //提交按钮
- alert(id);
- $('#submit').on('tap', function() {
- if($('#order_type').val() == '') {
- mui.alert('请输入工单类型!') //请输入工单类型
- } else if($('#order_name').val() == '') {
- mui.alert('请输入客户姓名!') //请输入客户姓名
- } else if($('#order_rengin').val() == '') {
- mui.alert('请输入项目名称!') //请输入项目名称
- } else if($('#order_room').val() == '') {
- mui.alert('请输入房间号!') //请输入房间号
- } else if($('#ower_relationship').val() == '') {
- mui.alert('请输入房东关系!') //房东关系
- } else if($('#order_reception').val() == '') {
- mui.alert('请填写详细描述!') //填写详细描述
- } else {
- $.ajax({
- type: "post",
- dataType: 'json',
- url: huayi.config.callcenter_url + '/WxLogin/UpdateWorkOrder',
- async: true,
- data: {
- orderid: id,
- gdly: $('#order_source').attr('data-index'), //工单来源
- gdlx: $('.order_type').find('input[type="radio"]:checked').val(), //工单类型
- callCustomer: $('#order_name').val(), //客户姓名
- tel: $('#order_tel').val(), //否 string 联系电话
- areaid: $("#order_rengin").attr('data-index'), //区域名称
- proid: $("#order_pro").attr('data-index'), //项目名称
- buildingid: $("#order_floor").attr('data-index'), //楼号
- roomno: $('#order_room').val(), //房间号
- OwnerRelations: $('#ower_relationship').attr('data-index'), //房东关系
- customerresponseid: $('#order_response').find('input[type="radio"]:checked').val(), //否 int 客户反应
- fkcont: $('#order_reception').val(), //否 string 接待描述 - 反馈内容
- fkdep: $('#complaintOrder_type').attr('data-index'), //否 int 处理部门(投诉类型)
- kfdepid: $('#serviceOrder_type').attr('data-index'), //否int 客服类类型
- isquality: $('#is_quality_assurance').attr('data-index'), //否 int 是,//否过质保
- fkcont: $('#order_reception').val(), //描述详情
- auditusercode: $('#order_responsible').val(), //否 string 受理人
- openid: openid, //微信openid,
- },
- success: function(data) {
- if(data.state == "success") {
- debugger
- mui.toast('投诉成功');
- $('#order_type').val(''); //工单类型
- $("#order_name").val(''); //客户姓名
- $("#order_pro").val(); //项目名称
- $("#order_room").val(''); //房间号
- $(".ower_relationship").val(''); //房东关系
- $("#order_reception").val(''); //投诉人电话
- window.location.href = "details.html?id=" +id+'&itype='+itype;
- // window.location.reload();
- } else {
- mui.toast(data.message);
- }
- }
- });
- }
- })
- // 接收部门
- function getDepts() {}
- var recive = [];
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + 'Department/GetDeptList',
- async: false,
- data: {},
- dataType: 'json',
- success: function(data) {
- console.log(data)
- recive = data.data;
- }
- });
- //项目名称
- var areaList = [];
- console.log(areaList);
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + 'CusRegionCategory/GetListTreeDrop',
- async: false,
- data: {},
- dataType: 'json',
- success: function(data) {
- console.log(data)
- areaList = data.data;
- //alert(JSON.stringify(data));
- }
- });
- //接收人员
- function getReceiveUser() {
- renyuan=[]
- $.ajax({
- url: huayi.config.callcenter_url + 'UserAccount/GetDeptUserList',
- type: 'get',
- data: {
- deptid: $('#recive_type').attr('data-index'),
- },
- dataType: "json",
- async: true,
- success: function(res) {
-
- if(res.state.toLowerCase() === "success") {
- res = res.data;
- if(res && res.length > 0) {
- res.forEach(function(v, i) {
- var obj1 = {};
- obj1.value = v.F_UserId;
- obj1.text = v.F_UserName;
- renyuan.push(obj1);
- //$('<option value="' + v.F_UserId + '">' + v.F_UserName + '</option>').appendTo('#order_recive');
- });
- cityPicker5.setData(renyuan);
- }
- }
- },
- });
- }
- // 受理人
- function getOrderResponsible() {
- shouli = [];
- $.ajax({
- url: huayi.config.callcenter_url + 'CallInScreen/GetUserListByBuildingidDrop',
- type: 'get',
- data: {
- depid: $('#complaintOrder_type').attr('data-index'), // 否 int 部门id
- arearid: $('#order_rengin').attr('data-index'), // 否 int 区域id
- proid: $('#order_pro').attr('data-index'), // 是 int 姓名/项目id
- buildingid: $('#order_floor').attr('data-index') // 否 int 楼号id
- },
- dataType: "json",
- async: true,
- success: function(res) {
- if(res.state.toLowerCase() === "success") {
- res = res.data;
-
- if(res && res.length > 0) {
- res.forEach(function(v, i) {
- var obj = {};
- obj.value = v.F_UserCode;
- obj.text = v.F_UserName;
- shouli.push(obj);
-
- //$('<option value="' + v.F_UserCode + '">' + v.F_UserName + '</option>').appendTo('#order_responsible');
- });
- zhuTiPicker7.setData(shouli);
- }
- }
- },
- });
- }
- //房东关系
- var keyList = [];
- console.log(keyList);
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + 'Dictionary/GetDicValueListByFlagWx',
- async: false,
- data: {
- flag: 'FZGX'
- },
- dataType: 'json',
- success: function(data) {
- var key_data = data.data;
- console.log(data.data);
- $(key_data).each(function(i, n) {
- var obj = {};
- obj.value = n.F_DictionaryValueId;
- obj.text = n.F_Name;
- keyList.push(obj)
- })
- }
- });
- (function($, doc) {
- $.init();
- $.ready(function() {
- // //项目名称
- var ZTiPickers = new $.PopPicker({
- layer: 3
- });
- ZTiPickers.setData(areaList);
- var ZXs = doc.getElementById('showZhuTiPicker');
- var ZXResults = doc.getElementById('order_rengin');
- var ZXResults2 = doc.getElementById('order_pro');
- var ZXResults3 = doc.getElementById('order_floor');
- ZXs.addEventListener('tap', function(event) {
- ZTiPickers.show(function(items) {
- console.log(items)
- ZXResults.value =items[0].text + "-" + items[1].text + "-" + items[2].text;
- ZXResults.setAttribute("data-index", items[0].id);
- ZXResults2.setAttribute("data-index", items[1].id);
- ZXResults3.setAttribute("data-index", items[2].id);
- //返回 false 可以阻止选择框的关闭
- //return false;
- });
- }, false);
- //接收部门
- var RCiPickers = new $.PopPicker({
- layer: 3
- });
- RCiPickers.setData(recive);
- var RCs = doc.getElementById('showUserPicker1');
- var RCResults = doc.getElementById('recive_type');
- RCs.addEventListener('tap', function(event) {
- RCiPickers.show(function(items) {
- console.log(items)
- if (items[2].text==undefined) {
- RCResults.value =items[1].text;
- RCResults.setAttribute("data-index", items[1].id);
- } else if (items[1].text==undefined) {
- RCResults.value = items[0].text;
- RCResults.setAttribute("data-index", items[0].id);
- } else{
- RCResults.value =items[2].text
- RCResults.setAttribute("data-index", items[2].id);
- }
- //返回 false 可以阻止选择框的关闭
- //return false;
- });
- }, false);
- // 接收人员
- cityPicker5 = new $.PopPicker();
-
- var showCityPickerButton5 = doc.getElementById('showCityPicker5');
- var cityResult5 = doc.getElementById('ower_recive');
- showCityPickerButton5.addEventListener('tap', function(event) {
- getReceiveUser()
- cityPicker5.show(function(items) {
- cityResult5.value = items[0].text;
- cityResult5.setAttribute("data-index", items[0].value);
- //返回 false 可以阻止选择框的关闭
- //return false;
- });
- }, false);
- // //房东关系
- var cityPicker3 = new $.PopPicker();
- cityPicker3.setData(keyList);
- var showCityPickerButton = doc.getElementById('showCityPicker3');
- var cityResult3 = doc.getElementById('ower_relationship');
- showCityPickerButton.addEventListener('tap', function(event) {
- cityPicker3.show(function(items) {
- cityResult3.value = items[0].text;
- cityResult3.setAttribute("data-index", items[0].value);
- //返回 false 可以阻止选择框的关闭
- //return false;
- });
- }, false);
- //受理人
- zhuTiPicker7 = new $.PopPicker();
-
- var showZhuTiPickerButton7 = doc.getElementById('showUserPicker2');
- var zhuTiResult7 = doc.getElementById('order_responsible');
- showZhuTiPickerButton7.addEventListener('tap', function(event) {
- getOrderResponsible()
-
- zhuTiPicker7.show(function(items) {
- zhuTiResult7.value = items[0].text;
- zhuTiResult7.setAttribute("data-index", items[0].value);
- //返回 false 可以阻止选择框的关闭
- //return false;
- });
- }, false);
- //投诉类型
- var userPicker = new $.PopPicker({
- layer: 3
- });
- userPicker.setData(cityData3);
- var showUserPickerButton = doc.getElementById('showUserPicker');
- var userResult = doc.getElementById('complaintOrder_type');
- var userResult2 = doc.getElementById('serviceOrder_type');
- var userResult3 = doc.getElementById('is_quality_assurance');
- showUserPickerButton.addEventListener('tap', function(event) {
- userPicker.show(function(items) {
- if (items[2].text==undefined) {
- userResult.value = items[0].text + "-" + items[1].text;
- } else if (items[1].text==undefined) {
- userResult.value = items[0].text;
- } else{
- userResult.value =items[0].text + "-" + items[1].text + "-" + items[2].text
- }
- //userResult.value = items[0].text + "-" + items[1].text + "-" + items[2].text;
- userResult.setAttribute("data-index", items[0].value);
- userResult2.setAttribute("data-index", items[1].value);
- userResult3.setAttribute("data-index", items[2].value);
- //返回 false 可以阻止选择框的关闭
- //return false;
- });
- }, false);
-
- })
- })(mui, document);
- })
|