index.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  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. getDept() {
  90. listOrganizations(1).then(data => {
  91. this.listData = data
  92. })
  93. },
  94. getUser(deptCode) {
  95. // 显示加载中的提示
  96. uni.showLoading({
  97. title: '加载中'
  98. })
  99. getUserPage({ pageNum: 1, size: -1, groupId: deptCode })
  100. .then(data => {
  101. this.userList = data.list.map(item => {
  102. item.text = item.name
  103. item.value = item.id
  104. return item
  105. })
  106. })
  107. .finally(() => {
  108. uni.hideLoading()
  109. })
  110. },
  111. // 抬头下拉信息保存
  112. handlePicker(e, list, idKey, nameKey) {
  113. if (idKey) {
  114. this.popupInfo[idKey] = list[e.detail.value].id
  115. }
  116. if (nameKey) {
  117. this.popupInfo[nameKey] = list[e.detail.value].name
  118. }
  119. },
  120. handleSearch() {
  121. this.getFirstList()
  122. },
  123. getFirstList() {
  124. this.searchVisible = false
  125. this.page = 1
  126. this.isEnd = true
  127. this.getList()
  128. },
  129. getMoreLists() {
  130. //获取更多数据
  131. page++
  132. this.getList()
  133. },
  134. //获取列表信息
  135. getList() {
  136. uni.showLoading({
  137. title: '加载中'
  138. })
  139. let data = {
  140. pageNum: this.page,
  141. size: this.size,
  142. status: this.status
  143. }
  144. getPlanProfitLoss(data)
  145. .then(res => {
  146. if (this.page === 1) {
  147. this.tableData = res.list
  148. } else {
  149. this.tableData = this.tableData.concat(res.list)
  150. }
  151. this.isEnd = this.tableData.length >= res.count
  152. })
  153. .finally(() => {
  154. uni.hideLoading()
  155. })
  156. },
  157. confirm(data, name) {
  158. this.popupInfo.reportDeptName = name
  159. this.popupInfo.reportDeptId = data[0]
  160. this.popupInfo.reportName = ''
  161. this.popupInfo.reportId = ''
  162. this.getUser(data[0])
  163. },
  164. //切换tab
  165. handleTabChange(status) {
  166. this.status = status
  167. this.getFirstList()
  168. },
  169. //筛选
  170. handleTabSearch() {
  171. // this.getFirstList()
  172. this.searchVisible = true
  173. },
  174. handleReset() {
  175. this.popupInfo = {
  176. code: '',
  177. name: '',
  178. reportDeptName: '',
  179. reportDeptId: '',
  180. reportName: '',
  181. reportId: ''
  182. }
  183. this.getFirstList()
  184. },
  185. //新增
  186. addStock() {
  187. uni.navigateTo({
  188. url: '/pages/warehouse/reportLoss/edit'
  189. })
  190. }
  191. }
  192. }
  193. </script>
  194. <style lang="scss" scoped>
  195. .mainBox {
  196. padding-bottom: 120rpx;
  197. }
  198. .tab-wrapper {
  199. position: fixed;
  200. z-index: 99;
  201. width: 100%;
  202. }
  203. .footBox {
  204. position: fixed;
  205. left: 0px;
  206. bottom: 0px;
  207. height: 100rpx;
  208. width: 100%;
  209. display: flex;
  210. align-items: center;
  211. justify-content: space-between;
  212. view {
  213. width: 100%;
  214. height: 100%;
  215. text-align: center;
  216. color: #fff;
  217. display: flex;
  218. align-items: center;
  219. justify-content: center;
  220. }
  221. .add {
  222. background: $uni-color-primary;
  223. }
  224. .reg {
  225. background: $u-success-dark;
  226. }
  227. .uni-icons {
  228. margin-right: 8rpx !important;
  229. font-weight: bold;
  230. }
  231. }
  232. .search-container {
  233. width: 70vw;
  234. padding: 30rpx 36rpx;
  235. .footer {
  236. position: absolute;
  237. bottom: 0;
  238. left: 0;
  239. width: 100%;
  240. display: flex;
  241. box-shadow: 0 10rpx 30rpx 0 #000;
  242. .btn {
  243. width: 50%;
  244. height: 80rpx;
  245. border-radius: 0 !important;
  246. flex: 1;
  247. display: flex;
  248. justify-content: center;
  249. align-items: center;
  250. &.reset {
  251. color: $j-primary-border-green;
  252. }
  253. &.search {
  254. color: #fff;
  255. background-color: $j-primary-border-green;
  256. }
  257. }
  258. }
  259. .title {
  260. font-weight: bold;
  261. font-size: 30rpx;
  262. margin-bottom: 20rpx;
  263. }
  264. /deep/.uni-date__x-input,
  265. /deep/.uni-easyinput__content,
  266. /deep/.uni-easyinput__content-input {
  267. height: 60rpx;
  268. border-radius: 30rpx;
  269. overflow: hidden;
  270. background-color: rgba(242, 242, 242, 1);
  271. }
  272. }
  273. </style>