index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479
  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, item)"></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 rightText="新建调拨" :icon="false" @rightClick="addAllocation" />
  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="allotCode">
  20. <uni-easyinput v-model="popupInfo.allotCode" :inputBorder="false" placeholder="请输入" />
  21. </uni-forms-item>
  22. <!-- <uni-forms-item label="关键词" name="keyWord">
  23. <uni-easyinput :inputBorder="false" :value="popupInfo.keyWord" placeholder="请输入关键词"></uni-easyinput>
  24. </uni-forms-item> -->
  25. <uni-forms-item label="调拨类型" name="type">
  26. <uni-data-select
  27. @change="initWarehouse"
  28. v-model="popupInfo.type"
  29. :localdata="[
  30. { value: 1, text: '库内调拨' },
  31. { value: 2, text: '库外调拨' }
  32. ]"></uni-data-select>
  33. </uni-forms-item>
  34. <uni-forms-item label="调出仓库" name="sourceWarehouse">
  35. <uni-data-select @change="sourceWarehouseChange" v-model="popupInfo.sourceWarehouse" :localdata="sourceWarehouseList"></uni-data-select>
  36. </uni-forms-item>
  37. <uni-forms-item label="调入仓库" name="targetWarehouse">
  38. <uni-easyinput v-if="popupInfo.type == 1" :inputBorder="false" :value="popupInfo.sourceWarehouseName" :disabled="true"></uni-easyinput>
  39. <uni-data-select v-else @change="targetWarehouseChange" v-model="popupInfo.targetWarehouse" :localdata="targetWarehouseList"></uni-data-select>
  40. </uni-forms-item>
  41. <uni-forms-item label="调拨状态" name="status">
  42. <uni-data-select v-model="popupInfo.status" :localdata="stutusOptions"></uni-data-select>
  43. </uni-forms-item>
  44. </uni-forms>
  45. <view class="footer">
  46. <view class="btn reset" @click="handleReset">重置</view>
  47. <view class="btn search" @click="handleSearch">搜索</view>
  48. </view>
  49. </view>
  50. </u-popup>
  51. </view>
  52. </template>
  53. <script>
  54. import { getWarehouseList, getAllotApplyPage } from '@/api/warehouseManagement'
  55. import { get, getJ, post, postJ } from '@/utils/api.js'
  56. import card from './components/card.vue'
  57. import CommonFooter from '../components/CommonFooter.vue'
  58. export default {
  59. components: {
  60. card,
  61. CommonFooter
  62. },
  63. data() {
  64. return {
  65. page: 1,
  66. size: 10,
  67. isEnd: false,
  68. searchVisible: false,
  69. stutusOptions: [
  70. {
  71. value: 0,
  72. text: '未提交'
  73. },
  74. {
  75. value: 1,
  76. text: '审核中'
  77. },
  78. {
  79. value: 2,
  80. text: '已完成'
  81. }
  82. ],
  83. tabList: [
  84. {
  85. value: '',
  86. label: '全部'
  87. },
  88. {
  89. value: 0,
  90. label: '未提交'
  91. },
  92. {
  93. value: 1,
  94. label: '审核中'
  95. },
  96. {
  97. value: 2,
  98. label: '已完成'
  99. }
  100. ],
  101. statusList: [
  102. { code: 0, label: '未提交' },
  103. { code: 1, label: '审核中' },
  104. { code: 2, label: '已完成' }
  105. ],
  106. pickTabIndex: 0,
  107. popupInfo: {
  108. sourceWarehouse: '',
  109. sourceWarehouseName: '',
  110. targetWarehouse: '',
  111. allotCode: '',
  112. type: '',
  113. keyWord: '',
  114. status: ''
  115. }, //筛选数据
  116. tableList: [],
  117. warehouseList: [],
  118. targetWarehouseList: [],
  119. sourceWarehouseList: []
  120. }
  121. },
  122. onShow() {
  123. this.getwarehouseList()
  124. this.getFirstList()
  125. },
  126. //触底加载
  127. onReachBottom: function () {
  128. if (this.isEnd) {
  129. uni.showToast({
  130. title: '已经没有更多数据了!',
  131. icon: 'none',
  132. duration: 1000 //提示持续时间
  133. })
  134. return
  135. }
  136. // 显示加载图标
  137. this.getMoreLists()
  138. },
  139. methods: {
  140. // 调拨类型改变
  141. initWarehouse() {
  142. this.popupInfo.sourceWarehouse = ''
  143. this.popupInfo.sourceWarehouseName = ''
  144. this.popupInfo.targetWarehouse = ''
  145. this.sourceWarehouseList = [...this.warehouseList]
  146. this.targetWarehouseList = [...this.warehouseList]
  147. },
  148. // 调出仓库改变
  149. sourceWarehouseChange(val) {
  150. // 清空
  151. if (!val) {
  152. this.popupInfo.targetWarehouse = ''
  153. this.sourceWarehouseList = [...this.warehouseList]
  154. this.targetWarehouseList = [...this.warehouseList]
  155. }
  156. // 库内调拨
  157. if (this.popupInfo.type == 1) {
  158. console.log('库内')
  159. console.log(this.warehouseList.find(item => item.value == val).text)
  160. this.popupInfo.sourceWarehouseName = this.warehouseList.find(item => item.value == val).text
  161. this.popupInfo.sourceWarehouse = val
  162. } else if (this.popupInfo.type == 2) {
  163. console.log('库外')
  164. this.popupInfo.sourceWarehouse = val
  165. this.targetWarehouseList = this.targetWarehouseList.filter(item => item.value != val)
  166. console.log(this.targetWarehouseList)
  167. }
  168. },
  169. // 调入仓库改变
  170. targetWarehouseChange(val) {
  171. // 清空
  172. if (!val) {
  173. this.popupInfo.sourceWarehouse = ''
  174. this.sourceWarehouseList = [...this.warehouseList]
  175. this.targetWarehouseList = [...this.warehouseList]
  176. }
  177. if (this.popupInfo.type == 2) {
  178. console.log('库外')
  179. this.popupInfo.targetWarehouse = val
  180. this.sourceWarehouseList = this.sourceWarehouseList.filter(item => item.value != val)
  181. console.log(this.sourceWarehouseList)
  182. }
  183. },
  184. //获取仓库
  185. async getwarehouseList() {
  186. let res = await getWarehouseList()
  187. let warehouseList = res.data.map(item => {
  188. return {
  189. value: item.id,
  190. text: item.name
  191. }
  192. })
  193. this.warehouseList = warehouseList
  194. this.sourceWarehouseList = [...warehouseList]
  195. this.targetWarehouseList = [...warehouseList]
  196. },
  197. back() {
  198. uni.switchTab({
  199. url: '/pages/index/index'
  200. })
  201. },
  202. addAllocation() {
  203. uni.navigateTo({
  204. url: '/pages/warehouse/inventoryAllocation/edit'
  205. })
  206. },
  207. handleReset() {
  208. this.popupInfo = {
  209. sourceWarehouse: '',
  210. sourceWarehouseName: '',
  211. targetWarehouse: '',
  212. allotCode: '',
  213. type: '',
  214. keyWord: '',
  215. status: ''
  216. }
  217. this.tableList = []
  218. this.getFirstList()
  219. },
  220. handleSearch() {
  221. this.getFirstList()
  222. },
  223. // 搜索弹窗
  224. openSearch() {
  225. // console.log('open');
  226. },
  227. getFirstList() {
  228. this.page = 1
  229. this.searchVisible = false
  230. this.isEnd = true
  231. this.getList()
  232. },
  233. getMoreLists() {
  234. //获取更多数据
  235. this.page++
  236. this.getList()
  237. },
  238. //获取列表信息
  239. getList() {
  240. uni.showLoading({
  241. title: '加载中'
  242. })
  243. let data = {
  244. pageNum: this.page,
  245. size: this.size,
  246. ...this.popupInfo
  247. }
  248. getAllotApplyPage(data)
  249. .then(res => {
  250. if (this.page === 1) {
  251. this.tableList = res.list
  252. } else {
  253. this.tableList = this.tableList.concat(res.list)
  254. }
  255. this.isEnd = this.tableList.length >= res.count
  256. })
  257. .finally(err => {
  258. uni.hideLoading()
  259. })
  260. },
  261. //切换tab
  262. changeChartsTab(index, item) {
  263. this.pickTabIndex = index
  264. this.popupInfo.status = item.value
  265. this.handleSearch()
  266. },
  267. //查看详情
  268. viewDetails(id, code) {
  269. uni.navigateTo({
  270. url: '/pages/warehouse/enterHouse/details?id=' + id + '&code=' + code
  271. })
  272. }
  273. }
  274. }
  275. </script>
  276. <style lang="scss" scoped>
  277. .mainBox {
  278. padding-bottom: 120rpx;
  279. }
  280. .search-container {
  281. width: 70vw;
  282. padding: 30rpx 36rpx;
  283. .footer {
  284. position: absolute;
  285. bottom: 0;
  286. left: 0;
  287. width: 100%;
  288. display: flex;
  289. box-shadow: 0 10rpx 30rpx 0 #000;
  290. .btn {
  291. width: 50%;
  292. height: 80rpx;
  293. border-radius: 0 !important;
  294. flex: 1;
  295. display: flex;
  296. justify-content: center;
  297. align-items: center;
  298. &.reset {
  299. color: $j-primary-border-green;
  300. }
  301. &.search {
  302. color: #fff;
  303. background-color: $j-primary-border-green;
  304. }
  305. }
  306. }
  307. .title {
  308. font-weight: bold;
  309. font-size: 30rpx;
  310. }
  311. .status-wrapper {
  312. display: flex;
  313. align-items: center;
  314. justify-content: space-between;
  315. view {
  316. background-color: rgba(242, 242, 242, 1);
  317. height: 60rpx;
  318. border-radius: 30rpx;
  319. line-height: 60rpx;
  320. text-align: center;
  321. width: 160rpx;
  322. border: 1rpx solid rgba(242, 242, 242, 1);
  323. &.active {
  324. color: #157a2c;
  325. border-color: rgba(21, 122, 44, 1);
  326. }
  327. }
  328. }
  329. /deep/.uni-date {
  330. .uni-icons {
  331. display: none;
  332. }
  333. .uni-date-x {
  334. padding: 0;
  335. view {
  336. margin: 0 20rpx;
  337. }
  338. }
  339. }
  340. /deep/.uni-date__x-input,
  341. /deep/.uni-easyinput__content-input {
  342. height: 60rpx;
  343. border-radius: 30rpx;
  344. overflow: hidden;
  345. background-color: rgba(242, 242, 242, 1);
  346. }
  347. }
  348. .tab-title {
  349. position: fixed;
  350. z-index: 99;
  351. width: 100%;
  352. display: flex;
  353. justify-content: space-between;
  354. align-items: center;
  355. height: $tab-height;
  356. line-height: $tab-height;
  357. background-color: #ffffff;
  358. border-bottom: 1px solid #f2f2f2;
  359. box-sizing: border-box;
  360. .search-icon {
  361. display: flex;
  362. align-items: center;
  363. justify-content: space-around;
  364. font-size: 28rpx;
  365. white-space: nowrap;
  366. margin-left: 10rpx;
  367. image {
  368. width: 34rpx;
  369. height: 34rpx;
  370. }
  371. }
  372. .tab-item {
  373. width: 25%;
  374. text-align: center;
  375. font-size: 32rpx;
  376. color: $uni-text-color-grey;
  377. }
  378. .tab-item.active {
  379. color: $j-primary-border-green;
  380. border-bottom: 1px solid $j-primary-border-green;
  381. font-weight: bold;
  382. }
  383. .tab-item.filter {
  384. flex: 1;
  385. padding: 0px 30rpx;
  386. .uni-icons {
  387. display: flex;
  388. padding-top: 5px;
  389. }
  390. }
  391. }
  392. .listBox {
  393. margin-top: 10px;
  394. padding-top: 5px;
  395. padding-bottom: 8px;
  396. .listTit {
  397. display: flex;
  398. align-items: center;
  399. .stuts {
  400. width: 55px;
  401. font-size: 12px;
  402. // border: 1px solid red;
  403. }
  404. .name {
  405. font-size: $uni-font-size-base;
  406. padding-left: 15rpx;
  407. }
  408. .date {
  409. font-size: $uni-font-size-sm;
  410. padding-left: 45rpx;
  411. color: #999;
  412. }
  413. }
  414. .listCont {
  415. display: flex;
  416. align-items: center;
  417. flex-wrap: wrap;
  418. padding-left: 20rpx;
  419. flex-direction: row;
  420. margin-top: 10rpx;
  421. color: #666;
  422. // border: 1px solid red;
  423. .item {
  424. width: 50%;
  425. font-size: $uni-font-size-sm;
  426. overflow: hidden;
  427. white-space: nowrap;
  428. text-overflow: ellipsis;
  429. -o-text-overflow: ellipsis;
  430. }
  431. .item text {
  432. color: #666;
  433. }
  434. .item-left {
  435. font-size: 20px;
  436. font-weight: 600;
  437. color: #999;
  438. position: relative;
  439. left: 90%;
  440. top: -55rpx;
  441. }
  442. }
  443. .item-top {
  444. height: 5rpx;
  445. width: 96%;
  446. margin: 0 auto;
  447. border-bottom: 1px solid #d8d3d3;
  448. }
  449. .listbtn {
  450. margin-top: 20rpx;
  451. display: flex;
  452. justify-content: flex-end;
  453. align-items: center;
  454. .operBox {
  455. display: flex;
  456. align-items: center;
  457. }
  458. }
  459. .listbtn button {
  460. margin-right: 20rpx;
  461. }
  462. }
  463. </style>