batchDetails.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. <template>
  2. <view class="mainBox">
  3. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="批次号详情" @clickLeft="back">
  4. <!--右菜单-->
  5. <template slot="float">
  6. <!-- <view class="nav-icon-caozuo rightNav" @click="getsure">
  7. <u-button type="success" size="small" class="u-reset-button" text="选择"></u-button>
  8. </view> -->
  9. </template>
  10. </uni-nav-bar>
  11. <view class="listContent">
  12. <view class="listBox" v-for="(item,index) in listData" :key="index">
  13. <view class="listBox-sel">
  14. <checkbox :value="item.code" color="#fff" :disabled="item.disabled" :checked="item.checked"
  15. @click="selectVal(item,index)" />
  16. </view>
  17. <view class="listBox-con">
  18. <view class="listBox-top">
  19. <view class="listBox-name">
  20. {{item.name}}
  21. </view>
  22. <view class="listBox-code">
  23. {{item.code}}
  24. </view>
  25. </view>
  26. <view class="listBox-bottom">
  27. <view class="bot-left">
  28. 牌号:{{item.mark}}
  29. </view>
  30. <view class="bot-right">
  31. 型号:{{item.model}}
  32. </view>
  33. </view>
  34. <view class="listBox-bottom">
  35. <view class="bot-left">
  36. 批次号:{{item.batchNo}}
  37. </view>
  38. <view class="bot-right">
  39. 重量:{{item.weight}}
  40. </view>
  41. </view>
  42. <view class="listBox-bottom">
  43. <view class="bot-left">
  44. 单位:{{item.init}}
  45. </view>
  46. <view class="bot-right">
  47. 状态:{{item.status}}
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. <view class="footer">
  54. <view class="bottom">
  55. <checkbox v-if="!seletedAll" color="#fff" :checked="seletedAll" @tap="_seletedAll">全选</checkbox>
  56. <checkbox class="select-all" color="#fff" v-else :checked="seletedAll" @tap="_seletedAll">取消全选
  57. </checkbox>
  58. </view>
  59. <u-button type="success" size="small" class="u-reset-button">
  60. <view class="selBtn">
  61. 选择( {{checkListLen}} )
  62. </view>
  63. </u-button>
  64. </view>
  65. </view>
  66. </template>
  67. <script>
  68. let [page, size, isEnd] = [1, 20, true];
  69. export default {
  70. data() {
  71. return {
  72. listData: [{
  73. name: "混炼料1",
  74. code: "TO5636633221653",
  75. mark: "E3888235",
  76. model: "B@3.0",
  77. batchNo: "aaaa",
  78. weight: "60",
  79. init: "kg",
  80. status: "部分出库"
  81. }, {
  82. name: "混炼料1",
  83. code: "TO5636633221653",
  84. mark: "E3888236",
  85. model: "B@3.0",
  86. batchNo: "bbbb",
  87. weight: "70",
  88. init: "kg",
  89. status: "部分出库"
  90. }, {
  91. name: "混炼料1",
  92. code: "TO5636633221653",
  93. mark: "E3888237",
  94. model: "B@3.0",
  95. batchNo: "cccc",
  96. weight: "80",
  97. init: "kg",
  98. status: "部分出库"
  99. }], //列表数据
  100. seletedAll: true, //全选状态
  101. }
  102. },
  103. computed: {
  104. checkListLen() {
  105. const list = this.listData.filter((el) => {
  106. if (el.checked) {
  107. return el
  108. }
  109. })
  110. return list.length
  111. },
  112. },
  113. onReachBottom: function() {
  114. if (isEnd) {
  115. return;
  116. }
  117. // 显示加载图标
  118. uni.showLoading({
  119. title: "数据加载中"
  120. });
  121. this.getInitList();
  122. },
  123. mounted() {
  124. this.getInitList();
  125. },
  126. methods: {
  127. //列表数据
  128. getInitList() {
  129. this.listData.forEach((el) => {
  130. this.$set(el, 'checked', true);
  131. });
  132. },
  133. //全选按钮
  134. _seletedAll() {
  135. if (!this.seletedAll) {
  136. this.seletedAll = true;
  137. this.listData.map(item => {
  138. this.$set(item, 'checked', true)
  139. })
  140. } else {
  141. this.seletedAll = false
  142. //this.checkListLen = 0;
  143. this.listData.map(item => {
  144. this.$set(item, 'checked', false)
  145. })
  146. };
  147. },
  148. }
  149. }
  150. </script>
  151. <style lang="scss" scoped>
  152. .mainBox {
  153. .listContent {
  154. .listBox {
  155. display: flex;
  156. height: 200rpx;
  157. border-bottom: 2rpx solid #e5e5e5;
  158. .listBox-sel {
  159. height: 200rpx;
  160. width: 80rpx;
  161. line-height: 200rpx;
  162. text-align: center;
  163. checkbox {
  164. transform: scale(1.2);
  165. }
  166. }
  167. .listBox-con {
  168. width: 100%;
  169. display: flex;
  170. flex-wrap: wrap;
  171. justify-content: space-between;
  172. align-items: center;
  173. .listBox-top {
  174. width: 100%;
  175. display: flex;
  176. justify-content: space-between;
  177. .listBox-name,
  178. .listBox-code {
  179. display: inline-block;
  180. width: 50%;
  181. }
  182. .listBox-code {
  183. text-align: right;
  184. padding-right: 20rpx;
  185. }
  186. }
  187. .listBox-bottom {
  188. width: 100%;
  189. display: flex;
  190. justify-content: space-between;
  191. .bot-left,
  192. .bot-right {
  193. display: inline-block;
  194. width: 50%;
  195. color: $uni-text-color-grey;
  196. }
  197. .bot-right {
  198. text-align: right;
  199. padding-right: 20rpx;
  200. }
  201. }
  202. }
  203. }
  204. }
  205. .footer {
  206. position: fixed;
  207. display: flex;
  208. justify-content: space-between;
  209. align-items: center;
  210. bottom: 0;
  211. width: 100%;
  212. height: 100rpx;
  213. border-top: 1rpx solid #eeecec;
  214. background-color: #FFFFFF;
  215. z-index: 999;
  216. .bottom {
  217. margin-left: 10rpx;
  218. }
  219. .u-reset-button {
  220. position: absolute;
  221. right: 10rpx;
  222. top: 20rpx;
  223. }
  224. }
  225. }
  226. </style>