提交 4f89b536 authored 作者: lihuihui's avatar lihuihui

update

上级 455a498e
...@@ -4,6 +4,7 @@ module.exports = { ...@@ -4,6 +4,7 @@ module.exports = {
}, },
extends: ['plugin:vue/essential', 'standard'], extends: ['plugin:vue/essential', 'standard'],
rules: { rules: {
'vue/no-mutating-props': 'off', // 暂时关闭
'vue/comment-directive': 'off', 'vue/comment-directive': 'off',
'space-before-function-paren': 'off' 'space-before-function-paren': 'off'
} }
......
<template> <template>
<div class="main"> <div class="main">
<commonheader @back="handlePrev" :callBack="true" />
<!-- 展示页面 --> <!-- 展示页面 -->
<div class="show_content"> <div class="show_content">
<div class="show_content_img" v-html="data.desc"></div> <div class="show_content_img" v-html="data.desc"></div>
...@@ -9,26 +10,21 @@ ...@@ -9,26 +10,21 @@
</template> </template>
<script> <script>
import Commonheader from '../components/Commonheader.vue'
export default { export default {
components: { Commonheader },
props: { props: {
stepList: { type: Array }, data: { type: Object }
data: { type: Object }, },
// eslint-disable-next-line vue/require-prop-type-constructor mounted() {
stepIndex: 0
}, },
methods: { methods: {
handlePrev() {
this.$emit('prev')
},
handleSubmit() { handleSubmit() {
const lastorder = this.stepList[this.stepList.length - 1].order this.$emit('next')
if (lastorder === this.data.order) {
this.$router.push('/')
} else {
this.$emit('next')
}
} }
},
mounted() {
window.localStorage.setItem('stepForm', this.formList)
} }
} }
</script> </script>
......
...@@ -4,12 +4,12 @@ ...@@ -4,12 +4,12 @@
<div class="main_content_banner" v-html="data.desc"></div> <div class="main_content_banner" v-html="data.desc"></div>
<div class="main_content_form"> <div class="main_content_form">
<van-form> <van-form>
<div v-for="(listIt, formIndex) in formList" :key="formIndex" class="main_content_form_list"> <div v-for="(listIt, formIndex) in data.user_fields" :key="formIndex" class="main_content_form_list">
<img <img
src="https://webapp-pub.ezijing.com/highway/h5/form_minus.png" src="https://webapp-pub.ezijing.com/highway/h5/form_minus.png"
class="btn_minus" class="btn_minus"
@click="handleMinus(formIndex)" @click="handleMinus(formIndex)"
v-if="formList.length > 1 && formIndex !== 0" v-if="formIndex !== 0"
/> />
<div class="formItemList_item" v-for="(item, index) in listIt" :key="index"> <div class="formItemList_item" v-for="(item, index) in listIt" :key="index">
<!-- 输入框 --> <!-- 输入框 -->
...@@ -77,16 +77,11 @@ ...@@ -77,16 +77,11 @@
</van-popup> </van-popup>
</div> </div>
</div> </div>
<div class="btn_operate">
<img
src="https://webapp-pub.ezijing.com/highway/h5/form_add.png"
class="btn_add"
@click="handleAdd"
v-if="formIndex === formList.length - 1"
/>
</div>
</div> </div>
</van-form> </van-form>
<div class="btn_operate">
<img src="https://webapp-pub.ezijing.com/highway/h5/form_add.png" class="btn_add" @click="handleAdd" />
</div>
</div> </div>
<div class="main_content_footer"> <div class="main_content_footer">
<template v-if="data.can_skip_pay === 1"> <template v-if="data.can_skip_pay === 1">
...@@ -109,193 +104,78 @@ ...@@ -109,193 +104,78 @@
<script> <script>
import { saveStepInfo } from '../api' import { saveStepInfo } from '../api'
import allFormList from '@/utils/formList'
export default { export default {
props: { props: {
stepList: { type: Array }, stepList: { type: Array },
data: { type: Object }, data: { type: Object },
stepIndex: { type: Number },
isShowSkip: { type: String },
personalInfo: { type: Object },
detailList: {
type: Object
},
myInfoList: { myInfoList: {
type: Array type: Array
}, }
order_join_rand: { type: String }
}, },
data() { data() {
return { return {
checkedPay: false, checkedPay: false, // 勾选是否跳过按钮
index: 0, index: 0,
cIndex: 0, cIndex: 0,
showPicker: false, showPicker: false,
showPickerTime: false, showPickerTime: false
formList: [],
form: {},
stepOrderInfo: {},
join_rand: ''
} }
}, },
mounted() { mounted() {},
console.log(this.stepList, 'stepList')
console.log(this.data, 'data')
const orderInfoList = this.$route.query.activity_detail_list // 点击我的订单也去支付,返回来拿到的表单数据
console.log(orderInfoList, 'orderInfoList')
const userFields = JSON.parse(this.stepList[this.stepIndex].user_fields)
console.log(this.$route.query.activity_detail_id, '0000')
if (this.$route.query.activity_detail_id) {
if (orderInfoList !== undefined) {
this.handleAdd()
}
// eslint-disable-next-line vue/no-mutating-props
// 订单拿回的数据回显
this.formList = orderInfoList
.sort((a, b) => {
return a.num - b.num
})
.reduce((a, b) => {
const arr = []
userFields.forEach(item => {
const find = Object.assign(
{},
allFormList.find(d => d.key === item.key)
)
find.value = b[item.key]
arr.push(find)
})
a.push(arr)
return a
}, [])
} else {
console.log(this.myInfoList, 'this.myInfoList')
// 详情拿回的数据回显
if (!this.myInfoList.length) {
this.handleAdd()
return
}
this.myInfoList.map((item, index) => {
if (item.mobile === this.detailList.info.mobile) {
item.num = 0
} else {
item.num = index + 1
}
return item
})
// eslint-disable-next-line vue/no-mutating-props
this.formList = this.myInfoList
.sort((a, b) => {
return a.num - b.num
})
.reduce((a, b) => {
const arr = []
userFields.forEach(item => {
const find = Object.assign(
{},
allFormList.find(d => d.key === item.key)
)
find.value = b[item.key]
arr.push(find)
})
a.push(arr)
return a
}, [])
}
console.log(this.formList, '1111')
},
methods: { methods: {
// 提交 // 提交
onSubmit() { onSubmit() {
const result = [] console.log(this.data, '123')
console.log(this.formList, 'this.formList')
this.formList.forEach(item => {
const resultObj = {}
item.forEach(obj => {
resultObj[obj.key] = obj.value
})
result.push(resultObj)
})
console.log(this.detailList.self_fill_in.list[0])
if (this.data.id === this.detailList.other_fill_in.list[0]?.pay_records.activity_detail_id) {
this.join_rand = this.detailList.other_fill_in.list[0]?.pay_records.join_rand
} else if (this.data.id === this.detailList.self_fill_in.list[0]?.pay_records.activity_detail_id) {
this.join_rand = this.detailList.self_fill_in.list[0]?.pay_records.join_rand
} else {
this.join_rand = this.order_join_rand || ''
}
const params = { const params = {
activity_id: this.data.activity_id, activity_id: this.data.activityInfo.id,
activity_detail_id: this.data.id, activity_detail_id: this.data.id,
need_skip: this.checkedPay ? '1' : '0', need_skip: this.checkedPay ? 1 : 0
users_info: result,
company_id: '',
join_rand: this.join_rand
} }
console.log(this.data.order, 'this.data.order') if (this.data.join_rand) {
params.join_rand = this.data.join_rand
}
params.users_info = this.data.user_fields.reduce((a, b) => {
const infos = {}
b.forEach(item => {
infos[item.key] = item.value
})
a.push(infos)
return a
}, [])
saveStepInfo(params).then(res => { saveStepInfo(params).then(res => {
if (res.code === 0) { if (res.code === 0) {
this.stepOrderInfo = res.data this.data.join_rand = res.data.join_rand
console.log(this.stepOrderInfo)
window.localStorage.setItem('stepOrderInfo', JSON.stringify(this.stepOrderInfo.list))
if (this.checkedPay) { if (this.checkedPay) {
const lastorder = this.stepList[this.stepList.length - 1].order this.stepList.splice(this.data.num, 1)
if (lastorder === this.data.order) { if (this.stepList[this.stepList.length - 1].num === this.data.num) {
this.$router.push('/') // 完成步骤跳转
this.$router.push({ path: '/' })
} else { } else {
this.$emit('next') this.$emit('next', res.data)
} }
} else { } else {
console.log(this.join_rand, 'this.join_rand') this.$emit('next', res.data)
this.$router.push({
path: '/OrderConfirm',
query: {
// stepOrderInfo: JSON.stringify(this.stepOrderInfo),
detailListName: JSON.stringify(this.detailList.activity.name),
activityId: JSON.stringify(this.data.activity_id),
join_rand: this.stepOrderInfo.list[0].pay_record.join_rand,
stepIndex: JSON.stringify(this.stepIndex),
activity_detail_id: this.data.id,
pay_price: JSON.stringify(this.stepOrderInfo.pay_price)
}
})
} }
} }
}) })
}, },
// 表单项减少 // 表单项减少
handleMinus(index) { handleMinus(index) {
this.formList.splice(index, 1) this.data.user_fields.splice(index, 1)
}, },
// 表单项增加 // 表单项增加
handleAdd() { handleAdd() {
console.log('000', '0000') const baseUserFields = this.data.user_fields[0].map(item => {
const userFields = JSON.parse(this.data.user_fields).concat() const copyItem = Object.assign({}, item)
const allUserFields = userFields.reduce((a, b) => { copyItem.value = ''
const data = allFormList.find(item => item.key === b.key) return copyItem
if (data) { })
a.push(Object.assign({}, data)) this.data.user_fields.push(baseUserFields)
}
return a
}, [])
this.formList.push(allUserFields)
if (this.formList.length === 1) {
this.formList[0].forEach(item => {
if (item.key === 'name') {
return (item.value = this.personalInfo.name)
} else if (item.key === 'mobile') {
return (item.value = this.personalInfo.mobile)
}
})
}
}, },
onConfirmTime(time) { onConfirmTime(time) {
this.formList[this.index][this.cIndex].value = this.bgDate(time) this.data.user_fields[this.index][this.cIndex].value = this.bgDate(time)
this.formList[this.index][this.cIndex].showPicker = false this.data.user_fields[this.index][this.cIndex].showPicker = false
}, },
bgDate(val) { bgDate(val) {
const d = new Date(val) const d = new Date(val)
...@@ -308,18 +188,18 @@ export default { ...@@ -308,18 +188,18 @@ export default {
return n < 10 ? `0${n}` : n return n < 10 ? `0${n}` : n
}, },
showTime(index, cIndex) { showTime(index, cIndex) {
this.formList[index][cIndex].showPicker = true this.data.user_fields[index][cIndex].showPicker = true
this.index = index this.index = index
this.cIndex = cIndex this.cIndex = cIndex
}, },
showSelectPicker(index, cIndex) { showSelectPicker(index, cIndex) {
this.formList[index][cIndex].showPicker = true this.data.user_fields[index][cIndex].showPicker = true
this.index = index this.index = index
this.cIndex = cIndex this.cIndex = cIndex
}, },
onConfirm(value) { onConfirm(value) {
this.formList[this.index][this.cIndex].value = value this.data.user_fields[this.index][this.cIndex].value = value
this.formList[this.index][this.cIndex].showPicker = false this.data.user_fields[this.index][this.cIndex].showPicker = false
} }
} }
} }
......
...@@ -94,12 +94,9 @@ export default { ...@@ -94,12 +94,9 @@ export default {
handlePay(item) { handlePay(item) {
console.log(item, 'item') console.log(item, 'item')
this.$router.push({ this.$router.push({
path: '/signMainPage', path: '/SignMainPage',
query: { query: {
activityId: item.list[0].activity_id, id: item.activity.id
activity_detail_id: item.list[0].pay_record.activity_detail_id,
activity_detail_list: item.list,
join_rand: item.join_rand
} }
}) })
} }
......
<template> <template>
<div class="main"> <div class="main">
<!-- 头部标题 --> <div class="order-confirm" v-if="!isQrPageShow">
<commonheader @back="handlePrev" :callBack="true" :title="title" /> <!-- 头部标题 -->
<div class="main_content"> <commonheader @back="handlePrev" :callBack="true" :title="title" />
<div class="main_content_list"> <div class="main_content">
<van-checkbox-group v-model="selctOrderData" ref="checkboxGroup" @change="checkItem"> <div class="main_content_list">
<div class="main_content_list_card" v-for="(item, index) in stepOrderInfo" :key="index"> <van-checkbox-group v-model="selctOrderData" ref="checkboxGroup" @change="checkItem">
<div class="card_header"> <div class="main_content_list_card" v-for="(item, index) in stepOrderInfo" :key="index">
<van-checkbox :name="item" :disabled="item.pay_record.pay_status === '1'"></van-checkbox> <div class="card_header">
<span class="card_header_title">{{ JSON.parse($route.query.detailListName) }}</span> <van-checkbox :name="item" :disabled="item.pay_record.pay_status === '1'"></van-checkbox>
</div> <!-- <span class="card_header_title">{{ JSON.parse($route.query.detailListName) }}</span> -->
<div class="card_con"> </div>
<p>{{ item.name }} {{ item.mobile }}</p> <div class="card_con">
</div> <p>{{ item.name }} {{ item.mobile }}</p>
<div class="card_fotter">
<div class="card_fotter_left">
<span class="price">¥</span>
<span class="price_num">{{ payPrice }}<span class="price_num"></span></span>
</div> </div>
<div class="card_fotter_left card_fotter_right"> <div class="card_fotter">
<span class="price">单位已优惠</span> <div class="card_fotter_left">
<span class="price">¥</span> <span class="price">¥</span>
<span class="price_num">{{ <span class="price_num">{{ payPrice }}<span class="price_num"></span></span>
(Number(payPrice).toFixed(2) - Number(item.pay_record.pay_amount).toFixed(2)).toFixed(2) </div>
}}</span> <div class="card_fotter_left card_fotter_right">
<span class="price">单位已优惠</span>
<span class="price">¥</span>
<span class="price_num">{{
(Number(payPrice).toFixed(2) - Number(item.pay_record.pay_amount).toFixed(2)).toFixed(2)
}}</span>
</div>
</div> </div>
</div> </div>
</div> </van-checkbox-group>
</van-checkbox-group>
</div>
</div>
<div class="main_footer">
<van-checkbox v-model="isAll" @click="checkAll">全选</van-checkbox>
<div class="main_footer_total">
<div class="main_footer_total_top"></div>
<div class="main_footer_total_top">
<div class="total_text">合计:</div>
<div class="total_sign">¥</div>
<div class="price">{{ totalPrice }}</div>
</div> </div>
<div class="main_footer_total_bottom"> </div>
<div class="company_yh">单位已优惠</div> <div class="main_footer">
<div class="company_sign">¥</div> <van-checkbox v-model="isAll" @click="checkAll">全选</van-checkbox>
<div class="company_yh">{{ totalCompanyPrice.toFixed(2) }}</div> <div class="main_footer_total">
<div class="main_footer_total_top"></div>
<div class="main_footer_total_top">
<div class="total_text">合计:</div>
<div class="total_sign">¥</div>
<div class="price">{{ totalPrice }}</div>
</div>
<div class="main_footer_total_bottom">
<div class="company_yh">单位已优惠</div>
<div class="company_sign">¥</div>
<div class="company_yh">{{ totalCompanyPrice.toFixed(2) }}</div>
</div>
</div> </div>
<van-button round @click="handlePrev" class="prev_btn">上一页</van-button>
<van-button round :disabled="!selctOrderData.length" @click="onSubmit" class="pay_btn">去支付</van-button>
</div> </div>
<van-button round @click="handlePrev" class="prev_btn">上一页</van-button>
<van-button round :disabled="!selctOrderData.length" @click="onSubmit" class="pay_btn">去支付</van-button>
</div> </div>
<pay-detail @next="$emit('next')" :stepList="stepList" v-else :data="payDetail"></pay-detail>
</div> </div>
</template> </template>
<script> <script>
import { getPayInfo } from '../api' import { getPayInfo } from '../api'
import PayDetail from './PayDetail.vue'
import Commonheader from '../components/Commonheader.vue' import Commonheader from '../components/Commonheader.vue'
export default { export default {
components: { Commonheader }, components: { Commonheader, PayDetail },
props: {
stepList: {
type: Array
},
data: {
type: Object
}
},
data() { data() {
return { return {
isQrPageShow: false,
title: '订单确认', title: '订单确认',
isAll: false, isAll: false,
numVsible: true, numVsible: true,
...@@ -73,20 +85,16 @@ export default { ...@@ -73,20 +85,16 @@ export default {
return this.selctOrderData.map(item => Number(item.pay_record.pay_amount)).reduce((pre, nex) => (pre += nex), 0) return this.selctOrderData.map(item => Number(item.pay_record.pay_amount)).reduce((pre, nex) => (pre += nex), 0)
}, },
payPrice() { payPrice() {
return JSON.parse(this.$route.query.pay_price) return this.data.payData.pay_price
}, },
totalCompanyPrice() { totalCompanyPrice() {
return this.selctOrderData return this.selctOrderData
.map(item => Number(this.payPrice) - Number(item.pay_record.pay_amount)) .map(item => Number(this.payPrice) - Number(item.pay_record.pay_amount))
.reduce((pre, nex) => (pre += nex), 0) .reduce((pre, nex) => (pre += nex), 0)
},
stepIndex() {
return JSON.parse(this.$route.query.stepIndex)
} }
}, },
mounted() { mounted() {
this.stepOrderInfo = JSON.parse(window.localStorage.getItem('stepOrderInfo')) this.stepOrderInfo = this.data.payData.list
}, },
methods: { methods: {
checkItem() { checkItem() {
...@@ -97,53 +105,35 @@ export default { ...@@ -97,53 +105,35 @@ export default {
} }
}, },
handlePrev() { handlePrev() {
console.log(this.stepIndex, 'kkk') this.$emit('prev')
this.$router.push({
path: '/SignMainPage',
query: {
isShowSkip: '1',
activityId: JSON.parse(this.$route.query.activityId),
stepIndex: this.stepIndex
}
})
}, },
checkAll() { checkAll() {
this.$refs.checkboxGroup.toggleAll(this.isAll) this.$refs.checkboxGroup.toggleAll(this.isAll)
}, },
onSubmit() { onSubmit() {
// if (this.selctOrderData.length && this.totalPrice === 0) {
// this.$router.push('/')
// } else {
this.getPayDetail() this.getPayDetail()
// }
}, },
getPayDetail() { getPayDetail() {
console.log(this.stepOrderInfo, 'orderifno')
if (this.stepOrderInfo.length) { if (this.stepOrderInfo.length) {
this.stepOrderInfo.forEach((item, index) => { this.stepOrderInfo.forEach((item, index) => {
if (item.pay_record.pay_status === '1') { if (item.pay_record.pay_status === '1') {
const findIndex = this.selctOrderData.findIndex(id => id.id === item.id) const findIndex = this.selctOrderData.findIndex(id => id.id === item.id)
this.selctOrderData.splice(findIndex, 1) if (findIndex !== -1) {
this.selctOrderData.splice(findIndex, 1)
}
} }
}) })
} }
const params = { const params = {
pay_record_ids: this.selctOrderData.map(item => item.pay_record.id).toString(), pay_record_ids: this.selctOrderData.map(item => item.pay_record.id).toString(),
join_rand: this.$route.query.join_rand join_rand: this.data.payData.join_rand
} }
console.log(this.$route.query.activity_detail_id, 'selecer') console.log(this.data, 'selecer')
getPayInfo(params).then(res => { getPayInfo(params).then(res => {
this.payDetail = res.data this.payDetail = Object.assign({ qrData: res.data }, this.data)
this.payDetail.order_id = res.data.order_id this.payDetail.order_id = res.data.order_id
this.$router.push({ this.isQrPageShow = true
path: '/PayDetail',
query: {
pay_record_ids: this.payDetail.order_id,
payDetail: res.data,
stepIndex: this.stepIndex,
activityId: JSON.parse(this.$route.query.activityId),
activity_detail_id: this.$route.query.activity_detail_id
}
})
}) })
} }
} }
......
<template> <template>
<div class="main"> <div class="main">
<commonheader :title="title" /> <!-- <commonheader :title="title" /> -->
<div class="main_content"> <div class="main_content">
<div class="main_content_desc">1.打开支付宝扫码二维码支付,或长按保存二维码打开支付宝支付。</div> <div class="main_content_desc">1.打开支付宝扫码二维码支付,或长按保存二维码打开支付宝支付。</div>
<div class="main_content_qdCode"> <div class="main_content_qdCode">
...@@ -27,14 +27,14 @@ ...@@ -27,14 +27,14 @@
class="main_btn_home" class="main_btn_home"
round round
@click="$router.push('/')" @click="$router.push('/')"
v-if="lastStepId === parseInt(this.activity_detail_id)" v-if="isLastStep && status == 1"
>首页</van-button >首页</van-button
> >
<van-button <van-button
round round
class="main_btn_home" class="main_btn_home"
@click="continueSign" @click="$router.go(0)"
v-if="lastStepId !== parseInt(this.activity_detail_id) && this.status === 1" v-if="!isLastStep && status == 1"
>继续报名</van-button >继续报名</van-button
> >
<van-button round class="main_btn_order" @click="$router.push('/MyOrder')">我的订单</van-button> <van-button round class="main_btn_order" @click="$router.push('/MyOrder')">我的订单</van-button>
...@@ -49,16 +49,24 @@ ...@@ -49,16 +49,24 @@
import QrcodeVue from 'qrcode.vue' import QrcodeVue from 'qrcode.vue'
import Clipboard from 'clipboard' import Clipboard from 'clipboard'
import { Toast } from 'vant' import { Toast } from 'vant'
import { getActivityDetail, getPayStatus } from '../api' import { getPayStatus } from '../api'
import commonheader from '../components/Commonheader.vue' // import commonheader from '../components/Commonheader.vue'
export default { export default {
props: {
data: {
type: Object
},
stepList: {
type: Array
}
},
components: { components: {
QrcodeVue, QrcodeVue
commonheader
}, },
data() { data() {
return { return {
isLastStep: false, // 判断是不是最后一个步骤 显示不同的按钮
title: '订单支付', title: '订单支付',
qrcodeUrl: '', qrcodeUrl: '',
clipboard: null, clipboard: null,
...@@ -71,10 +79,10 @@ export default { ...@@ -71,10 +79,10 @@ export default {
}, },
computed: { computed: {
payDetail() { payDetail() {
return this.$route.query.payDetail return this.data.qrData
}, },
pay_record_ids() { pay_record_ids() {
return this.$route.query.pay_record_ids return this.data.activity_detail_id
} }
}, },
methods: { methods: {
...@@ -99,48 +107,30 @@ export default { ...@@ -99,48 +107,30 @@ export default {
}) })
}, },
getPayStatus() { getPayStatus() {
this.getActivityDetail()
const params = { const params = {
order_id: this.pay_record_ids order_id: this.data.order_id
} }
getPayStatus(params).then(res => { getPayStatus(params).then(res => {
console.log(this.data, 'pddata')
if (res.code === 0) { if (res.code === 0) {
this.status = res.data.status this.status = res.data.status
if (res.data.status === 1) { if (res.data.status === 1) {
clearInterval(this.time) clearInterval(this.time)
if (this.$route.query.activityId) { if (this.data.jump_url) {
this.getActivityDetail() window.location.href = this.data.jump_url
return false
} }
this.getActivityDetail()
} }
} }
}) })
}, },
getActivityDetail() { getActivityDetail() {
this.activity_detail_id = this.$route.query.activity_detail_id console.log(this.stepList.length, this.data.num)
console.log(this.$route.query.activityId, 'activityId') if (this.stepList.length === this.data.num) {
const params = { id: this.$route.query.activityId } this.isLastStep = true
getActivityDetail(params).then(res => { }
this.detailList = res.data
this.lastStepId = this.detailList.activity.details.slice(-1).id
const currentStep = this.detailList.activity.details.find(item => item.id === this.activity_detail_id)
console.log(currentStep, 'currentStep')
if (res.data.status === 1 && currentStep.can_jump === 1) {
window.open(currentStep.jump_url)
}
// if (res.data.status === 1 || item) {
// if (parseInt(this.detailList.activity.details.slice(-1).id) === parseInt(this.activity_detail_id)) {
// console.log('1111tohome')
// this.$router.push('/')
// } else {
// console.log(this.$route.query.activityId, 'this.$route.query.activityId', '来了')
// this.$router.push({
// path: 'SignMainPage',
// query: {
// activityId: this.$route.query.activityId
// }
// })
// }
// }
})
}, },
continueSign() { continueSign() {
this.$router.push({ this.$router.push({
......
<template> <template>
<div class="main"> <div class="main">
<commonheader @back="handlePrev" :callBack="true" :title="title" /> <!-- <commonheader @back="handlePrev" :callBack="true" /> -->
<!-- 展示 --> <!-- 展示 -->
<template v-if="Object.keys(stepList).length"> <template v-if="Object.keys(stepList).length">
<img-show <img-show :data="setpItem" @prev="handlePrev" @next="handleNext" v-if="setpItem.type === 1" />
:stepList="stepList"
:data="setpItem"
@prev="handlePrev"
@next="handleNext"
v-if="setpItem.type === 1"
/>
<!-- 表单 --> <!-- 表单 -->
<sign-form <sign-form
:myInfoList="myInfoList"
:personalInfo="detailList.info"
:data="setpItem" :data="setpItem"
:stepList="stepList" :stepList="stepList"
:stepIndex="stepIndex"
@prev="handlePrev" @prev="handlePrev"
@next="handleNext" @next="handleNext"
v-if="setpItem.type === 2" v-if="setpItem.type === 2"
:isShowSkip="isShowSkip"
:detailList="detailList"
:order_join_rand="$route.query.join_rand"
/> />
<!-- 支付页面 -->
<order-confirm
@prev="handlePrev"
@next="handleNext"
:stepList="stepList"
:data="setpItem"
v-if="setpItem.type === 3"
></order-confirm>
</template> </template>
</div> </div>
</template> </template>
<script> <script>
import allFormList from '@/utils/formList'
import SignForm from '../components/SignForm.vue' import SignForm from '../components/SignForm.vue'
import ImgShow from '../components/ImgShow.vue' import ImgShow from '../components/ImgShow.vue'
import Commonheader from '../components/Commonheader.vue' import OrderConfirm from './OrderConfirm.vue'
// import Commonheader from '../components/Commonheader.vue'
import { getActivityDetail } from '../api' import { getActivityDetail } from '../api'
export default { export default {
components: { SignForm, ImgShow, Commonheader }, components: { SignForm, ImgShow, OrderConfirm },
data() { data() {
return { return {
title: '报名主页面', title: '报名主页面',
...@@ -49,11 +48,8 @@ export default { ...@@ -49,11 +48,8 @@ export default {
}, },
computed: { computed: {
setpItem() { setpItem() {
if (this.$route.query.stepIndex) { // return this.stepList[2]
return this.stepList[this.$route.query.stepIndex] return this.stepList[this.stepIndex]
} else {
return this.stepList[this.stepIndex]
}
} }
}, },
mounted() { mounted() {
...@@ -65,60 +61,111 @@ export default { ...@@ -65,60 +61,111 @@ export default {
getActivityDetail() { getActivityDetail() {
getActivityDetail({ id: this.$route.query.id }).then(res => { getActivityDetail({ id: this.$route.query.id }).then(res => {
const data = res.data const data = res.data
if (data.other_fill_in.need_fill_in_status === false && data.self_fill_in.need_fill_in_status === false) { let sliceData = []
// 重新报名 if (data.other_fill_in.need_fill_in_status) {
initInfo('other_fill_in')
} else if (data.self_fill_in.need_fill_in_status) {
initInfo('self_fill_in')
} else { } else {
// if (data.other_fill_in.need_fill_in_status) { initInfo()
// }
} }
// this.detailList = res.data // 初始化拿到数据做的第一步处理:取到需要展示出来的所有页面
// this.myInfoList = res.data.other_fill_in.list function initInfo(fields) {
// // console.log(this.detailList.activity.details.slice(-1), '0000') if (fields) {
// if (this.detailList.other_fill_in.need_fill_in_status) { // *** 继续报名数 || 第一次进报名,据初始化
// this.detailList.activity.details.forEach(item => { const index = data.activity.details.findIndex(item => item.id === data[fields].need_fill_in_id)
// if (item.id === this.detailList.other_fill_in.need_fill_in_id) { sliceData = data.activity.details.slice(index, data.activity.details.length)
// const details = this.detailList.activity.details.indexOf(item) // list 人员信息
// console.log(details, '111') sliceData.map(item => {
// if (details === 0) { item.activityInfo = data.activity
// this.stepList = res.data.activity.details // 判断有没有返回人员 没返回吧自己的信息push进去
// console.log(this.stepList, '1') if (data[fields].list.length) {
// } else if (details > 0) { // list有可能不会返回自己的信息,不返回push进去
// console.log(details, 'details') const findOwn = data[fields].list.find(info => info.mobile === data.info.mobile)
// this.stepList = this.detailList.activity.details.splice(details) if (!findOwn) {
// console.log(this.stepList, '2') data[fields].list.push(data.info)
// } }
// } // 添加index用于用户排序
// }) item.list = data[fields].list.map((item, index) => {
// } else { item.mobile === data.info.mobile ? (item.index = 0) : (item.index = index + 1)
// if (this.detailList.self_fill_in.need_fill_in_status) { return item
// this.detailList.activity.details.forEach(item => { })
// if (item.id === this.detailList.self_fill_in.need_fill_in_id) { item.join_rand = item.list[0] ? item.list[0].pay_records[0].join_rand : ''
// const details = this.detailList.activity.details.indexOf(item) return item
// console.log(details, '222') } else {
item.list = []
// if (details === 0) { item.list.push(data.info)
// this.stepList = res.data.activity.details }
// console.log(this.stepList, '3') return item
// } else if (details > 0) { })
// console.log(details, 'details1') } else {
// this.stepList = this.detailList.activity.details.splice(details) // 重新报名初始化数据
// console.log(this.stepList, '4') sliceData = data.activity.details
// } sliceData.map(item => {
// } item.list = []
// }) item.activityInfo = data.activity
// } else { item.list.push(data.info)
// this.stepList = res.data.activity.details return item
// console.log(this.stepList, '5') })
// } }
// } }
// const newIndex = this.stepList.findIndex(item => { // 第二步数据处理:字段细节处理
// return item.id === this.$route.query.activity_detail_id this.setData(sliceData)
// }) })
// if (this.$route.query.stepIndex) { },
// this.stepIndex = parseInt(this.$route.query.stepIndex) setData(data) {
// } else { // console.log(data, 'datas')
// this.stepIndex = newIndex < 0 ? 0 : newIndex // 处理数据
// } this.stepList = data.reduce((a, b) => {
// type: 1 是展示不用处理
if (b.type === 1) {
a.push(b)
} else {
// 表单类型的数据处理
// 处理需要填写的字段表单
const userFields = JSON.parse(b.user_fields)
const userFieldsStore = []
// 人员信息转换成表单需要的数据(因为第1个永远是自己所以加了排序)
b.list
.sort((a, b) => {
return a.index - b.index
})
.forEach(d => {
const fields = []
userFields.forEach(dd => {
const fData = Object.assign(
{},
allFormList.find(f => f.key === dd.key)
)
fData.value = d[dd.key]
fields.push(fData)
})
userFieldsStore.push(fields)
})
b.user_fields = userFieldsStore
a.push(b)
// 处理“开启支付功能” 自定义type3支付页
if (b.can_pay === 1) {
const payPage = {
type: 3,
user_fields: b.user_fields,
activity_detail_id: b.id,
id: b.activity_id,
num: b.num
}
// 开启支付成功跳转的功能
if (b.can_jump) {
payPage.jump_url = b.jump_url
}
a.push(payPage)
}
}
return a
}, [])
console.log(this.stepList)
this.stepList.map((item, index) => {
item.num = index + 1
return item
}) })
}, },
handlePrev() { handlePrev() {
...@@ -128,8 +175,13 @@ export default { ...@@ -128,8 +175,13 @@ export default {
this.stepIndex-- this.stepIndex--
} }
}, },
handleNext() { handleNext(data) {
this.stepIndex++ if (this.setpItem.num !== this.stepList) {
this.stepIndex++
if (data) {
this.setpItem.payData = data
}
}
} }
} }
} }
......
...@@ -16,7 +16,7 @@ export default defineConfig({ ...@@ -16,7 +16,7 @@ export default defineConfig({
proxy: { proxy: {
'/api/highway': { '/api/highway': {
// target: 'http://localhost-activity-frontend.ezijing.com', // target: 'http://localhost-activity-frontend.ezijing.com',
target: 'https://activity-frontend-api.ezijing.com', target: 'http://localhost-activity-frontend.ezijing.com',
changeOrigin: true, changeOrigin: true,
rewrite: path => path.replace(/^\/api\/highway/, '') rewrite: path => path.replace(/^\/api\/highway/, '')
}, },
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论