index.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  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="type">
  16. <template v-if="typeList.length">
  17. <div class="pre" v-for="(item,index) in typeList" :key="index" :style="{'width':'calc(100% / '+typeList.length+')'}"
  18. @tap="changeType(item.dictValue)" :class="{'active':params.orderType===item.dictValue}">
  19. {{item.dictLabel}}
  20. </div>
  21. </template>
  22. </div>
  23. <div class="select">
  24. <div class="left">选择仓库</div>
  25. <div class="right" @tap="selectWarehouse">
  26. <text v-if="warehouseName">{{warehouseName}} ></text>
  27. <div class="tip" v-else>请选择仓库<u-icon name="arrow-right" color="#198CFF" size="32" style="margin-left: 10rpx;"></u-icon></div>
  28. </div>
  29. </div>
  30. <div class="list" :style="{'height':'calc(100vh - '+(mt+175)+'px)'}">
  31. <template v-if="list.length">
  32. <u-list @scrolltolower="scrolltolower">
  33. <u-list-item v-for="(good, index) in list" :key="good.id">
  34. <div class="item">
  35. <div class="top">
  36. <div class="name">{{good.item.itemName}}</div>
  37. <div class="ktype" @tap="toDetail(good.id)">
  38. <div class="box" :class="typeClass[good.orderType]||'mr'">{{typeCfg[good.orderType]||''}}</div>
  39. <span><u-icon name="arrow-right" color="#86909C" size="32"></u-icon></span>
  40. </div>
  41. </div>
  42. <div class="info">
  43. <div class="iitem">
  44. <div class="pre pre1">
  45. 操作时间:<span>{{good.createDate||''}}</span>
  46. </div>
  47. <div class="pre">
  48. 数量:<span class="jc"><span v-if="good.quantity>0">+</span>{{good.quantity||0}}</span>
  49. </div>
  50. </div>
  51. <div class="iitem">
  52. <div class="pre pre1">
  53. 操作前:<span class="jc">{{good.beforeQuantity||0}}</span>
  54. </div>
  55. <div class="pre">
  56. 操作后:<span class="jc">{{good.afterQuantity||0}}</span>
  57. </div>
  58. </div>
  59. <div class="iitem">
  60. <div class="pre pre1">
  61. 规格信息:<span v-if="good.itemSku.skuCode">{{good.itemSku.skuCode+'/'}}</span>
  62. <span v-if="good.itemSku.skuName">{{good.itemSku.skuName||''}}</span>
  63. </div>
  64. </div>
  65. </div>
  66. </div>
  67. </u-list-item>
  68. </u-list>
  69. </template>
  70. <template v-else>
  71. <page-empty :height="'calc(100vh - 200px)'"></page-empty>
  72. </template>
  73. </div>
  74. <u-picker title="仓库" :show="warehouseShow" :columns="warehouseList" keyName="warehouseName"
  75. @cancel="warehouseShow=false" @confirm="warehouseConfirm">
  76. </u-picker>
  77. </view>
  78. </template>
  79. <script>
  80. export default {
  81. data(){
  82. return {
  83. params:{
  84. page:1,
  85. limit:10,
  86. orderType:'',
  87. itemName:'',
  88. warehouseId:'',
  89. },
  90. typeList:[],
  91. typeCfg:{},
  92. typeClass:{
  93. 1:'rk',
  94. 2:'ck',
  95. 3:'yk',
  96. 4:'pk'
  97. },
  98. list:[],
  99. warehouseName:'',
  100. warehouseShow:false,
  101. warehouseList:[],
  102. isOver:false
  103. }
  104. },
  105. async onLoad() {
  106. await this.getStorageType();
  107. this.getList();
  108. },
  109. methods:{
  110. async getStorageType(){
  111. let res = await this.$api.get('/sys/dict/data/getListByType/wms_inventory_history_type');
  112. if(res.data.code===0){
  113. this.typeList = res.data.data;
  114. res.data.data.forEach(d=>{
  115. this.typeCfg[d.dictValue] = d.dictLabel;
  116. })
  117. this.typeList.unshift({dictValue:'',dictLabel:'全部'})
  118. }else this.$showToast(res.data.msg)
  119. },
  120. changeType(type){
  121. this.params.orderType = type;
  122. this.initList();
  123. },
  124. initList(){
  125. this.params.page = 1;
  126. this.list = [];
  127. this.isOver = false;
  128. this.getList();
  129. },
  130. selectWarehouse(){
  131. this.warehouseShow = true;
  132. this.$nextTick(()=>{
  133. this.$api.get('/wms/warehouse/page').then(res=>{
  134. if(res.data.code===0){
  135. this.warehouseList = [res.data.data.list];
  136. }else this.$showToast(res.data.msg)
  137. })
  138. })
  139. },
  140. warehouseConfirm(e){
  141. this.params.warehouseId = e.value[0].id;
  142. this.warehouseName = e.value[0].warehouseName;
  143. this.warehouseShow = false;
  144. this.initList();
  145. },
  146. getList(){
  147. this.$api.get('/wms/inventoryhistory/page',this.params).then(res=>{
  148. if(res.data.code===0){
  149. if(this.list.length<res.data.data.total){
  150. this.params.page++;
  151. this.list = [...this.list,...res.data.data.list];
  152. }else this.isOver = true
  153. }else this.$showModal(res.data.msg)
  154. });
  155. },
  156. search(){
  157. this.initList();
  158. },
  159. initList(){
  160. this.params.page = 1;
  161. this.list = [];
  162. this.getList();
  163. },
  164. scrolltolower(){
  165. if(this.isOver) return
  166. this.getList();
  167. },
  168. toDetail(id){
  169. uni.navigateTo({
  170. url:'/pagesStorage/storageRecord/detail?id='+id
  171. })
  172. }
  173. }
  174. }
  175. </script>
  176. <style scoped lang="less">
  177. .page{
  178. padding: 0 24rpx 20rpx;
  179. background: #F4F8FB;
  180. box-sizing: border-box;
  181. .topbg{
  182. width: 100%;
  183. position: fixed;
  184. top: 0;
  185. left: 0;
  186. z-index: 0;
  187. }
  188. .search{
  189. width: 100%;
  190. height: 84rpx;
  191. padding: 6rpx 6rpx 6rpx 30rpx;
  192. box-sizing: border-box;
  193. background: #FFFFFF;
  194. border-radius: 40rpx;
  195. border: 1rpx solid #198CFF;
  196. position: relative;
  197. display: flex;
  198. align-items: center;
  199. justify-content: space-between;
  200. .btn{
  201. width: 118rpx;
  202. height: 68rpx;
  203. background: #198CFF;
  204. border-radius: 40rpx;
  205. border: 1rpx solid #198CFF;
  206. font-family: PingFangSC, PingFang SC;
  207. font-weight: 400;
  208. font-size: 28rpx;
  209. color: #FFFFFF;
  210. line-height: 68rpx;
  211. text-align: center;
  212. letter-spacing: 2rpx;
  213. }
  214. }
  215. .type{
  216. width: 100%;
  217. height: 80rpx;
  218. background: #FFFFFF;
  219. border-radius: 16rpx;
  220. display: flex;
  221. position: relative;
  222. margin-top: 20rpx;
  223. .pre{
  224. height: 100%;
  225. position: relative;
  226. display: flex;
  227. align-items: center;
  228. justify-content: center;
  229. font-family: PingFangSC, PingFang SC;
  230. font-weight: 400;
  231. font-size: 28rpx;
  232. color: #1D2129;
  233. &.active{
  234. font-weight: bold;
  235. font-size: 32rpx;
  236. color: #198CFF;
  237. &::after{
  238. content: '';
  239. width: 40rpx;
  240. height: 6rpx;
  241. background: #198CFF;
  242. border-radius: 3rpx;
  243. position: absolute;
  244. left: 50%;
  245. margin-left: -20rpx;
  246. bottom: 3rpx;
  247. }
  248. }
  249. }
  250. }
  251. .select{
  252. width: 100%;
  253. background: #FFFFFF;
  254. border-radius: 16rpx;
  255. padding: 24rpx;
  256. box-sizing: border-box;
  257. display: flex;
  258. align-items: center;
  259. justify-content: space-between;
  260. position: relative;
  261. margin-top: 20rpx;
  262. .left{
  263. font-family: PingFang-SC, PingFang-SC;
  264. font-weight: bold;
  265. font-size: 30rpx;
  266. color: #1D2129;
  267. line-height: 42rpx;
  268. }
  269. .right{
  270. font-family: PingFangSC, PingFang SC;
  271. font-weight: 400;
  272. font-size: 30rpx;
  273. color: #4E5969;
  274. line-height: 42rpx;
  275. text-align: right;
  276. .tip{
  277. display: flex;
  278. align-items: center;
  279. }
  280. }
  281. }
  282. .list{
  283. width: 100%;
  284. padding: 0 24rpx;
  285. box-sizing: border-box;
  286. margin-top: 20rpx;
  287. background: #FFFFFF;
  288. position: relative;
  289. border-radius: 16rpx 16rpx 0rpx 0rpx;
  290. ::v-deep .u-list{
  291. width: 100%;
  292. height: 100% !important;
  293. }
  294. ::v-deep .u-list-item{
  295. width: 100%;
  296. }
  297. .item{
  298. width: 100%;
  299. padding: 36rpx 0;
  300. box-sizing: border-box;
  301. box-shadow: inset 0rpx -1rpx 0rpx 0rpx #ECECEC;
  302. .top{
  303. width: 100%;
  304. display: flex;
  305. align-items: center;
  306. justify-content: space-between;
  307. .name{
  308. font-family: PingFang-SC, PingFang-SC;
  309. font-weight: bold;
  310. font-size: 30rpx;
  311. color: #1D2129;
  312. line-height: 30rpx;
  313. text-align: left;
  314. }
  315. .ktype{
  316. display: flex;
  317. align-items: center;
  318. .box{
  319. height: 40rpx;
  320. border-radius: 6rpx;
  321. padding: 0 12rpx;
  322. font-family: PingFangSC, PingFang SC;
  323. font-weight: 400;
  324. font-size: 24rpx;
  325. color: #FFFFFF;
  326. line-height: 40rpx;
  327. &.rk{
  328. background: #14CC8C;
  329. }
  330. &.ck{
  331. background: #FF817C;
  332. }
  333. &.yk{
  334. background: #FEA34C;
  335. }
  336. &.pk{
  337. background: #98A1FE;
  338. }
  339. &.mr{
  340. background: lightgray;
  341. }
  342. }
  343. span{
  344. font-size: 36rpx;
  345. color: #86909C;
  346. margin-left: 23rpx;
  347. }
  348. }
  349. }
  350. .info{
  351. width: 100%;
  352. .iitem{
  353. width: 100%;
  354. display: flex;
  355. .pre{
  356. margin-top: 24rpx;
  357. width: 250rpx;
  358. font-family: PingFangSC, PingFang SC;
  359. font-weight: 400;
  360. font-size: 24rpx;
  361. color: #86909C;
  362. line-height: 24rpx;
  363. text-align: right;
  364. padding-right: 40rpx;
  365. span{
  366. color: #4E5969;
  367. &.jc{
  368. font-weight: bold;
  369. font-size: 26rpx;
  370. }
  371. }
  372. &.pre1{
  373. width: calc(100% - 250rpx);
  374. text-align: left;
  375. padding-right: 0;
  376. }
  377. }
  378. }
  379. }
  380. }
  381. }
  382. }
  383. </style>