yangan
2025-02-27 ea7457be6870e35cd385e163ca9bba26d7621d66
pages/public-page/faYunstatisticsDetails/faYunstatisticsDetails.vue
@@ -38,7 +38,8 @@
                  <view class="">{{ faYunDetailobj.clean || '' }}</view>
               </view>
            </view>
            <view class="body-container">
            <view class="body-container"
               v-if="!isSpecial">
               <view class="container-block">
                  <view class="">订单剩余量</view>
                  <view class="">{{ faYunDetailobj.allowance || '' }}</view>
@@ -50,7 +51,8 @@
                  <view class="">{{ faYunDetailobj.code || '' }}</view>
               </view>
            </view>
            <view class="body-container last">
            <view class="body-container last"
               v-if="!isSpecial">
               <view class="container-block">
                  <view class="">订单编号</view>
                  <view class="">{{ faYunDetailobj.orderCode || '' }}</view>
@@ -79,11 +81,18 @@
               </view>
            </view>
         </view>
         <!-- 增加电子磅单下载 -->
         <!-- v-if="roleType === 3" -->
         <view class="weigh-button">   <u-button text="下载电子磅单"
               @click="downloadTmFile"
               type="primary"
               shape="circle"></u-button></view>
      </view>
   </view>
</template>
<script>
   import { BaseUrl } from '@/api/publicInterface.js';
   import combinedTitle from '@/components/combined-title/combined-title.vue';
   export default {
      components: {
@@ -94,11 +103,54 @@
            id: '',
            faYunDetailobj: {},
            coalStatus: ['领取', '预约', '签到', '入场', '称皮', '称毛', '离场', '入磅房', '出磅房', '入煤仓', '出煤仓', '放空', '作废', '入场申请',
               '进入场院', '异常审核中'
            ]
               '进入场院', '异常审核中', '打印中', '打印中', '填写'
            ],
            isSpecial: null //1 是特殊 0不是特殊
         };
      },
      methods: {},
      methods: {
         //下载电子磅单
         downloadTmFile(){
            uni.showLoading({
               title: '加载中'
            });
            this.$reqGetId('downLoadTm',this.id).then(res=>{
               console.log(res,'result')
               this.$u.toast('下载成功!')
               uni.hideLoading();
               const result =    res.data.url;
               let that = this;
               const fileExtName = ".pdf";
               const randfile = new Date().getTime() +res.data.fileName;
               const newPath = `${wx.env.USER_DATA_PATH}/${randfile}`;
               if(result){
                        wx.downloadFile({
                        url: `${BaseUrl}${result}`,
                        filePath:wx.env.USER_DATA_PATH+`/${randfile}`,
                        header: {
                           Authorization: 'Bearer' + ' ' + uni.getStorageSync('token'),
                           CLIENT_TOC: 'Y'
                        },
                        success(res){
                           const filePath = res.tempFilePath;
                           wx.openDocument({
                           filePath: res.filePath,
                           showMenu: true,
                           fileType: 'pdf',
                           success: function (res) {}
                           })
                           uni.hideLoading();
                        },
                        fail(err){
                           console.log(err,'下载文件失败')
                        }
               })
                     }
            })
         },
      },
      onLoad(params) {
         this.id = params.id;
      },
@@ -106,11 +158,17 @@
         this.$reqGet('getTakeCoal', { takeCoalId: this.id }).then(res => {
            if (res.code == 0) {
               this.faYunDetailobj = res.data;
               this.isSpecial = res.data.isSpecial
            } else {
               this.$u.toast('获取数据失败');
            }
         });
      }
      },
        computed:{
      roleType() {
            return uni.getStorageSync('roleType');
         },
     }
   };
</script>
@@ -121,7 +179,9 @@
      justify-content: space-between;
      align-items: center;
   }
   .weigh-button{
      margin-top: 30rpx;
   }
   .main {
      width: 100%;
      margin-top: vww(10);