infor.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. <template>
  2. <view class="content">
  3. <view class="topbar" v-show="isIphone">
  4. </view>
  5. <view class="status_bar">
  6. <view class="left" @click="goBack"><u-icon name="arrow-left"></u-icon>返回</view>
  7. <span style="font-size: 36rpx;">详情</span>
  8. <view class="right"></view>
  9. </view>
  10. <view class="mainCont">
  11. <view class="title">
  12. {{ info.packCode }}
  13. <span style="float: right; color: #bcbcbc" v-show="info.packState == '4'">已完成</span>
  14. <span style="float: right; color: #2D8CF0" v-show="info.packState == '3'">待验收</span>
  15. </view>
  16. <u-cell-group style="margin-bottom: 10px">
  17. <u-cell-item :arrow="false" :value-style="{textAlign: 'left',paddingLeft: '10px'}">
  18. <view slot="title"><span class="red"></span>科&emsp;&emsp;室:</view>
  19. {{ info.positionName }}
  20. </u-cell-item>
  21. </u-cell-group>
  22. <u-cell-group style="margin-bottom: 10px">
  23. <u-cell-item :arrow="false" :value-style="{textAlign: 'left',paddingLeft: '10px'}">
  24. <view slot="title"><span class="red"></span>分&emsp;&emsp;类:</view>
  25. {{ info.rubbishCategoryStr }}
  26. </u-cell-item>
  27. <u-cell-item :arrow="false" :value-style="{textAlign: 'left',paddingLeft: '10px'}">
  28. <view slot="title"><span class="red"></span>重&emsp;&emsp;量:</view>
  29. {{ info.packWeight }}kg
  30. </u-cell-item>
  31. <u-cell-item :arrow="false" :value-style="{textAlign: 'left',paddingLeft: '10px'}">
  32. <view slot="title"><span class="red"></span>打&ensp;包&ensp;人:</view>
  33. {{ info.createUserName }}
  34. </u-cell-item>
  35. <u-cell-item :arrow="false" :value-style="{textAlign: 'left',paddingLeft: '10px'}">
  36. <view slot="title"><span class="red"></span>打包时间:</view>
  37. {{ info.createTime }}
  38. </u-cell-item>
  39. <u-cell-item :arrow="false" :value-style="{textAlign: 'left',paddingLeft: '10px'}">
  40. <view slot="title"><span class="red"></span>暂&ensp;存&ensp;点:</view>
  41. {{ info.provisionalName }}
  42. </u-cell-item>
  43. </u-cell-group>
  44. <view class="imgupload">
  45. <view>{{ info.packRemake }}</view>
  46. <view class="imgbox">
  47. <img v-for="(item,index) in fileList" :src="item.filePath" alt="">
  48. </view>
  49. <!-- <u-upload :action="action" :file-list="fileList"></u-upload> -->
  50. </view>
  51. <u-cell-group style="margin-bottom: 10px">
  52. <u-cell-item :arrow="false" :value-style="{textAlign: 'left',paddingLeft: '10px'}">
  53. <view slot="title"><span class="red"></span>收&ensp;集&ensp;人:</view>
  54. {{ info.collectUserName }}
  55. </u-cell-item>
  56. <u-cell-item :arrow="false" :value-style="{textAlign: 'left',paddingLeft: '10px'}">
  57. <view slot="title"><span class="red"></span>收集时间:</view>
  58. {{ info.updateTime }}
  59. </u-cell-item>
  60. </u-cell-group>
  61. <u-cell-group style="margin-bottom: 10px" v-show="info.checkUserName">
  62. <u-cell-item :arrow="false" :value-style="{textAlign: 'left',paddingLeft: '10px'}">
  63. <view slot="title"><span class="red"></span>验&ensp;收&ensp;人:</view>
  64. {{ info.checkUserName }}
  65. </u-cell-item>
  66. <u-cell-item :arrow="false" :value-style="{textAlign: 'left',paddingLeft: '10px'}">
  67. <view slot="title"><span class="red"></span>验收时间:</view>
  68. {{ info.checkTime }}
  69. </u-cell-item>
  70. </u-cell-group>
  71. <view class="imgupload" v-show="info.abnormalRemake">
  72. <view>异常内容:{{ info.abnormalRemake }}</view>
  73. <view class="imgbox">
  74. <img v-for="(item,index) in imgList2" :src="item.filePath" alt="">
  75. </view>
  76. <!-- <u-upload :action="action" :file-list="fileList"></u-upload> -->
  77. </view>
  78. <!-- <view class="imgupload" v-show="info.packState != '2'">
  79. <u-input v-model="remark" auto-height type="textarea" />
  80. <u-upload ref="upload" @on-remove="uploadRemove" @on-success="uploadSuccess" :header="uploadHeader"
  81. max-count="3" width="80px" height="80px" :custom-btn="true" :action="action" :file-list="fileList">
  82. <view slot="addBtn" class="slot-btn">
  83. <u-icon name="photo" size="60" :color="$u.color['lightColor']"></u-icon>
  84. </view>
  85. </u-upload>
  86. </view>
  87. <view class="bottomButton" @click="collectDo" v-show="info.packState != '2'">
  88. <view>收集</view>
  89. </view> -->
  90. </view>
  91. <u-toast ref="uToast" />
  92. </view>
  93. </template>
  94. <script>
  95. const NET = require('@/utils/request')
  96. const API = require('@/config/api')
  97. export default {
  98. data() {
  99. return {
  100. remark: "",
  101. action: API.uploadFile,
  102. fileList: [],
  103. imgList: [],
  104. imgList2: [],
  105. id: "",
  106. isIphone: false,
  107. uploadHeader: {
  108. Authorization: 'Bearer ' + uni.getStorageSync('token')
  109. },
  110. info: {},
  111. }
  112. },
  113. onLoad(options) {
  114. uni.getSystemInfo({
  115. success: (res) => {
  116. console.log(res)
  117. if (res.model == 'iPhone') {
  118. this.isIphone = true;
  119. }
  120. },
  121. fail: (err) => {
  122. console.log(err)
  123. }
  124. })
  125. this.id = options.id
  126. NET.request(API.getPackageInfo + '/' + options.id, {}).then(res => {
  127. this.info = res.data
  128. this.fileList = res.data.packFiles.filter(a => a.fileCategory == 1)
  129. this.imgList2 = res.data.packFiles.filter(a => a.fileCategory == 3)
  130. }).catch(error => {
  131. this.$refs.uToast.show({
  132. title: error.msg,
  133. type: 'warning',
  134. })
  135. })
  136. },
  137. onReady() {
  138. if (this.isIphone) {
  139. document.getElementsByClassName('mainCont')[0].style.height = document.getElementsByClassName('mainCont')[
  140. 0].clientHeight - 25 + 'px'
  141. }
  142. },
  143. methods: {
  144. goBack() {
  145. uni.navigateBack({
  146. delta: 1
  147. });
  148. },
  149. uploadSuccess(data, index) {
  150. console.log(data, index)
  151. if (data.code == 200) {
  152. data.data[0].fileType = 2
  153. data.data[0].fileCategory = 2
  154. this.imgList.push(data.data[0])
  155. } else {
  156. this.$refs.upload.remove(index)
  157. }
  158. },
  159. uploadRemove(index) {
  160. console.log(index);
  161. this.imgList.splice(index, 1)
  162. },
  163. collectDo() {
  164. let postData = {
  165. collectRemake: this.remark,
  166. collectFileList: this.imgList
  167. }
  168. NET.request(API.collectRubbishPackage + '/' + this.id, postData, 'POST').then(res => {
  169. this.$refs.uToast.show({
  170. title: '收集成功',
  171. type: 'success',
  172. })
  173. uni.navigateBack({
  174. delta: 1
  175. });
  176. }).catch(error => {
  177. this.$refs.uToast.show({
  178. title: error.msg,
  179. type: 'warning',
  180. })
  181. })
  182. }
  183. }
  184. }
  185. </script>
  186. <style lang="scss">
  187. .mainCont {
  188. height: calc(100% - 80rpx);
  189. padding-bottom: 60px;
  190. overflow-y: scroll;
  191. }
  192. .title {
  193. height: 40px;
  194. line-height: 20px;
  195. padding: 10px;
  196. }
  197. .red {
  198. display: inline-block;
  199. width: 10px;
  200. height: 10px;
  201. color: red;
  202. }
  203. .imgupload {
  204. margin-bottom: 10px;
  205. padding: 10px 25px;
  206. background: #fff;
  207. .imgbox {
  208. img {
  209. width: 80px;
  210. height: 80px;
  211. margin: 10px 10px 10px 0;
  212. }
  213. }
  214. }
  215. .slot-btn {
  216. width: 80px;
  217. height: 80px;
  218. display: flex;
  219. justify-content: center;
  220. align-items: center;
  221. border: 1px solid #c0c4cc;
  222. border-radius: 5px;
  223. }
  224. /deep/ .u-cell__value {
  225. color: #1c1c1c;
  226. }
  227. </style>