qingyiay
2023-05-05 79993be468244e6cc16ce9c1d7e8736bd359c600
pages/customer-page/customer-index/customer-index.vue
@@ -1,69 +1,122 @@
<template>
   <view class="customer-index">
      <view class="customer-index-body">
         <u-empty mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png" textSize="30" iconSize="1000" v-if="orderPlanData.length == 0"></u-empty>
         <card v-for="(item, index) in orderPlanData" :key="index" :name="item.id" @click="cardBodyClick">
            <template v-slot:left>
               <view class="card-left__top">
                  <text>{{ item.carNum }}</text>
                  张
               </view>
               <view class="card-left__utils">
                  <u-button @tap.stop="receiveClick(item)" text="领取" type="primary" v-if="item.cars2 != item.carNum" shape="circle"></u-button>
                  <u-button text="转发" type="primary" @tap.stop="forwardClick(item)" shape="circle" v-if="item.carNum != item.carNumSurplus1"></u-button>
               </view>
            </template>
            <template v-slot:right-top>
               <view class="right-top">
                  <view class="card-right-top-row">
                     <view>
                        <text>{{ item.deptName || '' }}</text>
   <view class="">
      <view class="customer-index">
         <view class="customer-index-body">
            <!-- 待领取和转发提煤单 -->
            <view class="wait-collection" style="background: url('https://mx.jzeg.cn:9095/appimg/image/banner/customerbanner.png') no-repeat;background-size:contain"></view>
            <view style="position: relative;top: -120px;">
               <u-empty mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png" textSize="30" iconSize="1000" v-if="orderPlanData.length == 0"></u-empty>
            </view>
            <view class="collection-form">
               <view class="collection-form-item" v-for="(item, index) in orderPlanData" :key="index" @click="cardBodyClick(item)">
                  <view class="first-line">
                     <view class="dispatch-receive">
                        <view class="dispatch">{{ item.filedName }}</view>
                     </view>
                     <view>
                        <text>{{ item.coalName }}</text>
                     <view class="point-number">
                        <text class="residue">{{ item.cars2 }}</text>
                        <text>/{{ item.carNum }}</text>
                     </view>
                  </view>
                  <view class="card-right-top-row">
                     <view>
                        <text>已领取{{ item.cars2 }}张</text>
                     </view>
                  <view class="second-line">
                     <view class="coal-name">{{ item.coalName }}</view>
                     <view class="black-block"></view>
                     <view class="coal-type" v-if="item.orderType">{{ item.orderType }}</view>
                  </view>
                  <view class="card-right-top-row">
                     <!-- <view v-if="item.cars == item.cars2 ? false : true">
                        领取:
                        <text class="lingqu" @tap.stop="numInput(item.id)">{{ item.receiveNum || '_______' }}</text>
                        张
                     </view> -->
                     <view v-if="item.cars == item.cars2 ? false : true">剩余{{ item.carNum - item.cars2 }}张</view>
                     <view v-else>已领完</view>
                  <view class="third-line">
                     <view class="time-icon"><u-icon name="clock" color="#515151" size="40"></u-icon></view>
                     <view class="send-date">{{ item.sendDate }}</view>
                  </view>
                  <view class="fourth-line">
                     <u-button @tap.stop="receiveClick(item)" text="领取" type="primary" v-if="item.carNum - item.cars2 != 0" shape="circle"></u-button>
                     <u-button text="转发" type="primary" @tap.stop="forwardClick(item)" shape="circle"></u-button>
                  </view>
               </view>
            </template>
            <template v-slot:right-bottom>
               <view class="code">
                  <text>编号:{{ item.code || '' }}</text>
               </view>
            </template>
         </card>
      </view>
            </view>
      <!-- 领取弹出框 -->
      <u-popup :show="show" @close="close" @open="open" mode="center" round="10">
         <view class="receiverPopup">
            <view class="receiverPopup__title"><text>确认领取数量</text></view>
            <view class="receiverPopup__input"><u--input v-model="receiveNum" @change="change" placeholder="请输入内容" type="number" border="surround"></u--input></view>
            <view class="receiverPopup__btn"><u-button text="确定" type="primary" @click="popupDetermineClick"></u-button></view>
            <!-- 历史提煤单 -->
            <view class="history-numbers">
               <combined-title title="历史提煤单"></combined-title>
               <scroll-view :scroll-top="scrollTop" scroll-y="true" class="scroll-Y" @scrolltolower="historyScrolltolower">
                  <u-empty mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png" textSize="30" iconSize="1000" v-if="historyCoalData.length == 0"></u-empty>
                  <view class="history-information" v-for="(item, index) in historyCoalData" :key="index" @click="faYundetail(item)">
                     <view class="first">
                        <view class="">{{ item.deptName || '' }}</view>
                        <view class=""><u-icon name="arrow-right" color="#999999" size="40"></u-icon></view>
                     </view>
                     <view class="second">
                        <view class="">{{ item.coalName || '' }}</view>
                        <view class="order-type">{{ item.orderType || '' }}</view>
                     </view>
                     <view class="third">
                        <view class="third-line">
                           <view class="third-line_text">领取数:</view>
                           <view class="third-line_num">{{ item.cars2 }}</view>
                        </view>
                        <view class="third-line">
                           <view class="third-line_text">剩余数:</view>
                           <view class="third-line_num" v-if="roleType == 1">{{ item.carNumSurplus1 }}</view>
                           <view class="third-line_num" v-else-if="roleType == 2">{{ item.carNumSurplus }}</view>
                        </view>
                        <view class="third-line">
                           <view class="third-line_text">提煤单个数::</view>
                           <view class="third-line_num">{{ item.tmCount }}</view>
                        </view>
                     </view>
                     <view class="fourth">
                        <view class="fourth-icon"><u-icon name="clock" color="#999999" size="40"></u-icon></view>
                        <view class="senddate">{{ item.sendDate }}</view>
                     </view>
                     <view class="fourth">
                        <view class="fourth-icon"><u-icon name="clock" color="#999999" size="40"></u-icon></view>
                        <view class="senddate">{{ item.orderCode }}</view>
                     </view>
                  </view>
                  <view class="more_text" v-if="showMoreData && historyCoalData.length !== 0">没有数据了...</view>
                  <view class="white-block"></view>
               </scroll-view>
            </view>
         </view>
      </u-popup>
         <!-- 领取弹出框 -->
         <u-popup :show="show" @close="close" @open="open" mode="center" round="10">
            <view class="receiverPopup">
               <view class="receiverPopup__title"><text>确认领取数量</text></view>
               <view class="receiverPopup__input"><u--input v-model="receiveNum" @change="change" placeholder="请输入内容" type="number" border="surround"></u--input></view>
               <view class="receiverPopup__btn"><u-button text="确定" type="primary" @click="popupDetermineClick"></u-button></view>
            </view>
         </u-popup>
      </view>
   </view>
