123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206 |
- <template>
- <view class="content">
- <view class="topbar" v-show="isIphone">
- </view>
- <view class="status_bar">
- <view class="left" @click="goBack"><u-icon name="arrow-left"></u-icon>返回</view>
- <span style="font-size: 36rpx;">详情</span>
- <view class="right"></view>
- </view>
- <view class="mainCont">
- <view class="title">
- {{ info.packCode }}
- <span style="float: right; color: #FF6600" v-show="info.packState != '2'">待收集</span>
- <span style="float: right; color: #00cc00" v-show="info.packState == '2'">转运中</span>
- </view>
- <u-cell-group style="margin-bottom: 10px">
- <u-cell-item :arrow="false" :value-style="{textAlign: 'left',paddingLeft: '10px'}">
- <view slot="title"><span class="red"></span>科  室:</view>
- {{ info.positionName }}
- </u-cell-item>
- </u-cell-group>
- <u-cell-group style="margin-bottom: 10px">
- <u-cell-item :arrow="false" :value-style="{textAlign: 'left',paddingLeft: '10px'}">
- <view slot="title"><span class="red"></span>分  类:</view>
- {{ info.rubbishCategoryStr }}
- </u-cell-item>
- <u-cell-item :arrow="false" :value-style="{textAlign: 'left',paddingLeft: '10px'}">
- <view slot="title"><span class="red"></span>重  量:</view>
- {{ info.packWeight }}kg
- </u-cell-item>
- <u-cell-item :arrow="false" :value-style="{textAlign: 'left',paddingLeft: '10px'}">
- <view slot="title"><span class="red"></span>打 包 人:</view>
- {{ info.createUserName }}
- </u-cell-item>
- <u-cell-item :arrow="false" :value-style="{textAlign: 'left',paddingLeft: '10px'}">
- <view slot="title"><span class="red"></span>打包时间:</view>
- {{ info.createTime }}
- </u-cell-item>
- <u-cell-item :arrow="false" :value-style="{textAlign: 'left',paddingLeft: '10px'}">
- <view slot="title"><span class="red"></span>暂 存 点:</view>
- {{ info.provisionalName }}
- </u-cell-item>
- </u-cell-group>
- <view class="imgupload" v-show="fileList.length || info.packRemake">
- <view>{{ info.packRemake }}</view>
- <view class="imgbox">
- <img v-for="(item,index) in fileList" :src="item.filePath" alt="">
- </view>
- <!-- <u-upload :action="action" :file-list="fileList"></u-upload> -->
- </view>
- <view class="imgupload" v-show="info.packState != '2'">
- <u-input v-model="remark" auto-height type="textarea" />
- <u-upload :show-progress="false" ref="upload" @on-remove="uploadRemove" @on-success="uploadSuccess"
- :header="uploadHeader" max-count="3" width="80px" height="80px" :custom-btn="true" :action="action"
- :file-list="filesList">
- <view slot="addBtn" class="slot-btn">
- <image style="width: 80px;height: 80px" src="/static/tjzp.png" alt="">
- </view>
- </u-upload>
- </view>
- <view class="bottomButton" @click="collectDo" v-show="info.packState != '2'">
- <view>收集</view>
- </view>
- </view>
- <u-toast ref="uToast" />
- </view>
- </template>
- <script>
- const NET = require('@/utils/request')
- const API = require('@/config/api')
- export default {
- data() {
- return {
- remark: "",
- action: API.uploadFile,
- fileList: [],
- filesList: [],
- imgList: [],
- id: "",
- uploadHeader: {
- Authorization: 'Bearer ' + uni.getStorageSync('token')
- },
- isIphone: false,
- info: {},
- }
- },
- onLoad(options) {
- uni.getSystemInfo({
- success: (res) => {
- console.log(res)
- if (res.model == 'iPhone') {
- this.isIphone = true;
- }
- },
- fail: (err) => {
- console.log(err)
- }
- })
- this.id = options.id
- this.getInfo()
- },
- onReady() {
- if (this.isIphone) {
- document.getElementsByClassName('mainCont')[0].style.height = document.getElementsByClassName('mainCont')[
- 0].clientHeight - 25 + 'px'
- }
- },
- methods: {
- goBack() {
- uni.navigateBack({
- delta: 1
- });
- },
- getInfo() {
- NET.request(API.getPackageInfo + '/' + this.id, {}).then(res => {
- this.info = res.data
- this.fileList = res.data.packFiles
- }).catch(error => {
- this.$refs.uToast.show({
- title: error.msg,
- type: 'warning',
- })
- })
- },
- uploadSuccess(data, index) {
- console.log(data, index)
- if (data.code == 200) {
- data.data[0].fileType = 2
- data.data[0].fileCategory = 2
- this.imgList.push(data.data[0])
- this.$refs.uToast.show({
- title: '上传成功',
- type: 'success',
- })
- } else {
- this.$refs.upload.remove(index)
- }
- },
- uploadRemove(index) {
- console.log(index);
- this.imgList.splice(index, 1)
- },
- collectDo() {
- let postData = {
- collectRemake: this.remark,
- collectFileList: this.imgList
- }
- NET.request(API.collectRubbishPackage + '/' + this.id, postData, 'POST').then(res => {
- this.$refs.uToast.show({
- title: '收集成功',
- type: 'success',
- })
- uni.navigateBack({
- delta: 1
- });
- }).catch(error => {
- this.$refs.uToast.show({
- title: error.msg,
- type: 'warning',
- })
- })
- }
- }
- }
- </script>
- <style lang="scss">
- .mainCont {
- height: calc(100% - 80rpx);
- padding-bottom: 60px;
- overflow-y: scroll;
- }
- .title {
- height: 40px;
- line-height: 20px;
- padding: 10px;
- }
- .red {
- display: inline-block;
- width: 10px;
- height: 10px;
- color: red;
- }
- .imgupload {
- margin-bottom: 10px;
- padding: 10px 25px;
- background: #fff;
- .imgbox {
- img {
- width: 80px;
- height: 80px;
- margin: 10px 10px 10px 0;
- }
- }
- }
- /deep/ .u-cell__value {
- color: #1c1c1c;
- }
- </style>
|