-
zhangwei
2025-03-05 16213c0f85aa3ac8317797bf4a05fd12940e16d3
src/pages/company/index.vue
@@ -1,101 +1,139 @@
<template>
   <view class="full-page">
      <up-sticky>
         <view class="coreshop-ff content c-p-10">
            <up-search placeholder="请点击选择打卡日期" @click='clickIcon' disabled v-model="wordDate" search-icon="calendar"
               @custom='PostMyComDakaListPage'></up-search>
         </view>
         <up-subsection :list="list" activeColor="#f9ae3d" @change="sectionChange"></up-subsection>
      </up-sticky>
      <view class="" v-if="viewList&&viewList.length>0">
         <view class="listrecord c-p-18" v-for="item in viewList" :key='item.id'>
            <view class="coreshop-ff chuany-bradius20">
               <view @click='jumpWorkDetail(item)'
                  class="bgblue c-p-l-18 c-p-r-18 c-p-t-10 c-p-b-10 chuany-flex chuany-justify-between chuany-font30">
                  <text class=''>
                     打卡日期:{{$util.formatDate(item.workDate)}}
                  </text>
               </view>
               <view class="c-p-26">
                  <view class="chuany-flex chuany-justify-between">
                     <text class="chuany-font34 ">
                        {{item.orderName}}
   <view class="full-page" scroll-y using-sticky>
      <view class="">
         <up-sticky>
            <!-- <view class="coreshop-ff content c-p-10">
               <up-search placeholder="请点击选择打卡日期" @click='clickIcon' disabled v-model="wordDate" search-icon="calendar"
                  @custom='PostMyComDakaListPage'></up-search>
            </view> -->
            <view class="coreshop-ff content c-p-l-10 c-p-t-10 c-p-r-10">
               <!-- <up-input shape="round" class="u-search__content__input"></up-input> -->
               <up-search placeholder="请点击选择打卡日期" @click='clickIcon' @clear='init' disabled
                  v-model="wordDate" search-icon="calendar" @search='init'
                  :show-action="false"></up-search>
               <!-- <up-search placeholder="请输入工人名字" :show-action="false" v-model="workerUserName"
                  @clear='PostMyComDakaListPage' @search='PostMyComDakaListPage'></up-search> -->
            </view>
            <view class="coreshop-ff content c-p-10">
               <up-search placeholder="请输入工人名字" v-model="workerUserName" @custom='init'
                  @clear='init' @search='init'></up-search>
               <!-- <up-search placeholder="请点击选择打卡日期" @click='clickIcon' @clear='PostMyComDakaListPage' disabled
                  v-model="wordDate" search-icon="calendar" @search='PostMyComDakaListPage'
                  @custom='PostMyComDakaListPage'></up-search> -->
            </view>
            <up-subsection :list="list" current='1' activeColor="#f9ae3d" @change="sectionChange"></up-subsection>
         </up-sticky>
         <view class="full-page-content c-p-b-100" v-if="viewList&&viewList.length>0">
            <view class="listrecord c-p-t-28 c-p-l-28 c-p-r-28" v-for="item in viewList" :key='item.id'>
               <view class="coreshop-ff chuany-bradius20">
                  <view @click='jumpWorkDetail(item)'
                     class="bgblue c-p-l-18 c-p-r-18 c-p-t-10 c-p-b-10 chuany-flex chuany-justify-between chuany-font30">
                     <text class=''>
                        打卡日期:{{$util.formatDate(item.workDate)}}
                     </text>
                  </view>
                  <view class="c-p-18 chuany-font28">
                     <view class="chuany-flex chuany-justify-between">
                        <!-- <text class="c-p-r-20">
                        </text> -->
                        <up-tag class='c-m-r-10' :text="item.isShenPiName" shape="circle" type="success" plain
                           plainFill size='mini'></up-tag>
                        <!-- <up-tag text="已确认" shape="circle" type="success" plain plainFill size='mini'></up-tag> -->
                     </view>
                  </view>
                  <view class="c-p-t-14">
                     姓名:{{item.workerUserName}}
                  </view>
                  <view class="c-p-t-14">
                     打卡记录:{{item.dakaMingxi}}
                  </view>
                  <view class="chuany-flex chuany-justify-between chuany-flex-wrap">
                     <view class="chuany-width48 c-p-t-14">
                        <text>
                           方式:{{item.workerTypeName}}
                        <text class="chuany-font32">
                           {{item.orderName}}
                        </text>
                     </view>
                     <view class="chuany-width48 chuany-flex c-p-t-14">
                        <text>
                           工价:{{item.workPrice}}{{item.workerType==0?'元/小时':'元/件'}}
                        </text>
                        <!-- <up-input type="digit" v-if="item.isShenPiName!=='已结算'" style="padding: 0;" size='mini'
                           @blur='(val) => {item.todaySalary=$util.roundToTwo(item.workTime*item.workPrice)}'
                           border="surround" v-model="item.workPrice"></up-input>
                        <text v-else>{{item.workPrice}}{{item.workerType==0?'元/小时':'元/件'}}</text> -->
                     </view>
                        <view class="chuany-flex chuany-justify-between">
                           <!-- <text class="c-p-r-20">
                           </text> -->
                           <!-- <up-tag class='c-m-r-10' :text="item.isShenPiName" shape="circle" type="success" plain
                              plainFill size='mini'></up-tag> -->
                           <!-- v-if="item.isShenPi!==2" -->
                           <view class="chuany-width10" v-if="item.isShenPiName=='未审核'||item.isModify">
                              <up-button :text="item.isShenPi!==2?'核准工资':'修改'" size="mini"
                                 :loading='item.isLoading' :loadingText="item.isShenPi!==2?'核准中':'修改中'"
                                 @tap.stop='saveDakaDetailCompany(item)' type="warning"></up-button>
                           </view>
                           <up-text v-else :type="item.isShenPiName=='未审核'?'info':'success'"
                              :text="item.isShenPiName" size='14'></up-text>
                     <view class="chuany-width48 chuany-flex c-p-t-14">
                        <text>
                           时长:
                        </text>
                        <up-input type="digit" v-if="item.workerType!=1" style="padding: 0;" size='mini'
                           @blur='(val) => {item.todaySalary=$util.roundToTwo(item.workTime*item.workPrice)}'
                           border="surround" v-model="item.workTime"></up-input>
                     </view>
                     <view class="chuany-width48 chuany-flex c-p-t-14" v-if="item.workerType==1">
                        <text>
                           数量:
                        </text>
                        <up-input type="digit" style="padding: 0;" size='mini' border="surround"
                           @blur='(val) => {item.todaySalary=$util.roundToTwo(item.workCount*item.workPrice)}'
                           v-model="item.workCount"></up-input>
                     </view>
                     <view class="chuany-width48 chuany-flex c-p-t-14">
                        <text>
                           工资:
                        </text>
                        <up-input type="digit" style="padding: 0;" size='mini' border="surround"
                           v-model="item.todaySalary"></up-input>
                        <!-- <text v-else>{{item.todaySalary}} 元</text> -->
                     </view>
                     <view class="chuany-width48 c-p-t-14">
                        <view class="chuany-width10">
                           <up-button class="button-layout__item" :text="item.isShenPiName!=='已结算'?'确认':'修改'" size="mini"
                              :loading='item.isLoading' :loadingText="item.isShenPiName!=='已结算'?'确认中':'修改中'"
                              @tap.stop='saveDakaDetailCompany(item)' type="warning"></up-button>
                           <!-- <up-tag text="已确认" shape="circle" type="success" plain plainFill size='mini'></up-tag> -->
                        </view>
                     </view>
                     <view class="text-69">
                        <view class="c-p-t-8">
                           姓名:{{item.workerUserName}}
                        </view>
                        <view class="c-p-t-8">
                           打卡记录:{{item.dakaMingxi}}
                        </view>
                     </view>
                     <view class="chuany-flex chuany-justify-between chuany-flex-wrap text-69 c-p-t-8">
                        <view class="chuany-width48">
                           <text>
                              方式:{{item.workerTypeName}}
                           </text>
                        </view>
                        <view class="chuany-width48 chuany-flex">
                           <text>
                              工价:{{item.workPrice}}{{item.workerType==0?'元/小时':'元/件'}}
                           </text>
                           <!-- <up-input type="digit" v-if="item.isShenPiName!=='已结算'" style="padding: 0;" size='mini'
                              @change='(val) => {item.todaySalary=$util.roundToTwo(item.workTime*item.workPrice)}'
                              border="surround" v-model="item.workPrice"></up-input>
                           <text v-else>{{item.workPrice}}{{item.workerType==0?'元/小时':'元/件'}}</text> -->
                        </view>
                        <view class="chuany-width48 chuany-flex c-p-t-8">
                           <text>
                              时长:
                           </text>
                           <up-input type="digit"
                              style="padding: 0;" size='mini' v-if="item.workerType!=1 && (item.isShenPi!==2||item.isModify)"
                              @change='(val) => {item.todaySalary=$util.roundToTwo(val*item.workPrice)}'
                              border="surround" v-model="item.workTime"></up-input>
                           <text v-else>{{item.workTime}}</text>
                        </view>
                        <view class="chuany-width48 chuany-flex c-p-t-8" v-if="item.workerType==1">
                           <text>
                              数量:
                           </text>
                           <up-input type="digit" style="padding: 0;" size='mini' border="surround"
                              v-if="item.isShenPi!==2||item.isModify"
                              @change='(val) => {item.todaySalary=$util.roundToTwo(val*item.workPrice)}'
                              v-model="item.workCount"></up-input>
                           <text v-else>{{item.workCount}}</text>
                        </view>
                        <view class="chuany-width48 chuany-flex c-p-t-8">
                           <text>
                              工资:
                           </text>
                           <up-input type="digit" style="padding: 0;" size='mini' border="surround"
                              v-model="item.todaySalary" v-if="item.isShenPi!==2||item.isModify"></up-input>
                           <text v-else>{{item.todaySalary}} 元</text>
                        </view>
                        <!-- <view class="chuany-width48 c-p-t-8">
                           <view class="chuany-width10" v-if="item.isShenPi!==2">
                              <up-button class="button-layout__item" :text="item.isShenPi!==2?'核准工资':'修改'"
                                 size="mini" :loading='item.isLoading'
                                 :loadingText="item.isShenPi!==2?'核准中':'修改中'"
                                 @tap.stop='saveDakaDetailCompany(item)' type="warning"></up-button>
                           </view>
                        </view> -->
                     </view>
                  </view>
               </view>
            </view>
            <up-loadmore :status="loadStatus" />
         </view>
         <up-loadmore :status="loadStatus" />
         <view v-else>
            <up-empty text='暂无' icon="/static/order.png">
            </up-empty>
         </view>
         <!-- <fui-date-picker :show="datePickerShow" :value="$util.formatDate(new Date())" type="3" @change="changePicker"
            @cancel="cancel"></fui-date-picker> -->
         <fui-date-picker :show="datePickerShow" range :value="$util.formatDate(new Date())" type="3"
            @change="changePicker" @cancel="cancel"></fui-date-picker>
         <view class="tabbtns">
            合计:{{heji}} 元
         </view>
      </view>
      <view v-else>
         <up-empty text='暂无' icon="/static/order.png">
         </up-empty>
      </view>
      <fui-date-picker :show="datePickerShow" :value="$util.formatDate(new Date())" type="3" @change="changePicker"
         @cancel="cancel"></fui-date-picker>
   </view>
