index.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. <template>
  2. <view class="main">
  3. <navbar :config="config" backColor="#666"></navbar>
  4. <image class="cover" src="/static/recommendDonation/cover.png"></image>
  5. <view class="content">
  6. <view class="detail-top-title">
  7. <image class="line" src="/static/common/line1.png"></image>
  8. <text class="title">帮扶对象信息</text>
  9. <image class="line" src="/static/common/line1.png"></image>
  10. </view>
  11. </view>
  12. <view class="common-form">
  13. <view class="form-title required">真实姓名</view>
  14. <view class="form-item">
  15. <input v-model="form.real_name" placeholder="请输入帮扶对象姓名" :maxlength="10" />
  16. </view>
  17. <view class="form-title required">联系电话</view>
  18. <view class="form-item">
  19. <input v-model="form.phone" placeholder="请输入帮扶对象联系电话" type="number" :maxlength="11" />
  20. </view>
  21. <view class="form-title">性别</view>
  22. <view class="form-item" @click="sexShow=true">
  23. <text v-if="form.sex===0||form.sex===1">{{sexList[form.sex].label}}</text>
  24. <input disabled v-else placeholder="请选择性别" />
  25. <text class="iconfont2">&#xe6cc;</text>
  26. </view>
  27. <view class="form-title">年龄</view>
  28. <view class="form-item">
  29. <input v-model="form.age" placeholder="请输入年龄" type="number" :maxlength="3" />
  30. </view>
  31. <view class="form-title">身份证号</view>
  32. <view class="form-item">
  33. <input style="width: 100%;" v-model="form.id_number" :adjust-position="false" placeholder="请输入身份证号" type="text"
  34. :maxlength="18" />
  35. </view>
  36. <view class="form-title">所在地区</view>
  37. <view class="form-item" @click="addressShow=true">
  38. <view v-if="form.province_name&&form.city_name&&form.area_name">
  39. {{form.province_name+form.city_name+form.area_name}}</view>
  40. <input v-else disabled placeholder="选择省市区" />
  41. <text class="iconfont2">&#xe65f;</text>
  42. </view>
  43. <view class="form-title">详细地址</view>
  44. <view class="form-item">
  45. <input v-model="form.address" placeholder="请输入详细地址" />
  46. </view>
  47. <view class="form-title required">情况说明</view>
  48. <view class="form-item no-border">
  49. <u-input v-model="form.explanation" type="textarea" border height="214" maxlength="500"
  50. placeholder="请详细说明帮扶对象的情况" style="background-color: #FAFAFA;" />
  51. </view>
  52. <view class="form-split"></view>
  53. <view class="detail-top-title">
  54. <image class="line" src="/static/common/line1.png"></image>
  55. <text class="title">推荐人信息</text>
  56. <image class="line" src="/static/common/line1.png"></image>
  57. </view>
  58. <view class="form-title required">联系人</view>
  59. <view class="form-item">
  60. <input v-model="form.contacts" placeholder="请输入推荐人姓名" :maxlength="10" />
  61. </view>
  62. <view class="form-title required">联系电话</view>
  63. <view class="form-item">
  64. <input v-model="form.contact_number" type="number" placeholder="请输入推荐人联系电话" :maxlength="11" />
  65. </view>
  66. <view class="form-tip">
  67. 注意:您填写捐赠信息后,基金工作人员将会电话联系帮扶对象或您、确定具体帮扶事宜!
  68. </view>
  69. <button class="submit-btn" @click="submit()">立即提交</button>
  70. </view>
  71. <uni-popup class="submit-popup" ref="submitPopup" type="center" :mask-click="false">
  72. <view class="content-box">
  73. <view class="title">提交完成</view>
  74. <view class="content">
  75. <image class="success-icon" src="/static/common/success-icon.png"></image>
  76. <view class="tip" style="width: 416rpx;">
  77. 公益捐款信息已经提交,工作人员会 尽快与您取得联系对接帮扶事宜。
  78. </view>
  79. <button class="btn" @click="closePopup()">知道了</button>
  80. </view>
  81. </view>
  82. </uni-popup>
  83. <!-- 选择性别 -->
  84. <u-select v-model="sexShow" mode="single-column" :list="sexList" @confirm="sexConfirm"></u-select>
  85. <!-- 选择地区 -->
  86. <u-select v-model="addressShow" mode="mutil-column-auto" :list="addressArr" @confirm="addressConfirm">
  87. </u-select>
  88. <u-modal v-model="tostShow" content="确认提交?" show-cancel-button @confirm="affirmSubmit"></u-modal>
  89. </view>
  90. </template>
  91. <script>
  92. export default {
  93. data() {
  94. return {
  95. config: {
  96. back: true,
  97. title: '推荐帮扶',
  98. color: '#1a1a1a',
  99. backgroundColor: [1, '#fff'],
  100. statusBarFontColor: 'black'
  101. },
  102. form: {},
  103. imgFiles: [],
  104. sexShow: false,
  105. sexList: [{
  106. value: 0,
  107. label: '男'
  108. },
  109. {
  110. value: 1,
  111. label: '女'
  112. }
  113. ],
  114. addressShow: false,
  115. addressArr: [],
  116. tostShow: false
  117. }
  118. },
  119. onLoad() {
  120. this.getAddressCode()
  121. },
  122. methods: {
  123. getAddressCode() {
  124. this.$http.get('/cnarea/tree-lbs').then(res => {
  125. if (res && res.code == 200) {
  126. this.addressArr = res.tree.children;
  127. }
  128. })
  129. },
  130. // 选择性别
  131. sexConfirm(e) {
  132. this.form.sex = e[0].value;
  133. },
  134. // 选择地区
  135. addressConfirm(e) {
  136. this.form.province_name = e[0].label;
  137. this.form.province_code = e[0].value;
  138. this.form.city_name = e[1].label;
  139. this.form.city_code = e[1].value;
  140. this.form.area_name = e[2].label;
  141. this.form.area_code = e[2].value;
  142. },
  143. submit() {
  144. let regExp = new RegExp("^1\\d{10}$");
  145. if (!this.form.real_name) {
  146. uni.showToast({
  147. icon: "none",
  148. title: '请输入帮扶对象姓名',
  149. duration: 1500
  150. });
  151. return
  152. } else if (!this.form.phone) {
  153. uni.showToast({
  154. icon: "none",
  155. title: '请输入帮扶对象联系电话',
  156. duration: 1500
  157. });
  158. return
  159. } else if (!regExp.test(this.form.phone)) {
  160. uni.showToast({
  161. icon: "none",
  162. title: '请输入正确的帮扶对象联系电话',
  163. duration: 1500
  164. });
  165. return
  166. } else if (!this.form.explanation) {
  167. uni.showToast({
  168. icon: "none",
  169. title: '请输入情况说明',
  170. duration: 1500
  171. });
  172. return
  173. } else if (!this.form.contacts) {
  174. uni.showToast({
  175. icon: "none",
  176. title: '请输入推荐人姓名',
  177. duration: 1500
  178. });
  179. return
  180. } else if (!this.form.contact_number) {
  181. uni.showToast({
  182. icon: "none",
  183. title: '请输入推荐人联系电话',
  184. duration: 1500
  185. });
  186. return
  187. } else if (!regExp.test(this.form.contact_number)) {
  188. uni.showToast({
  189. icon: "none",
  190. title: '请输入正确的推荐人联系电话',
  191. duration: 1500
  192. });
  193. return
  194. }
  195. this.tostShow = true;
  196. },
  197. affirmSubmit() {
  198. uni.showLoading({
  199. title: '加载中'
  200. });
  201. this.$http.post('/recommend/assist/submit', this.form).then(res => {
  202. uni.hideLoading();
  203. if (res && res.code == 200) {
  204. this.$refs.submitPopup.open();
  205. }
  206. })
  207. },
  208. closePopup() {
  209. this.$refs.submitPopup.close();
  210. uni.navigateBack()
  211. },
  212. }
  213. };
  214. </script>
  215. <style lang="scss" scoped>
  216. .main {
  217. box-sizing: border-box;
  218. .cover {
  219. width: 100%;
  220. height: 340rpx;
  221. background-color: #f2f2f2;
  222. }
  223. .content {
  224. box-sizing: border-box;
  225. padding: 40rpx 0 18rpx 0;
  226. }
  227. .form-item {
  228. text {
  229. font-size: 30rpx;
  230. }
  231. }
  232. }
  233. </style>