selectSupplies.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <template>
  2. <!-- 选择物料信息 -->
  3. <view class="assign-container">
  4. <u-popup :show="popShow" @close="close">
  5. <view class="main">
  6. <uni-search-bar
  7. @confirm="search"
  8. v-model="searchKey"
  9. @input="search"
  10. cancelButton="none"
  11. placeholder="名称/编码"
  12. >
  13. </uni-search-bar>
  14. <view class="order-list-wrap">
  15. <view
  16. class="order-list"
  17. :class="{ active: index === current }"
  18. v-for="(item, index) in dataList"
  19. :key="index"
  20. @click="handlCurrent(index)"
  21. >
  22. <view class="s1">
  23. <view class="b1"> {{ item.informationName }} </view>
  24. <view class="b2"> </view>
  25. </view>
  26. <view class="wrap">
  27. <view class="item">
  28. <view class="label"> 编码 </view>
  29. <view class="value">
  30. {{ item.informationCode }}
  31. </view>
  32. </view>
  33. </view>
  34. <view class="wrap">
  35. <view class="item" style="width: 100%">
  36. <view class="label">类型</view>
  37. <view class="value">
  38. {{ item.classificationUrl }}
  39. </view>
  40. </view>
  41. </view>
  42. <view class="wrap">
  43. <view class="item">
  44. <view class="label"> 牌号 </view>
  45. <view class="value">
  46. {{ item.brandNum }}
  47. </view>
  48. </view>
  49. <view class="item">
  50. <view class="label"> 型号 </view>
  51. <view class="value">
  52. {{ item.modelType }}
  53. </view>
  54. </view>
  55. </view>
  56. <view class="wrap">
  57. <view class="item">
  58. <view class="label"> 单位 </view>
  59. <view class="value">
  60. {{ item.measuringUnit }} / {{ item.packingUnit }}
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. </view>
  66. <view class="fixed-bottom">
  67. <view class="item" @click="close"> 取消 </view>
  68. <view class="item s1" @click="confirm"> 确定 </view>
  69. </view>
  70. </view>
  71. </u-popup>
  72. </view>
  73. </template>
  74. <script>
  75. import { get, post } from '@/utils/api.js'
  76. import _ from 'lodash'
  77. import { mapGetters, mapActions } from 'vuex'
  78. export default {
  79. props: {
  80. classificationIds: [String, Number]
  81. },
  82. data () {
  83. return {
  84. popShow: false,
  85. searchKey: '',
  86. dataList: [],
  87. current: ''
  88. }
  89. },
  90. created () {
  91. this.search = _.debounce(this.search, 1000)
  92. },
  93. computed: {
  94. ...mapGetters(['getDictValue'])
  95. },
  96. methods: {
  97. open () {
  98. this.popShow = true
  99. this.getData()
  100. },
  101. close () {
  102. this.popShow = false
  103. // 重置
  104. this.current = ''
  105. },
  106. handlCurrent (index) {
  107. this.current = index
  108. },
  109. search (e) {
  110. this.getData()
  111. },
  112. confirm () {
  113. if (this.current === '') {
  114. uni.showToast({
  115. title: '请选择物料信息',
  116. icon: 'none'
  117. })
  118. return
  119. }
  120. let item = this.dataList[this.current]
  121. this.$emit('succeed', {
  122. data: item
  123. })
  124. this.close()
  125. },
  126. getData () {
  127. let par = {
  128. classificationIds: [this.classificationIds],
  129. searchKey: this.searchKey,
  130. page: 1,
  131. size: 999
  132. }
  133. par = this.URLSearchParams(par)
  134. get(this.apiUrl + '/asset/get/goods/page?' + par).then(res => {
  135. if (res.success) {
  136. console.log(res)
  137. this.dataList = res.data.records
  138. }
  139. })
  140. }
  141. }
  142. }
  143. </script>
  144. <style lang="scss" scoped>
  145. .main {
  146. padding: 20rpx 0 0;
  147. position: relative;
  148. }
  149. .fixed-bottom {
  150. margin-top: 20rpx;
  151. background-color: #fff;
  152. width: 100%;
  153. box-sizing: border-box;
  154. display: flex;
  155. border: 1px solid #157a2c;
  156. .item {
  157. flex: 1;
  158. display: flex;
  159. justify-content: center;
  160. align-items: center;
  161. height: 80rpx;
  162. font-size: 28rpx;
  163. color: #333;
  164. &.s1 {
  165. background-color: #157a2c;
  166. color: #fff;
  167. }
  168. }
  169. }
  170. .order-list-wrap {
  171. height: 800rpx;
  172. overflow-y: auto;
  173. .order-list {
  174. padding: 30rpx 20rpx;
  175. border-bottom: 1px solid #f2f2f2;
  176. position: relative;
  177. &.active {
  178. background-color: #caf982;
  179. }
  180. .s1 {
  181. display: flex;
  182. justify-content: space-between;
  183. align-items: center;
  184. .b1 {
  185. color: #555555;
  186. font-size: 30rpx;
  187. }
  188. .b2 {
  189. color: #000000;
  190. font-size: 28rpx;
  191. }
  192. }
  193. .wrap {
  194. display: flex;
  195. margin-top: 20rpx;
  196. .item {
  197. color: #555555;
  198. font-size: 28rpx;
  199. display: flex;
  200. width: 340rpx;
  201. .label {
  202. margin-right: 20rpx;
  203. }
  204. }
  205. }
  206. }
  207. }
  208. </style>