123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231 |
- <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: #bcbcbc" v-show="info.packState == '4'">已完成</span>
- <span style="float: right; color: #2D8CF0" v-show="info.packState == '3'">待验收</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">
- <view>{{ info.packRemake }}</view>
- <view class="imgbox">
- <img v-for="(item,index) in fileList" :src="item.filePath" alt="">
- </view>
- </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>
- 顾一野
- </u-cell-item>
- <u-cell-item :arrow="false" :value-style="{textAlign: 'left',paddingLeft: '10px'}">
- <view slot="title"><span class="red"></span>收集时间:</view>
- 2021-05-18 12:23:09
- </u-cell-item>
- </u-cell-group>
- <view class="imgupload">
- <u-input v-model="remark" placeholder="请描述异常内容" 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>
- <view class="bottomButton" @click="unusualDo">
- <view>提交</view>
- </view>
- <u-toast ref="uToast" />
- </view>
- </template>
- <script>
- const NET = require('@/utils/request')
- const API = require('@/config/api')
- export default {
- data() {
- return {
- id: "",
- remark: "",
- action: API.uploadFile,
- info: {},
- fileList: [],
- filesList: [],
- isIphone: false,
- imgList: [],
- uploadHeader: {
- Authorization: 'Bearer ' + uni.getStorageSync('token')
- },
- }
- },
- 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
- NET.request(API.getPackageInfo + '/' + options.id, {}).then(res => {
- this.info = res.data
- this.fileList = res.data.packFiles
- }).catch(error => {
- this.$refs.uToast.show({
- title: error.msg,
- type: 'warning',
- })
- })
- },
- onReady() {
- if (this.isIphone) {
- document.getElementsByClassName('mainCont')[0].style.height = document.getElementsByClassName('mainCont')[
- 0].clientHeight - 25 + 'px'
- }
- },
- methods: {
- uploadSuccess(data, index) {
- console.log(data, index)
- if (data.code == 200) {
- data.data[0].fileType = 2
- data.data[0].fileCategory = 3
- data.data[0].packageId = this.id
- this.imgList.push(data.data[0])
- this.$refs.uToast.show({
- title: '上传成功',
- type: 'success',
- })
- } else {
- this.$refs.upload.remove(index)
- this.$refs.uToast.show({
- title: data.msg,
- type: 'warning',
- })
- }
- },
- uploadRemove(index) {
- console.log(index);
- this.imgList.splice(index, 1)
- },
- unusualDo() {
- if (!this.remark) {
- this.$refs.uToast.show({
- title: '请填写异常描述内容',
- type: 'warning',
- })
- return false
- }
- if (!this.imgList.length) {
- this.$refs.uToast.show({
- title: '请上传异常照片',
- type: 'warning',
- })
- return false
- }
- let postData = {
- abnormalRemake: this.remark,
- files: this.imgList,
- id: this.id
- }
- NET.request(API.handleError4Pack, postData, 'POST').then(res => {
- this.$refs.uToast.show({
- title: res.msg,
- type: 'success',
- })
- uni.navigateBack({
- delta: 1
- });
- }).catch(error => {
- this.$refs.uToast.show({
- title: error.msg,
- type: 'warning',
- })
- })
- },
- goBack() {
- uni.navigateBack({
- delta: 1
- });
- },
- }
- }
- </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>
|