index.vue 9.4 KB

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