tareDetail.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <template>
  2. <view class="warp">
  3. <view class="title">
  4. 基本信息
  5. </view>
  6. <view class="content">
  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.number}}</view>
  14. </view>
  15. <view class="row">
  16. <view class="left">客户</view>
  17. <view class="right">{{detailData.customer}}</view>
  18. </view>
  19. <view class="row">
  20. <view class="left">车牌号</view>
  21. <view class="right">{{detailData.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.goodsName}}</view>
  34. </view>
  35. <view class="row row-bottom">
  36. <view class="left">毛重(公斤)</view>
  37. <view class="right">{{detailData.grossWeight}}</view>
  38. </view>
  39. <view class="row row-bottom">
  40. <view class="left">皮重(公斤)</view>
  41. <input class="right-bottom" placeholder="输入皮重" @input="changeInput" v-model="detailData.tare"></input>
  42. </view>
  43. <view v-if="detailData.qualityInspectionManagement.paramType == '2'" class="row row-bottom">
  44. <view class="left">扣重(公斤)</view>
  45. <input class="right-bottom" placeholder="输入扣重" @input="changeInput"
  46. v-model="detailData.buckleMiscellaneous"></input>
  47. </view>
  48. <view class="row row-bottom" style="border: 0;">
  49. <view class="left">净重(公斤)</view>
  50. <input class="right-bottom" disabled placeholder="自动计算" v-model="detailData.netWeight"></input>
  51. </view>
  52. </view>
  53. <u-button type="primary" class="submit" @click="submit">提交</u-button>
  54. <u-toast ref="uToast" />
  55. </view>
  56. </template>
  57. <script>
  58. export default {
  59. data() {
  60. return {
  61. detailData: {
  62. tare: 0,
  63. buckleMiscellaneous: 0,
  64. qualityInspectionManagement:{}
  65. },
  66. purchasePriceList: []
  67. }
  68. },
  69. onShow() {
  70. this.$api.doRequest('get', '/qualityInspectionManagement/api/goodsName', {
  71. warehouseId: this.detailData.warehouseId
  72. }).then(res => {
  73. if (res.data.code == 200) {
  74. this.purchasePriceList = res.data.data
  75. }
  76. })
  77. },
  78. onLoad(options) {
  79. this.detailData = JSON.parse(options.detailData)
  80. if (!this.detailData.buckleMiscellaneous) {
  81. this.detailData.buckleMiscellaneous = 0
  82. }
  83. },
  84. methods: {
  85. changeInput() {
  86. this.detailData.netWeight = (parseFloat(this.detailData.grossWeight) - parseFloat(this.detailData.tare) -
  87. parseFloat(this.detailData.buckleMiscellaneous)).toFixed(3)
  88. },
  89. submit() {
  90. let that = this;
  91. uni.showModal({
  92. content: "确定提交检斤信息?",
  93. success() {
  94. that.$api.doRequest('get', '/paymentManagement/cumulant', {
  95. compId: JSON.parse(localStorage.getItem('pcUserInfo')).data.compId,
  96. customerNumberCard: that.detailData.customerNumberCard,
  97. goodsName: that.detailData.goodsName,
  98. }).then(res => {
  99. if (res.data.code == 200) {
  100. for (let i = 0; i < that.purchasePriceList.length; i++) {
  101. if (
  102. that.detailData.goodsName == that.purchasePriceList[i]
  103. .goodsName
  104. ) {
  105. let count = (that.purchasePriceList[i].saleLimit -
  106. res.data.data / 1000).toFixed(2)
  107. if (count <= 0) {
  108. count = 0
  109. that.$api.msg('该客户累计销售' + this.detailData.goodsName + (
  110. res.data.data / 1000).toFixed(2) +
  111. '吨,还可售粮' +
  112. count + '吨', )
  113. } else {
  114. that.$api.doRequest('post', '/weighingManagement/api/editTare',
  115. that.detailData).then(res => {
  116. if (res.data.code == 200) {
  117. that.$refs.uToast.show({
  118. title: '提交成功',
  119. type: 'success'
  120. })
  121. uni.navigateBack({})
  122. } else {
  123. that.$refs.uToast.show({
  124. title: '提交失败',
  125. type: 'error',
  126. })
  127. }
  128. })
  129. }
  130. }
  131. }
  132. }
  133. })
  134. }
  135. })
  136. }
  137. }
  138. }
  139. </script>
  140. <style scoped lang="scss">
  141. uni-page-body {
  142. overflow: hidden;
  143. }
  144. .warp {
  145. background: white;
  146. margin: 20rpx;
  147. padding: 20rpx;
  148. border-radius: 20rpx;
  149. .title {
  150. font-size: 28rpx;
  151. font-weight: 500;
  152. color: #333333;
  153. }
  154. }
  155. .content {
  156. .row {
  157. display: flex;
  158. justify-content: space-between;
  159. padding: 21rpx 0;
  160. .right {
  161. font-size: 28rpx;
  162. // font-weight: 600;
  163. color: #333333;
  164. }
  165. }
  166. .row-bottom {
  167. // border: 0;
  168. .right-bottom {
  169. width: 300rpx;
  170. font-size: 28rpx;
  171. font-weight: 600;
  172. color: #333333;
  173. text-align: right;
  174. }
  175. }
  176. }
  177. .submit {
  178. position: fixed;
  179. bottom: 40rpx;
  180. width: 90%;
  181. background: #22C572;
  182. border-radius: 50rpx;
  183. }
  184. </style>