grossWeightDetail1.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <template>
  2. <view class="warp">
  3. <view class="content">
  4. <view class="title">
  5. 基本信息
  6. </view>
  7. <view class="row">
  8. <view class="left">仓库</view>
  9. <view class="right">{{detailData.warehouseName}}</view>
  10. </view>
  11. <view class="row">
  12. <view class="left">合同编号</view>
  13. <view class="right">{{detailData.contractNo}}</view>
  14. </view>
  15. <view class="row">
  16. <view class="left">货名</view>
  17. <view class="right">{{detailData.goodsName}}</view>
  18. </view>
  19. <view class="row">
  20. <view class="left">车牌号</view>
  21. <view class="right">{{detailData.qualityInspectionManagement.carNumber}}</view>
  22. </view>
  23. <view class="row">
  24. <view class="left">仓位号</view>
  25. <view class="right">{{detailData.binNumber}}</view>
  26. </view>
  27. <view class="row">
  28. <view class="left">囤位号</view>
  29. <view class="right">{{detailData.storageNumber}}</view>
  30. </view>
  31. <view class="row">
  32. <view class="left">出库类型</view>
  33. <view class="right">{{detailData.inOutType}}</view>
  34. </view>
  35. <view class="row">
  36. <view class="left">货名</view>
  37. <view class="right">{{detailData.goodsName}}</view>
  38. </view>
  39. </view>
  40. <view class="content1">
  41. <view class="title">
  42. 检斤信息
  43. </view>
  44. <view class="row row-bottom">
  45. <view class="left">皮重(公斤)</view>
  46. {{detailData.tare}}
  47. </view>
  48. <view class="row row-bottom">
  49. <view class="left">毛重(公斤)</view>
  50. <input @input='calculate' v-model='detailData.grossWeight' class="right-bottom"
  51. placeholder="输入毛重"></input>
  52. </view>
  53. <view class="row row-bottom" style="border: 0;">
  54. <view class="left">净重(公斤)</view>
  55. <input v-model='detailData.netWeight' class="right-bottom" disabled placeholder="自动计算"></input>
  56. </view>
  57. </view>
  58. <view style="padding-bottom: 300rpx;">
  59. <view class="content2">
  60. <view class="left">上传磅单</view>
  61. <upload class="upload" ref="upload" :action="action" :max-size="maxSize" :max-count="1"
  62. :size-type="['compressed']" @on-success="getImgUrl" @on-error="onError" @on-remove="onRemove"
  63. @on-uploaded="isAdd = true" :before-upload="filterFileType" @on-progress="onProgress"></upload>
  64. </view>
  65. </view>
  66. <u-toast ref="uToast" />
  67. <u-button type="primary" class="submit" @click="submit">提交</u-button>
  68. </view>
  69. </template>
  70. <script>
  71. import upload from '@/components/upload.vue';
  72. export default {
  73. components: {
  74. upload
  75. },
  76. data() {
  77. return {
  78. action: this.$uploadUrl,
  79. maxSize: 50 * 1024 * 1024, //限制文件大小 50M
  80. btnLoading: false, //防止重复点击
  81. isAdd: true,
  82. detailData: {
  83. name: "",
  84. qualityInspectionManagement: {}
  85. }
  86. }
  87. },
  88. onLoad(options) {
  89. this.id = options.id
  90. this.cangId = options.cangId
  91. },
  92. onShow() {
  93. this.getWeighingManagement()
  94. },
  95. methods: {
  96. filterFileType(index, lists) {
  97. if (lists[index].fileType != 'jpg' && lists[index].fileType != 'png' && lists[index].fileType != 'gif') {
  98. lists.splice(index, 1);
  99. // 当前文件不支持
  100. uni.showModal({
  101. title: '暂不支持当前图片类型',
  102. showCancel: false
  103. });
  104. } else {
  105. this.isAdd = false;
  106. }
  107. },
  108. calculate() {
  109. this.detailData.netWeight = (this.detailData.grossWeight - this.detailData.tare).toFixed(3)
  110. },
  111. getImgUrl(res) {
  112. this.detailData.addressUrl = res
  113. console.log(res)
  114. console.log('------------res-----------')
  115. },
  116. onError(error) {
  117. alert(error)
  118. console.log('------------error-----------')
  119. console.log(error)
  120. },
  121. contractNopicker(e) {
  122. this.detailData.goodsName = this.contractNoList[e[0]].goodsName
  123. this.detailData.contractNo = this.contractNoList[e[0]].contractNo
  124. },
  125. binNumberpicker(e) {
  126. this.detailData.binNumber = this.positionList[e[0]].binNumber
  127. },
  128. getWeighingManagement() {
  129. this.$api.doRequest('get', '/weighingManagement/getWeighingManagement', {
  130. id: this.id
  131. }).then(res => {
  132. if (res.data.code == 200) {
  133. console.log(res)
  134. this.detailData = res.data.data
  135. }
  136. })
  137. this.$api.doRequest('get', '/warehouseBaseInfo/getWarehouse', {
  138. id: this.cangId
  139. }).then(res => {
  140. if (res.data.code == 200) {
  141. this.positionList = res.data.data.warehousePositionInfoList
  142. }
  143. })
  144. this.$api.doRequest('get', '/warehouseBaseInfo/selectContractNoList', {
  145. compId: '',
  146. flag: 5
  147. }).then(res => {
  148. if (res.data.code == 200) {
  149. this.contractNoList = res.data.data
  150. }
  151. })
  152. },
  153. onProgress(e) {
  154. console.log(e)
  155. },
  156. onRemove(index) {},
  157. submit() {
  158. if (!this.detailData.grossWeight) {
  159. this.$api.msg('毛重不能为空')
  160. return
  161. }
  162. if (isNaN(this.detailData.grossWeight) ||
  163. (String(this.detailData.grossWeight).indexOf('.') != -1 &&
  164. String(this.detailData.grossWeight).length -
  165. (String(this.detailData.grossWeight).indexOf('.') + 1) >
  166. 1) ||
  167. this.detailData.grossWeight < 1 ||
  168. this.detailData.grossWeight > 100000
  169. ) {
  170. this.$api.msg('毛重输入错误!')
  171. return
  172. }
  173. let that = this
  174. uni.showModal({
  175. content: "确定提交检斤信息?",
  176. success(res) {
  177. if (res.confirm) {
  178. that.$api.doRequest('post', '/weighingManagement/api/editGrossWeight',
  179. that.detailData).then(res => {
  180. if (res.data.code == 200) {
  181. that.$api.msg('提交成功')
  182. uni.navigateBack()
  183. }
  184. })
  185. }
  186. }
  187. })
  188. }
  189. }
  190. }
  191. </script>
  192. <style scoped lang="scss">
  193. uni-page-body {
  194. overflow: hidden;
  195. }
  196. .warp {
  197. margin: 10rpx;
  198. padding: 20rpx 20rpx 140rpx 20rpx;
  199. }
  200. .content,
  201. .content1,
  202. .content2 {
  203. border-radius: 20rpx;
  204. background: white;
  205. padding: 20rpx;
  206. .title {
  207. font-size: 28rpx;
  208. font-weight: 600;
  209. color: #333333;
  210. }
  211. .row {
  212. display: flex;
  213. justify-content: space-between;
  214. padding: 21rpx 0;
  215. .right,
  216. input {
  217. font-size: 28rpx;
  218. color: #333333;
  219. }
  220. }
  221. .row-bottom {
  222. // border: 0;
  223. .right-bottom {
  224. width: 300rpx;
  225. text-align: right;
  226. }
  227. }
  228. }
  229. .content1 {
  230. margin-top: 20rpx;
  231. }
  232. .content2 {
  233. margin-top: 10px;
  234. display: flex;
  235. align-items: center;
  236. .left {
  237. margin-right: 20px;
  238. }
  239. }
  240. .submit {
  241. position: fixed;
  242. bottom: 40rpx;
  243. width: 90%;
  244. background: #22C572;
  245. border-radius: 50rpx;
  246. }
  247. </style>