|
|
@@ -115,7 +115,6 @@
|
|
|
<button class="g-share-btn" open-type="share"></button>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <!-- <view class="user-tags">张三</view> -->
|
|
|
<view class="r-user-list" v-for="item in userData" :key="item.id">
|
|
|
<view class="minus-user" @click="deleteUser(item)">-</view>
|
|
|
<view class="r-list">
|
|
|
@@ -128,6 +127,35 @@
|
|
|
<view class="add-text">添加用户</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
+ <view class="g-userinfo-card" v-for="(item, index) in userData" :key="item.id">
|
|
|
+ <view style="font-size: 28rpx;font-weight: bold;">补充信息{{ index + 1 }}({{ item.fullName }})</view>
|
|
|
+ <view class="use-is-schoolStutent">
|
|
|
+ <view class="is-schoolStutent"><text style="color: red;">*</text>是否本校({{ schoolName }})学生</view>
|
|
|
+ <view class="radio-box">
|
|
|
+ <view class="select-radio" @click="setSchoolStudent(index, true)">
|
|
|
+ <zzx-icon :name="schoolStudentStatus[index] === true ? 'selected' : 'unchecked'"
|
|
|
+ size="14"></zzx-icon>
|
|
|
+ <view style="margin-bottom: 6rpx;">是</view>
|
|
|
+ </view>
|
|
|
+ <view style="width: 40rpx;"></view>
|
|
|
+ <view class="select-radio" @click="setSchoolStudent(index, false)">
|
|
|
+ <zzx-icon :name="schoolStudentStatus[index] === false ? 'selected' : 'unchecked'"
|
|
|
+ size="14"></zzx-icon>
|
|
|
+ <view style="margin-bottom: 6rpx;">否</view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="use-select-grade-class" v-if="schoolStudentStatus[index] === true">
|
|
|
+ <view class="select-grade-title"><text style="color: red;">*</text>年级班级</view>
|
|
|
+ <view class="select-grade-input">
|
|
|
+ <input type="text" placeholder="请输入" v-model="gradeClassInfo[index].grade" />
|
|
|
+ <view>年级</view>
|
|
|
+ <input type="text" placeholder="请输入" v-model="gradeClassInfo[index].class" />
|
|
|
+ <view>班</view>
|
|
|
+ </view>
|
|
|
+ <view class="select-grade-tips">请输入数字,年级范围为1-12,班级范围为1-40</view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
<view class="g-usetips-card">
|
|
|
<view class="use-title">{{ placeId ? '使用须知' : '购买须知' }}</view>
|
|
|
<block v-if="previewCourseInfo?.usableCount && previewCourseInfo?.indate">
|
|
|
@@ -149,11 +177,6 @@
|
|
|
<rich-text :nodes="fixImgStyle(previewCourseInfo?.reminder)"></rich-text>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <!-- <view class="use-tips-more"
|
|
|
- @click="RouterUtils.to_page(`/pages/index/useNotice/index?reminder=${previewCourseInfo?.reminder}`)">
|
|
|
- <view class="more-text">查看更多</view>
|
|
|
- <view class="use-line"></view>
|
|
|
- </view> -->
|
|
|
</view>
|
|
|
<view class="g-usetips-card">
|
|
|
<view class="use-title">服务保障</view>
|
|
|
@@ -163,10 +186,6 @@
|
|
|
{{ previewCourseInfo?.refundType == 1 ? '未消费随时退款,过期未消费自动退款。' : '不支退款,请慎重考虑后购买。' }}
|
|
|
</view>
|
|
|
</view>
|
|
|
- <!-- <view class="use-tips-more">
|
|
|
- <view class="more-text">查看更多</view>
|
|
|
- <view class="use-line"></view>
|
|
|
- </view> -->
|
|
|
</view>
|
|
|
<view style="height: 166rpx;"></view>
|
|
|
<view class="footer footer-box">
|
|
|
@@ -222,9 +241,9 @@
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
-import { ref, onMounted, computed } from 'vue';
|
|
|
+import { ref, onMounted, computed, watch } from 'vue';
|
|
|
import { onLoad, onShareAppMessage } from '@dcloudio/uni-app';
|
|
|
-import { RouterUtils, TipsUtils, idCardHide, debounce,fixImgStyle } from '@/utils/util';
|
|
|
+import { RouterUtils, TipsUtils, idCardHide, debounce, fixImgStyle } from '@/utils/util';
|
|
|
import { http } from '@/utils/http'
|
|
|
import { useCacheStore } from '@/stores/cache'
|
|
|
const cache = useCacheStore()
|
|
|
@@ -233,12 +252,14 @@ const select_insurance = ref(false)
|
|
|
const loadType = ref(1)
|
|
|
const buyType = ref()
|
|
|
const placeId = ref()
|
|
|
+const schoolName = ref()
|
|
|
onLoad((options) => {
|
|
|
console.log(options);
|
|
|
loadType.value = options.type
|
|
|
courseId.value = options.courseId
|
|
|
placeId.value = options.placeId
|
|
|
buyType.value = options.buyType
|
|
|
+ schoolName.value = options.schoolName
|
|
|
orderFormData.value.type = options.orderType
|
|
|
orderFormData.value.orFreeOrder = options.buyType
|
|
|
orderFormData.value.amount = 1
|
|
|
@@ -264,6 +285,16 @@ onMounted(() => {
|
|
|
getInsureData()
|
|
|
})
|
|
|
|
|
|
+
|
|
|
+// 设置某个用户是否为学生
|
|
|
+const setSchoolStudent = (index, isStudent) => {
|
|
|
+ if (schoolStudentStatus.value[index] === true && isStudent === false) {
|
|
|
+ gradeClassInfo.value[index].grade = '';
|
|
|
+ gradeClassInfo.value[index].class = '';
|
|
|
+ }
|
|
|
+ schoolStudentStatus.value[index] = isStudent;
|
|
|
+};
|
|
|
+
|
|
|
const toUserList = () => {
|
|
|
RouterUtils.to_page('/pages/index/userList/index')
|
|
|
}
|
|
|
@@ -281,6 +312,17 @@ const get_userData = () => {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+const schoolStudentStatus = ref([])
|
|
|
+const gradeClassInfo = ref([])
|
|
|
+
|
|
|
+watch(userData, (newUserData) => {
|
|
|
+ schoolStudentStatus.value = new Array(newUserData.length).fill(false);
|
|
|
+ gradeClassInfo.value = new Array(newUserData.length).fill(null).map(() => ({
|
|
|
+ grade: '',
|
|
|
+ class: ''
|
|
|
+ }));
|
|
|
+}, { immediate: true });
|
|
|
+
|
|
|
const deleteUser = async (e) => {
|
|
|
let res: any = await TipsUtils.tips_alert('确定删除该用户吗?', true)
|
|
|
if (res.confirm) {
|
|
|
@@ -431,14 +473,37 @@ let orderFormData = ref({
|
|
|
assertEndTime: '',
|
|
|
insurePriceId: '',
|
|
|
familyMembersIds: '',
|
|
|
- }
|
|
|
+ },
|
|
|
+ addGradeLevelInformation: []
|
|
|
})
|
|
|
|
|
|
const orderCode = ref(null)
|
|
|
const orderId = ref(null)
|
|
|
const submitOrderImpl = () => {
|
|
|
orderFormData.value.amount = countTotal.value
|
|
|
+ for (let i = 0; i < userData.value.length; i++) {
|
|
|
+ if (schoolStudentStatus.value[i] === true) {
|
|
|
+ const grade = gradeClassInfo.value[i].grade;
|
|
|
+ const clazz = gradeClassInfo.value[i].class;
|
|
|
|
|
|
+ if (!grade || !clazz) {
|
|
|
+ return TipsUtils.tips_toast(`请为${userData.value[i].fullName}输入完整的年级和班级信息`);
|
|
|
+ }
|
|
|
+ const gradeNum = parseInt(grade);
|
|
|
+ const classNum = parseInt(clazz);
|
|
|
+ if (isNaN(gradeNum) || gradeNum < 1 || gradeNum > 12) {
|
|
|
+ return TipsUtils.tips_toast(`请为${userData.value[i].fullName}输入有效的年级(1-12)`);
|
|
|
+ }
|
|
|
+ if (isNaN(classNum) || classNum < 1 || classNum > 40) {
|
|
|
+ return TipsUtils.tips_toast(`请为${userData.value[i].fullName}输入有效的班级(1-40)`);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ orderFormData.value.addGradeLevelInformation = userData.value.map((user, index) => ({
|
|
|
+ class: schoolStudentStatus.value[index] === true ? gradeClassInfo.value[index].class : '',
|
|
|
+ familyId: user.id,
|
|
|
+ levelInfo: schoolStudentStatus.value[index] === true ? `${gradeClassInfo.value[index].grade}年级 ${gradeClassInfo.value[index].class}班` : ''
|
|
|
+ }));
|
|
|
// 计算总金额
|
|
|
let totalPrice = 0;
|
|
|
if (previewCourseInfo.value?.originalPrice) {
|
|
|
@@ -466,7 +531,6 @@ const submitOrderImpl = () => {
|
|
|
if (!userData || userData.value.length === 0) {
|
|
|
delete data.familyIds
|
|
|
}
|
|
|
-
|
|
|
// 如果总金额为0,直接创建订单并跳转,不调用微信支付
|
|
|
if (totalPrice === 0 || buyType.value == 1) {
|
|
|
http.post('/order/createOrder', data, { loading: true }).then((res) => {
|
|
|
@@ -829,6 +893,56 @@ const getOrderQuery = (orderCode: string, orderId: string, retryCount = 0) => {
|
|
|
background: #FFFFFF;
|
|
|
border-radius: 32rpx;
|
|
|
|
|
|
+ .use-is-schoolStutent {
|
|
|
+ .is-schoolStutent {
|
|
|
+ font-size: 24rpx;
|
|
|
+ color: #222222;
|
|
|
+ }
|
|
|
+
|
|
|
+ .radio-box {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ font-size: 24rpx;
|
|
|
+ margin-top: 20rpx;
|
|
|
+
|
|
|
+ .select-radio {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ gap: 8rpx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .use-select-grade-class {
|
|
|
+ margin-top: 20rpx;
|
|
|
+ font-size: 24rpx;
|
|
|
+
|
|
|
+ .select-grade-title {
|
|
|
+ margin-top: 20rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .select-grade-input {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ gap: 8rpx;
|
|
|
+ margin-top: 20rpx;
|
|
|
+
|
|
|
+ &>input {
|
|
|
+ width: 132rpx;
|
|
|
+ height: 60rpx;
|
|
|
+ background-color: rgba(246, 246, 246, 1);
|
|
|
+ border-radius: 16rpx;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .select-grade-tips {
|
|
|
+ margin-top: 20rpx;
|
|
|
+ font-size: 24rpx;
|
|
|
+ color: #AAAAAA;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
.r-user {
|
|
|
display: flex;
|
|
|
align-items: center;
|