grossWeightDetail1.vue 6.1 KB

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