</template>
@@ -106,12 +144,16 @@
            pageIndex: 1,
            pageSize: 20,
            wordDate: '',
            isJieSuan: '',
            list: ['全部', '未结算', '已结算'],
            isJieSuan: false,
            workerUserName: '',
            list: ['全部', '未审核', '已审核'],
            datePickerShow: false,
            viewList: [],
            heji: '',
            loadStatus: 'loadmore',
            workCount: '', //计件数量
            WordDateStart: '', //工作日期开始
            WordDateEnd: '' //工作日期结束
         }
      },
      onLoad() {
@@ -123,18 +165,36 @@
         }
      },
      onPullDownRefresh() {
         this.pageIndex = 1
         this.pageSize = 20
         this.wordDate = ''
         this.isJieSuan = ''
         this.loadStatus = 'loadmore'
         this.PostMyComDakaListPage();
         this.workerUserName = ''
         this.init()
         uni.stopPullDownRefresh();
      },
      methods: {
         changeTime(val,item) {
            item.workTime = val
            item.todaySalary = this.$util.roundToTwo(item.workTime * item.workPrice)
            console.log(val,item.todaySalary,item.workTime * item.workPrice);
         },
         init() {
            this.pageIndex = 1
            this.pageSize = 20
            this.loadStatus = 'loadmore'
            this.PostMyComDakaListPage();
         },
         sectionChange(val) {
            this.isJieSuan = val
            this.PostMyComDakaListPage()
            switch (val) {
               case 0:
                  this.isJieSuan = null
                  break;
               case 1:
                  this.isJieSuan = false
                  break;
               case 2:
                  this.isJieSuan = true
                  break;
            }
            this.init()
         },
         saveDakaDetailCompany(item) {
            if (item.workerType == 1 && !item.workCount) {
@@ -153,15 +213,15 @@
               obj.workCount = item.workCount
            }
            item.isLoading = true
            console.log(item.isShenPiName,'item.isShenPiName’');
            console.log(item.isShenPiName, 'item.isShenPiName’');
            this.$api.saveDakaDetailCompany(obj).then(res => {
               if (res.code == 1) {
                  this.$util.showToast({
                     title: item.isShenPiName=='已结算'?'修改成功!':'确认成功!',
                     title: item.isShenPiName == '已结算' ? '修改成功!' : '确认成功!',
                     icon: 'success'
                  })
                  this.PostMyComDakaListPage();
               }else {
                  this.init();
               } else {
                  this.$util.showToast({
                     title: res.error ? res.error : '失败!'
                  })
@@ -173,34 +233,31 @@
            let data = {
               pageIndex: this.pageIndex,
               pageSize: this.pageSize,
               isJieSuan: this.isJieSuan
            }
            // if (this.wordDate) {
            //    data.wordDate = this.wordDate
            // }
            if (this.wordDate) {
               data.wordDate = this.wordDate
               data.WordDateStart = this.WordDateStart //工作日期开始
               data.WordDateEnd = this.WordDateEnd //工作日期结束
            }
            if (this.isJieSuan) {
               switch (this.isJieSuan) {
                  case 0:
                     this.isJieSuan = ''
                     break;
                  case 1:
                     this.isJieSuan = false
                     break;
                  case 2:
                     this.isJieSuan = true
                     break;
               }
               data.isJieSuan = this.isJieSuan
            if (this.workerUserName) {
               data.WorkerUserName = this.workerUserName
            }
            this.$api.PostMyComDakaListPage(data).then(res => {
               if (res.code == 1) {
                  this.heji = res.data.heji
                  if (this.pageIndex == 1) {
                     this.viewList = res.data.items
                  } else {
                     this.viewList.concat(...res.data.items)
                     this.viewList = this.viewList.concat(...res.data.items)
                  }
                  console.log(this.viewList, this.viewList.length, 'this.viewList');
                  this.viewList.forEach(item=>{
                  this.viewList.forEach(item => {
                     item.isLoading = false
                     console.log(this.$util.minutesBetweenDates(item.shenPitime, new Date()));
                     this.$util.minutesBetweenDates(item.shenPitime, new Date()) <= 5 ? item.isModify =
                        true : item.isModify = false
                  })
                  // totalPages.value = res.data.totalCount
                  // 根据count数量判断是否还有数据
@@ -214,9 +271,16 @@
               }
            })
         },
         // changePicker(val) {
         //    this.wordDate = val.result
         //    this.datePickerShow = false
         // },
         changePicker(val) {
            this.wordDate = val.result
            this.wordDate = val.startDate.result + '至' + val.endDate.result
            this.WordDateStart = new Date(val.startDate.result) //工作日期开始
            this.WordDateEnd = new Date(val.endDate.result) //工作日期结束
            this.datePickerShow = false
            this.PostMyComDakaListPage();
         },
         cancel() {
            this.datePickerShow = false