1 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-5d789bc2"],{2058:function(e,t,n){"use strict";n("a746")},"2c9f":function(e,t,n){"use strict";n.r(t);var a=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"content"},[n("div",{staticClass:"search_box"},[n("div",[n("el-input",{attrs:{placeholder:"助手手机号/昵称",clearable:""},on:{clear:function(t){e.params.phone="",e.getList()}},nativeOn:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.getList(t)}},model:{value:e.params.phone,callback:function(t){e.$set(e.params,"phone",t)},expression:"params.phone"}}),e._v(" "),n("el-input",{attrs:{placeholder:"客户手机号/昵称",clearable:""},on:{clear:function(t){e.params.search_name="",e.getList()}},nativeOn:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.getList(t)}},model:{value:e.params.search_name,callback:function(t){e.$set(e.params,"search_name",t)},expression:"params.search_name"}}),e._v(" "),n("el-button",{attrs:{type:"primary",loading:e.loading},on:{click:function(t){return e.getList()}}},[e._v("搜索")]),e._v(" "),n("el-button",{attrs:{type:"primary"},on:{click:function(t){return e.handelEdit(0,"")}}},[e._v("添加助手")])],1)]),e._v(" "),n("div",{staticClass:"table_box"},[n("el-table",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],ref:"listTable",staticStyle:{width:"100%"},attrs:{"header-cell-style":{background:"#f8fbfc"},border:"",stripe:"",data:e.list,height:e.tableHeight+"px","cell-style":{padding:"10px 0"}}},[n("el-table-column",{attrs:{label:"序号",type:"index",width:"80",align:"center",index:function(e){return e+1}}}),e._v(" "),n("el-table-column",{attrs:{label:"助手昵称",prop:"name",align:"center"}}),e._v(" "),n("el-table-column",{attrs:{label:"助手手机号",prop:"phone",align:"center"}}),e._v(" "),n("el-table-column",{attrs:{label:"所属客户",align:"center"},scopedSlots:e._u([{key:"default",fn:function(t){var a=t.row;return[n("el-button",{attrs:{type:"text"},on:{click:function(t){return e.getOtherInfo(a.user&&a.user.id)}}},[e._v(e._s(a.user&&a.user.nickname))])]}}])}),e._v(" "),n("el-table-column",{attrs:{label:"客户手机号",align:"center"},scopedSlots:e._u([{key:"default",fn:function(t){var n=t.row;return[e._v("\n "+e._s(n.user&&n.user.mobile)+"\n ")]}}])}),e._v(" "),n("el-table-column",{attrs:{prop:"level",label:"客户类别",align:"center"},scopedSlots:e._u([{key:"default",fn:function(t){var a=t.row;return[n("el-tag",{staticStyle:{color:"#ffffff"},attrs:{color:e.levelStatus(a.user&&a.user.level).color}},[e._v("\n "+e._s(e.levelStatus(a.user&&a.user.level).name)+"\n ")])]}}])}),e._v(" "),n("el-table-column",{attrs:{label:"添加时间",prop:"created_at",align:"center"}}),e._v(" "),n("el-table-column",{attrs:{label:"操作",align:"center"},scopedSlots:e._u([{key:"default",fn:function(t){var a=t.row;return[n("el-button",{attrs:{type:"text"},on:{click:function(t){return e.handelEdit(1,a)}}},[e._v("编辑")]),e._v(" "),n("el-button",{attrs:{type:"text"},on:{click:function(t){return e.handelDel(a.id)}}},[e._v("删除")])]}}])})],1)],1),e._v(" "),n("el-drawer",{attrs:{title:e.memberInfo.nickname+" - "+e.levelStatus(e.memberInfo.level).name,visible:e.showAgent,direction:"rtl",size:"600px"},on:{"update:visible":function(t){e.showAgent=t}}},[n("MemberInfo",{attrs:{info:e.memberInfo,"team-type":!0},on:{getOtherInfo:e.changeOtherInfo}})],1),e._v(" "),n("div",{staticClass:"helper_info"},[n("el-dialog",{attrs:{title:0===e.type?"添加助手":"编辑助手",visible:e.dialogVisible,width:"45%"},on:{"update:visible":function(t){e.dialogVisible=t}}},[n("el-form",{ref:"helperInfo",attrs:{model:e.helperInfo,"label-width":"100px",rules:e.rules}},[n("el-form-item",{attrs:{label:"所属客户:",required:"",prop:"agent_id"}},[n("el-select",{staticStyle:{width:"320px"},attrs:{placeholder:"输入客户手机号/昵称",filterable:"","filter-method":e.handelSelect},on:{change:e.getSelect},model:{value:e.helperInfo.agent_id,callback:function(t){e.$set(e.helperInfo,"agent_id",t)},expression:"helperInfo.agent_id"}},e._l(e.agentList,(function(e){return n("el-option",{key:e.id,attrs:{label:e.name,value:e.id}})})),1)],1),e._v(" "),n("el-form-item",{attrs:{label:"助手昵称:",prop:"name"}},[n("el-input",{model:{value:e.helperInfo.name,callback:function(t){e.$set(e.helperInfo,"name",t)},expression:"helperInfo.name"}})],1),e._v(" "),n("el-form-item",{attrs:{label:"手机号:",prop:"phone"}},[n("el-input",{model:{value:e.helperInfo.phone,callback:function(t){e.$set(e.helperInfo,"phone",t)},expression:"helperInfo.phone"}})],1),e._v(" "),n("el-form-item",{attrs:{label:"密码:",prop:"password"}},[n("el-input",{model:{value:e.helperInfo.password,callback:function(t){e.$set(e.helperInfo,"password",t)},expression:"helperInfo.password"}})],1)],1),e._v(" "),n("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[n("el-button",{on:{click:function(t){e.dialogVisible=!1}}},[e._v("取 消")]),e._v(" "),n("el-button",{directives:[{name:"throttle",rawName:"v-throttle",value:2e3,expression:"2000"}],attrs:{type:"primary"},on:{click:function(t){return e.submitForm("helperInfo")}}},[e._v(e._s(0===e.type?"添 加":"修 改"))])],1)],1)],1),e._v(" "),n("div",{staticClass:"batch-container"},[n("pagination",{attrs:{total:e.totalPage,limit:e.params.page_size,page:e.params.page_index},on:{pagination:e.changePagination,"update:limit":e.changePagination}})],1)],1)},r=[],s=(n("7f7f"),n("c80c")),i=(n("96cf"),n("3b8d")),o=n("b775");function l(e){return Object(o["a"])({url:"assit/getUser",method:"get",params:e})}function c(e){return Object(o["a"])({url:"assit/getAssitList",method:"get",params:e})}function u(e){return Object(o["a"])({url:"assit/addAssit",method:"post",data:e})}function p(e){return Object(o["a"])({url:"assit/editAssit",method:"post",data:e})}function d(e){return Object(o["a"])({url:"assit/delAssit",method:"post",data:e})}function h(e){return Object(o["a"])({url:"trace/exportSimple",method:"get",params:e})}var f=n("f72b"),m=n("8e44"),g=n("44f1"),b=n("ed08"),v={name:"BackstageHelper",components:{MemberInfo:f["default"]},data:function(){return{loading:!1,dialogVisible:!1,params:{page_index:1,page_size:10,search_name:"",phone:""},helperInfo:{name:"",agent_id:"",phone:"",password:""},list:[],totalPage:0,phone:"",tableHeight:0,type:"",rules:{agent_id:[{required:!0,message:"所属客户不能为空",trigger:"change"}],name:[{required:!0,message:"助手名称不能为空",trigger:"blur"},{min:2,max:10,message:"长度在 2 到 10 个字符",trigger:"blur"}],phone:[{required:!0,message:"手机号不能为空",trigger:"blur"}],password:[{required:!0,message:"密码不能为空",trigger:"blur"},{min:6,max:8,message:"长度在 6 到 8 个字符",trigger:"blur"}]},helper_id:"",memberInfo:{nickname:"",level:""},showAgent:!1,agentList:[]}},created:function(){this.getList(),this.levelStatus=g["b"]},mounted:function(){var e=this;this.$nextTick((function(){e.tableHeight=document.getElementsByClassName("table_box")[0].offsetHeight}))},methods:{exportOrder:function(){var e=Object(i["a"])(Object(s["a"])().mark((function e(){var t,a,r,i,o=this;return Object(s["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return this.loadingFull=!0,e.prev=1,e.next=4,h({});case 4:if(t=e.sent,a=t.code,r=t.message,200!==a){e.next=14;break}if(i=t.data,!(i.length<1)){e.next=11;break}return this.$message.error("没有数据哦!!!"),e.abrupt("return",!1);case 11:Promise.all([n.e("chunk-5bdd67a2"),n.e("chunk-2c21b5a5")]).then(n.bind(null,"4bf8d")).then((function(e){var t=["类型","短码","小码","中码","大码"],n=["model","security_code","code","sec_code","max_code"],a=i,r=o.formatJson(n,a);e.export_json_to_excel({header:t,data:r,filename:"防伪码",autoWidth:!0,bookType:"csv"}),o.loadingFull=!1,o.$message.success("导出数据完成")})),e.next=15;break;case 14:this.$message.error(r);case 15:e.next=21;break;case 17:e.prev=17,e.t0=e["catch"](1),console.log("导出销售失败: ".concat(e.t0)),this.loadingFull=!1;case 21:case"end":return e.stop()}}),e,this,[[1,17]])})));function t(){return e.apply(this,arguments)}return t}(),formatJson:function(e,t){return t.map((function(t){return e.map((function(e){return"timestamp"===e?Object(b["j"])(t[e]):t[e]}))}))},handelSelect:function(e){e&&this.getAgent(e)},getSelect:function(e){this.helperInfo.agent_id=e},changeOtherInfo:function(e){this.getOtherInfo(e,(function(e){}))},handleSeeMemberInfo:function(e){this.memberInfo=e,this.showAgent=!0},getOtherInfo:function(){var e=Object(i["a"])(Object(s["a"])().mark((function e(t,n){var a,r,i,o;return Object(s["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(t){e.next=3;break}return this.$message.error("获取用户id失败"),e.abrupt("return",!1);case 3:return this.loadingFull=!0,e.prev=4,e.next=7,Object(m["d"])({id:t});case 7:a=e.sent,r=a.code,i=a.message,200===r?(o=a.data,this.handleSeeMemberInfo(o),n&&n(o)):this.$message.error(i),e.next=15;break;case 12:e.prev=12,e.t0=e["catch"](4),console.log("获取分享人或上级批发商信息失败:".concat(e.t0));case 15:this.loadingFull=!1;case 16:case"end":return e.stop()}}),e,this,[[4,12]])})));function t(t,n){return e.apply(this,arguments)}return t}(),submitForm:function(e){var t=this;this.$refs[e].validate((function(e){if(!e)return console.log("error submit!!"),!1;var n=t.helperInfo,a=n.name,r=n.agent_id,s=n.phone,i=n.password,o=0===t.type?{name:a,phone:s,password:i,agent_id:r}:{name:a,phone:s,password:i,agent_id:r,id:t.helper_id},l=0===t.type?u:p;l(o).then((function(e){200===e.code?(t.$message.success("".concat(0===t.type?"添加":"修改","成功")),t.dialogVisible=!1,t.getList()):t.$message.error(e.message||"".concat(0===t.type?"添加":"修改","失败"))}))}))},handelEdit:function(e,t){if(this.type=e,this.dialogVisible=!0,0===e)return this.helperInfo={name:"",agent_id:"",phone:"",password:""},!1;this.getAgent(t.user&&t.user.mobile);var n=t.name,a=t.phone,r=t.password,s=t.id,i=t.agent_id;this.helperInfo={name:n,agent_id:i,phone:a,password:r},this.helper_id=s},changePagination:function(e){var t=e.page,n=e.limit;this.params.page_size=n,this.params.page_index=t,this.getList()},delHelper:function(e){var t=this;d({id:e}).then((function(e){200===e.code?(t.$message.success("删除成功"),t.getList()):t.$message.error(e.message||"删除失败")}))},handelDel:function(e){var t=this;this.$confirm("确定要删除当前助手吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){t.delHelper(e)})).catch((function(){t.$message({type:"info",message:"已取消删除"})}))},handleSureGood:function(e){this.selelcted.num="",this.selectGood=this.goodList.filter((function(t){return t.id===e}))[0]},getAgent:function(e){var t=this;l({phone:e}).then((function(e){if(200===e.code){var n=[],a=e.data;a.map((function(e){n.push({name:"".concat(e.nickname,"-").concat(e.mobile),id:e.id})})),t.agentList=n}else t.$message.error(e.message||"获取客户信息失败")}))},getList:function(){var e=this;this.loading=!0,c(this.params).then((function(t){200===t.code?(e.list=t.data.list,e.totalPage=t.data.total):e.$message.error(t.message||"获取客户助手列表失败"),e.loading=!1})).catch((function(){e.loading=!1}))}}},_=v,k=(n("2058"),n("2877")),x=Object(k["a"])(_,a,r,!1,null,"0fca32a2",null);t["default"]=x.exports},a746:function(e,t,n){}}]);
|