index.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. <template>
  2. <view class="inventory-page">
  3. <u-navbar height="40px" title="存货查询" bgColor="#fff" autoBack placeholder>
  4. </u-navbar>
  5. <view class="container_main">
  6. <view class="head-box">
  7. <view class="search-box">
  8. <u-search placeholder="请输入单据编号" shape="square" v-model="searchKey" :showAction="false"></u-search>
  9. <view class="scan-icon flex_box flex_row_center">
  10. <image src="@/static/image/scan-icon-2.png" mode=""></image>
  11. </view>
  12. </view>
  13. <view class="type-box">
  14. <u-tabs
  15. :list="tabList"
  16. :inactiveStyle="{color:'#000',fontSize:'24rpx'}"
  17. :activeStyle="{color:'#000',fontSize:'24rpx'}"
  18. lineColor="#0256FF"
  19. lineWidth="66rpx"
  20. :scrollable="false"
  21. @click="tabClick"
  22. >
  23. </u-tabs>
  24. </view>
  25. </view>
  26. <view class="goods-box">
  27. <view class="goods-type" @click="typeClick">
  28. <view class="goods-type-text">{{typeName}}</view>
  29. <u-icon name="arrow-down-fill" color="#999999" size="10"></u-icon>
  30. </view>
  31. <view class="goods-cont">
  32. <view class="goods-cont-left">
  33. <scroll-view
  34. scroll-y
  35. :style="{height:`calc(100vh - ${scrollH}px - 40px - 24rpx - 102rpx)`}"
  36. >
  37. <view
  38. class="type-item"
  39. :class="item.id == typeId ? 'active-item':''"
  40. v-for="(item,i) in typeList"
  41. :key="i"
  42. @click="chooseType(item)"
  43. >
  44. {{item.name}}
  45. </view>
  46. </scroll-view>
  47. </view>
  48. <view class="goods-cont-right">
  49. <scroll-view scroll-y :style="{height:`calc(100vh - ${scrollH}px - 40px - 24rpx - 102rpx)`}">
  50. <block v-for="(item,i) in goodsList" :key="i">
  51. <good-item :item="item"></good-item>
  52. </block>
  53. </scroll-view>
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. <u-picker :show="typeShow" :defaultIndex="defaultIndex" :columns="columnsList" @confirm="pickerConfirm" @cancel="typeShow= false"></u-picker>
  59. </view>
  60. </template>
  61. <script>
  62. import goodItem from '@/components/good-item/good-item.vue'
  63. export default {
  64. components:{
  65. goodItem
  66. },
  67. data() {
  68. return {
  69. offsetTop: 0,
  70. searchKey: '',
  71. current: 0,
  72. typeShow:false,
  73. defaultIndex:[],
  74. typeName:'按分类展示',
  75. scrollH:0,
  76. columnsList:[
  77. ['按分类展示','按库位展示']
  78. ],
  79. typeId:0,
  80. typeList:[
  81. {
  82. name:'全部',
  83. id:0
  84. },
  85. {
  86. name:'饮料',
  87. id:1
  88. },
  89. {
  90. name:'食品',
  91. id:2
  92. }
  93. ],
  94. tabList: [{
  95. index: 0,
  96. name: '有库存'
  97. },
  98. {
  99. index: 1,
  100. name: '无库存'
  101. },
  102. {
  103. index: 2,
  104. name: '全部'
  105. }
  106. ],
  107. goodsList:[
  108. {
  109. src:'',
  110. name:'大童专用氨基酸洗发水',
  111. },
  112. {
  113. src:'',
  114. name:'大童专用氨基酸洗发水',
  115. },
  116. {
  117. src:'',
  118. name:'大童专用氨基酸洗发水',
  119. },
  120. {
  121. src:'',
  122. name:'大童专用氨基酸洗发水',
  123. },
  124. {
  125. src:'',
  126. name:'大童专用氨基酸洗发水',
  127. }
  128. ]
  129. }
  130. },
  131. mounted() {
  132. let systemInfo = uni.getSystemInfoSync();
  133. let statusBarHeight = systemInfo.statusBarHeight;
  134. let headH = 0;
  135. const query = uni.createSelectorQuery().in(this);
  136. query.select('.head-box').boundingClientRect(rect => {
  137. headH = rect.height
  138. this.scrollH = statusBarHeight + headH
  139. }).exec()
  140. },
  141. onLoad() {
  142. // let systemInfo = uni.getSystemInfoSync();
  143. // let statusBarHeight = systemInfo.statusBarHeight;
  144. // this.offsetTop = statusBarHeight + 40
  145. },
  146. methods: {
  147. tabClick() {
  148. },
  149. typeClick() {
  150. let index = this.columnsList[0].findIndex(item=>item == this.typeName)
  151. this.defaultIndex = [index]
  152. this.typeShow = true
  153. },
  154. pickerConfirm(val) {
  155. this.typeName = val.value[0]
  156. this.typeShow = false
  157. },
  158. chooseType(item) {
  159. this.typeId = item.id
  160. }
  161. }
  162. }
  163. </script>
  164. <style lang="scss" scoped>
  165. .inventory-page {
  166. min-height: 100vh;
  167. background: #F0F6FB;
  168. .container_main {
  169. .head-box {
  170. background-color: #fff;
  171. }
  172. .search-box {
  173. background-color: rgba(191, 200, 219, 0.2);
  174. margin: 0 32rpx;
  175. display: flex;
  176. align-items: center;
  177. justify-content: space-between;
  178. border-radius: 8rpx;
  179. ::v-deep .u-search__content {
  180. background-color: transparent !important;
  181. .u-search__content__input {
  182. background-color: transparent !important;
  183. }
  184. }
  185. .scan-icon {
  186. width: 100rpx;
  187. height: 100%;
  188. image {
  189. width: 40rpx;
  190. height: 40rpx;
  191. }
  192. }
  193. }
  194. .goods-box {
  195. margin-top: 24rpx;
  196. .goods-type {
  197. display: flex;
  198. align-items: center;
  199. padding-left: 24rpx;
  200. height: 102rpx;
  201. background-color: #fff;
  202. &-text {
  203. color: #0256FF;
  204. font-size: 28rpx;
  205. font-weight: bold;
  206. margin-right: 10rpx;
  207. }
  208. }
  209. .goods-cont {
  210. display: flex;
  211. .goods-cont-left {
  212. width: 160rpx;
  213. background-color: #F0F6FB;
  214. .type-item {
  215. width: 100%;
  216. height: 84rpx;
  217. display: flex;
  218. align-items: center;
  219. justify-content: center;
  220. color: #666;
  221. font-family: "PingFang SC";
  222. font-size: 28rpx;
  223. font-weight: 400;
  224. }
  225. .active-item {
  226. background-color: #fff;
  227. color: #333;
  228. font-weight: bold;
  229. }
  230. }
  231. .goods-cont-right {
  232. flex: 1;
  233. background-color: #fff;
  234. }
  235. }
  236. }
  237. }
  238. }
  239. </style>