index.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  1. <template>
  2. <view class="mainBox">
  3. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="入库管理" @clickLeft="back">
  4. <!--右菜单-->
  5. <!-- <template slot="float">
  6. <view class="nav-icon-caozuo rightNav" @click="openPopup">
  7. <uni-icons
  8. custom-prefix="iconfont"
  9. type="icon-shaixuan"
  10. size="18"
  11. color="#ccc"
  12. ></uni-icons>
  13. </view>
  14. </template> -->
  15. </uni-nav-bar>
  16. <view class="tab-title">
  17. <view v-for="(item, index) in tabList" :key="index" class="tab-item" v-text="item.label" :class="index === pickTabIndex ? 'active' : ''" @click="changeChartsTab(index)"></view>
  18. <view class="search-icon" @click="searchVisible = true">
  19. 筛选
  20. <image src="~@/static/filter.svg" mode=""></image>
  21. </view>
  22. </view>
  23. <view class="tab-title__placeholder"></view>
  24. <card :list="tableList"></card>
  25. <CommonFooter leftText="新增入库" @leftClick="addStock('hand')" />
  26. <!-- 搜索组件 -->
  27. <u-popup :show="searchVisible" mode="right" @close="searchVisible = false" @open="openSearch">
  28. <view class="search-container">
  29. <view class="title">筛选</view>
  30. <uni-forms ref="customForm" :modelValue="popupInfo" label-position="top">
  31. <uni-forms-item label="入库时间" name="name">
  32. <view class="time-wrapper">
  33. <uni-datetime-picker v-model="popupInfo.range" :border="false" :icon="false" type="daterange" />
  34. </view>
  35. </uni-forms-item>
  36. <uni-forms-item label="入库类型" name="categoryCode">
  37. <uni-data-select v-model="popupInfo.bizType" :localdata="sceneState"></uni-data-select>
  38. </uni-forms-item>
  39. <uni-forms-item label="入库单号" name="sourceBizNo">
  40. <uni-easyinput v-model="popupInfo.sourceBizNo" :inputBorder="false" placeholder="请输入" />
  41. </uni-forms-item>
  42. <uni-forms-item label="物品名称" name="categoryName">
  43. <uni-easyinput v-model="popupInfo.categoryName" :inputBorder="false" placeholder="请输入" />
  44. </uni-forms-item>
  45. <uni-forms-item label="物品编码" name="categoryCode">
  46. <uni-easyinput v-model="popupInfo.categoryCode" :inputBorder="false" placeholder="请输入" />
  47. </uni-forms-item>
  48. </uni-forms>
  49. <view class="footer">
  50. <view class="btn reset" @click="handleReset">重置</view>
  51. <view class="btn search" @click="handleSearch">搜索</view>
  52. </view>
  53. </view>
  54. </u-popup>
  55. </view>
  56. </template>
  57. <script>
  58. import { sceneState } from '../common'
  59. import { getOutInList } from '@/api/warehouseManagement'
  60. import card from './components/card.vue'
  61. import CommonFooter from '.././components/CommonFooter.vue'
  62. export default {
  63. components: {
  64. card,
  65. CommonFooter
  66. },
  67. data() {
  68. return {
  69. sceneState,
  70. page: 1,
  71. size: 10,
  72. isEnd: false,
  73. searchVisible: false,
  74. tabList: [
  75. {
  76. value: '',
  77. label: '全部'
  78. },
  79. {
  80. value: 3,
  81. label: '已驳回'
  82. },
  83. {
  84. value: 2,
  85. label: '审核通过'
  86. },
  87. {
  88. value: 1,
  89. label: '审核中'
  90. },
  91. {
  92. value: 0,
  93. label: '未提交'
  94. }
  95. ],
  96. pickTabIndex: 0,
  97. popupInfo: {
  98. status: '',
  99. range: [],
  100. bizType: '',
  101. sourceBizNo: '',
  102. categoryName: '',
  103. categoryCode: ''
  104. }, //筛选数据
  105. tableList: []
  106. }
  107. },
  108. onShow() {
  109. this.getFirstList()
  110. },
  111. //触底加载
  112. onReachBottom: function () {
  113. if (this.isEnd) {
  114. uni.showToast({
  115. title: '已经没有更多数据了!',
  116. icon: 'none',
  117. duration: 1000 //提示持续时间
  118. })
  119. return
  120. }
  121. // 显示加载图标
  122. uni.showLoading({
  123. title: '数据加载中'
  124. })
  125. this.getMoreLists()
  126. },
  127. methods: {
  128. handleReset() {
  129. this.popupInfo = {
  130. status: '',
  131. range: [],
  132. bizType: '',
  133. sourceBizNo: '',
  134. categoryName: '',
  135. categoryCode: ''
  136. }
  137. this.tableList = []
  138. this.getFirstList()
  139. },
  140. handleSearch() {
  141. this.getFirstList()
  142. },
  143. statusChange(code) {
  144. let index = this.popupInfo.status.indexOf(code)
  145. if (index === -1) {
  146. this.popupInfo.status.push(code)
  147. } else {
  148. this.popupInfo.status.splice(index, 1)
  149. }
  150. },
  151. // 搜索弹窗
  152. openSearch() {
  153. // console.log('open');
  154. },
  155. getFirstList() {
  156. this.page = 1
  157. this.searchVisible = false
  158. this.isEnd = true
  159. uni.showLoading({
  160. title: '数据加载中'
  161. })
  162. this.getList(this.popupInfo)
  163. },
  164. getMoreLists() {
  165. //获取更多数据
  166. this.page++
  167. this.getList(this.popupInfo)
  168. },
  169. //获取列表信息
  170. getList() {
  171. uni.showLoading({
  172. title: '加载中'
  173. })
  174. let data = {
  175. ...this.popupInfo,
  176. pageNum: this.page,
  177. size: this.size,
  178. type: 1
  179. }
  180. if (data.range?.length) {
  181. data.startTime = data.range[0]
  182. data.endTime = data.range[1]
  183. }
  184. delete data.range
  185. getOutInList(data)
  186. .then(res => {
  187. if (this.page === 1) {
  188. this.tableList = res.list
  189. } else {
  190. this.tableList.push(...res.list)
  191. }
  192. this.isEnd = this.tableList.length >= res.count
  193. })
  194. .then(() => {
  195. uni.hideLoading()
  196. })
  197. // get(this.apiUrl + '/outInWarehouse/select/inWarehouse', data)
  198. // .then(res => {
  199. // if (res.success == true) {
  200. // if (page === 1) {
  201. // this.tableList = res.data.records
  202. // } else {
  203. // this.tableList.push(...res.data.records)
  204. // }
  205. // isEnd = this.tableList.length >= res.data.total
  206. // }
  207. // })
  208. // .then(() => {
  209. // uni.hideLoading()
  210. // })
  211. },
  212. //切换tab
  213. changeChartsTab(index) {
  214. this.pickTabIndex = index
  215. this.popupInfo.status = this.tabList[index].value
  216. this.handleSearch()
  217. },
  218. //新增入库单
  219. addStock(type) {
  220. uni.navigateTo({
  221. url: '/pages/warehouse/enterHouse/addStock?type=' + type
  222. })
  223. },
  224. //查看详情
  225. viewDetails(id, code) {
  226. uni.navigateTo({
  227. url: '/pages/warehouse/enterHouse/details?id=' + id + '&code=' + code
  228. })
  229. }
  230. }
  231. }
  232. </script>
  233. <style lang="scss" scoped>
  234. .mainBox {
  235. padding-bottom: 120rpx;
  236. }
  237. .search-container {
  238. width: 70vw;
  239. padding: 30rpx 36rpx;
  240. .footer {
  241. position: absolute;
  242. bottom: 0;
  243. left: 0;
  244. width: 100%;
  245. display: flex;
  246. box-shadow: 0 10rpx 30rpx 0 #000;
  247. .btn {
  248. width: 50%;
  249. height: 80rpx;
  250. border-radius: 0 !important;
  251. flex: 1;
  252. display: flex;
  253. justify-content: center;
  254. align-items: center;
  255. &.reset {
  256. color: $j-primary-border-green;
  257. }
  258. &.search {
  259. color: #fff;
  260. background-color: $j-primary-border-green;
  261. }
  262. }
  263. }
  264. .title {
  265. font-weight: bold;
  266. font-size: 30rpx;
  267. }
  268. .status-wrapper {
  269. display: flex;
  270. align-items: center;
  271. justify-content: space-between;
  272. view {
  273. background-color: rgba(242, 242, 242, 1);
  274. height: 60rpx;
  275. border-radius: 30rpx;
  276. line-height: 60rpx;
  277. text-align: center;
  278. width: 160rpx;
  279. border: 1rpx solid rgba(242, 242, 242, 1);
  280. &.active {
  281. color: #157a2c;
  282. border-color: rgba(21, 122, 44, 1);
  283. }
  284. }
  285. }
  286. /deep/.uni-date {
  287. .uni-icons {
  288. display: none;
  289. }
  290. .uni-date-x {
  291. padding: 0;
  292. view {
  293. margin: 0 20rpx;
  294. }
  295. }
  296. }
  297. /deep/.uni-date__x-input,
  298. /deep/.uni-easyinput__content-input {
  299. height: 60rpx;
  300. border-radius: 30rpx;
  301. overflow: hidden;
  302. background-color: rgba(242, 242, 242, 1);
  303. }
  304. }
  305. .tab-title {
  306. position: fixed;
  307. z-index: 99;
  308. width: 100%;
  309. display: flex;
  310. justify-content: space-between;
  311. align-items: center;
  312. height: $tab-height;
  313. line-height: $tab-height;
  314. background-color: #ffffff;
  315. border-bottom: 1px solid #f2f2f2;
  316. box-sizing: border-box;
  317. .search-icon {
  318. display: flex;
  319. align-items: center;
  320. justify-content: space-around;
  321. font-size: 28rpx;
  322. white-space: nowrap;
  323. margin-left: 10rpx;
  324. image {
  325. width: 30rpx;
  326. height: 30rpx;
  327. }
  328. }
  329. .tab-item {
  330. width: 25%;
  331. text-align: center;
  332. font-size: 32rpx;
  333. color: $uni-text-color-grey;
  334. }
  335. .tab-item.active {
  336. color: $j-primary-border-green;
  337. border-bottom: 1px solid $j-primary-border-green;
  338. font-weight: bold;
  339. }
  340. .tab-item.filter {
  341. flex: 1;
  342. padding: 0px 30rpx;
  343. .uni-icons {
  344. display: flex;
  345. padding-top: 5px;
  346. }
  347. }
  348. }
  349. .listBox {
  350. margin-top: 10px;
  351. padding-top: 5px;
  352. padding-bottom: 8px;
  353. .listTit {
  354. display: flex;
  355. align-items: center;
  356. .stuts {
  357. width: 55px;
  358. font-size: 12px;
  359. // border: 1px solid red;
  360. }
  361. .name {
  362. font-size: $uni-font-size-base;
  363. padding-left: 15rpx;
  364. }
  365. .date {
  366. font-size: $uni-font-size-sm;
  367. padding-left: 45rpx;
  368. color: #999;
  369. }
  370. }
  371. .listCont {
  372. display: flex;
  373. align-items: center;
  374. flex-wrap: wrap;
  375. padding-left: 20rpx;
  376. flex-direction: row;
  377. margin-top: 10rpx;
  378. color: #666;
  379. // border: 1px solid red;
  380. .item {
  381. width: 50%;
  382. font-size: $uni-font-size-sm;
  383. overflow: hidden;
  384. white-space: nowrap;
  385. text-overflow: ellipsis;
  386. -o-text-overflow: ellipsis;
  387. }
  388. .item text {
  389. color: #666;
  390. }
  391. .item-left {
  392. font-size: 20px;
  393. font-weight: 600;
  394. color: #999;
  395. position: relative;
  396. left: 90%;
  397. top: -55rpx;
  398. }
  399. }
  400. .item-top {
  401. height: 5rpx;
  402. width: 96%;
  403. margin: 0 auto;
  404. border-bottom: 1px solid #d8d3d3;
  405. }
  406. .listbtn {
  407. margin-top: 20rpx;
  408. display: flex;
  409. justify-content: flex-end;
  410. align-items: center;
  411. .operBox {
  412. display: flex;
  413. align-items: center;
  414. }
  415. }
  416. .listbtn button {
  417. margin-right: 20rpx;
  418. }
  419. }
  420. </style>