index.vue 8.7 KB

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