donateDetail.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701
  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">
  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">
  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: {} //最新动态
  153. };
  154. },
  155. filters: {
  156. time(val) {
  157. let str = '';
  158. if (val) {
  159. let date = new Date(val * 1000);
  160. let Y = date.getFullYear();
  161. let M = date.getMonth() > 9 ? date.getMonth() : '0' + date.getMonth();
  162. let D = date.getDate() > 9 ? date.getDate() : '0' + date.getDate();
  163. str = Y + '年' + M + '月' + D + '日';
  164. }
  165. return str;
  166. },
  167. type(val, typeList) {
  168. let str = '';
  169. let arr = typeList;
  170. let len = arr.length;
  171. for (let i = 0; i < len; i++) {
  172. if (arr[i].id === val) {
  173. return (str = arr[i].name);
  174. }
  175. }
  176. },
  177. name(val, typeList) {
  178. let str = '';
  179. if (val) {
  180. str = val.substr(0, 1);
  181. }
  182. return str + '**';
  183. },
  184. item(val, typeList) {
  185. let str = '';
  186. if (val) {
  187. let arr = val.map(item => {
  188. for (let i = 0; i < typeList.length; i++) {
  189. if (item.project_donation_id == typeList[i].id) {
  190. str = str + typeList[i].name + ' ' + item.project_donation_num + ' ' + '个 ';
  191. }
  192. }
  193. });
  194. }
  195. return str;
  196. }
  197. },
  198. onLoad(opt) {
  199. that = this;
  200. this.pid = opt.id;
  201. this.getNewOrder();
  202. this.loadDate(this.pid);
  203. this.getDonationInfo();
  204. },
  205. methods: {
  206. loadDate(id) {
  207. getProjectInfo({
  208. id: id
  209. }).then(res => {
  210. let data = JSON.parse(res.msg);
  211. console.log(data, 'loaddata++++++++++');
  212. data.info = data.info.replace(/<img /g, '<img style="width:100%"');
  213. this.proInfo = data;
  214. let arr = this.proInfo.project_donation_info;
  215. let len = arr.length;
  216. let map = {},
  217. dest = [];
  218. for (var i = 0; i < len; i++) {
  219. var ai = arr[i];
  220. if (!map[ai.project_donation_id]) {
  221. // dest.push({
  222. // id: ai.id,
  223. // pro_id: ai.pro_id,
  224. // project_donation_id: ai.project_donation_id,
  225. // project_donation_num: ai.project_donation_num,
  226. // received: ai.received,
  227. // send_num: ai.send_num,
  228. // transport: ai.transport
  229. // });
  230. dest.push(ai)
  231. map[ai.project_donation_id] = ai;
  232. } else {
  233. for (var j = 0; j < dest.length; j++) {
  234. var dj = dest[j];
  235. if (dj.project_donation_id == ai.project_donation_id) {
  236. dj.project_donation_num = dj.project_donation_num + ai.project_donation_num
  237. dj.received = dj.received + ai.received
  238. dj.send_num = dj.send_num + ai.send_num
  239. dj.transport = dj.transport + ai.transport
  240. break;
  241. }
  242. }
  243. }
  244. }
  245. this.proInfo.project_donation_info = dest
  246. console.log(this.proInfo.project_donation_info, 'proInfo.item++++++++++++++++++++++++++');
  247. });
  248. },
  249. navTo(url) {
  250. uni.navigateTo({
  251. url: url
  252. });
  253. },
  254. navClick(index) {
  255. this.currentIndex = index;
  256. },
  257. lookmore(index) {
  258. this.navCurrentIndex = index;
  259. },
  260. want() {
  261. this.$refs.popup.open();
  262. },
  263. chooseType(index) {
  264. this.jxType = index;
  265. },
  266. qr() {
  267. this.$refs.popup.close();
  268. let wzList = [];
  269. let list = this.proInfo.project_donation_info;
  270. list.map(item => {
  271. for (let i = 0; i < this.typeList.length; i++) {
  272. if (item.project_donation_id === this.typeList[i].id) {
  273. wzList.push(this.typeList[i]);
  274. }
  275. }
  276. });
  277. console.log(wzList, '**************************************');
  278. this.navTo('/pages/donate/idonate?type=' + this.jxType + '&id=' + this.proInfo.id + '&wzlist=' + JSON.stringify(wzList));
  279. },
  280. //获取物资分类列表
  281. getDonationInfo() {
  282. getDonationInfo().then(({ data }) => {
  283. this.typeList = data;
  284. console.log(this.typeList, '获取所有物资');
  285. });
  286. },
  287. getNewOrder() {
  288. getAllOrder({
  289. project_id: this.pid
  290. }).then(({ data }) => {
  291. console.log(data, '999999999999999999999999');
  292. this.newItem = data.list[0];
  293. console.log(this.newItem, '88888888888888888');
  294. });
  295. },
  296. getItem(item) {
  297. // this.getDonationInfo()
  298. let str = '';
  299. console.log(item);
  300. if (item) {
  301. item.forEach(item => {
  302. for (let i = 0; i < this.typeList.length; i++) {
  303. if (item.project_donation_id === this.typeList[i].project_donation_id) {
  304. str = str + this.typeList[i].project_donation_name + item.project_donation_num + '个';
  305. }
  306. }
  307. });
  308. }
  309. console.log(str, '222222222222222222');
  310. return str;
  311. }
  312. }
  313. };
  314. </script>
  315. <style lang="scss" scoped>
  316. page {
  317. width: 100%;
  318. }
  319. .top {
  320. height: 863rpx;
  321. background-color: #fff;
  322. border-top: 1rpx solid #f6f6f6;
  323. padding-top: 33rpx;
  324. margin-bottom: 20rpx;
  325. image {
  326. display: block;
  327. width: 680rpx;
  328. height: 375rpx;
  329. border-radius: 20rpx;
  330. margin: 0 auto;
  331. // background-color: red;
  332. }
  333. .title {
  334. width: 580rpx;
  335. font-size: 32rpx;
  336. font-family: PingFang SC;
  337. font-weight: bold;
  338. color: #333333;
  339. line-height: 1;
  340. padding-top: 28rpx;
  341. padding-left: 42rpx;
  342. margin-bottom: 39rpx;
  343. }
  344. .base-info {
  345. font-size: 27rpx;
  346. font-family: PingFang SC;
  347. font-weight: 500;
  348. color: #999999;
  349. line-height: 1;
  350. display: flex;
  351. padding: 0 56rpx;
  352. flex-wrap: wrap;
  353. .item {
  354. width: 50%;
  355. padding-bottom: 40rpx;
  356. .status {
  357. color: red;
  358. font-weight: bold;
  359. }
  360. text {
  361. font-size: 26rpx;
  362. font-family: PingFang SC;
  363. font-weight: 500;
  364. color: #666666;
  365. display: inline-block;
  366. margin-right: 15rpx;
  367. }
  368. }
  369. }
  370. .dynamic {
  371. width: 666rpx;
  372. height: 111rpx;
  373. background: #efefef;
  374. border-radius: 10rpx;
  375. margin: 5rpx auto 0;
  376. .left {
  377. width: 115rpx;
  378. height: 111rpx;
  379. background: #5c93fc;
  380. border-radius: 10rpx 0px 0px 10rpx;
  381. font-size: 28rpx;
  382. font-family: PingFang SC;
  383. font-weight: 500;
  384. color: #ffffff;
  385. line-height: 34rpx;
  386. padding: 22rpx 29rpx;
  387. margin-right: 15rpx;
  388. }
  389. .right {
  390. font-size: 22rpx;
  391. font-family: PingFang SC;
  392. font-weight: 400;
  393. color: #333333;
  394. line-height: 1;
  395. padding: 12rpx 0;
  396. flex-direction: column;
  397. justify-content: space-between;
  398. text {
  399. color: red;
  400. font-weight: bold;
  401. }
  402. }
  403. }
  404. }
  405. .content {
  406. .content-nav {
  407. height: 82rpx;
  408. background: #ffffff;
  409. font-size: 30rpx;
  410. font-family: PingFang SC;
  411. font-weight: 500;
  412. color: #999999;
  413. line-height: 82rpx;
  414. justify-content: space-around;
  415. .active {
  416. border-bottom: 4rpx solid #fa7e67;
  417. color: #fa7e67;
  418. font-weight: bold;
  419. }
  420. }
  421. }
  422. .tip {
  423. margin-left: 42rpx;
  424. font-size: 30rpx;
  425. font-family: PingFang SC;
  426. font-weight: bold;
  427. color: #333333;
  428. line-height: 1;
  429. margin-bottom: 34rpx;
  430. view {
  431. display: inline-block;
  432. width: 4rpx;
  433. height: 30rpx;
  434. background: #fa7e67;
  435. border-radius: 2rpx;
  436. margin-right: 9rpx;
  437. position: relative;
  438. bottom: -2rpx;
  439. }
  440. }
  441. .btn-wrapper {
  442. .btn {
  443. width: 50%;
  444. text-align: center;
  445. height: 99rpx;
  446. line-height: 99rpx;
  447. font-size: 34rpx;
  448. font-family: PingFang SC;
  449. font-weight: 500;
  450. color: #ffffff;
  451. }
  452. .btn1 {
  453. background-color: #f7c03e;
  454. }
  455. .btn2 {
  456. background-color: #fa7e67;
  457. }
  458. }
  459. .item-detail {
  460. padding-top: 42rpx;
  461. .item-content {
  462. padding: 0 78rpx 0 48rpx;
  463. font-size: 26rpx;
  464. font-family: PingFang SC;
  465. font-weight: 500;
  466. color: #666666;
  467. line-height: 44rpx;
  468. margin-bottom: 32rpx;
  469. }
  470. .item-needs {
  471. .need-item {
  472. width: 666rpx;
  473. height: 150rpx;
  474. background: #f3f3f3;
  475. border-radius: 10rpx;
  476. margin: 0 auto;
  477. font-size: 26rpx;
  478. font-family: PingFang SC;
  479. font-weight: 500;
  480. color: #333333;
  481. margin-bottom: 10rpx;
  482. padding-top: 20rpx;
  483. padding-left: 13rpx;
  484. line-height: 1;
  485. view {
  486. margin-bottom: 15rpx;
  487. text {
  488. color: #e80000;
  489. }
  490. }
  491. }
  492. }
  493. }
  494. .feedback {
  495. padding: 25rpx 41rpx 36rpx;
  496. .feedback-nav {
  497. margin-bottom: 20rpx;
  498. .nav-item {
  499. display: inline-block;
  500. width: 100rpx;
  501. height: 55rpx;
  502. background: #fdcbc2;
  503. box-shadow: 0px 0px 10rpx 0rpx rgba(0, 0, 0, 0.1);
  504. border-radius: 10rpx;
  505. margin-right: 20rpx;
  506. text-align: center;
  507. line-height: 55rpx;
  508. font-size: 24rpx;
  509. font-family: PingFang SC;
  510. font-weight: 500;
  511. color: #ffffff;
  512. }
  513. .nav-item-err {
  514. color: #999999;
  515. background: #f1f1f0;
  516. }
  517. .action {
  518. background: #fa7e67;
  519. color: #fff;
  520. }
  521. }
  522. .feedback-content {
  523. .overall {
  524. .title {
  525. width: 667rpx;
  526. height: 75rpx;
  527. background: #fa7e67;
  528. box-shadow: 0px 0px 10rpx 0rpx rgba(0, 0, 0, 0.1);
  529. border-radius: 10rpx 10rpx 0px 0px;
  530. font-size: 28rpx;
  531. font-family: PingFang SC;
  532. font-weight: bold;
  533. color: #ffffff;
  534. line-height: 75rpx;
  535. padding-left: 17rpx;
  536. }
  537. .content {
  538. padding: 33rpx 36rpx 43rpx 30rpx;
  539. width: 667rpx;
  540. background-color: #fff;
  541. box-shadow: 0px 0px 10rpx 0px rgba(0, 0, 0, 0.1);
  542. border-radius: 0px 0px 10rpx 10rpx;
  543. font-size: 26rpx;
  544. font-family: PingFang SC;
  545. font-weight: 500;
  546. color: #999999;
  547. line-height: 42rpx;
  548. }
  549. }
  550. .feedback-item {
  551. margin: 20rpx auto;
  552. // display: flex;
  553. background-color: #fff;
  554. box-shadow: 0px 0px 10rpx 0px rgba(0, 0, 0, 0.1);
  555. border-radius: 10rpx 10rpx 10rpx;
  556. .item-top {
  557. height: 118rpx;
  558. border-radius: 10px 10px 0 0;
  559. border-bottom: 1px solid #ececec;
  560. padding: 25rpx 0 0 17rpx;
  561. display: flex;
  562. image {
  563. width: 77rpx;
  564. height: 77rpx;
  565. border-radius: 50%;
  566. background-color: red;
  567. margin-right: 12rpx;
  568. }
  569. .item-name-time {
  570. .item-name {
  571. font-size: 28rpx;
  572. font-family: PingFang SC;
  573. font-weight: bold;
  574. color: #333333;
  575. line-height: 35rpx;
  576. }
  577. .item-time {
  578. font-size: 24rpx;
  579. font-family: PingFang SC;
  580. font-weight: 500;
  581. color: #999999;
  582. line-height: 50rpx;
  583. }
  584. }
  585. }
  586. .item-content {
  587. padding: 25rpx 47rpx 40rpx 30rpx;
  588. border-radius: 0 0 10rpx 10rpx;
  589. font-size: 26rpx;
  590. font-family: PingFang SC;
  591. font-weight: 500;
  592. color: #999;
  593. line-height: 42rpx;
  594. text {
  595. color: #e80000;
  596. font-weight: bold;
  597. }
  598. }
  599. }
  600. }
  601. }
  602. .type-box {
  603. width: 542rpx;
  604. height: 575rpx;
  605. // background: linear-gradient(0deg, rgba(249, 98, 105, 0.06), rgba(255, 255, 255, 0.06));
  606. border-radius: 20rpx;
  607. background-color: #fff;
  608. position: relative;
  609. .bg {
  610. width: 100%;
  611. height: 138rpx;
  612. position: absolute;
  613. }
  614. .box-title {
  615. text-align: center;
  616. font-size: 36rpx;
  617. font-family: PingFang SC;
  618. font-weight: bold;
  619. color: #333333;
  620. line-height: 1;
  621. padding-top: 77rpx;
  622. }
  623. .box-tip {
  624. text-align: center;
  625. font-size: 24rpx;
  626. font-family: PingFang SC;
  627. font-weight: 500;
  628. color: #808080;
  629. line-height: 1;
  630. padding-top: 12rpx;
  631. margin-bottom: 43rpx;
  632. }
  633. .box-btn {
  634. margin: 0 auto;
  635. width: 460rpx;
  636. height: 95rpx;
  637. display: flex;
  638. align-items: center;
  639. border-bottom: 1px solid #f3efef;
  640. position: relative;
  641. image {
  642. height: 43rpx;
  643. width: 43rpx;
  644. background-color: red;
  645. margin-right: 15rpx;
  646. }
  647. .qq {
  648. width: 32rpx;
  649. height: 32rpx;
  650. border: 1px solid #808080;
  651. opacity: 0.5;
  652. border-radius: 50%;
  653. position: absolute;
  654. right: 0;
  655. }
  656. .action {
  657. border-color: #fa7e67;
  658. // position: relative;
  659. .yx {
  660. width: 20rpx;
  661. height: 20rpx;
  662. background: #fa7e67;
  663. // border: 1px solid #FA7E67;
  664. border-radius: 50%;
  665. position: absolute;
  666. top: 0;
  667. bottom: 0;
  668. left: 0;
  669. right: 0;
  670. margin: auto;
  671. }
  672. }
  673. }
  674. .qr {
  675. width: 460rpx;
  676. height: 71rpx;
  677. background: #fa7e67;
  678. box-shadow: 0px 16rpx 16rpx 0px rgba(250, 126, 103, 0.5);
  679. border-radius: 10rpx;
  680. font-size: 28rpx;
  681. font-family: PingFang SC;
  682. font-weight: 500;
  683. color: #ffffff;
  684. text-align: center;
  685. line-height: 71rpx;
  686. margin: 62rpx auto 0;
  687. }
  688. }
  689. </style>