index.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  1. <template>
  2. <view class="pay">
  3. <image :src="pbg" class="paytop"></image>
  4. <view class="paybox">
  5. <view class="flext mb18">
  6. <view class="flex1 pl16">
  7. <view class="cof fw f30 mb8 wordb">{{nodataflag?paymonth.shifa:0}}</view>
  8. <view class="cof fw5 f16">本月实发工资</view>
  9. </view>
  10. <view class="flex0">
  11. <picker mode="date" fields ="month" :value="datemonth" @change="bindDateChangea">
  12. <view class="pay_btn flexcc">
  13. <view class="f15 cofe f500" :style="'text-align:'+textAlign">{{year}}年{{month}}月</view>
  14. <image :src="pup"></image>
  15. </view>
  16. </picker>
  17. </view>
  18. </view>
  19. <view class="paybg paya mb15" v-if="nodataflag">
  20. <block v-for="(ite,key) in paymonth">
  21. <view class="paylist" v-if="key!='shifa'">
  22. <view class="tit">{{ite||0}}</view>
  23. <view class="txt">{{key}}</view>
  24. </view>
  25. </block>
  26. </view>
  27. <view class="paybg payc mb15" v-else>
  28. <image :src="noicon"></image>
  29. <view>本月暂无工资条数据</view>
  30. </view>
  31. <!-- 历史工资 -->
  32. <view class="hisbox flexc mb15">
  33. <view class="line"></view>
  34. <view class="tit">历史工资条记录</view>
  35. <view class="hisbtn">
  36. <picker mode="date" fields ="year" :value="dateyear" @change="bindDateChangeb">
  37. <view class="flexcc pl8">
  38. <view class=" f15 co6 f500" :style="'text-align:'+textAlign">{{dateyear||'2023'}}年</view>
  39. <image :src="aup"></image>
  40. </view>
  41. </picker>
  42. </view>
  43. </view>
  44. <view class="paybg payb flex1" style="overflow: hidden;">
  45. <zb-table
  46. ref="zbTable"
  47. :show-header="true"
  48. :columns="columns"
  49. :stripe="true"
  50. :pullUpLoading="pullUpLoading"
  51. :isShowLoadMore="reachflag"
  52. :fit="true"
  53. @rowClick="rowClick"
  54. @toggleRowSelection="toggleRowSelection"
  55. @toggleAllSelection="toggleAllSelection"
  56. :border="border"
  57. @edit="buttonEdit"
  58. @dele="dele"
  59. :data="list"></zb-table>
  60. </view>
  61. </view>
  62. </view>
  63. </template>
  64. <script>
  65. import {getDictionaryFn} from '@/api/mine/register.js'
  66. import {getpayListFn} from '@/api/mine/payslip.js'
  67. import zbTable from "@/mine/components/zb-table/zb-tables.vue"
  68. export default {
  69. components:{
  70. zbTable
  71. },
  72. data(){
  73. return{
  74. pbg:require("@/work/static/pay/pbg.png"),
  75. aup:require("@/work/static/pay/aup.png"),
  76. pup:require("@/work/static/pay/pup.png"),
  77. noicon:require("@/work/static/pay/noicon.png"),
  78. columns:[],
  79. list: [],
  80. paymonth:{},//当月工资条
  81. nodataflag:false,//当月是否有工资
  82. pageSize: 15,
  83. pageNum: 1,
  84. reachflag: true,
  85. joinflag:false,
  86. wtdt: '',
  87. paylist:[
  88. {a:'06',b:1700,c:1600,d:20,e:30,f:20,g:30},
  89. {a:'07',b:1700,c:1600,d:20,e:30,f:20,g:30},
  90. {a:'08',b:1700,c:1600,d:20,e:30,f:20,g:30},
  91. ],
  92. wagesList:[],//字典值
  93. date:'',
  94. textAlign:'center',
  95. border:false,
  96. year:'',//年
  97. month:'',//月
  98. dateyear:'',
  99. datemonth:'',
  100. flag1:true,
  101. mondab:'',//发放时间汉字
  102. }
  103. },
  104. onLoad: function() {
  105. // var newArr=[
  106. // { name: 'a', label: '月份',fixed:true,width:50,emptyString:'--',align:'center'},
  107. // { name: 'c', label: '实发工资',fixed:true,width:70,emptyString:'--',align:'center'},
  108. // { name: 'b', label: '岗位工资',width:70,emptyString:'--',align:'center'},
  109. // { name: 'd', label: '薪级工资',width:70,emptyString:'--',align:'center'},
  110. // { name: 'e', label: '教龄津贴',width:70,emptyString:'--',align:'center'},
  111. // { name: 'f', label: '教龄津贴',width:70,emptyString:'--',align:'center'},
  112. // { name: 'g', label: '教龄津贴',width:70,emptyString:'--',align:'center'},
  113. // ]
  114. // this.columns=newArr
  115. this.init()
  116. this.time()
  117. },
  118. methods:{
  119. init(){
  120. // 工资条
  121. getDictionaryFn('wages').then(res=>{
  122. if(res.code==200){
  123. this.wagesList = res.data.map(v => {
  124. if(v.dictValue=='fafangshij'){
  125. this.mondab=v.dictLabel
  126. }
  127. return {
  128. dictLabel: v.dictLabel,
  129. dictValue: v.dictValue
  130. }
  131. })
  132. this.getColumns(this.wagesList)
  133. }
  134. })
  135. },
  136. bindDateChangea(e){
  137. var val=e.detail.value.split('-')
  138. this.year=val[0];
  139. this.month=val[1];
  140. this.getDataMonth()
  141. },
  142. bindDateChangeb(e){
  143. var val=e.detail.value
  144. this.dateyear=val;
  145. this.reachflag=true;
  146. this.pageNum=1;
  147. this.list=[];
  148. this.getDataFn()
  149. },
  150. time() {
  151. var date = new Date();
  152. var y = date.getFullYear();
  153. var m = date.getMonth() + 1;
  154. this.year = y;
  155. this.month = m < 10 ? "0" + m : m;
  156. this.dateyear=y;
  157. // 获取当月的工资
  158. this.getDataMonth()
  159. this.getDataFn()
  160. },
  161. getColumns(info){
  162. var newArr=info;
  163. var narr=[];
  164. // var column1=[]
  165. var column1=[{ name:'fmonth',label: '月份', fixed:true,width:30,align:'center'},];
  166. // { name: 'scoreDataName', label: '姓名',fixed:true,width:70,emptyString:'--',align:'center' }
  167. Object.keys(newArr).some((key) => {
  168. var obj={};
  169. obj.name=newArr[key].dictLabel;
  170. obj.label=newArr[key].dictLabel;
  171. // obj.sorter=true
  172. obj.align='center'
  173. obj.width='70'
  174. obj.paddingRight=12;
  175. column1.push(obj)
  176. })
  177. // column1=column1.concat(narr)
  178. this.columns=JSON.parse(JSON.stringify(column1))
  179. },
  180. getDataMonth(){
  181. var params = {
  182. pageSize: this.pageSize,
  183. pageNum: this.pageNum,
  184. year:this.year,
  185. month:this.month
  186. }
  187. getpayListFn(params).then(res => {
  188. if (res.code == 200) {
  189. var data=res.data;
  190. if(data.records&&data.records.length){
  191. var paylist=data.records[0].tableDataJO
  192. if(paylist&&paylist.length){
  193. this.nodataflag=true;
  194. // 处理数据
  195. var dat=paylist[0];
  196. var wages=this.wagesList;
  197. var newObja={};
  198. Object.keys(wages).some((key) => {
  199. var dict=wages[key].dictValue;
  200. var dicts=wages[key].dictLabel
  201. if(wages[key]&&dict!='xingming'&&dict!='gonghao'&&dict!='fafangshij'&&dict!='shifa'){
  202. newObja[dicts]=dat[dicts]
  203. }else if(wages[key]&&dict=='shifa'){
  204. newObja['shifa']=dat[dicts]
  205. }
  206. })
  207. this.paymonth=newObja
  208. }else{
  209. this.nodataflag=false
  210. }
  211. }
  212. } else {
  213. this.$toast(res.msg)
  214. }
  215. })
  216. },
  217. // 年
  218. getDataFn(a) {
  219. var params = {
  220. pageSize: this.pageSize,
  221. pageNum: this.pageNum,
  222. year:this.dateyear,
  223. }
  224. // params['params[role]']=this.$store.state.user.choseroles
  225. getpayListFn(params).then(res => {
  226. this.flag1=true;
  227. if (res.code == 200) {
  228. if (res.data.size < this.pageSize) {
  229. this.reachflag = false
  230. this.wtdt = '到底了~';
  231. this.$refs.zbTable.pullUpCompleteLoading('ok')
  232. } else {
  233. var num = parseInt(res.data.size) + parseInt(this.pageSize) * parseInt(this.pageNum -1)
  234. if (num < res.data.total) {
  235. this.reachflag = true
  236. this.wtdt = '上拉加载更多'
  237. this.$refs.zbTable.pullUpCompleteLoading('')
  238. } else {
  239. this.reachflag = false
  240. this.wtdt = '到底了~';
  241. this.$refs.zbTable.pullUpCompleteLoading('ok')
  242. }
  243. }
  244. var data=res.data;
  245. if(data.records&&data.records.length){
  246. var paylist=data.records[0].tableDataJO
  247. if(paylist&&paylist.length){
  248. // 处理数据
  249. Object.keys(paylist).some((key) => {
  250. var a=this.mondab
  251. if (paylist[key][a]&&a) {
  252. var s=paylist[key][a].split('-')
  253. paylist[key].fmonth=s[1]
  254. }
  255. })
  256. if (this.pageNum == 1) {
  257. this.list = paylist;
  258. } else {
  259. this.list = this.list.concat(paylist)
  260. }
  261. }
  262. }
  263. } else {
  264. this.$toast(res.msg)
  265. }
  266. })
  267. },
  268. pullUpLoading(done){
  269. if(!this.flag1){
  270. return
  271. }
  272. var that=this;
  273. this.flag1=false;
  274. setTimeout(()=>{
  275. that.pageNum++
  276. that.getDataFn()
  277. },100)
  278. },
  279. },
  280. }
  281. </script>
  282. <style lang="scss" scoped>
  283. .pay{
  284. .paytop{width: 100%;height: 300rpx;}
  285. .paybox{
  286. padding:0 32rpx;position: relative;margin-top: -250rpx;display: flex;flex-direction: column;height: calc(100vh - 50rpx);
  287. .pay_btn{width: 240rpx;height: 66rpx;background: rgba(0, 0, 0, 0.4);border-radius: 32rpx;
  288. font-size: 30rpx;font-weight: 500;color: #ECECEC;
  289. image{width: 18rpx;height: 10rpx;margin-left: 20rpx;}
  290. }
  291. .paybg{
  292. background: #FFFFFF;width: 100%;border-radius: 20rpx;
  293. &.paya{display: flex;align-items: center;flex-wrap: wrap;padding:16rpx 0;}
  294. &.payb{padding: 30rpx 24rpx 0;min-height: 600rpx;box-sizing: border-box;border-radius: 20rpx 20rpx 0 0;}
  295. .paylist{width: 25%;display: flex;flex-direction: column;align-items: center;padding: 16rpx 0;
  296. .tit{font-size: 38rpx;color: #161616;font-weight: bold;margin-bottom: 6rpx;}
  297. .txt{font-size: 26rpx;color: #666666;}
  298. }
  299. &.payc{height: 388rpx;display: flex;flex-direction: column;align-items: center;justify-content: center;font-size: 26rpx;font-weight: 500;
  300. color: #AAAAAA;
  301. image{width: 232rpx;height: 168rpx;margin-bottom: 40rpx;}
  302. }
  303. }
  304. .hisbox{
  305. .line{width: 10rpx;height: 40rpx;background: #1F57E6;border-radius: 6rpx;flex: 0 0 auto;margin-right: 26rpx;}
  306. .tit{font-size: 32rpx;font-weight: bold;color: #161616;flex: 1;}
  307. .hisbtn{
  308. image{width: 18rpx;height: 10rpx;margin-left: 14rpx;}
  309. }
  310. }
  311. }
  312. }
  313. .pay /deep/ .zb-table .zb-table-header{background-color: #F2F5FB;}
  314. .pay /deep/ .zb-table .odd{background-color: #F2F5FB;}
  315. .pay /deep/ .item-td{border-bottom: none;font-weight: bold;font-size: 26rpx;}
  316. .pay /deep/ .item-th{border-bottom: none;font-weight: bold;font-size: 26rpx;}
  317. .pay /deep/ .zb-table-tbody{padding-bottom: 20rpx;}
  318. </style>