; var addlogistics = new Vue({ el:'#qualifications', data:{ open:false, pageType:'', shopOrderId:0, logisticsBatchId:0, selectGoods:false, productActions:[], qualificationsList:[ { productName:'请选择商品', recordId:'', sn:'', fileList:[], imageList:[] } ] }, methods:{ GetSupplierQualificationData:function(logisticsBatchId){//编辑回显商品资质信息 var _this = this; SupplierApi.GetSupplierQualificationData({logisticsBatchId:logisticsBatchId},function(response){ if(response.code == 0 ){ var data = response.data; if(data && data.length > 0) { _this.qualificationsList = data; _this.isEmpty = false }else{ _this.isEmpty = true } }else{ CAIMEI.Alert(response.msg, '确定', false); } }) }, GetSupplierLogisticsRecord:function(logisticsBatchId){//添加商品资质初始化查询商品信息 var _this = this; SupplierApi.GetSupplierLogisticsRecord({ logisticsBatchId : logisticsBatchId },function(response){ if(response.code == 0 ){ var data = response.data; data.forEach(function(el,index){ var obj = { id : el.id, productName : el.productName }; _this.productActions.push(obj) }); }else{ CAIMEI.Alert(response.msg, '确定', false); } }) }, editButtonConfim:function(){//确定添加商品资质信息 var _this = this; var params = []; _this.qualificationsList.forEach(function(el,index){ var obj = { recordId : el.recordId, sn : el.sn, files : el.fileList, images : el.imageList }; params.push(obj) }); SupplierApi.GetSupplierQualificationUpdata({ params:JSON.stringify(params) },function(response){ if(response.code == 0 ){ CAIMEI.dialog('保存资质成功'); }else{ CAIMEI.Alert(response.msg, '确定', false); } }) }, showViewerImageFn: function(index,imageIndex ){//预览图片 var _this = this; var DomEven = '#listViewImage'+index+''+imageIndex; var ViewerDom = document.querySelector(DomEven); _this.viewer = new Viewer(ViewerDom, {url:'data-image'}); }, showGoodSelect:function(){ var _this = this; _this.selectGoods = !_this.selectGoods; }, changeGoodsFn:function(item,good){ //品牌列表 var _this = this; item.recordId = good.id; item.productName = good.productName; }, uploadImagesFn: function(index,array,event){//上传商品资质图片 var _this = this; var inputDOM = _this.$refs['Qualificationsimage'+index]; var file = inputDOM[0].files; var formData = new FormData(); formData.append('file', file[0]); PublicApi.uploadimg(formData,function(response){ array.push(response.data); event.target.value = ''; }); }, uploadFileFn : function(index,array,event){//上传承诺函文件 var _this = this; var inputDOM = _this.$refs['QualificationsFile'+index]; var file = inputDOM[0].files; console.log('file========>',file); var formData = new FormData(); formData.append('file', file[0]); PublicApi.uploadFile(formData,function(response){ var obj = { fileName:response.data.fileName, ossName:response.data.ossName }; array.push(obj); console.log('array',array); event.target.value = ''; }); }, removeGoodsImagesFn: function(index){//删除商品图片 var _this = this; _this.GoodsImagesList.splice(index,1); _this.secondParams.image =_this.GoodsImagesList.toString()+','; }, deleteImageFileFn: function(array,index){//删除图片 array.splice(index, 1); }, deleteFileFn:function(array,index){//删除商品资质文件 var _this = this; PublicApi.deleteOssFile({ ossName : array[index].ossName },function (response) { if (response.code==0){ array.splice(index, 1); }else{ console.log('删除文件异常提示===>',response.msg) } }) }, addListFn : function(){//添加商品 var _this = this; var obj ={ productName:'', recordId:'', sn:'', fileList:[], imageList:[ 'https://dss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=1194131577,2954769920&fm=26&gp=0.jpg', 'https://dss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=1194131577,2954769920&fm=26&gp=0.jpg' ] }; _this.qualificationsList.push(obj) }, deleteLogistItemFn: function(item,index){ var _this = this; CAIMEI.Modal('确认删除商品吗?','取消','确定',function () { _this.qualificationsList.splice(index, 1); }); }, editButtonCanel:function(){//暂不填写 var _this = this; window.location.href = '/supplier/order/delivery_record.html?shopOrderID='+_this.shopOrderId; } }, mounted:function () { var _self = this; _self.shopOrderId=CAIMEI.getUrlParam('shopOrderId'); _self.logisticsBatchId = CAIMEI.getUrlParam('logisticsBatchId'); _self.pageType = CAIMEI.getUrlParam('type'); if( _self.pageType == 'edit'){ _self.GetSupplierLogisticsRecord( _self.logisticsBatchId); _self.GetSupplierQualificationData( _self.logisticsBatchId); }else{ _self.GetSupplierLogisticsRecord(_self.logisticsBatchId); } _self.open=true; } });