locationPopu.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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. components: {
  35. },
  36. data () {
  37. return {
  38. warehouseList:[],
  39. current: -1,
  40. currentData:{}
  41. }
  42. },
  43. onShow () {
  44. },
  45. methods: {
  46. open() {
  47. this.$refs.popup.open('bottom')
  48. this.getList()
  49. },
  50. close() {
  51. this.$refs.popup.close()
  52. },
  53. async getList(){
  54. const data = await getByCode('warehouse')
  55. const list = []
  56. if(data.length){
  57. data.map((item,index)=>{
  58. for(var key in data[index]){
  59. list.push({
  60. warehouse:data[index][key],
  61. warehouseId:key
  62. })
  63. }
  64. })
  65. }
  66. this.warehouseList = list
  67. },
  68. radioChange (e) {
  69. let value = Number(e.detail.value)
  70. let employeeList = this.warehouseList
  71. let warehouse = employeeList[value].warehouse
  72. let warehouseId = employeeList[value].warehouseId
  73. let data = {
  74. warehouse,
  75. warehouseId
  76. }
  77. this.currentData = data
  78. },
  79. comfirm(){
  80. this.close()
  81. this.$emit('checkLocation', this.currentData)
  82. }
  83. }
  84. }
  85. </script>
  86. <style lang="scss" scoped>
  87. .popup{
  88. width: 100%;
  89. height: 600rpx;
  90. background: #fff;
  91. .popup-top{
  92. width: 100%;
  93. display: flex;
  94. align-items: center;
  95. justify-content: space-between;
  96. height: 80rpx;
  97. background: rgba(21, 122, 44, 1);
  98. color: #fff;
  99. .top-left{
  100. font-size: 32rpx;
  101. margin-left: 10rpx;
  102. }
  103. .top-right{
  104. display: flex;
  105. align-items: center;
  106. justify-content: flex-end;
  107. margin-right: 10rpx;
  108. uni-button{
  109. background: rgba(21, 122, 44, 1);
  110. color: #fff;
  111. width: 100rpx;
  112. height: 60rpx;
  113. line-height: 60rpx;
  114. font-size: 28rpx;
  115. padding: 0;
  116. border: 1rpx solid #fff;
  117. margin-left: 20rpx;
  118. }
  119. }
  120. }
  121. .popup-list{
  122. width: 100%;
  123. height: 520rpx;
  124. overflow-y: auto;
  125. background-color: rgba(242, 242, 242, 1);
  126. .list-item{
  127. padding: 0 30rpx;
  128. height: 80rpx;
  129. text-align: center;
  130. line-height: 80rpx;
  131. border-bottom: 1rpx solid #fff;
  132. display: flex;
  133. align-items: center;
  134. justify-content:flex-start;
  135. .item-radio{
  136. margin: 0 16rpx;
  137. }
  138. }
  139. .list-item:last-child{
  140. border: none;
  141. }
  142. .list-item:hover{
  143. background: rgba(254,64,102,.25)
  144. }
  145. }
  146. }
  147. </style>