bm_page.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  1. <template>
  2. <view class="box">
  3. <u-navbar :title="activityTitle" autoBack :placeholder="true" bgColor="#fee1b9"></u-navbar>
  4. <view class="ban">
  5. <view class="hdjs_box">
  6. <view class="hdjs_tit">活动介绍</view>
  7. <view class="hdjs_xq" style="overflow: scroll">{{activityDesc}}</view>
  8. </view>
  9. <!-- -->
  10. <view class="ld">报名资料填写</view>
  11. <view class="radio_box">
  12. <u-radio-group
  13. v-model="scheduleValue"
  14. placement="column"
  15. >
  16. <u-radio
  17. :customStyle="{marginBottom: '8px'}"
  18. v-for="(item, index) in scheduleList"
  19. :key="index"
  20. :label="item.desc"
  21. :name="item.id"
  22. @change="scheduleChange"
  23. >
  24. </u-radio>
  25. </u-radio-group>
  26. </view>
  27. <!-- 动态表单 -->
  28. <block v-for="item in signupParams" :key="item.id">
  29. <view @click="getTitle(item)" class="" style="margin-top: 30rpx;">
  30. <text >{{ item.title }}</text>
  31. <!-- <text v-if="item.tip" class="tip">{{ item.tip }}</text> -->
  32. <!-- 根据 type 属性决定渲染哪种类型的输入 -->
  33. <u--input v-if="item.type === 'string'"
  34. v-model="item.value"
  35. border="surround"
  36. @change="onInput"
  37. :placeholder="item.tip" />
  38. <u-radio-group v-if="item.type === 'radio'" placement="column">
  39. <u-radio v-for="(fruitName, fruitId) in item.params" :key="fruitId"
  40. :label="fruitName"
  41. :name="fruitName"
  42. @change="radioChange"
  43. :customStyle="{ marginBottom: '8px', height: '30px' }"
  44. >
  45. <!-- {{ fruitName }} -->
  46. </u-radio>
  47. </u-radio-group>
  48. <!-- 其他类型可以根据需要添加 -->
  49. </view>
  50. </block>
  51. <view class="bm_btn" @click="tjcyBtn">添加家庭成员</view>
  52. <view class="cy_box" v-for="(item,index) in cyList" :key="index">
  53. <view class="" style="display: flex;">
  54. <view class="icon_box">
  55. <u-icon name="account" color="#000000" size="20"></u-icon>
  56. </view>
  57. <view style="margin-left: 20rpx">
  58. <view class="cy_name">{{item.name}}</view>
  59. <view class="cy_age">年龄:{{item.age}}</view>
  60. </view>
  61. </view>
  62. <view @click="removePassenger(index)" style="width: 60rpx;height: 60rpx;">
  63. <u-icon name="trash" color="#858789" size="20" ></u-icon>
  64. </view>
  65. </view>
  66. <!-- -->
  67. <view class="tjbm_btn">提交报名</view>
  68. <!-- 阅读协议 -->
  69. <view class="ydxy">
  70. <u-checkbox-group @change="xyShow=!xyShow" >
  71. <u-checkbox v-model="xyShow" shape="circle" ></u-checkbox>
  72. </u-checkbox-group>
  73. <view class="" @click="volhow=true">
  74. 阅读并同意《隐私政策》和《用户协议》
  75. </view>
  76. </view>
  77. </view>
  78. <!-- 协议弹层 -->
  79. <u-popup bgColor="#f2c8a2" :show="volhow" mode="center" customStyle="width:600rpx;padding: 30rpx;" round="20rpx">
  80. <view style="text-align: center; font-size: 30rpx">请阅读以下协议</view>
  81. <view style="margin-top: 20rpx"></view>
  82. <view class="bt_box">
  83. <view @click="volhow=false" class="bt2">我已知悉</view>
  84. </view>
  85. </u-popup>
  86. </view>
  87. </view>
  88. </template>
  89. <script>
  90. let that;
  91. export default {
  92. data() {
  93. return {
  94. signupParams : [
  95. // {
  96. // id: 1,
  97. // name: "fruit",
  98. // group: "basic",
  99. // title: "请选择参赛类型",
  100. // tip: "请选择一款水果",
  101. // type: "radio",
  102. // value: "",
  103. // content: { 1: "1.5公里线路(适合家庭及儿童)", 2: "3公里线路(适合初学者)", 3: "5公里线路(适合跑步爱好者)" },
  104. // rule: "required"
  105. // },
  106. {
  107. id: 2,
  108. name: "name",
  109. group: "basic",
  110. title: "姓名",
  111. tip: "请填写姓名",
  112. type: "string",
  113. value: "张宁",
  114. rule: "required"
  115. },
  116. {
  117. id: 3,
  118. name: "name",
  119. group: "basic",
  120. title: "年龄",
  121. tip: "请填写年龄",
  122. type: "string",
  123. value: "18",
  124. rule: "required"
  125. },
  126. {
  127. id: 4,
  128. name: "name",
  129. group: "basic",
  130. title: "手机",
  131. tip: "请填写手机号",
  132. type: "string",
  133. value: "1866166265",
  134. rule: "required"
  135. },
  136. ],
  137. activityId: 1,
  138. activityDesc: '',
  139. activityTitle: '',
  140. volhow:false,
  141. xyShow:false,
  142. mobile: '',
  143. mailbox: '',
  144. // 家庭成员
  145. cyList:[],
  146. ydxyShow:false,
  147. // 默认选中第一个
  148. scheduleValue: 1,
  149. scheduleList: [],
  150. params:{
  151. scheduleValue: 1,
  152. }
  153. };
  154. },
  155. onLoad(option) {
  156. console.log(option);
  157. that = this;
  158. that.activityId = option.id;
  159. that.activityDesc = option.desc;
  160. that.activityTitle = option.title;
  161. that.getActivityScheduleList(that.activityId);
  162. that.getActivitySignupParams(that.activityId);
  163. this.loadPassengers();
  164. },
  165. methods: {
  166. //获取活动日程列表
  167. getActivityScheduleList(id) {
  168. this.$api.activityScheduleList(
  169. {
  170. activity_id: id
  171. },
  172. data => {
  173. if (data.code == 0) {
  174. that.$common.errorToShow(data.msg);
  175. return;
  176. } else {
  177. that.scheduleList = data.data;
  178. // console.log(that.scheduleList);
  179. }
  180. }
  181. );
  182. },
  183. //获取活动报名参数
  184. getActivitySignupParams(id) {
  185. this.$api.activitySignupParams(
  186. {
  187. activity_id: id
  188. },
  189. data => {
  190. if (data.code == 0) {
  191. that.$common.errorToShow(data.msg);
  192. return;
  193. } else {
  194. that.signupParams = data.data;
  195. console.log(that.signupParams);
  196. }
  197. }
  198. );
  199. },
  200. // 从本地存储中获取乘客信息
  201. loadPassengers() {
  202. const storedSelectedPassengers = uni.getStorageSync('selectedPassengers');
  203. if (storedSelectedPassengers) {
  204. this.cyList = storedSelectedPassengers;
  205. } else {
  206. this.cyList = [];
  207. }
  208. },
  209. getTitle(title) {
  210. console.log(title, 'title');
  211. },
  212. radioChange(n) {
  213. console.log(n, 'n');
  214. let title = '性别';
  215. that.params[title] = n;
  216. console.log(that.params);
  217. },
  218. scheduleChange(n) {
  219. that.scheduleValue = n;
  220. that.params.scheduleValue = n;
  221. console.log(that.params);
  222. console.log('scheduleChange',that.scheduleValue);
  223. },
  224. onInput(e) {
  225. // 更新字符串值
  226. console.log(e)
  227. },
  228. tjcyBtn(){
  229. uni.navigateTo({
  230. url: '/index_fenbao/XuanJiangYuan/ck_page'
  231. });
  232. },
  233. removePassenger(index) {
  234. // 移除乘客并更新本地存储
  235. this.cyList.splice(index, 1);
  236. // 更新本地存储中的乘客信息
  237. uni.setStorageSync('passengers', this.cyList);
  238. // 提示删除成功
  239. uni.showToast({
  240. title: '删除成功',
  241. icon: 'success'
  242. });
  243. }
  244. }
  245. };
  246. </script>
  247. <style>
  248. .box {
  249. min-height: 100%;
  250. height: auto;
  251. width: 100%;
  252. padding-bottom: 50rpx;
  253. background-image: url('https://huli-app.wenlvti.net/app_static/minnanhun/image/gj_bg.png');
  254. background-repeat: repeat-y;
  255. background-size: 100%;
  256. }
  257. .ban {
  258. width: 92%;
  259. margin: auto;
  260. }
  261. .top_tit {
  262. width: 100%;
  263. height: 60rpx;
  264. color: black;
  265. line-height: 60rpx;
  266. text-align: center;
  267. font-size: 30rpx;
  268. background-color: #fee1b9;
  269. }
  270. .hdjs_box {
  271. height: 200rpx;
  272. color: black;
  273. margin-top: 10rpx;
  274. border-radius: 10rpx;
  275. padding: 20rpx;
  276. background-color: #fff0e3;
  277. }
  278. .hdjs_box2 {
  279. color: black;
  280. margin-top: 10rpx;
  281. border-radius: 10rpx;
  282. margin-bottom: 30rpx;
  283. padding: 20rpx;
  284. background-color: #fff0e3;
  285. }
  286. .hdjs_tit {
  287. font-size: 30rpx;
  288. }
  289. .hdjs_xq {
  290. margin-top: 10rpx;
  291. font-size: 26rpx;
  292. }
  293. .ld {
  294. font-size: 30rpx;
  295. font-weight: 700;
  296. margin-top: 20rpx;
  297. margin-bottom: 20rpx;
  298. }
  299. .u-input.data-v-113bc24f {
  300. background-color: #fee1b9 !important ;
  301. margin-top: 20rpx;
  302. }
  303. .bm_btn {
  304. width: 100%;
  305. height: 80rpx;
  306. font-size: 30rpx;
  307. line-height: 80rpx;
  308. text-align: center;
  309. color: black;
  310. border-radius: 10rpx;
  311. background-color: #fee1b9;
  312. margin-top: 20rpx;
  313. }.bt2 {
  314. width: 244rpx;
  315. height: 78rpx;
  316. background: #ca5642;
  317. border-radius: 39rpx;
  318. text-align: center;
  319. line-height: 78rpx;
  320. color: #ffffff;
  321. }
  322. .cy_box {
  323. display: flex;
  324. margin-top: 20rpx;
  325. justify-content: space-between;
  326. }
  327. .icon_box {
  328. width: 90rpx;
  329. height: 90rpx;
  330. display: flex;
  331. justify-content: center;
  332. background-color: #fee1b9;
  333. border-radius: 10rpx;
  334. }
  335. .cy_name {
  336. color: black;
  337. font-size: 28rpx;
  338. line-height: 50rpx;
  339. }
  340. .cy_age {
  341. font-size: 24rpx;
  342. color: #858789;
  343. }
  344. .bt_box {
  345. display: flex;
  346. margin-top: 50rpx;
  347. justify-content: space-around;
  348. }
  349. .tjbm_btn {
  350. width: 100%;
  351. height: 80rpx;
  352. font-size: 30rpx;
  353. line-height: 80rpx;
  354. text-align: center;
  355. color: #ffffff;
  356. border-radius: 10rpx;
  357. background-color: #fb5a02;
  358. margin-top: 50rpx;
  359. }
  360. .ydxy{
  361. display: flex;
  362. align-items: center;
  363. margin-top: 20rpx;
  364. height: 50rpx;
  365. font-size: 24rpx;
  366. color:#03A9F4;
  367. }
  368. .radio_box{
  369. background-color: #fee1b9;
  370. padding: 20rpx;
  371. border-radius: 10rpx;
  372. }
  373. </style>