chunk-566a0256.da3a33fb.js 17 KB

1
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-566a0256"],{"206d":function(e,t){e.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACYAAAAmCAYAAACoPemuAAAAAXNSR0IArs4c6QAAAJ5JREFUWAnt2DEKwDAMA8Ck9Cl9e/Ko9i8uXrUIBQ8eVMhgUEW4Zggdo+jZe7+5iurGXVUUEU9VV/ZclWWVXd6Yqmkxi6kCat5nzGKqgJr3GbOYKqDm256xmbfO6kueqoP5OefXVgw3ezyvtSLXcQG82FbMG4MvRUeLUSIIWAxA6GgxSgQBiwEIHS1GiSBgMQChY1uxsn+weR2mDELgB3FmFp5YffVrAAAAAElFTkSuQmCC"},4091:function(e,t,o){},"5cc6":function(e,t,o){var a=o("74e8");a("Uint8",(function(e){return function(t,o,a){return e(this,t,o,a)}}))},b1e2:function(e,t,o){"use strict";o.r(t);var a=function(){var e=this,t=e.$createElement,o=e._self._c||t;return o("div",{staticClass:"ele-body"},[o("el-card",{attrs:{shadow:"never"}},[o("el-form",{staticClass:"ele-form-search",attrs:{model:e.table.where,"label-width":"77px"},nativeOn:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.$refs.table.reload()},submit:function(e){e.preventDefault()}}},[o("el-row",{attrs:{gutter:15}},[o("el-col",{attrs:{md:6,sm:12}},[o("el-form-item",{attrs:{label:"商品名称:"}},[o("el-input",{attrs:{placeholder:"请输入商品名称",clearable:""},model:{value:e.table.where.realname,callback:function(t){e.$set(e.table.where,"realname",t)},expression:"table.where.realname"}})],1)],1),o("el-col",{attrs:{md:6,sm:12}},[o("el-form-item",{attrs:{label:"状态:"}},[o("el-select",{staticClass:"ele-fluid",attrs:{placeholder:"请选择状态",clearable:""},model:{value:e.table.where.status,callback:function(t){e.$set(e.table.where,"status",t)},expression:"table.where.status"}},[o("el-option",{attrs:{label:"全部",value:"0"}}),o("el-option",{attrs:{label:"已发布",value:"1"}}),o("el-option",{attrs:{label:"待发布",value:"2"}})],1)],1)],1),o("el-col",{attrs:{md:6,sm:12}},[o("div",{staticClass:"ele-form-actions"},[o("el-button",{staticClass:"ele-btn-icon",attrs:{type:"primary",icon:"el-icon-search"},on:{click:function(t){return e.$refs.table.reload()}}},[e._v("查询 ")]),o("el-button",{on:{click:function(t){(e.table.where={status:"0"})&&e.$refs.table.reload()}}},[e._v("重置")])],1)])],1)],1),o("div",{staticClass:"ele-table-tool ele-table-tool-default"},[e.permission.includes("sys:goods:add")?o("el-button",{staticClass:"ele-btn-icon",attrs:{type:"primary",icon:"el-icon-plus",size:"small"},on:{click:function(t){e.showEdit=!0}}},[e._v("添加 ")]):e._e(),e.permission.includes("sys:goods:dall")?o("el-button",{staticClass:"ele-btn-icon",attrs:{type:"danger",icon:"el-icon-delete",size:"small"},on:{click:function(t){return e.remove()}}},[e._v("批量删除 ")]):e._e()],1),o("ele-data-table",{ref:"table",attrs:{config:e.table,choose:e.choose,height:"calc(100vh - 315px)","highlight-current-row":""},on:{"update:choose":function(t){e.choose=t}},scopedSlots:e._u([{key:"default",fn:function(t){var a=t.index;return[o("el-table-column",{attrs:{type:"selection",width:"45",align:"center",fixed:"left"}}),o("el-table-column",{attrs:{type:"index",index:a,label:"编号",width:"60",align:"center",fixed:"left","show-overflow-tooltip":""}}),o("el-table-column",{attrs:{label:"图片","min-width":"100",align:"center"},scopedSlots:e._u([{key:"default",fn:function(e){var t=e.row;return[o("el-avatar",{attrs:{shape:"square",size:35,src:t.thumb}})]}}],null,!0)}),o("el-table-column",{attrs:{prop:"title",label:"商品名称","show-overflow-tooltip":"",align:"center","min-width":"200"}}),o("el-table-column",{attrs:{prop:"cate_id",label:"分类",align:"center","min-width":"200"},scopedSlots:e._u([{key:"default",fn:function(t){var a=t.row;return[o("span",{domProps:{textContent:e._s(a.cate_name)}})]}}],null,!0)}),o("el-table-column",{attrs:{prop:"price",label:"券价格","show-overflow-tooltip":"",align:"center","min-width":"120"}}),o("el-table-column",{attrs:{prop:"score",label:"积分价格","show-overflow-tooltip":"",align:"center","min-width":"120"}}),o("el-table-column",{attrs:{prop:"stock",label:"库存","show-overflow-tooltip":"",align:"center","min-width":"150"}}),o("el-table-column",{attrs:{prop:"specs",label:"单位","show-overflow-tooltip":"",align:"center","min-width":"150"}}),o("el-table-column",{attrs:{prop:"is_recommand",label:"推荐",resizable:!1,align:"center","min-width":"100"},scopedSlots:e._u([{key:"default",fn:function(t){var a=t.row;return[o("span",{domProps:{textContent:e._s(1==a.is_recommand?"是":"否")}})]}}],null,!0)}),o("el-table-column",{attrs:{prop:"status",label:"状态",resizable:!1,align:"center","min-width":"100"},scopedSlots:e._u([{key:"default",fn:function(t){var a=t.row;return[o("el-switch",{attrs:{"active-value":1,"inactive-value":2},on:{change:function(t){return e.editStatus(a)}},model:{value:a.status,callback:function(t){e.$set(a,"status",t)},expression:"row.status"}})]}}],null,!0)}),o("el-table-column",{attrs:{prop:"description",label:"描述","show-overflow-tooltip":"",align:"center","min-width":"250"}}),o("el-table-column",{attrs:{prop:"sort",label:"排序",sortable:"custom",align:"center","show-overflow-tooltip":"","min-width":"100"}}),o("el-table-column",{attrs:{label:"创建时间",sortable:"custom","show-overflow-tooltip":"",align:"center","min-width":"160"},scopedSlots:e._u([{key:"default",fn:function(t){var o=t.row;return[e._v(e._s(e._f("toDateString")(o.create_time)))]}}],null,!0)}),o("el-table-column",{attrs:{label:"操作",width:"130px",align:"center",resizable:!1,fixed:"right"},scopedSlots:e._u([{key:"default",fn:function(t){var a=t.row;return[e.permission.includes("sys:goods:edit")?o("el-link",{attrs:{icon:"el-icon-edit",type:"primary",underline:!1},on:{click:function(t){return e.edit(a)}}},[e._v("修改")]):e._e(),o("el-popconfirm",{staticClass:"ele-action",attrs:{title:"确定要删除此商品信息吗?"},on:{confirm:function(t){return e.remove(a)}}},[e.permission.includes("sys:goods:delete")?o("el-link",{attrs:{slot:"reference",icon:"el-icon-delete",type:"danger",underline:!1},slot:"reference"},[e._v("删除")]):e._e()],1)]}}],null,!0)})]}}])})],1),o("el-dialog",{attrs:{title:(e.editForm.id,"修改商品信息"),visible:e.showEdit,width:"600px","destroy-on-close":!0,"custom-class":"ele-dialog-form","lock-scroll":!1},on:{"update:visible":function(t){e.showEdit=t},closed:function(t){e.editForm={}}}},[o("el-form",{ref:"editForm",attrs:{model:e.editForm,rules:e.editRules,"label-width":"82px"}},[o("el-form-item",{attrs:{label:"图片:",visible:e.showEdit},on:{"update:visible":function(t){e.showEdit=t}}},[o("uploadImage",{attrs:{limit:1},model:{value:e.editForm.thumb,callback:function(t){e.$set(e.editForm,"thumb",t)},expression:"editForm.thumb"}})],1),o("el-form-item",{attrs:{label:"相册:"}},[o("uploadImage",{attrs:{limit:5},model:{value:e.editForm.albums,callback:function(t){e.$set(e.editForm,"albums",t)},expression:"editForm.albums"}})],1),o("el-row",{attrs:{gutter:15}},[o("el-col",{attrs:{sm:24}},[o("el-col",{attrs:{sm:12}},[o("el-form-item",{attrs:{label:"分类:",prop:"cate_id"}},[o("el-select",{staticClass:"ele-block",attrs:{placeholder:"请选择分类",clearable:""},model:{value:e.editForm.cate_id,callback:function(t){e.$set(e.editForm,"cate_id",t)},expression:"editForm.cate_id"}},e._l(e.cates,(function(e,t){return o("el-option",{key:"c"+t,attrs:{label:e.name,value:e.id}})})),1)],1),o("el-form-item",{attrs:{label:"商品名称:",prop:"title"}},[o("el-input",{attrs:{placeholder:"请输入商品名称",clearable:""},model:{value:e.editForm.title,callback:function(t){e.$set(e.editForm,"title",t)},expression:"editForm.title"}})],1),o("el-form-item",{attrs:{label:"商品价格:",prop:"price"}},[o("el-input",{attrs:{placeholder:"商品价格",clearable:""},model:{value:e.editForm.price,callback:function(t){e.$set(e.editForm,"price",t)},expression:"editForm.price"}})],1),o("el-form-item",{attrs:{label:"积分价格:",prop:"score"}},[o("el-input",{attrs:{placeholder:"商品积分价格",clearable:""},model:{value:e.editForm.score,callback:function(t){e.$set(e.editForm,"score",t)},expression:"editForm.score"}})],1),o("el-form-item",{attrs:{label:"商品库存:",prop:"stock"}},[o("el-input",{attrs:{placeholder:"商品库存",clearable:""},model:{value:e.editForm.stock,callback:function(t){e.$set(e.editForm,"stock",t)},expression:"editForm.stock"}})],1),o("el-form-item",{attrs:{label:"商品单位:",prop:"specs"}},[o("el-input",{attrs:{placeholder:"商品单位,如:个",clearable:""},model:{value:e.editForm.specs,callback:function(t){e.$set(e.editForm,"specs",t)},expression:"editForm.specs"}})],1)],1),o("el-col",{attrs:{sm:24}},[o("el-form-item",{attrs:{label:"商品描述:",prop:"description"}},[o("el-input",{attrs:{placeholder:"请输入商品描述",rows:6,type:"textarea"},model:{value:e.editForm.description,callback:function(t){e.$set(e.editForm,"description",t)},expression:"editForm.description"}})],1),o("el-form-item",{attrs:{label:"商品详情:",prop:"content"}},[o("tinymce-editor",{attrs:{init:e.editContent},model:{value:e.editForm.content,callback:function(t){e.$set(e.editForm,"content",t)},expression:"editForm.content"}})],1),o("el-form-item",{attrs:{label:"排序号:",prop:"sort"}},[o("el-input-number",{staticClass:"ele-fluid ele-text-left",attrs:{"controls-position":"right",min:0,placeholder:"请输入排序号"},model:{value:e.editForm.sort,callback:function(t){e.$set(e.editForm,"sort",t)},expression:"editForm.sort"}})],1),o("el-form-item",{attrs:{label:"是否推荐:"}},[o("el-radio-group",{model:{value:e.editForm.is_recommand,callback:function(t){e.$set(e.editForm,"is_recommand",t)},expression:"editForm.is_recommand"}},[o("el-radio",{attrs:{label:1}},[e._v("推荐")]),o("el-radio",{attrs:{label:2}},[e._v("不推荐")])],1)],1),o("el-form-item",{attrs:{label:"发布状态:"}},[o("el-radio-group",{model:{value:e.editForm.status,callback:function(t){e.$set(e.editForm,"status",t)},expression:"editForm.status"}},[o("el-radio",{attrs:{label:1}},[e._v("已发布")]),o("el-radio",{attrs:{label:2}},[e._v("待发布")])],1)],1)],1)],1)],1)],1),o("div",{attrs:{slot:"footer"},slot:"footer"},[o("el-button",{on:{click:function(t){e.showEdit=!1}}},[e._v("取消")]),o("el-button",{attrs:{type:"primary"},on:{click:e.save}},[e._v("保存")])],1)],1)],1)},l=[],s=(o("d81d"),o("5530")),i=o("2f62"),r=o("cbc3"),n=o("432e"),c={name:"SysGoods",components:{uploadImage:r["a"],tinymceEditor:n["a"]},data:function(){return{table:{url:"/goods/index",where:{status:"0"}},choose:[],showEdit:!1,editForm:{id:0,status:1,form:1,thumb:{},albums:[],title:""},cates:[],editRules:{title:[{required:!0,message:"请输入商品名称",trigger:"blur"}],cate_id:[{required:!0,message:"请选择商品所属分类",trigger:"blur"}],status:[{required:!0,message:"请选择发布状态",trigger:"blur"}]}}},computed:Object(s["a"])(Object(s["a"])({},Object(i["b"])(["permission"])),{},{editContent:function(){return{menubar:!1,file_picker_callback:this.file_picker_callback,skin_url:"dark"===this.$store.state.theme.theme?"/tinymce/skins/ui/oxide-dark":"/tinymce/skins/ui/oxide",content_css:"dark"===this.$store.state.theme.theme?"/tinymce/skins/content/dark/content.css":"/tinymce/skins/content/default/content.css"}}}),mounted:function(){this.getCateOPtions()},methods:{getCateOPtions:function(){var e=this,t=this.$loading({lock:!0});this.$http.post("/goodscates/options",this.editForm).then((function(o){t.close(),0===o.data.code?e.cates="undefined"!=typeof o.data.data?o.data.data:{}:e.$message.error(o.data.msg)})).catch((function(o){t.close(),e.$message.error(o.message)}))},edit:function(e){this.editForm=Object.assign({},e),this.editForm.albums||(this.editForm.albums=[]),this.showEdit=!0},save:function(){var e=this;this.$refs["editForm"].validate((function(t){if(!t)return!1;var o=e.$loading({lock:!0});e.$http.post("/goods/edit",e.editForm).then((function(t){o.close(),0===t.data.code?(e.showEdit=!1,e.$message({type:"success",message:t.data.msg}),e.$refs.table.reload()):e.$message.error(t.data.msg)})).catch((function(t){o.close(),e.$message.error(t.message)}))}))},remove:function(e){var t=this;if(e){var o=this.$loading({lock:!0});this.$http.post("/goods/delete",{id:e.id}).then((function(e){o.close(),0===e.data.code?(t.$message({type:"success",message:e.data.msg}),t.$refs.table.reload()):t.$message.error(e.data.msg)})).catch((function(e){o.close(),t.$message.error(e.message)}))}else{if(0===this.choose.length)return this.$message.error("请至少选择一条数据");var a=this.choose.map((function(e){return e.id}));this.$confirm("确定要删除选中的信息吗?","提示",{type:"warning"}).then((function(){var e=t.$loading({lock:!0});t.$http.post("/goods/delete",{id:a}).then((function(o){e.close(),0===o.data.code?(t.$message({type:"success",message:o.data.msg}),t.$refs.table.reload()):t.$message.error(o.data.msg)})).catch((function(o){e.close(),t.$message.error(o.message)}))})).catch((function(){return 0}))}},editStatus:function(e){var t=this,o=this.$loading({lock:!0}),a=Object.assign({},e);this.$http.post("/goods/status",a).then((function(a){o.close(),0===a.data.code?t.$message({type:"success",message:a.data.msg}):(e.status=e.status?1:2,t.$message.error(a.data.msg))})).catch((function(e){o.close(),t.$message.error(e.message)}))}}},d=c,u=(o("eb35"),o("2877")),m=Object(u["a"])(d,a,l,!1,null,"4602b87a",null);t["default"]=m.exports},c19f:function(e,t,o){"use strict";var a=o("23e7"),l=o("da84"),s=o("621a"),i=o("2626"),r="ArrayBuffer",n=s[r],c=l[r];a({global:!0,forced:c!==n},{ArrayBuffer:n}),i(r)},cbc3:function(e,t,o){"use strict";var a=function(){var e=this,t=e.$createElement,o=e._self._c||t;return o("div",{staticClass:"finish_room"},[o("div",{staticClass:"finish_room2"},[o("div",{staticClass:"img-list"},e._l(e.photo,(function(t,a){return o("div",{key:a,staticClass:"room_img"},[o("img",{directives:[{name:"lazy",rawName:"v-lazy",value:t.url,expression:"item.url"}]}),o("div",{staticClass:"im-button",attrs:{disabled:!e.disabled},on:{click:function(t){return e.deleteImg(a)}}},[o("div",{staticClass:"im-close"}),o("div",{staticClass:"im-close1"})])])})),0),e.photo.length<e.limit?o("div",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],staticClass:"room_add_img"},[e._m(0),o("input",{attrs:{disabled:e.disabled,type:"file"},on:{change:e.add_img}})]):e._e()])])},l=[function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("span",{staticStyle:{"margin-top":"35px"}},[a("img",{attrs:{src:o("206d")}})])}],s=(o("a434"),o("c19f"),o("a9e3"),o("d3b7"),o("ac1f"),o("1276"),o("5cc6"),o("9a8c"),o("a975"),o("735e"),o("c1ac"),o("d139"),o("3a7b"),o("d5d6"),o("82f8"),o("e91f"),o("60bd"),o("5f96"),o("3280"),o("3fcc"),o("ca91"),o("25a1"),o("cd26"),o("3c5d"),o("2954"),o("649e"),o("219c"),o("170b"),o("b39a"),o("72f7"),o("bc3a")),i=o.n(s),r={name:"uploadImage",props:{limit:{type:Number,default:function(){return 1}},disabled:{type:Boolean,default:function(){return!1}},isCompress:{type:Boolean,default:function(){return!1}},value:{}},data:function(){return{photo:[],deleteStatus:!1,loading:!1}},watch:{photo:function(){1==this.limit?this.$emit("input",this.photo.length>0?this.photo[0].url:""):this.$emit("input",this.photo)},value:function(){1==this.limit?this.value instanceof Array?this.photo=[]:this.photo=this.value?[{url:this.value}]:[]:this.photo=this.value}},mounted:function(){1==this.limit?this.value instanceof Array?this.photo=[]:this.photo=this.value?[{url:this.value}]:[]:this.value instanceof Array?this.photo=this.value:this.photo=[]},methods:{deleteImg:function(e){this.photo&&this.photo instanceof Array&&this.photo.splice(e,1)},compress:function(e){var t=null,o=document.createElement("canvas"),a=e.height/e.width;o.width=720,o.height=720*a;var l=o.getContext("2d");return l.clearRect(0,0,o.width,o.height),l.drawImage(e,0,0,o.width,o.height),t=o.toDataURL("image/jpeg"),t},dataURItoBlob:function(e){for(var t=window.atob(e.split(",")[1]),o=e.split(",")[0].split(":")[1].split(";")[0],a=new ArrayBuffer(t.length),l=new Uint8Array(a),s=0;s<t.length;s++)l[s]=t.charCodeAt(s);return new window.Blob([a],{type:o})},add_img:function(e){var t=e.target.files[0];if(/\.(gif|jpg|jpeg|png|GIF|JPG|PNG)$/.test(e.target.value)){var o=10485760,a=t.size;if(a>o)return e.target.value="",void this.$notify.error({title:"上传图片错误",message:"上传图片不能超过10M"});this.loading=!0;var l=new FileReader,s=this;l.readAsDataURL(t);var r=new Image;l.onload=function(o){r.src=this.result,r.onload=function(){var a=o.target.result,l=t;s.isCompress&&(a=s.compress(r),l=s.dataURItoBlob(a));var n=new window.FormData;n.append("file",l),i()({method:"POST",url:"/upload/uploadImage",data:n,timeout:1e6,headers:{"Content-Type":"multipart/form-data"}}).then((function(o){console.log(o.data),e.target.value="","undefined"!=typeof s.photo&&""!=s.photo||(s.photo=[]),console.log(s.photo),s.photo.push({fileName:t.fileName,url:o.data.data}),s.loading=!1})).catch((function(t){e.target.value="",s.loading=!1,console.log(t)}))}}}else e.target.value="",this.$notify.error({title:"上传图片错误",message:"请上传gif|jpg|jpeg|png|GIF|JPG|PNG格式图片"})}}},n=r,c=(o("e5ee"),o("2877")),d=Object(c["a"])(n,a,l,!1,null,"2ed5cae0",null);t["a"]=d.exports},e5ee:function(e,t,o){"use strict";o("4091")},ea78:function(e,t,o){},eb35:function(e,t,o){"use strict";o("ea78")}}]);