confirmCheck.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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="pcTop">{{ options.batchName }} ({{ options.num }})<span style="float: right">24.5kg</span>
  12. </view>
  13. <u-cell-group style="margin-b<u-icon name="arrow-left"></u-icon>ottom: 10px">
  14. <u-cell-item :arrow="false" :value-style="{textAlign: 'right',paddingLeft: '10px'}">
  15. <view slot="title"><span class="red"></span>收&ensp;集&ensp;人:</view>
  16. {{ options.name }}
  17. </u-cell-item>
  18. <u-cell-item :arrow="false" :value-style="{textAlign: 'right',paddingLeft: '10px'}">
  19. <view slot="title"><span class="red"></span>收集时间:</view>
  20. {{ time }}
  21. </u-cell-item>
  22. <u-cell-item :arrow="false" :value-style="{textAlign: 'right',paddingLeft: '10px'}">
  23. <view slot="title"><span class="red"></span>收集重量:</view>
  24. {{ options.weight }}kg
  25. </u-cell-item>
  26. <u-cell-item :arrow="false" :value-style="{textAlign: 'right',paddingLeft: '10px'}">
  27. <view slot="title"><span class="red"></span>验收重量:</view>
  28. <view style="display: flex;justify-content: space-between;">
  29. <u-input input-align="right" placeholder="重量" v-model="weight" type="number"
  30. style="width: calc(100% - 30px);" />
  31. <span style='width: 30px;line-height: 35px;'>kg</span>
  32. </view>
  33. </u-cell-item>
  34. </u-cell-group>
  35. </view>
  36. <view class="bottomButton" @click="confirmCheck">
  37. <view>确认</view>
  38. </view>
  39. <u-toast ref="uToast" />
  40. </view>
  41. </template>
  42. <script>
  43. const NET = require('@/utils/request')
  44. const API = require('@/config/api')
  45. export default {
  46. data() {
  47. return {
  48. tableList: [{}],
  49. time: "",
  50. options: {},
  51. weight: 0,
  52. isIphone: false,
  53. }
  54. },
  55. onLoad(options) {
  56. uni.getSystemInfo({
  57. success: (res) => {
  58. console.log(res)
  59. if (res.model == 'iPhone') {
  60. this.isIphone = true;
  61. }
  62. },
  63. fail: (err) => {
  64. console.log(err)
  65. }
  66. })
  67. this.options = options
  68. let date = new Date;
  69. //获取年份
  70. let yy = date.getFullYear();
  71. //获取月份
  72. let mm = date.getMonth() + 1;
  73. //如果月份小于10 前面加0
  74. mm = (mm < 10 ? "0" + mm : mm);
  75. let dd = date.getDate();
  76. dd = (dd < 10 ? "0" + dd : dd);
  77. //返回日期
  78. this.time = `${yy}-${mm}-${dd}`
  79. },
  80. onReady() {
  81. if (this.isIphone) {
  82. document.getElementsByClassName('mainCont')[0].style.height = document.getElementsByClassName('mainCont')[
  83. 0].clientHeight - 25 + 'px'
  84. }
  85. },
  86. methods: {
  87. goBack() {
  88. uni.navigateBack({
  89. delta: 1
  90. });
  91. },
  92. confirmCheck() {
  93. if (!this.weight) {
  94. this.$refs.uToast.show({
  95. title: '请填写验收重量',
  96. type: 'warning',
  97. })
  98. return false
  99. }
  100. let postData = {
  101. // id: this.options.id,
  102. weight: this.weight
  103. }
  104. NET.request(API.receiveBatch + '/' + this.options.id, postData).then(res => {
  105. this.$refs.uToast.show({
  106. title: res.msg,
  107. type: 'success',
  108. })
  109. uni.navigateBack({
  110. delta: 2
  111. });
  112. }).catch(error => {
  113. this.$refs.uToast.show({
  114. title: error.msg,
  115. type: 'warning',
  116. })
  117. })
  118. }
  119. }
  120. }
  121. </script>
  122. <style lang="scss">
  123. .mainCont {
  124. height: calc(100% - 80rpx);
  125. padding-bottom: 60px;
  126. overflow-y: scroll;
  127. }
  128. .pcTop {
  129. width: calc(100% - 20px);
  130. padding: 0 10px;
  131. height: 20px;
  132. line-height: 20px;
  133. margin: 0 auto;
  134. margin-top: 10px;
  135. margin-bottom: 10px;
  136. position: relative;
  137. &:after {
  138. content: '';
  139. position: absolute;
  140. height: 20px;
  141. top: 0;
  142. left: 0;
  143. width: 2px;
  144. background-color: #6aa0f7;
  145. }
  146. }
  147. /deep/ .u-cell__value {
  148. color: #1c1c1c;
  149. }
  150. </style>