| 1 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-5785c236"],{"3fd8":function(t,e,a){"use strict";a.r(e);var l=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"divBox relative"},[a("div",{staticClass:"selCard"},[a("el-form",{ref:"searchForm",attrs:{model:t.tableFrom,"label-width":"90px",inline:"",size:"small"}},[a("el-form-item",{attrs:{label:"卡密库名称:",prop:"name"}},[a("el-input",{staticClass:"selWidth",attrs:{placeholder:"请输入卡密库名称",size:"small",clearable:""},nativeOn:{keyup:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.getList(1)}},model:{value:t.tableFrom.name,callback:function(e){t.$set(t.tableFrom,"name","string"===typeof e?e.trim():e)},expression:"tableFrom.name"}})],1),t._v(" "),a("el-form-item",{attrs:{label:"商品名称:",prop:"productName"}},[a("el-input",{staticClass:"selWidth",attrs:{placeholder:"请输入商品名称",size:"small",clearable:""},nativeOn:{keyup:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.getList(1)}},model:{value:t.tableFrom.productName,callback:function(e){t.$set(t.tableFrom,"productName","string"===typeof e?e.trim():e)},expression:"tableFrom.productName"}})],1),t._v(" "),a("el-form-item",[a("el-button",{attrs:{type:"primary",size:"small"},on:{click:function(e){return t.getList(1)}}},[t._v("搜索")]),t._v(" "),a("el-button",{attrs:{size:"small"},on:{click:function(e){return t.searchReset()}}},[t._v("重置")])],1)],1)],1),t._v(" "),a("el-card",{staticClass:"box-card mt14",attrs:{"body-style":{padding:"20px"},shadow:"never",bordered:!1}},[a("el-button",{staticClass:"mb20",attrs:{size:"small",type:"primary"},on:{click:function(e){return t.handleAdd()}}},[t._v("添加卡密库")]),t._v(" "),a("el-table",{directives:[{name:"loading",rawName:"v-loading",value:t.listLoading,expression:"listLoading"}],staticStyle:{width:"100%"},attrs:{data:t.tableData.data,size:"small","highlight-current-row":""}},[a("el-table-column",{attrs:{prop:"id",label:"ID","min-width":"50"}}),t._v(" "),a("el-table-column",{attrs:{label:"卡密库名称",prop:"name","min-width":"150","show-overflow-tooltip":!0}}),t._v(" "),a("el-table-column",{attrs:{label:"关联商品","min-width":"200"},scopedSlots:t._u([{key:"default",fn:function(e){return[e.row.product?a("div",{staticClass:"tabBox acea-row row-middle"},[a("div",{staticClass:"demo-image__preview"},[a("el-image",{attrs:{src:e.row.product.image,"preview-src-list":[e.row.product.image]}})],1),t._v(" "),a("span",{staticClass:"tabBox_tit"},[t._v(t._s(e.row.product.store_name))])]):t._e()]}}])}),t._v(" "),a("el-table-column",{attrs:{label:"关联商品规格",prop:"productAttrValueName","min-width":"150"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("span",[t._v(t._s(e.row.attrValue&&e.row.attrValue.sku||"-"))])]}}])}),t._v(" "),a("el-table-column",{attrs:{label:"未使用/卡密总数","min-width":"180","show-overflow-tooltip":!0},scopedSlots:t._u([{key:"default",fn:function(e){return[a("span",[t._v(t._s(Number(e.row.total_num)-Number(e.row.used_num)+" / "+e.row.total_num))])]}}])}),t._v(" "),a("el-table-column",{attrs:{label:"备注",prop:"remark","min-width":"120","show-overflow-tooltip":!0},scopedSlots:t._u([{key:"default",fn:function(e){return[a("span",[t._v(t._s(t._f("filterEmpty")(e.row.remark)))])]}}])}),t._v(" "),a("el-table-column",{attrs:{prop:"create_time",label:"创建时间","min-width":"150"}}),t._v(" "),a("el-table-column",{attrs:{label:"操作",width:"180",fixed:"right"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-button",{staticClass:"mr10",attrs:{type:"text",size:"small"},on:{click:function(a){return t.handleAdd(e.row)}}},[t._v("编辑")]),t._v(" "),a("router-link",{staticClass:"mr10",attrs:{to:{path:t.roterPre+"/product/cdkey/creatCdkey?id="+e.row.id+"&name="+e.row.name}}},[a("el-button",{attrs:{type:"text",size:"small"}},[t._v("管理卡密")])],1),t._v(" "),e.row.productAttrValueName||e.row.productName?t._e():[a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.handleDelete(e.row)}}},[t._v("删除")])]]}}])})],1),t._v(" "),a("div",{staticClass:"block"},[a("el-pagination",{attrs:{background:"","page-size":t.tableFrom.limit,"current-page":t.tableFrom.page,layout:"total, sizes, prev, pager, next, jumper",total:t.tableData.total},on:{"size-change":t.handleSizeChange,"current-change":t.pageChange}})],1)],1),t._v(" "),a("el-dialog",{attrs:{visible:t.dialogVisible,title:0===t.formValidate.id?"新增卡密库":"编辑卡密库","destroy-on-close":"","close-on-click-modal":!1,width:"540px"},on:{"update:visible":function(e){t.dialogVisible=e}}},[a("el-form",{ref:"formValidate",staticClass:"formValidate",attrs:{rules:t.ruleValidate,model:t.formValidate,"label-width":"90px",size:"small"},nativeOn:{submit:function(t){t.preventDefault()}}},[a("el-form-item",{attrs:{label:"卡密库名称:",prop:"name"}},[a("el-input",{attrs:{placeholder:"请输入卡密库名称,最多32字",maxlength:"32",clearable:""},model:{value:t.formValidate.name,callback:function(e){t.$set(t.formValidate,"name","string"===typeof e?e.trim():e)},expression:"formValidate.name"}})],1),t._v(" "),a("el-form-item",{attrs:{label:"备注:"}},[a("el-input",{attrs:{placeholder:"请输入备注,最多可输入200字",maxlength:"200",type:"textarea",clearable:""},model:{value:t.formValidate.remark,callback:function(e){t.$set(t.formValidate,"remark","string"===typeof e?e.trim():e)},expression:"formValidate.remark"}})],1)],1),t._v(" "),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{attrs:{size:"small"},on:{click:function(e){t.dialogVisible=!1}}},[t._v("取消")]),t._v(" "),a("el-button",{staticClass:"submission",attrs:{type:"primary",size:"small",loading:t.loadingBtn},on:{click:function(e){return t.handleSubmit("formValidate")}}},[t._v("确定")])],1)],1)],1)},i=[],r=(a("7f7f"),a("c4c8")),o=a("83d6"),n=a("61f7"),s={page:1,limit:20,name:"",productName:""},c={name:"cdkey",data:function(){return{roterPre:o["roterPre"],productName:"",name:"",listLoading:!1,tableData:{data:[],total:0},tableFrom:Object.assign({},s),dialogVisible:!1,formValidate:{name:"",remark:"",id:0},loadingBtn:!1,ruleValidate:{name:[{required:!0,message:"请填写卡密库名称",trigger:"blur"}]}}},mounted:function(){this.getList()},methods:{searchReset:function(){this.$refs.searchForm.resetFields(),this.getList(1)},handleAdd:function(t){t?Object.assign(this.formValidate,t):Object.assign(this.formValidate,{name:"",remark:"",id:0}),this.dialogVisible=!0},handleSubmit:Object(n["a"])((function(t){var e=this;this.$refs[t].validate((function(t){t&&(e.loadingBtn=!0,0===e.formValidate.id?Object(r["mb"])(e.formValidate).then((function(t){e.$message.success("新增成功"),e.dialogVisible=!1,e.getList(1),e.loadingBtn=!1})).catch((function(t){e.loadingBtn=!1})):Object(r["Jb"])(e.formValidate.id,e.formValidate).then((function(t){e.$message.success("编辑成功"),e.loadingBtn=!1,e.dialogVisible=!1,e.getList(1)})).catch((function(t){e.loadingBtn=!1})))}))})),getList:function(t){var e=this;this.listLoading=!0,this.tableFrom.page=t||this.tableFrom.page,Object(r["lb"])(this.tableFrom).then((function(t){e.tableData.data=t.data.list,e.tableData.total=t.data.count,e.listLoading=!1})).catch((function(t){e.listLoading=!1}))},pageChange:function(t){this.tableFrom.page=t,this.getList()},handleSizeChange:function(t){this.tableFrom.limit=t,this.getList()},handleDelete:function(t){var e=this;t.attrValue?this.$modalSureDelete("此卡密库存在关联商品,确定删除吗").then((function(){Object(r["kb"])(t.id).then((function(){e.$message.success("删除成功"),e.handleDeleteTable(e.tableData.data.length,e.tableFrom),e.getList("")}))})):this.$modalSure("删除此卡密库吗").then((function(){Object(r["kb"])(t.id).then((function(){e.$message.success("删除成功"),e.handleDeleteTable(e.tableData.data.length,e.tableFrom),e.getList("")}))}))}}},d=c,m=(a("4ad3"),a("2877")),u=Object(m["a"])(d,l,i,!1,null,"7fb46385",null);e["default"]=u.exports},"4ad3":function(t,e,a){"use strict";a("eeb2")},eeb2:function(t,e,a){}}]);
|