idonate.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  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" :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">
  81. </view>
  82. </view>
  83. <view class="tow" v-show="limit === 2">
  84. <view class="t-item">
  85. <view class="t-tit">
  86. 实物照片(必填)
  87. </view>
  88. <image src="" mode="" v-if="!cardimg1" @click.stop="imgsub('cardimg1')"></image>
  89. <image :src="cardimg1" mode="" v-if="cardimg1" @click.stop="imgsub('cardimg1')"></image>
  90. </view>
  91. <view class="t-item">
  92. <view class="t-tit">
  93. 营业执照(必填)
  94. </view>
  95. <image src="" mode="" v-if="!cardimg2" @click.stop="imgsub('cardimg2')"></image>
  96. <image :src="cardimg2" mode="" v-if="cardimg2" @click.stop="imgsub('cardimg2')"></image>
  97. </view>
  98. <view class="t-item">
  99. <view class="t-tit">
  100. 质量合格书(必填)
  101. </view>
  102. <image src="" mode="" v-if="!cardimg3" @click.stop="imgsub('cardimg3')"></image>
  103. <image :src="cardimg3" mode="" v-if="cardimg3" @click.stop="imgsub('cardimg3')"></image>
  104. </view>
  105. <view class="t-item">
  106. <view class="t-tit">
  107. 价值凭证
  108. </view>
  109. <image src="" mode="" v-if="!cardimg4" @click.stop="imgsub('cardimg4')"></image>
  110. <image :src="cardimg4" mode="" v-if="cardimg4" @click.stop="imgsub('cardimg4')"></image>
  111. </view>
  112. </view>
  113. <view class="jg">
  114. </view>
  115. <view class="btn">
  116. <view class="next" v-show="limit === 1" @click="nextLimit()">
  117. 下一页
  118. </view>
  119. <view class="prev" v-show="limit === 2" @click="prevLimit()">
  120. 上一步
  121. </view>
  122. <view class="sub" v-show="limit === 2">
  123. 提交
  124. </view>
  125. </view>
  126. </view>
  127. </template>
  128. <script>
  129. import { upload } from '@/api/ask.js';
  130. export default {
  131. data() {
  132. return {
  133. items: [
  134. {
  135. value: '企业(团体)',
  136. iid: '0'
  137. },
  138. {
  139. value: '个人',
  140. iid: '1'
  141. }
  142. ],
  143. IsAnonymous: false,
  144. limit: 1,
  145. type: 0,//捐赠个体 1位个人 0为团体(企业)
  146. unit: '',//捐赠单位
  147. dwPeople: '',//捐赠方联系人
  148. dwPhone: '',//单位电话
  149. log: '',//物流方式
  150. logs: ['顺丰','邮政'],
  151. Isopen: false,//是否开具发票
  152. mask: '',//备注
  153. qyxydm: '',//企业信用代码
  154. name: '',// 捐赠人姓名
  155. phone: '',//捐赠人联系方式
  156. identityNumber: '',//身份证号
  157. cardimg1: '',//实物照片
  158. cardimg2: '',//营业执照
  159. cardimg3: '',//质量合格书(必填)
  160. cardimg4: '',//价值凭证
  161. }
  162. },
  163. onLoad(ops) {
  164. if(ops.type) {
  165. this.type = ops.type*1
  166. console.log(this.type,'++++++++')
  167. }
  168. },
  169. methods: {
  170. //下一页
  171. nextLimit() {
  172. this.limit = 2
  173. },
  174. //下一页
  175. prevLimit() {
  176. this.limit = 1
  177. },
  178. //选择捐赠是个人或团体
  179. typeChange(e) {
  180. this.type = e.detail.value*1
  181. console.log(this.type)
  182. },
  183. //选择是否匿名
  184. anonymousChange(e) {
  185. if(e.detail.value !== '1') {
  186. this.IsAnonymous = false
  187. }else {
  188. this.IsAnonymous = true
  189. }
  190. },
  191. //选择物流方式
  192. bindLogChange(e) {
  193. this.log = this.logs[e.detail.value*1]
  194. },
  195. //
  196. openChange(e) {
  197. if(e.detail.value !== '1') {
  198. this.Isopen = false
  199. }else {
  200. this.Isopen = true
  201. }
  202. },
  203. imgsub(e) {
  204. upload({
  205. filename: ''
  206. }).then(data => {
  207. this[e] = data[0].url;
  208. });
  209. }
  210. }
  211. }
  212. </script>
  213. <style lang="scss" scoped>
  214. page {
  215. height: 100%;
  216. background-color: #fff;
  217. }
  218. .idonate {
  219. padding: 0 30rpx;
  220. margin-top: 20rpx;
  221. background-color: #fff;
  222. }
  223. .btn {
  224. height: 196rpx;
  225. width: 100%;
  226. text-align: center;
  227. display: flex;
  228. justify-content: center;
  229. line-height: 75rpx;
  230. .next {
  231. width: 478rpx;
  232. height: 75rpx;
  233. // margin: 0 auto;
  234. background: #FA7E67;
  235. border-radius: 35rpx;
  236. color: #fff;
  237. font-size: 32rpx;
  238. font-family: PingFang SC;
  239. font-weight: 500;
  240. color: #FFFFFF;
  241. }
  242. .prev {
  243. width: 264rpx;
  244. height: 75rpx;
  245. border: 1px solid #FA7E67;
  246. border-radius: 35rpx;
  247. font-size: 32rpx;
  248. font-family: PingFang SC;
  249. font-weight: 500;
  250. color: #FA7E67;
  251. margin-right: 60rpx;
  252. line-height: 70rpx;
  253. }
  254. .sub {
  255. width: 264rpx;
  256. height: 75rpx;
  257. background: #FA7E67;
  258. border-radius: 35rpx;
  259. font-size: 32rpx;
  260. font-family: PingFang SC;
  261. font-weight: 500;
  262. color: #FFFFFF;
  263. line-height: 70rpx;
  264. }
  265. }
  266. .item {
  267. display: flex;
  268. align-items: center;
  269. height: 102rpx;
  270. border-bottom: 1px #ECECEC solid;
  271. font-size: 30rpx;
  272. font-family: PingFang SC;
  273. font-weight: 500;
  274. color: #222222;
  275. line-height: 102rpx;
  276. .item-tit {
  277. flex-shrink: 0;
  278. display: inline-block;
  279. width: 200rpx;
  280. }
  281. text {
  282. color: #F3392C;
  283. }
  284. input {
  285. display: inline-block;
  286. width: 100%;
  287. }
  288. .log {
  289. // display: inline-block;
  290. width: 400rpx;
  291. color: #999;
  292. }
  293. .select {
  294. color: #000;
  295. }
  296. }
  297. .mask {
  298. padding-left: 202rpx;
  299. textarea {
  300. width: 396rpx;
  301. height: 166rpx;
  302. border: 1rpx solid #ccc;
  303. border-radius: 10rpx;
  304. font-size: 24rpx;
  305. font-family: PingFang SC;
  306. font-weight: 500;
  307. color: #000;
  308. line-height: 24rpx;
  309. padding: 24rpx 16rpx;
  310. }
  311. }
  312. .check-box {
  313. flex-grow: 0;
  314. display: flex;
  315. display: inline-block;
  316. }
  317. .no-border-b {
  318. border-bottom: none;
  319. }
  320. .bbtm {
  321. margin-top: 40rpx;
  322. width: 689rpx;
  323. height: 1rpx;
  324. background: #ECECEC;
  325. }
  326. .t-item {
  327. padding: 35rpx 0;
  328. border-bottom: 1px #ECECEC solid;
  329. font-size: 30rpx;
  330. font-family: PingFang SC;
  331. font-weight: 500;
  332. color: #222222;
  333. &:last-of-type {
  334. border-bottom: none;
  335. }
  336. image {
  337. display: block;
  338. width: 160rpx;
  339. height: 160rpx;
  340. background: red;
  341. border-radius: 5rpx;
  342. margin: 0 auto;
  343. }
  344. }
  345. </style>