index.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  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 leftText="新增入库" @leftClick="addStock('hand')" />
  15. <!-- 搜索组件 -->
  16. <u-popup :show="searchVisible" closeOnClickOverlay 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="assetType">
  20. <uni-datetime-picker v-model="popupInfo.range" :border="true" :icon="false" type="daterange" />
  21. </u-form-item>
  22. <u-form-item label="入库类型:" class="required-form" borderBottom prop="bizType">
  23. <zxz-uni-data-select :localdata="sceneState" v-model="popupInfo.bizType" dataValue='value'
  24. dataKey="text" filterable format='{text}'></zxz-uni-data-select>
  25. </u-form-item>
  26. <u-form-item label="入库单号:" class="required-form" borderBottom prop="sourceBizNo">
  27. <uni-easyinput v-model="popupInfo.sourceBizNo" :inputBorder="false" placeholder="请输入" />
  28. </u-form-item>
  29. <u-form-item label="物品名称:" class="required-form" borderBottom prop="categoryName">
  30. <uni-easyinput v-model="popupInfo.categoryName" :inputBorder="false" placeholder="请输入" />
  31. </u-form-item>
  32. <u-form-item label="物品编码:" class="required-form" borderBottom prop="categoryCode">
  33. <uni-easyinput v-model="popupInfo.categoryCode" :inputBorder="false" placeholder="请输入" />
  34. </u-form-item>
  35. </u-form>
  36. </view>
  37. <view class="operate_box rx-bc">
  38. <u-button size="small" class="u-reset-button" @click="handleReset">
  39. 重置
  40. </u-button>
  41. <u-button type="success" size="small" class="u-reset-button" @click="handleSearch">
  42. 确定
  43. </u-button>
  44. </view>
  45. </u-popup>
  46. </view>
  47. </template>
  48. <script>
  49. import {
  50. sceneState
  51. } from '../common'
  52. import {
  53. getOutInList
  54. } from '@/api/warehouseManagement'
  55. import card from './components/card.vue'
  56. import CommonFooter from '.././components/CommonFooter.vue'
  57. export default {
  58. components: {
  59. card,
  60. CommonFooter
  61. },
  62. data() {
  63. return {
  64. sceneState,
  65. page: 1,
  66. size: 10,
  67. isEnd: false,
  68. searchVisible: false,
  69. tabList: [{
  70. value: '',
  71. label: '全部'
  72. },
  73. {
  74. value: 3,
  75. label: '已驳回'
  76. },
  77. {
  78. value: 2,
  79. label: '审核通过'
  80. },
  81. {
  82. value: 1,
  83. label: '审核中'
  84. },
  85. {
  86. value: 0,
  87. label: '未提交'
  88. }
  89. ],
  90. pickTabIndex: 0,
  91. popupInfo: {
  92. status: '',
  93. range: [],
  94. bizType: '',
  95. sourceBizNo: '',
  96. categoryName: '',
  97. categoryCode: ''
  98. }, //筛选数据
  99. tableList: []
  100. }
  101. },
  102. onShow() {
  103. this.getFirstList()
  104. },
  105. //触底加载
  106. onReachBottom: function() {
  107. if (this.isEnd) {
  108. uni.showToast({
  109. title: '已经没有更多数据了!',
  110. icon: 'none',
  111. duration: 1000 //提示持续时间
  112. })
  113. return
  114. }
  115. // 显示加载图标
  116. uni.showLoading({
  117. title: '数据加载中'
  118. })
  119. this.getMoreLists()
  120. },
  121. methods: {
  122. handleReset() {
  123. this.popupInfo = {
  124. status: '',
  125. range: [],
  126. bizType: '',
  127. sourceBizNo: '',
  128. categoryName: '',
  129. categoryCode: ''
  130. }
  131. this.pickTabIndex = 0
  132. this.tableList = []
  133. this.getFirstList()
  134. },
  135. handleSearch() {
  136. this.getFirstList()
  137. },
  138. statusChange(code) {
  139. let index = this.popupInfo.status.indexOf(code)
  140. if (index === -1) {
  141. this.popupInfo.status.push(code)
  142. } else {
  143. this.popupInfo.status.splice(index, 1)
  144. }
  145. },
  146. // 搜索弹窗
  147. openSearch() {
  148. // console.log('open');
  149. },
  150. getFirstList() {
  151. this.page = 1
  152. this.searchVisible = false
  153. this.isEnd = true
  154. uni.showLoading({
  155. title: '数据加载中'
  156. })
  157. this.getList(this.popupInfo)
  158. },
  159. getMoreLists() {
  160. //获取更多数据
  161. this.page++
  162. this.getList(this.popupInfo)
  163. },
  164. //获取列表信息
  165. getList() {
  166. uni.showLoading({
  167. title: '加载中'
  168. })
  169. let data = {
  170. ...this.popupInfo,
  171. pageNum: this.page,
  172. size: this.size,
  173. type: 1
  174. }
  175. if (data.range?.length) {
  176. data.startTime = data.range[0]
  177. data.endTime = data.range[1]
  178. }
  179. delete data.range
  180. getOutInList(data)
  181. .then(res => {
  182. if (this.page === 1) {
  183. this.tableList = res.list
  184. } else {
  185. this.tableList.push(...res.list)
  186. }
  187. this.isEnd = this.tableList.length >= res.count
  188. })
  189. .then(() => {
  190. uni.hideLoading()
  191. })
  192. // get(this.apiUrl + '/outInWarehouse/select/inWarehouse', data)
  193. // .then(res => {
  194. // if (res.success == true) {
  195. // if (page === 1) {
  196. // this.tableList = res.data.records
  197. // } else {
  198. // this.tableList.push(...res.data.records)
  199. // }
  200. // isEnd = this.tableList.length >= res.data.total
  201. // }
  202. // })
  203. // .then(() => {
  204. // uni.hideLoading()
  205. // })
  206. },
  207. //切换tab
  208. changeChartsTab(index) {
  209. this.pickTabIndex = index
  210. this.popupInfo.status = this.tabList[index].value
  211. this.handleSearch()
  212. },
  213. //新增入库单
  214. addStock(type) {
  215. uni.navigateTo({
  216. url: '/pages/warehouse/enterHouse/addStock?type=' + type
  217. })
  218. },
  219. //查看详情
  220. viewDetails(id, code) {
  221. uni.navigateTo({
  222. url: '/pages/warehouse/enterHouse/details?id=' + id + '&code=' + code
  223. })
  224. }
  225. }
  226. }
  227. </script>
  228. <style lang="scss" scoped>
  229. .mainBox {
  230. padding-bottom: 120rpx;
  231. }
  232. .tab-title {
  233. display: flex;
  234. align-items: center;
  235. background-color: #fff;
  236. position: relative;
  237. .tab_box {
  238. width: 100%;
  239. height: 68rpx;
  240. }
  241. .tab_item {
  242. height: 68rpx;
  243. line-height: 68rpx;
  244. padding: 0 20rpx;
  245. font-size: 32rpx;
  246. // color: #979C9E;
  247. }
  248. .more_search {
  249. display: flex;
  250. align-items: center;
  251. height: 70rpx;
  252. line-height: 70rpx;
  253. }
  254. image {
  255. width: 52rpx;
  256. height: 52rpx;
  257. margin-left: 10rpx;
  258. }
  259. .active {
  260. box-sizing: border-box;
  261. border-bottom: 6rpx solid $theme-color;
  262. color: $theme-color;
  263. }
  264. }
  265. .search_list {
  266. min-height: 100rpx;
  267. /deep/ .baseForm {
  268. padding: 40rpx 20rpx 20rpx 20rpx;
  269. }
  270. }
  271. .operate_box {
  272. padding: 10rpx 32rpx;
  273. /deep/ .u-button {
  274. width: 40%;
  275. }
  276. }
  277. </style>