(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-246590bc"],{"09f4":function(e,t,a){"use strict";a.d(t,"a",(function(){return o})),Math.easeInOutQuad=function(e,t,a,i){return e/=i/2,e<1?a/2*e*e+t:(e--,-a/2*(e*(e-2)-1)+t)};var i=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(e){window.setTimeout(e,1e3/60)}}();function n(e){document.documentElement.scrollTop=e,document.body.parentNode.scrollTop=e,document.body.scrollTop=e}function r(){return document.documentElement.scrollTop||document.body.parentNode.scrollTop||document.body.scrollTop}function o(e,t,a){var o=r(),l=e-o,s=20,c=0;t="undefined"===typeof t?500:t;var u=function e(){c+=s;var r=Math.easeInOutQuad(c,o,l,t);n(r),c0,expression:"total > 0"}],attrs:{total:e.total,page:e.listQuery.page,limit:e.listQuery.limit},on:{"update:page":function(t){return e.$set(e.listQuery,"page",t)},"update:limit":function(t){return e.$set(e.listQuery,"limit",t)},pagination:e.getList}}),a("el-dialog",{attrs:{visible:e.dialogVisible,title:e.dialogTitle},on:{"update:visible":function(t){e.dialogVisible=t},open:e.onOpen,close:e.onClose}},[a("el-form",{ref:"elForm",attrs:{model:e.formData,rules:e.rules,size:"medium","label-width":"120px"}},[a("el-form-item",{attrs:{label:"请选择平台",prop:"os"}},[a("el-select",{attrs:{placeholder:"请选择平台",clearable:""},model:{value:e.formData.os,callback:function(t){e.$set(e.formData,"os",t)},expression:"formData.os"}},e._l(e.ossArr,(function(e,t){return a("el-option",{key:e.id,attrs:{label:e.os,value:e.id}})})),1)],1),a("el-form-item",{attrs:{label:"产品名称",prop:"product_name"}},[a("el-input",{attrs:{placeholder:"请输入产品名称",clearable:""},model:{value:e.formData.product_name,callback:function(t){e.$set(e.formData,"product_name",t)},expression:"formData.product_name"}})],1),a("el-form-item",{attrs:{label:"第三方产品编号",prop:"third_product_id"}},[a("el-input",{attrs:{placeholder:"请输入第三方产品编号",clearable:""},model:{value:e.formData.third_product_id,callback:function(t){e.$set(e.formData,"third_product_id",t)},expression:"formData.third_product_id"}})],1),a("el-form-item",{attrs:{label:"天数",prop:"day"}},[a("el-input",{attrs:{placeholder:"请输入天数",clearable:""},model:{value:e.formData.day,callback:function(t){e.$set(e.formData,"day",t)},expression:"formData.day"}})],1),a("el-form-item",{attrs:{label:"晚数",prop:"night"}},[a("el-input",{attrs:{placeholder:"请输入晚数",clearable:""},model:{value:e.formData.night,callback:function(t){e.$set(e.formData,"night",t)},expression:"formData.night"}})],1),a("el-form-item",{attrs:{label:"出游类型",prop:"type"}},[a("el-radio-group",{attrs:{size:"medium"},model:{value:e.formData.type,callback:function(t){e.$set(e.formData,"type",t)},expression:"formData.type"}},e._l(e.fieldTypeOptions,(function(t,i){return a("el-radio",{key:t.value,attrs:{label:t.value}},[e._v(e._s(t.label))])})),1)],1),a("el-form-item",{attrs:{label:"详细行程",prop:"trip_info",required:""}},[a("el-upload",{ref:"field105",attrs:{action:"","before-upload":e.wordBeforeUpload,"http-request":e.handlesAvatarSuccess,"on-success":e.handleWordSuccess,"on-error":e.handleUploadError,"on-remove":e.handleRemove,"on-change":e.handleChange,"before-remove":e.beforeRemove,limit:1,"file-list":e.fieldFileList,accept:".pdf,.docx,.xlsx"}},[a("el-button",{attrs:{size:"small",type:"primary",icon:"el-icon-upload"}},[e._v("点击上传")])],1)],1)],1),a("div",{attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:e.close}},[e._v("取消")]),a("el-button",{attrs:{type:"primary"},on:{click:e.handelConfirm}},[e._v("确定")])],1)],1)],1)},n=[],r=a("c7eb"),o=a("1da1"),l=a("5530"),s=(a("99af"),a("c740"),a("caad"),a("d81d"),a("fb6a"),a("a434"),a("b0c0"),a("333d")),c=a("50fc"),u=a("5f87"),d={name:"ProManagement",components:{Pagination:s["a"]},data:function(){return{listQuery:{page:1,limit:10},total:0,listLoading:!0,list:[],ossArr:[],dialogVisible:!1,dialogTitle:"新增商品",fieldFileList:[],formData:{os:"",product_name:"",type:"",day:"",night:"",third_product_id:"",trip_info:""},fieldAction:"//admin/upload/index",fieldTypeOptions:[{label:"境内",value:1},{label:"境外",value:2}],rules:{os:[{required:!0,message:"请选择平台",trigger:"change"}],product_name:[{required:!0,message:"请输入线路名称",trigger:"blur"}],day:[{required:!0,message:"请输入天数",trigger:"blur"}],night:[{required:!0,message:"请输入晚数",trigger:"blur"}],third_product_id:[{required:!0,message:"请输入第三方产品编号",trigger:"blur"}],type:[{required:!0,message:"请选择出游类型",trigger:"change"}]},editType:""}},created:function(){this.getList()},methods:{handleCreate:function(e,t){this.editType=e,"add"===e?this.AddProduct():this.editProduct(t)},AddProduct:function(){this.dialogTitle="新增商品",this.dialogVisible=!0},editProduct:function(e){console.log(e,"row"),this.formData=Object(l["a"])({},e),this.dialogTitle="编辑商品",this.dialogVisible=!0},getList:function(){var e=this;return Object(o["a"])(Object(r["a"])().mark((function t(){var a;return Object(r["a"])().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return console.log("this.listQuery",e.listQuery),t.next=3,Object(c["f"])(e.listQuery);case 3:a=t.sent,0===a.error&&(e.listLoading=!1,e.total=a.data.total,e.list=a.data.data,e.ossArr=a.ext.oss);case 5:case"end":return t.stop()}}),t)})))()},onWork:function(e){this.$router.push("/system/proScheduling?id=".concat(e))},handleChange:function(e,t){this.fileList=t.slice(-1)},handlesAvatarSuccess:function(e){var t=this;return Object(o["a"])(Object(r["a"])().mark((function a(){var i,n,o,l;return Object(r["a"])().wrap((function(a){while(1)switch(a.prev=a.next){case 0:return a.prev=0,i=new FormData,i.append("file",e.file),a.next=5,t.$axios.post("/admin/upload/index",i,{headers:{"Content-type":"multipart/form-data","X-Token":Object(u["a"])()}});case 5:n=a.sent,console.log(n,"收拾收拾"),0===n.error&&e.onSuccess(n),a.next=17;break;case 10:a.prev=10,a.t0=a["catch"](0),console.log(e,"error--handlesAvatarSuccess"),o=e.file.uid,l=t.$refs.field105.uploadFiles.findIndex((function(e){return e.uid===o})),t.$refs.field105.uploadFiles.splice(l,1),t.$message.error("上传失败");case 17:case"end":return a.stop()}}),a,null,[[0,10]])})))()},handleWordSuccess:function(e,t,a,i){console.log(e,t,a,"成功了"),e&&(this.formData.trip_info="".concat(window.location.protocol,"//").concat(window.location.host).concat(e.data),this.fieldFileList=[{name:t.name,uid:t.uid,url:this.formData.trip_info}],this.$message.success("上传成功"))},beforeRemove:function(e,t){return this.$confirm("确定移除 ".concat(e.name,"?"))},handleRemove:function(e,t){var a=this;console.log(e,t,"handleRemove"),this.formData.trip_info="",this.fieldFileList.map((function(t,i){t.uid===e.uid&&a.fieldFileList.splice(i,1)}))},handleUploadError:function(e,t){var a=this;this.$message.error("上传失败: ".concat(t.name)),console.log(this.fieldFileList,"失败了"),this.fieldFileList.map((function(e,i){e.uid===t.uid&&a.fieldFileList.splice(i,1)}))},wordBeforeUpload:function(e){var t=["application/pdf","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"].includes(e.type),a=e.size/1024/1024<2;return t||this.$message.error("只允许上传 PDF、DOCX、XLSX 格式的文件"),a||this.$message.error("文件大小超过 2MB"),t&&a},openLink:function(e){window.open(e)},onOpen:function(){},onClose:function(){this.$refs["elForm"].resetFields(),this.$refs.field105.uploadFiles=[]},close:function(){console.log("1111",this.$refs.field105.uploadFiles),this.dialogVisible=!1,this.$refs.field105.uploadFiles=[]},handelConfirm:function(){var e=this;this.$refs["elForm"].validate(function(){var t=Object(o["a"])(Object(r["a"])().mark((function t(a){var i;return Object(r["a"])().wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(a){t.next=2;break}return t.abrupt("return");case 2:return t.next=4,Object(c["g"])(e.formData);case 4:i=t.sent,0===i.error&&(e.getList(),e.$message({message:"add"===e.editType?"商品添加成功":"商品编辑成功",type:"success"})),e.close();case 7:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())}}},p=d,f=(a("62cb"),a("2877")),m=Object(f["a"])(p,i,n,!1,null,"b91865a6",null);t["default"]=m.exports}}]);