| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208 |
- <template>
- <MeScroll :up="up" :down="down" @up="upFn" :fixed="false" @down="downFn" @init="initMeScroll">
- <u-toast ref="uToast"/>
- <card @pass="pass" @fail="fail" :list="list" ></card>
- </MeScroll>
- </template>
- <script>
- import MeScroll from '@/components/mescroll-body/mescroll-uni.vue'
- import card from './card.vue'
- var app=getApp()
- export default {
- components:{
- MeScroll,card
- },
- props: {
- //审核意见
- opinion:String,
- //真实姓名
- realName:String,
- //联系方式
- phone:String,
-
-
- type: Number,
- i: Number,
- fireType: Number,
- item:Object
- },
- data() {
- return {
- //审核不通过时展示
- modelShow:false,
- //审核不通过的原因
- dataDetail:{},
-
- //所属公司
- enterpriseId:'',
- //登录类型
- loginType:'',
- //园区id
- agencyId:'',
-
- isInit: false, // 是否初始化
- list: [], // 列表数据
- mescroll: null, // mescroll 对象
- // 上拉配置参数
- up: {
- noMoreSize: 2,
- auto: false,
- page: {
- page: 0,
- size: 10
- }
- },
- // 下拉配置参数
- down: {
- use: false,
- auto: false
- }
- }
- },
- created() {
- this.enterpriseId= this.$cache.get('enterpriseId')
- this.loginType=this.$cache.get('loginType')
- this.agencyId=this.$cache.get('agencyId')
- },
- watch:{
- type(val) {
- if(!this.isInit && val === this.i) {
- this.mescroll.resetUpScroll()
- }
- }
- },
- mounted() {
- if(!this.isInit && this.i === 0) {
- this.mescroll.resetUpScroll()
- }
- },
- methods: {
- /**
- * 通过审核
- */
- pass(data){
- let that=this
- let item=this.$u.deepClone(data)
- this.$showModel("确定审核通过该员工信息吗?").then(res=>{
- item.examine=1
- item.auditTime=this.$createDateTime()
- this.$api.enterprisestaff.submit(item).then(res=>{
- if (res.success==true) {
- this.$showToast(res.msg)
- let msgData={
- openId:item.openId,
- content:"审核已通过",
- remarks:"已审核",
- enterpriseName:item.enterpriseName
- }
- that.send(msgData)
- that.mescroll.resetUpScroll()
- }
- })
- })
- },
- /**
- * 显示审核不通过的意见框
- * @param {Object} item
- */
- fail(item){
- this.$emit('showOpinion',item)
- },
- async send(msgData){
- let tokenData={
- grantType:this.$api.wxData.subscribe_grant_type,
- appId:this.$api.wxData.appId,
- secret:this.$api.wxData.secret
- }
- let res=await this.$api.wxApi.getAccessToken(tokenData)
- let token=JSON.parse(res.data).access_token
- let subscribeData={
- accessToken:token,
- touser:msgData.openId,
- lang:"zh_CN",
- page:'/pages/index/index',
- miniprogramState:this.$miniprogramState.FORMAL,
- templateId: this.$tmplIds[0],
- "data": {
- "thing13": {
- "value": msgData.enterpriseName
- },
- "thing9":{
- "value": "员工认证信息审核"
- },
- "phrase2": {
- "value": msgData.content
- },
- "thing3": {
- "value": msgData.remarks
- },
- }
- }
- this.$api.wxApi.subscribe(subscribeData).then(res=>{
- console.log(res);
- }).catch(err=>{
- console.error(err);
- })
- },
- /**
- * @param {Object} mescroll 初始化组件
- */
- initMeScroll(mescroll) {
- this.mescroll = mescroll
- },
- /**
- * @param {Object} mescroll 上拉回调
- */
- upFn(mescroll) {
- let that=this
- let obj={
- realName:this.realName,
- phone:this.phone,
- current:mescroll.num,
- size:mescroll.size
- }
- if (this.loginType==this.$loginType.ENTERPRISE) {
- //企业登录
- obj.enterpriseId=this.enterpriseId
-
- }else if(this.loginType==this.$loginType.AGENCY){
- //园区管理员登陆
- obj.agencyId=this.agencyId
- }
-
-
- if (this.item.value!=-1) {
- //不是查询全部就传examine
- obj.examine=this.item.value
- }
- try{
- this.$api.enterprisestaff.page(obj).then(res=>{
- let data=res.data.records
- let length=data.length
- let total=res.data.total
- mescroll.endBySize(length, total);
- if(mescroll.num == 1) that.list = []; //如果是第一页需手动制空列表
- that.list=that.list.concat(data); //追加新数据
- })
- }catch(e){
- mescroll.endErr();
- }
- },
- /**
- * 下拉回调
- * */
- downFn(mescroll) {
- setTimeout(()=>{
- this.$showToast('刷新成功')
- this.mescroll.resetUpScroll()
- },1500)
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- view{
- box-sizing: border-box;
- }
- </style>
|