batchPopu.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <template>
  2. <view>
  3. <uni-popup ref="popup" type="bottom">
  4. <div class="popup">
  5. <div class="popup-top">
  6. <div class="top-left">选择批次号</div>
  7. <div class="top-right">
  8. <button @click="close">关闭</button>
  9. <button @click="comfirm">确定</button>
  10. </div>
  11. </div>
  12. <div class="popup-list">
  13. <radio-group @change="radioChange">
  14. <template v-for="(item, index) in warehouseList">
  15. <label class="list-item">
  16. <view class="item-radio">
  17. <radio :value="index + ''" :checked="index == current" />
  18. </view>
  19. <view class="lable-title">
  20. <label>{{ item.warehouse }}</label>
  21. </view>
  22. </label>
  23. </template>
  24. </radio-group>
  25. </div>
  26. </div>
  27. </uni-popup>
  28. </view>
  29. </template>
  30. <script>
  31. import { get, getJ, post, postJ } from "@/utils/api.js";
  32. import { getByCode } from "@/api/production/extrusion.js";
  33. export default {
  34. props: {},
  35. components: {},
  36. data() {
  37. return {
  38. warehouseList: [],
  39. current: -1,
  40. currentData: {},
  41. };
  42. },
  43. onShow() {},
  44. methods: {
  45. open() {
  46. this.$refs.popup.open("bottom");
  47. this.getList();
  48. },
  49. close() {
  50. this.$refs.popup.close();
  51. },
  52. async getList() {
  53. const data = await getByCode("warehouse");
  54. const list = [];
  55. if (data.length) {
  56. data.map((item, index) => {
  57. for (var key in data[index]) {
  58. list.push({
  59. warehouse: data[index][key],
  60. warehouseId: key,
  61. });
  62. }
  63. });
  64. }
  65. this.warehouseList = list;
  66. },
  67. radioChange(e) {
  68. let value = Number(e.detail.value);
  69. let employeeList = this.warehouseList;
  70. let warehouse = employeeList[value].warehouse;
  71. let warehouseId = employeeList[value].warehouseId;
  72. let data = {
  73. warehouse,
  74. warehouseId,
  75. };
  76. this.currentData = data;
  77. },
  78. comfirm() {
  79. this.close();
  80. this.$emit("checkLocation", this.currentData);
  81. },
  82. },
  83. };
  84. </script>
  85. <style lang="scss" scoped>
  86. .popup {
  87. width: 100%;
  88. height: 600rpx;
  89. background: #fff;
  90. .popup-top {
  91. width: 100%;
  92. display: flex;
  93. align-items: center;
  94. justify-content: space-between;
  95. height: 80rpx;
  96. background: rgba(21, 122, 44, 1);
  97. color: #fff;
  98. .top-left {
  99. font-size: 32rpx;
  100. margin-left: 10rpx;
  101. }
  102. .top-right {
  103. display: flex;
  104. align-items: center;
  105. justify-content: flex-end;
  106. margin-right: 10rpx;
  107. uni-button {
  108. background: rgba(21, 122, 44, 1);
  109. color: #fff;
  110. width: 100rpx;
  111. height: 60rpx;
  112. line-height: 60rpx;
  113. font-size: 28rpx;
  114. padding: 0;
  115. border: 1rpx solid #fff;
  116. margin-left: 20rpx;
  117. }
  118. }
  119. }
  120. .popup-list {
  121. width: 100%;
  122. height: 520rpx;
  123. overflow-y: auto;
  124. background-color: rgba(242, 242, 242, 1);
  125. .list-item {
  126. padding: 0 30rpx;
  127. height: 80rpx;
  128. text-align: center;
  129. line-height: 80rpx;
  130. border-bottom: 1rpx solid #fff;
  131. display: flex;
  132. align-items: center;
  133. justify-content: flex-start;
  134. .item-radio {
  135. margin: 0 16rpx;
  136. }
  137. }
  138. .list-item:last-child {
  139. border: none;
  140. }
  141. .list-item:hover {
  142. background: rgba(254, 64, 102, 0.25);
  143. }
  144. }
  145. }
  146. </style>