chunk-f9cb2fc8.332ee572.js 17 KB

1
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-f9cb2fc8"],{"03ad":function(t,e,r){},"09f4":function(t,e,r){"use strict";r.d(e,"a",(function(){return i})),Math.easeInOutQuad=function(t,e,r,o){return t/=o/2,t<1?r/2*t*t+e:(t--,-r/2*(t*(t-2)-1)+e)};var o=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(t){window.setTimeout(t,1e3/60)}}();function a(t){document.documentElement.scrollTop=t,document.body.parentNode.scrollTop=t,document.body.scrollTop=t}function n(){return document.documentElement.scrollTop||document.body.parentNode.scrollTop||document.body.scrollTop}function i(t,e,r){var i=n(),s=t-i,l=20,u=0;e="undefined"===typeof e?500:e;var c=function t(){u+=l;var n=Math.easeInOutQuad(u,i,s,e);a(n),u<e?o(t):r&&"function"===typeof r&&r()};c()}},"3a73":function(t,e,r){"use strict";r.d(e,"c",(function(){return a})),r.d(e,"b",(function(){return n})),r.d(e,"a",(function(){return i})),r.d(e,"d",(function(){return s})),r.d(e,"g",(function(){return l})),r.d(e,"f",(function(){return u})),r.d(e,"h",(function(){return c})),r.d(e,"e",(function(){return m}));var o=r("b775");r("4328");function a(t){return Object(o["a"])({url:"/api-web/luckDrawGroup/list",method:"get",headers:{"content-type":"application/x-www-form-urlencoded"},data:{},params:t})}function n(t){return Object(o["a"])({url:"/api-web/luckDrawGroup/findAll",method:"get",headers:{"content-type":"application/x-www-form-urlencoded"},data:{},params:t})}function i(t){return Object(o["a"])({url:"/api-web/luckDrawGroup/add",method:"post",data:t})}function s(t){return Object(o["a"])({url:"/api-web/luckDrawGroup/update",method:"post",data:t})}function l(t){return Object(o["a"])({url:"/api-web/luckDrawPrize/list",method:"get",headers:{"content-type":"application/x-www-form-urlencoded"},data:{},params:t})}function u(t){return Object(o["a"])({url:"/api-web/luckDrawPrize/batchAdd",method:"post",data:t})}function c(t){return Object(o["a"])({url:"/api-web/luckDrawPrize/update",method:"post",data:t})}function m(t){return Object(o["a"])({url:"/api-web/luckDrawLog/rewardlist",method:"get",headers:{"content-type":"application/x-www-form-urlencoded"},data:{},params:t})}},"783f":function(t,e,r){"use strict";r("03ad")},"986a":function(t,e,r){"use strict";r("a844")},a844:function(t,e,r){},da3b:function(t,e,r){"use strict";r.r(e);var o=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"m-container"},[r("el-page-header",{staticClass:"setTrophy",attrs:{content:"奖品设置"},on:{back:t.goBack}}),t._v(" "),r("div",{directives:[{name:"permission",rawName:"v-permission",value:"luckDrawPrize/batchAdd",expression:"'luckDrawPrize/batchAdd'"}],staticClass:"newBand",on:{click:function(e){return t.onOperationTrophy("create")}}},[t._v("\n "+t._s(t.tableList.length>0?"修改":"添加")+"\n ")]),t._v(" "),r("save-form",{staticClass:"searchForm",attrs:{inline:!0,model:t.searchForm},on:{submit:t.getList}},[r("el-form-item",[r("el-input",{attrs:{clearable:"",placeholder:"请输入奖品名称"},model:{value:t.searchForm.name,callback:function(e){t.$set(t.searchForm,"name","string"===typeof e?e.trim():e)},expression:"searchForm.name"}})],1),t._v(" "),r("el-form-item",[r("el-button",{attrs:{"native-type":"submit",type:"danger"}},[t._v("搜索")])],1)],1),t._v(" "),r("div",{staticClass:"tableWrap"},[r("el-table",{attrs:{data:t.tableList,"header-cell-style":{background:"#EDEEF0",color:"#444"}}},[r("el-table-column",{attrs:{align:"center",prop:"name",label:"奖品名称"}}),t._v(" "),r("el-table-column",{attrs:{align:"center",prop:"chances",label:"中奖概率"},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v("\n "+t._s(Number((100*e.row.chances).toFixed(4)))+"%\n ")]}}])}),t._v(" "),r("el-table-column",{attrs:{align:"center",prop:"stock",label:"库存"}}),t._v(" "),r("el-table-column",{attrs:{align:"center",prop:"isDefault",label:"是否默认"},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v("\n "+t._s(e.row.isDefault?"是":"否")+"\n ")]}}])}),t._v(" "),r("el-table-column",{attrs:{align:"center",prop:"memo",label:"备注"},scopedSlots:t._u([{key:"default",fn:function(t){return[r("tooltip",{attrs:{content:t.row.memo}})]}}])})],1)],1),t._v(" "),r("el-dialog",{attrs:{title:t.formTitle[t.formActionTitle],visible:t.lotteryCreateStatus,width:"800px"},on:{"update:visible":function(e){t.lotteryCreateStatus=e}}},[t.lotteryCreateStatus?r("trophy-create",{attrs:{groupList:t.groupList,getList:t.getList,close:t.onPopupClose,list:t.tableList}}):t._e()],1),t._v(" "),r("el-dialog",{attrs:{title:t.formTitle[t.formActionTitle],visible:t.lotteryStatus,width:"500px"},on:{"update:visible":function(e){t.lotteryStatus=e},close:function(e){return t.onFormClose("trophyForm")}}},[r("el-form",{ref:"trophyForm",attrs:{model:t.form,rules:t.rules,"label-width":"100PX"}},[r("el-form-item",{attrs:{label:"奖品名称",prop:"name"}},[r("el-input",{attrs:{autocomplete:"off",placeholder:"请输入奖品名称"},model:{value:t.form.name,callback:function(e){t.$set(t.form,"name","string"===typeof e?e.trim():e)},expression:"form.name"}})],1),t._v(" "),r("el-form-item",{attrs:{label:"所属活动",prop:"groupId"}},[r("el-select",{staticStyle:{width:"100% !important"},attrs:{placeholder:"请选择所属活动"},model:{value:t.form.groupId,callback:function(e){t.$set(t.form,"groupId","string"===typeof e?e.trim():e)},expression:"form.groupId"}},t._l(t.groupList,(function(t){return r("el-option",{key:t.id,attrs:{value:t.id,label:t.name}})})),1)],1),t._v(" "),r("el-form-item",{attrs:{label:"中奖概率",prop:"chances"}},[r("el-input",{attrs:{type:"number",autocomplete:"off",placeholder:"请输入中奖概率"},model:{value:t.form.chances,callback:function(e){t.$set(t.form,"chances","string"===typeof e?e.trim():e)},expression:"form.chances"}},[r("i",{staticClass:"el-input__icon",staticStyle:{"padding-right":"5px"},attrs:{slot:"suffix"},slot:"suffix"},[t._v("%")])])],1),t._v(" "),r("el-form-item",{attrs:{label:"库存",prop:"stock"}},[r("el-input",{attrs:{type:"number",autocomplete:"off",placeholder:"请输入库存"},model:{value:t.form.stock,callback:function(e){t.$set(t.form,"stock","string"===typeof e?e.trim():e)},expression:"form.stock"}})],1),t._v(" "),r("el-form-item",{attrs:{label:"是否默认",prop:"isDefault"}},[r("el-select",{staticStyle:{width:"100% !important"},attrs:{placeholder:"请选择是否是默认"},model:{value:t.form.isDefault,callback:function(e){t.$set(t.form,"isDefault","string"===typeof e?e.trim():e)},expression:"form.isDefault"}},[r("el-option",{attrs:{value:!0,label:"是"}}),t._v(" "),r("el-option",{attrs:{value:!1,label:"否"}})],1)],1),t._v(" "),r("el-form-item",{attrs:{label:"备注",prop:"memo"}},[r("el-input",{attrs:{type:"textarea",rows:2,autocomplete:"off",placeholder:"请输入备注"},model:{value:t.form.memo,callback:function(e){t.$set(t.form,"memo","string"===typeof e?e.trim():e)},expression:"form.memo"}})],1)],1),t._v(" "),r("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[r("el-button",{on:{click:function(e){t.lotteryStatus=!1}}},[t._v("取 消")]),t._v(" "),r("el-button",{attrs:{type:"primary"},on:{click:function(e){return t.onSubmit("trophyForm")}}},[t._v("确 定")])],1)],1)],1)},a=[],n=(r("7f7f"),r("c5f6"),r("c80c")),i=(r("96cf"),r("3b8d")),s=r("a5b0"),l=r("333d"),u=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",[r("el-form",{ref:"ruleForm",attrs:{model:t.form,rules:t.rules}},[r("p",{staticStyle:{color:"red",padding:"0 0 10px 100px"}},[t._v("\n 注意:活动所有奖品的中奖概率之和必须等于100%;\n "),r("br"),t._v("活动奖品必须选择一个默认奖品,该奖品建议设置为谢谢参与;\n ")]),t._v(" "),r("el-form-item",{attrs:{label:"所属活动",prop:"groupId","label-width":"100PX"}},[r("el-select",{staticStyle:{width:"100% !important"},attrs:{placeholder:"请选择所属活动",disabled:!0},model:{value:t.form.groupId,callback:function(e){t.$set(t.form,"groupId","string"===typeof e?e.trim():e)},expression:"form.groupId"}},t._l(t.groupList,(function(t){return r("el-option",{key:t.id,attrs:{value:t.id,label:t.name}})})),1)],1),t._v(" "),t._l(t.form.rewordList,(function(e,o){return r("div",{key:o},[r("el-row",{attrs:{gutter:10}},[r("el-col",{attrs:{span:9}},[r("el-form-item",{attrs:{label:"奖品"+(o+1),"label-width":"100PX",prop:"rewordList."+o+".name",rules:[{required:!0,message:"请输入活动名称",trigger:"blur"}]}},[r("el-input",{attrs:{autocomplete:"off",placeholder:"请输入奖品名称"},model:{value:e.name,callback:function(r){t.$set(e,"name","string"===typeof r?r.trim():r)},expression:"reword.name"}})],1)],1),t._v(" "),r("el-col",{attrs:{span:5}},[r("el-form-item",{attrs:{prop:"rewordList."+o+".chances",rules:[{required:!0,validator:t.validNumber,trigger:"blur"}]}},[r("el-input",{attrs:{type:"number",autocomplete:"off",placeholder:"请输入中奖概率"},model:{value:e.chances,callback:function(r){t.$set(e,"chances","string"===typeof r?r.trim():r)},expression:"reword.chances"}},[r("i",{staticClass:"el-input__icon",staticStyle:{"padding-right":"5px"},attrs:{slot:"suffix"},slot:"suffix"},[t._v("%")])])],1)],1),t._v(" "),r("el-col",{attrs:{span:4}},[r("el-form-item",{attrs:{prop:"rewordList."+o+".stock",rules:[{required:!0,validator:t.validNumber1,trigger:"blur"}]}},[r("el-input",{attrs:{type:"number",autocomplete:"off",placeholder:"请输入库存"},model:{value:e.stock,callback:function(r){t.$set(e,"stock","string"===typeof r?r.trim():r)},expression:"reword.stock"}})],1)],1),t._v(" "),r("el-col",{attrs:{span:5}},[r("el-form-item",{attrs:{prop:"rewordList."+o+".isDefault",rules:[{required:!0,message:"请输入选择是否默认",trigger:"blur"}]}},[r("el-select",{staticStyle:{width:"100% !important"},attrs:{placeholder:"请选择是否默认"},model:{value:e.isDefault,callback:function(r){t.$set(e,"isDefault","string"===typeof r?r.trim():r)},expression:"reword.isDefault"}},[r("el-option",{attrs:{value:!0,label:"是"}}),t._v(" "),r("el-option",{attrs:{value:!1,label:"否"}})],1)],1)],1),t._v(" "),r("el-col",{attrs:{span:1}},[t.form.rewordList.length<=1?t._e():r("i",{staticClass:"el-icon-delete delete",on:{click:function(r){return t.deteleRow(e,o)}}})])],1),t._v(" "),r("el-row",[r("el-form-item",{attrs:{label:"备注","label-width":"100px",prop:"rewordList."+o+".memo"}},[r("el-input",{attrs:{type:"textarea",rows:2,autocomplete:"off",placeholder:"请输入备注"},model:{value:e.memo,callback:function(r){t.$set(e,"memo","string"===typeof r?r.trim():r)},expression:"reword.memo"}})],1)],1)],1)})),t._v(" "),r("div",{staticStyle:{"text-align":"center"}},[r("el-button",{staticClass:"add-reword",attrs:{disabled:t.form.rewordList.length<=1,round:"",icon:"el-icon-minus"},on:{click:t.onRemoveReword}},[t._v("删除奖品")]),t._v(" "),r("el-button",{staticClass:"add-reword",attrs:{round:"",icon:"el-icon-plus"},on:{click:t.onAddReword}},[t._v("添加奖品")])],1)],2),t._v(" "),r("div",{staticClass:"dialog-footer"},[r("el-button",{on:{click:function(e){return t.onClose("ruleForm")}}},[t._v("取 消")]),t._v(" "),r("el-button",{attrs:{type:"primary"},on:{click:function(e){return t.onSubmit("ruleForm")}}},[t._v("确 定")])],1)],1)},c=[],m=(r("ac6a"),r("5a0c"),r("6612")),d=r.n(m),p=r("e3eb"),f=r.n(p),h=r("3a73"),g=function(t,e,r){var o=/^[0-9]+$/;""==e&&"string"==typeof e||null==e?r(new Error("请输入库存")):!o.test(e)&&e<0?r(new Error("输入库存为正整数")):r()},b=function(t,e,r){""==e&&"string"==typeof e||null==e?r(new Error("请输入中奖概率")):e<0?r(new Error("输入值不能小于0")):r()},v={components:{pagination:l["a"],Tooltip:s["a"]},props:["groupList","close","getList","list"],data:function(){return{validNumber1:g,validNumber:b,form:{groupId:Number(this.$route.query.groupId),rewordList:[{name:null,chances:null,stock:null,isDefault:null,memo:null}]},rules:{groupId:[{required:!0,message:"请选择所属活动",trigger:"change"}]},pageInfo:{limit:10,page:1,total:1,page_size:[10,20,40,50]}}},mounted:function(){if(this.list&&Array.isArray(this.list)){var t=this.list.map((function(t){return{name:t.name,stock:t.stock,isDefault:t.isDefault,memo:t.memo,chances:100*t.chances,id:t.id}}));this.$set(this.form,"rewordList",t),this.$forceUpdate()}},methods:{onRemoveReword:function(){var t=this.form;t.rewordList.length<=1||this.form.rewordList.pop()},deteleRow:function(t,e){var r=this.form;r.rewordList.length<=1||this.form.rewordList.splice(e,1)},onAddReword:function(){var t=this.form;t.rewordList.push({name:null,chances:null,stock:null,isDefault:null})},onSubmit:function(t){var e=this;this.$refs[t].validate((function(r){if(r){var o=Object.assign({},e.form),a=o.rewordList?o.rewordList:[],n=[],i=0;if(a.forEach((function(t){i+=Number(t.chances),n.push({name:t.name,groupId:o.groupId,chances:d()(t.chances?t.chances/100:0).format("0.0000"),stock:t.stock,isDefault:t.isDefault,memo:t.memo,enabled:1,id:t.id||null})})),100!=i)return void e.$message.error("所有奖品的概率之和必须等于100%");Object(h["f"])(n).then((function(r){e.messageTips("添加",r,t)}))}}))},messageTips:function(t,e,r){200==e.code?(this.$message.success(t+"成功"),this.onClose(r),this.getList()):this.$message.error(e.msg)},onClose:function(t){this.$refs[t].resetFields(),this.close()}}},w=v,y=(r("783f"),r("2877")),k=Object(y["a"])(w,u,c,!1,null,"dfe9a01a",null),_=k.exports,x=r("ce96"),L=function(t,e,r){var o=/^[0-9]+$/;""==e&&"string"==typeof e||null==e?r(new Error("请输入库存")):!o.test(e)&&e<0?r(new Error("输入库存为正整数")):r()},D=function(t,e,r){""==e&&"string"==typeof e||null==e?r(new Error("请输入中奖概率")):e<0?r(new Error("输入值不能小于0")):r()},$={components:{pagination:l["a"],Tooltip:s["a"],trophyCreate:_},data:function(){return{searchForm:{name:null,groupId:null},formTitle:{create:"添加奖品",update:"修改奖品"},formActionTitle:"create",lotteryStatus:!1,lotteryCreateStatus:!1,tableList:[],groupList:[],form:{name:null,groupId:null,chances:null,stock:null,memo:null,isDefault:null},rules:{name:[{required:!0,message:"请输入活动名称",trigger:"blur"}],groupId:[{required:!0,message:"请选择所属活动",trigger:"change"}],chances:[{required:!0,validator:D,trigger:"blur"}],stock:[{required:!0,validator:L,trigger:"blur"}],enabled:[{required:!0,message:"请选择是否启用",trigger:"change"}],isDefault:[{required:!0,message:"请选择是否默认",trigger:"change"}]},pageInfo:{limit:10,page:1,total:1,page_size:[10,20,40,50]}}},created:function(){var t=Object(i["a"])(Object(n["a"])().mark((function t(){return Object(n["a"])().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,this.__init();case 2:case"end":return t.stop()}}),t,this)})));function e(){return t.apply(this,arguments)}return e}(),mounted:function(){},methods:{__init:function(){var t=Object(i["a"])(Object(n["a"])().mark((function t(){var e,r=this;return Object(n["a"])().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return e=this.$route.query,t.next=3,Object(h["b"])({page:1,rows:9999}).then((function(t){var o=t.data;if(200==t.code){var a,n;r.groupList=(null===o||void 0===o?void 0:o.length)>0?o:[],r.searchForm.groupId=e.groupId?Number(e.groupId):null===(a=r.groupList[0])||void 0===a?void 0:a.id;var i,s=new x["a"](r.$route.path);if(null!==(n=s.get().form)&&void 0!==n&&n.groupId)r.searchForm.groupId=null===(i=s.get().form)||void 0===i?void 0:i.groupId}}));case 3:this.getList();case 4:case"end":return t.stop()}}),t,this)})));function e(){return t.apply(this,arguments)}return e}(),onOperationTrophy:function(t,e){var r=this;this.formActionTitle=t,"update"==t?(this.$nextTick((function(){r.form={id:e.id,name:e.name,groupId:e.groupId,chances:100*e.chances,stock:e.stock,isDefault:e.isDefault,memo:e.memo}})),this.lotteryStatus=!0):"create"==t&&(this.lotteryCreateStatus=!0)},onSubmit:function(t){var e=this;this.$refs[t].validate((function(t){if(t){var r=Object.assign({},e.form),o={name:r.name,groupId:r.groupId,chances:d()(r.chances?r.chances/100:0).format("0.0000"),stock:r.stock,memo:r.memo,isDefault:r.isDefault,enabled:1};"update"==e.formActionTitle&&(o.id=r.id,Object(h["h"])(o).then((function(t){e.messageTips("修改",t)})))}}))},onPopupClose:function(){this.lotteryCreateStatus=!1},onFormClose:function(t){this.$refs[t].resetFields()},messageTips:function(t,e){200==e.code?(this.$message.success(t+"成功"),this.lotteryStatus=!1,this.getList()):this.$message.error(e.msg)},getList:function(){var t=this,e=Object.assign({},this.searchForm);e.rows=9999,e.page=1,Object(h["g"])(f()(e)).then((function(e){200==e.code&&e.data&&(t.tableList=e.data.rows)}))},goBack:function(){this.$router.push("/luckyDraw/lotteryManager")}}},I=$,O=(r("986a"),Object(y["a"])(I,o,a,!1,null,"3d1169e7",null));e["default"]=O.exports}}]);