(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-50b4157a"],{"02bd":function(t,e,a){},3157:function(t,e,a){"use strict";a("02bd")},3519:function(t,e,a){"use strict";a.r(e);var s=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"app-container"},[a("div",{staticClass:"app-form margin-top"},[a("div",{staticClass:"app-form-group"},[a("div",{staticClass:"app-form-ti"},[t._v("基础配置")]),a("form-generator",{ref:"basicForm",attrs:{"form-config":t.formConfig,"show-footer":!0,showCancel:!0,cancelText:"返回"},on:{submit:t.handleBasicSubmit,cancel:t.handleCancel},scopedSlots:t._u([{key:"stock",fn:function(e){var s=e.form;return[a("el-form-item",{attrs:{label:"库存设置"}},t._l(s.stock,(function(e,s){return a("div",{key:s,staticClass:"flex margin-bottom"},[a("el-input",{staticClass:"form-input",model:{value:e.title,callback:function(a){t.$set(e,"title",a)},expression:"item.title"}},[a("template",{slot:"prepend"},[t._v("名称")])],2),a("el-input",{staticClass:"form-input margin-left",model:{value:e.unit,callback:function(a){t.$set(e,"unit",a)},expression:"item.unit"}},[a("template",{slot:"prepend"},[t._v("单位")])],2),a("el-input",{staticClass:"form-input margin-left",model:{value:e.reward,callback:function(a){t.$set(e,"reward",a)},expression:"item.reward"}},[a("template",{slot:"prepend"},[t._v("出库奖励")]),a("template",{slot:"append"},[t._v("元")])],2)],1)})),0)]}},{key:"association_stock",fn:function(e){var s=e.form;return[a("el-form-item",{attrs:{label:"关联库存"}},[t._l(s.association_stock,(function(e,o){return a("div",{staticClass:"flex margin-bottom"},[a("div",{staticClass:"select-wrap"},[a("div",{staticClass:"select-title"},[t._v("主库存")]),a("el-select",{staticClass:"form-select",on:{change:function(e){return t.handleAssociaChange(e,o,s)}},model:{value:e.stock,callback:function(a){t.$set(e,"stock",a)},expression:"associatItem.stock"}},t._l(t.options,(function(t){return a("el-option",{key:t.value,attrs:{label:t.label,value:t.value}})})),1)],1),a("div",{staticClass:"select-wrap"},[a("div",{staticClass:"select-title"},[t._v("关联库存")]),a("el-select",{staticClass:"form-select",attrs:{multiple:""},model:{value:e.goal,callback:function(a){t.$set(e,"goal",a)},expression:"associatItem.goal"}},t._l(t.options.filter((function(t){return t.value!=e.stock||""==t.value})),(function(t){return a("el-option",{key:t.value,attrs:{label:t.label,value:t.value}})})),1)],1),a("el-input",{staticClass:"form-input",model:{value:e.deduct_stock,callback:function(a){t.$set(e,"deduct_stock",a)},expression:"associatItem.deduct_stock"}},[a("template",{slot:"prepend"},[t._v("扣除库存")])],2),a("el-button",{staticClass:"margin-left",attrs:{type:"danger",size:"mini"},on:{click:function(e){return t.removeAssociationStock(o)}}},[t._v("删除")])],1)})),a("el-button",{attrs:{type:"primary"},on:{click:t.addAssociationStock}},[t._v("添加")]),a("el-alert",{staticClass:"maring-top",attrs:{title:"选择主库存和关联库存后，主库存每扣除一个，关联库存就扣除指定数量",type:"info","show-icon":""}})],2)]}}]),model:{value:t.formData,callback:function(e){t.formData=e},expression:"formData"}})],1)])])},o=[],i=a("7f70"),l=(a("9ca6"),a("e8d6"),a("baf6"),a("5c41"),a("0c43"),a("6994"),a("8327")),n={name:"SaleQuota",data:function(){return{formData:{status:1},levels:[],options:[{label:"选择库存",value:""},{label:"第一项",value:0},{label:"第二项",value:1}]}},computed:Object(i["a"])(Object(i["a"])({},Object(l["b"])(["config"])),{},{formConfig:function(){var t=[{type:"radio",label:"状态",prop:"status",required:!0,width:"400px",options:[{label:"启用",value:1},{label:"禁用",value:0}]}];return 1==this.formData.status&&t.push({label:"开启等级",prop:"level",type:"select",width:"400px",multiple:!0,options:this.levels},{label:"库存设置",prop:"stock",width:"400px",slot:"stock"},{label:"关联库存",prop:"association_stock",width:"400px",slot:"association_stock"}),t}}),created:function(){},watch:{config:{handler:function(t){this.init()},deep:!0,immediate:!0}},methods:{init:function(){var t=this,e=this.$util.restJson(this.config.salequota);e&&(this.formData=e),this.api.get("fenxiao/level/all").then((function(e){if(1==e.code){var a=e.data.list.map((function(t){return{label:t.title,value:t.id}}));a.unshift({label:"选择等级",value:-1}),t.levels=a}}))},handleBasicSubmit:function(t){var e=this;this.api.post("salequota/config/set",t).then((function(t){1==t.code?(e.$util.success(t.message),e.$store.dispatch("settings/getSetting")):e.$util.error(t.message)}))},handleCancel:function(){this.$router.back()},addStock:function(){this.formData.stock.push({title:"",unit:"",reward:""})},removeStock:function(t){this.formData.stock.splice(t,1)},handleAssociaChange:function(t,e,a){a.association_stock[e].goal=[]},addAssociationStock:function(){this.formData.association_stock.push({deduct_stock:"",stock:0,goal:[]})},removeAssociationStock:function(t){this.formData.association_stock.splice(t,1)}}},c=n,r=(a("3157"),a("3d7a")),u=Object(r["a"])(c,s,o,!1,null,"3edd3c3a",null);e["default"]=u.exports}}]);