index.vue 8.6 KB

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