donateDetail.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715
  1. <template>
  2. <view class="detail">
  3. <view class="top">
  4. <image :src="proInfo.img" mode=""></image>
  5. <view class="title clamp">{{ proInfo.title }}</view>
  6. <view class="tip">
  7. <view class=""></view>
  8. 基本信息
  9. </view>
  10. <view class="base-info">
  11. <view class="item">
  12. <text>捐赠进度</text>
  13. <text class="status">{{ proInfo.project_progress }}%</text>
  14. </view>
  15. <view class="item">
  16. <text>创立时间</text>
  17. {{ proInfo.add_time | time }}
  18. </view>
  19. <view class="item">
  20. <text>开始时间</text>
  21. {{ proInfo.start_time | time }}
  22. </view>
  23. <view class="item">
  24. <text>结束时间</text>
  25. {{ proInfo.end_time | time }}
  26. </view>
  27. </view>
  28. <view class="dynamic flex" v-if="newItem">
  29. <view class="left">实时动态</view>
  30. <view class="right flex">
  31. <view>捐赠时间:{{ newItem.add_time | time }}</view>
  32. <view>
  33. 捐赠人:
  34. <text>{{ newItem.name | name }}</text>
  35. </view>
  36. <view class="clamp" style="width: 500rpx;">捐赠数量:{{ newItem.item | item(typeList) }}</view>
  37. </view>
  38. </view>
  39. </view>
  40. <view class="content">
  41. <view class="content-nav flex">
  42. <view class="nav-item" v-for="(item, index) in navList" :key="index" :class="{ active: currentIndex === index }" @click="navClick(index)">{{ item }}</view>
  43. </view>
  44. </view>
  45. <view v-if="currentIndex === 0">
  46. <view class="item-detail" ref="swiperItemOne">
  47. <view class="tip">
  48. <view class=""></view>
  49. 捐赠介绍
  50. </view>
  51. <view class="item-content" v-html="proInfo.info"></view>
  52. <view class="tip">
  53. <view class=""></view>
  54. 项目需求
  55. </view>
  56. <view class="item-needs">
  57. <view class="need-item" v-for="item in proInfo.project_donation_info">
  58. <view class="">
  59. {{ item.project_donation_id | type(typeList) }}:
  60. <text>{{ item.project_donation_num }}</text>
  61. </view>
  62. <view class="">
  63. 最低需求捐赠数:
  64. <text>{{ item.project_donation_num }}</text>
  65. </view>
  66. <view class="">
  67. 物资捐赠要求:
  68. <text>全新</text>
  69. </view>
  70. </view>
  71. <!-- <view class="need-item">
  72. <view class="">
  73. 帐篷类(帐篷):
  74. <text>500</text>
  75. </view>
  76. <view class="">
  77. 最低需求捐赠数:
  78. <text>500</text>
  79. </view>
  80. <view class="">
  81. 物资捐赠要求:
  82. <text>全新</text>
  83. </view>
  84. </view> -->
  85. </view>
  86. </view>
  87. </view>
  88. <view v-else class="feedback">
  89. <view class="feedback-nav">
  90. <view class="nav-item" :class="{ action: navCurrentIndex === 0 }" @click="lookmore(0)">全部</view>
  91. <view class="nav-item" :class="{ action: navCurrentIndex === 1 }" @click="lookmore(1)">已成功</view>
  92. <view class="nav-item nav-item-err" :class="{ action: navCurrentIndex === 2 }" @click="lookmore(2)">已失败</view>
  93. </view>
  94. <view class="feedback-content">
  95. <view class="overall" v-if="navCurrentIndex === 0">
  96. <view class="title">项目整体反馈</view>
  97. <view class="content">截止2021年6月10日,荆州市红十字会已将捐赠的消毒液1120瓶和帐篷200顶,500箱矿泉水全数发往阳光福利院。</view>
  98. </view>
  99. <view class="feedback-item">
  100. <view class="item-top">
  101. <image src="" mode=""></image>
  102. <view class="item-name-time">
  103. <view class="item-name">荆州捐赠</view>
  104. <view class="item-time">2021年06月10日 22:25:14</view>
  105. </view>
  106. </view>
  107. <view class="item-content">
  108. <text>荆州XXXX有限分公司</text>
  109. 2021年6月10日,荆州市红十字会已将贵公司捐赠的消毒液1120瓶和帐篷200顶,发往阳光福利院。
  110. </view>
  111. </view>
  112. </view>
  113. </view>
  114. <view class="btn-wrapper flex" v-if="isBottom">
  115. <view class="btn1 btn" @click="navTo('/pages/donate/progress?id=' + proInfo.id)">实时进展</view>
  116. <view class="btn2 btn" @click="want()">我要捐款</view>
  117. </view>
  118. <uni-popup ref="popup" type="center">
  119. <view class="type-box">
  120. <image src="../../static/img/sele.png" mode="" class="bg"></image>
  121. <view class="box-title">捐款类型</view>
  122. <view class="box-tip">请选择您的捐赠身份类型</view>
  123. <view class="box-btn" @click="chooseType(0)">
  124. <image src="" mode=""></image>
  125. <view class="btn-title">个人捐赠</view>
  126. <view class="qq" :class="{ action: jxType === 0 }"><view class="yx"></view></view>
  127. </view>
  128. <view class="box-btn" @click="chooseType(1)">
  129. <image src="" mode=""></image>
  130. <view class="">企业(团队)捐赠</view>
  131. <view class="qq" :class="{ action: jxType === 1 }"><view class="yx"></view></view>
  132. </view>
  133. <view class="qr" @click="qr()">确认</view>
  134. </view>
  135. </uni-popup>
  136. </view>
  137. </template>
  138. <script>
  139. import { getProjectInfo, createProject, getDonationInfo, getAllOrder } from '../../api/money.js';
  140. let that;
  141. export default {
  142. data() {
  143. return {
  144. navList: ['捐赠详情', '捐赠反馈'],
  145. currentIndex: 0,
  146. swiperHeight: 0,
  147. navCurrentIndex: 0,
  148. jxType: 0,
  149. pid: 0,
  150. proInfo: {},
  151. typeList: [], //物资分类列表
  152. newItem: null ,//最新动态,
  153. isBottom: false
  154. };
  155. },
  156. onReachBottom() {
  157. this.isBottom = true
  158. },
  159. filters: {
  160. time(val) {
  161. let str = '';
  162. // console.log(val)
  163. if (val) {
  164. let date = new Date(val * 1000);
  165. let Y = date.getFullYear();
  166. let M = date.getMonth() > 9 ? date.getMonth() : '0' + date.getMonth();
  167. let D = date.getDate() > 9 ? date.getDate() : '0' + date.getDate();
  168. str = Y + '年' + M + '月' + D + '日';
  169. }
  170. return str;
  171. },
  172. type(val, typeList) {
  173. let str = '';
  174. let arr = typeList;
  175. let len = arr.length;
  176. for (let i = 0; i < len; i++) {
  177. if (arr[i].id === val) {
  178. return (str = arr[i].name);
  179. }
  180. }
  181. },
  182. name(val, typeList) {
  183. let str = '';
  184. if (val) {
  185. str = val.substr(0, 1);
  186. }
  187. return str + '**';
  188. },
  189. item(val, typeList) {
  190. let str = '';
  191. if (val) {
  192. let arr = val.map(item => {
  193. for (let i = 0; i < typeList.length; i++) {
  194. if (item.project_donation_id == typeList[i].id) {
  195. str = str + typeList[i].name + ' ' + item.project_donation_num + ' ' + '个 ';
  196. }
  197. }
  198. });
  199. }
  200. return str;
  201. }
  202. },
  203. onLoad(opt) {
  204. console.log('onLoadonLoadonLoadonLoadonLoadonLoadonLoadonLoad')
  205. that = this;
  206. this.pid = opt.id;
  207. console.log(this.pid,'5555555555555555555555')
  208. this.getNewOrder();
  209. this.loadDate(this.pid);
  210. this.getDonationInfo();
  211. },
  212. methods: {
  213. loadDate(id) {
  214. getProjectInfo({
  215. id: id
  216. }).then(res => {
  217. let data = JSON.parse(res.msg);
  218. console.log(data, 'loaddata++++++++++');
  219. data.info = data.info.replace(/<img /g, '<img style="width:100%"');
  220. this.proInfo = data;
  221. console.log(this.proInfo,'this.proInfo++++++++++++++++')
  222. let arr = this.proInfo.project_donation_info;
  223. let len = arr.length;
  224. let map = {},
  225. dest = [];
  226. for (var i = 0; i < len; i++) {
  227. var ai = arr[i];
  228. if (!map[ai.project_donation_id]) {
  229. // dest.push({
  230. // id: ai.id,
  231. // pro_id: ai.pro_id,
  232. // project_donation_id: ai.project_donation_id,
  233. // project_donation_num: ai.project_donation_num,
  234. // received: ai.received,
  235. // send_num: ai.send_num,
  236. // transport: ai.transport
  237. // });
  238. dest.push(ai)
  239. map[ai.project_donation_id] = ai;
  240. } else {
  241. for (var j = 0; j < dest.length; j++) {
  242. var dj = dest[j];
  243. if (dj.project_donation_id == ai.project_donation_id) {
  244. dj.project_donation_num = dj.project_donation_num + ai.project_donation_num
  245. dj.received = dj.received + ai.received
  246. dj.send_num = dj.send_num + ai.send_num
  247. dj.transport = dj.transport + ai.transport
  248. break;
  249. }
  250. }
  251. }
  252. }
  253. this.proInfo.project_donation_info = dest
  254. console.log(this.proInfo.project_donation_info, 'proInfo.item++++++++++++++++++++++++++');
  255. });
  256. },
  257. navTo(url) {
  258. uni.navigateTo({
  259. url: url
  260. });
  261. },
  262. navClick(index) {
  263. this.currentIndex = index;
  264. },
  265. lookmore(index) {
  266. this.navCurrentIndex = index;
  267. },
  268. want() {
  269. this.$refs.popup.open();
  270. },
  271. chooseType(index) {
  272. this.jxType = index;
  273. },
  274. qr() {
  275. this.$refs.popup.close();
  276. let wzList = [];
  277. let list = this.proInfo.project_donation_info;
  278. list.map(item => {
  279. for (let i = 0; i < this.typeList.length; i++) {
  280. if (item.project_donation_id === this.typeList[i].id) {
  281. wzList.push(this.typeList[i]);
  282. }
  283. }
  284. });
  285. console.log(wzList, '**************************************');
  286. this.navTo('/pages/donate/idonate?type=' + this.jxType + '&id=' + this.proInfo.id + '&wzlist=' + JSON.stringify(wzList));
  287. },
  288. //获取物资分类列表
  289. getDonationInfo() {
  290. getDonationInfo().then(({ data }) => {
  291. this.typeList = data;
  292. console.log(this.typeList, '获取所有物资');
  293. });
  294. },
  295. getNewOrder() {
  296. getAllOrder({
  297. project_id: this.pid,
  298. page: 1,
  299. limit: 1
  300. }).then(({ data }) => {
  301. if(data.count!== 0){
  302. console.log(data, '999999999999999999999999');
  303. // this.newItem = data.list[0];
  304. this.$set(this,'newItem', data.list[0])
  305. console.log(this.newItem, '88888888888888888');
  306. }
  307. });
  308. },
  309. getItem(item) {
  310. // this.getDonationInfo()
  311. let str = '';
  312. console.log(item);
  313. if (item) {
  314. item.forEach(item => {
  315. for (let i = 0; i < this.typeList.length; i++) {
  316. if (item.project_donation_id === this.typeList[i].project_donation_id) {
  317. str = str + this.typeList[i].project_donation_name + item.project_donation_num + '个';
  318. }
  319. }
  320. });
  321. }
  322. console.log(str, '222222222222222222');
  323. return str;
  324. }
  325. }
  326. };
  327. </script>
  328. <style lang="scss" scoped>
  329. page {
  330. width: 100%;
  331. }
  332. .top {
  333. // height: 863rpx;
  334. background-color: #fff;
  335. border-top: 1rpx solid #f6f6f6;
  336. padding-top: 33rpx;
  337. margin-bottom: 20rpx;
  338. image {
  339. display: block;
  340. width: 680rpx;
  341. height: 375rpx;
  342. border-radius: 20rpx;
  343. margin: 0 auto;
  344. // background-color: red;
  345. }
  346. .title {
  347. width: 580rpx;
  348. font-size: 32rpx;
  349. font-family: PingFang SC;
  350. font-weight: bold;
  351. color: #333333;
  352. line-height: 1;
  353. padding-top: 28rpx;
  354. padding-left: 42rpx;
  355. margin-bottom: 39rpx;
  356. }
  357. .base-info {
  358. font-size: 27rpx;
  359. font-family: PingFang SC;
  360. font-weight: 500;
  361. color: #999999;
  362. line-height: 1;
  363. display: flex;
  364. padding: 0 56rpx;
  365. flex-wrap: wrap;
  366. .item {
  367. width: 50%;
  368. padding-bottom: 40rpx;
  369. .status {
  370. color: red;
  371. font-weight: bold;
  372. }
  373. text {
  374. font-size: 26rpx;
  375. font-family: PingFang SC;
  376. font-weight: 500;
  377. color: #666666;
  378. display: inline-block;
  379. margin-right: 15rpx;
  380. }
  381. }
  382. }
  383. .dynamic {
  384. width: 666rpx;
  385. height: 111rpx;
  386. background: #efefef;
  387. border-radius: 10rpx;
  388. margin: 5rpx auto 0;
  389. .left {
  390. width: 115rpx;
  391. height: 111rpx;
  392. background: #5c93fc;
  393. border-radius: 10rpx 0px 0px 10rpx;
  394. font-size: 28rpx;
  395. font-family: PingFang SC;
  396. font-weight: 500;
  397. color: #ffffff;
  398. line-height: 34rpx;
  399. padding: 22rpx 29rpx;
  400. margin-right: 15rpx;
  401. }
  402. .right {
  403. font-size: 22rpx;
  404. font-family: PingFang SC;
  405. font-weight: 400;
  406. color: #333333;
  407. line-height: 1;
  408. padding: 12rpx 0;
  409. flex-direction: column;
  410. justify-content: space-between;
  411. text {
  412. color: red;
  413. font-weight: bold;
  414. }
  415. }
  416. }
  417. }
  418. .content {
  419. .content-nav {
  420. height: 82rpx;
  421. background: #ffffff;
  422. font-size: 30rpx;
  423. font-family: PingFang SC;
  424. font-weight: 500;
  425. color: #999999;
  426. line-height: 82rpx;
  427. justify-content: space-around;
  428. .active {
  429. border-bottom: 4rpx solid #fa7e67;
  430. color: #fa7e67;
  431. font-weight: bold;
  432. }
  433. }
  434. }
  435. .tip {
  436. margin-left: 42rpx;
  437. font-size: 30rpx;
  438. font-family: PingFang SC;
  439. font-weight: bold;
  440. color: #333333;
  441. line-height: 1;
  442. margin-bottom: 34rpx;
  443. view {
  444. display: inline-block;
  445. width: 4rpx;
  446. height: 30rpx;
  447. background: #fa7e67;
  448. border-radius: 2rpx;
  449. margin-right: 9rpx;
  450. position: relative;
  451. bottom: -2rpx;
  452. }
  453. }
  454. .btn-wrapper {
  455. .btn {
  456. width: 50%;
  457. text-align: center;
  458. height: 99rpx;
  459. line-height: 99rpx;
  460. font-size: 34rpx;
  461. font-family: PingFang SC;
  462. font-weight: 500;
  463. color: #ffffff;
  464. }
  465. .btn1 {
  466. background-color: #f7c03e;
  467. }
  468. .btn2 {
  469. background-color: #fa7e67;
  470. }
  471. }
  472. .item-detail {
  473. padding-top: 42rpx;
  474. .item-content {
  475. padding: 0 78rpx 0 48rpx;
  476. font-size: 26rpx;
  477. font-family: PingFang SC;
  478. font-weight: 500;
  479. color: #666666;
  480. line-height: 44rpx;
  481. margin-bottom: 32rpx;
  482. }
  483. .item-needs {
  484. .need-item {
  485. width: 666rpx;
  486. height: 150rpx;
  487. background: #f3f3f3;
  488. border-radius: 10rpx;
  489. margin: 0 auto;
  490. font-size: 26rpx;
  491. font-family: PingFang SC;
  492. font-weight: 500;
  493. color: #333333;
  494. margin-bottom: 10rpx;
  495. padding-top: 20rpx;
  496. padding-left: 13rpx;
  497. line-height: 1;
  498. view {
  499. margin-bottom: 15rpx;
  500. text {
  501. color: #e80000;
  502. }
  503. }
  504. }
  505. }
  506. }
  507. .feedback {
  508. padding: 25rpx 41rpx 36rpx;
  509. .feedback-nav {
  510. margin-bottom: 20rpx;
  511. .nav-item {
  512. display: inline-block;
  513. width: 100rpx;
  514. height: 55rpx;
  515. background: #fdcbc2;
  516. box-shadow: 0px 0px 10rpx 0rpx rgba(0, 0, 0, 0.1);
  517. border-radius: 10rpx;
  518. margin-right: 20rpx;
  519. text-align: center;
  520. line-height: 55rpx;
  521. font-size: 24rpx;
  522. font-family: PingFang SC;
  523. font-weight: 500;
  524. color: #ffffff;
  525. }
  526. .nav-item-err {
  527. color: #999999;
  528. background: #f1f1f0;
  529. }
  530. .action {
  531. background: #fa7e67;
  532. color: #fff;
  533. }
  534. }
  535. .feedback-content {
  536. .overall {
  537. .title {
  538. width: 667rpx;
  539. height: 75rpx;
  540. background: #fa7e67;
  541. box-shadow: 0px 0px 10rpx 0rpx rgba(0, 0, 0, 0.1);
  542. border-radius: 10rpx 10rpx 0px 0px;
  543. font-size: 28rpx;
  544. font-family: PingFang SC;
  545. font-weight: bold;
  546. color: #ffffff;
  547. line-height: 75rpx;
  548. padding-left: 17rpx;
  549. }
  550. .content {
  551. padding: 33rpx 36rpx 43rpx 30rpx;
  552. width: 667rpx;
  553. background-color: #fff;
  554. box-shadow: 0px 0px 10rpx 0px rgba(0, 0, 0, 0.1);
  555. border-radius: 0px 0px 10rpx 10rpx;
  556. font-size: 26rpx;
  557. font-family: PingFang SC;
  558. font-weight: 500;
  559. color: #999999;
  560. line-height: 42rpx;
  561. }
  562. }
  563. .feedback-item {
  564. margin: 20rpx auto;
  565. // display: flex;
  566. background-color: #fff;
  567. box-shadow: 0px 0px 10rpx 0px rgba(0, 0, 0, 0.1);
  568. border-radius: 10rpx 10rpx 10rpx;
  569. .item-top {
  570. height: 118rpx;
  571. border-radius: 10px 10px 0 0;
  572. border-bottom: 1px solid #ececec;
  573. padding: 25rpx 0 0 17rpx;
  574. display: flex;
  575. image {
  576. width: 77rpx;
  577. height: 77rpx;
  578. border-radius: 50%;
  579. background-color: red;
  580. margin-right: 12rpx;
  581. }
  582. .item-name-time {
  583. .item-name {
  584. font-size: 28rpx;
  585. font-family: PingFang SC;
  586. font-weight: bold;
  587. color: #333333;
  588. line-height: 35rpx;
  589. }
  590. .item-time {
  591. font-size: 24rpx;
  592. font-family: PingFang SC;
  593. font-weight: 500;
  594. color: #999999;
  595. line-height: 50rpx;
  596. }
  597. }
  598. }
  599. .item-content {
  600. padding: 25rpx 47rpx 40rpx 30rpx;
  601. border-radius: 0 0 10rpx 10rpx;
  602. font-size: 26rpx;
  603. font-family: PingFang SC;
  604. font-weight: 500;
  605. color: #999;
  606. line-height: 42rpx;
  607. text {
  608. color: #e80000;
  609. font-weight: bold;
  610. }
  611. }
  612. }
  613. }
  614. }
  615. .type-box {
  616. width: 542rpx;
  617. height: 575rpx;
  618. // background: linear-gradient(0deg, rgba(249, 98, 105, 0.06), rgba(255, 255, 255, 0.06));
  619. border-radius: 20rpx;
  620. background-color: #fff;
  621. position: relative;
  622. .bg {
  623. width: 100%;
  624. height: 138rpx;
  625. position: absolute;
  626. }
  627. .box-title {
  628. text-align: center;
  629. font-size: 36rpx;
  630. font-family: PingFang SC;
  631. font-weight: bold;
  632. color: #333333;
  633. line-height: 1;
  634. padding-top: 77rpx;
  635. }
  636. .box-tip {
  637. text-align: center;
  638. font-size: 24rpx;
  639. font-family: PingFang SC;
  640. font-weight: 500;
  641. color: #808080;
  642. line-height: 1;
  643. padding-top: 12rpx;
  644. margin-bottom: 43rpx;
  645. }
  646. .box-btn {
  647. margin: 0 auto;
  648. width: 460rpx;
  649. height: 95rpx;
  650. display: flex;
  651. align-items: center;
  652. border-bottom: 1px solid #f3efef;
  653. position: relative;
  654. image {
  655. height: 43rpx;
  656. width: 43rpx;
  657. background-color: red;
  658. margin-right: 15rpx;
  659. }
  660. .qq {
  661. width: 32rpx;
  662. height: 32rpx;
  663. border: 1px solid #808080;
  664. opacity: 0.5;
  665. border-radius: 50%;
  666. position: absolute;
  667. right: 0;
  668. }
  669. .action {
  670. border-color: #fa7e67;
  671. // position: relative;
  672. .yx {
  673. width: 20rpx;
  674. height: 20rpx;
  675. background: #fa7e67;
  676. // border: 1px solid #FA7E67;
  677. border-radius: 50%;
  678. position: absolute;
  679. top: 0;
  680. bottom: 0;
  681. left: 0;
  682. right: 0;
  683. margin: auto;
  684. }
  685. }
  686. }
  687. .qr {
  688. width: 460rpx;
  689. height: 71rpx;
  690. background: #fa7e67;
  691. box-shadow: 0px 16rpx 16rpx 0px rgba(250, 126, 103, 0.5);
  692. border-radius: 10rpx;
  693. font-size: 28rpx;
  694. font-family: PingFang SC;
  695. font-weight: 500;
  696. color: #ffffff;
  697. text-align: center;
  698. line-height: 71rpx;
  699. margin: 62rpx auto 0;
  700. }
  701. }
  702. </style>