|
@@ -12,7 +12,7 @@
|
|
<view class="ld">报名资料填写</view>
|
|
<view class="ld">报名资料填写</view>
|
|
<view class="radio_box">
|
|
<view class="radio_box">
|
|
<u-radio-group
|
|
<u-radio-group
|
|
- v-model="scheduleValue"
|
|
|
|
|
|
+ v-model="activity_schedule_id"
|
|
placement="column"
|
|
placement="column"
|
|
|
|
|
|
>
|
|
>
|
|
@@ -29,25 +29,26 @@
|
|
</view>
|
|
</view>
|
|
|
|
|
|
<!-- 动态表单 -->
|
|
<!-- 动态表单 -->
|
|
- <block v-for="item in signupParams" :key="item.id">
|
|
|
|
- <view @click="getTitle(item)" class="" style="margin-top: 30rpx;">
|
|
|
|
|
|
+ <block v-for="item in signupParams" :key="item.id">
|
|
|
|
+ <!-- @click="getTitle(item)" -->
|
|
|
|
+ <view class="" style="margin-top: 30rpx;">
|
|
<text >{{ item.title }}</text>
|
|
<text >{{ item.title }}</text>
|
|
<!-- <text v-if="item.tip" class="tip">{{ item.tip }}</text> -->
|
|
<!-- <text v-if="item.tip" class="tip">{{ item.tip }}</text> -->
|
|
<!-- 根据 type 属性决定渲染哪种类型的输入 -->
|
|
<!-- 根据 type 属性决定渲染哪种类型的输入 -->
|
|
<u--input v-if="item.type === 'string'"
|
|
<u--input v-if="item.type === 'string'"
|
|
v-model="item.value"
|
|
v-model="item.value"
|
|
border="surround"
|
|
border="surround"
|
|
- @change="onInput"
|
|
|
|
|
|
+ @change="onInput(item)"
|
|
:placeholder="item.tip" />
|
|
:placeholder="item.tip" />
|
|
|
|
|
|
- <u-radio-group v-if="item.type === 'radio'" placement="column">
|
|
|
|
|
|
+ <u-radio-group v-if="item.type === 'radio'" placement="column">
|
|
<u-radio v-for="(fruitName, fruitId) in item.params" :key="fruitId"
|
|
<u-radio v-for="(fruitName, fruitId) in item.params" :key="fruitId"
|
|
:label="fruitName"
|
|
:label="fruitName"
|
|
- :name="fruitName"
|
|
|
|
|
|
+ :name="item.name + '-' + fruitName"
|
|
@change="radioChange"
|
|
@change="radioChange"
|
|
:customStyle="{ marginBottom: '8px', height: '30px' }"
|
|
:customStyle="{ marginBottom: '8px', height: '30px' }"
|
|
>
|
|
>
|
|
- <!-- {{ fruitName }} -->
|
|
|
|
|
|
+ {{ fruitName }}
|
|
</u-radio>
|
|
</u-radio>
|
|
</u-radio-group>
|
|
</u-radio-group>
|
|
|
|
|
|
@@ -55,7 +56,7 @@
|
|
</view>
|
|
</view>
|
|
</block>
|
|
</block>
|
|
|
|
|
|
- <view class="bm_btn" @click="tjcyBtn">添加家庭成员</view>
|
|
|
|
|
|
+ <view class="bm_btn" @click="tjcyBtn">添加成员</view>
|
|
<view class="cy_box" v-for="(item,index) in cyList" :key="index">
|
|
<view class="cy_box" v-for="(item,index) in cyList" :key="index">
|
|
<view class="" style="display: flex;">
|
|
<view class="" style="display: flex;">
|
|
<view class="icon_box">
|
|
<view class="icon_box">
|
|
@@ -68,13 +69,13 @@
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
|
|
- <view @click="removePassenger(index)" style="width: 60rpx;height: 60rpx;">
|
|
|
|
|
|
+ <view @click="removeMembers(index)" style="width: 60rpx;height: 60rpx;">
|
|
<u-icon name="trash" color="#858789" size="20" ></u-icon>
|
|
<u-icon name="trash" color="#858789" size="20" ></u-icon>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<!-- -->
|
|
<!-- -->
|
|
|
|
|
|
- <view class="tjbm_btn">提交报名</view>
|
|
|
|
|
|
+ <view class="tjbm_btn" @click="submitActivitySignupInfo">提交报名</view>
|
|
<!-- 阅读协议 -->
|
|
<!-- 阅读协议 -->
|
|
<view class="ydxy">
|
|
<view class="ydxy">
|
|
<u-checkbox-group @change="xyShow=!xyShow" >
|
|
<u-checkbox-group @change="xyShow=!xyShow" >
|
|
@@ -93,7 +94,7 @@
|
|
<view style="margin-top: 20rpx"></view>
|
|
<view style="margin-top: 20rpx"></view>
|
|
<view class="bt_box">
|
|
<view class="bt_box">
|
|
|
|
|
|
- <view @click="volhow=false" class="bt2">我已知悉</view>
|
|
|
|
|
|
+ <view class="bt2" @click="volhow=false">我已知悉</view>
|
|
</view>
|
|
</view>
|
|
</u-popup>
|
|
</u-popup>
|
|
|
|
|
|
@@ -106,65 +107,21 @@
|
|
export default {
|
|
export default {
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
- signupParams : [
|
|
|
|
- // {
|
|
|
|
- // id: 1,
|
|
|
|
- // name: "fruit",
|
|
|
|
- // group: "basic",
|
|
|
|
- // title: "请选择参赛类型",
|
|
|
|
- // tip: "请选择一款水果",
|
|
|
|
- // type: "radio",
|
|
|
|
- // value: "",
|
|
|
|
- // content: { 1: "1.5公里线路(适合家庭及儿童)", 2: "3公里线路(适合初学者)", 3: "5公里线路(适合跑步爱好者)" },
|
|
|
|
- // rule: "required"
|
|
|
|
- // },
|
|
|
|
- {
|
|
|
|
- id: 2,
|
|
|
|
- name: "name",
|
|
|
|
- group: "basic",
|
|
|
|
- title: "姓名",
|
|
|
|
- tip: "请填写姓名",
|
|
|
|
- type: "string",
|
|
|
|
- value: "张宁",
|
|
|
|
- rule: "required"
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- id: 3,
|
|
|
|
- name: "name",
|
|
|
|
- group: "basic",
|
|
|
|
- title: "年龄",
|
|
|
|
- tip: "请填写年龄",
|
|
|
|
- type: "string",
|
|
|
|
- value: "18",
|
|
|
|
- rule: "required"
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- id: 4,
|
|
|
|
- name: "name",
|
|
|
|
- group: "basic",
|
|
|
|
- title: "手机",
|
|
|
|
- tip: "请填写手机号",
|
|
|
|
- type: "string",
|
|
|
|
- value: "1866166265",
|
|
|
|
- rule: "required"
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- ],
|
|
|
|
|
|
+ radioName: '',
|
|
|
|
+ signupParams : [],
|
|
activityId: 1,
|
|
activityId: 1,
|
|
activityDesc: '',
|
|
activityDesc: '',
|
|
activityTitle: '',
|
|
activityTitle: '',
|
|
volhow:false,
|
|
volhow:false,
|
|
xyShow:false,
|
|
xyShow:false,
|
|
- mobile: '',
|
|
|
|
- mailbox: '',
|
|
|
|
// 家庭成员
|
|
// 家庭成员
|
|
cyList:[],
|
|
cyList:[],
|
|
ydxyShow:false,
|
|
ydxyShow:false,
|
|
// 默认选中第一个
|
|
// 默认选中第一个
|
|
- scheduleValue: 1,
|
|
|
|
|
|
+ activity_schedule_id: 1,
|
|
scheduleList: [],
|
|
scheduleList: [],
|
|
params:{
|
|
params:{
|
|
- scheduleValue: 1,
|
|
|
|
|
|
+ activity_schedule_id: 1,
|
|
}
|
|
}
|
|
};
|
|
};
|
|
},
|
|
},
|
|
@@ -176,7 +133,17 @@ export default {
|
|
that.activityTitle = option.title;
|
|
that.activityTitle = option.title;
|
|
that.getActivityScheduleList(that.activityId);
|
|
that.getActivityScheduleList(that.activityId);
|
|
that.getActivitySignupParams(that.activityId);
|
|
that.getActivitySignupParams(that.activityId);
|
|
- this.loadPassengers();
|
|
|
|
|
|
+ that.params.activity_id = option.id;
|
|
|
|
+ },
|
|
|
|
+ onShow() {
|
|
|
|
+ // console.log(uni.getStorageSync('selectedMembers'), 'selectedMembers');
|
|
|
|
+ that.loadMembers();
|
|
|
|
+ },
|
|
|
|
+ computed: {
|
|
|
|
+ // 筛选出 type 为 radio 的数据
|
|
|
|
+ radioItems() {
|
|
|
|
+ return this.signupParams.filter((item) => item.type === "radio");
|
|
|
|
+ },
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
//获取活动日程列表
|
|
//获取活动日程列表
|
|
@@ -208,55 +175,94 @@ export default {
|
|
return;
|
|
return;
|
|
} else {
|
|
} else {
|
|
that.signupParams = data.data;
|
|
that.signupParams = data.data;
|
|
- console.log(that.signupParams);
|
|
|
|
|
|
+ //这边需要把每个参都存到params里面
|
|
|
|
+ that.signupParams.forEach((item) => {
|
|
|
|
+ that.params[item.name] = '';
|
|
|
|
+ });
|
|
|
|
+ console.log(that.params,'sparams');
|
|
|
|
+ // console.log(that.signupParams,'that.signupParams')
|
|
}
|
|
}
|
|
}
|
|
}
|
|
);
|
|
);
|
|
},
|
|
},
|
|
- // 从本地存储中获取乘客信息
|
|
|
|
- loadPassengers() {
|
|
|
|
- const storedSelectedPassengers = uni.getStorageSync('selectedPassengers');
|
|
|
|
- if (storedSelectedPassengers) {
|
|
|
|
- this.cyList = storedSelectedPassengers;
|
|
|
|
- } else {
|
|
|
|
- this.cyList = [];
|
|
|
|
- }
|
|
|
|
|
|
+ submitActivitySignupInfo() {
|
|
|
|
+ console.log(that.xyShow);
|
|
|
|
+ if (that.xyShow === false) {
|
|
|
|
+ that.$common.errorToShow('请阅读并同意协议');
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ let params = that.params;
|
|
|
|
+ if (that.cyList.length === 0) {
|
|
|
|
+ that.$common.errorToShow('请选择报名成员');
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ params.identities = that.cyList.map(item => item.id).join(",");
|
|
|
|
+ console.log(params, 'params');
|
|
|
|
+ this.$api.submitActivitySignupInfo(params,
|
|
|
|
+ data => {
|
|
|
|
+ if (data.code == 0) {
|
|
|
|
+ that.$common.errorToShow(data.msg);
|
|
|
|
+ return;
|
|
|
|
+ } else {
|
|
|
|
+ that.$common.successToShow(data.msg);
|
|
|
|
+ if (data.code == 1) {
|
|
|
|
+ setTimeout(
|
|
|
|
+ function(){
|
|
|
|
+ uni.navigateBack({
|
|
|
|
+ delta: 1
|
|
|
|
+ });
|
|
|
|
+ }, 1500);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ );
|
|
},
|
|
},
|
|
- getTitle(title) {
|
|
|
|
- console.log(title, 'title');
|
|
|
|
|
|
+ volhowChange(volhow){
|
|
|
|
+ that.volhow = !volhow;
|
|
|
|
+ console.log(that.volhow);
|
|
},
|
|
},
|
|
radioChange(n) {
|
|
radioChange(n) {
|
|
- console.log(n, 'n');
|
|
|
|
- let title = '性别';
|
|
|
|
- that.params[title] = n;
|
|
|
|
- console.log(that.params);
|
|
|
|
|
|
+ const [field, value] = n.split("-");
|
|
|
|
+ let title = field;
|
|
|
|
+ that.params[title] = value;
|
|
|
|
+ // console.log(that.params,'that.params');
|
|
},
|
|
},
|
|
scheduleChange(n) {
|
|
scheduleChange(n) {
|
|
- that.scheduleValue = n;
|
|
|
|
- that.params.scheduleValue = n;
|
|
|
|
- console.log(that.params);
|
|
|
|
- console.log('scheduleChange',that.scheduleValue);
|
|
|
|
- },
|
|
|
|
- onInput(e) {
|
|
|
|
- // 更新字符串值
|
|
|
|
- console.log(e)
|
|
|
|
|
|
+ that.activity_schedule_id = n;
|
|
|
|
+ that.params.activity_schedule_id = n;
|
|
|
|
+ // console.log(that.params);
|
|
|
|
+ // console.log('scheduleChange',that.activity_schedule_id);
|
|
|
|
+ },
|
|
|
|
+ onInput(item) {
|
|
|
|
+ that.$set(that.params, item.name, item.value); // 使用Vue的$set方法保证响应式
|
|
|
|
+ // console.log('this.params:', this.params);
|
|
|
|
+ },
|
|
|
|
+ tjcyBtn(){
|
|
|
|
+ uni.navigateTo({
|
|
|
|
+ url: '/index_fenbao/XuanJiangYuan/ck_page'
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ // 从本地存储中获取乘客信息
|
|
|
|
+ loadMembers() {
|
|
|
|
+ const storedSelectedMembers = uni.getStorageSync('selectedMembers');
|
|
|
|
+ // console.log(storedSelectedMembers, 'storedSelectedMembers')
|
|
|
|
+ if (storedSelectedMembers) {
|
|
|
|
+ that.cyList = storedSelectedMembers;
|
|
|
|
+ } else {
|
|
|
|
+ that.cyList = [];
|
|
|
|
+ }
|
|
},
|
|
},
|
|
- tjcyBtn(){
|
|
|
|
- uni.navigateTo({
|
|
|
|
- url: '/index_fenbao/XuanJiangYuan/ck_page'
|
|
|
|
- });
|
|
|
|
-},
|
|
|
|
- removePassenger(index) {
|
|
|
|
- // 移除乘客并更新本地存储
|
|
|
|
- this.cyList.splice(index, 1);
|
|
|
|
- // 更新本地存储中的乘客信息
|
|
|
|
- uni.setStorageSync('passengers', this.cyList);
|
|
|
|
- // 提示删除成功
|
|
|
|
- uni.showToast({
|
|
|
|
- title: '删除成功',
|
|
|
|
- icon: 'success'
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
|
|
+ removeMembers(index) {
|
|
|
|
+ // 移除乘客并更新本地存储
|
|
|
|
+ that.cyList.splice(index, 1);
|
|
|
|
+ // 更新本地存储中的乘客信息
|
|
|
|
+ uni.setStorageSync('selectedMembers', that.cyList);
|
|
|
|
+ // 提示删除成功
|
|
|
|
+ uni.showToast({
|
|
|
|
+ title: '删除成功',
|
|
|
|
+ icon: 'success'
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
|
|
}
|
|
}
|
|
};
|
|
};
|