index.vue 9.8 KB

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