| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221 |
- mui.init({
- swipeBack: false,
- })
- mui.init({
- statusBarBackground:"#FF0000"
- });
- mui.plusReady(function() {
- var wv = plus.webview.currentWebview();
- var usercode = localStorage.getItem("user"); //获取本地存储
- var files;
- var Str = '';
- var str_ary;
- var reg = /,$/gi;
- //提交按钮
- $('#submit').on('tap', function() {
- $(".image-box").each(function(i, n) {
- var a = $(n).attr("indexs");
- if(a) {
- Str += a + ',';
- }
- })
- str_ary = Str.substring(0, Str.length - 1);
- // alert(str_ary);
- var myreg = /^[1][3,4,5,7,8][0-9]{9}$/;
- // /^(([0\+]\d{2,3}-)?((0\d{2,3}))?(-)?)?(\d{7,8})(-(\d{3,}))?$/
- var myreg11 = /^(([0\+]\d{2,3}-)?((0\d{2,3}))?(-)?)?(\d{7,8})(-(\d{3,}))?$/;
- var stre = $("#phone").val();
- var stre2 = $("#conphone").val();
- var stre3 = $("#conphone").val() == '';
- if($('#name').val() == '') {
- mui.alert('请输入姓名!')
- } else if($('#phone').val() == '') {
- mui.alert('请输入投诉电话!')
- } else if(!myreg.test(stre)&&!myreg11.test(stre)) {
- mui.alert('手机号格式不正确!')
- }else if($('#conphone').val() == '') {
- mui.alert('请输入联系电话!')
- } else if(!myreg.test(stre2)&&!myreg11.test(stre2)) {
- mui.alert('手机号格式不正确!')
- } else if($('#title').val() == '') {
- mui.alert('请输入诉求主题!')
- } else if($('.content').val() == '') {
- mui.alert('请输入诉求内容!')
- } else if($('#zhuTiResult').val() == '') {
- mui.alert('请选择主题词!')
- } else {
- $.ajax({
- type: "post",
- dataType: 'json',
- url: huayi.config.callcenter_url + '/APP/AddWorkOrder',
- async: true,
- data: {
- type: $('#userResult').attr('data-index'), //诉求类型
- keys: $('#zhuTiResult').attr('data-index'), //关键词
- isprotect: $('input[name="secret"]:checked').val(), //(0普通1保密)
- level: $('input[name="jinji"]:checked').val(), //=(1普通2紧急)
- cussex: $('input[name="cussex"]:checked').val(), //=(1男2女)
- title: $('#title').val(), //投诉主题
- email: $("#email").val(),//邮箱
- zipcode: $("#zipcode").val(),//邮编
- content: $('.content').val(), //投诉内容
- cusname: $('#name').val(), //投诉人姓名
- cusphone: $('#phone').val(), //投诉人电话
- conphone: $("#conphone").val(),//联系电话
- sourcearea: $('#cityResult3').attr('data-index'), //事发地域id
- sourceaddress: $('#detail_address').val(), //详细地址
- //issubmit:1, //=(0保存1保存并提交)
- files: str_ary,
- usercode: usercode,
- },
- success: function(data) {
- if(data.state == "success") {
- mui.toast('投诉成功');
- $("#name").val('');
- $("#phone").val('');
- $("#conphone").val();
- $("#title").val('');
- $(".content").val('');
- $("#cityResult3").val('');
- $("#zhuTiResult").val('');
- $("#userResult").val('');
- $("#source").val('');
- $('#detail_address').val('');
- $("#email").val('');
- $("#zipcode").val('');
- $('input[name="secret"][value="0"]').prop("checked", "checked");
- $('input[name="jinji"][value="0"]').prop("checked", "checked");
- $('input[name="cussex"][value="0"]').prop("checked", "checked");
- window.location.reload();
- } else {
- mui.toast(data.message);
- }
- }
- });
- }
- })
- // $(".space").on("click", function() {
- // if($(".image-box").length == 6) {
- // $(".space").hide();
- // } else {
- // $(".space").show();
- // }
- // });
- // $(".image-close").on("click", function() {
- // alert("ddd")
- // if($(".image-box").length < 6) {
- // $(".space").show();
- // }
- // });
- //工单类型
- var typeList = [];
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + 'Dictionary/GetDicValueListById?',
- async: false,
- data: {
- id: 2
- },
- dataType: 'json',
- success: function(data) {
- var type_data = data.data;
- $(type_data).each(function(i, n) {
- var obj = {};
- obj.value = n.F_ValueId;
- obj.text = n.F_Value;
- typeList.push(obj)
- })
- }
- });
- //事发地域
- var areaList = [];
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + 'web/GetWebAreaList',
- async: false,
- data: {},
- dataType: 'json',
- success: function(data) {
- var area_data = data.data;
- // area_data = JSON.stringify(area_data);
- console.log(area_data);
- $(area_data).each(function(i, n) {
- var obj = {};
- obj.value = n.F_AreaId;
- obj.text = n.F_AreaName;
- areaList.push(obj)
- console.log(obj);
- })
- }
- });
- //主题词
- var keyList = [];
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + 'Dictionary/GetDicValueListById?',
- async: false,
- data: {
- id: 3
- },
- dataType: 'json',
- success: function(data) {
- var key_data = data.data;
- $(key_data).each(function(i, n) {
- var obj = {};
- obj.value = n.F_ValueId;
- obj.text = n.F_Value;
- keyList.push(obj)
- })
- }
- });
- (function($, doc) {
- $.init();
- $.ready(function() {
- //诉求类型
- var userPicker = new $.PopPicker();
- userPicker.setData(typeList);
- var showUserPickerButton = doc.getElementById('showUserPicker');
- var userResult = doc.getElementById('userResult');
- showUserPickerButton.addEventListener('tap', function(event) {
- userPicker.show(function(items) {
- console.log(items)
- userResult.value = items[0].text;
- userResult.setAttribute("data-index", items[0].value);
- //返回 false 可以阻止选择框的关闭
- //return false;
- });
- }, false);
- //主题词
- var zhuTiPicker = new $.PopPicker();
- zhuTiPicker.setData(keyList);
- var showZhuTiPickerButton = doc.getElementById('showZhuTiPicker');
- var zhuTiResult = doc.getElementById('zhuTiResult');
- showZhuTiPickerButton.addEventListener('tap', function(event) {
- zhuTiPicker.show(function(items) {
- console.log(items)
- zhuTiResult.value = items[0].text;
- zhuTiResult.setAttribute("data-index", items[0].value);
- //返回 false 可以阻止选择框的关闭
- //return false;
- });
- }, false);
- //事件地址
- var cityPicker3 = new $.PopPicker();
- cityPicker3.setData(areaList);
- var showCityPickerButton = doc.getElementById('showCityPicker3');
- var cityResult3 = doc.getElementById('cityResult3');
- 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);
- })
- })(mui, document);
- });
|