张园活动报名&核销
parent
6d4ab29b2e
commit
3566cca5f0
|
|
@ -1,15 +1,15 @@
|
|||
APP_BASE_URL=https://test.birkenstock.net.cn/api/h5app/wxapp
|
||||
APP_WEBSOCKET=wss://test.birkenstock.net.cn/ws
|
||||
APP_BASE_URL=http://47.103.169.154:8080/api/h5app/wxapp
|
||||
APP_WEBSOCKET=wss://http://47.103.169.154:8080/ws
|
||||
APP_COMPANY_ID=1
|
||||
APP_PLATFORM=standard
|
||||
APP_CUSTOM_SERVER=https://test.birkenstock.net.cn/
|
||||
APP_CUSTOM_SERVER=http://47.103.169.154:8081/
|
||||
APP_HOME_PAGE=/pages/index
|
||||
APP_TRACK=youshu
|
||||
APP_YOUSHU_TOKEN=bi281e87ab2424481a
|
||||
# APP_ID=wx3e1c17c88abf3e45
|
||||
APP_ID=wx72e9e1a93420862c
|
||||
APP_ID=wx55ff808ba0e28b1d
|
||||
APP_MAP_KEY=1ccc1ebc947719886f0cd766d70241fe
|
||||
APP_MAP_NAME=BIRKENSTOCK门店定位
|
||||
APP_MAP_NAME=oneX新零售门店定位
|
||||
APP_IMAGE_CDN=https://b-img-cdn.yuanyuanke.cn/ecshopx-vshop
|
||||
APP_IMAGE_CDN_NEW=https://espier-oss-cdn.oss-cn-shanghai.aliyuncs.com/default_project/wxAssets
|
||||
APP_DIANWU_URL=
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
APP_BASE_URL=http://47.103.169.154:8080/api/h5app/wxapp
|
||||
APP_WEBSOCKET=wss://http://47.103.169.154:8080/ws
|
||||
APP_BASE_URL=https://test.birkenstock.net.cn/api/h5app/wxapp
|
||||
APP_WEBSOCKET=wss://test.birkenstock.net.cn/ws
|
||||
APP_COMPANY_ID=1
|
||||
APP_PLATFORM=standard
|
||||
APP_CUSTOM_SERVER=http://47.103.169.154:8081/
|
||||
APP_CUSTOM_SERVER=https://test.birkenstock.net.cn/
|
||||
APP_HOME_PAGE=/pages/index
|
||||
APP_TRACK=youshu
|
||||
APP_YOUSHU_TOKEN=bi281e87ab2424481a
|
||||
# APP_ID=wx3e1c17c88abf3e45
|
||||
APP_ID=wx55ff808ba0e28b1d
|
||||
APP_ID=wx72e9e1a93420862c
|
||||
APP_MAP_KEY=1ccc1ebc947719886f0cd766d70241fe
|
||||
APP_MAP_NAME=oneX新零售门店定位
|
||||
APP_MAP_NAME=BIRKENSTOCK门店定位
|
||||
APP_IMAGE_CDN=https://b-img-cdn.yuanyuanke.cn/ecshopx-vshop
|
||||
APP_IMAGE_CDN_NEW=https://espier-oss-cdn.oss-cn-shanghai.aliyuncs.com/default_project/wxAssets
|
||||
APP_DIANWU_URL=
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
APP_BASE_URL=https://test.birkenstock.net.cn/api/h5app/wxapp
|
||||
APP_WEBSOCKET=wss://test.birkenstock.net.cn/ws
|
||||
APP_BASE_URL=https://slb.birkenstock.net.cn/api/h5app/wxapp
|
||||
APP_WEBSOCKET=wss://slb.birkenstock.net.cn/ws
|
||||
APP_COMPANY_ID=1
|
||||
APP_PLATFORM=standard
|
||||
APP_CUSTOM_SERVER=https://test.birkenstock.net.cn/
|
||||
APP_CUSTOM_SERVER=https://slb.birkenstock.net.cn/
|
||||
APP_HOME_PAGE=/pages/index
|
||||
APP_TRACK=youshu
|
||||
APP_YOUSHU_TOKEN=bi281e87ab2424481a
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"miniprogramRoot": "dist/",
|
||||
"projectname": "ecshopx-vshop",
|
||||
"description": "weshop for platform",
|
||||
"appid": "wx72e9e1a93420862c",
|
||||
"appid": "wx55ff808ba0e28b1d",
|
||||
"setting": {
|
||||
"urlCheck": false,
|
||||
"es6": false,
|
||||
|
|
|
|||
|
|
@ -304,7 +304,7 @@ function SpPage (props, ref) {
|
|||
// 'icon-home1': cusCurrentPage == 1,
|
||||
'icon-fanhui': alwaysBackUrl ? true : cusCurrentPage != 1
|
||||
})}
|
||||
style={{ color: isBlack ? 'white' : 'black' }}
|
||||
// style={{ color: isBlack ? 'white' : 'black' }}
|
||||
onClick={() => {
|
||||
if (alwaysBackUrl) {
|
||||
Taro.navigateTo({
|
||||
|
|
|
|||
|
|
@ -574,6 +574,7 @@ function Home () {
|
|||
|
||||
const indexUrl = 'https://mp.weixin.qq.com/s/LBXthKa-P9gNK8FCv3n1pA'
|
||||
const handleGoWx = () => {
|
||||
return handleApply()
|
||||
Taro.navigateTo({ url: '/pages/webview?url=' + encodeURIComponent(indexUrl) })
|
||||
}
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -24,12 +24,17 @@ const initState = {
|
|||
formData: {},
|
||||
formList: [{}],
|
||||
areaList: [],
|
||||
changci: {},
|
||||
formDataList: [],
|
||||
}
|
||||
export default function detail () {
|
||||
const $instance = getCurrentInstance()
|
||||
const [state, setState] = useImmer(initState)
|
||||
const { appName } = useSelector((_state) => _state.sys)
|
||||
const { userInfo = {} } = useSelector((_state) => _state.user)
|
||||
const pages = getCurrentPages()
|
||||
const current = pages[pages.length - 1]
|
||||
const eventChannel = current.getOpenerEventChannel()
|
||||
const { isLogin } = useLogin({
|
||||
autoLogin: true,
|
||||
})
|
||||
|
|
@ -50,8 +55,12 @@ export default function detail () {
|
|||
})
|
||||
}
|
||||
const _item = recordList.list?.[0] || {}
|
||||
const { content = [] } = activity_info.formdata
|
||||
const formdata = content[0]?.formdata || []
|
||||
setState(draft => {
|
||||
draft.isLoading = false
|
||||
// draft.formList = formdata.sort((a, b) => a.id - b.id)
|
||||
draft.formDataList = formdata
|
||||
draft.activeInfo = {
|
||||
...activity_info,
|
||||
user_code,
|
||||
|
|
@ -61,13 +70,18 @@ export default function detail () {
|
|||
status: _item.is_write_off === '1' ? 'done' : _item.status,
|
||||
isLoading: false
|
||||
}
|
||||
draft.checked = !!_item
|
||||
// draft.checked = !!_item
|
||||
})
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
getActiveDetail()
|
||||
fetchAreaData()
|
||||
eventChannel.on('apply', (res) => {
|
||||
setState(draft => {
|
||||
draft.changci = res
|
||||
})
|
||||
})
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
|
|
@ -77,12 +91,14 @@ export default function detail () {
|
|||
username: userInfo.username,
|
||||
mobile: userInfo.mobile,
|
||||
}
|
||||
draft.formData['username'] = userInfo.username
|
||||
draft.formData['mobile'] = userInfo.mobile
|
||||
})
|
||||
}
|
||||
}, [userInfo, isLogin])
|
||||
|
||||
|
||||
const { isLoading, activeInfo = {}, visible, formInfo, checked, status, isShare, alwaysBackUrl, isSub, formData, formList, areaList } = state
|
||||
const { isLoading, activeInfo = {}, visible, formInfo, checked, status, isShare, alwaysBackUrl, isSub, formData, formList, areaList, formDataList, changci } = state
|
||||
|
||||
const handleConfirm = async () => {
|
||||
if (!isLogin || !userInfo) return
|
||||
|
|
@ -104,12 +120,76 @@ export default function detail () {
|
|||
if (!res.confirm) return
|
||||
setState((draft) => {
|
||||
draft.checked = true
|
||||
draft.visible = true
|
||||
// draft.visible = true
|
||||
})
|
||||
} else {
|
||||
const _formData = formDataList.map((d) => {
|
||||
return {
|
||||
...d,
|
||||
answer: formData[d.field_name]
|
||||
}
|
||||
})
|
||||
let flag = true
|
||||
try {
|
||||
_formData.forEach((d) => {
|
||||
const { field_name, field_title, answer } = d
|
||||
const reg = /^[1][3,4,5,7,8,9][0-9]{9}$/
|
||||
if ((formData['has_partner'] === '否' && field_name.includes('partner') || field_name.includes('city') || (field_name === 'mobile' && answer === userInfo.mobile))) {
|
||||
return
|
||||
}
|
||||
if (field_name === 'mobile' || field_name === 'partner_mobile') {
|
||||
if (!reg.test(answer)) {
|
||||
Taro.showToast({
|
||||
title: `${formData['has_partner'] === '是' ? '同行人' : ''}${field_title}格式不正确`,
|
||||
icon: 'none'
|
||||
})
|
||||
throw new Error(`${field_title}格式不正确`)
|
||||
}
|
||||
} else {
|
||||
if (!answer || !answer.trim()) {
|
||||
Taro.showToast({
|
||||
title: `请填写${formData['has_partner'] === '是' ? '同行人' : ''}${field_title}`,
|
||||
icon: 'none'
|
||||
})
|
||||
throw new Error(`${formData['has_partner'] === '是' ? '同行人' : ''}${field_title}不能为空`)
|
||||
}
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
flag = false
|
||||
}
|
||||
if (!flag) return
|
||||
const content = {
|
||||
title: '',
|
||||
sort: 1,
|
||||
formdata: _formData
|
||||
}
|
||||
const { status } = await api.user.registrationSubmit({
|
||||
formdata: { content: JSON.stringify([content]) },
|
||||
activity_id: activeInfo.activity_id,
|
||||
registration_session_id: changci.id
|
||||
})
|
||||
if (status) {
|
||||
const templeparams = {
|
||||
temp_name: 'yykweishop',
|
||||
source_type: 'activity'
|
||||
}
|
||||
const { template_id } = await api.user.newWxaMsgTmpl(templeparams)
|
||||
Taro.requestSubscribeMessage({
|
||||
tmplIds: template_id,
|
||||
success: () => {
|
||||
},
|
||||
fail: (err) => {
|
||||
},
|
||||
complete: () => {
|
||||
Taro.navigateTo({ url: '/pages/recommend/status?success=true&id=' + activeInfo.activity_id })
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
setState((draft) => {
|
||||
draft.visible = true
|
||||
})
|
||||
// setState((draft) => {
|
||||
// draft.visible = true
|
||||
// })
|
||||
}
|
||||
|
||||
const fetchAreaData = async () => {
|
||||
|
|
@ -244,12 +324,11 @@ export default function detail () {
|
|||
}, 800)
|
||||
}
|
||||
|
||||
const pickerChange = (e) => {
|
||||
const pickerChange = (e, key) => {
|
||||
const { value } = e.detail
|
||||
console.log("🚀 ~ file: apply.js:247 ~ value:", value)
|
||||
// setState((draft) => {
|
||||
// draft.formData.sex = value
|
||||
// })
|
||||
setState((draft) => {
|
||||
draft.formData[key] = areaList[value]?.label
|
||||
})
|
||||
}
|
||||
const handleAddApply = (flag) => {
|
||||
if (formList.length > 2) {
|
||||
|
|
@ -258,10 +337,12 @@ export default function detail () {
|
|||
if (flag) {
|
||||
setState((draft) => {
|
||||
draft.formList = [...formList, {}]
|
||||
draft.formData['has_partner'] = '是'
|
||||
})
|
||||
} else {
|
||||
setState((draft) => {
|
||||
draft.formList = [formList[0]]
|
||||
draft.formData['has_partner'] = '否'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -269,19 +350,19 @@ export default function detail () {
|
|||
const formItem = activeInfo.formdata?.key_index || []
|
||||
// !!activeInfo?.total_count ? <></> :
|
||||
return (
|
||||
<SpPage title='报名信息' renderFooter={!!activeInfo?.total_count ? <></> : renderFooter()} loading={isLoading} className='page-recommend-apply' alwaysBackUrl={alwaysBackUrl} isBlack>
|
||||
<View className="activity_apply_time">第一场 13:00-14:00</View>
|
||||
<SpPage title='报名信息' renderFooter={!!activeInfo?.total_count ? <></> : renderFooter()} loading={isLoading} className='page-recommend-apply' >
|
||||
<View className="activity_apply_time">第{changci.index}场 {changci.start}-{changci.end}</View>
|
||||
<View className="activity_apply_tit">请填写您的个人信息</View>
|
||||
{formList.map((item, index) => <View className='user-form' key={index}>
|
||||
<View className="user-form-item">
|
||||
<View className="user-form-item-title">姓名</View>
|
||||
<View className='cell-item'>
|
||||
<Input
|
||||
value={item.username}
|
||||
value={formData[index === 0 ? 'username' : 'partner_name']}
|
||||
className="user-form-item-ipt"
|
||||
type="text"
|
||||
placeholder={`请输入${index > 0 ? '他人' : ''}姓名`}
|
||||
onInput={(e) => onIptChange(e, 'username')}
|
||||
onInput={(e) => onIptChange(e, index === 0 ? 'username' : 'partner_name')}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
|
|
@ -289,10 +370,11 @@ export default function detail () {
|
|||
<View className="user-form-item-title">手机</View>
|
||||
<View className='cell-item'>
|
||||
<Input
|
||||
value={formData[index === 0 ? 'mobile' : 'partner_mobile']}
|
||||
className="user-form-item-ipt"
|
||||
type="text"
|
||||
placeholder={`请输入${index > 0 ? '他人' : ''}手机号`}
|
||||
onInput={(e) => onIptChange(e, 'mobile')}
|
||||
onInput={(e) => onIptChange(e, index === 0 ? 'mobile' : 'partner_mobile')}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
|
|
@ -300,13 +382,13 @@ export default function detail () {
|
|||
<View className='cell-item'>
|
||||
<View className="cell-item-tit">性别</View>
|
||||
<View className='flex-row'>
|
||||
<View className="flex-row">
|
||||
<View className="sex-label">男</View>
|
||||
<View className={classNames("radio ", { checked: true })}></View>
|
||||
<View className="flex-row" onClick={() => onIptChange({ detail: { value: '男' } }, index === 0 ? 'gender' : 'partner_gender')} style={{ paddingRight: '10rpx' }} >
|
||||
<View className="sex-label" >男</View>
|
||||
<View className={classNames("radio ", { checked: formData[index === 0 ? 'gender' : 'partner_gender'] === '男' })}></View>
|
||||
</View>
|
||||
<View className="flex-row">
|
||||
<View className="flex-row" onClick={() => onIptChange({ detail: { value: '女' } }, index === 0 ? 'gender' : 'partner_gender')} >
|
||||
<View className="sex-label">女</View>
|
||||
<View className={classNames("radio ", { checked: true })}></View>
|
||||
<View className={classNames("radio ", { checked: formData[index === 0 ? 'gender' : 'partner_gender'] === '女' })}></View>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
|
|
@ -315,13 +397,13 @@ export default function detail () {
|
|||
<View className='cell-item'>
|
||||
<View className="cell-item-tit">是否拥有BIRKENSTOCK鞋履</View>
|
||||
<View className='flex-row'>
|
||||
<View className="flex-row">
|
||||
<View className="flex-row" onClick={() => onIptChange({ detail: { value: '是' } }, index === 0 ? 'has_bought' : 'partner_has_bought')} style={{ paddingRight: '10rpx' }}>
|
||||
<View className="sex-label">是</View>
|
||||
<View className={classNames("radio ", { checked: true })}></View>
|
||||
<View className={classNames("radio ", { checked: formData[index === 0 ? 'has_bought' : 'partner_has_bought'] === '是' })}></View>
|
||||
</View>
|
||||
<View className="flex-row">
|
||||
<View className="flex-row" onClick={() => onIptChange({ detail: { value: '否' } }, index === 0 ? 'has_bought' : 'partner_has_bought')}>
|
||||
<View className="sex-label">否</View>
|
||||
<View className={classNames("radio ", { checked: true })}></View>
|
||||
<View className={classNames("radio ", { checked: formData[index === 0 ? 'has_bought' : 'partner_has_bought'] === '否' })}></View>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
|
|
@ -331,12 +413,12 @@ export default function detail () {
|
|||
<View className="cell-item-tit">常驻城市(选填)</View>
|
||||
<Picker
|
||||
mode='selector'
|
||||
onChange={pickerChange}
|
||||
onChange={(e) => pickerChange(e, index === 0 ? 'city_name' : 'partner_city_name')}
|
||||
range={areaList}
|
||||
rangeKey="label"
|
||||
>
|
||||
<View className='flex-row'>
|
||||
<View className="sex-label">测试</View>
|
||||
<View className="sex-label" style="minWidth: 120px;text-align: end;" >{formData[index === 0 ? 'city_name' : 'partner_city_name']}</View>
|
||||
<View className="iconfont icon-arrowRight"></View>
|
||||
</View>
|
||||
</Picker>
|
||||
|
|
@ -346,13 +428,13 @@ export default function detail () {
|
|||
<View className='cell-item'>
|
||||
<View className="cell-item-tit">是否协同他人一起参加</View>
|
||||
<View className='flex-row'>
|
||||
<View onClick={() => handleAddApply(1)} className="flex-row">
|
||||
<View onClick={() => handleAddApply(1)} className="flex-row" style={{ paddingRight: '10rpx' }}>
|
||||
<View className="sex-label">是</View>
|
||||
<View className={classNames("radio ", { checked: true })}></View>
|
||||
<View className={classNames("radio ", { checked: formData['has_partner'] === '是' })}></View>
|
||||
</View>
|
||||
<View onClick={() => handleAddApply(0)} className="flex-row">
|
||||
<View className="sex-label">否</View>
|
||||
<View className={classNames("radio ", { checked: false })}></View>
|
||||
<View className={classNames("radio ", { checked: formData['has_partner'] === '否' })}></View>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@
|
|||
color: #000;
|
||||
}
|
||||
.flex-row {
|
||||
margin-left: 20rpx;
|
||||
// margin-left: 20rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ const initState = {
|
|||
isShare: false,
|
||||
alwaysBackUrl: "/pages/index",
|
||||
isSub: false,
|
||||
changci: [],
|
||||
applyStatus: false,
|
||||
}
|
||||
export default function detail () {
|
||||
const $instance = getCurrentInstance()
|
||||
|
|
@ -36,8 +38,9 @@ export default function detail () {
|
|||
const getActiveDetail = async () => {
|
||||
const { id: activity_id, alwaysBackUrl } = $instance.router.params
|
||||
if (!activity_id) return
|
||||
const { status, activity_info = {}, total_count, user_code, recordList = {} } = await api.user.registrationActivity({ activity_id })
|
||||
if (total_count > 0 && !alwaysBackUrl) {
|
||||
const { status, changci = [], activity_info = {}, total_count, user_code, recordList = {} } = await api.user.registrationActivity({ activity_id })
|
||||
const _applyStatus = changci.some((item) => item.has_stauts == 1)
|
||||
if (_applyStatus && !alwaysBackUrl) {
|
||||
Taro.redirectTo({ url: '/pages/recommend/status?&id=' + activity_id })
|
||||
return
|
||||
}
|
||||
|
|
@ -61,6 +64,9 @@ export default function detail () {
|
|||
isLoading: false
|
||||
}
|
||||
draft.checked = !!_item
|
||||
// MM-DD
|
||||
draft.changci = changci.map((item, index) => ({ index: index + 1, start: dayjs(item.start_time).format('HH:mm'), end: dayjs(item.end_time).format('HH:mm'), limit: item.join_limit, join: item.has_join_num, id: item.registration_session_id, activity_id: item.activity_id, has_stauts: item.has_stauts == 1 }))
|
||||
draft.applyStatus = _applyStatus
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -80,7 +86,7 @@ export default function detail () {
|
|||
}, [userInfo, isLogin])
|
||||
|
||||
|
||||
const { isLoading, activeInfo = {}, visible, formInfo, checked, status, isShare, alwaysBackUrl, isSub } = state
|
||||
const { isLoading, activeInfo = {}, changci, visible, formInfo, checked, status, isShare, alwaysBackUrl, isSub, applyStatus } = state
|
||||
|
||||
const handleConfirm = async () => {
|
||||
if (!isLogin || !userInfo) return
|
||||
|
|
@ -205,6 +211,7 @@ export default function detail () {
|
|||
draft.isSub = false
|
||||
})
|
||||
}
|
||||
|
||||
const onClickShare = () => {
|
||||
setState((draft) => {
|
||||
draft.visible = true
|
||||
|
|
@ -230,6 +237,22 @@ export default function detail () {
|
|||
}, 800)
|
||||
}
|
||||
|
||||
const handleGoApply = (item) => {
|
||||
if (item.has_stauts) {
|
||||
navigateTo('/pages/recommend/status?id=' + activeInfo.activity_id + '&time=')
|
||||
} else {
|
||||
if (applyStatus) return
|
||||
navigateTo('/pages/recommend/apply?id=' + activeInfo.activity_id + '&time=')
|
||||
Taro.navigateTo({
|
||||
url: '/pages/recommend/apply?id=' + activeInfo.activity_id,
|
||||
success: (res) => {
|
||||
res.eventChannel.emit('apply', item)
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
const formItem = activeInfo.formdata?.key_index || []
|
||||
// !!activeInfo?.total_count ? <></> :
|
||||
// renderFooter={!!activeInfo?.total_count ? <></> : renderFooter()}
|
||||
|
|
@ -242,7 +265,7 @@ export default function detail () {
|
|||
<View className="name-box">
|
||||
<View className="activity_name">{activeInfo.activity_name}</View>
|
||||
</View>
|
||||
<View className="activity_time">{activeInfo.start} - {activeInfo.end}</View>
|
||||
<View className="activity_time">{activeInfo.start == activeInfo.end ? activeInfo.start : `${activeInfo.start} - ${activeInfo.end}`}</View>
|
||||
<View className="activity_addr">
|
||||
<Image mode="widthFix" src={require('@/assets/icon/map.png')}></Image>
|
||||
<Text>{activeInfo.address}</Text>
|
||||
|
|
@ -255,9 +278,9 @@ export default function detail () {
|
|||
</View>
|
||||
|
||||
<View style={{ paddingBottom: '80px' }}>
|
||||
{[{}, {}, {}].map((item, index) => <View className='time-item' key={index + '__item'}>
|
||||
<Text className="time-item-title">第{index + 1}场 13:00-14:00</Text>
|
||||
<View className="btn" onClick={() => navigateTo('/pages/recommend/apply?id=' + activeInfo.activity_id + '&time=' + index)} >{2}席可选</View>
|
||||
{changci.length > 0 && changci.map((item, index) => <View className='time-item' key={index + '__item'}>
|
||||
<Text className="time-item-title">第{item.index}场 {item.start}-{item.end}</Text>
|
||||
<View className={`btn ${(item.limit - item.join <= 0) && !item.has_stauts ? 'disabled' : ''}`} onClick={() => handleGoApply(item)} >{item.has_stauts ? '已报名' : `${item.limit - item.join}席可选`}</View>
|
||||
</View>)}
|
||||
</View>
|
||||
|
||||
|
|
|
|||
|
|
@ -18,13 +18,15 @@ const initState = {
|
|||
loading: true,
|
||||
activeInfo: {},
|
||||
qrUrl: '',
|
||||
visible: false
|
||||
visible: false,
|
||||
session: {},
|
||||
record: {}
|
||||
}
|
||||
export default function status () {
|
||||
const $instance = getCurrentInstance()
|
||||
const [state, setState] = useImmer(initState)
|
||||
const [showModal, setShowModal] = useState(false)
|
||||
const { cur_activity_info, loading, activeInfo, qrUrl, visible } = state
|
||||
const { cur_activity_info, loading, activeInfo, qrUrl, visible, session, record } = state
|
||||
|
||||
useEffect(() => {
|
||||
getActiveDetail()
|
||||
|
|
@ -32,23 +34,25 @@ export default function status () {
|
|||
|
||||
const getActiveDetail = async () => {
|
||||
const { id, success } = $instance.router.params
|
||||
const { activity_info = {}, total_count, user_code, recordList = {} } = await api.user.registrationActivity({ activity_id: id })
|
||||
const { activity_info = {}, changci = [], total_count, recordList = {} } = await api.user.registrationActivity({ activity_id: id })
|
||||
const _start = dayjs(activity_info.start_time * 1000)
|
||||
const _end = dayjs(activity_info.end_time * 1000)
|
||||
const _session = changci.find(item => item.has_stauts == 1) || {}
|
||||
const _item = _session.recordList?.[0] || {}
|
||||
let url = ''
|
||||
const qrData = JSON.stringify({
|
||||
activity_id: id,
|
||||
user_code: user_code || ''
|
||||
user_code: _item.user_code || ''
|
||||
})
|
||||
await QRCode.toDataURL(qrData).then((_url) => {
|
||||
url = _url
|
||||
})
|
||||
const _item = recordList.list?.[0] || {}
|
||||
const list = _item.content?.[0]?.formdata || []
|
||||
const record = {}
|
||||
list.map((item) => {
|
||||
record[item.field_name] = item.answer || ''
|
||||
})
|
||||
console.log("🚀 ~ file: status.js:52 ~ record:", _item)
|
||||
setState(draft => {
|
||||
draft.activeInfo = {
|
||||
...activity_info,
|
||||
|
|
@ -60,6 +64,8 @@ export default function status () {
|
|||
}
|
||||
draft.loading = false
|
||||
draft.qrUrl = url
|
||||
draft.session = _session
|
||||
draft.record = _item
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -126,7 +132,8 @@ export default function status () {
|
|||
// if (!res.confirm) return
|
||||
const { id } = $instance.router.params
|
||||
await api.user.cancelRegistrationRecord({
|
||||
activity_id: id
|
||||
activity_id: id,
|
||||
registration_session_id: session?.registration_session_id
|
||||
})
|
||||
navigateTo('/pages/index')
|
||||
}
|
||||
|
|
@ -149,12 +156,12 @@ export default function status () {
|
|||
imageUrl: `${process.env.APP_IMAGE_CDN_NEW}/share-logo.jpg`
|
||||
}
|
||||
})
|
||||
|
||||
// {activeInfo.status === 'pending' ? '待审核' : '报名成功'}
|
||||
return (
|
||||
<SpPage loading={loading} title={activeInfo.status === 'pending' ? '待审核' : '预约成功'} className='page-recommend-status' alwaysBackUrl="/pages/index" isBlack>
|
||||
<SpPage loading={loading} title="报名成功" className='page-recommend-status' alwaysBackUrl="/pages/index" isBlack>
|
||||
<View className="tit__label">
|
||||
{/* <SpCheckbox checked={true} colors="#000" label={activeInfo.status === 'pending' ? '待审核' : activeInfo.status === 'done' ? '已签到' : "已预约"}></SpCheckbox> */}
|
||||
{activeInfo.status === 'pending' ? '待审核' : activeInfo.status === 'done' ? '已签到' : "已报名 待通过"}
|
||||
{activeInfo.status === 'done' ? '已签到' : "待签到"}
|
||||
</View>
|
||||
<View style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
|
||||
<SpImage src='member/logo-black.png' height={42} mode='heightFix' isNew ></SpImage>
|
||||
|
|
@ -173,20 +180,22 @@ export default function status () {
|
|||
<Text className="value">{activeInfo?.mobile}</Text>
|
||||
</View>
|
||||
</View>
|
||||
<View style={{ margin: '20px 0 14px' }}>同行朋友</View>
|
||||
<View className="activity_info">
|
||||
<View className="activity_info-item flex-col">
|
||||
<Text className="title">姓名</Text>
|
||||
<Text className="value">{activeInfo?.username}</Text>
|
||||
{activeInfo?.has_partner === '是' && <>
|
||||
<View style={{ margin: '20px 0 14px' }}>同行朋友</View>
|
||||
<View className="activity_info">
|
||||
<View className="activity_info-item flex-col">
|
||||
<Text className="title">姓名</Text>
|
||||
<Text className="value">{activeInfo?.partner_name}</Text>
|
||||
</View>
|
||||
<View className="activity_info-item flex-col">
|
||||
<Text className="title">手机号</Text>
|
||||
<Text className="value">{activeInfo?.partner_mobile}</Text>
|
||||
</View>
|
||||
</View>
|
||||
<View className="activity_info-item flex-col">
|
||||
<Text className="title">手机号</Text>
|
||||
<Text className="value">{activeInfo?.mobile}</Text>
|
||||
</View>
|
||||
</View>
|
||||
</>}
|
||||
<View className="activity_time flex-col">
|
||||
<Text className="title">活动时间</Text>
|
||||
<Text className="value">{activeInfo?.start} - {activeInfo?.end}</Text>
|
||||
<Text className="value">{activeInfo.start == activeInfo.end ? activeInfo.start : `${activeInfo.start} - ${activeInfo.end} ${session.start_time.substr(11, 5)} - ${session.end_time.substr(11, 5)}`}</Text>
|
||||
</View>
|
||||
<View className="activity_addr flex-col">
|
||||
<Text className="title">活动地点</Text>
|
||||
|
|
@ -201,7 +210,7 @@ export default function status () {
|
|||
<Image className='member-code-box-qr' mode='aspectFit' src={qrUrl} />
|
||||
</View>
|
||||
<View className="code-box-txt">入场请出示预约凭证</View>
|
||||
</View> : <View style={'height:315px;'}></View>}
|
||||
</View> : <View style={{ height: activeInfo.status === 'done' ? '0px' : '315px' }}></View>}
|
||||
{activeInfo.status !== 'done' && <View className="cancel-txt" onClick={() => setShowModal(true)}>取消预约</View>}
|
||||
<View className="sp-picker">
|
||||
<View
|
||||
|
|
@ -232,7 +241,7 @@ export default function status () {
|
|||
cancelText='是,我要取消'
|
||||
confirmText='否,我要保留'
|
||||
onClose={() => setShowModal(false)}
|
||||
onCancel={() => handleCancel}
|
||||
onCancel={handleCancel}
|
||||
onConfirm={() => {
|
||||
setShowModal(false)
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
.page-recommend-status {
|
||||
padding: 10px 58px;
|
||||
.sp-page-body {
|
||||
padding-bottom: 50px;
|
||||
}
|
||||
.sp-checkbox-new {
|
||||
padding: 30px 0;
|
||||
.icon-checkbox-xuanzhong {
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ export default function scan () {
|
|||
}
|
||||
|
||||
const getRecords = async () => {
|
||||
const data = await api.user.getVerifyRegistrationRecordList({ activity_id: 1 })
|
||||
const data = await api.user.getVerifyRegistrationRecordList({ activity_id: 2 })
|
||||
const _list = (data?.list || []).map(item => {
|
||||
let formData = item.content?.[0]?.formdata || []
|
||||
if (formData.length > 0) {
|
||||
|
|
|
|||
|
|
@ -429,8 +429,8 @@ export const meiqiaInit = () => {
|
|||
}
|
||||
|
||||
const redirectUrl = async (api, url, type = 'redirectTo') => {
|
||||
if (!browser.weixin) {
|
||||
Taro[type]({ url })
|
||||
if (!browser?.weixin) {
|
||||
typeof url === 'string' && Taro[type]({ url })
|
||||
return
|
||||
}
|
||||
let newUrl = getUrl(url)
|
||||
|
|
|
|||
Loading…
Reference in New Issue