import{n as c,_ as n}from"./index.13f93d3a.js";const d={name:"upload-trade",data(){return{category:{},categories:[]}},mounted(){const a=parseInt(this.$route.query.id),t=JSON.parse(sessionStorage.getItem("conf_categories"));this.category=t.find(s=>s.id===a);const e=this.$t("common.failure");this.$axios.get("/api/upload_type_list",{params:{pid:a}}).then(s=>{const{code:r,msg:o=e,data:i=[]}=s.data;r==0?this.categories=i:this.$message.error(o||e)}).catch(()=>{this.$message.error(e)})},methods:{backToInformation(){const{id:a}=this.$route.query;this.$router.push({path:"/upload/information",query:{id:a,category:"trade"}})},toSuccess(){this.$router.push({path:"/upload/success"})},uploadFile(a){const t=this.$t("common.failure"),e=JSON.parse(sessionStorage.getItem("conf_upload"));this.$axios.post("/api/product/add_product",{...e,type:[this.id,a]}).then(s=>{const{code:r,msg:o=t}=s.data;r==0?this.toSuccess():this.$message.error(o||t)}).catch(()=>{this.$message.error(t)})}},computed:{id(){const{id:a}=this.$route.query;return parseInt(a)},nameKey(){return this.$store.state.nameKey}}};var l=function(){var t=this,e=t._self._c;return e("div",{staticClass:"upload-trade"},[e("div",{staticClass:"back",on:{click:t.backToInformation}},[e("img",{attrs:{src:n,alt:"back"}})]),e("div",{staticClass:"center"},[e("div",{staticClass:"center-title"},[e("b",{domProps:{innerHTML:t._s(t.$t("upload.index.select"))}})]),e("div",{staticClass:"center-sub-title"},[e("div",{staticClass:"dot green"}),t._v(" "+t._s(t.category[t.nameKey])+" ")]),e("ul",t._l(t.categories,function(s){return e("li",{key:s.id},[e("div",{staticClass:"left"},[e("div",{staticClass:"left-top"},[e("div",{staticClass:"point"}),e("b",[t._v(t._s(s[t.nameKey]))])]),e("div",{staticClass:"left-bottom"},[e("ul",[e("li",[t._v(t._s(s.describe))])])])]),e("div",{staticClass:"right"},[e("el-button",{attrs:{type:"primary",round:""},on:{click:function(r){return t.uploadFile(s.id)}}},[t._v(t._s(t.$t("common.select")))])],1)])}),0)])])},u=[],_=c(d,l,u,!1,null,"b13ace4a",null,null);const m=_.exports;export{m as default};
