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