index.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  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-wrapper">
  5. <tabs @change="handleTabChange" @handleSearch="handleTabSearch" />
  6. </view>
  7. <view class="tab-title__placeholder"></view>
  8. <CardList :list="tableData" />
  9. <view class="footBox">
  10. <view class="reg" @click="addStock">
  11. <uni-icons custom-prefix="iconfont" type="icon-shixiangxinzeng" size="20" color="#fff"></uni-icons>
  12. 新增报损报溢
  13. </view>
  14. </view>
  15. <!-- 搜索组件 -->
  16. <u-popup :show="searchVisible" mode="right" @close="searchVisible = false">
  17. <view class="search-container">
  18. <view class="title">筛选</view>
  19. <uni-forms ref="customForm" :modelValue="popupInfo" label-position="top" label-width="200">
  20. <uni-forms-item label="单号" name="code">
  21. <uni-easyinput v-model="popupInfo.code" :inputBorder="false" placeholder="请输入" />
  22. </uni-forms-item>
  23. <uni-forms-item label="名称" name="name">
  24. <uni-easyinput v-model="popupInfo.name" :inputBorder="false" placeholder="请输入" />
  25. </uni-forms-item>
  26. <uni-forms-item label="报损报溢部门" name="deliveryreportDeptNameName">
  27. <uni-easyinput :value="popupInfo.reportDeptName" disabled @click.native="$refs.treePicker._show()" :inputBorder="false" placeholder="请选择" />
  28. </uni-forms-item>
  29. <uni-forms-item label="报损报溢人" name="reportName">
  30. <uni-data-select v-model="popupInfo.reportId" :localdata="userList"></uni-data-select>
  31. </uni-forms-item>
  32. </uni-forms>
  33. <view class="footer">
  34. <view class="btn reset" @click="handleReset">重置</view>
  35. <view class="btn search" @click="handleSearch">搜索</view>
  36. </view>
  37. </view>
  38. </u-popup>
  39. <ba-tree-picker ref="treePicker" :multiple="false" @select-change="confirm" title="选择部门" :localdata="listData" valueKey="id" textKey="name" childrenKey="children" />
  40. </view>
  41. </template>
  42. <script>
  43. import { listOrganizations, getUserPage } from '@/api/myTicket/index.js'
  44. import { getPlanProfitLoss } from '@/api/warehouseManagement'
  45. import tabs from './components/tabs.vue'
  46. import CardList from './components/CardList.vue'
  47. import baTreePicker from '@/components/ba-tree-picker/ba-tree-picker.vue'
  48. export default {
  49. components: {
  50. tabs,
  51. CardList,
  52. baTreePicker
  53. },
  54. data() {
  55. return {
  56. listData: [],
  57. page: 1,
  58. size: 10,
  59. isEnd: true,
  60. searchVisible: false,
  61. status: '',
  62. pickerIndex: 0,
  63. pickTabIndex: 0,
  64. popupInfo: {
  65. code: '',
  66. name: '',
  67. reportDeptName: '',
  68. reportDeptId: '',
  69. reportName: '',
  70. reportId: ''
  71. }, //筛选数据
  72. userList: [],
  73. deptList: [],
  74. tableData: []
  75. }
  76. },
  77. onLoad() {
  78. this.getFirstList()
  79. this.getDept()
  80. },
  81. //触底加载
  82. onReachBottom: function () {
  83. if (this.isEnd) {
  84. return
  85. }
  86. this.getMoreLists()
  87. },
  88. methods: {
  89. back() {
  90. uni.switchTab({
  91. url: '/pages/index/index'
  92. })
  93. },
  94. getDept() {
  95. listOrganizations(1).then(data => {
  96. this.listData = data
  97. })
  98. },
  99. getUser(deptCode) {
  100. // 显示加载中的提示
  101. uni.showLoading({
  102. title: '加载中'
  103. })
  104. getUserPage({ pageNum: 1, size: -1, groupId: deptCode })
  105. .then(data => {
  106. this.userList = data.list.map(item => {
  107. item.text = item.name
  108. item.value = item.id
  109. return item
  110. })
  111. })
  112. .finally(() => {
  113. uni.hideLoading()
  114. })
  115. },
  116. // 抬头下拉信息保存
  117. handlePicker(e, list, idKey, nameKey) {
  118. if (idKey) {
  119. this.popupInfo[idKey] = list[e.detail.value].id
  120. }
  121. if (nameKey) {
  122. this.popupInfo[nameKey] = list[e.detail.value].name
  123. }
  124. },
  125. handleSearch() {
  126. this.getFirstList()
  127. },
  128. getFirstList() {
  129. this.searchVisible = false
  130. this.page = 1
  131. this.isEnd = true
  132. this.getList()
  133. },
  134. getMoreLists() {
  135. //获取更多数据
  136. page++
  137. this.getList()
  138. },
  139. //获取列表信息
  140. getList() {
  141. uni.showLoading({
  142. title: '加载中'
  143. })
  144. let data = {
  145. pageNum: this.page,
  146. size: this.size,
  147. status: this.status
  148. }
  149. getPlanProfitLoss(data)
  150. .then(res => {
  151. if (this.page === 1) {
  152. this.tableData = res.list
  153. } else {
  154. this.tableData = this.tableData.concat(res.list)
  155. }
  156. this.isEnd = this.tableData.length >= res.count
  157. })
  158. .finally(() => {
  159. uni.hideLoading()
  160. })
  161. },
  162. confirm(data, name) {
  163. this.popupInfo.reportDeptName = name
  164. this.popupInfo.reportDeptId = data[0]
  165. this.popupInfo.reportName = ''
  166. this.popupInfo.reportId = ''
  167. this.getUser(data[0])
  168. },
  169. //切换tab
  170. handleTabChange(status) {
  171. this.status = status
  172. this.getFirstList()
  173. },
  174. //筛选
  175. handleTabSearch() {
  176. // this.getFirstList()
  177. this.searchVisible = true
  178. },
  179. handleReset() {
  180. this.popupInfo = {
  181. code: '',
  182. name: '',
  183. reportDeptName: '',
  184. reportDeptId: '',
  185. reportName: '',
  186. reportId: ''
  187. }
  188. this.getFirstList()
  189. },
  190. //新增
  191. addStock() {
  192. uni.navigateTo({
  193. url: '/pages/warehouse/reportLoss/edit'
  194. })
  195. }
  196. }
  197. }
  198. </script>
  199. <style lang="scss" scoped>
  200. .mainBox {
  201. padding-bottom: 120rpx;
  202. }
  203. .tab-wrapper {
  204. position: fixed;
  205. z-index: 99;
  206. width: 100%;
  207. }
  208. .footBox {
  209. position: fixed;
  210. left: 0px;
  211. bottom: 0px;
  212. height: 100rpx;
  213. width: 100%;
  214. display: flex;
  215. align-items: center;
  216. justify-content: space-between;
  217. view {
  218. width: 100%;
  219. height: 100%;
  220. text-align: center;
  221. color: #fff;
  222. display: flex;
  223. align-items: center;
  224. justify-content: center;
  225. }
  226. .add {
  227. background: $uni-color-primary;
  228. }
  229. .reg {
  230. background: $u-success-dark;
  231. }
  232. .uni-icons {
  233. margin-right: 8rpx !important;
  234. font-weight: bold;
  235. }
  236. }
  237. .search-container {
  238. width: 70vw;
  239. padding: 30rpx 36rpx;
  240. .footer {
  241. position: absolute;
  242. bottom: 0;
  243. left: 0;
  244. width: 100%;
  245. display: flex;
  246. box-shadow: 0 10rpx 30rpx 0 #000;
  247. .btn {
  248. width: 50%;
  249. height: 80rpx;
  250. border-radius: 0 !important;
  251. flex: 1;
  252. display: flex;
  253. justify-content: center;
  254. align-items: center;
  255. &.reset {
  256. color: $j-primary-border-green;
  257. }
  258. &.search {
  259. color: #fff;
  260. background-color: $j-primary-border-green;
  261. }
  262. }
  263. }
  264. .title {
  265. font-weight: bold;
  266. font-size: 30rpx;
  267. margin-bottom: 20rpx;
  268. }
  269. /deep/.uni-date__x-input,
  270. /deep/.uni-easyinput__content,
  271. /deep/.uni-easyinput__content-input {
  272. height: 60rpx;
  273. border-radius: 30rpx;
  274. overflow: hidden;
  275. background-color: rgba(242, 242, 242, 1);
  276. }
  277. }
  278. </style>