| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213 |
- <template>
- <view class="">
- <u-modal :show-cancel-button="true" @confirm="submitFailAudit" v-model="modelShow" >
- <view class="slot-content margin-10 " style="background-color: #f5f5f5;">
- <textarea placeholder-style="color:#bababa" v-model="opinion" placeholder="请输入审核意见" />
- </view>
- </u-modal>
- <MeScroll :up="up" :down="down" @up="upFn" :fixed="false" @down="downFn" @init="initMeScroll">
- <card @pass="pass" @fail="fail" :list="list" ></card>
- </MeScroll>
- </view>
-
- </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: {
- refresh:Boolean,
- type: Number,
- i: Number,
- item:Object
- },
- data() {
- return {
- //审核不通过时展示
- modelShow:false,
- //审核不通过的原因
- opinion:'',
- dataDetail:{},
-
- //所属公司
- enterpriseId:'',
-
- isInit: false, // 是否初始化
- list: [], // 列表数据
- mescroll: null, // mescroll 对象
- // 上拉配置参数
- up: {
- noMoreSize: 3,
- auto: true,
- page: {
- page: 0,
- size: 10
- }
- },
- // 下拉配置参数
- down: {
- use: true,
- auto: false
- }
- }
- },
- watch:{
- refresh() {
- console.log("我要刷新了");
- this.mescroll.resetUpScroll()
- },
- type(val) {
- if(!this.isInit && val === this.i) {
- this.mescroll.resetUpScroll()
- }
- }
- },
- mounted() {
- if(!this.isInit && this.i === 0) {
- this.mescroll.resetUpScroll()
- }
- },
- created() {
- this.enterpriseId= this.$cache.get('enterpriseId')
- },
- methods: {
- /**
- * 通过审核
- */
- pass(item){
- let that=this
- this.$showModel("确定审核通过该员工信息吗?").then(res=>{
- item.examine=1
- item.auditTime=this.$createDateTime()
- this.$api.enterprisestaff.submit(item).then(res=>{
- that.$u.toast(res.msg)
- let msgData={
- openId:item.openId,
- content:"审核已通过",
- remarks:"已审核",
- enterpriseName:item.enterpriseName
- }
- that.send(msgData)
- that.mescroll.resetUpScroll()
- })
- })
- },
- /**
- * 审核不通过
- * @param {Object}
- */
- submitFailAudit(){
- let item=this.dataDetail
- let that=this
- item.examine=2
- item.opinion=that.opinion
- item.auditTime=this.$createDateTime()
- this.$api.enterprisestaff.submit(item).then(res=>{
- let msgData={
- openId:item.openId,
- content:"审核不通过",
- remarks:that.opinion || '审核不通过',
- enterpriseName:item.enterpriseName
- }
- that.send(msgData)
- that.$u.toast(res.msg)
- that.mescroll.resetUpScroll()
- })
- },
- /**
- * 显示审核不通过的意见框
- * @param {Object} item
- */
- fail(item){
- this.dataDetail=item
- this.modelShow=true
- },
- 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={
- enterpriseId:this.enterpriseId,
- current:mescroll.num,
- size:mescroll.size,
- }
- if (this.item.value!=-1) {
- //不是查询全部就传examine
- obj.examine=this.item.value
- }
- try{
- let enterpriseId=
- 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.mescroll.resetUpScroll()
- },1500)
- },
- }
- }
- </script>
- <style lang="scss" scoped>
-
- </style>
|