index.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <template>
  2. <view class="page" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
  3. <cus-header title='库存统计' bgColor='transparent'></cus-header>
  4. <image class="topbg" :src="imgBase+'storage/home_bg.png'" mode="widthFix"></image>
  5. <div class="search">
  6. <u--input
  7. placeholder="请输入商品名称"
  8. border="none"
  9. prefixIcon="search"
  10. prefixIconStyle="font-size: 24px;color: #86909C"
  11. v-model="params.itemName"
  12. ></u--input>
  13. <div class="btn" @tap="search">搜索</div>
  14. </div>
  15. <div class="select">
  16. <div class="left">选择仓库</div>
  17. <div class="right" @tap="selectWarehouse">
  18. <text v-if="warehouseName">{{warehouseName}} ></text>
  19. <div class="tip" v-else>请选择仓库<u-icon name="arrow-right" color="#198CFF" size="32" style="margin-left: 10rpx;"></u-icon></div>
  20. </div>
  21. </div>
  22. <div class="list" :style="{'height':'calc(100vh - '+(mt+125)+'px)'}">
  23. <template v-if="list.length">
  24. <u-list @scrolltolower="scrolltolower">
  25. <u-list-item v-for="(good, index) in list" :key="good.id">
  26. <div class="item">
  27. <div class="title">{{good.item.itemName}}</div>
  28. <div class="info">
  29. <div>
  30. 规格信息:<span v-if="good.itemSku.skuCode">{{good.itemSku.skuCode+'/'}}</span>
  31. <span v-if="good.itemSku.skuName">{{good.itemSku.skuName}}</span>
  32. </div>
  33. <div>库存:<span :class="{'zero':good.quantity=='0'}" style="font-size: 28rpx;font-weight: bold;">{{good.quantity||''}}</span></div>
  34. </div>
  35. </div>
  36. </u-list-item>
  37. </u-list>
  38. </template>
  39. <template v-else>
  40. <page-empty :height="'calc(100vh - 200px)'"></page-empty>
  41. </template>
  42. </div>
  43. <u-picker title="仓库" :show="warehouseShow" :columns="warehouseList" keyName="warehouseName"
  44. @cancel="warehouseShow=false" @confirm="warehouseConfirm">
  45. </u-picker>
  46. </view>
  47. </template>
  48. <script>
  49. import pageEmpty from '@/components/pageEmpty/index.vue'
  50. export default {
  51. components:{ pageEmpty },
  52. data(){
  53. return {
  54. params:{
  55. page:1,
  56. limit:10,
  57. itemName:'',
  58. warehouseId:'',
  59. },
  60. list:[],
  61. warehouseName:'',
  62. warehouseShow:false,
  63. warehouseList:[],
  64. isOver:false
  65. }
  66. },
  67. onLoad() {
  68. this.getList();
  69. },
  70. methods:{
  71. selectWarehouse(){
  72. this.warehouseShow = true;
  73. this.$nextTick(()=>{
  74. this.$api.get('/wms/warehouse/page').then(res=>{
  75. if(res.data.code===0){
  76. this.warehouseList = [res.data.data.list];
  77. }else this.$showToast(res.data.msg)
  78. })
  79. })
  80. },
  81. warehouseConfirm(e){
  82. this.params.warehouseId = e.value[0].id;
  83. this.warehouseName = e.value[0].warehouseName;
  84. this.warehouseShow = false;
  85. this.initList();
  86. },
  87. getList(){
  88. this.$api.get('/wms/inventory/boardList/warehouse',this.params).then(res=>{
  89. if(res.data.code===0){
  90. if(this.list.length<res.data.data.total){
  91. this.params.page++;
  92. this.list = [...this.list,...res.data.data.list];
  93. }else this.isOver = true
  94. }else this.$showModal(res.data.msg)
  95. });
  96. },
  97. search(){
  98. this.initList();
  99. },
  100. initList(){
  101. this.params.page = 1;
  102. this.list = [];
  103. this.isOver = false;
  104. this.getList();
  105. },
  106. scrolltolower(){
  107. if(this.isOver) return
  108. this.getList();
  109. },
  110. }
  111. }
  112. </script>
  113. <style scoped lang="less">
  114. .page{
  115. padding: 0 24rpx 20rpx;
  116. background: #F4F8FB;
  117. box-sizing: border-box;
  118. .topbg{
  119. width: 100%;
  120. position: fixed;
  121. top: 0;
  122. left: 0;
  123. z-index: 0;
  124. }
  125. .search{
  126. width: 100%;
  127. height: 84rpx;
  128. padding: 6rpx 6rpx 6rpx 30rpx;
  129. box-sizing: border-box;
  130. background: #FFFFFF;
  131. border-radius: 40rpx;
  132. border: 1rpx solid #198CFF;
  133. position: relative;
  134. display: flex;
  135. align-items: center;
  136. justify-content: space-between;
  137. .btn{
  138. width: 118rpx;
  139. height: 68rpx;
  140. background: #198CFF;
  141. border-radius: 40rpx;
  142. border: 1rpx solid #198CFF;
  143. font-family: PingFangSC, PingFang SC;
  144. font-weight: 400;
  145. font-size: 28rpx;
  146. color: #FFFFFF;
  147. line-height: 68rpx;
  148. text-align: center;
  149. letter-spacing: 2rpx;
  150. }
  151. }
  152. .select{
  153. width: 100%;
  154. background: #FFFFFF;
  155. border-radius: 16rpx;
  156. padding: 24rpx;
  157. box-sizing: border-box;
  158. display: flex;
  159. align-items: center;
  160. justify-content: space-between;
  161. position: relative;
  162. margin-top: 20rpx;
  163. .left{
  164. font-family: PingFang-SC, PingFang-SC;
  165. font-weight: bold;
  166. font-size: 30rpx;
  167. color: #1D2129;
  168. line-height: 42rpx;
  169. }
  170. .right{
  171. font-family: PingFangSC, PingFang SC;
  172. font-weight: 400;
  173. font-size: 30rpx;
  174. color: #4E5969;
  175. line-height: 42rpx;
  176. text-align: right;
  177. .tip{
  178. display: flex;
  179. align-items: center;
  180. }
  181. }
  182. }
  183. .list{
  184. width: 100%;
  185. margin-top: 20rpx;
  186. background: #FFFFFF;
  187. position: relative;
  188. border-radius: 16rpx 16rpx 0rpx 0rpx;
  189. ::v-deep .u-list{
  190. width: 100%;
  191. height: 100% !important;
  192. }
  193. ::v-deep .u-list-item{
  194. width: 100%;
  195. }
  196. .item{
  197. width: 100%;
  198. padding: 36rpx 24rpx;
  199. box-sizing: border-box;
  200. box-shadow: inset 0rpx -1rpx 0rpx 0rpx #ECECEC;
  201. .title{
  202. font-family: PingFang-SC, PingFang-SC;
  203. font-weight: bold;
  204. font-size: 30rpx;
  205. color: #1D2129;
  206. line-height: 30rpx;
  207. text-align: left;
  208. text-overflow: ellipsis;
  209. overflow: hidden;
  210. white-space: nowrap;
  211. }
  212. .info{
  213. width: 100%;
  214. display: flex;
  215. align-items: center;
  216. justify-content: space-between;
  217. margin-top: 28rpx;
  218. &>div{
  219. font-family: PingFangSC, PingFang SC;
  220. font-weight: 400;
  221. font-size: 24rpx;
  222. color: #86909C;
  223. line-height: 24rpx;
  224. text-align: left;
  225. span{
  226. color: #4E5969;
  227. &.zero{
  228. color: #FA415E;
  229. }
  230. }
  231. }
  232. }
  233. }
  234. }
  235. }
  236. </style>