| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264 |
- <template>
- <view class="container">
- <u-toast ref="uToast"/>
- <u-modal cancel-text="重置" cancel-color="#000000" @cancel="filterReset" :show-cancel-button="true" @confirm="filterConfirm" title="筛选" :mask-close-able="true" v-model="filterShow" >
- <view class="slot-content" style="margin: 20rpx;">
- <u-form label-width="150" ref="uForm">
- <u-form-item label="员工姓名"><u-input v-model="realName" /></u-form-item>
- <u-form-item :border-bottom="false" label="手机号"><u-input v-model="phone" type="number" /></u-form-item>
- </u-form>
- </view>
- </u-modal>
-
- <u-modal :show-cancel-button="true" @confirm="opinionConfirm" title="审核意见" :mask-close-able="true" v-model="opinionShow" >
- <view class="slot-content" style="margin: 20rpx;">
- <u-form label-width="150" ref="uForm">
- <u-form-item :border-bottom="false"><u-input height="150" placeholder="请输入审核意见(选填)" v-model="opinion" /></u-form-item>
- </u-form>
- </view>
- </u-modal>
-
- <view class="tabs flex flex-direction">
- <view class="flex">
- <scroll-view scroll-x class="bg-white nav" style="width: 90%;">
- <view class="flex text-center">
- <view class="cu-item flex-sub" :class="index==current?'text-blue text-xl text-bold ':'text-lg'" v-for="(item,index) in tabs" :key="index" @tap="tabChange(index)" >
- {{item.name}}
- </view>
- </view>
- </scroll-view>
- <view class="flex justify-center align-center" @click="show">
- <text class="cuIcon-filter " style="font-size: 40rpx;"></text>
- <u-badge size="mini" type="error" :count="filterCount"></u-badge>
- </view>
- </view>
- </view>
- <view style="height: 100%;">
- <swiper style="height: 100%;" :current="current" @change="swiperChange"
- @animationfinish="animationfinish">
- <swiper-item v-for="(item, index) in tabs" :key="index">
- <scroll-view scroll-y style="height: 100%;">
- <item @showOpinion="showOpinion" ref="mescrollItem" :opinion="opinion" :realName="realName" :phone="phone" :refresh="refresh" :i="index" :item="item" :type="current"></item>
- </scroll-view>
- </swiper-item>
- </swiper>
- </view>
- </view>
- </template>
- <script>
- import item from "./comps/item.vue"
- export default {
- components: {
- item
- },
- data() {
- return {
- // 审核不通过的审核意见
- opinion:'',
- // 显示审核不通过对话框
- opinionShow:false,
- // 审核不通过的对象
- failItem:{},
-
- filterCount:0,
- filterShow:false,
- realName:'',
- phone:'',
-
- current: 0,
- swiperCurrent:0,
- tabs: [
- {
- name: '全部',
- value:-1
- },
- {
- name: '待审核',
- value:0
- },
- {
- name: '已通过',
- value:1
- },
- {
- name:'未通过',
- value:2
- }
- ],
- }
- },
- onShow(){
- let pages = getCurrentPages(); //获取所有页面栈实例列表
- let currPage = pages[ pages.length - 1]; //当前页页面实例
- if (currPage.data.flag==true) {
- this.realName=''
- this.phone=''
- this.refreshMescroll()
- }
- },
- onLoad() {
-
- },
- methods:{
- showOpinion(item){
- this.opinionShow=true
- this.failItem=item
- },
-
- /**
- * 确定审核不通过回调
- */
- opinionConfirm(){
- this.submitFailAudit()
- },
- /**
- * 审核不通过
- * @param {Object}
- */
- submitFailAudit(){
- let item=this.$u.deepClone(this.failItem)
- let that=this
- item.examine=2
- item.opinion=that.opinion
- item.auditTime=this.$createDateTime()
- that.$api.enterprisestaff.submit(item).then(res=>{
- if (res.success==true) {
- this.$showToast(res.msg)
- that.send(item)
- that.$nextTick(() => {
- that.refreshMescroll()
- })
- }
- })
- },
- /**
- * 发送信息
- */
- async send(item){
- 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:item.openId,
- lang:"zh_CN",
- page:'/pages/login/login',
- miniprogramState:this.$miniprogramState,
- templateId: this.$staffTmplIds[0],
- "data": {
- "name1": {
- "value": this.$cache.get('loginAccount')
- },
- "phrase5":{
- "value": "员工认证"
- },
- "phrase2": {
- "value": "审核不通过"
- },
- "thing3": {
- "value": this.opinion || '审核不通过'
- },
- }
- }
- this.$api.wxApi.subscribe(subscribeData).then(res=>{
- console.log(res);
- }).catch(err=>{
- console.error(err);
- })
- },
-
- /**
- * 筛选显示
- */
- show(){
- this.filterShow=true
- },
- /**
- * 筛选
- */
- filterConfirm(){
- this.refreshMescroll()
- let n=0
- if (!this.$isEmpty(this.realName)) {
- n++
- }
- if (!this.$isEmpty(this.phone)) {
- n++
- }
- this.filterCount=n
- },
- /**
- * 重置筛选项
- */
- filterReset(){
- this.filterCount=0
- this.realName=''
- this.phone=''
- this.$nextTick(() => {
- this.refreshMescroll()
- })
- },
- /**
- * 刷新列表
- */
- refreshMescroll(){
- let curMescroll = this.getMescroll(this.current)
- curMescroll && curMescroll.resetUpScroll()
- },
- /**
- * 获取Mescroll对象
- * @param {Object} i
- */
- getMescroll(i){
- let mescrollItems = this.$refs.mescrollItem;
- if(mescrollItems){
- let item = mescrollItems[i]
- if(item) return item.mescroll
- }
- return null
- },
-
- tabChange(index) {
- this.current = index
- },
- swiperChange(e) {
- uni.pageScrollTo({
- scrollTop: 0,
- duration: 0
- });
- this.current = e.detail.current
- },
- animationfinish({detail: { current }}) {
- this.swiperCurrent = current;
- this.current = current;
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .text-blue{
- color: $base-color;
- }
- .text-xl{
- font-size: 34rpx;
- }
- .container {
- height: calc(100vh);
- background-color: #F6F6F6;
- padding: 78rpx 0rpx 0rpx;
- .tabs {
- position: fixed;
- top: -10rpx;
- left: 0;
- width: 100%;
- background-color: #FFFFFF;
- box-sizing: border-box;
- z-index: 3;
- }
- }
- </style>
|