index.vue 9.5 KB

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