"use strict";(self["webpackChunkvoghion_vue_admin"]=self["webpackChunkvoghion_vue_admin"]||[]).push([[70469],{70469:function(e,t,a){a.r(t),a.d(t,{default:function(){return u}});var l=function(){var e=this,t=e._self._c;return t("div",{staticClass:"permissionList"},[t("el-form",{attrs:{form:e.form,inline:!0}},[t("el-form-item",{attrs:{label:"商家名"}},[t("el-input",{attrs:{clearable:""},model:{value:e.form.merchantName,callback:function(t){e.$set(e.form,"merchantName",t)},expression:"form.merchantName"}})],1),t("el-form-item",{attrs:{label:"商家ID"}},[t("el-input",{attrs:{clearable:""},model:{value:e.form.merchantId,callback:function(t){e.$set(e.form,"merchantId",t)},expression:"form.merchantId"}})],1),t("el-form-item",{attrs:{label:"状态"}},[t("el-select",{attrs:{clearable:""},model:{value:e.form.status,callback:function(t){e.$set(e.form,"status",t)},expression:"form.status"}},e._l(e.permissionStatus,(function([e,a]){return t("el-option",{key:e,attrs:{value:e,label:a}})})),1)],1),t("el-form-item",[t("el-button",{attrs:{type:"primary"},on:{click:e.doSearch}},[e._v("搜索")]),t("el-button",{attrs:{type:"primary"},on:{click:e.doAdd}},[e._v("新增")])],1)],1),t("el-table",{attrs:{data:e.dataSource.merchantUsers}},[t("el-table-column",{attrs:{align:"center",label:"商家名称",prop:"merchantName"}}),t("el-table-column",{attrs:{align:"center",label:"商家ID",prop:"merchantId"}}),t("el-table-column",{attrs:{align:"center",label:"负责小二",prop:"principal"}}),t("el-table-column",{attrs:{align:"center",label:"创建日期",prop:"createTime"}}),t("el-table-column",{attrs:{align:"center",label:"创建人",prop:"createBy"}}),t("el-table-column",{attrs:{align:"center",label:"状态"},scopedSlots:e._u([{key:"default",fn:function(t){return[e._v(" "+e._s(e.getPermissionStatus(t.row.status))+" ")]}}])}),t("el-table-column",{attrs:{align:"center",label:"最近更新时间",prop:"updateTime"}}),t("el-table-column",{attrs:{align:"center",label:"更新人",prop:"updateBy"}}),t("el-table-column",{attrs:{align:"center",label:"操作"},scopedSlots:e._u([{key:"default",fn:function(a){return[1===a.row.status?t("el-button",{attrs:{type:"text"},on:{click:function(t){return e.doToggle(a.row,"close")}}},[e._v("关闭")]):e._e(),2===a.row.status?t("el-button",{attrs:{type:"text"},on:{click:function(t){return e.doToggle(a.row,"open")}}},[e._v("开启")]):e._e()]}}])})],1),t("div",{staticClass:"g-pagination-container"},[t("el-pagination",{attrs:{"current-page":e.pageNow,"page-sizes":[20,50,100],"page-size":e.pageSize,layout:"sizes, prev, pager, next, jumper",background:"",total:e.dataSource.totalCount},on:{"size-change":function(t){return e.doPageChange(null,t)},"current-change":function(t){return e.doPageChange(t)}}})],1),t("el-dialog",{attrs:{title:"新增商家",visible:e.addVisible,"before-close":e.hiddenAddModal},on:{"update:visible":function(t){e.addVisible=t}},scopedSlots:e._u([{key:"footer",fn:function(){return[t("el-button",{on:{click:e.hiddenAddModal}},[e._v("取 消")]),t("el-button",{attrs:{type:"primary"},on:{click:e.addModalOkHandle}},[e._v("确 定")])]},proxy:!0}])},[t("el-input",{attrs:{type:"textarea",placeholder:"请输入新增商家id，逗号区分多个"},model:{value:e.addMerchantId,callback:function(t){e.addMerchantId=t},expression:"addMerchantId"}})],1)],1)},r=[];a(81454);const n=new Map([[1,"开启中"],[2,"已关闭"]]),s=e=>n.get(e);var o={data(){return{title:"商家权限列表",form:{status:null,merchantId:null,merchantName:null},addMerchantId:null,addVisible:!1,permissionStatus:n,pageNow:1,pageSize:20,dataSource:{}}},watch:{addVisible(e){e||(this.addMerchantId=null)}},mounted(){this.doSearch()},methods:{getPermissionStatus:s,doToggle(e,t){const a={merchantUserId:e.merchantUserId};"close"===t&&(console.log("关闭",a),a.newStatus=2,a.oldStatus=1),"open"===t&&(console.log("开启",a),a.newStatus=1,a.oldStatus=2),this.$store.dispatch({type:"im/editMerhantCustom",payload:a}).then((e=>{e.success?this.getList():this.$message.error(e.errorMessage)}))},doSearch(){console.log(this.form),this.pageNow=1,this.getList()},getList(){const{status:e,merchantId:t,merchantName:a}=this.form,l={status:e,merchantId:t,merchantName:a,pageIndex:this.pageNow,pageSize:this.pageSize};this.$store.dispatch({type:"im/getImMerchantList",payload:l}).then((e=>{this.dataSource=e}))},doPageChange(e,t){e&&(this.pageNow=e),t&&(this.pageSize=t),this.getList()},doAdd(){console.log("新增"),this.addVisible=!0},hiddenAddModal(){this.addVisible=!1},addModalOkHandle(){const e=this.addMerchantId.split(",").map((e=>e.trim())).join(",");this.$store.dispatch({type:"im/batchAddCustomMerchants",payload:{merchantIds:e}}).then((e=>{e.errorMessage?this.$message.error(e.errorMessage):(this.addVisible=!1,this.doSearch())}))}}},i=o,c=a(81656),d=(0,c.A)(i,l,r,!1,null,"d972d03c",null),u=d.exports}}]);