infor.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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: #FF6600" v-show="info.packState != '2'">待收集</span>
  14. <span style="float: right; color: #00cc00" v-show="info.packState == '2'">转运中</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" v-show="fileList.length || info.packRemake">
  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. <view class="imgupload" v-show="info.packState != '2'">
  52. <u-input v-model="remark" auto-height type="textarea" />
  53. <u-upload :show-progress="false" ref="upload" @on-remove="uploadRemove" @on-success="uploadSuccess"
  54. :header="uploadHeader" max-count="3" width="80px" height="80px" :custom-btn="true" :action="action"
  55. :file-list="filesList">
  56. <view slot="addBtn" class="slot-btn">
  57. <image style="width: 80px;height: 80px" src="/static/tjzp.png" alt="">
  58. </view>
  59. </u-upload>
  60. </view>
  61. <view class="bottomButton" @click="collectDo" v-show="info.packState != '2'">
  62. <view>收集</view>
  63. </view>
  64. </view>
  65. <u-toast ref="uToast" />
  66. </view>
  67. </template>
  68. <script>
  69. const NET = require('@/utils/request')
  70. const API = require('@/config/api')
  71. export default {
  72. data() {
  73. return {
  74. remark: "",
  75. action: API.uploadFile,
  76. fileList: [],
  77. filesList: [],
  78. imgList: [],
  79. id: "",
  80. uploadHeader: {
  81. Authorization: 'Bearer ' + uni.getStorageSync('token')
  82. },
  83. isIphone: false,
  84. info: {},
  85. }
  86. },
  87. onLoad(options) {
  88. uni.getSystemInfo({
  89. success: (res) => {
  90. console.log(res)
  91. if (res.model == 'iPhone') {
  92. this.isIphone = true;
  93. }
  94. },
  95. fail: (err) => {
  96. console.log(err)
  97. }
  98. })
  99. this.id = options.id
  100. this.getInfo()
  101. },
  102. onReady() {
  103. if (this.isIphone) {
  104. document.getElementsByClassName('mainCont')[0].style.height = document.getElementsByClassName('mainCont')[
  105. 0].clientHeight - 25 + 'px'
  106. }
  107. },
  108. methods: {
  109. goBack() {
  110. uni.navigateBack({
  111. delta: 1
  112. });
  113. },
  114. getInfo() {
  115. NET.request(API.getPackageInfo + '/' + this.id, {}).then(res => {
  116. this.info = res.data
  117. this.fileList = res.data.packFiles
  118. }).catch(error => {
  119. this.$refs.uToast.show({
  120. title: error.msg,
  121. type: 'warning',
  122. })
  123. })
  124. },
  125. uploadSuccess(data, index) {
  126. console.log(data, index)
  127. if (data.code == 200) {
  128. data.data[0].fileType = 2
  129. data.data[0].fileCategory = 2
  130. this.imgList.push(data.data[0])
  131. this.$refs.uToast.show({
  132. title: '上传成功',
  133. type: 'success',
  134. })
  135. } else {
  136. this.$refs.upload.remove(index)
  137. }
  138. },
  139. uploadRemove(index) {
  140. console.log(index);
  141. this.imgList.splice(index, 1)
  142. },
  143. collectDo() {
  144. let postData = {
  145. collectRemake: this.remark,
  146. collectFileList: this.imgList
  147. }
  148. NET.request(API.collectRubbishPackage + '/' + this.id, postData, 'POST').then(res => {
  149. this.$refs.uToast.show({
  150. title: '收集成功',
  151. type: 'success',
  152. })
  153. uni.navigateBack({
  154. delta: 1
  155. });
  156. }).catch(error => {
  157. this.$refs.uToast.show({
  158. title: error.msg,
  159. type: 'warning',
  160. })
  161. })
  162. }
  163. }
  164. }
  165. </script>
  166. <style lang="scss">
  167. .mainCont {
  168. height: calc(100% - 80rpx);
  169. padding-bottom: 60px;
  170. overflow-y: scroll;
  171. }
  172. .title {
  173. height: 40px;
  174. line-height: 20px;
  175. padding: 10px;
  176. }
  177. .red {
  178. display: inline-block;
  179. width: 10px;
  180. height: 10px;
  181. color: red;
  182. }
  183. .imgupload {
  184. margin-bottom: 10px;
  185. padding: 10px 25px;
  186. background: #fff;
  187. .imgbox {
  188. img {
  189. width: 80px;
  190. height: 80px;
  191. margin: 10px 10px 10px 0;
  192. }
  193. }
  194. }
  195. /deep/ .u-cell__value {
  196. color: #1c1c1c;
  197. }
  198. </style>