2 lines
16 KiB
JavaScript
2 lines
16 KiB
JavaScript
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-551b767f"],{"6b45":function(e,t,r){"use strict";var n=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticClass:"upload-container"},[r("el-upload",{staticClass:"image-uploader",attrs:{data:e.dataObj,name:"image-file",accept:"image/jpeg,image/gif,image/png",multiple:!1,"show-file-list":!1,"on-success":e.handleImageSuccess,drag:"",action:e.uploadUrl}},[r("i",{staticClass:"el-icon-upload"}),r("div",{staticClass:"el-upload__text"},[e._v(" 将文件拖到此处,或"),r("em",[e._v("点击上传")])])]),r("div",{staticClass:"image-preview"},[r("div",{directives:[{name:"show",rawName:"v-show",value:e.imageUrl.length>1,expression:"imageUrl.length>1"}],staticClass:"image-preview-wrapper"},[r("img",{attrs:{src:e.imageUrl}}),r("div",{staticClass:"image-preview-action"},[r("i",{staticClass:"el-icon-delete",on:{click:e.rmImage}})])])])],1)},a=[],o=r("d4ec"),i=r("bee2"),s=r("262e"),c=r("2caf"),u=r("9ab4"),l=r("1b40"),p=function(e){Object(s["a"])(r,e);var t=Object(c["a"])(r);function r(){var e;return Object(o["a"])(this,r),e=t.apply(this,arguments),e.uploadUrl="https://opm.kingsome.cn/api/upload",e.tempUrl="",e.dataObj={sub_path:"game",type:"image"},e}return Object(i["a"])(r,[{key:"imageUrl",get:function(){return this.value}},{key:"emitInput",value:function(e){this.$emit("input",e)}},{key:"rmImage",value:function(){this.emitInput("")}},{key:"handleImageSuccess",value:function(e){console.log(e),this.emitInput(e.url_cdn)}}]),r}(l["c"]);Object(u["a"])([Object(l["b"])({default:""})],p.prototype,"value",void 0),p=Object(u["a"])([Object(l["a"])({name:"UploadImage"})],p);var d=p,h=d,f=(r("961d"),r("0c7c")),m=Object(f["a"])(h,n,a,!1,null,"62f54f8e",null);t["a"]=m.exports},8397:function(e,t,r){e.exports={menuBg:"#304156",menuText:"#bfcbd9",menuActiveText:"#409eff"}},8712:function(e,t,r){"use strict";r("8397")},8960:function(e,t,r){"use strict";r.d(t,"a",(function(){return a})),r.d(t,"d",(function(){return o})),r.d(t,"c",(function(){return i})),r.d(t,"e",(function(){return s})),r.d(t,"b",(function(){return c}));var n=r("b32d"),a={shop:"",name:"",content:"",total:0,count:0,limitOne:1},o=function(e){return Object(n["a"])({url:"/api/coupons",method:"post",params:e})},i=function(e,t){return Object(n["a"])({url:"/api/coupon/".concat(e),method:"get",params:t})},s=function(e){return Object(n["a"])({url:"/api/coupon/save",method:"post",data:e})},c=function(e){return Object(n["a"])({url:"/api/coupon/".concat(e,"/delete"),method:"post"})}},"961d":function(e,t,r){"use strict";r("b43b")},a221:function(e,t,r){"use strict";r.r(t);var n=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticClass:"app-container"},[r("el-alert",{attrs:{title:"转盘一共需要配置8个项目",type:"success",description:"如果不满8个, 保存时, 会自动填充空的数据, 请自己修改留空项的出现概率",effect:"dark"}}),r("div",{staticClass:"action-bar"},[1===e.userLevel?r("el-select",{staticClass:"w100",attrs:{placeholder:"选择"+e.$t("main.shop"),name:"shop",required:""},model:{value:e.shop,callback:function(t){e.shop=t},expression:"shop"}},e._l(e.allDepts,(function(e){return r("el-option",{key:e._id,attrs:{label:e.name,value:e._id}})})),1):e._e(),r("el-button",{staticStyle:{"margin-left":"10px"},attrs:{type:"primary",icon:"el-icon-edit"},on:{click:e.handleCreateReward}},[e._v(" 添加 ")])],1),r("el-table",{attrs:{data:e.rewards,border:"",fit:"","highlight-current-row":""}},[r("el-table-column",{attrs:{label:"概率",prop:"rank"}}),r("el-table-column",{attrs:{label:"奖励",prop:"coupon",formatter:e.formatCoupon}}),r("el-table-column",{attrs:{align:"center",width:"180",label:"操作",fixed:"right"},scopedSlots:e._u([{key:"default",fn:function(t){return[r("el-button",{attrs:{type:"primary",size:"small",icon:"el-icon-edit"},on:{click:function(r){return e.handleEdit(t)}}},[e._v(" 编辑 ")]),r("el-button",{staticStyle:{"margin-left":"10px"},attrs:{type:"danger",size:"small"},on:{click:function(r){return e.deleteRank(t)}}},[e._v(" "+e._s(e.$t("permission.delete"))+" ")])]}}])})],1),r("div",{staticClass:"footer-bar"},[r("el-button",{attrs:{type:"primary",loading:e.saveing},on:{click:e.submitForm}},[e._v(" 保存 ")]),r("el-button",{on:{click:e.onCancel}},[e._v(" 取消 ")])],1),r("el-dialog",{attrs:{visible:e.dialogVisible,title:"编辑奖励"},on:{"update:visible":function(t){e.dialogVisible=t}}},[r("el-form",{ref:"modalForm",attrs:{model:e.record,rules:e.modalRules,"label-width":"120px","label-position":"left"}},[2!==e.record.type?r("el-form-item",{attrs:{label:"概率",prop:"rank"}},[r("el-input",{staticStyle:{width:"30%"},attrs:{placeholder:"概率",type:"number"},model:{value:e.record.rank,callback:function(t){e.$set(e.record,"rank",t)},expression:"record.rank"}})],1):e._e(),r("el-form-item",{attrs:{label:"奖励",prop:"coupon"}},[r("el-select",{staticClass:"w100",attrs:{placeholder:"选择奖励",name:"coupon",required:""},model:{value:e.record.coupon,callback:function(t){e.$set(e.record,"coupon",t)},expression:"record.coupon"}},[r("el-option",{key:"empty",attrs:{label:"留空",value:"empty"}}),r("el-option",{key:"lottery_ticket",attrs:{label:"抽奖券",value:"lottery_ticket"}}),e._l(e.coupons,(function(e){return r("el-option",{key:e._id,attrs:{label:e.name,value:e._id}})}))],2)],1),r("el-form-item",{attrs:{label:"数量",prop:"count"}},[r("el-input",{attrs:{placeholder:"数量",type:"number"},model:{value:e.record.count,callback:function(t){e.$set(e.record,"count",t)},expression:"record.count"}})],1),r("el-form-item",[r("el-button",{directives:[{name:"permission",rawName:"v-permission",value:["shop:edit"],expression:"['shop:edit']"}],attrs:{type:"primary"},on:{click:e.saveReward}},[e._v(" 保存 ")]),r("el-button",{on:{click:e.closeModal}},[e._v(" 取消 ")])],1)],1)],1)],1)},a=[],o=r("b85c"),i=r("1da1"),s=r("d4ec"),c=r("bee2"),u=r("262e"),l=r("2caf"),p=(r("99af"),r("b0c0"),r("a434"),r("96cf"),r("9ab4")),d=r("1b40"),h=r("6b45"),f=r("2ef0"),m=r("ef85"),b=r("db85"),g=r("9dba"),v=r("4c9b"),y=r("8960"),k=function(e){Object(u["a"])(r,e);var t=Object(l["a"])(r);function r(){var e;return Object(s["a"])(this,r),e=t.apply(this,arguments),e.rewards=[],e.dialogType="new",e.dialogVisible=!1,e.shop="",e.allDepts=[],e.record={type:0,count:1,rewardType:0},e.coupons=[],e.saveing=!1,e.modalRules={rank:[{required:!0,message:"请输入抽取概率",trigger:"blur"}],coupon:[{required:!0,message:"请选择奖励",trigger:"blur"}]},e}return Object(c["a"])(r,[{key:"userLevel",get:function(){return g["a"].level}},{key:"created",value:function(){var e=Object(i["a"])(regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(1!==g["a"].level){e.next=6;break}return e.next=3,this.getRemoteDeptList();case 3:v["i"].$on(v["h"],(function(){t.getRemoteDeptList()})),e.next=9;break;case 6:return this.shop=g["a"].department,e.next=9,this.fetchData();case 9:v["i"].$on(v["b"],(function(){t.shop&&t.getCouponList(t.shop)}));case 10:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"beforeDestory",value:function(){1===g["a"].level&&v["i"].$off(v["h"])}},{key:"onShopChange",value:function(){this.shop&&(this.getCouponList(this.shop),this.fetchData())}},{key:"formatCoupon",value:function(e,t,r,n){var a,i="未知(".concat(r,")"),s=this.rewards[n],c=Object(o["a"])(this.coupons);try{for(c.s();!(a=c.n()).done;){var u=a.value;if(u._id===r){i=u.name;break}}}catch(l){c.e(l)}finally{c.f()}return"lottery_ticket"===r?"抽奖券 x ".concat(s.count):"empty"===r?"留空":"".concat(i," x ").concat(s.count)}},{key:"handleCreateReward",value:function(){this.record=Object.assign({},m["b"]),this.record.id=this.rewards.length,this.dialogType="new",this.dialogVisible=!0}},{key:"handleEdit",value:function(e){this.dialogType="edit",this.dialogVisible=!0,this.record=Object(f["cloneDeep"])(e.row)}},{key:"deleteRank",value:function(){var e=Object(i["a"])(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return r=t.$index,e.prev=1,e.next=4,this.$confirm("Confirm to remove the record?","Warning",{confirmButtonText:"Confirm",cancelButtonText:"Cancel",type:"warning"});case 4:this.rewards.splice(r,1),this.$message({type:"success",message:"删除成功, 请点击保存"}),e.next=10;break;case 8:e.prev=8,e.t0=e["catch"](1);case 10:case"end":return e.stop()}}),e,this,[[1,8]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"closeModal",value:function(){this.dialogVisible=!1,this.$refs.modalForm.clearValidate()}},{key:"getRemoteDeptList",value:function(){var e=Object(i["a"])(regeneratorRuntime.mark((function e(){var t,r;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Object(b["k"])({});case 2:if(t=e.sent,r=t.data,r.records){e.next=6;break}return e.abrupt("return");case 6:this.allDepts=r.records,this.allDepts.length>0&&!this.shop&&(this.shop=this.allDepts[0]._id);case 8:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"saveReward",value:function(){var e=this,t="edit"===this.dialogType;this.$refs.modalForm.validate(function(){var r=Object(i["a"])(regeneratorRuntime.mark((function r(n){var a;return regeneratorRuntime.wrap((function(r){while(1)switch(r.prev=r.next){case 0:if(n){r.next=3;break}return e.$message.error("请按要求填写表单"),r.abrupt("return",!1);case 3:if("lottery_ticket"===e.record.coupon?e.record.rewardType=1:"empty"===e.record.coupon?e.record.rewardType=2:e.record.rewardType=0,!t){r.next=15;break}a=0;case 6:if(!(a<e.rewards.length)){r.next=13;break}if(e.rewards[a].id!==e.record.id){r.next=10;break}return e.rewards.splice(a,1,Object.assign({},e.record)),r.abrupt("break",13);case 10:a++,r.next=6;break;case 13:r.next=16;break;case 15:e.rewards.push(e.record);case 16:e.dialogVisible=!1,e.$notify({title:"Success",dangerouslyUseHTMLString:!0,message:"\n 奖励成功保存, 请点击保存\n ",type:"success"});case 18:case"end":return r.stop()}}),r)})));return function(e){return r.apply(this,arguments)}}())}},{key:"getCouponList",value:function(){var e=Object(i["a"])(regeneratorRuntime.mark((function e(t){var r,n;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Object(y["d"])({shop:t});case 2:r=e.sent,n=r.data,this.coupons=n.records;case 5:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"fetchData",value:function(){var e=Object(i["a"])(regeneratorRuntime.mark((function e(){var t,r;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return console.log("get remote shop cfg"),e.next=3,Object(b["h"])({shop:this.shop});case 3:t=e.sent,r=t.data,this.rewards=r;case 6:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"onCancel",value:function(){var e=Object(i["a"])(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.$confirm("确认不保存当前修改的信息?","Warning",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"});case 3:this.$store.dispatch("delView",this.$route),this.$router.go(-1),e.next=9;break;case 7:e.prev=7,e.t0=e["catch"](0);case 9:case"end":return e.stop()}}),e,this,[[0,7]])})));function t(){return e.apply(this,arguments)}return t}()},{key:"submitForm",value:function(){var e=Object(i["a"])(regeneratorRuntime.mark((function e(){var t,r,n,a,i,s,c;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(e.prev=0,0!==this.rewards.length){e.next=4;break}return this.$message({message:"好歹填一个不留空的配置项吧",type:"error"}),e.abrupt("return",!1);case 4:t=0,r=0,n=Object(o["a"])(this.rewards);try{for(n.s();!(a=n.n()).done;)i=a.value,"empty"!==i.coupon&&(t++,r+=+i.rank)}catch(u){n.e(u)}finally{n.f()}if(0!==t){e.next=11;break}return this.$message({message:"好歹填一个不留空的配置项吧",type:"error"}),e.abrupt("return",!1);case 11:if(!(this.rewards.length>8)){e.next=14;break}return this.$message({message:"配置项不能多于8个, 请删除几个后再保存",type:"error"}),e.abrupt("return",!1);case 14:for(s=this.rewards.length;s<8;s++)this.rewards.push({coupon:"empty",rank:r,count:1,rewardType:2});return this.saveing=!0,e.next=18,Object(b["o"])({shop:this.shop,cfgs:this.rewards});case 18:c=e.sent,c.data,this.saveing=!1,this.$notify({title:"Success",message:"保存成功",type:"success",duration:2e3}),e.next=29;break;case 24:return e.prev=24,e.t0=e["catch"](0),console.error("Submit Error!"),this.saveing=!1,e.abrupt("return",!1);case 29:case"end":return e.stop()}}),e,this,[[0,24]])})));function t(){return e.apply(this,arguments)}return t}()}]),r}(d["c"]);Object(p["a"])([Object(d["d"])("shop")],k.prototype,"onShopChange",null),k=Object(p["a"])([Object(d["a"])({name:"ShopLottery",components:{UploadImage:h["a"]}})],k);var w=k,j=w,O=(r("8712"),r("0c7c")),x=Object(O["a"])(j,n,a,!1,null,null,null);t["default"]=x.exports},b43b:function(e,t,r){},db85:function(e,t,r){"use strict";r.d(t,"a",(function(){return a})),r.d(t,"k",(function(){return o})),r.d(t,"e",(function(){return i})),r.d(t,"d",(function(){return s})),r.d(t,"m",(function(){return c})),r.d(t,"b",(function(){return u})),r.d(t,"n",(function(){return l})),r.d(t,"f",(function(){return p})),r.d(t,"g",(function(){return d})),r.d(t,"q",(function(){return h})),r.d(t,"p",(function(){return f})),r.d(t,"c",(function(){return m})),r.d(t,"l",(function(){return b})),r.d(t,"h",(function(){return g})),r.d(t,"o",(function(){return v})),r.d(t,"i",(function(){return y})),r.d(t,"r",(function(){return k})),r.d(t,"j",(function(){return w}));var n=r("b32d"),a={name:"",address:"",logo:"",qtypes:[]},o=function(e){return Object(n["a"])({url:"/api/shops",method:"post",params:e})},i=function(e,t){return Object(n["a"])({url:"/api/shop/".concat(e),method:"get",params:t})},s=function(){return Object(n["a"])({url:"/api/myshop",method:"get"})},c=function(e){return Object(n["a"])({url:"/api/shop/save",method:"post",data:e})},u=function(e){return Object(n["a"])({url:"/api/shop/".concat(e,"/delete"),method:"post"})},l=function(e){return Object(n["a"])({url:"/api/shop/gameinfo/save",method:"post",data:e})},p=function(e){return Object(n["a"])({url:"/api/shop/gameinfo",method:"post",data:e})},d=function(e){return Object(n["a"])({url:"/api/shop/gameqr",method:"post",data:e})},h=function(e){return Object(n["a"])({url:"/api/shop/save_qtype",method:"post",data:e})},f=function(e){return Object(n["a"])({url:"/api/shop/publish",method:"post",data:e})},m=function(e){return Object(n["a"])({url:"/api/shop/gametheme",method:"post",data:e})},b=function(e){return Object(n["a"])({url:"/api/shop/gametheme/save",method:"post",data:e})},g=function(e){return Object(n["a"])({url:"/api/shop/lottery",method:"post",data:e})},v=function(e){return Object(n["a"])({url:"/api/shop/lottery_update",method:"post",data:e})},y=function(e){return Object(n["a"])({url:"/api/shop/share",method:"post",data:e})},k=function(e){return Object(n["a"])({url:"/api/shop/share_update",method:"post",data:e})},w=function(e){return Object(n["a"])({url:"/api/shop/game_users",method:"post",data:e})}},ef85:function(e,t,r){"use strict";r.d(t,"b",(function(){return a})),r.d(t,"a",(function(){return o})),r.d(t,"e",(function(){return i})),r.d(t,"d",(function(){return s})),r.d(t,"g",(function(){return c})),r.d(t,"c",(function(){return u})),r.d(t,"f",(function(){return l}));var n=r("b32d"),a={count:1,type:0,rewardType:0},o={beginDays:[],active:!1,beginTime:[],monthDays:[],weekDays:[],name:"",prepareTime:0,qcount:0,qtypes:[],repeatType:0,shop:"",rewardInfo:[]},i=function(e){return Object(n["a"])({url:"/api/activitys",method:"post",params:e})},s=function(e,t){return Object(n["a"])({url:"/api/activity/".concat(e),method:"get",params:t})},c=function(e){return Object(n["a"])({url:"/api/activity/save",method:"post",data:e})},u=function(e){return Object(n["a"])({url:"/api/activity/".concat(e,"/delete"),method:"post"})},l=function(e){return Object(n["a"])({url:"/api/activity/publish",method:"post",data:e})}}}]);
|
|
//# sourceMappingURL=chunk-551b767f.d2f1aa09.js.map
|