trade.4341f2b7.js 1.9 KB

1
  1. import{n,_ as c}from"./index.4fdc1c7a.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:o,msg:r=e,data:i=[]}=s.data;o==0?this.categories=i:this.$message.error(r||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:o,msg:r=t}=s.data;o==0?this.toSuccess():this.$message.error(r||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:c,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(o){return t.uploadFile(s.id)}}},[t._v(t._s(t.$t("common.select")))])],1)])}),0)])])},u=[],_=n(d,l,u,!1,null,"1fb1894a",null,null);const m=_.exports;export{m as default};