46.6591870f270db77a84d0.js 8.21 KB
webpackJsonp([46],{GtNI:function(t,e){},ZmSP:function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=a("kmJW"),i=a("CCn6"),n={name:"dialogObj",props:["dialogObj"],data:function(){return{form:{name:"",cost_price:"",gift_num:"",stock_num:0,type:""},rules:{name:[{required:!0,message:"请输入赠品名称"},{max:20,message:"赠品名称不能超过20汉字"}],cost_price:[{required:!0,message:"请输入成本价格"},{validator:function(t,e,a){/^[\.\d]*$/.test(e)?a():a(new Error("只能填数字和小数"))}}],gift_num:[{required:!0,message:"请输入赠品总数"},{validator:function(t,e,a){/^[0-9]+$/.test(e)?a():a(new Error("只能填数字"))}}],type:[{required:!0,message:"请选择赠品类型",trigger:"change"}]}}},methods:{sub:function(){var t=this;this.$refs.form.validate(function(e){if(!e)return!1;var a={name:t.form.name,cost_price:t.form.cost_price,type:t.form.type,gift_num:t.form.gift_num};switch(t.dialogObj.type){case 0:Object(i._167)(a).then(function(e){t.$message({type:"success",message:"新增成功!"}),t.$emit("reflash"),t.dialogObj.show=!1});break;case 1:Object(i._168)(t.dialogObj.id,a).then(function(e){t.$message({type:"success",message:"修改成功!"}),t.$emit("reflash"),t.dialogObj.show=!1})}})}},watch:{"dialogObj.show":function(){var t=this;this.$nextTick(function(){t.$refs.form.resetFields(),1==t.dialogObj.type&&(t.form.name=t.dialogObj.name,t.form.cost_price=t.dialogObj.cost_price,t.form.gift_num=t.dialogObj.gift_num,t.form.stock_num=t.dialogObj.stock_num,t.form.type=t.dialogObj.gift_type.toString())})}}},l={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("el-dialog",{attrs:{title:t.dialogObj.title,visible:t.dialogObj.show,"close-on-click-modal":!1,center:"",width:"500px"},on:{"update:visible":function(e){t.$set(t.dialogObj,"show",e)}}},[a("el-form",{ref:"form",attrs:{model:t.form,rules:t.rules}},[a("el-form-item",{attrs:{label:"赠品名称",prop:"name"}},[a("el-input",{model:{value:t.form.name,callback:function(e){t.$set(t.form,"name",e)},expression:"form.name"}})],1),t._v(" "),a("el-form-item",{attrs:{label:"成本价格",prop:"cost_price"}},[a("el-input",{model:{value:t.form.cost_price,callback:function(e){t.$set(t.form,"cost_price",e)},expression:"form.cost_price"}})],1),t._v(" "),a("el-form-item",{attrs:{label:"赠品总数",prop:"gift_num"}},[a("el-input",{model:{value:t.form.gift_num,callback:function(e){t.$set(t.form,"gift_num",e)},expression:"form.gift_num"}})],1),t._v(" "),a("el-form-item",{attrs:{label:"库存数量",prop:"stock_num"}},[a("div",[t._v(t._s(t.form.stock_num))])]),t._v(" "),a("el-form-item",{attrs:{label:"赠品类型",prop:"type"}},[a("el-select",{attrs:{placeholder:"请选择",clearable:""},model:{value:t.form.type,callback:function(e){t.$set(t.form,"type",e)},expression:"form.type"}},[a("el-option",{attrs:{label:"渠道赠品(市场渠道或投放需求关联的赠品)",value:"1"}}),t._v(" "),a("el-option",{attrs:{label:"活动赠品(全勤打卡或其他运营活动关联的赠品)",value:"2"}}),t._v(" "),a("el-option",{attrs:{label:"关联赠品(销售为了关单而赠送的赠品)",value:"3"}})],1)],1)],1),t._v(" "),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(e){t.dialogObj.show=!1}}},[t._v("取 消")]),t._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:t.sub}},[t._v("保 存")])],1)],1)},staticRenderFns:[]};var s=a("VU/8")(n,l,!1,function(t){a("GtNI")},"data-v-141ff993",null).exports,r={name:"index",components:{page:o.a,dialogCom:s},filters:{idFilter:function(t){return 1==(t=t.toString()).length?"000"+t:2==t.length?"00"+t:3==t.length?"0"+t:t}},data:function(){return{searchFrom:{name:"",type:""},dataList:[],nowPage:1,total:0,limit:10,dialogObj:{type:0,show:!1,id:"",title:""}}},methods:{getDataList:function(){var t=this,e={name:this.searchFrom.name,type:this.searchFrom.type,limit:this.limit,page:this.nowPage};Object(i._206)(e).then(function(e){t.dataList=e.list,t.total=e.total})},add:function(){this.dialogObj={type:0,show:!0,id:"",title:"新增赠品"}},edit:function(t){this.dialogObj={type:1,show:!0,id:t.id,title:"编辑赠品",name:t.name,cost_price:t.cost_price,gift_num:t.gift_num,stock_num:t.stock_num,gift_type:t.gift_type}},onDown:function(t){var e=this;this.$confirm("此操作将下架该商品?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(function(){Object(i._169)(t.id).then(function(t){e.$message({type:"success",message:"操作成功!"}),e.getDataList()})}).catch(function(){})},changeShow:function(t){this.dialogObj.show=t},onPageChange:function(t){this.nowPage=t,this.getDataList()},onSizeChange:function(t){this.limit=t,this.nowPage=1,this.getDataList()}},created:function(){this.getDataList()}},c={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"container"},[a("div",{staticClass:"search-form"},[a("el-form",{attrs:{inline:!0,model:t.searchFrom,size:"small"}},[a("el-form-item",{attrs:{label:"赠品名称","label-width":"100px"}},[a("el-input",{attrs:{clearable:""},model:{value:t.searchFrom.name,callback:function(e){t.$set(t.searchFrom,"name",e)},expression:"searchFrom.name"}})],1),t._v(" "),a("el-form-item",{attrs:{label:"类型","label-width":"100px"}},[a("el-select",{attrs:{placeholder:"请选择",clearable:""},model:{value:t.searchFrom.type,callback:function(e){t.$set(t.searchFrom,"type",e)},expression:"searchFrom.type"}},[a("el-option",{attrs:{label:"渠道赠品",value:"1"}}),t._v(" "),a("el-option",{attrs:{label:"活动赠品",value:"2"}}),t._v(" "),a("el-option",{attrs:{label:"关联赠品",value:"3"}})],1)],1),t._v(" "),a("el-form-item",[a("el-button",{attrs:{type:"primary",plain:""},on:{click:t.getDataList}},[t._v("搜索")])],1),t._v(" "),a("el-form-item",[a("el-button",{attrs:{type:"success",plain:"",icon:"el-icon-plus"},on:{click:t.add}},[t._v("新增")])],1)],1)],1),t._v(" "),a("div",{staticClass:"table-form"},[a("el-table",{staticStyle:{width:"100%"},attrs:{data:t.dataList,size:"mini"}},[a("el-table-column",{attrs:{prop:"id",label:"ID"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("span",[t._v(t._s(t._f("idFilter")(e.row.id)))])]}}])}),t._v(" "),a("el-table-column",{attrs:{prop:"name",label:"赠品名称"}}),t._v(" "),a("el-table-column",{attrs:{prop:"gift_type",label:"赠品类型"},scopedSlots:t._u([{key:"default",fn:function(e){return[1==e.row.gift_type?a("div",[t._v("渠道赠品")]):t._e(),t._v(" "),2==e.row.gift_type?a("div",[t._v("活动赠品")]):t._e(),t._v(" "),3==e.row.gift_type?a("div",[t._v("关联赠品")]):t._e()]}}])}),t._v(" "),a("el-table-column",{attrs:{prop:"cost_price",label:"成本价"}}),t._v(" "),a("el-table-column",{attrs:{prop:"gift_num",label:"赠品总数"}}),t._v(" "),a("el-table-column",{attrs:{prop:"stock_num",label:"库存数量"}}),t._v(" "),a("el-table-column",{attrs:{prop:"get_num",label:"领取数量"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("router-link",{staticClass:"get_num",attrs:{to:{name:"giftDeliverRecord",query:{id:e.row.id}}}},[t._v("\n            "+t._s(e.row.get_num)+"\n          ")])]}}])}),t._v(" "),a("el-table-column",{attrs:{prop:"status",label:"状态"},scopedSlots:t._u([{key:"default",fn:function(e){return[1==e.row.status?a("div",[t._v("上架")]):t._e(),t._v(" "),2==e.row.status?a("div",[t._v("下架")]):t._e()]}}])}),t._v(" "),a("el-table-column",{attrs:{width:"150",label:"操作"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-button",{attrs:{type:"primary",size:"mini",plain:""},on:{click:function(a){t.edit(e.row)}}},[t._v("编辑")]),t._v(" "),1==e.row.status?a("el-button",{attrs:{type:"warning",size:"mini",plain:""},on:{click:function(a){t.onDown(e.row)}}},[t._v("下架\n          ")]):t._e(),t._v(" "),2==e.row.status?a("el-button",{attrs:{type:"success",size:"mini",plain:""},on:{click:function(a){t.onDown(e.row)}}},[t._v("上架\n          ")]):t._e()]}}])})],1)],1),t._v(" "),a("div",{staticClass:"pagination"},[a("page",{attrs:{nowPage:t.nowPage,total:t.total,limit:t.limit},on:{pageChange:t.onPageChange,sizeChange:t.onSizeChange}})],1),t._v(" "),a("dialog-com",{attrs:{dialogObj:t.dialogObj},on:{reflash:t.getDataList}})],1)},staticRenderFns:[]};var m=a("VU/8")(r,c,!1,function(t){a("lcqk")},"data-v-75f3a110",null);e.default=m.exports},lcqk:function(t,e){}});