|
|
@@ -0,0 +1,400 @@
|
|
|
+
|
|
|
+let vueList=new Vue({
|
|
|
+ el:"#list",
|
|
|
+ data:{
|
|
|
+ filterParams:{created_at:'',owner_id:'',order_number:'',logistic_number_return:'',mobile_sender:'',barcode_goods:'',
|
|
|
+ is_checked:'',created_at_start:'',created_at_end:'',id_quality_label:'',is_loaded:'',checked_numbers:'',paginate:'50'},
|
|
|
+ checkBoxAll:[],
|
|
|
+ rejectedBills:rejectedBills,
|
|
|
+ rejectedBills_checkBoxes:[],
|
|
|
+ owners:owners,
|
|
|
+ qualityLabels:qualityLabels,
|
|
|
+ },
|
|
|
+ mounted:function(){
|
|
|
+ $(".tooltipTarget").tooltip({'trigger':'hover'});
|
|
|
+ this.initInputs();
|
|
|
+ $('#list').removeClass('d-none');
|
|
|
+ },
|
|
|
+ methods:{
|
|
|
+ filterRun:function(){
|
|
|
+ let form=$("<form method='get'></form>");
|
|
|
+ this.filterParams['page']='';
|
|
|
+ for(let key in this.filterParams){
|
|
|
+ if(this.filterParams[key]){
|
|
|
+ form.append($("<input type='hidden' name='"+key+"' value='"+this.filterParams[key]+"'>"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $("body").append(form);
|
|
|
+ form.submit();
|
|
|
+ },
|
|
|
+ searchByFilters:function(e){
|
|
|
+ this.filterRun();
|
|
|
+ },
|
|
|
+ created_at_startChange:function(e){
|
|
|
+ this.filterParams.created_at_start=e.target.value;
|
|
|
+ this.filterRun();
|
|
|
+ },
|
|
|
+ created_at_endChange:function(e){
|
|
|
+ this.filterParams.created_at_end=e.target.value;
|
|
|
+ this.filterRun();
|
|
|
+ },
|
|
|
+ owner_idChange:function(e){
|
|
|
+ this.filterParams.owner_id=e.target.value;
|
|
|
+ this.filterRun();
|
|
|
+ },
|
|
|
+ is_checkedChange:function(e){
|
|
|
+ this.filterParams.is_checked=e.target.value;
|
|
|
+ this.filterRun();
|
|
|
+ },
|
|
|
+ id_quality_labelChange:function(e){
|
|
|
+ this.filterParams.id_quality_label=e.target.value;
|
|
|
+ this.filterRun();
|
|
|
+ },
|
|
|
+ is_loadedChange:function(e){
|
|
|
+ this.filterParams.is_loaded=e.target.value;
|
|
|
+ this.filterRun();
|
|
|
+ },
|
|
|
+ initInputs:function(){
|
|
|
+ let data=this;
|
|
|
+ // let uriParts = decodeURI(location.href).split("?");
|
|
|
+ // if(uriParts.length>1){
|
|
|
+ // let params = uriParts[1].split('&');
|
|
|
+ // params.forEach(function(paramPair){
|
|
|
+ // let pair=paramPair.split('=');
|
|
|
+ // let key = pair[0], val = pair[1];
|
|
|
+ // $('input[name="'+key+'"]').val(val);
|
|
|
+ // $('select[name="'+key+'"]').val(val);
|
|
|
+ // data.filterParams[key]=val;
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ for(let key in paginateParams){
|
|
|
+ let val = paginateParams[key];
|
|
|
+ $('input[name="'+key+'"]').val(val);
|
|
|
+ $('select[name="'+key+'"]').val(val);
|
|
|
+ data.filterParams[key]=val;
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ edit:function(e){
|
|
|
+ let id = $(e.target).parents('tr').attr('data-id');
|
|
|
+ let editFullUri = editUrl+id+"/edit";
|
|
|
+ // location.href = editFullUri;
|
|
|
+ let form=$('<form action=\"'+editFullUri+'\" method="post" target="_blank"></form>');
|
|
|
+ form.append('<input type="hidden" name="filterParams" value=\''+JSON.stringify(this.filterParams)+'\'/>');
|
|
|
+ form.append(csrfInput);
|
|
|
+ $('body').append(form);
|
|
|
+ form.submit();
|
|
|
+ },
|
|
|
+ destroy:function(rejectedBill){
|
|
|
+ if(!confirm('确定要删除退货信息“' + rejectedBill.owner.name+':'+rejectedBill.logistic_number_return+ '”吗?')){return;}
|
|
|
+ let data=this;
|
|
|
+ let url = destroyUrl+rejectedBill.id;
|
|
|
+ axios.delete(url,{id:rejectedBill.id})
|
|
|
+ .then(function (response) {
|
|
|
+ if(response.data.success){
|
|
|
+ for (let i = 0; i < data.rejectedBills.length; i++) {
|
|
|
+ if (data.rejectedBills[i].id===rejectedBill.id){
|
|
|
+ data.rejectedBills.splice(i,1);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ tempTip.setDuration(1000);
|
|
|
+ tempTip.showSuccess('删除退货信息"'+rejectedBill.owner.name+':'+rejectedBill.logistic_number_return+'"成功!')
|
|
|
+ }else{
|
|
|
+ tempTip.setDuration(1000);
|
|
|
+ tempTip.show('删除退货信息"'+rejectedBill.owner.name+':'+rejectedBill.logistic_number_return+'"失败!')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(function (err) {
|
|
|
+ tempTip.setDuration(3000);
|
|
|
+ tempTip.show('删除退货信息失败!'+'网络错误:' + err);
|
|
|
+ console.log(err);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ submitFilterOnEnter:function(e){
|
|
|
+ if(e.key==='Enter'){
|
|
|
+ this.filterRun();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created_at_startEntering:function(e){
|
|
|
+ if(e.key==='Enter'){
|
|
|
+ this.created_at_startChange(e)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created_at_endEntering:function(e){
|
|
|
+ if(e.key==='Enter'){
|
|
|
+ this.created_at_endChange(e)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ owner_idEntering:function(e){
|
|
|
+ if(e.key==='Enter'){
|
|
|
+ e.target.value=$('#owner_id').val();
|
|
|
+ this.owner_idChange(e);
|
|
|
+ e.target.value='';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ locateOwner:function (e) {
|
|
|
+ str = e.target.value.trim()
|
|
|
+ if (str==='')return ;
|
|
|
+ $("#owner_id option").attr("selected",false);
|
|
|
+ let selectingOption=$("#owner_id").find("option:contains("+str+")").eq(0);
|
|
|
+ selectingOption.attr("selected",true);
|
|
|
+ this.filterParams.owner_id=selectingOption.val();
|
|
|
+ },
|
|
|
+ mobile_senderEntering:function(e){
|
|
|
+ this.filterParams.mobile_sender=e.target.value;
|
|
|
+ if(e.key==='Enter'){
|
|
|
+ this.filterRun();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ order_numberEntering:function(e){
|
|
|
+ this.filterParams.order_number=e.target.value;
|
|
|
+ if(e.key==='Enter'){
|
|
|
+ this.filterRun();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ barcode_goodsEntering:function(e){
|
|
|
+ this.filterParams.barcode_goods=e.target.value;
|
|
|
+ if(e.key==='Enter'){
|
|
|
+ this.filterRun();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ checked_numbersEntering:function(e){
|
|
|
+ this.filterParams.checked_numbers=e.target.value;
|
|
|
+ if(e.key==='Enter'){
|
|
|
+ this.filterRun();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ logistic_number_returnEntering:function(e){
|
|
|
+ this.filterParams.logistic_number_return=e.target.value;
|
|
|
+ if(e.key==='Enter'){
|
|
|
+ this.filterRun();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ logistic_numberEntering:function(e){
|
|
|
+ this.filterParams.logistic_number=e.target.value;
|
|
|
+ if(e.key==='Enter'){
|
|
|
+ this.filterRun();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ cancelCheckConfirmAll:function(){
|
|
|
+ $('#checkConfirmingAll').tooltip('hide');
|
|
|
+ setTimeout(function () {
|
|
|
+ $(".tooltipTarget").tooltip({'trigger':'hover'})
|
|
|
+ }, 10);
|
|
|
+ this.checkBoxAll=false;
|
|
|
+ this.rejectedBills.forEach(function(rejectedBill){
|
|
|
+ if(rejectedBill.is_checked===-1)
|
|
|
+ rejectedBill.is_checked='0';
|
|
|
+ })
|
|
|
+ },
|
|
|
+ setIsLoaded_batch:function(val){
|
|
|
+ let _this=this;
|
|
|
+ if(_this.rejectedBills_checkBoxes.length===0){
|
|
|
+ tempTip.show('没有勾选记录');
|
|
|
+ $(e.target).val("");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let is_loaded=0;
|
|
|
+ let is_loadedLabel='否';
|
|
|
+ if(parseInt(val)===1){
|
|
|
+ is_loaded=1;
|
|
|
+ is_loadedLabel='是';
|
|
|
+ }else if(parseInt(val)===2){
|
|
|
+ is_loaded=2;
|
|
|
+ is_loadedLabel='待推单';
|
|
|
+ }else if(parseInt(val)===4){
|
|
|
+ is_loaded=4;
|
|
|
+ is_loadedLabel='待确认';
|
|
|
+ }else if(val==="null"){
|
|
|
+ is_loaded='null';
|
|
|
+ is_loadedLabel='无需入库';
|
|
|
+ }
|
|
|
+ if(!confirm("确定要标记所有勾选入库情况为'"+is_loadedLabel+"'吗")){return;}
|
|
|
+ axios.post(ajaxCheckUrl,{ids:_this.rejectedBills_checkBoxes,is_loaded:is_loaded}).then(function(response){
|
|
|
+ if(response.data.success){
|
|
|
+ _this.rejectedBills_checkBoxes.forEach(function(id){
|
|
|
+ _this.rejectedBills.forEach(function(bill){
|
|
|
+ if(bill.id===id){
|
|
|
+ bill.is_loaded=is_loaded;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ tempTip.setDuration(1000);
|
|
|
+ tempTip.showSuccess('修改勾选记录的入库状态成功');
|
|
|
+ }else{
|
|
|
+ tempTip.setDuration(2500);
|
|
|
+ tempTip.show('修改勾选记录的入库状态失败,错误:'+response.data.fail_info);
|
|
|
+ }
|
|
|
+ }).catch(function (e) {
|
|
|
+ alert('网络连接错误:'+e);
|
|
|
+ tempTip.setDuration(2500);
|
|
|
+ tempTip.show('审核勾选内容失败,网络连接错误:'+e);
|
|
|
+ console.log(e);
|
|
|
+ });
|
|
|
+ $(e.target).val("")
|
|
|
+ },
|
|
|
+ checkBoxAllToggle:function(e){
|
|
|
+ let _this=this;
|
|
|
+ if(_this.rejectedBills_checkBoxes.length>=this.rejectedBills.length){
|
|
|
+ _this.rejectedBills_checkBoxes=[];
|
|
|
+ _this.checkBoxAll=[];
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ _this.rejectedBills_checkBoxes=[];
|
|
|
+ this.rejectedBills.forEach(function(bill){
|
|
|
+ _this.rejectedBills_checkBoxes.push(bill.id);
|
|
|
+ _this.checkBoxAll=[1];
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ checkAll:function(){
|
|
|
+ let _this=this;
|
|
|
+ if(_this.rejectedBills_checkBoxes.length===0){
|
|
|
+ tempTip.show('没有勾选记录');
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if(!confirm("确定要标记所有勾选内容为'已审核'吗")){return;}
|
|
|
+ axios.post(ajaxCheckAllURL,{ids:_this.rejectedBills_checkBoxes}).then(function(response){
|
|
|
+ if(response.data.success){
|
|
|
+ response.data.rejecteds.forEach(function (rejected) {
|
|
|
+ _this.rejectedBills.forEach(function(rejectedBill){
|
|
|
+ if(parseInt(rejectedBill.id)===parseInt(rejected.id)){
|
|
|
+ rejectedBill.is_checked=1;
|
|
|
+ rejectedBill.checked_numbers=rejected.checked_numbers;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ tempTip.setDuration(1000);
|
|
|
+ tempTip.showSuccess('审核勾选内容成功');
|
|
|
+ }else{
|
|
|
+ tempTip.setDuration(2500);
|
|
|
+ tempTip.show('审核勾选内容失败,错误:'+response.data.fail_info);
|
|
|
+ }
|
|
|
+ }).catch(function (e) {
|
|
|
+ alert('网络连接错误:'+e);
|
|
|
+ tempTip.setDuration(2500);
|
|
|
+ tempTip.show('审核勾选内容失败,网络连接错误:'+e);
|
|
|
+ console.log(e);
|
|
|
+ })
|
|
|
+ },
|
|
|
+ confirmBeStored:function($e,id){
|
|
|
+ let _this=this;
|
|
|
+ axios.post(ajaxConfirmBeStoredUrl,{id:id}).then(function(response){
|
|
|
+ if(response.data.success){
|
|
|
+ _this.rejectedBills.forEach(function(rejectedBill){
|
|
|
+ if(rejectedBill.id===id){
|
|
|
+ rejectedBill.is_loaded=1;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ tempTip.setDuration(1000);
|
|
|
+ tempTip.showSuccess('确认入库成功');
|
|
|
+ }else{
|
|
|
+ tempTip.setDuration(2500);
|
|
|
+ tempTip.okWindow('数据异常无法确认!请在WMS确定入库状态后,勾选该条目手动修改相应入库状态!','知道了')
|
|
|
+ }
|
|
|
+ }).catch(function (e) {
|
|
|
+ alert('确认失败,网络连接错误:'+e);
|
|
|
+ tempTip.setDuration(2500);
|
|
|
+ tempTip.show('确认失败,网络连接错误:'+e);
|
|
|
+ console.log(e);
|
|
|
+ })
|
|
|
+ },
|
|
|
+ finishAll:function(){
|
|
|
+ let _this=this;
|
|
|
+ if(_this.rejectedBills_checkBoxes.length===0){
|
|
|
+ tempTip.show('没有勾选记录');
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if(!confirm("确定要标记所有勾选内容为'已完结'吗")){return;}
|
|
|
+ axios.post(ajaxFinishAllUrl,{ids:_this.rejectedBills_checkBoxes}).then(function(response){
|
|
|
+ if(response.data.success){
|
|
|
+ _this.rejectedBills.forEach(function(rejectedBill){
|
|
|
+ _this.rejectedBills_checkBoxes.forEach(function (checkedId) {
|
|
|
+ if(rejectedBill.id===checkedId){
|
|
|
+ rejectedBill.is_finished=1;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ tempTip.setDuration(1000);
|
|
|
+ tempTip.showSuccess('标记勾选内容为完结成功');
|
|
|
+ }else{
|
|
|
+ tempTip.setDuration(2500);
|
|
|
+ tempTip.show('标记勾选内容为完结失败,错误:'+response.data.fail_info);
|
|
|
+ }
|
|
|
+ }).catch(function (e) {
|
|
|
+ alert('网络连接错误:'+e);
|
|
|
+ tempTip.setDuration(2500);
|
|
|
+ tempTip.show('标记勾选内容完结失败,网络连接错误:'+e);
|
|
|
+ console.log(e);
|
|
|
+ })
|
|
|
+ },
|
|
|
+ exportExcel:function(val){
|
|
|
+ let _this=this;
|
|
|
+ let form;
|
|
|
+ if(parseInt(val)===1){
|
|
|
+ if(_this.rejectedBills_checkBoxes.length===0){
|
|
|
+ tempTip.show('没有勾选记录');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ form=$('<form action=\"'+exportExcelURL+'\" method="post" target="_blank"></form>');
|
|
|
+ form.append('<input type="hidden" name="ids" value=\''+JSON.stringify(_this.rejectedBills_checkBoxes)+'\'/>');
|
|
|
+ }
|
|
|
+ if(parseInt(val)===2){
|
|
|
+ if(!confirm("确定要导出当前条件下全部页的结果吗?")){return;}
|
|
|
+ /* if(total>100000){
|
|
|
+ tempTip.okWindow('当前导出记录超过100000条,将不会导出已完结的记录','知道了')
|
|
|
+ }*/
|
|
|
+ form=$('<form action=\"'+exportExcelOnFilterParamsURL+'\" method="post" target="_blank"></form>');
|
|
|
+ form.append('<input type="hidden" name="filterParams" value=\''+JSON.stringify(_this.filterParams)+'\'/>');
|
|
|
+
|
|
|
+ }
|
|
|
+ form.append('<input type="hidden" name="created_at_start" value=\''+JSON.stringify(_this.filterParams.created_at_start)+'\'/>');
|
|
|
+ form.append('<input type="hidden" name="created_at_end" value=\''+JSON.stringify(_this.filterParams.created_at_end)+'\'/>');
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ form.append(csrfInput);
|
|
|
+ $('#list').append(form);
|
|
|
+ form.submit();
|
|
|
+ tempTip.setDuration(5000);
|
|
|
+ tempTip.showSuccess("导出成功,如无结果则是被浏览器拦截新窗口,请尝试再次请求,或关闭浏览器对当前页面的弹出窗口拦截")
|
|
|
+ },
|
|
|
+ setPaginate:function(e){
|
|
|
+ let _this=this;
|
|
|
+ // let val=$(e.target).val();
|
|
|
+ this.filterParams.paginate=e.target.value;
|
|
|
+ this.filterRun();
|
|
|
+ },
|
|
|
+
|
|
|
+ },
|
|
|
+ computed:{
|
|
|
+ isBeingFilterConditions:function(){
|
|
|
+ for(let key in this.filterParams){
|
|
|
+ if(this.filterParams[key]){
|
|
|
+ if(key==='paginate')continue;
|
|
|
+ if(key==='page')continue;
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ filters:{
|
|
|
+ yesNo:function (val) {
|
|
|
+ if(!val||val===0||val==='0'){return '否'}
|
|
|
+ return '是'
|
|
|
+ },
|
|
|
+ yesNoIsLoaded:function (val) {
|
|
|
+ switch(val){
|
|
|
+ case 0:case '0':return '否';
|
|
|
+ case 1:case '1':return '是';
|
|
|
+ case 2:case '2':return '待推单';
|
|
|
+ case 3:case '3':return '交互异常';
|
|
|
+ case 4:case '4':return '待确认';
|
|
|
+ case null:case 'null':return '无需入库';
|
|
|
+ }
|
|
|
+ return '';
|
|
|
+ }
|
|
|
+ }
|
|
|
+});
|