123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343 |
- <template>
- <view class="container">
- <view class="card-box">
- <view class="card-item-box">
- <view class="required"></view>
- <view class="label">
- 开票金额
- </view>
- <view class="text">
- ¥{{ formData.form.price }}元
- </view>
- </view>
- </view>
- <u-form :model="formData.form" ref="formRef">
- <view class="card-box">
- <view class="card-item-box">
- <view class="required">*</view>
- <view class="label">
- 发票类型
- </view>
- <view class="text">
- <u-form-item prop="type">
- <u-radio-group v-model="formData.form.type">
- <u-radio
- @change="onTypeChange"
- v-for="(item, index) in typeList" :key="index"
- :name="item.name"
- icon-size="26"
- label-size="26"
- >
- {{item.name}}
- </u-radio>
- </u-radio-group>
- </u-form-item>
- </view>
- </view>
- <view class="card-item-box">
- <view class="required">*</view>
- <view class="label">
- 抬头类型
- </view>
- <view class="text">
- <u-form-item prop="titleType">
- <u-radio-group v-model="formData.form.titleType">
- <u-radio
- @change="onTitleTypeChange"
- v-for="(item, index) in titleTypeList" :key="index"
- :name="item.name"
- icon-size="26"
- label-size="26"
- >
- {{item.name}}
- </u-radio>
- </u-radio-group>
- </u-form-item>
- </view>
- </view>
- <view class="card-item-box">
- <view class="required">*</view>
- <view class="label">
- 抬头名称
- </view>
- <view class="text">
- <u-form-item prop="name">
- <u-input v-model="formData.form.name" type="text" :border="false" placeholder=""/>
- </u-form-item>
- </view>
- </view>
- <view class="card-item-box">
- <view class="required">{{formData.form.titleType === '企业单位' ? '*' : ''}}</view>
- <view class="label">
- 纳税人识别号
- </view>
- <view class="text">
- <u-form-item prop="number">
- <u-input v-model="formData.form.number" type="text" :border="false" placeholder=""/>
- </u-form-item>
- </view>
- </view>
- <view class="card-item-box">
- <view class="required">*</view>
- <view class="label">
- 收票人邮箱
- </view>
- <view class="text">
- <u-form-item prop="email">
- <u-input v-model="formData.form.email" type="text" :border="false" placeholder=""/>
- </u-form-item>
- </view>
- </view>
- <view class="card-item-box">
- <view class="required">*</view>
- <view class="label">
- 手机号码
- </view>
- <view class="text">
- <u-form-item prop="tel">
- <u-input v-model="formData.form.tel" type="text" :border="false" placeholder=""/>
- </u-form-item>
- </view>
- </view>
- <view class="card-item-box" v-if="showMore">
- <view class="required"></view>
- <view class="label">
- 地址
- </view>
- <view class="text">
- <u-form-item prop="address">
- <u-input v-model="formData.form.address" type="text" :border="false" placeholder=""/>
- </u-form-item>
- </view>
- </view>
- <view class="card-item-box" v-if="showMore">
- <view class="required"></view>
- <view class="label">
- 开户银行
- </view>
- <view class="text">
- <u-form-item prop="bank">
- <u-input v-model="formData.form.bank" type="text" :border="false" placeholder=""/>
- </u-form-item>
- </view>
- </view>
- <view class="card-item-box" v-if="showMore">
- <view class="required"></view>
- <view class="label">
- 银行账号
- </view>
- <view class="text">
- <u-form-item prop="bankAccount">
- <u-input v-model="formData.form.bankAccount" type="text" :border="false" placeholder=""/>
- </u-form-item>
- </view>
- </view>
- <view class="card-item-box" v-if="showMore">
- <view class="required"></view>
- <view class="label">
- 备注说明
- </view>
- <view class="text">
- <u-form-item prop="remark">
- <u-input v-model="formData.form.remark" type="text" :border="false" placeholder=""/>
- </u-form-item>
- </view>
- </view>
- <view class="card-item-box func" @click="showMore = !showMore">
- <view class="text">
- {{ showMore ? '收起' : '展开' }}选项信息 <span class="iconfont icon-chevron-up" :class="{'reversal': !showMore}"></span>
- </view>
- </view>
- </view>
- <view class="bottom-box">
- <u-button type="error" shape="circle" @click="onSubmit">提交申请</u-button>
- </view>
- </u-form>
- </view>
- </template>
- <script setup>
- import { ref, reactive } from 'vue'
- import { onReady, onLoad } from '@dcloudio/uni-app'
-
- const showMore = ref(false)
-
- const formRef = ref()
- const formData = reactive({
- form: {
- orderIds: null, // 订单Id
- price: '0.00', // 开票金额
- type: '全电专票', // 发票类型
- titleType: '企业单位', // 抬头类型
- name: null, // 抬头名称
- number: null, // 纳税人识别号
- email: null, // 收票人邮箱
- tel: null, // 手机号码
- address: null, // 地址
- bank: null, // 开户银行
- bankAccount: null, // 银行账号
- remark: null // 备注说明
- },
- rules: {
- type: [
- {
- required: true,
- message: '请选择发票类型',
- // 可以单个或者同时写两个触发验证方式
- trigger: ['change','blur'],
- }
- ],
- titleType: [
- {
- required: true,
- message: '请选择抬头类型',
- // 可以单个或者同时写两个触发验证方式
- trigger: ['change','blur'],
- }
- ],
- name: [
- {
- required: true,
- message: '请输入抬头名称',
- // 可以单个或者同时写两个触发验证方式
- trigger: 'blur',
- }
- ],
- number: [
- {
- required: true,
- message: '请输入纳税人识别号',
- // 可以单个或者同时写两个触发验证方式
- trigger: 'blur',
- }
- ],
- email: [
- {
- required: true,
- message: '请输入收票人邮箱',
- // 可以单个或者同时写两个触发验证方式
- trigger: 'blur',
- }
- ],
- tel: [
- {
- required: true,
- message: '请输入手机号码',
- // 可以单个或者同时写两个触发验证方式
- trigger: 'blur',
- }
- ],
- }
- })
- const typeList = ref([
- {
- name: '全电专票'
- },
- {
- name: '全店普票'
- }
- ])
- const titleTypeList = ref([
- {
- name: '企业单位'
- },
- {
- name: '个人/非企业单位'
- }
- ])
- function onTypeChange(val) {}
- function onTitleTypeChange(val) {
- if (val !== '企业单位') {
- formData.rules.number[0].required = false
- } else {
- formData.rules.number[0].required = true
- }
- }
- function onSubmit() {
- formRef.value.validate((valid) => {
- if (valid) {
- uni.redirectTo({
- url: '/pages/invoiceResult/invoiceResult'
- })
- }
- })
- }
-
- onReady(() => {
- formRef.value.setRules(formData.rules)
- })
- onLoad((load) => {
- formData.form.orderIds = load.ids
- formData.form.price = load.price
-
- console.log('form', formData.form)
- })
- </script>
- <style lang="scss" scoped>
- .container {
- height: 100vh;
- width: 100vw;
- background-color: $uni-bg-color;
- padding: 0 20rpx;
- position: relative;
-
- .card-box {
- padding: 0 20rpx;
- background-color: $uni-text-color-inverse;
- border-radius: $uni-card-border-radius;
- margin-bottom: 20rpx;
- // &:first-child {
- // .card-item-box {
- // padding: 0;
- // }
- // }
- .card-item-box {
- display: flex;
- align-items: center;
- // padding: 20rpx 0;
- font-size: $uni-title-font-size-2;
- border-bottom: 1rpx solid #E6E6E6;
- height: 82rpx;
- &:last-child {
- border-bottom: none;
- }
- .required {
- width: 3%;
- color: $uni-color-error;
- font-weight: bold;
- }
- .label {
- width: 27%;
- font-weight: bold;
- }
- .text {
- width: 70%;
- ::v-deep .u-form-item {
- padding: 0 !important;
- line-height: 0;
- font-size: $uni-title-font-size-2;
- }
- }
- }
- .func {
- justify-content: center;
- text-align: center;
- color: $uni-text-color-grey;
-
- .reversal {
- display: inline-block;
- transform: rotate(180deg);
- }
- }
- }
-
- .bottom-box {
- padding: 20rpx;
-
- position: absolute;
- bottom: 50rpx;
- width: 95%;
- }
- }
- </style>
|