(window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-4f56"],{"2Q0y":function(e,t,a){"use strict";a.r(t);var r=a("P2sY"),i=a.n(r),l=a("ip1f"),o={name:"Freight",components:{Pagination:a("Mz3J").a},filters:{defaultFreePriceFilter:function(e){return e<0?"不包邮":0===e?"包邮":"满"+e+"元包邮"}},data:function(){var e=function(e,t,a){parseInt(t)<=0&&a(new Error("需要大于零")),parseInt(t)>1e7&&a(new Error("需要小于1千万")),a()},t=function(e,t,a){parseInt(t)<0&&a(new Error("需要大于等于零")),parseInt(t)>1e7&&a(new Error("需要小于1千万")),a()};return{list:void 0,total:0,listLoading:!0,carriage:void 0,dialogStatus:"",dialogFormVisible:!1,specList:void 0,specVisiable:!1,listQuery:{},textMap:{update:"编辑",create:"创建"},dataForm:{templateId:void 0,templateName:void 0,spuLocation:void 0,isFree:1,deliveryDeadline:void 0,defaultFreePrice:void 0,defaultFirstPrice:void 0,defaultFirstNum:void 0,defaultContinuePrice:void 0,defaultContinueNum:void 0,freightTemplateCarriageDOList:[]},specForm:{designatedAreaList:[],designatedArea:void 0,freePrice:void 0,firstNum:void 0,firstMoney:void 0,continueNum:void 0,continueMoney:void 0},provs:["北京市","天津市","河北省","山西省","内蒙古自治区","辽宁省","吉林省","黑龙江省","上海市","江苏省","浙江省","安徽省","福建省","江西省","山东省","河南省","湖北省","湖南省","广东省","广西壮族自治区","海南省","重庆市","四川省","贵州省","云南省","西藏自治区","陕西省","甘肃省","青海省","宁夏回族自治区","新疆维吾尔自治区","台湾省","香港特别行政区","澳门特别行政区"],rules:{templateName:[{required:!0,message:"模板名称不能为空",trigger:"blur"}],deliveryDeadline:[{required:!0,message:"发货期限不能为空",trigger:"blur"},{pattern:/^[0-9]*$/,message:"请输入整数"},{validator:e,trigger:"blur"}],defaultFreePrice:[{required:!0,message:"包邮门栏额度不能为空",trigger:"blur"},{pattern:/^[0-9]*$/,message:"请输入整数"},{validator:t,trigger:"blur"}],defaultFirstNum:[{required:!0,message:"首次计费数量不能为空",trigger:"blur"},{pattern:/^[0-9]*$/,message:"请输入整数"},{validator:e,trigger:"blur"}],defaultFirstPrice:[{required:!0,message:"首次计费价格不能为空",trigger:"blur"},{pattern:/^[0-9]*$/,message:"请输入整数"},{validator:t,trigger:"blur"}],defaultContinueNum:[{required:!0,message:"续件计费数量不能为空",trigger:"blur"},{pattern:/^[0-9]*$/,message:"请输入整数"},{validator:e,trigger:"blur"}],defaultContinuePrice:[{required:!0,message:"续件计费价格不能为空",trigger:"blur"},{pattern:/^[0-9]*$/,message:"请输入整数"},{validator:t,trigger:"blur"}]},specRules:{freePrice:[{required:!0,message:"包邮门栏额度不能为空",trigger:"blur"},{pattern:/^[0-9]*$/,message:"请输入整数"},{validator:t,trigger:"blur"}],firstNum:[{required:!0,message:"首次计费数量不能为空",trigger:"blur"},{pattern:/^[0-9]*$/,message:"请输入整数"},{validator:e,trigger:"blur"}],firstMoney:[{required:!0,message:"首次计费价格不能为空",trigger:"blur"},{pattern:/^[0-9]*$/,message:"请输入整数"},{validator:t,trigger:"blur"}],continueNum:[{required:!0,message:"续件计费数量不能为空",trigger:"blur"},{pattern:/^[0-9]*$/,message:"请输入整数"},{validator:e,trigger:"blur"}],continueMoney:[{required:!0,message:"续件计费价格不能为空",trigger:"blur"},{pattern:/^[0-9]*$/,message:"请输入整数"},{validator:t,trigger:"blur"}],designatedAreaList:[{required:!0,message:"至少选择一个地区",trigger:"blur"}]}}},created:function(){this.getList()},methods:{getList:function(){var e=this;this.listLoading=!0,Object(l.c)(this.listQuery).then(function(t){t.data.data.forEach(function(e){e.freightTemplateDO.defaultContinueMoney=e.freightTemplateDO.defaultContinueMoney/100,e.freightTemplateDO.defaultFirstMoney=e.freightTemplateDO.defaultFirstMoney/100,e.freightTemplateDO.defaultFreePrice=e.freightTemplateDO.defaultFreePrice/100,e.freightTemplateCarriageDOList.forEach(function(e){e.freePrice=e.freePrice/100,e.firstMoney=e.firstMoney/100,e.continueMoney=e.continueMoney/100})}),e.list=t.data.data,e.listLoading=!1}).catch(function(){e.list=[],e.listLoading=!1})},resetData:function(){this.dataForm={templateId:void 0,templateName:void 0,spuLocation:void 0,isFree:1,deliveryDeadline:void 0,defaultFreePrice:void 0,defaultFirstPrice:void 0,defaultFirstNum:void 0,defaultContinuePrice:void 0,defaultContinueNum:void 0,freightTemplateCarriageDOList:[]}},resetSpec:function(){this.specForm={designatedAreaList:[],designatedArea:void 0,freePrice:void 0,firstNum:void 0,firstMoney:void 0,continueNum:void 0,continueMoney:void 0}},deleteBtn:function(e){var t=this;this.$confirm("此操作将永久删除该运费模板---"+e.freightTemplateDO.templateName+"---, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(function(){Object(l.b)(e.freightTemplateDO.id).then(function(a){t.$notify.success({title:"成功",message:"删除运费模板成功"});var r=t.list.indexOf(e);t.list.splice(r,1)}).catch(function(e){t.$notify.error({title:"失败",message:e.data.errmsg})})}).catch(function(){return!1})},createHandle:function(){var e=this;this.resetData(),this.dialogStatus="create",this.dialogFormVisible=!0,this.$nextTick(function(){e.$refs.dataForm.clearValidate()})},createData:function(){var e=this;this.dataForm.isFree<=0&&(this.dataForm.defaultFreePrice=this.dataForm.isFree),this.$refs.dataForm.validate(function(t){t&&(e.multiplyHundred(e.dataForm),Object(l.a)(e.dataForm).then(function(t){e.getList(),e.dialogFormVisible=!1,e.$notify.success({title:"成功",message:"创建运费模板成功"})}).catch(function(t){e.$notify.error({title:"失败",message:t.data.errmsg})}))})},handleSpecified:function(){var e=this;this.specVisiable=!0,this.resetSpec(),this.$nextTick(function(){e.$refs.specForm.clearValidate()})},updateBtn:function(e){var t=this;this.resetData(),this.dataForm=i()({},{templateId:e.freightTemplateDO.id,templateName:e.freightTemplateDO.templateName,spuLocation:e.freightTemplateDO.spuLocation,deliveryDeadline:e.freightTemplateDO.deliveryDeadline,defaultFreePrice:e.freightTemplateDO.defaultFreePrice,defaultFirstPrice:e.freightTemplateDO.defaultFirstMoney,defaultFirstNum:e.freightTemplateDO.defaultFirstNum,defaultContinuePrice:e.freightTemplateDO.defaultContinueMoney,defaultContinueNum:e.freightTemplateDO.defaultContinueNum,freightTemplateCarriageDOList:e.freightTemplateCarriageDOList,isFree:e.freightTemplateDO.defaultFreePrice>0?1:e.freightTemplateDO.defaultFreePrice}),this.dialogStatus="update",this.dialogFormVisible=!0,this.$nextTick(function(){t.$refs.dataForm.clearValidate()})},updateDate:function(){var e=this;this.dataForm.isFree<=0&&(this.dataForm.defaultFreePrice=this.dataForm.isFree),this.$refs.dataForm.validate(function(t){t&&(e.multiplyHundred(e.dataForm),Object(l.d)(e.dataForm).then(function(t){e.getList(),e.dialogFormVisible=!1,e.$notify.success({title:"成功",message:"修改运费模板成功"})}).catch(function(t){e.$notify.error({title:"失败",message:t.data.errmsg})}))})},handleSpecAdd:function(){var e=this;this.$refs.specForm.validate(function(t){if(t){e.specForm.designatedArea=e.specForm.designatedAreaList.join(",");var a=i()({},e.specForm);e.dataForm.freightTemplateCarriageDOList.unshift(a),e.specVisiable=!1}})},handleSpecDelete:function(e){var t=this;this.$confirm("此操作将删除该指定地区, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(function(){var a=t.dataForm.freightTemplateCarriageDOList.indexOf(e);t.dataForm.freightTemplateCarriageDOList.splice(a,1)}).catch(function(){return!1})},multiplyHundred:function(e){e.defaultFreePrice=100*e.defaultFreePrice,e.defaultFirstPrice=100*e.defaultFirstPrice,e.defaultContinuePrice=100*e.defaultContinuePrice;for(var t=0;t