You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
11 KiB
1 lines
11 KiB
webpackJsonp([64],{Ewwq:function(e,t){},mHKU:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=a("mvHQ"),n=a.n(r),i=a("Xxa5"),s=a.n(i),o=a("exGp"),l=a.n(o),c=a("PJh5"),u=a.n(c),m={data:function(){return{loading:{list:!1,user:!1},sendType:{0:"活动派发",1:"平台定向派发",2:"用户领取"},searchForm:{list:{page:1,limit:10,name:""},user:{page:1,limit:10,nickName:""}},tableData:{list:[],user:[]},total:{list:0,user:0},cur_coupon:{},multipleSelection:[],showDialog:!1}},activated:function(){this.getTableDataList(1,"list")},methods:{resetForm:function(e){var t=e+"Form";this.$refs[t].resetFields(),this.getTableDataList(1,e)},handleSizeChange:function(e,t){this.searchForm[t].limit=e,this.handleCurrentChange(1,t)},handleCurrentChange:function(e,t){this.searchForm[t].page=e,this.getTableDataList("",t)},getTableDataList:function(e,t){var a=this;return l()(s.a.mark(function r(){var n,i,o,l;return s.a.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(e&&(a.searchForm[t].page=1),a.tableData[t]=[],a.loading[t]=!0,n=a.searchForm[t],"list"!==t){r.next=10;break}return r.next=7,a.$api.market.couponList(n);case 7:r.t0=r.sent,r.next=13;break;case 10:return r.next=12,a.$api.custom.userList(n);case 12:r.t0=r.sent;case 13:if(i=r.t0,o=i.code,l=i.data,a.loading[t]=!1,200===o){r.next=19;break}return r.abrupt("return");case 19:a.tableData[t]=l.data,a.total[t]=l.total;case 21:case"end":return r.stop()}},r,a)}))()},confirmDel:function(e){var t=this;this.$confirm(this.$t("tips.confirmDelete"),this.$t("tips.reminder"),{confirmButtonText:this.$t("action.comfirm"),cancelButtonText:this.$t("action.cancel"),type:"warning"}).then(function(){t.updateItem(e,-1)}).catch(function(){})},updateItem:function(e,t){var a=this;return l()(s.a.mark(function r(){return s.a.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:a.$api.market.couponUpdate({id:e,status:t}).then(function(e){if(200===e.code)a.$message.success(a.$t(-1===t?"tips.successDel":"tips.successOper")),-1===t&&(a.searchForm.list.page=a.searchForm.list.page<Math.ceil((a.total.list-1)/a.searchForm.list.limit)?a.searchForm.list.page:Math.ceil((a.total.list-1)/a.searchForm.list.limit),a.getTableDataList("","list"));else{if(-1===t)return;a.getTableDataList("","list")}});case 1:case"end":return r.stop()}},r,a)}))()},toShowDialog:function(e){var t=this;return l()(s.a.mark(function a(){return s.a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return t.searchForm.user.nickName="",t.cur_coupon=JSON.parse(n()(e)),a.next=4,t.getTableDataList(1,"user");case 4:t.showDialog=!t.showDialog;case 5:case"end":return a.stop()}},a,t)}))()},handleSelectionChange:function(e){this.multipleSelection=e},handleDialogConfirm:function(){var e=this;return l()(s.a.mark(function t(){var a,r,i,o,l,c,u,m,p,d,h;return s.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!((a=JSON.parse(n()(e.multipleSelection))).length<1)){t.next=4;break}return e.$message.error("请选择用户"),t.abrupt("return");case 4:t.t0=s.a.keys(a);case 5:if((t.t1=t.t0()).done){t.next=15;break}if(r=t.t1.value,i=1*r+1,o=a[r],l=o.id,c=o.nickName,u=o.num,m=c?";用户昵称:"+c:"",void 0===u?0:u){t.next=13;break}return e.$message.error("选择用户 第"+i+"条数据:(用户ID:"+l+m+")未设置卡券数量"),t.abrupt("return");case 13:t.next=5;break;case 15:return p=a.map(function(e){return{id:e.id,num:e.num}}),d={coupon_id:e.cur_coupon.id,user:p},t.next=19,e.$api.market.couponRecordAdd(d);case 19:if(h=t.sent,200===h.code){t.next=24;break}return e.showDialog=!1,t.abrupt("return");case 24:e.$message.success("卡券派发成功"),e.getTableDataList("","list"),e.showDialog=!1;case 27:case"end":return t.stop()}},t,e)}))()}},filters:{handleTime:function(e,t){return 1===t?u()(1e3*e).format("YYYY-MM-DD"):2===t?u()(1e3*e).format("HH:mm:ss"):u()(1e3*e).format("YYYY-MM-DD HH:mm:ss")}}},p={render:function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"lb-examine-goods"},[a("top-nav"),e._v(" "),a("div",{staticClass:"page-main"},[a("el-row",{staticClass:"page-top-operate"},[a("lb-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:e.$route.name+"-add",expression:"`${$route.name}-add`"}],attrs:{type:"primary",icon:"el-icon-plus"},on:{click:function(t){return e.$router.push("/market/coupon/edit")}}},[e._v(e._s(e.$t("menu.MarketCouponAdd")))])],1),e._v(" "),a("el-row",{staticClass:"page-search-form"},[a("el-form",{ref:"listForm",attrs:{inline:!0,model:e.searchForm.list},nativeOn:{submit:function(e){e.preventDefault()}}},[a("el-form-item",{attrs:{label:"输入查询",prop:"name"}},[a("el-input",{attrs:{placeholder:"请输入卡券名称"},model:{value:e.searchForm.list.name,callback:function(t){e.$set(e.searchForm.list,"name",t)},expression:"searchForm.list.name"}})],1),e._v(" "),a("el-form-item",[a("lb-button",{staticStyle:{"margin-right":"5px"},attrs:{size:"medium",type:"primary",icon:"el-icon-search"},on:{click:function(t){return e.getTableDataList(1,"list")}}},[e._v(e._s(e.$t("action.search")))]),e._v(" "),a("lb-button",{staticStyle:{"margin-right":"5px"},attrs:{size:"medium",icon:"el-icon-refresh-left"},on:{click:function(t){return e.resetForm("list")}}},[e._v(e._s(e.$t("action.reset")))])],1)],1)],1),e._v(" "),a("el-table",{directives:[{name:"loading",rawName:"v-loading",value:e.loading.list,expression:"loading.list"}],staticStyle:{width:"100%"},attrs:{data:e.tableData.list,"header-cell-style":{background:"#f5f7fa",color:"#606266"}}},[a("el-table-column",{attrs:{prop:"id",label:"ID"}}),e._v(" "),a("el-table-column",{attrs:{prop:"title",label:"卡券名称"}}),e._v(" "),a("el-table-column",{attrs:{prop:"type",label:"使用条件"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("p",[e._v("\n "+e._s(0===t.row.type?"消费满¥"+t.row.full+"减¥"+t.row.discount:"立减¥"+t.row.discount)+"\n ")])]}}])}),e._v(" "),a("el-table-column",{attrs:{prop:"send_type","min-width":"120",label:"派发方式"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("p",[e._v(e._s(e.sendType[t.row.send_type]))])]}}])}),e._v(" "),a("el-table-column",{attrs:{prop:"top",width:"100",label:"排序值"}}),e._v(" "),a("el-table-column",{attrs:{prop:"create_time","min-width":"120",label:"创建时间"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("p",[e._v(e._s(e._f("handleTime")(t.row.create_time,1)))]),e._v(" "),a("p",[e._v(e._s(e._f("handleTime")(t.row.create_time,2)))])]}}])}),e._v(" "),a("el-table-column",{attrs:{prop:"status",label:"是否上架"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("el-switch",{attrs:{disabled:!e.$route.meta.pagePermission[0].auth.includes("edit"),"active-value":1,"inactive-value":0},on:{change:function(a){return e.updateItem(t.row.id,t.row.status)}},model:{value:t.row.status,callback:function(a){e.$set(t.row,"status",a)},expression:"scope.row.status"}})]}}])}),e._v(" "),a("el-table-column",{attrs:{label:"操作","min-width":"120"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("div",{staticClass:"table-operate"},[a("lb-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:e.$route.name+"-edit",expression:"`${$route.name}-edit`"}],attrs:{size:"mini",plain:"",type:"primary"},on:{click:function(a){return e.$router.push("/market/coupon/edit?id="+t.row.id)}}},[e._v(e._s(e.$t("action.edit")))]),e._v(" "),a("lb-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:e.$route.name+"-delete",expression:"`${$route.name}-delete`"}],attrs:{size:"mini",plain:"",type:"danger"},on:{click:function(a){return e.confirmDel(t.row.id)}}},[e._v(e._s(e.$t("action.delete")))]),e._v(" "),a("lb-button",{directives:[{name:"show",rawName:"v-show",value:1===t.row.send_type,expression:"scope.row.send_type === 1"},{name:"hasPermi",rawName:"v-hasPermi",value:e.$route.name+"-handOut",expression:"`${$route.name}-handOut`"}],attrs:{size:"mini",plain:"",type:"success"},on:{click:function(a){return e.toShowDialog(t.row)}}},[e._v("指定派发")])],1)]}}])})],1),e._v(" "),a("lb-page",{attrs:{batch:!1,page:e.searchForm.list.page,pageSize:e.searchForm.list.limit,total:e.total.list},on:{handleSizeChange:function(t){return e.handleSizeChange(t,"list")},handleCurrentChange:function(t){return e.handleCurrentChange(t,"list")}}}),e._v(" "),a("el-dialog",{attrs:{title:"指定派发",visible:e.showDialog,width:"1000px",center:""},on:{"update:visible":function(t){e.showDialog=t}}},[a("lb-tips",[a("div",{staticClass:"flex-y-center"},[e._v("\n 卡券名称:\n "),a("div",{staticClass:"c-link"},[e._v(e._s(e.cur_coupon.title))])]),e._v(" "),a("div",{staticClass:"flex-y-center"},[e._v("\n 使用条件:\n "),a("div",{staticClass:"c-link"},[e._v("\n "+e._s(0===e.cur_coupon.type?"消费满¥"+e.cur_coupon.full+"减¥"+e.cur_coupon.discount:"立减¥"+e.cur_coupon.discount)+"\n ")])])]),e._v(" "),a("el-form",{ref:"userForm",attrs:{inline:!0,model:e.searchForm.user,"label-width":"70px"}},[a("el-form-item",{attrs:{label:"输入查询",prop:"nickName"}},[a("el-input",{attrs:{placeholder:"请输入用户昵称/手机号"},model:{value:e.searchForm.user.nickName,callback:function(t){e.$set(e.searchForm.user,"nickName",t)},expression:"searchForm.user.nickName"}})],1),e._v(" "),a("el-form-item",[a("lb-button",{staticStyle:{"margin-right":"5px"},attrs:{size:"medium",type:"primary",icon:"el-icon-search"},on:{click:function(t){return e.getTableDataList(1,"user")}}},[e._v(e._s(e.$t("action.search")))]),e._v(" "),a("lb-button",{staticStyle:{"margin-right":"5px"},attrs:{size:"medium",icon:"el-icon-refresh-left"},on:{click:function(t){return e.resetForm("user")}}},[e._v(e._s(e.$t("action.reset")))])],1)],1),e._v(" "),a("el-table",{ref:"multipleTable",staticStyle:{width:"100%"},attrs:{data:e.tableData.user,"header-cell-style":{background:"#f5f7fa",color:"#606266"},"tooltip-effect":"dark"},on:{"selection-change":e.handleSelectionChange}},[a("el-table-column",{attrs:{type:"selection",width:"55"}}),e._v(" "),a("el-table-column",{attrs:{prop:"id",width:"100",label:"用户ID"}}),e._v(" "),a("el-table-column",{attrs:{prop:"nickName",label:"用户昵称"}}),e._v(" "),a("el-table-column",{attrs:{prop:"avatarUrl",width:"150",label:"用户头像"},scopedSlots:e._u([{key:"default",fn:function(e){return[a("lb-image",{attrs:{src:e.row.avatarUrl}})]}}])}),e._v(" "),a("el-table-column",{attrs:{prop:"phone",label:"手机号"}}),a("el-table-column",{attrs:{prop:"num",label:"卡券数量",width:"220"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("el-input-number",{staticClass:"lb-input-number mini",attrs:{controls:!1,min:1,precision:0,placeholder:"请输入卡券数量"},model:{value:t.row.num,callback:function(a){e.$set(t.row,"num",a)},expression:"scope.row.num"}})]}}])})],1),e._v(" "),a("lb-page",{attrs:{batch:!1,page:e.searchForm.user.page,pageSize:e.searchForm.user.limit,total:e.total.user},on:{handleSizeChange:function(t){return e.handleSizeChange(t,"user")},handleCurrentChange:function(t){return e.handleCurrentChange(t,"user")}}}),e._v(" "),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(t){e.showDialog=!1}}},[e._v("取 消")]),e._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:e.handleDialogConfirm}},[e._v("确 定")])],1)],1)],1)],1)},staticRenderFns:[]};var d=a("VU/8")(m,p,!1,function(e){a("Ewwq")},"data-v-59d45a5a",null);t.default=d.exports}}); |