123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327 |
- <template>
- <view class="pay">
- <image :src="pbg" class="paytop"></image>
- <view class="paybox">
- <view class="flext mb18">
- <view class="flex1 pl16">
- <view class="cof fw f30 mb8 wordb">{{nodataflag?paymonth.shifa:0}}</view>
- <view class="cof fw5 f16">本月实发工资</view>
- </view>
- <view class="flex0">
- <picker mode="date" fields ="month" :value="datemonth" @change="bindDateChangea">
- <view class="pay_btn flexcc">
- <view class="f15 cofe f500" :style="'text-align:'+textAlign">{{year}}年{{month}}月</view>
- <image :src="pup"></image>
- </view>
- </picker>
- </view>
- </view>
-
- <view class="paybg paya mb15" v-if="nodataflag">
- <block v-for="(ite,key) in paymonth">
- <view class="paylist" v-if="key!='shifa'">
- <view class="tit">{{ite||0}}</view>
- <view class="txt">{{key}}</view>
- </view>
- </block>
- </view>
- <view class="paybg payc mb15" v-else>
- <image :src="noicon"></image>
- <view>本月暂无工资条数据</view>
- </view>
- <!-- 历史工资 -->
- <view class="hisbox flexc mb15">
- <view class="line"></view>
- <view class="tit">历史工资条记录</view>
- <view class="hisbtn">
- <picker mode="date" fields ="year" :value="dateyear" @change="bindDateChangeb">
- <view class="flexcc pl8">
- <view class=" f15 co6 f500" :style="'text-align:'+textAlign">{{dateyear||'2023'}}年</view>
- <image :src="aup"></image>
- </view>
- </picker>
- </view>
- </view>
- <view class="paybg payb flex1" style="overflow: hidden;">
- <zb-table
- ref="zbTable"
- :show-header="true"
- :columns="columns"
- :stripe="true"
- :pullUpLoading="pullUpLoading"
- :isShowLoadMore="reachflag"
- :fit="true"
- @rowClick="rowClick"
- @toggleRowSelection="toggleRowSelection"
- @toggleAllSelection="toggleAllSelection"
- :border="border"
- @edit="buttonEdit"
- @dele="dele"
- :data="list"></zb-table>
- </view>
- </view>
-
- </view>
- </template>
- <script>
- import {getDictionaryFn} from '@/api/mine/register.js'
- import {getpayListFn} from '@/api/mine/payslip.js'
- import zbTable from "@/mine/components/zb-table/zb-tables.vue"
- export default {
- components:{
- zbTable
- },
- data(){
- return{
- pbg:require("@/work/static/pay/pbg.png"),
- aup:require("@/work/static/pay/aup.png"),
- pup:require("@/work/static/pay/pup.png"),
- noicon:require("@/work/static/pay/noicon.png"),
- columns:[],
- list: [],
- paymonth:{},//当月工资条
- nodataflag:false,//当月是否有工资
- pageSize: 15,
- pageNum: 1,
- reachflag: true,
- joinflag:false,
- wtdt: '',
- paylist:[
- {a:'06',b:1700,c:1600,d:20,e:30,f:20,g:30},
- {a:'07',b:1700,c:1600,d:20,e:30,f:20,g:30},
- {a:'08',b:1700,c:1600,d:20,e:30,f:20,g:30},
- ],
- wagesList:[],//字典值
- date:'',
- textAlign:'center',
- border:false,
- year:'',//年
- month:'',//月
- dateyear:'',
- datemonth:'',
- flag1:true,
- mondab:'',//发放时间汉字
- }
- },
- onLoad: function() {
- // var newArr=[
- // { name: 'a', label: '月份',fixed:true,width:50,emptyString:'--',align:'center'},
- // { name: 'c', label: '实发工资',fixed:true,width:70,emptyString:'--',align:'center'},
- // { name: 'b', label: '岗位工资',width:70,emptyString:'--',align:'center'},
- // { name: 'd', label: '薪级工资',width:70,emptyString:'--',align:'center'},
- // { name: 'e', label: '教龄津贴',width:70,emptyString:'--',align:'center'},
- // { name: 'f', label: '教龄津贴',width:70,emptyString:'--',align:'center'},
- // { name: 'g', label: '教龄津贴',width:70,emptyString:'--',align:'center'},
- // ]
- // this.columns=newArr
- this.init()
- this.time()
-
- },
- methods:{
- init(){
- // 工资条
- getDictionaryFn('wages').then(res=>{
- if(res.code==200){
- this.wagesList = res.data.map(v => {
- if(v.dictValue=='fafangshij'){
- this.mondab=v.dictLabel
- }
- return {
- dictLabel: v.dictLabel,
- dictValue: v.dictValue
- }
- })
- this.getColumns(this.wagesList)
- }
- })
- },
- bindDateChangea(e){
- var val=e.detail.value.split('-')
- this.year=val[0];
- this.month=val[1];
- this.getDataMonth()
- },
- bindDateChangeb(e){
- var val=e.detail.value
- this.dateyear=val;
- this.reachflag=true;
- this.pageNum=1;
- this.list=[];
- this.getDataFn()
- },
- time() {
- var date = new Date();
- var y = date.getFullYear();
- var m = date.getMonth() + 1;
- this.year = y;
- this.month = m < 10 ? "0" + m : m;
- this.dateyear=y;
- // 获取当月的工资
- this.getDataMonth()
- this.getDataFn()
- },
- getColumns(info){
- var newArr=info;
- var narr=[];
- // var column1=[]
- var column1=[{ name:'fmonth',label: '月份', fixed:true,width:30,align:'center'},];
- // { name: 'scoreDataName', label: '姓名',fixed:true,width:70,emptyString:'--',align:'center' }
-
- Object.keys(newArr).some((key) => {
- var obj={};
- obj.name=newArr[key].dictLabel;
- obj.label=newArr[key].dictLabel;
- // obj.sorter=true
- obj.align='center'
- obj.width='70'
- obj.paddingRight=12;
- column1.push(obj)
- })
- // column1=column1.concat(narr)
- this.columns=JSON.parse(JSON.stringify(column1))
- },
- getDataMonth(){
- var params = {
- pageSize: this.pageSize,
- pageNum: this.pageNum,
- year:this.year,
- month:this.month
- }
- getpayListFn(params).then(res => {
- if (res.code == 200) {
- var data=res.data;
- if(data.records&&data.records.length){
- var paylist=data.records[0].tableDataJO
- if(paylist&&paylist.length){
- this.nodataflag=true;
- // 处理数据
- var dat=paylist[0];
- var wages=this.wagesList;
- var newObja={};
- Object.keys(wages).some((key) => {
- var dict=wages[key].dictValue;
- var dicts=wages[key].dictLabel
- if(wages[key]&&dict!='xingming'&&dict!='gonghao'&&dict!='fafangshij'&&dict!='shifa'){
- newObja[dicts]=dat[dicts]
- }else if(wages[key]&&dict=='shifa'){
- newObja['shifa']=dat[dicts]
- }
- })
- this.paymonth=newObja
- }else{
- this.nodataflag=false
- }
- }
- } else {
- this.$toast(res.msg)
- }
- })
- },
- // 年
- getDataFn(a) {
- var params = {
- pageSize: this.pageSize,
- pageNum: this.pageNum,
- year:this.dateyear,
- }
- // params['params[role]']=this.$store.state.user.choseroles
- getpayListFn(params).then(res => {
- this.flag1=true;
- if (res.code == 200) {
- if (res.data.size < this.pageSize) {
- this.reachflag = false
- this.wtdt = '到底了~';
- this.$refs.zbTable.pullUpCompleteLoading('ok')
- } else {
- var num = parseInt(res.data.size) + parseInt(this.pageSize) * parseInt(this.pageNum -1)
- if (num < res.data.total) {
- this.reachflag = true
- this.wtdt = '上拉加载更多'
- this.$refs.zbTable.pullUpCompleteLoading('')
- } else {
- this.reachflag = false
- this.wtdt = '到底了~';
- this.$refs.zbTable.pullUpCompleteLoading('ok')
- }
- }
- var data=res.data;
- if(data.records&&data.records.length){
- var paylist=data.records[0].tableDataJO
- if(paylist&&paylist.length){
- // 处理数据
- Object.keys(paylist).some((key) => {
- var a=this.mondab
- if (paylist[key][a]&&a) {
- var s=paylist[key][a].split('-')
- paylist[key].fmonth=s[1]
- }
- })
- if (this.pageNum == 1) {
- this.list = paylist;
- } else {
- this.list = this.list.concat(paylist)
- }
- }
- }
- } else {
- this.$toast(res.msg)
- }
- })
- },
- pullUpLoading(done){
- if(!this.flag1){
- return
- }
- var that=this;
- this.flag1=false;
- setTimeout(()=>{
- that.pageNum++
- that.getDataFn()
- },100)
- },
- },
-
- }
- </script>
- <style lang="scss" scoped>
- .pay{
- .paytop{width: 100%;height: 300rpx;}
- .paybox{
-
- padding:0 32rpx;position: relative;margin-top: -250rpx;display: flex;flex-direction: column;height: calc(100vh - 50rpx);
- .pay_btn{width: 240rpx;height: 66rpx;background: rgba(0, 0, 0, 0.4);border-radius: 32rpx;
- font-size: 30rpx;font-weight: 500;color: #ECECEC;
- image{width: 18rpx;height: 10rpx;margin-left: 20rpx;}
- }
- .paybg{
- background: #FFFFFF;width: 100%;border-radius: 20rpx;
- &.paya{display: flex;align-items: center;flex-wrap: wrap;padding:16rpx 0;}
- &.payb{padding: 30rpx 24rpx 0;min-height: 600rpx;box-sizing: border-box;border-radius: 20rpx 20rpx 0 0;}
- .paylist{width: 25%;display: flex;flex-direction: column;align-items: center;padding: 16rpx 0;
- .tit{font-size: 38rpx;color: #161616;font-weight: bold;margin-bottom: 6rpx;}
- .txt{font-size: 26rpx;color: #666666;}
- }
- &.payc{height: 388rpx;display: flex;flex-direction: column;align-items: center;justify-content: center;font-size: 26rpx;font-weight: 500;
- color: #AAAAAA;
- image{width: 232rpx;height: 168rpx;margin-bottom: 40rpx;}
- }
- }
- .hisbox{
- .line{width: 10rpx;height: 40rpx;background: #1F57E6;border-radius: 6rpx;flex: 0 0 auto;margin-right: 26rpx;}
- .tit{font-size: 32rpx;font-weight: bold;color: #161616;flex: 1;}
- .hisbtn{
- image{width: 18rpx;height: 10rpx;margin-left: 14rpx;}
- }
- }
- }
-
- }
- .pay /deep/ .zb-table .zb-table-header{background-color: #F2F5FB;}
- .pay /deep/ .zb-table .odd{background-color: #F2F5FB;}
- .pay /deep/ .item-td{border-bottom: none;font-weight: bold;font-size: 26rpx;}
- .pay /deep/ .item-th{border-bottom: none;font-weight: bold;font-size: 26rpx;}
- .pay /deep/ .zb-table-tbody{padding-bottom: 20rpx;}
- </style>
|