chunk-d09d58b6.2b8b4c11.js 18 KB

1
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-d09d58b6"],{"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 n(t){document.documentElement.scrollTop=t,document.body.parentNode.scrollTop=t,document.body.scrollTop=t}function a(){return document.documentElement.scrollTop||document.body.parentNode.scrollTop||document.body.scrollTop}function i(t,e,r){var i=a(),l=t-i,s=20,u=0;e="undefined"===typeof e?500:e;var c=function t(){u+=s;var a=Math.easeInOutQuad(u,i,l,e);n(a),u<e?o(t):r&&"function"===typeof r&&r()};c()}},"223b":function(t,e,r){"use strict";r("ebba")},"3a73":function(t,e,r){"use strict";r.d(e,"c",(function(){return n})),r.d(e,"b",(function(){return a})),r.d(e,"a",(function(){return i})),r.d(e,"d",(function(){return l})),r.d(e,"g",(function(){return s})),r.d(e,"f",(function(){return u})),r.d(e,"h",(function(){return c})),r.d(e,"e",(function(){return p}));var o=r("b775");function n(t){return Object(o["a"])({url:"/api-web/luckDrawGroup/list",method:"get",headers:{"content-type":"application/x-www-form-urlencoded"},data:{},params:t})}function a(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 l(t){return Object(o["a"])({url:"/api-web/luckDrawGroup/update",method:"post",data:t})}function s(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 p(t){return Object(o["a"])({url:"/api-web/luckDrawLog/rewardlist",method:"get",headers:{"content-type":"application/x-www-form-urlencoded"},data:{},params:t})}},"5cb2":function(t,e,r){},"9f89":function(t,e,r){"use strict";r("5cb2")},a5b0:function(t,e,r){"use strict";var o=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("el-tooltip",{attrs:{effect:"dark",placement:"top"}},[r("div",{staticStyle:{"max-width":"200px"},attrs:{slot:"content"},slot:"content"},[t._v(t._s(t.content))]),t._v(" "),r("span",{staticClass:"content-tooltip"},[t._v(t._s(t.content))])])},n=[],a={name:"scrollPane",props:{content:{required:!0,type:String}},data:function(){return{}},methods:{}},i=a,l=(r("9f89"),r("2877")),s=Object(l["a"])(i,o,n,!1,null,"754f10ff",null);e["a"]=s.exports},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"},[t._m(0),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("添加")]),t._v(" "),r("el-form",{staticClass:"searchForm",attrs:{inline:!0},model:{value:t.searchForm,callback:function(e){t.searchForm="string"===typeof e?e.trim():e},expression:"searchForm"}},[r("el-form-item",[r("el-input",{attrs:{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-select",{staticStyle:{width:"100% !important"},attrs:{placeholder:"请选择所属活动"},model:{value:t.searchForm.groupId,callback:function(e){t.$set(t.searchForm,"groupId","string"===typeof e?e.trim():e)},expression:"searchForm.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",[r("el-button",{attrs:{type:"danger"},on:{click:t.getList}},[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:"enabled",label:"是否启用"},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v("\n "+t._s(e.row.enabled?"启用":"不启用")+"\n ")]}}])}),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}})]}}])}),t._v(" "),r("el-table-column",{attrs:{align:"center",label:"操作"},scopedSlots:t._u([{key:"default",fn:function(e){return[r("el-button",{directives:[{name:"permission",rawName:"v-permission",value:"luckDrawPrize/update",expression:"'luckDrawPrize/update'"}],attrs:{type:"text"},on:{click:function(r){return t.onOperationTrophy("update",e.row)}}},[t._v("修改")])]}}])})],1),t._v(" "),r("pagination",{attrs:{total:t.pageInfo.total,page:t.pageInfo.page,limit:t.pageInfo.limit,"page-sizes":t.pageInfo.page_size},on:{"update:page":function(e){return t.$set(t.pageInfo,"page",e)},"update:limit":function(e){return t.$set(t.pageInfo,"limit",e)},pagination:t.getList}})],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}}},[r("trophy-create",{attrs:{groupList:t.groupList,getList:t.getList,close:t.onPopupClose}})],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)},n=[function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("h2",[r("div",{staticClass:"squrt"}),t._v("奖品设置\n ")])}],a=(r("7f7f"),r("c5f6"),r("96cf"),r("1da1")),i=r("a5b0"),l=r("333d"),s=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("注意:活动所有奖品的中奖概率之和必须等于100%; "),r("br"),t._v("活动奖品必须选择一个默认奖品,该奖品建议设置为谢谢参与;")]),t._v(" "),r("el-form-item",{attrs:{label:"所属活动",prop:"groupId","label-width":"100PX"}},[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(" "),t._l(t.form.rewordList,(function(e,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: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)],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),t._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:t.form.memo,callback:function(e){t.$set(t.form,"memo","string"===typeof e?e.trim():e)},expression:"form.memo"}})],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)},u=[],c=(r("ac6a"),r("5a0c"),r("6612")),p=r.n(c),m=r("e3eb"),f=r.n(m),d=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()},h=function(t,e,r){""==e&&"string"==typeof e||null==e?r(new Error("请输入中奖概率")):e<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 t=this.form;t.rewordList.length<=1||this.form.rewordList.pop()},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),n=o.rewordList?o.rewordList:[],a=[],i=0;if(n.forEach((function(t){i+=Number(t.chances),a.push({name:t.name,groupId:o.groupId,chances:p()(t.chances?t.chances/100:0).format("0.00"),stock:t.stock,isDefault:t.isDefault,memo:o.memo,enabled:1})})),100!=i)return void e.$message.error("所有奖品的概率之和必须等于100%");Object(d["f"])(a).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()}}},v=b,w=(r("223b"),r("2877")),_=Object(w["a"])(v,s,u,!1,null,"de543970",null),y=_.exports,k=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()},x=function(t,e,r){""==e&&"string"==typeof e||null==e?r(new Error("请输入中奖概率")):e<0?r(new Error("输入值不能小于0")):r()},I={components:{pagination:l["a"],Tooltip:i["a"],trophyCreate:y},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:x,trigger:"blur"}],stock:[{required:!0,validator:k,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(){},mounted:function(){var t=Object(a["a"])(regeneratorRuntime.mark((function t(){return regeneratorRuntime.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}(),activated:function(){var t=Object(a["a"])(regeneratorRuntime.mark((function t(){return regeneratorRuntime.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}(),methods:{__init:function(){var t=Object(a["a"])(regeneratorRuntime.mark((function t(){var e,r=this;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return e=this.$route.query,t.next=3,Object(d["b"])({page:1,rows:9999}).then((function(t){var o,n=t.data;200==t.code&&(r.groupList=(null===n||void 0===n?void 0:n.length)>0?n:[],r.searchForm.groupId=e.groupId?Number(e.groupId):null===(o=r.groupList[0])||void 0===o?void 0:o.id)}));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:p()(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(d["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=this.pageInfo.limit,e.page=this.pageInfo.page,Object(d["g"])(f()(e)).then((function(e){200==e.code&&e.data&&(t.tableList=e.data.rows,t.pageInfo.total=e.data.total)}))}}},L=I,D=Object(w["a"])(L,o,n,!1,null,null,null);e["default"]=D.exports},ebba:function(t,e,r){}}]);