index.vue 10 KB

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