| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398 |
- mui.init({})
- var FullName = helper.cookies.get("fullname");
- var UserCode = helper.cookies.get("usercode");
- var UserType = helper.cookies.get("usertype");
- var openid = helper.cookies.get("openid");
- $(function () {
- $('#order_name').val(FullName);
- $('#order_tel').val(UserCode);
- // 投诉咨询切换
- $('.order_type').find('input[type="radio"]').on('change', function() {
- if($(this).val() === "108") { //投诉
- $('.complaintOrder').show(); //receive
- $('.receive').hide();
- } else {
- $('.receive').show();
- $('.complaintOrder').hide();
- }
- });
- //工单有效性
- $('#order_valid').find('input[type="radio"]').on('change', function() {
- //是否有效工单项(0有效,1无效)
- if($(this).val() === "1") { //无效
- $('.order_note').show();
- } else {
- $('.order_note').hide();
- }
- });
- Ajax();
- function Ajax() {
- $.ajax({
- url: huayi.config.callcenter_url + '/WxLogin/GetCustomer',
- data: {
- openid: openid, //微信openid,
- },
- async: true,
- dataType: 'json',
- type: 'get', //HTTP请求类型
- success: function(data) {
- if(data.state.toLowerCase()== "success") {
- var con=data.data;
- var CustomerNature;
- if(con.F_CustomerNatureID=="473"){
- CustomerNature="租赁"
- }else if(con.F_CustomerNatureID=="474"){
- CustomerNature="自用"
- }
- $("#order_name").val(con.F_CustomerName); //客户姓名
- $('#order_tel').val(con.F_Mobile); //电话 F_Layer
- $('#order_rengin').val(con.areaname+con.proname+con.stagename);//项目名称
- $("#order_rengin").attr('data-index',con.F_Layer); //区域id
- $("#order_pro").attr('data-index',con.F_CategoryId) //项目id
- $("#order_floor").attr('data-index',con.F_CustomerType) //期号id
- $('#order_tower').val(con.F_CustomerNature); //楼号
- $('#order_unit').val(con.F_CustomerClass); //单元号
- $('#order_room').val(con.roomname);//房间号
- $('#ower_relationship').val(CustomerNature);//房主关系
- $('#ower_relationship').attr('data-index',con.F_CustomerNatureID);//房主ids
- }
- }
-
- })
- }
- //提交按钮
- $('#submit').on('tap', function() {
- var myreg = /^[1][3,4,5,7,8][0-9]{9}$/;
- var myreg11 = /^(([0\+]\d{2,3}-)?((0\d{2,3}))?(-)?)?(\d{7,8})(-(\d{3,}))?$/;
- var str = $("#order_tel").val();
- if($('#order_type').val() == '') {
- mui.alert('请输入工单类型!') //请输入工单类型
- } else if($('#order_name').val() == '') {
- mui.alert('请输入客户姓名!') //请输入客户姓名
- } else if($('#order_tel').val() == '') {
- mui.alert('请输入电话!') //请输入客户姓名
- } else if (!myreg.test(str)&&!myreg11.test(str)) {
- 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/AddWorkOrder',
- async: true,
- data: {
- 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'), //项目名称
- buildingnum: $('#order_tower').val(),// 否 string 楼号
- unitnum: $('#order_unit').val(),// 否 string 单元
- buildingid: $("#order_floor").attr('data-index'), //楼号
- roomno: $('#order_room').val(), //房间号
- //OwnerRelations: $('#ower_relationship').attr('data-index'), //房东关系
- ownerrelationsid: $('#ower_relationship').attr('data-index'), //房东关系
- customerresponseid: $('#order_response').find('input[type="radio"]:checked').val(), //否 int 客户反应
- 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 受理人
- iseffective: $('#order_valid').find('input[type="radio"]:checked').val(), // 否 int 是否有效工单项(0有效,1无效)
- note: $('#order_note').val(), // 无效原因 否 string 备注 (iseffective,1无效时填写备注)
- clbm: $('#recive_type').attr('data-index'), //否 int 咨询类工单指派部门id
- clid: $('#ower_recive').attr('data-index'), // 否 string 接收人id $(this)
- //$('#order_receiveUser option').find("option:selected").val(),
- openid: openid,
- },
- success: function(data) {
- if(data.state == "success") {
- debugger
- // alert($('#order_reception').val()), //描述详情
- mui.toast('创建成功');
- $('#order_type').val(''); //工单类型
- $('#order_name').val(''), //客户姓名
- $('#order_tel').val(''), //否 string 联系电话
- $("#order_rengin").attr(''), //区域名称
- $("#order_pro").attr(''), //项目名称
- $("#order_floor").attr(''), //楼号
- $('#order_room').val(''), //房间号
- $('#ower_relationship').attr(''), //房东关系
- $('#order_response').find('input[type="radio"]:checked').val(), //否 int 客户反应
- $('#complaintOrder_type').attr(''), //否 int 处理部门(投诉类型)
- $('#serviceOrder_type').attr(''), //否int 客服类类型
- $('#is_quality_assurance').attr(''), //否 int 是,//否过质保
- $('#order_reception').val(''), //描述详情
- $('#order_responsible').val(''), //否 string 受理人
- $('#order_valid').find('input[type="radio"]:checked').val(), // 否 int 是否有效工单项(0有效,1无效)
- $('#order_note').val(''), // 无效原因 否 string 备注 (iseffective,1无效时填写备注)
- $('#recive_type').attr(''), //$('#order_transfer_dept').attr('data-id') 否 int 咨询类工单指派部门id
- $('#ower_recive').attr(''), // 否 string 接收人id $(this)
- window.location.href = "client_index.html";
- } else {
- mui.toast(data.message);
- }
- }
- });
- }
- })
- // 接收部门
- // function getDepts() {}
- // var recive = [];
- // $.ajax({
- // type: "get",
- // url: huayi.config.callcenter_url + 'Department/GetAssignDeptList',
- // async: false,
- // data: {},
- // dataType: 'json',
- // success: function(data) {
- // console.log(data)
- // recive = data.data;
- // //alert(JSON.stringify(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=[]
- // console.log(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;
- //// alert(obj1.text);
- // 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
- });
-
- 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.setData(areaList);
- ZTiPickers.show(function(items) {
- console.log(items)
- if (items[1].text==undefined) {
- ZXResults.value = items[0].text;
- } else if (items[2].text==undefined) {
- ZXResults.value =items[0].text + "-" +items[1].text;
- } else {
- 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');
- // var RCResults2 = doc.getElementById('recive_type1');
- // var RCResults3 = doc.getElementById('recive_type2');
- // 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);
- // }
- // //RCResults.value =items[0].text + "-" + items[1].text + "-" + items[2].text;
- // //RCResults.setAttribute("data-index", items[0].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.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);
- })
|