</template>
<script>
import card from '@/components/card/card.vue';
import combinedTitle from '@/components/combined-title/combined-title.vue';
import { customerId } from '@/utils/status';
export default {
   props: {
      orderPlanDataStore: {
         type: Array,
         default: []
      }
   },
   components: {
      card
      card,
      combinedTitle
   },
   watch: {
      orderPlanDataStore: {
         handler(v) {
            this.orderPlanData = v;
         },
         deep: true,
         immediate: true
      }
   },
   computed: {
      roleType() {
         return uni.getStorageSync('roleType');
      }
   },
   data() {
      return {
@@ -73,32 +126,76 @@
         getOrderNum: {
            num: '',
            id: null
         }
         },
         historyCoalData: [],
         // 表格加载状态
         loading: false,
         scrollTop: 0,
         // 每页数据量
         pageSize: 10,
         // 当前页
         pageCurrent: 1,
         // 数据总量
         total: 0,
         // 是否显示更多数据
         showMoreData: false
      };
   },
   onLoad() {},
   onShow() {
      this.init();
   },
   methods: {
      init() {
         this.GetOrderPlan();
         this.getJhOrderPlanDataPage();
      },
      // 获取发运计划列表
      GetOrderPlan() {
         uni.showLoading({
            title: '加载中...'
         });
         uni.showLoading({ title: '加载中...' });
         this.$reqGet('GetOrderPlan').then(res => {
            this.orderPlanData = res.data;
            uni.hideLoading();
            if (res.data) {
               this.orderPlanData = res.data;
               uni.hideLoading();
            }
         });
      },
      // 获取历史提煤单
      getJhOrderPlanDataPage() {
         this.loading = true;
         this.$reqGet('getJhOrderPlanDataPage', { current: this.pageCurrent, size: this.pageSize }).then(res => {
            if (res.data.records) {
               this.total = res.data.total;
               if (this.pageCurrent > 1) {
                  this.historyCoalData = this.historyCoalData.concat(res.data.records);
                  this.historyCoalData = this.ArrSet(this.historyCoalData, 'id');
                  this.loading = false;
               } else {
                  this.historyCoalData = res.data.records;
                  this.loading = false;
               }
            }
         });
      },
      // 上拉加载
      historyScrolltolower() {
         if (this.pageCurrent * this.pageSize >= this.total) return (this.showMoreData = true);
         this.pageCurrent++;
         this.getJhOrderPlanDataPage();
      },
      //fix 点击提煤单返回会增加重复数据
      ArrSet(Arr, id) {
         var obj = {};
         const arrays = Arr.reduce((setArr, item) => {
            obj[item[id]] ? '' : (obj[item[id]] = true && setArr.push(item));
            return setArr;
         }, []);
         return arrays;
      },
      popupDetermineClick() {
         if (this.receiveNum) {
            this.getOrderNum.num = this.receiveNum;
            uni.showLoading({
               title: '加载中...'
            });
            uni.showLoading({ title: '加载中...' });
            this.$reqPost('customerGet', this.getOrderNum, 'params').then(res => {
               uni.hideLoading();
               if (res.code == 0) {
@@ -110,7 +207,7 @@
                     duration: 1000
                  });
               } else {
                  this.$u.toast(res.data ? res.data : '领取失败');
                  this.$u.toast(res.msg ? res.msg : '领取失败');
               }
            });
         } else {
@@ -138,119 +235,242 @@
         console.log('输入框', e);
      },
      // 提煤单详情
      cardBodyClick(name) {
         console.log('提煤单详情', name);
      cardBodyClick(v) {
         // console.log(name, 'name');
         // let code = null;
         // let cars2 = null;
         // this.orderPlanData.forEach(item => {
         //    if (item.id == name) {
         //       code = item.code;
         //       cars2 = item.cars2;
         //    }
         // });
         uni.navigateTo({ url: `/pages/customer-page/customer-index/fayunPlanDetails/fayunPlanDetails?orderPlanId=${v.id}&code=${v.code}&cars2=${v.cars2}` });
      },
      // 点击历史提煤单获取详情
      faYundetail(v) {
         uni.navigateTo({
            url: `/pages/customer-page/customer-index/fayunPlanDetails/fayunPlanDetails?orderPlanId=${name}`
            url: `/pages/customer-page/customer-index/fayunPlanDetails/fayunPlanDetails?orderPlanId=${v.id}&cars2=${v.cars2}&coalName=${v.coalName}&deptName=${v.deptName}`
         });
      },
      // 转发
      forwardClick(obj) {
         uni.navigateTo({
            url: `/pages/public-page/forward/forward?orderPlanId=${obj.id}&carNumSurplus1=${obj.carNumSurplus1}`
         });
         if (obj.cars2 == 0) return this.$u.toast('请先领取后再转发');
         uni.navigateTo({ url: `/pages/public-page/forward/forward?orderPlanId=${obj.id}&carNumSurplus1=${obj.carNumSurplus1}&carNum=${obj.carNum}&cars2=${obj.cars2}` });
      }
   }
};
</script>
<style lang="scss" scoped>
@mixin flex {
   display: flex;
   justify-content: space-between;
   align-items: center;
}
.wait-collection {
   width: 100%;
   height: 600rpx;
   position: relative;
   top: vww(-10);
   z-index: 0;
}
.white-block {
   width: 100%;
   height: vww(50);
   margin-top: vww(10);
}
.scroll-Y {
   height: 900rpx;
   .more_text {
      color: #333;
      font-size: 24rpx;
      text-align: center;
   }
}
.history-numbers {
   width: 100%;
   position: relative;
   top: vww(-110);
   .history-information {
      width: 690rpx;
      height: 398rpx;
      margin: vww(10) vww(15);
      background: #ffffff;
      box-shadow: 0rpx 0rpx 14rpx 0rpx rgba(73, 120, 240, 0.14), 0rpx 7rpx 45rpx 0rpx rgba(73, 120, 240, 0.12);
      border-radius: 20rpx;
      @include flex flex-direction: column;
      align-items: flex-start;
      justify-content: space-evenly;
      overflow: hidden;
      .first {
         width: 96%;
         height: 34rpx;
         font-size: 32rpx;
         font-family: Microsoft YaHei;
         font-weight: 300;
         color: #303030;
         @include flex;
         margin: vww(10) vww(10) 0;
      }
      .second {
         width: 50%;
         height: 31rpx;
         font-size: 30rpx;
         font-family: Microsoft YaHei;
         font-weight: 300;
         color: #515151;
         margin: vww(10) vww(10) 0;
         @include flex;
         .order-type {
            color: #035cfb;
            border: 2px solid #035cfb;
            border-radius: 4rpx;
            padding: vww(2) vww(4);
            text-align: center;
         }
      }
      .third {
         width: 96%;
         height: 31rpx;
         font-size: 30rpx;
         font-family: Microsoft YaHei;
         font-weight: 300;
         color: #515151;
         margin: vww(10) vww(10) 0;
         @include flex;
         .third-line {
            @include flex;
            &_text {
               color: #919090;
            }
            &_num {
               color: #035cfb;
            }
         }
      }
      .fourth {
         width: 50%;
         height: 31rpx;
         font-size: 30rpx;
         font-family: Microsoft YaHei;
         font-weight: 300;
         color: #515151;
         margin: vww(10) vww(10) 0;
         @include flex;
      }
   }
}
::v-deep.customer-index {
   width: 94%;
   width: 100%;
   margin: 0 auto;
   // 主体
   .customer-index-body {
      margin-bottom: vww(56);
      .card-left__top {
         margin-top: vww(26);
         text-align: center;
         color: #ffffff;
         text {
            font-size: vww(48);
            font-weight: 800;
         }
      }
      .card-left__utils {
         display: flex;
         padding: 0 vww(15) 0 vww(15);
         .u-button {
            width: vww(55);
            height: vww(24);
            background-color: #fff;
            color: #1987ff;
         }
      }
      .right-top {
         display: flex;
         flex-flow: column nowrap;
         align-content: space-around;
         .card-right-top-row {
            margin-top: vww(8);
            text-align: center;
            .lingqu {
               margin-right: vww(10);
               border-bottom: 1px solid #000000;
               width: vww(30);
      .collection-form {
         width: vww(345);
         margin: 0 vww(15);
         position: relative;
         top: vww(-144);
         .collection-form-item {
            width: 690rpx;
            height: 300rpx;
            background: #ffffff;
            box-shadow: 4rpx 6rpx 25rpx 0rpx rgba(73, 120, 240, 0.15);
            border-radius: 20rpx;
            overflow: hidden;
            @include flex flex-direction: column;
            position: relative;
            align-items: flex-start;
            margin-top: vww(10);
            .first-line {
               width: 94%;
               height: vww(30);
            }
            &:nth-child(1) {
               margin: vww(10) vww(16) 0 vww(16);
               display: flex;
               justify-content: space-between;
               view {
                  text-align: center;
                  width: 50%;
               .dispatch-receive {
                  width: 70%;
                  display: flex;
                  justify-content: space-between;
                  align-items: center;
               }
               .point-number {
                  width: 15%;
                  text {
                     font-size: 24rpx;
                     font-family: Microsoft YaHei;
                     font-weight: 400;
                     color: #c78a64;
                  }
                  .residue {
                     font-size: 40rpx;
                     font-family: CTCuHeiSJ;
                     font-weight: 400;
                     color: #f81414;
                  }
               }
            }
         }
      }
      .code {
         margin-top: vww(7);
         text-align: center;
      }
      // .newTask-card-body-row {
      //    text-align: center;
      //    .lingqu {
      //       margin-right: vww(10);
      //       border-bottom: 1px solid #000000;
      //       width: vww(30);
      //       height: vww(30);
      //    }
      // &:nth-child(1) {
      //    font-weight: 600;
      // }
      // &:nth-child(2) {
      //    margin-top: vww(10);
      //    font-weight: 600;
      // }
      // &:nth-child(3) {
      //    margin-top: vww(10);
      //    font-weight: 600;
      // }
      // &:nth-child(4) {
      //    margin-top: vww(10);
      //    font-weight: 600;
      // }
      // view {
      //    display: inline-block;
      //    &:nth-child(1) {
      //       margin-right: vww(20);
      //    }
      // }
      // }
      .utilsBtn {
         display: flex;
         .u-button {
            width: 30%;
            .second-line {
               width: 60%;
               height: vww(30);
               display: flex;
               justify-content: space-evenly;
               align-items: center;
               .coal-name {
                  width: 30%;
                  height: 30rpx;
                  font-size: 30rpx;
                  font-family: Microsoft YaHei;
                  font-weight: 300;
                  color: #515151;
                  position: relative;
                  display: flex;
                  justify-content: space-between;
               }
               .black-block {
                  width: 2rpx;
                  height: 30rpx;
                  background: #515151;
               }
               .coal-type {
                  width: 24%;
                  height: 30rpx;
                  font-size: 30rpx;
                  font-family: Microsoft YaHei;
                  font-weight: 300;
                  color: #515151;
               }
            }
            .third-line {
               width: 40%;
               height: vww(30);
               margin-left: vww(15);
               display: flex;
               justify-content: space-between;
               align-items: center;
               .send-date {
                  width: 148rpx;
                  height: 24rpx;
                  line-height: 24rpx;
                  font-size: 28rpx;
                  font-family: Microsoft YaHei;
                  font-weight: 300;
                  color: #515151;
               }
            }
            .fourth-line {
               width: 40%;
               height: vww(30);
               @include flex;
               position: relative;
               left: 60%;
               bottom: vww(10);
               .u-button {
                  width: vww(50);
                  height: vww(30);
               }
            }
         }
      }
   }