idonate.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535
  1. <template>
  2. <view class="idonate">
  3. <view class="one" v-show="limit === 1">
  4. <view class="item">
  5. <view class="item-tit">捐赠个体<text>*</text></view>
  6. <radio-group @change="typeChange" class="check-box">
  7. <label v-for="(item, index) in items" :key="item.value">
  8. <radio :value="item.iid" :checked="index === type" color="#f3392c" style="transform:scale(0.7)" />
  9. <text style="color: #000000;">{{ item.value }}</text>
  10. </label>
  11. </radio-group>
  12. </view>
  13. <template v-if="type === 0">
  14. <view class="item">
  15. <view class="item-tit">捐赠单位<text>*</text></view>
  16. <input type="text" :value="unit" placeholder="请填写捐赠单位"/>
  17. </view>
  18. <view class="item">
  19. <view class="item-tit">单位联系人<text>*</text></view>
  20. <input type="text" :value="dwPeople" placeholder="请填写捐赠方联系人"/>
  21. </view>
  22. <view class="item">
  23. <view class="item-tit">单位电话<text>*</text></view>
  24. <input type="text" :value="dwPhone" placeholder="请填写单位联系方式"/>
  25. </view>
  26. <view class="item">
  27. <view class="item-tit">企业信用代码</view>
  28. <input type="text" :value="qyxydm" placeholder="请填写单位的企业信用代码"/>
  29. </view>
  30. </template>
  31. <template v-if="type === 1">
  32. <view class="item">
  33. <view class="item-tit">姓名<text>*</text></view>
  34. <input type="text" :value="unit" placeholder="请填写您的姓名"/>
  35. </view>
  36. <view class="item">
  37. <view class="item-tit">联系方式<text>*</text></view>
  38. <input type="text" :value="unit" placeholder="请填写您的联系方式"/>
  39. </view>
  40. <view class="item">
  41. <view class="item-tit">身份证号</view>
  42. <input type="text" :value="unit" placeholder="请填写您的身份证号"/>
  43. </view>
  44. </template>
  45. <view class="item">
  46. <view class="item-tit">是否匿名</view>
  47. <radio-group @change="anonymousChange" class="check-box">
  48. <label>
  49. <radio value="1" :checked="IsAnonymous" color="#f3392c" style="transform:scale(0.7)" />
  50. <text style="color: #000000;">是</text>
  51. </label>
  52. <label>
  53. <radio value="0" :checked="!IsAnonymous" color="#f3392c" style="transform:scale(0.7)" />
  54. <text style="color: #000000;">否</text>
  55. </label>
  56. </radio-group>
  57. </view>
  58. <view class="item">
  59. <view class="item-tit">物流方式</view>
  60. <picker @change="bindLogChange(item)" :range="logs">
  61. <view class="log select" :class="{'action': log }">{{ log || '请选择物流方式' }}</view>
  62. </picker>
  63. </view>
  64. <view class="item no-border-b">
  65. <view class="item-tit">开具发票<text>*</text></view>
  66. <radio-group @change="openChange" class="check-box">
  67. <label>
  68. <radio value="1" :checked="Isopen" color="#f3392c" style="transform:scale(0.7)" />
  69. <text style="color: #000000;">是</text>
  70. </label>
  71. <label>
  72. <radio value="0" :checked="!Isopen" color="#f3392c" style="transform:scale(0.7)" />
  73. <text style="color: #000000;">否</text>
  74. </label>
  75. </radio-group>
  76. </view>
  77. <view class="mask">
  78. <textarea :value="mask" placeholder="如果有备注请填写"/>
  79. </view>
  80. <view class="bbtm"></view>
  81. <view class="jzwz">
  82. <view class="item-tit">捐赠物资<text>*</text></view>
  83. <view class="choose-box">
  84. <view class="choose-item" v-for="(item,index) in wzList" :key="index" @click="dianji(index)">
  85. <picker @change="bindWzChange" :range="wzs">
  86. <view class="wz select" :class="{'action': item.wzname }">{{ item.wzname }}</view>
  87. </picker>
  88. <input type="number" v-model="item.num" placeholder="填写数量"/>
  89. </view>
  90. <view class="more" @click="addMore">
  91. +添加更多
  92. </view>
  93. </view>
  94. </view>
  95. </view>
  96. <view class="tow" v-show="limit === 2">
  97. <view class="t-item">
  98. <view class="t-tit">
  99. 实物照片(必填)<text>{{swimg | much}}/3</text>
  100. </view>
  101. <view class="img-list flex">
  102. <template v-for="(item,index) in swimg">
  103. <image src="../../static/images/upload.png" mode="" v-if="!item" @click.stop="imgsub(swimg,index)" :key="index"></image>
  104. <image :src="item" mode="" v-if="item" @click.stop="imgsub(item)" :key="index"></image>
  105. </template>
  106. </view>
  107. </view>
  108. <view class="t-item" v-if="type === 0">
  109. <view class="t-tit">
  110. 营业执照(必填)<text>{{yyimg | much}}/3</text>
  111. </view>
  112. <view class="img-list flex">
  113. <template v-for="(item,index) in yyimg">
  114. <image src="../../static/images/upload.png" mode="" v-if="!item" @click.stop="imgsub(yyimg,index)" :key="index"></image>
  115. <image :src="item" mode="" v-if="item" @click.stop="imgsub(yyimg,index)" :key="index"></image>
  116. </template>
  117. </view>
  118. </view>
  119. <view class="t-item">
  120. <view class="t-tit">
  121. 质量合格书(必填)<text>{{zlimg | much}}/3</text>
  122. </view>
  123. <view class="img-list flex">
  124. <template v-for="(item,index) in zlimg">
  125. <image src="../../static/images/upload.png" mode="" v-if="!item" @click.stop="imgsub(zlimg,index)" :key="index"></image>
  126. <image :src="item" mode="" v-if="item" @click.stop="imgsub(zlimg,index)" :key="index"></image>
  127. </template>
  128. </view>
  129. </view>
  130. <view class="t-item">
  131. <view class="t-tit">
  132. 价值凭证<text>{{jzimg | much}}/3</text>
  133. </view>
  134. <view class="img-list flex">
  135. <template v-for="(item,index) in jzimg">
  136. <image src="../../static/images/upload.png" mode="" v-if="!item" @click.stop="imgsub(jzimg,index)" :key="index"></image>
  137. <image :src="item" mode="" v-if="item" @click.stop="imgsub(jzimg,index)" :key="index"></image>
  138. </template>
  139. </view>
  140. </view>
  141. </view>
  142. <view class="jg">
  143. </view>
  144. <view class="btn">
  145. <view class="next" v-show="limit === 1" @click="nextLimit()">
  146. 下一页
  147. </view>
  148. <view class="prev" v-show="limit === 2" @click="prevLimit()">
  149. 上一步
  150. </view>
  151. <view class="sub" v-show="limit === 2">
  152. 提交
  153. </view>
  154. </view>
  155. </view>
  156. </template>
  157. <script>
  158. import { upload } from '@/api/ask.js';
  159. export default {
  160. data() {
  161. return {
  162. items: [
  163. {
  164. value: '企业(团体)',
  165. iid: '0'
  166. },
  167. {
  168. value: '个人',
  169. iid: '1'
  170. }
  171. ],
  172. IsAnonymous: false,
  173. limit: 1,
  174. type: 0,//捐赠个体 1位个人 0为团体(企业)
  175. unit: '',//捐赠单位
  176. dwPeople: '',//捐赠方联系人
  177. dwPhone: '',//单位电话
  178. log: '',//物流方式
  179. logs: ['顺丰','邮政'],
  180. Isopen: false,//是否开具发票
  181. mask: '',//备注
  182. qyxydm: '',//企业信用代码
  183. name: '',// 捐赠人姓名
  184. phone: '',//捐赠人联系方式
  185. identityNumber: '',//身份证号
  186. wzs: ['帐篷类(帐篷)','棉被类(被子)'],
  187. wzList: [
  188. {
  189. wzname: '帐篷类(帐篷)',
  190. num: null
  191. },
  192. {
  193. wzname: '棉被类(被子)',
  194. num: null
  195. }
  196. ],
  197. swimg: [''],//实物照片
  198. yyimg: [''],//营业执照
  199. zlimg: [''],//质量合格证书
  200. jzimg: [''],//价值凭证
  201. }
  202. },
  203. filters:{
  204. much(val) {
  205. let num = 0
  206. val.forEach(item => {
  207. if(item) {
  208. num += 1
  209. }
  210. })
  211. return num
  212. }
  213. },
  214. onLoad(ops) {
  215. if(ops.type) {
  216. this.type = ops.type*1
  217. console.log(this.type,'++++++++')
  218. }
  219. },
  220. mounted() {
  221. // this.$set(this,'wzList',[this.wz1,this.wz2])
  222. },
  223. methods: {
  224. //下一页
  225. nextLimit() {
  226. this.limit = 2
  227. },
  228. //下一页
  229. prevLimit() {
  230. this.limit = 1
  231. },
  232. //选择捐赠是个人或团体
  233. typeChange(e) {
  234. this.type = e.detail.value*1
  235. console.log(this.type)
  236. },
  237. //选择是否匿名
  238. anonymousChange(e) {
  239. if(e.detail.value !== '1') {
  240. this.IsAnonymous = false
  241. }else {
  242. this.IsAnonymous = true
  243. }
  244. },
  245. //选择物流方式
  246. bindLogChange(e) {
  247. this.log = this.logs[e.detail.value*1]
  248. },
  249. //
  250. openChange(e) {
  251. if(e.detail.value !== '1') {
  252. this.Isopen = false
  253. }else {
  254. this.Isopen = true
  255. }
  256. },
  257. imgsub(item,index) {
  258. console.log(index,item)
  259. upload({
  260. filename: ''
  261. }).then(data => {
  262. console.log(data,'6666666666')
  263. this.$set(item,index,data[0].url)
  264. if(index < 2) {
  265. this.$set(item,index+1,'')
  266. }
  267. });
  268. },
  269. //选择捐献物资分类
  270. bindWzChange(e){
  271. // item.wzname = e.detail.value
  272. // console.log(item)
  273. this.wzList[this.currentWzIndex].wzname = this.wzs[e.detail.value]
  274. console.log(this.wzList)
  275. },
  276. dianji(index) {
  277. this.currentWzIndex = index
  278. },
  279. //添加更多
  280. addMore() {
  281. this.wzList.push({
  282. wzname: this.wzs[0],
  283. num: null
  284. })
  285. }
  286. }
  287. }
  288. </script>
  289. <style lang="scss" scoped>
  290. page {
  291. height: 100%;
  292. background-color: #fff;
  293. }
  294. .idonate {
  295. padding: 0 30rpx;
  296. margin-top: 20rpx;
  297. background-color: #fff;
  298. }
  299. .btn {
  300. // height: 196rpx;
  301. // width: 100%;
  302. width: 690rpx;
  303. text-align: center;
  304. display: flex;
  305. justify-content: center;
  306. line-height: 75rpx;
  307. padding-bottom: 54rpx;
  308. // padding-top: 54rpx;
  309. position: fixed;
  310. bottom: 0;
  311. background-color: #fff;
  312. z-index: 9;
  313. .next {
  314. width: 478rpx;
  315. height: 75rpx;
  316. // margin: 0 auto;
  317. background: #FA7E67;
  318. border-radius: 35rpx;
  319. color: #fff;
  320. font-size: 32rpx;
  321. font-family: PingFang SC;
  322. font-weight: 500;
  323. color: #FFFFFF;
  324. }
  325. .prev {
  326. width: 264rpx;
  327. height: 75rpx;
  328. border: 1px solid #FA7E67;
  329. border-radius: 35rpx;
  330. font-size: 32rpx;
  331. font-family: PingFang SC;
  332. font-weight: 500;
  333. color: #FA7E67;
  334. margin-right: 60rpx;
  335. line-height: 70rpx;
  336. }
  337. .sub {
  338. width: 264rpx;
  339. height: 75rpx;
  340. background: #FA7E67;
  341. border-radius: 35rpx;
  342. font-size: 32rpx;
  343. font-family: PingFang SC;
  344. font-weight: 500;
  345. color: #FFFFFF;
  346. line-height: 70rpx;
  347. }
  348. }
  349. .item {
  350. display: flex;
  351. align-items: center;
  352. height: 102rpx;
  353. border-bottom: 1px #ECECEC solid;
  354. font-size: 30rpx;
  355. font-family: PingFang SC;
  356. font-weight: 500;
  357. color: #222222;
  358. line-height: 102rpx;
  359. .item-tit {
  360. flex-shrink: 0;
  361. display: inline-block;
  362. width: 200rpx;
  363. }
  364. text {
  365. color: #F3392C;
  366. }
  367. input {
  368. display: inline-block;
  369. width: 100%;
  370. }
  371. .log {
  372. // display: inline-block;
  373. width: 400rpx;
  374. color: #999;
  375. }
  376. .select {
  377. color: #000;
  378. }
  379. }
  380. .mask {
  381. padding-left: 202rpx;
  382. textarea {
  383. width: 396rpx;
  384. height: 166rpx;
  385. border: 1rpx solid #ccc;
  386. border-radius: 10rpx;
  387. font-size: 24rpx;
  388. font-family: PingFang SC;
  389. font-weight: 500;
  390. color: #000;
  391. line-height: 32rpx;
  392. padding: 24rpx 16rpx;
  393. }
  394. }
  395. .check-box {
  396. flex-grow: 0;
  397. display: flex;
  398. display: inline-block;
  399. }
  400. .no-border-b {
  401. border-bottom: none;
  402. }
  403. .bbtm {
  404. margin-top: 40rpx;
  405. width: 689rpx;
  406. height: 1rpx;
  407. background: #ECECEC;
  408. }
  409. .t-item {
  410. padding: 35rpx 0;
  411. border-bottom: 1px #ECECEC solid;
  412. font-size: 30rpx;
  413. font-family: PingFang SC;
  414. font-weight: 500;
  415. color: #222222;
  416. &:last-of-type {
  417. border-bottom: none;
  418. }
  419. image {
  420. display: block;
  421. width: 160rpx;
  422. height: 160rpx;
  423. // background: red;
  424. border-radius: 5rpx;
  425. // margin: 0 auto;
  426. }
  427. .t-tit {
  428. position: relative;
  429. text {
  430. display: inline-block;
  431. width: 73rpx;
  432. height: 31rpx;
  433. background: #F0433C;
  434. border-radius: 14rpx;
  435. font-size: 24rpx;
  436. font-family: PingFang SC;
  437. font-weight: 500;
  438. color: #FFFFFF;
  439. line-height: 31rpx;
  440. text-align: center;
  441. position: absolute;
  442. right: 0;
  443. // left: 0;
  444. top: 0;
  445. bottom: 0;
  446. margin: auto;
  447. }
  448. }
  449. .img-list {
  450. margin-top: 20rpx;
  451. justify-content: center;
  452. image {
  453. margin-right: 20rpx;
  454. }
  455. }
  456. }
  457. .jzwz {
  458. display: flex;
  459. .item-tit {
  460. font-size: 30rpx;
  461. font-family: PingFang SC;
  462. font-weight: 500;
  463. color: #222222;
  464. padding-top: 39rpx;
  465. line-height: 1;
  466. width: 200rpx;
  467. }
  468. .choose-box {
  469. padding-top: 24rpx;
  470. .choose-item {
  471. display: flex;
  472. margin-bottom: 15rpx;
  473. .wz {
  474. padding-left: 58rpx;
  475. width: 297rpx;
  476. height: 66rpx;
  477. background: #F3F3F3;
  478. border-radius: 5rpx;
  479. font-size: 28rpx;
  480. font-family: PingFang SC;
  481. font-weight: 500;
  482. color: #222222;
  483. line-height: 66rpx;
  484. &::after {
  485. content: '';
  486. width: 0;
  487. height: 0;
  488. border-left: 10rpx solid transparent;
  489. border-right: 10rpx solid transparent;
  490. border-top: 10rpx solid #808080;
  491. position: absolute;
  492. right: 10rpx;
  493. bottom: 26rpx;
  494. }
  495. }
  496. input {
  497. width: 189rpx;
  498. height: 66rpx;
  499. background: #F3F3F3;
  500. border-radius: 5rpx;
  501. line-height: 66rpx;
  502. margin-left: 15rpx;
  503. text-align: center;
  504. }
  505. }
  506. .more {
  507. width: 297rpx;
  508. height: 66rpx;
  509. background: #FFFFFF;
  510. border: 1px solid #FA7E67;
  511. border-radius: 5rpx;
  512. font-size: 24rpx;
  513. font-family: PingFang SC;
  514. font-weight: 500;
  515. color: #FA7E67;
  516. line-height: 66rpx;
  517. text-align: center;
  518. }
  519. }
  520. }
  521. .jg {
  522. height: 150rpx;
  523. background-color: #fff;
  524. }
  525. </style>