index.vue 11 KB

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