loveList.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  1. <template>
  2. <div class="love-list">
  3. <div class="cate">
  4. <div class="hand" :class="{'red': currentUrl.indexOf('lovelist') != -1}" @click="gotos('/donate/lovelist')">款项捐赠公示</div>
  5. <div class="hand" :class="{'red': currentUrl.indexOf('wuzhilist') != -1}" @click="gotos('/donate/wuzhilist')">物资捐赠公示</div>
  6. </div>
  7. <div style="padding-bottom: 15px;">款项到账后,我们将为捐赠者开具公益事业捐赠统一票据,如需请致电027-60229370,提供开票信息,谢谢合作!</div>
  8. <div class="search-wrap flex">
  9. <span class="name">
  10. 捐赠者:
  11. </span><el-input class="inp" v-model="name" placeholder="请输入捐赠者"></el-input>
  12. <span class="name">
  13. 金额:
  14. </span><el-input class="inp" v-model="money" placeholder="请输入金额"></el-input>
  15. <span class="name">
  16. 捐赠时间:
  17. </span>
  18. <el-date-picker v-model="value2" type="daterange" align="right" unlink-panels range-separator="至"
  19. start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOptions"
  20. value-format="yyyy-MM-dd" @change="dateChange">
  21. </el-date-picker>
  22. <div class="go" @click="search('re')">提交查询</div>
  23. </div>
  24. <div class="list-title flex">
  25. <div style="width: 35%">捐赠方</div>
  26. <div style="width: 15%">捐赠金额</div>
  27. <div style="width: 15%">捐赠时间</div>
  28. <div style="width: 35%">用途</div>
  29. <!-- <div style="width: 133px">备注</div> -->
  30. </div>
  31. <div class="list-item flex" v-for="(item, index) in tableData" :key="index">
  32. <div class="clamp" style="width: 35%">{{item.donate_er}}</div>
  33. <div class="clamp" style="width: 15%">{{item.money}}</div>
  34. <div class="clamp" style="width: 15%">{{item.time}}</div>
  35. <div class="clamp" style="width: 35%">{{item.intention}}</div>
  36. <!-- <div class="clamp" style="width: 133px">{{item.mask}}</div> -->
  37. </div>
  38. <div class="table-empty" v-if="tableData.length == 0">
  39. 暂无更多捐赠数据
  40. </div>
  41. <el-pagination layout="prev, pager, next" :total="total" background prev-text="上一页" next-text="下一页"
  42. @current-change="currentChange" :page-size="limit" hide-on-single-page></el-pagination>
  43. </div>
  44. </template>
  45. <script>
  46. import {
  47. loveList,
  48. searchLoveList
  49. } from '../../request/api.js'
  50. import {
  51. Message
  52. } from 'element-ui'
  53. export default {
  54. data() {
  55. return {
  56. sdata: '',
  57. tableData: [],
  58. total: 100,
  59. page: 1,
  60. limit: 14,
  61. name: '',
  62. money: '',
  63. pickerOptions: {
  64. shortcuts: [{
  65. text: '最近一周',
  66. onClick(picker) {
  67. const end = new Date();
  68. const start = new Date();
  69. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
  70. picker.$emit('pick', [start, end]);
  71. }
  72. }, {
  73. text: '最近一个月',
  74. onClick(picker) {
  75. const end = new Date();
  76. const start = new Date();
  77. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
  78. picker.$emit('pick', [start, end]);
  79. }
  80. }, {
  81. text: '最近三个月',
  82. onClick(picker) {
  83. const end = new Date();
  84. const start = new Date();
  85. start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
  86. picker.$emit('pick', [start, end]);
  87. }
  88. }]
  89. },
  90. value1: '',
  91. value2: ''
  92. };
  93. },
  94. created() {
  95. // this.getLiveList()
  96. this.search()
  97. },
  98. computed: {
  99. currentUrl() {
  100. return this.$route.path
  101. }
  102. },
  103. methods: {
  104. gotos(path) {
  105. let currentUrl = this.$route.path
  106. if (currentUrl === path) {
  107. return
  108. } else {
  109. this.$router.push(path)
  110. }
  111. },
  112. dateChange(e) {
  113. console.log(e)
  114. if(e) {
  115. this.sdata = this.value2[0] + ' - ' + this.value2[1]
  116. }else {
  117. this.sdata = ''
  118. }
  119. },
  120. //分页页码改变触发事件
  121. currentChange(e) {
  122. console.log(e);
  123. this.page = e
  124. this.getLiveList()
  125. },
  126. getLiveList() {
  127. let obj = this
  128. let data = {
  129. page: obj.page,
  130. limit: obj.limit
  131. }
  132. loveList(data).then(res => {
  133. obj.tableData = res.data.list.map(item => {
  134. if (item.intention === '') {
  135. item.intention = '非定向捐款'
  136. }
  137. let date = new Date(item.add_time * 1000)
  138. let Y = date.getFullYear()
  139. let M = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() +
  140. 1;
  141. let D = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();
  142. item.time = Y + '/' + M + '/' + D
  143. return item
  144. })
  145. obj.total = res.data.count
  146. console.log(obj.tableData)
  147. })
  148. },
  149. search(type) {
  150. console.log(this.name)
  151. let obj = this
  152. if(type == 're') {
  153. obj.page = 1
  154. obj.tableData = []
  155. }
  156. let data = {
  157. page: obj.page,
  158. limit: obj.limit,
  159. key: obj.name,
  160. data: obj.sdata,
  161. money: obj.money
  162. }
  163. searchLoveList(data).then(res => {
  164. // console.log(res, 'dddddddddddd')
  165. let arr = res.data.data
  166. if (arr.length !== 0) {
  167. // Message.success('数据加载完成!')
  168. } else {
  169. Message('未找到数据。')
  170. }
  171. obj.total = res.data.count
  172. obj.tableData = arr.map(item => {
  173. if (item.intention === '') {
  174. item.intention = '非定向捐款'
  175. }
  176. let date = new Date(item.pay_time * 1000)
  177. let Y = date.getFullYear()
  178. let M = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() +
  179. 1;
  180. let D = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();
  181. item.time = Y + '/' + M + '/' + D
  182. return item
  183. })
  184. })
  185. }
  186. }
  187. };
  188. </script>
  189. <style lang="scss" scoped>
  190. .love-list {
  191. height: 870px;
  192. position: relative;
  193. }
  194. /deep/ .el-table thead th {
  195. font-size: 18px;
  196. font-weight: bold;
  197. // color: #d82020;
  198. color: gray;
  199. }
  200. /deep/ .el-table tr td {
  201. font-size: 16px;
  202. font-family: PingFang SC;
  203. font-weight: bold;
  204. color: #101010;
  205. padding: 11px 0;
  206. line-height: 1;
  207. }
  208. /deep/ .el-pagination {
  209. position: absolute;
  210. display: inline-block;
  211. bottom: 75px;
  212. right: 0;
  213. padding-right: 0;
  214. }
  215. .search {
  216. margin-left: 879px;
  217. padding-left: 13px;
  218. padding-right: 13px;
  219. width: 295px;
  220. height: 33px;
  221. line-height: 33px;
  222. background: #FFFFFF;
  223. border: 1px solid #CCCCCC;
  224. border-radius: 10px;
  225. margin-bottom: 10px;
  226. display: flex;
  227. justify-content: space-between;
  228. align-items: center;
  229. input {
  230. width: 235px;
  231. font-size: 16px;
  232. font-family: PingFang SC;
  233. font-weight: bold;
  234. outline: none;
  235. border: none;
  236. }
  237. img {
  238. width: 20px;
  239. height: 20px;
  240. }
  241. }
  242. .tabb {
  243. border-right: 1px solid #000000;
  244. border-bottom: 1px solid #000000;
  245. }
  246. .list-title {
  247. // display: flex;
  248. text-align: center;
  249. border: 2px solid #ccc;
  250. line-height: 36px;
  251. font-size: 18px;
  252. font-family: PingFang SC;
  253. font-weight: bold;
  254. color: #D82020;
  255. // border-top: none;
  256. div {
  257. border-right: 2px solid #ccc;
  258. &:last-of-type {
  259. border-right: none;
  260. }
  261. }
  262. }
  263. .list-item {
  264. text-align: center;
  265. border: 2px solid #ccc;
  266. font-size: 16px;
  267. line-height: 36px;
  268. font-family: PingFang SC;
  269. font-weight: bold;
  270. color: #101010;
  271. border-top: none;
  272. div {
  273. border-right: 2px solid #ccc;
  274. font-size: 15px;
  275. font-weight: 500;
  276. &:last-of-type {
  277. border-right: none;
  278. }
  279. }
  280. }
  281. .table-empty {
  282. // width: 100%;
  283. text-align: center;
  284. border: 2px solid #F2F2F2;
  285. font-size: 16px;
  286. line-height: 36px;
  287. font-family: PingFang SC;
  288. font-weight: bold;
  289. border-top: none;
  290. }
  291. .search-wrap {
  292. font-size: 16px;
  293. align-items: center;
  294. padding: 0 0 20px 0;
  295. width: 100%;
  296. justify-content: space-between;
  297. .inp {
  298. width: 120px;
  299. color: #000000;
  300. }
  301. .name {
  302. // padding: 0 10px;
  303. }
  304. .go {
  305. width: 80px;
  306. height: 40px;
  307. background-color: #be0202;
  308. color: #FFFFFF;
  309. display: flex;
  310. justify-content: center;
  311. align-items: center;
  312. }
  313. }
  314. /deep/ .el-input__inner {
  315. // background: #dddddd;
  316. }
  317. /deep/ .el-range-input {
  318. // background: #dddddd;
  319. }
  320. /deep/ .el-date-editor {
  321. width: 300px;
  322. }
  323. .cate {
  324. font-size: 20px;
  325. display: flex;
  326. border-bottom: 1px solid #ddd;
  327. margin-bottom: 20px;
  328. div {
  329. width: 200px;
  330. height: 50px;
  331. display: flex;
  332. align-items: center;
  333. justify-content: center;
  334. }
  335. }
  336. .red {
  337. color: #be0202;
  338. }
  339. </style>