综合办公系统
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

borrowList.vue 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  1. <template>
  2. <view class="container">
  3. <uv-tabs :list="tabList" @click="clickTab"></uv-tabs>
  4. <mescroll-uni ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption"
  5. :up="upOption" :fixed="false" :top="10" style="padding: 30rpx;">
  6. <view>
  7. <view v-for="(item, index) in borrowList" :key="index" class="modern-card">
  8. <view class="modern-card-header" v-if="selectedTab === '项目借款'">
  9. <view class="modern-card-title">
  10. <text class="project-number">{{ item.projectNumber }}</text>
  11. <text class="project-name">{{ item.project ? item.project.projectName : '' }}</text>
  12. </view>
  13. </view>
  14. <view class="modern-card-header" v-else>
  15. <view class="modern-card-title">
  16. <text class="project-name">{{ item.applyReason }}</text>
  17. </view>
  18. </view>
  19. <view class="modern-card-body">
  20. <view class="avatar-section">
  21. <view class="avatar">
  22. <text>{{ item.applierUser.nickName ? item.applierUser.nickName[0] : '' }}</text>
  23. </view>
  24. <view>
  25. <text class="applier-name">{{ item.applierUser.nickName }}</text>
  26. <text class="dept-name">{{ item.dept.deptName }}</text>
  27. </view>
  28. </view>
  29. <view class="info-row">
  30. <text class="info-label">申请时间:</text>
  31. <text class="info-value">{{ item.applyDate }}</text>
  32. </view>
  33. <view class="info-row">
  34. <text class="info-label">申请说明:</text>
  35. <text class="info-value">{{ item.remark }}</text>
  36. </view>
  37. <view class="info-row">
  38. <text class="info-label">申请金额:</text>
  39. <text class="amount-highlight-detail">¥{{ item.applyAmount }}</text>
  40. </view>
  41. <view class="info-row">
  42. <text class="info-label">核准金额:</text>
  43. <text class="manager-amount-highlight-detail">¥{{ item.managerAmount }}</text>
  44. </view>
  45. </view>
  46. <view class="modern-card-footer">
  47. <button class="footer-btn detail-btn" @click="openDetailPopup(item.borrowId)">查看明细</button>
  48. <button class="footer-btn form-btn" @click="openFormInfo(item)">表单信息</button>
  49. </view>
  50. </view>
  51. </view>
  52. </mescroll-uni>
  53. <uv-popup ref="detailPopup" mode="bottom">
  54. <view class="popup-detail-list" @touchmove.stop>
  55. <view class="popup-close-btn" @click="$refs.detailPopup.close()">×</view>
  56. <view class="popup-detail-title">借款明细</view>
  57. <view v-for="(item, index) in detailList" :key="item.borrowDetailId" class="popup-detail-item">
  58. <view class="popup-detail-index">{{ index + 1 }}</view>
  59. <view class="popup-detail-main">
  60. <view class="popup-detail-row">
  61. <text class="popup-detail-label">开支项目:</text>
  62. <text class="popup-detail-value">{{ item.borrowItem }}</text>
  63. </view>
  64. <view class="popup-detail-row">
  65. <text class="popup-detail-label">单价×数量:</text>
  66. <text class="popup-detail-value">¥{{ item.price }} × {{ item.quantity }}{{ item.unit }}</text>
  67. </view>
  68. <view class="popup-detail-row">
  69. <text class="popup-detail-label">申请金额:</text>
  70. <text class="popup-detail-amount">¥{{ item.applyAmount }}</text>
  71. </view>
  72. <view class="popup-detail-row" v-if="item.managerAmount">
  73. <text class="popup-detail-label">核准金额:</text>
  74. <text class="popup-detail-manager-amount">¥{{ item.managerAmount }}</text>
  75. </view>
  76. </view>
  77. </view>
  78. </view>
  79. </uv-popup>
  80. </view>
  81. </template>
  82. <script>
  83. import { listBorrow } from '@/api/oa/borrow/borrow';
  84. import { listBorrowDetail, addBorrowDetail, updateBorrowDetail, delBorrowDetail, delBorrowDetailByDetailId } from "@/api/oa/borrow/borrowDetail";
  85. import MescrollMixin from '@/uni_modules/mescroll/components/mescroll-uni/mescroll-mixins.js'
  86. export default {
  87. mixins: [MescrollMixin],
  88. data() {
  89. return {
  90. tabList: [{
  91. name: '项目借款',
  92. }, {
  93. name: '非项目借款',
  94. }, {
  95. name: '工会借款'
  96. }, {
  97. name: '党委借款'
  98. }, {
  99. name: '团委借款'
  100. }],
  101. selectedTab: '项目借款',
  102. mescroll: null, // mescroll实例
  103. downOption: {
  104. auto: true,
  105. textOutOffset: '下拉刷新',
  106. textLoading: '加载中...'
  107. },
  108. upOption: {
  109. auto: false,
  110. page: { num: 1, size: 10 },
  111. noMoreSize: 5,
  112. empty: { tip: '暂无借款数据' },
  113. textNoMore: '~ 没有更多数据了 ~'
  114. },
  115. borrowList: [],
  116. queryParams: {
  117. pageNum: 1,
  118. pageSize: 10,
  119. borrowUsage: '0'
  120. },
  121. detailList: []
  122. }
  123. },
  124. onLoad: function (options) {
  125. uni.startPullDownRefresh();
  126. },
  127. methods: {
  128. // 加载数据
  129. async loadData() {
  130. try {
  131. const res = await listBorrow(this.queryParams)
  132. return { data: res.rows, total: res.total }
  133. } catch (e) {
  134. return { data: [], error: true }
  135. }
  136. },
  137. mescrollInit(mescroll) {
  138. this.mescroll = mescroll;
  139. },
  140. // mescroll下拉刷新回调
  141. async downCallback() {
  142. this.borrowList = []; // 清空列表
  143. this.queryParams.pageNum = 1
  144. const res = await this.loadData()
  145. if (res.error) {
  146. this.mescroll.endErr();
  147. } else {
  148. this.borrowList = res.data;
  149. this.mescroll.endSuccess(res.data.length, res.total);
  150. }
  151. uni.stopPullDownRefresh();
  152. },
  153. // mescroll上拉加载回调
  154. async upCallback(page) {
  155. this.queryParams.pageNum = page.num
  156. const res = await this.loadData()
  157. if (res.error) {
  158. this.mescroll.endErr();
  159. } else {
  160. this.borrowList = this.borrowList.concat(res.data)
  161. this.mescroll.endSuccess(res.data.length, res.total);
  162. }
  163. },
  164. clickTab(obj) {
  165. let index = obj.index;
  166. this.selectedTab = this.tabList[index].name;
  167. let param = [
  168. { name: '项目借款', value: '0' },
  169. { name: '非项目借款', value: '1' },
  170. { name: '工会借款', value: '2' },
  171. { name: '党委借款', value: '3' },
  172. { name: '团委借款', value: '4' }
  173. ]
  174. this.queryParams.borrowUsage = param[index].value;
  175. uni.startPullDownRefresh();
  176. },
  177. openDetailPopup(borrowId) {
  178. listBorrowDetail({ borrowId: borrowId, pageNum: 1, pageSize: 200 }).then(res => {
  179. this.detailList = res.rows;
  180. this.$refs.detailPopup.open();
  181. })
  182. },
  183. openFormInfo(item) {
  184. uni.navigateTo({
  185. url: `/pages/components/formInfo?formId=${item.borrowId}&formType=borrow`
  186. });
  187. }
  188. }
  189. }
  190. </script>
  191. <style lang="scss" scoped>
  192. .container {
  193. padding: 20rpx;
  194. background-color: #f5f5f5;
  195. height: 100vh;
  196. display: flex;
  197. flex-direction: column;
  198. }
  199. .search-box {
  200. background-color: #fff;
  201. border-radius: 8rpx;
  202. margin-bottom: 20rpx;
  203. overflow: hidden;
  204. }
  205. .search-header {
  206. padding: 20rpx;
  207. display: flex;
  208. justify-content: space-between;
  209. align-items: center;
  210. border-bottom: 1px solid #ebeef5;
  211. }
  212. .search-title {
  213. font-size: 32rpx;
  214. font-weight: bold;
  215. color: #333;
  216. }
  217. .search-icon {
  218. font-size: 28rpx;
  219. color: #909399;
  220. }
  221. .search-content {
  222. padding: 20rpx;
  223. }
  224. .search-item {
  225. margin-bottom: 20rpx;
  226. }
  227. .search-item text {
  228. display: block;
  229. margin-bottom: 10rpx;
  230. font-size: 28rpx;
  231. color: #333;
  232. }
  233. .search-item input,
  234. .search-item .picker {
  235. width: 100%;
  236. height: 80rpx;
  237. padding: 0 20rpx;
  238. border: 1px solid #dcdfe6;
  239. border-radius: 4rpx;
  240. box-sizing: border-box;
  241. }
  242. .search-item .picker {
  243. line-height: 80rpx;
  244. color: #606266;
  245. }
  246. .search-buttons {
  247. display: flex;
  248. gap: 20rpx;
  249. margin-top: 20rpx;
  250. }
  251. .search-buttons button {
  252. flex: 1;
  253. }
  254. .modern-card {
  255. background: #fff;
  256. border-radius: 18rpx;
  257. margin-bottom: 32rpx;
  258. box-shadow: 0 6rpx 16rpx rgba(0, 0, 0, 0.08);
  259. overflow: hidden;
  260. transition: box-shadow 0.2s;
  261. border: 1rpx solid #f0f0f0;
  262. }
  263. .modern-card-header {
  264. display: flex;
  265. justify-content: space-between;
  266. align-items: center;
  267. background: linear-gradient(90deg, #e0e7ff 0%, #f8fafc 100%);
  268. padding: 24rpx 28rpx 16rpx 28rpx;
  269. }
  270. .modern-card-title {
  271. display: flex;
  272. flex-direction: column;
  273. }
  274. .project-number {
  275. font-size: 26rpx;
  276. color: #6366f1;
  277. font-weight: 600;
  278. }
  279. .project-name {
  280. font-size: 28rpx;
  281. color: #22223b;
  282. font-weight: bold;
  283. margin-top: 4rpx;
  284. }
  285. .amount-highlight {
  286. background: #fef3c7;
  287. color: #d97706;
  288. font-size: 32rpx;
  289. font-weight: bold;
  290. border-radius: 10rpx;
  291. padding: 8rpx 20rpx;
  292. min-width: 120rpx;
  293. text-align: center;
  294. }
  295. .amount-highlight-detail {
  296. background: #fef3c7;
  297. color: #d97706;
  298. font-size: 28rpx;
  299. font-weight: bold;
  300. border-radius: 10rpx;
  301. padding: 4rpx 18rpx;
  302. margin-left: 8rpx;
  303. }
  304. .manager-amount-highlight-detail {
  305. background: #d4f3e9;
  306. color: #10b981;
  307. font-size: 28rpx;
  308. font-weight: bold;
  309. border-radius: 10rpx;
  310. padding: 4rpx 18rpx;
  311. margin-left: 8rpx;
  312. }
  313. .modern-card-body {
  314. padding: 20rpx 28rpx 24rpx 28rpx;
  315. }
  316. .avatar-section {
  317. display: flex;
  318. align-items: center;
  319. margin-bottom: 18rpx;
  320. }
  321. .avatar {
  322. width: 56rpx;
  323. height: 56rpx;
  324. border-radius: 50%;
  325. background: #a5b4fc;
  326. color: #fff;
  327. display: flex;
  328. align-items: center;
  329. justify-content: center;
  330. font-size: 28rpx;
  331. font-weight: bold;
  332. margin-right: 18rpx;
  333. }
  334. .applier-name {
  335. font-size: 28rpx;
  336. color: #22223b;
  337. font-weight: 500;
  338. }
  339. .dept-name {
  340. font-size: 24rpx;
  341. color: #64748b;
  342. margin-left: 8rpx;
  343. }
  344. .info-row {
  345. display: flex;
  346. margin-bottom: 10rpx;
  347. }
  348. .info-label {
  349. color: #64748b;
  350. font-size: 24rpx;
  351. min-width: 120rpx;
  352. }
  353. .info-value {
  354. color: #22223b;
  355. font-size: 24rpx;
  356. flex: 1;
  357. word-break: break-all;
  358. }
  359. .modern-card-footer {
  360. display: flex;
  361. justify-content: flex-end;
  362. gap: 20rpx;
  363. padding: 16rpx 28rpx 20rpx 28rpx;
  364. border-top: 1px solid #f0f0f0;
  365. background: #fafbfc;
  366. }
  367. .footer-btn {
  368. font-size: 26rpx;
  369. border-radius: 8rpx;
  370. border: none;
  371. outline: none;
  372. background: #e0e7ff;
  373. color: #3b3b4f;
  374. }
  375. .detail-btn {
  376. background: #6366f1;
  377. color: #fff;
  378. }
  379. .form-btn {
  380. background: #f4c542;
  381. color: #fff;
  382. }
  383. .popup-detail-list {
  384. padding: 32rpx 24rpx 48rpx 24rpx;
  385. background: #fff;
  386. border-radius: 24rpx 24rpx 0 0;
  387. min-height: 300rpx;
  388. max-height: 70vh;
  389. overflow-y: auto;
  390. position: relative;
  391. }
  392. .popup-detail-title {
  393. font-size: 32rpx;
  394. font-weight: bold;
  395. color: #22223b;
  396. margin-bottom: 24rpx;
  397. text-align: center;
  398. }
  399. .popup-detail-item {
  400. display: flex;
  401. align-items: flex-start;
  402. background: #f7f8fa;
  403. border-radius: 12rpx;
  404. margin-bottom: 18rpx;
  405. padding: 18rpx 16rpx;
  406. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.04);
  407. }
  408. .popup-detail-index {
  409. width: 44rpx;
  410. height: 44rpx;
  411. background: #6366f1;
  412. color: #fff;
  413. border-radius: 50%;
  414. display: flex;
  415. align-items: center;
  416. justify-content: center;
  417. font-size: 24rpx;
  418. font-weight: bold;
  419. margin-right: 18rpx;
  420. }
  421. .popup-detail-main {
  422. flex: 1;
  423. }
  424. .popup-detail-row {
  425. display: flex;
  426. align-items: center;
  427. margin-bottom: 8rpx;
  428. }
  429. .popup-detail-label {
  430. color: #64748b;
  431. font-size: 24rpx;
  432. min-width: 120rpx;
  433. }
  434. .popup-detail-value {
  435. color: #22223b;
  436. font-size: 24rpx;
  437. }
  438. .popup-detail-amount {
  439. color: #d97706;
  440. font-size: 28rpx;
  441. font-weight: bold;
  442. margin-left: 8rpx;
  443. }
  444. .popup-detail-manager-amount {
  445. color: #10b981;
  446. font-size: 28rpx;
  447. font-weight: bold;
  448. margin-left: 8rpx;
  449. }
  450. .popup-close-btn {
  451. position: absolute;
  452. right: 24rpx;
  453. top: 18rpx;
  454. font-size: 40rpx;
  455. color: #999;
  456. z-index: 10;
  457. cursor: pointer;
  458. line-height: 1;
  459. }
  460. </style>