text: webpackJsonp([43],{PRU9:function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var a=i("Edqs"),n=i.n(a),l=i("vLgD"),s=i("mQOt"),o=i.n(s);function r(t){return Object(l.a)({url:"/admin/level/update",method:"post",data:o.a.stringify(t)})}var d=i("cAgV"),u=i("0xDb"),c=i("erVD"),p=[{key:"CN",display_name:"China"},{key:"US",display_name:"USA"},{key:"JP",display_name:"Japan"},{key:"EU",display_name:"Eurozone"}],m=p.reduce(function(t,e){return t[e.key]=e.display_name,t},{}),f={name:"complexTable",directives:{waves:d.a},components:{uploadImg:c.a},data:function(){return{tableKey:0,list:null,total:null,listLoading:!0,listQuery:{page:1,limit:20,importance:void 0,title:void 0,type:void 0,sort:"+id"},importanceOptions:[1,2,3],calendarTypeOptions:p,sortOptions:[{label:"ID Ascending",key:"+id"},{label:"ID Descending",key:"-id"}],statusOptions:["published","draft","deleted"],showReviewer:!1,temp:{id:void 0,level:"",month:"",price:"0.01"},dialogFormVisible:!1,dialogStatus:"",textMap:{update:"Edit",create:"Create"},dialogPvVisible:!1,pvData:[],rules:{type:[{required:!1,message:"type is required",trigger:"change"}],timestamp:[{type:"date",required:!0,message:"timestamp is required",trigger:"change"}],title:[{required:!1,message:"title is required",trigger:"blur"}]},downloadLoading:!1}},filters:{statusFilter:function(t){return{published:"success",draft:"info",deleted:"danger"}[t]},typeFilter:function(t){return m[t]}},created:function(){this.getList()},methods:{uploadImg:function(t){this.temp.icon=t},getList:function(){var t,e=this;this.listLoading=!0,(t=this.listQuery,Object(l.a)({url:"/admin/level",method:"get",params:t})).then(function(t){e.list=t.data.list,e.total=t.data.meta.total,e.listLoading=!1})},handleFilter:function(){this.listQuery.page=1,this.getList()},handleSizeChange:function(t){this.listQuery.limit=t,this.getList()},handleCurrentChange:function(t){this.listQuery.page=t,this.getList()},handleModifyStatus:function(t,e){this.$message({message:"操作成功",type:"success"}),t.status=e},resetTemp:function(){this.temp={id:void 0,level:"",num:""}},handleCreate:function(){var t=this;this.resetTemp(),this.dialogStatus="create",this.dialogFormVisible=!0,this.$nextTick(function(){t.$refs.dataForm.clearValidate()})},createData:function(){var t=this;this.$refs.dataForm.validate(function(e){e&&(t.temp.id=parseInt(100*Math.random())+1024,t.temp.author="vue-element-admin",r(t.temp).then(function(){t.getList(),t.dialogFormVisible=!1,t.$notify({title:"成功",message:"创建成功",type:"success",duration:2e3})}))})},handleUpdate:function(t){var e=this;this.temp=n()({},t),this.dialogStatus="update",this.dialogFormVisible=!0,this.$nextTick(function(){e.$refs.dataForm.clearValidate()})},updateData:function(){var t=this;this.$refs.dataForm.validate(function(e){e&&r(n()({},t.temp)).then(function(){t.getList(),t.dialogFormVisible=!1,t.$notify({title:"成功",message:"更新成功",type:"success",duration:2e3})})})},handleDelete:function(t){this.$notify({title:"成功",message:"删除成功",type:"success",duration:2e3});var e=this.list.indexOf(t);this.list.splice(e,1)},handleFetchPv:function(t){var e=this;fetchPv(t).then(function(t){e.pvData=t.data.pvData,e.dialogPvVisible=!0})},handleDownload:function(){var t=this;this.downloadLoading=!0,Promise.all([i.e(48),i.e(47)]).then(i.bind(null,"zWO4")).then(function(e){var i=t.formatJson(["timestamp","title","type","importance","status"],t.list);e.export_json_to_excel(["timestamp","title","type","importance","status"],i,"table-list"),t.downloadLoading=!1})},formatJson:function(t,e){return e.map(function(e){return t.map(function(t){return"timestamp"===t?Object(u.c)(e[t]):e[t]})})}}},h={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"app-container calendar-list-container"},[i("el-table",{directives:[{name:"loading",rawName:"v-loading",value:t.listLoading,expression:"listLoading"}],key:t.tableKey,staticStyle:{width:"100%"},attrs:{data:t.list,"element-loading-text":"给我一点时间",border:"",fit:"","highlight-current-row":""}},[i("el-table-column",{attrs:{align:"center",label:"#id",width:"65"},scopedSlots:t._u([{key:"default",fn:function(e){return[i("span",[t._v(t._s(e.row.id))])]}}])}),t._v(" "),i("el-table-column",{attrs:{width:"150px",align:"center",label:"会员类型"},scopedSlots:t._u([{key:"default",fn:function(e){return[i("span",[t._v(t._s(e.row.type?"分析师":"普通用户"))])]}}])}),t._v(" "),i("el-table-column",{attrs:{width:"150px",align:"center",label:"会员等级"},scopedSlots:t._u([{key:"default",fn:function(e){return[i("span",[t._v("等级"+t._s(e.row.level))])]}}])}),t._v(" "),i("el-table-column",{attrs:{"min-width":"100px",align:"center",label:"等级图标"},scopedSlots:t._u([{key:"default",fn:function(t){return[i("img",{staticStyle:{width:"60px"},attrs:{src:t.row.icon}})]}}])}),t._v(" "),i("el-table-column",{attrs:{"min-width":"200px",align:"center",label:"免费查看（发推荐）单数"},scopedSlots:t._u([{key:"default",fn:function(e){return[i("span",[t._v(t._s(e.row.num))])]}}])}),t._v(" "),i("el-table-column",{attrs:{"min-width":"200px",align:"left",label:"特权文案描述"},scopedSlots:t._u([{key:"default",fn:function(e){return[i("span",{domProps:{innerHTML:t._s(e.row.intro.replace(/(\r\n)|\n/g,"<br/>"))}})]}}])}),t._v(" "),i("el-table-column",{attrs:{align:"center",label:"操作",width:"230","class-name":"small-padding fixed-width"},scopedSlots:t._u([{key:"default",fn:function(e){return[i("el-button",{attrs:{type:"primary",size:"mini"},on:{click:function(i){t.handleUpdate(e.row)}}},[t._v("编辑")])]}}])})],1),t._v(" "),i("el-dialog",{attrs:{title:"编辑用户会员特权",visible:t.dialogFormVisible},on:{"update:visible":function(e){t.dialogFormVisible=e}}},[i("el-form",{ref:"dataForm",staticStyle:{width:"400px","margin-left":"50px"},attrs:{rules:t.rules,model:t.temp,"label-position":"left","label-width":"150px"}},[i("el-form-item",{attrs:{label:"会员等级",prop:"level"}},[i("span",[t._v("\n\t\t                会员等级"+t._s(t.temp.level)+"\n\t\t            ")])]),t._v(" "),i("el-form-item",{attrs:{label:"会员类型",prop:"level"}},[i("span",[t._v("\n\t\t                "+t._s(t.temp.level?"分析师":"普通用户")+"\n\t\t            ")])]),t._v(" "),i("el-form-item",{attrs:{label:"免费查看(发推荐)单数",prop:"price"}},[i("el-input-number",{model:{value:t.temp.num,callback:function(e){t.$set(t.temp,"num",e)},expression:"temp.num"}})],1),t._v(" "),i("el-form-item",{attrs:{label:"特权描述",prop:"price"}},[i("el-input",{attrs:{type:"textarea"},model:{value:t.temp.intro,callback:function(e){t.$set(t.temp,"intro",e)},expression:"temp.intro"}})],1)],1),t._v(" "),i("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[i("el-button",{on:{click:function(e){t.dialogFormVisible=!1}}},[t._v("取 消")]),t._v(" "),"create"==t.dialogStatus?i("el-button",{attrs:{type:"primary"},on:{click:t.createData}},[t._v("确 定")]):i("el-button",{attrs:{type:"primary"},on:{click:t.updateData}},[t._v("确 定")])],1)],1),t._v(" "),i("el-dialog",{attrs:{title:"Reading statistics",visible:t.dialogPvVisible},on:{"update:visible":function(e){t.dialogPvVisible=e}}},[i("el-table",{staticStyle:{width:"100%"},attrs:{data:t.pvData,border:"",fit:"","highlight-current-row":""}},[i("el-table-column",{attrs:{prop:"key",label:"Channel"}}),t._v(" "),i("el-table-column",{attrs:{prop:"pv",label:"Pv"}})],1),t._v(" "),i("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[i("el-button",{attrs:{type:"primary"},on:{click:function(e){t.dialogPvVisible=!1}}},[t._v("确 定")])],1)],1)],1)},staticRenderFns:[]},g=i("XAIM")(f,h,!1,null,null,null);e.default=g.exports}});