Files
chazhi/src/bundle/package/claim-coupon.vue
wangxiaowei 83f4ed1d4b 完善页面
2026-04-16 12:22:03 +08:00

109 lines
4.0 KiB
Vue

<route lang="jsonc" type="page">{
"needLogin": true,
"layout": "default",
"style": {
"navigationBarTitleText": "填写资料",
"navigationBarBackgroundColor": "#fff"
}
}</route>
<template>
<view>
<!-- <wd-navbar title="填写资料" placeholder safeAreaInsetTop :bordered="false">
<template #capsule>
<wd-navbar-capsule @back="router.navigateBack" @back-home="router.switchTab('/pages/index/index')" />
</template>
</wd-navbar> -->
<view class="bg-white rounded-16rpx px-30rpx pt-28rpx mt-20rpx">
<view class="text-32rpx leading-44rpx text-#303133 mb-32rpx flex items-center">
<view class="mr-10rpx">基本信息</view>
<view class="flex items-center">
<wd-img width="16rpx" height="16rpx" :src="`${OSS}icon/icon_validate.png`"></wd-img>
</view>
</view>
<view>
<view>
<view class="text-26rpx leading-32rpx text-#606266">公司名称</view>
<view class="mt-20rpx border-b border-b-solid border-b-[#F6F7F8] pb-20rpx">
<wd-input no-border placeholder="请填写公司名称" v-model="form.company_name"></wd-input>
</view>
</view>
<view class="mt-22rpx">
<view class="text-26rpx leading-32rpx text-#606266">姓名</view>
<view class="mt-20rpx border-b border-b-solid border-b-[#F6F7F8] pb-20rpx">
<wd-input no-border placeholder="请填写真实姓名" v-model="form.real_name"></wd-input>
</view>
</view>
<view class="mt-22rpx">
<view class="text-26rpx leading-32rpx text-#606266">手机号</view>
<view class="mt-20rpx border-b border-b-solid border-b-[#F6F7F8] pb-20rpx">
<wd-input no-border placeholder="请填写手机号" v-model="form.mobile" type="number"></wd-input>
</view>
</view>
</view>
</view>
<!-- 底部按钮 -->
<view class="fixed left-0 right-0 bottom-0 z-2 bg-[#fff] flex items-center justify-center"
:style="{ height: '140rpx' }">
<view class="text-32rpx flex items-center justify-center leading-90rpx text-center w-full px-60rpx">
<view class="flex-1 w-full h-90rpx bg-[#4C9F44] rounded-8rpx text-[#fff]" @click="hasToken ? ClaimCoupon.handleSubmit() : router.navigateTo('/pages/login/login')">{{ hasToken ? '提交' : '去登录' }}</view>
</view>
</view>
</view>
</template>
<script lang="ts" setup>
import { mobile } from '@/utils/test';
import { router, removeImageUrlPrefix, strToParams } from '@/utils/tools'
import { getTeaPackageCoupon } from '@/api/tea-package'
import { useToast } from 'wot-design-uni'
const toast = useToast()
const OSS = inject('OSS')
const form = reactive({
company_name: '',
real_name: '',
mobile: '',
})
const id = ref<number>(0)
const hasToken = ref<boolean>(false)
onLoad((args) => {
const scene = args?.scene
if (scene) {
id.value = strToParams(decodeURIComponent(args.scene))?.id
console.log("🚀 ~ id.value:", id.value)
}
})
onShow(() => {
const token = uni.getStorageSync('token')
hasToken.value = !!token
})
const ClaimCoupon = {
handleSubmit: async () => {
if (!id.value) {
toast.show('请重新扫码')
return
}
if (!form.company_name || !form.real_name || !form.mobile) {
toast.show('请完善信息')
return
}
if (!mobile(form.mobile)) {
toast.show('请输入正确的手机号')
return
}
const res = await getTeaPackageCoupon(id.value, form.company_name, form.real_name, form.mobile)
router.switchTab('/pages/index/index', 1000)
}
}
</script>