donate.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. <template>
  2. <view class="donate-wrapper">
  3. <view class="top-select flex">
  4. <view class="">选择地区</view>
  5. <picker @change="bindAreaChange" :range="areas">
  6. <view class="area select" :class="{'action': area }">{{ area || '点击选择地区' }}</view>
  7. </picker>
  8. <picker @change="bindStatusChange" :range="statuss">
  9. <view class="status select" :class="{'action': status }">{{ status }}</view>
  10. </picker>
  11. </view>
  12. <view class="item-wrapper">
  13. <view class="item flex" v-for="item in list" >
  14. <view class="item-left">
  15. <image :src="item.img" mode=""></image>
  16. </view>
  17. <view class="item-right">
  18. <view class="item-title clamp">{{item.title}}</view>
  19. <view class="item-content clamp2">{{item.info}}</view>
  20. <view class="item-status">捐赠进度<text>{{item.project_progress}}%</text></view>
  21. <view class="item-btn" :class="{'btn-active': item.status === 0}" @click="join(item.id)">{{item.status===0?'我要捐赠':'已结束'}}</view>
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. </template>
  27. <script>
  28. import {getProjectList,getProjectInfo} from '../../api/money.js'
  29. export default {
  30. data() {
  31. return {
  32. areas: ['沙市区红十字会','荆州区红十字会','石首区红十字会','洪湖区红十字会','松滋区红十字会','监利区红十字会','公安县红十字会','江陵县红十字会'],
  33. area: '',
  34. statuss: ['全部','进行中','已结束'],
  35. status: '全部',
  36. ceshiList: [
  37. {
  38. id: '1',
  39. title: '夏天里的清凉夏天里的清凉夏天里的清凉夏天里的清凉夏天里的清凉',
  40. content: '荆州市阳光孤儿院成立于2021年,荆州市红 十字会向社会募集各种空调荆州市阳光孤儿院成立于2021年,荆州市红 十字会向社会募集各种空调',
  41. status: 0,
  42. jindu: 99
  43. },
  44. {
  45. id: '2',
  46. title: '夏天里的清凉',
  47. content: '荆州市阳光孤儿院成立于2021年,荆州市红 十字会向社会募集各种空调荆州市阳光孤儿院成立于2021年,荆州市红 十字会向社会募集各种空调',
  48. status: 1,
  49. jindu: 100
  50. },
  51. {
  52. id: '3',
  53. title: '夏天里的清凉',
  54. content: '荆州市阳光孤儿院成立于2021年,荆州市红 十字会向社会募集各种空调荆州市阳光孤儿院成立于2021年,荆州市红 十字会向社会募集各种空调',
  55. status: 0,
  56. jindu: 20
  57. },
  58. ],
  59. list: []
  60. }
  61. },
  62. onLoad() {
  63. this.loadDate()
  64. },
  65. methods: {
  66. bindAreaChange(e) {
  67. console.log(e.target)
  68. this.area = this.areas[e.target.value]
  69. },
  70. bindStatusChange(e) {
  71. console.log(e.target)
  72. this.status = this.statuss[e.target.value]
  73. },
  74. join(id) {
  75. console.log(id)
  76. uni.navigateTo({
  77. url: '/pages/donate/donateDetail?id=' +id
  78. })
  79. console.log('dddddddddd')
  80. },
  81. async loadDate() {
  82. getProjectList({
  83. page: 1,
  84. limit: 1000
  85. }).then( ({data}) => {
  86. // console.log(res,'+++++++++++++++++')
  87. let list = []
  88. data.list.map( item => {
  89. getProjectInfo({
  90. id: item.id
  91. }).then( res => {
  92. let data = JSON.parse(res.msg)
  93. // console.log( data.project_progress,'999999999999999')
  94. item.project_progress = data.project_progress
  95. item.info = item.info.replace(/<[^>]+>/g, "")
  96. console.log(item)
  97. this.list.push(item)
  98. return item
  99. })
  100. })
  101. console.log(this.list,'5555555')
  102. })
  103. }
  104. }
  105. }
  106. </script>
  107. <style lang="scss" scoped>
  108. .donate-wrapper {
  109. padding-top: 25rpx;
  110. }
  111. .top-select {
  112. font-size: 30rpx;
  113. font-family: PingFang SC;
  114. font-weight: 500;
  115. color: #333333;
  116. height: 63rpx;
  117. line-height: 63rpx;
  118. padding: 0 20rpx 0 19rpx;
  119. margin-bottom: 20rpx;
  120. .select {
  121. padding-left: 40rpx;
  122. background: #FFFFFF;
  123. border-radius: 5rpx;
  124. font-size: 26rpx;
  125. font-family: PingFang SC;
  126. font-weight: 500;
  127. color: #999999;
  128. line-height: 63rpx;
  129. position: relative;
  130. &::after {
  131. content: '';
  132. width: 0;
  133. height: 0;
  134. border-left: 10rpx solid transparent;
  135. border-right: 10rpx solid transparent;
  136. border-top: 10rpx solid #808080;
  137. position: absolute;
  138. right: 30rpx;
  139. bottom: 26rpx;
  140. }
  141. }
  142. .area {
  143. width: 355rpx;
  144. height: 63rpx;
  145. margin: 0 10rpx 0 24rpx;
  146. }
  147. .status {
  148. width: 204rpx;
  149. height: 63rpx;
  150. }
  151. .action {
  152. color: #000;
  153. }
  154. }
  155. .item-wrapper {
  156. padding: 0 20rpx;
  157. .item {
  158. width: 710rpx;
  159. height: 280rpx;
  160. background: #FFFFFF;
  161. box-shadow: 0px 0px 20rpx 0rpx rgba(50, 50, 52, 0.06);
  162. border-radius: 8rpx;
  163. padding:40rpx 20rpx;
  164. margin-bottom: 20rpx;
  165. .item-left {
  166. width: 190rpx;
  167. height: 200rpx;
  168. border-radius: 10rpx;
  169. image {
  170. width: 190rpx;
  171. height: 200rpx;
  172. border-radius: 10rpx;
  173. }
  174. }
  175. .item-right {
  176. padding-left: 22rpx;
  177. position: relative;
  178. .item-title {
  179. width: 316rpx;
  180. font-size: 30rpx;
  181. font-family: PingFang SC;
  182. font-weight: 500;
  183. color: #333333;
  184. overflow: hidden;
  185. text-overflow: ellipsis;
  186. white-space: nowrap;
  187. display: block;
  188. line-height: 1;
  189. padding-bottom: 14rpx;
  190. }
  191. .item-content {
  192. width: 416rpx;
  193. font-size: 22rpx;
  194. font-family: PingFang SC;
  195. font-weight: 400;
  196. color: #999999;
  197. line-height: 1.5;
  198. }
  199. .item-status {
  200. font-size: 24rpx;
  201. font-family: PingFang SC;
  202. font-weight: 500;
  203. color: #666666;
  204. line-height: 1.5;
  205. position: absolute;
  206. left: 22rpx;
  207. bottom: 0;
  208. text {
  209. color: #E80000;
  210. font-weight: bold;
  211. }
  212. }
  213. .item-btn {
  214. width: 160rpx;
  215. height: 60rpx;
  216. background: #F2F2F2;
  217. border-radius: 30px;
  218. font-size: 28rpx;
  219. font-family: PingFang SC;
  220. font-weight: 500;
  221. color: #999999;
  222. line-height: 60rpx;
  223. text-align: center;
  224. position: absolute;
  225. right: -42rpx;
  226. bottom: -9rpx;
  227. }
  228. .btn-active {
  229. background: #FA7E67;
  230. color: #fff;
  231. box-shadow: 0px 2px 20px 0px rgba(250, 126, 103, 0.5);
  232. }
  233. }
  234. }
  235. }
  236. </style>