index.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  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="outputSceneState" 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. outputSceneState
  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. outputSceneState,
  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: 2
  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. },
  193. //切换tab
  194. changeChartsTab(index) {
  195. this.pickTabIndex = index
  196. this.popupInfo.status = this.tabList[index].value
  197. this.handleSearch()
  198. },
  199. //新增入库单
  200. addStock(type) {
  201. uni.navigateTo({
  202. url: '/pages/warehouse/outHouse/addStock?type=' + type
  203. })
  204. },
  205. //查看详情
  206. viewDetails(id, code) {
  207. uni.navigateTo({
  208. url: '/pages/warehouse/outHouse/details?id=' + id + '&code=' + code
  209. })
  210. }
  211. }
  212. }
  213. </script>
  214. <style lang="scss" scoped>
  215. .mainBox {
  216. padding-bottom: 120rpx;
  217. }
  218. .tab-title {
  219. display: flex;
  220. align-items: center;
  221. background-color: #fff;
  222. position: relative;
  223. .tab_box {
  224. width: 100%;
  225. height: 68rpx;
  226. }
  227. .tab_item {
  228. height: 68rpx;
  229. line-height: 68rpx;
  230. padding: 0 20rpx;
  231. font-size: 32rpx;
  232. // color: #979C9E;
  233. }
  234. .more_search {
  235. display: flex;
  236. align-items: center;
  237. height: 70rpx;
  238. line-height: 70rpx;
  239. }
  240. image {
  241. width: 52rpx;
  242. height: 52rpx;
  243. margin-left: 10rpx;
  244. }
  245. .active {
  246. box-sizing: border-box;
  247. border-bottom: 6rpx solid $theme-color;
  248. color: $theme-color;
  249. }
  250. }
  251. .search_list {
  252. min-height: 100rpx;
  253. /deep/ .baseForm {
  254. padding: 40rpx 20rpx 20rpx 20rpx;
  255. }
  256. }
  257. .operate_box {
  258. padding: 10rpx 32rpx;
  259. /deep/ .u-button {
  260. width: 40%;
  261. }
  262. }
  263. </style>