index.vue 9.6 KB

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