goods-pop.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. <template>
  2. <view>
  3. <u-popup :show="goodsShow" @close="closeClick" :round="10">
  4. <view class="goods-box">
  5. <view class="goods-head">
  6. <view class="goods-type" @click="typeClick">
  7. <view class="goods-type-text">{{typeName}}</view>
  8. <u-icon name="arrow-down-fill" color="#999999" size="10"></u-icon>
  9. </view>
  10. <view class="search-box">
  11. <u-search placeholder="分类/条码/名称查找" shape="square" v-model="searchKey" :showAction="false"></u-search>
  12. <view class="scan-icon flex_box flex_row_center">
  13. <image src="@/static/image/scan-icon-2.png" mode=""></image>
  14. </view>
  15. </view>
  16. </view>
  17. <view class="goods-cont">
  18. <view class="goods-cont-left">
  19. <scroll-view class="goods-scroll" scroll-y>
  20. <view
  21. class="type-item"
  22. :class="item.id == typeId ? 'active-item':''"
  23. v-for="(item,i) in typeList"
  24. :key="i"
  25. @click="chooseType(item)"
  26. >
  27. {{item.name}}
  28. </view>
  29. </scroll-view>
  30. </view>
  31. <view class="goods-cont-right">
  32. <scroll-view class="goods-scroll" scroll-y>
  33. <block v-for="(item,i) in goodsList" :key="i">
  34. <good-item :item="item">
  35. <view class="num-box">
  36. <view class="num-box-text" v-if="type == 'caigou'">入库数量</view>
  37. <view class="num-box-text" v-else>出库数量</view>
  38. <u-number-box v-model="item.numberVal">
  39. <view slot="minus" class="minus">
  40. <u-icon name="minus" color="#0256FF" size="12"></u-icon>
  41. </view>
  42. <text slot="input" class="input">{{item.numberVal}}</text>
  43. <view slot="plus" class="plus">
  44. <u-icon name="plus" color="#FFFFFF" size="12"></u-icon>
  45. </view>
  46. </u-number-box>
  47. </view>
  48. </good-item>
  49. </block>
  50. </scroll-view>
  51. </view>
  52. </view>
  53. </view>
  54. </u-popup>
  55. <u-picker class="picler-class" :show="typeShow" :defaultIndex="defaultIndex" :columns="columnsList" @confirm="pickerConfirm" @cancel="typeShow= false"></u-picker>
  56. </view>
  57. </template>
  58. <script>
  59. import goodItem from '@/components/good-item/good-item.vue'
  60. export default{
  61. components:{
  62. goodItem
  63. },
  64. props:{
  65. value:{
  66. type:Boolean,
  67. default:false
  68. },
  69. type:{
  70. type:String,
  71. default:''
  72. }
  73. },
  74. data() {
  75. return {
  76. searchKey:'',
  77. goodsShow:false,
  78. defaultIndex:[],
  79. typeName:'按分类展示',
  80. columnsList:[
  81. ['按分类展示','按库位展示']
  82. ],
  83. typeId:0,
  84. typeList:[
  85. {
  86. name:'全部',
  87. id:0
  88. },
  89. {
  90. name:'饮料',
  91. id:1
  92. },
  93. {
  94. name:'食品',
  95. id:2
  96. }
  97. ],
  98. goodsList: [
  99. {
  100. src: '',
  101. name: '大童专用氨基酸洗发水',
  102. numberVal:1,
  103. }, {
  104. src: '',
  105. name: '大童专用氨基酸洗发水',
  106. numberVal:4,
  107. },{
  108. src: '',
  109. name: '大童专用氨基酸洗发水',
  110. numberVal:0,
  111. }
  112. ],
  113. typeShow:false,
  114. }
  115. },
  116. watch:{
  117. value: {
  118. handler(val) {
  119. this.goodsShow = val
  120. },
  121. immediate:true
  122. }
  123. },
  124. methods:{
  125. closeClick() {
  126. this.$emit('close')
  127. },
  128. confirmClick() {
  129. this.$emit('confirm')
  130. },
  131. typeClick() {
  132. let index = this.columnsList[0].findIndex(item=>item == this.typeName)
  133. this.defaultIndex = [index]
  134. this.typeShow = true
  135. },
  136. tabClick() {
  137. },
  138. pickerConfirm(val) {
  139. this.typeName = val.value[0]
  140. this.typeShow = false
  141. },
  142. chooseType(item) {
  143. this.typeId = item.id
  144. }
  145. }
  146. }
  147. </script>
  148. <style lang="scss" scoped>
  149. .goods-box {
  150. margin-top: 24rpx;
  151. .goods-head {
  152. display: flex;
  153. align-items: center;
  154. .goods-type {
  155. display: flex;
  156. align-items: center;
  157. padding-left: 24rpx;
  158. height: 102rpx;
  159. background-color: #fff;
  160. flex-shrink: 0;
  161. &-text {
  162. color: #0256FF;
  163. font-size: 28rpx;
  164. font-weight: bold;
  165. margin-right: 10rpx;
  166. }
  167. }
  168. .search-box {
  169. background-color: rgba(191, 200, 219, 0.2);
  170. margin: 0 32rpx;
  171. display: flex;
  172. align-items: center;
  173. justify-content: space-between;
  174. border-radius: 8rpx;
  175. ::v-deep .u-search__content {
  176. background-color: transparent !important;
  177. .u-search__content__input {
  178. background-color: transparent !important;
  179. }
  180. }
  181. .scan-icon {
  182. width: 100rpx;
  183. height: 100%;
  184. image {
  185. width: 40rpx;
  186. height: 40rpx;
  187. }
  188. }
  189. }
  190. }
  191. .goods-cont {
  192. display: flex;
  193. .goods-cont-left {
  194. width: 160rpx;
  195. background-color: #F0F6FB;
  196. .type-item {
  197. width: 100%;
  198. height: 84rpx;
  199. display: flex;
  200. align-items: center;
  201. justify-content: center;
  202. color: #666;
  203. font-family: "PingFang SC";
  204. font-size: 28rpx;
  205. font-weight: 400;
  206. }
  207. .active-item {
  208. background-color: #fff;
  209. color: #333;
  210. font-weight: bold;
  211. }
  212. }
  213. .goods-cont-right {
  214. flex: 1;
  215. background-color: #fff;
  216. }
  217. .goods-scroll {
  218. height: 75vh;
  219. }
  220. }
  221. .num-box {
  222. display: flex;
  223. align-items: center;
  224. justify-content: space-between;
  225. padding: 0 48rpx 0 26rpx;
  226. .num-box-text {
  227. color: #666;
  228. font-family: "PingFang SC";
  229. font-size: 28rpx;
  230. font-weight: 400;
  231. }
  232. .input {
  233. width: 112rpx;
  234. text-align: center;
  235. border-bottom: 1px solid #0256FF;
  236. margin: 0 8rpx;
  237. }
  238. .minus {
  239. width: 40rpx;
  240. height: 40rpx;
  241. border-radius: 8rpx;
  242. border: 1px solid #0256FF;
  243. display: flex;
  244. align-items: center;
  245. justify-content: center;
  246. }
  247. .plus {
  248. width: 40rpx;
  249. height: 40rpx;
  250. border-radius: 8rpx;
  251. background-color: #0256FF;
  252. display: flex;
  253. align-items: center;
  254. justify-content: center;
  255. }
  256. }
  257. }
  258. .picler-class {
  259. ::v-deep .u-fade-enter-active {
  260. z-index: 10098!important;
  261. }
  262. ::v-deep .u-slide-up-enter-active {
  263. z-index: 10099!important;
  264. }
  265. }
  266. </style>