powder.94b6e15c.js 8.0 KB

1
  1. import{_ as d,a as h,b as _,c as u,d as m,e as f,f as g,g as v,h as y,i as C}from"./square.3277a4f5.js";import{H as I}from"./header.e39c6eb1.js";import{n as b,b as $,c as r,d as k,F as w,C as S,e as E,i as T,f as A,h as l}from"./index.4fdc1c7a.js";const F={name:"makeup-filter-powder",components:{Header:I},data(){return{containers:[],shapes:[],capacities:[],containerIds:[],shapeIds:[],capacityIds:[],level1Count:0,level2Count:0}},mounted(){const e=this.$t("common.failure");this.$axios.get("/api/upload_type_list",{params:{pid:this.id}}).then(t=>{const{code:s,msg:i=e,data:a=[]}=t.data;if(s==0){const n=a.find(o=>o.id===this.containerId),c=a.find(o=>o.id===this.shapeId),p=a.find(o=>o.id===this.capacityId);this.getContainers(n),this.getShapes(c),this.getCapacities(p)}else this.$message.error(i||e)}),this.getFilterTypes()},methods:{toggleContainers(){this.containerAll?this.containerIds=[]:this.containerIds=this.containers.filter(e=>e.type!=="empty").map(e=>e.id)},toggleShapes(){this.shapeAll?this.shapeIds=[]:this.shapeIds=this.shapes.filter(e=>e.type!=="empty").map(e=>e.id)},toggleCapacities(){this.capacityAll?this.capacityIds=[]:this.capacityIds=this.capacities.filter(e=>e.type!=="empty").map(e=>e.id)},getFilterTypes(){const e=this.$t("common.failure");this.$axios.get("/api/filter_type_list").then(t=>{const{code:s,msg:i=e,data:a=[]}=t.data;if(s==0){const[n,c]=$(l.makeup,A[l.makeup].powder,a);this.level1Count=n,this.level2Count=c}else this.$message.error(i||e)})},toBase(){sessionStorage.setItem("conf_filters",JSON.stringify([this.containers,this.shapes,this.capacities])),this.$router.push({path:"/makeup",query:{filter:`${this.containerIds},${this.shapeIds},${this.capacityIds}`}})},changeContainer({id:e,type:t}){t!=="empty"&&(this.containerIds=[],this.containerIds.push(e))},changeShape({id:e,type:t}){t!=="empty"&&(this.shapeIds=[],this.shapeIds.push(e))},changeCapacity({id:e,type:t}){t!=="empty"&&(this.capacityIds=[],this.capacityIds.push(e))},fillEmpty(e){for(let t=5;t>=0;t--)if(!e[t]){e[t]={type:"empty"};continue}return e},rebuildContainers(e){let t=r[this.id];t=t[this.containerId];const s=e.map(i=>{const a=t[i.id];return{...i,type:a,image:new URL(Object.assign({"../../../../assets/images/makeup/filter/containers/powder/double.png":d,"../../../../assets/images/makeup/filter/containers/powder/doubleOne.png":h,"../../../../assets/images/makeup/filter/containers/powder/doubleTwo.png":_,"../../../../assets/images/makeup/filter/containers/powder/single.png":u,"../../../../assets/images/makeup/filter/containers/powder/singleOne.png":m,"../../../../assets/images/makeup/filter/containers/powder/singleTwo.png":f})[`../../../../assets/images/makeup/filter/containers/powder/${a}.png`],self.location).href}});return this.fillEmpty(s)},rebuildShapes(e){let t=r[parseInt(this.id)];t=t[this.shapeId];const s=e.map(i=>{const a=t[i.id];return{...i,type:a,image:new URL(Object.assign({"../../../../assets/images/makeup/filter/shapes/powder/oval.png":g,"../../../../assets/images/makeup/filter/shapes/powder/rectangle.png":v,"../../../../assets/images/makeup/filter/shapes/powder/round.png":y,"../../../../assets/images/makeup/filter/shapes/powder/square.png":C})[`../../../../assets/images/makeup/filter/shapes/powder/${a}.png`],self.location).href}});return this.fillEmpty(s)},rebuildCapacities(e){return this.fillEmpty(e)},getContainers({id:e}){const t=this.$t("common.failure");this.$axios.get("/api/upload_type_list",{params:{pid:e}}).then(s=>{const{code:i,msg:a=t,data:n=[]}=s.data;i==0?this.containers=this.rebuildContainers(n):this.$message.error(a||t)})},getShapes({id:e}){const t=this.$t("common.failure");this.$axios.get("/api/upload_type_list",{params:{pid:e}}).then(s=>{const{code:i,msg:a=t,data:n=[]}=s.data;i==0?this.shapes=this.rebuildShapes(n):this.$message.error(a||t)})},getCapacities({id:e}){const t=this.$t("common.failure");this.$axios.get("/api/upload_type_list",{params:{pid:e}}).then(s=>{const{code:i,msg:a=t,data:n=[]}=s.data;i==0?this.capacities=this.rebuildCapacities(n):this.$message.error(a||t)})}},computed:{id(){return k[w.mode].powder},containerAll(){return this.containerIds.length===this.containers.filter(e=>e.type!=="empty").length},shapeAll(){return this.shapeIds.length===this.shapes.filter(e=>e.type!=="empty").length},capacityAll(){return this.capacityIds.length===this.capacities.filter(e=>e.type!=="empty").length},containerId(){return S[this.id]},shapeId(){return E[this.id]},capacityId(){return T[this.id]},disabled(){return!(this.containerIds.length&&this.shapeIds.length&&this.capacityIds.length)},nameKey(){return this.$store.state.nameKey}}};var R=function(){var t=this,s=t._self._c;return s("div",{staticClass:"makeup-filter-powder"},[s("div",{staticClass:"filter-content"},[s("Header",{attrs:{type:"powder"}}),s("div",{staticClass:"filter-container"},[s("div",{staticClass:"row"},[s("div",{class:["column-item",t.containerAll?"selected":""],on:{click:t.toggleContainers}},[t._m(0),s("div",{staticClass:"content"},[s("div",{staticClass:"top"},[s("b",[t._v(t._s(t.$t("common.filter.all")))])]),s("div",{staticClass:"bottom"},[t._v(" "+t._s(t.$t("common.filter.container"))+" ")])])]),t._l(t.containers,function(i){return s("div",{key:i.id,class:["column-item",i.type,i.type==="other"?"vh-center":"",i.type==="empty"?"filter":"",t.containerIds.includes(i.id)?"selected":""],on:{click:function(a){return t.changeContainer(i)}}},[i.type==="empty"?void 0:[t._m(1,!0),s("div",{staticClass:"content"},[s("div",{staticClass:"top"},[i.type==="other"?s("span",[t._v(t._s(i[t.nameKey]))]):s("img",{attrs:{src:i.image,alt:"plastic"}})]),i.type==="other"?s("div",{staticClass:"bottom"}):s("div",{staticClass:"bottom"},[t._v(" "+t._s(i[t.nameKey])+" ")])])]],2)})],2),s("div",{staticClass:"row"},[s("div",{class:["column-item",t.shapeAll?"selected":""],on:{click:t.toggleShapes}},[t._m(2),s("div",{staticClass:"content"},[s("div",{staticClass:"top"},[s("b",[t._v(t._s(t.$t("common.filter.all")))])]),s("div",{staticClass:"bottom"},[t._v(" "+t._s(t.$t("common.filter.shape"))+" ")])])]),t._l(t.shapes,function(i){return s("div",{key:i.id,class:["column-item",i.type,i.type==="other"?"vh-center":"",i.type==="empty"?"filter":"",t.shapeIds.includes(i.id)?"selected":""],on:{click:function(a){return t.changeShape(i)}}},[i.type==="empty"?void 0:[t._m(3,!0),s("div",{staticClass:"content"},[s("div",{staticClass:"top"},[i.type==="other"?s("span",[t._v(t._s(i[t.nameKey]))]):s("img",{attrs:{src:i.image,alt:"plastic"}})]),i.type==="other"?s("div",{staticClass:"bottom"}):s("div",{staticClass:"bottom"},[t._v(" "+t._s(i[t.nameKey])+" ")])])]],2)})],2),s("div",{staticClass:"row horizontal"},[s("div",{class:["column-item",t.capacityAll?"selected":""],on:{click:t.toggleCapacities}},[s("i",{staticClass:"el-icon-success"}),s("div",{staticClass:"horizontal-item"},[s("b",[t._v(t._s(t.$t("common.filter.all")))])]),s("div",{staticClass:"horizontal-item"},[t._v(" "+t._s(t.$t("common.filter.capacity"))+" ")])]),t._l(t.capacities,function(i){return s("div",{key:i.id,class:["column-item",t.capacityIds.includes(i.id)?"selected":""],on:{click:function(a){return t.changeCapacity(i)}}},[s("i",{staticClass:"el-icon-success"}),s("div",{staticClass:"horizontal-item"},[t._v(" "+t._s(i[t.nameKey])+" ")])])})],2)]),s("div",{staticClass:"upload-makeup-footer"},[s("div",{staticClass:"footer-count"},[s("ul",[s("li",[t._v(" "+t._s(t.$t("header.navs.nav2"))+" "+t._s(t.level1Count)+" ")]),t._v(" \xA0\xA0 > \xA0\xA0 "),s("li",[t._v(" "+t._s(t.$t("makeup.nav.powder"))+" "+t._s(t.level2Count)+" ")])])]),s("el-button",{attrs:{type:"primary",disabled:t.disabled,round:""},on:{click:t.toBase}},[t._v(t._s(t.$t("common.resume")))])],1)],1)])},x=[function(){var e=this,t=e._self._c;return t("div",{staticClass:"selection"},[t("i",{staticClass:"el-icon-success"})])},function(){var e=this,t=e._self._c;return t("div",{staticClass:"selection"},[t("i",{staticClass:"el-icon-success"})])},function(){var e=this,t=e._self._c;return t("div",{staticClass:"selection"},[t("i",{staticClass:"el-icon-success"})])},function(){var e=this,t=e._self._c;return t("div",{staticClass:"selection"},[t("i",{staticClass:"el-icon-success"})])}],D=b(F,R,x,!1,null,"78f617e1",null,null);const z=D.exports;export{z as default};