idonate.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541
  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" @click="sub">
  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. sub() {
  288. uni.navigateTo({
  289. url: '/pages/joinSuc/joinsuccess'
  290. })
  291. }
  292. }
  293. }
  294. </script>
  295. <style lang="scss" scoped>
  296. page {
  297. height: 100%;
  298. background-color: #fff;
  299. }
  300. .idonate {
  301. padding: 0 30rpx;
  302. margin-top: 20rpx;
  303. background-color: #fff;
  304. }
  305. .btn {
  306. // height: 196rpx;
  307. // width: 100%;
  308. width: 690rpx;
  309. text-align: center;
  310. display: flex;
  311. justify-content: center;
  312. line-height: 75rpx;
  313. padding-bottom: 54rpx;
  314. // padding-top: 54rpx;
  315. position: fixed;
  316. bottom: 0;
  317. background-color: #fff;
  318. z-index: 9;
  319. .next {
  320. width: 478rpx;
  321. height: 75rpx;
  322. // margin: 0 auto;
  323. background: #FA7E67;
  324. border-radius: 35rpx;
  325. color: #fff;
  326. font-size: 32rpx;
  327. font-family: PingFang SC;
  328. font-weight: 500;
  329. color: #FFFFFF;
  330. }
  331. .prev {
  332. width: 264rpx;
  333. height: 75rpx;
  334. border: 1px solid #FA7E67;
  335. border-radius: 35rpx;
  336. font-size: 32rpx;
  337. font-family: PingFang SC;
  338. font-weight: 500;
  339. color: #FA7E67;
  340. margin-right: 60rpx;
  341. line-height: 70rpx;
  342. }
  343. .sub {
  344. width: 264rpx;
  345. height: 75rpx;
  346. background: #FA7E67;
  347. border-radius: 35rpx;
  348. font-size: 32rpx;
  349. font-family: PingFang SC;
  350. font-weight: 500;
  351. color: #FFFFFF;
  352. line-height: 70rpx;
  353. }
  354. }
  355. .item {
  356. display: flex;
  357. align-items: center;
  358. height: 102rpx;
  359. border-bottom: 1px #ECECEC solid;
  360. font-size: 30rpx;
  361. font-family: PingFang SC;
  362. font-weight: 500;
  363. color: #222222;
  364. line-height: 102rpx;
  365. .item-tit {
  366. flex-shrink: 0;
  367. display: inline-block;
  368. width: 200rpx;
  369. }
  370. text {
  371. color: #F3392C;
  372. }
  373. input {
  374. display: inline-block;
  375. width: 100%;
  376. }
  377. .log {
  378. // display: inline-block;
  379. width: 400rpx;
  380. color: #999;
  381. }
  382. .select {
  383. color: #000;
  384. }
  385. }
  386. .mask {
  387. padding-left: 202rpx;
  388. textarea {
  389. width: 396rpx;
  390. height: 166rpx;
  391. border: 1rpx solid #ccc;
  392. border-radius: 10rpx;
  393. font-size: 24rpx;
  394. font-family: PingFang SC;
  395. font-weight: 500;
  396. color: #000;
  397. line-height: 32rpx;
  398. padding: 24rpx 16rpx;
  399. }
  400. }
  401. .check-box {
  402. flex-grow: 0;
  403. display: flex;
  404. display: inline-block;
  405. }
  406. .no-border-b {
  407. border-bottom: none;
  408. }
  409. .bbtm {
  410. margin-top: 40rpx;
  411. width: 689rpx;
  412. height: 1rpx;
  413. background: #ECECEC;
  414. }
  415. .t-item {
  416. padding: 35rpx 0;
  417. border-bottom: 1px #ECECEC solid;
  418. font-size: 30rpx;
  419. font-family: PingFang SC;
  420. font-weight: 500;
  421. color: #222222;
  422. &:last-of-type {
  423. border-bottom: none;
  424. }
  425. image {
  426. display: block;
  427. width: 160rpx;
  428. height: 160rpx;
  429. // background: red;
  430. border-radius: 5rpx;
  431. // margin: 0 auto;
  432. }
  433. .t-tit {
  434. position: relative;
  435. text {
  436. display: inline-block;
  437. width: 73rpx;
  438. height: 31rpx;
  439. background: #F0433C;
  440. border-radius: 14rpx;
  441. font-size: 24rpx;
  442. font-family: PingFang SC;
  443. font-weight: 500;
  444. color: #FFFFFF;
  445. line-height: 31rpx;
  446. text-align: center;
  447. position: absolute;
  448. right: 0;
  449. // left: 0;
  450. top: 0;
  451. bottom: 0;
  452. margin: auto;
  453. }
  454. }
  455. .img-list {
  456. margin-top: 20rpx;
  457. justify-content: center;
  458. image {
  459. margin-right: 20rpx;
  460. }
  461. }
  462. }
  463. .jzwz {
  464. display: flex;
  465. .item-tit {
  466. font-size: 30rpx;
  467. font-family: PingFang SC;
  468. font-weight: 500;
  469. color: #222222;
  470. padding-top: 39rpx;
  471. line-height: 1;
  472. width: 200rpx;
  473. }
  474. .choose-box {
  475. padding-top: 24rpx;
  476. .choose-item {
  477. display: flex;
  478. margin-bottom: 15rpx;
  479. .wz {
  480. padding-left: 58rpx;
  481. width: 297rpx;
  482. height: 66rpx;
  483. background: #F3F3F3;
  484. border-radius: 5rpx;
  485. font-size: 28rpx;
  486. font-family: PingFang SC;
  487. font-weight: 500;
  488. color: #222222;
  489. line-height: 66rpx;
  490. &::after {
  491. content: '';
  492. width: 0;
  493. height: 0;
  494. border-left: 10rpx solid transparent;
  495. border-right: 10rpx solid transparent;
  496. border-top: 10rpx solid #808080;
  497. position: absolute;
  498. right: 10rpx;
  499. bottom: 26rpx;
  500. }
  501. }
  502. input {
  503. width: 189rpx;
  504. height: 66rpx;
  505. background: #F3F3F3;
  506. border-radius: 5rpx;
  507. line-height: 66rpx;
  508. margin-left: 15rpx;
  509. text-align: center;
  510. }
  511. }
  512. .more {
  513. width: 297rpx;
  514. height: 66rpx;
  515. background: #FFFFFF;
  516. border: 1px solid #FA7E67;
  517. border-radius: 5rpx;
  518. font-size: 24rpx;
  519. font-family: PingFang SC;
  520. font-weight: 500;
  521. color: #FA7E67;
  522. line-height: 66rpx;
  523. text-align: center;
  524. }
  525. }
  526. }
  527. .jg {
  528. height: 150rpx;
  529. background-color: #fff;
  530. }
  531. </style>