index.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437
  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.pickTabIndex = 0
  138. this.tableList = []
  139. this.getFirstList()
  140. },
  141. handleSearch() {
  142. this.getFirstList()
  143. },
  144. statusChange(code) {
  145. let index = this.popupInfo.status.indexOf(code)
  146. if (index === -1) {
  147. this.popupInfo.status.push(code)
  148. } else {
  149. this.popupInfo.status.splice(index, 1)
  150. }
  151. },
  152. // 搜索弹窗
  153. openSearch() {
  154. // console.log('open');
  155. },
  156. getFirstList() {
  157. this.page = 1
  158. this.searchVisible = false
  159. this.isEnd = true
  160. uni.showLoading({
  161. title: '数据加载中'
  162. })
  163. this.getList(this.popupInfo)
  164. },
  165. getMoreLists() {
  166. //获取更多数据
  167. this.page++
  168. this.getList(this.popupInfo)
  169. },
  170. //获取列表信息
  171. getList() {
  172. uni.showLoading({
  173. title: '加载中'
  174. })
  175. let data = {
  176. ...this.popupInfo,
  177. pageNum: this.page,
  178. size: this.size,
  179. type: 1
  180. }
  181. if (data.range?.length) {
  182. data.startTime = data.range[0]
  183. data.endTime = data.range[1]
  184. }
  185. delete data.range
  186. getOutInList(data)
  187. .then(res => {
  188. if (this.page === 1) {
  189. this.tableList = res.list
  190. } else {
  191. this.tableList.push(...res.list)
  192. }
  193. this.isEnd = this.tableList.length >= res.count
  194. })
  195. .then(() => {
  196. uni.hideLoading()
  197. })
  198. // get(this.apiUrl + '/outInWarehouse/select/inWarehouse', data)
  199. // .then(res => {
  200. // if (res.success == true) {
  201. // if (page === 1) {
  202. // this.tableList = res.data.records
  203. // } else {
  204. // this.tableList.push(...res.data.records)
  205. // }
  206. // isEnd = this.tableList.length >= res.data.total
  207. // }
  208. // })
  209. // .then(() => {
  210. // uni.hideLoading()
  211. // })
  212. },
  213. //切换tab
  214. changeChartsTab(index) {
  215. this.pickTabIndex = index
  216. this.popupInfo.status = this.tabList[index].value
  217. this.handleSearch()
  218. },
  219. //新增入库单
  220. addStock(type) {
  221. uni.navigateTo({
  222. url: '/pages/warehouse/enterHouse/addStock?type=' + type
  223. })
  224. },
  225. //查看详情
  226. viewDetails(id, code) {
  227. uni.navigateTo({
  228. url: '/pages/warehouse/enterHouse/details?id=' + id + '&code=' + code
  229. })
  230. }
  231. }
  232. }
  233. </script>
  234. <style lang="scss" scoped>
  235. .mainBox {
  236. padding-bottom: 120rpx;
  237. }
  238. .search-container {
  239. width: 70vw;
  240. padding: 30rpx 36rpx;
  241. .footer {
  242. position: absolute;
  243. bottom: 0;
  244. left: 0;
  245. width: 100%;
  246. display: flex;
  247. box-shadow: 0 10rpx 30rpx 0 #000;
  248. .btn {
  249. width: 50%;
  250. height: 80rpx;
  251. border-radius: 0 !important;
  252. flex: 1;
  253. display: flex;
  254. justify-content: center;
  255. align-items: center;
  256. &.reset {
  257. color: $j-primary-border-green;
  258. }
  259. &.search {
  260. color: #fff;
  261. background-color: $j-primary-border-green;
  262. }
  263. }
  264. }
  265. .title {
  266. font-weight: bold;
  267. font-size: 30rpx;
  268. }
  269. .status-wrapper {
  270. display: flex;
  271. align-items: center;
  272. justify-content: space-between;
  273. view {
  274. background-color: rgba(242, 242, 242, 1);
  275. height: 60rpx;
  276. border-radius: 30rpx;
  277. line-height: 60rpx;
  278. text-align: center;
  279. width: 160rpx;
  280. border: 1rpx solid rgba(242, 242, 242, 1);
  281. &.active {
  282. color: #157a2c;
  283. border-color: rgba(21, 122, 44, 1);
  284. }
  285. }
  286. }
  287. /deep/.uni-date {
  288. .uni-icons {
  289. display: none;
  290. }
  291. .uni-date-x {
  292. padding: 0;
  293. view {
  294. margin: 0 20rpx;
  295. }
  296. }
  297. }
  298. /deep/.uni-date__x-input,
  299. /deep/.uni-easyinput__content-input {
  300. height: 60rpx;
  301. border-radius: 30rpx;
  302. overflow: hidden;
  303. background-color: rgba(242, 242, 242, 1);
  304. }
  305. }
  306. .tab-title {
  307. position: fixed;
  308. z-index: 99;
  309. width: 100%;
  310. display: flex;
  311. justify-content: space-between;
  312. align-items: center;
  313. height: $tab-height;
  314. line-height: $tab-height;
  315. background-color: #ffffff;
  316. border-bottom: 1px solid #f2f2f2;
  317. box-sizing: border-box;
  318. .search-icon {
  319. display: flex;
  320. align-items: center;
  321. justify-content: space-around;
  322. font-size: 28rpx;
  323. white-space: nowrap;
  324. margin-left: 10rpx;
  325. image {
  326. width: 30rpx;
  327. height: 30rpx;
  328. }
  329. }
  330. .tab-item {
  331. width: 25%;
  332. text-align: center;
  333. font-size: 32rpx;
  334. color: $uni-text-color-grey;
  335. }
  336. .tab-item.active {
  337. color: $j-primary-border-green;
  338. border-bottom: 1px solid $j-primary-border-green;
  339. font-weight: bold;
  340. }
  341. .tab-item.filter {
  342. flex: 1;
  343. padding: 0px 30rpx;
  344. .uni-icons {
  345. display: flex;
  346. padding-top: 5px;
  347. }
  348. }
  349. }
  350. .listBox {
  351. margin-top: 10px;
  352. padding-top: 5px;
  353. padding-bottom: 8px;
  354. .listTit {
  355. display: flex;
  356. align-items: center;
  357. .stuts {
  358. width: 55px;
  359. font-size: 12px;
  360. // border: 1px solid red;
  361. }
  362. .name {
  363. font-size: $uni-font-size-base;
  364. padding-left: 15rpx;
  365. }
  366. .date {
  367. font-size: $uni-font-size-sm;
  368. padding-left: 45rpx;
  369. color: #999;
  370. }
  371. }
  372. .listCont {
  373. display: flex;
  374. align-items: center;
  375. flex-wrap: wrap;
  376. padding-left: 20rpx;
  377. flex-direction: row;
  378. margin-top: 10rpx;
  379. color: #666;
  380. // border: 1px solid red;
  381. .item {
  382. width: 50%;
  383. font-size: $uni-font-size-sm;
  384. overflow: hidden;
  385. white-space: nowrap;
  386. text-overflow: ellipsis;
  387. -o-text-overflow: ellipsis;
  388. }
  389. .item text {
  390. color: #666;
  391. }
  392. .item-left {
  393. font-size: 20px;
  394. font-weight: 600;
  395. color: #999;
  396. position: relative;
  397. left: 90%;
  398. top: -55rpx;
  399. }
  400. }
  401. .item-top {
  402. height: 5rpx;
  403. width: 96%;
  404. margin: 0 auto;
  405. border-bottom: 1px solid #d8d3d3;
  406. }
  407. .listbtn {
  408. margin-top: 20rpx;
  409. display: flex;
  410. justify-content: flex-end;
  411. align-items: center;
  412. .operBox {
  413. display: flex;
  414. align-items: center;
  415. }
  416. }
  417. .listbtn button {
  418. margin-right: 20rpx;
  419. }
  420. }
  421. </style>