| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282 |
- /**
- * 工单处理
- * */
- var openid = helper.cookies.get("openid");
- var id = helper.request.queryString("id");
- var countyPicker; //乡镇
- if(id) {
- //获取信息分类 、乡镇 及交办单位后获取 详情信息
- $.when(getTypeList(), getCounty()).then(function() {
- getWorkDetails(); //获取工单详情
- });
-
- var userCode = helper.cookies.get("usercode");
- $('#h_inquser').val(userCode);
- //获取当前日期
- var nowDate = helper.DateFormat.getNowDate();
- $('#h_inqtime').val(nowDate);
- $("#submit").on('tap', submitHandle);
- }
- function getWorkDetails() {
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + 'WxLogin/GetWorkOrder',
- async: true,
- data: {
- openid: openid,
- workorderid: id
- },
- success: function(data) {
- if($('#hy_loading')){
- $('#hy_loading').fadeOut();
- $('#hy_loading').remove();
- }
- data = JSON.parse(data);
- if(data.state.toLowerCase() == "success") {
- var con = data.data;
- if(con) {
- if(con.data && con.data.length > 0) {
- var res = con.data[0];
- $('#h_userName').val(res.Customer); //string 是 客户姓名
- countyPicker.pickers[0].setSelectedValue(res.County); //int 否 乡镇
- var sItems = countyPicker.getSelectedItems();
- $('#h_county').val(sItems[0].text);
- $('#h_county').attr('data-index', sItems[0].value);
- $('#h_address').val(res.Address); //string 否 住址
- $('#h_contents').val(res.Detail); //string 是 反映问题
- // $('#h_inquser').val(res.Inquser); //string 否 调查员
- // $('#h_inqtime').val(res.Inqtime); //string 否 调查时间
- // $('#h_infoType').val(res.InfoTypeID); //int 否 信息分类id,默认为0
- // $('#h_unit').val(res.UnitID); //int 否 交办单位id,默认为0
- // $('#h_cont').val(res.clcontent); //string 否 问题处理情况
- // $('#h_answer').val(res.Answer); //string 否 回访反馈情况
- // $('#h_remark').val(res.Remark); //string 否 备注
- //图片展示
- // var Files = res.File;
- // if(Files) {
- // $(Files).each(function(i, n) {
- // $('<div class="img-box"><img src="' + n.F_FileUrl + '" alt="" class="image-item" data-preview-src="" data-preview-group="1" /><div>').appendTo("#image-list");
- // })
- // }
- }
- }
- }
- }
- });
- }
- function submitHandle() {
- var that = this;
- if(!$.trim($("#h_userName").val())) {
- mui.toast("请您输入姓名后再提交");
- return;
- }
- if(!$.trim($("#h_contents").val())) {
- mui.toast("请您输入反映问题后再提交");
- return;
- }
- $.ajax({
- type: "post",
- url: huayi.config.callcenter_url + 'WxLogin/DealWorkOrder',
- async: true,
- beforeSend: function() {
- mui(that).button('loading');
- },
- data: {
- openid: openid, //string 是
- orderid: id, //string 是 工单编号
- cusname: $('#h_userName').val(), //string 是 客户姓名
- country: $('#h_county').attr('data-index'), //int 否 乡镇
- address: $('#h_address').val(), //string 否 住址
- content: $('#h_contents').val(), //string 是 反映问题
- issend: $('#h_resut').find('input[type="radio"]:checked').val(),
- inquser: $('#h_inquser').val(), //string 否 调查员
- inqtime: $('#h_inqtime').val(), //string 否 调查时间
- infotypeid: $('#h_infoType').attr('data-index'), //int 否 信息分类id,默认为0
- unitid: $('#h_unit').attr('data-index'), //int 否 交办单位id,默认为0
- cont: $('#h_cont').val(), //string 否 问题处理情况
- answer: $('#h_answer').val(), //string 否 回访反馈情况
- remark: $('#h_remark').val(), //string 否 备注
- },
- dataType: 'json',
- success: function(data) {
- mui(that).button('reset');
- if(data.state.toLowerCase() == "success") {
- mui.alert("提交成功", ' ', function() {
- window.location.href = 'WorkCL.html';
- });
- }
- },
- error: function(textStatus) {
- mui(that).button('reset');
- mui.toast('网络繁忙,请稍后再试...');
- },
- complete: function(XMLHttpRequest, textStatus) {
- mui(that).button('reset');
- if(textStatus == 'timeout') {
- var xmlhttp = window.XMLHttpRequest ? new window.XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHttp");
- xmlhttp.abort();
- mui.toast('网络超时,请稍后再试...');
- }
- },
- });
- }
- //信息分类
- function getTypeList() {
- var dtd = $.Deferred(); //在函数内部,新建一个Deferred对象
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + 'WxLogin/GetTypeList',
- async: false,
- data: {
- openid: openid,
- },
- dataType: 'json',
- success: function(data) {
- if(data.state.toLowerCase() == "success") {
- var res = data.data;
- if(res.length > 0) {
- //下拉弹出
- (function($, doc) {
- $.init();
- $.ready(function() {
- var t_countyDatas = [{
- value: 0,
- text: '请选择信息分类'
- }];
- res.forEach(function(item, index) {
- t_countyDatas.push({
- value: item.F_DictionaryValueId,
- text: item.F_Name
- });
- });
- var infoTypesPicker = new $.PopPicker();
- infoTypesPicker.setData(t_countyDatas);
- //信息分类
- var showInfoTypebtn = doc.getElementById('showInfoTypePicker');
- var infotypeRes = doc.getElementById('h_infoType');
- showInfoTypebtn.addEventListener('tap', function(event) {
- infoTypesPicker.show(function(items) {
- infotypeRes.value = items[0].text;
- infotypeRes.setAttribute("data-index", items[0].value);
- });
- }, false);
- });
- })(mui, document);
- }
- dtd.resolve(); // 改变Deferred对象的执行状态
- }
- }
- });
- return dtd.promise(); // 返回promise对象
- }
- //获取乡镇 及交办单位
- function getCounty() {
- var dtd = $.Deferred(); //在函数内部,新建一个Deferred对象
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + "WxLogin/GetAreaList",
- dataType: 'json',
- async: true,
- data: {
- openid: openid,
- },
- success: function(data) {
- if(data.state.toLowerCase() == "success") {
- var res = data.data;
- if(res.length > 0) {
- //下拉弹出
- (function($, doc) {
- $.init();
- $.ready(function() {
- var t_countyDatas = [{
- value: 0,
- text: '请选择乡镇'
- }];
- res.forEach(function(item, index) {
- t_countyDatas.push({
- value: item.F_DictionaryValueId,
- text: item.F_Name
- });
- });
- var t_unitDatas = [{
- value: 0,
- text: '请选择交办单位'
- }];
- res.forEach(function(item, index) {
- t_unitDatas.push({
- value: item.F_DictionaryValueId,
- text: item.F_Name
- });
- });
- countyPicker = new $.PopPicker();
- countyPicker.setData(t_countyDatas);
- var unitPicker = new $.PopPicker();
- unitPicker.setData(t_unitDatas);
- //乡镇
- var showCountybtn = doc.getElementById('showCountyPicker');
- var countyRes = doc.getElementById('h_county');
- showCountybtn.addEventListener('tap', function(event) {
- countyPicker.show(function(items) {
- countyRes.value = items[0].text;
- countyRes.setAttribute("data-index", items[0].value);
- });
- }, false);
- //交办单位
- var showUnitbtn = doc.getElementById('showUnitPicker');
- var unitRes = doc.getElementById('h_unit');
- showUnitbtn.addEventListener('tap', function(event) {
- unitPicker.show(function(items) {
- unitRes.value = items[0].text;
- unitRes.setAttribute("data-index", items[0].value);
- });
- }, false);
- });
- })(mui, document);
- }
- dtd.resolve(); // 改变Deferred对象的执行状态
- }
- }
- });
- return dtd.promise(); // 返回promise对象
- }
- //时间控件
- (function($, doc) {
- $.init();
- var btns = $('.btn');
- btns.each(function(i, btn) {
- btn.addEventListener('tap', function() {
- var _self = this;
- if(_self.picker) {
- _self.picker.show(function(rs) {
- _self.picker.dispose();
- _self.picker = null;
- });
- } else {
- var optionsJson = this.getAttribute('data-options') || '{}';
- var options = JSON.parse(optionsJson);
- var id = this.getAttribute('id');
- _self.picker = new $.DtPicker(options);
- _self.picker.show(function(rs) {
- document.getElementById("h_inqtime").value = rs.text;
- _self.picker.dispose();
- _self.picker = null;
- });
- }
- }, false);
- });
- })(mui, document);
|