c18acc6e by lttnew
2 parents 3915c951 9a38e7d0
......@@ -1780,7 +1780,7 @@ export function cancelPay(id) {
export const outputInvoiceNo = (data) => {
return request({
url: `/common/order/outputInvoiceNo/${data.id}`,
url: `/common/order/outputInvoiceNo/${data.id}?taxno=${data.taxno}&phone=${data.phone}&name=${data.name}&invoiceType=${data.invoiceType}&amount=${data.amount}`,
method: 'post',
params: data
})
......
// dev
// const baseUrl_api = 'http://192.168.1.125:8787'
const baseUrl_api = 'https://tk001.wxjylt.com/stage-api/'
const baseUrl_api = 'http://47.98.186.233:8787'
// const baseUrl_api = 'https://tk001.wxjylt.com/stage-api/'
const loginImage_api = 'https://tk001.wxjylt.com/stage-api'
const payUrl = 'https://wxpay.cmbc.com.cn/mobilePlatform/appserver/lcbpPay.do'
......
......@@ -6,9 +6,9 @@
<text class="label">发票类型</text>
<view class="type-select">
<view
:class="{ active: form.invoiceType === '2' }"
class="type-option"
:class="{ active: form.invoiceType === '1' }"
@click="form.invoiceType = '1'"
@click="form.invoiceType = '2'"
>
<view class="type-icon"></view>
<view class="type-info">
......@@ -17,9 +17,10 @@
</view>
</view>
<view
v-if="type==0"
:class="{ active: form.invoiceType === '1' }"
class="type-option"
:class="{ active: form.invoiceType === '2' }"
@click="form.invoiceType = '2'"
@click="form.invoiceType = '1'"
>
<view class="type-icon enterprise"></view>
<view class="type-info">
......@@ -34,21 +35,21 @@
<view class="form-item column">
<text class="label">发票抬头</text>
<input
class="input"
v-model="form.name"
class="input"
placeholder="请输入公司全称或个人姓名"
/>
<text class="hint">请确保发票抬头与公司营业执照或个人身份证上的名称一致。</text>
</view>
<!-- 纳税人识别号(企业才显示) -->
<view class="form-item column" v-if="form.invoiceType === '2'">
<view v-if="form.invoiceType === '1'" class="form-item column">
<text class="label">纳税人识别号</text>
<input
class="input"
v-model="form.taxno"
placeholder="请输入纳税人识别号"
class="input"
maxlength="20"
placeholder="请输入纳税人识别号"
/>
<text class="hint">企业税务登记证上的号码,一般为 15、18 或 20 位</text>
</view>
......@@ -78,8 +79,8 @@
<view class="form-item column">
<text class="label">接收邮箱号码</text>
<input
class="input"
v-model="form.phone"
class="input"
placeholder="请输入接收发票的邮箱号码"
type="text"
/>
......@@ -89,7 +90,7 @@
<!-- 提交按钮 -->
<view class="btn-wrap">
<view class="submit-btn" :class="{ loading: submitting }" @click="handleSubmit">
<view :class="{ loading: submitting }" class="submit-btn" @click="handleSubmit">
{{ submitting ? '提交中...' : '提交申请' }}
</view>
</view>
......@@ -97,15 +98,15 @@
</template>
<script setup>
import { ref, reactive } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import { outputInvoiceNo } from '@/common/api.js';
import {ref, reactive} from 'vue';
import {onLoad} from '@dcloudio/uni-app';
import {outputInvoiceNo} from '@/common/api.js';
const submitting = ref(false);
const type = ref(0) //1个人订单只开普票
// 表单数据(与PC端字段完全对齐)
const form = reactive({
invoiceType: '1', // 1=个人 2=企业
invoiceType: '2', // 1=企业 2=个人
deliveryMethod: '1', // 接收方式:1=电子发票
name: '', // 发票抬头
taxno: '', // 纳税人识别号
......@@ -123,43 +124,45 @@ onLoad((options) => {
if (options.invoiceType) {
form.invoiceType = options.invoiceType;
}
type.value = options.type ?? 0
console.log(options)
});
// 表单验证
const validateForm = () => {
// 发票抬头校验
if (!form.name) {
uni.showToast({ title: '请输入发票抬头', icon: 'none' });
uni.showToast({title: '请输入发票抬头', icon: 'none'});
return false;
}
if (form.name.length < 2 || form.name.length > 100) {
uni.showToast({ title: '发票抬头长度在2-100个字符之间', icon: 'none' });
uni.showToast({title: '发票抬头长度在2-100个字符之间', icon: 'none'});
return false;
}
// 企业必须填纳税人识别号
if (form.invoiceType === '2' && !form.taxno) {
uni.showToast({ title: '请输入纳税人识别号', icon: 'none' });
if (form.invoiceType === '1' && !form.taxno) {
uni.showToast({title: '请输入纳税人识别号', icon: 'none'});
return false;
}
// 纳税人识别号格式校验(同PC)
if (form.invoiceType === '2') {
if (form.invoiceType === '1') {
const taxReg = /^[A-Z0-9]{15}$|^[A-Z0-9]{18}$|^[A-Z0-9]{20}$/;
if (!taxReg.test(form.taxno)) {
uni.showToast({ title: '纳税人识别号格式不正确', icon: 'none' });
uni.showToast({title: '纳税人识别号格式不正确', icon: 'none'});
return false;
}
}
// 邮箱校验
if (!form.phone) {
uni.showToast({ title: '请输入接收邮箱', icon: 'none' });
uni.showToast({title: '请输入接收邮箱', icon: 'none'});
return false;
}
const phoneReg = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
if (!phoneReg.test(form.phone)) {
uni.showToast({ title: '请输入正确的邮箱地址', icon: 'none' });
uni.showToast({title: '请输入正确的邮箱地址', icon: 'none'});
return false;
}
......@@ -183,6 +186,7 @@ const handleSubmit = async () => {
uni.navigateBack();
}, 1500);
} catch (error) {
console.log(error)
submitting.value = false;
// 错误已由 request.js 处理
} finally {
......
......@@ -5,13 +5,15 @@
<view class="yearRow">
<view class="label">缴费年限</view>
<view class="control">
<image class="icon" @click="minusYear" :src="config.baseUrl_api + '/fs/static/dd_02.png'" mode="widthFix"
v-if="form.payYear > 1"></image>
<image class="icon" :src="config.baseUrl_api + '/fs/static/dd_02_g.png'" mode="widthFix" v-else></image>
<image v-if="form.payYear > 1" :src="config.baseUrl_api + '/fs/static/dd_02.png'" class="icon"
mode="widthFix"
@click="minusYear"></image>
<image v-else :src="config.baseUrl_api + '/fs/static/dd_02_g.png'" class="icon" mode="widthFix"></image>
<text class="num">{{ form.payYear }}</text>
<image class="icon" :src="config.baseUrl_api + '/fs/static/btn_03.png'" mode="widthFix" @click="plusYear"
v-if="form.payYear < 5"></image>
<image class="icon" :src="config.baseUrl_api + '/fs/static/btn_03_g.png'" mode="widthFix" v-else></image>
<image v-if="form.payYear < 5" :src="config.baseUrl_api + '/fs/static/btn_03.png'" class="icon"
mode="widthFix"
@click="plusYear"></image>
<image v-else :src="config.baseUrl_api + '/fs/static/btn_03_g.png'" class="icon" mode="widthFix"></image>
</view>
</view>
</view>
......@@ -27,9 +29,9 @@
<view class="payRow ">
<radio-group @change="onPayTypeChange">
<label class="radioItem">
<radio value="1" :checked="payType === '1'" class="custom-radio" />
<radio :checked="payType === '1'" class="custom-radio" value="1"/>
<view class="payInfo">
<image class="icon" :src="config.baseUrl_api + '/fs/static/min.png'" mode="widthFix"></image>
<image :src="config.baseUrl_api + '/fs/static/min.png'" class="icon" mode="widthFix"></image>
<text>民生付</text>
</view>
</label>
......@@ -44,42 +46,43 @@
</view>
<view class="bottomBtn">
<button class="payBtn" @click="handelPay" :loading="isPaying">立即支付 ¥{{ memberTotalFee }}</button>
<button :loading="isPaying" class="payBtn" @click="handelPay">立即支付 ¥{{ memberTotalFee }}</button>
</view>
</view>
</template>
<script setup>
import {
import {
ref,
computed,
onMounted
} from 'vue'
import {
} from 'vue'
import {
onLoad
} from '@dcloudio/uni-app';
import to from 'await-to-js'
import * as api from '@/common/api.js'
import {
} from '@dcloudio/uni-app';
import to from 'await-to-js'
import * as api from '@/common/api.js'
import {
minShengPay
} from '@/common/pay.js'
} from '@/common/pay.js'
import config from '@/config.js'
const form = ref({
const form = ref({
payYear: 1
})
})
// 支付方式
const payType = ref('1')
const isPaying = ref(false)
// 支付方式
const payType = ref('1')
const isPaying = ref(false)
// 费用与优惠
const memberFee = ref(0)
const memberTotalFee = computed(() => {
// 费用与优惠
const memberFee = ref(0)
const memberTotalFee = computed(() => {
return memberFee.value * form.value.payYear
})
onLoad((options) => {
})
onLoad((options) => {
if (options.baseFormData) {
const data = JSON.parse(decodeURIComponent(options.baseFormData))
form.value = {
......@@ -89,30 +92,29 @@ import config from '@/config.js'
}
// 初始化接口
getMyMemberCertUnitFeeApi()
})
})
// 减年限
const minusYear = () => {
// 减年限
const minusYear = () => {
if (form.value.payYear > 1) {
form.value.payYear--
}
}
}
// 加年限(最大 5 年)
const plusYear = () => {
// 加年限(最大 5 年)
const plusYear = () => {
if (form.value.payYear < 5) {
form.value.payYear++
}
}
}
// 支付方式切换
const onPayTypeChange = (e) => {
// 支付方式切换
const onPayTypeChange = (e) => {
payType.value = e.detail.value
}
}
const handelPay = async () => {
const handelPay = async () => {
if (memberTotalFee.value <= 0) {
uni.showToast({
title: '支付金额异常',
......@@ -127,13 +129,13 @@ import config from '@/config.js'
mask: true
})
isPaying.value = true
form.value.validityDate = undefined
// 拼接完整参数
const postData = {
...form.value,
payYear: form.value.payYear,
payType: payType.value,
totalFee: memberTotalFee.value
totalFee: memberTotalFee.value,
}
// 创建订单
......@@ -172,95 +174,94 @@ import config from '@/config.js'
uni.redirectTo({
url: `/personal/sucPay?orderId=${orderRes.data.orderId}`
})
}
}
// 获取会员费
async function getMyMemberCertUnitFeeApi() {
// 获取会员费
async function getMyMemberCertUnitFeeApi() {
const res = await api.getZtxFeeConfig()
memberFee.value = Number(res.data.personMemberFee || 1500)
}
}
</script>
<style scoped>
.container {
.container {
min-height: 100vh;
background-color: #f7f7f7;
}
}
.content {
.content {
padding: 20rpx 20rpx 120rpx;
}
}
.card {
.card {
background: #fff;
border-radius: 8rpx;
padding: 25rpx 20rpx;
margin-bottom: 20rpx;
}
}
.yearRow {
.yearRow {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 20rpx;
}
}
.yearRow .label {
.yearRow .label {
font-size: 28rpx;
color: #333;
}
}
.yearRow .control {
.yearRow .control {
display: flex;
align-items: center;
}
}
.control image {
.control image {
width: 50rpx;
height: 50rpx;
}
}
.yearRow .num {
.yearRow .num {
font-size: 28rpx;
color: #333;
min-width: 80rpx;
text-align: center;
margin: 0 10rpx;
}
}
.row {
.row {
display: flex;
justify-content: space-between;
align-items: center;
}
}
.row .label {
.row .label {
font-size: 28rpx;
color: #333;
}
}
.row .value {
.row .value {
font-size: 30rpx;
color: #C4121B;
font-weight: 500;
}
}
.hintRow {
.hintRow {
display: flex;
align-items: flex-start;
font-size: 24rpx;
line-height: 1.4;
}
}
.hintRow .hintText {
.hintRow .hintText {
color: #FF8124;
flex: 1;
margin-top: 10rpx;
}
}
.deductRow {
.deductRow {
background: #fff;
padding: 20rpx 20rpx;
display: flex;
......@@ -268,48 +269,48 @@ import config from '@/config.js'
align-items: center;
margin-bottom: 10rpx;
border-radius: 8rpx;
}
}
.deductRow .label {
.deductRow .label {
font-size: 28rpx;
color: #333;
}
}
.deductRow .value {
.deductRow .value {
font-size: 30rpx;
color: #C4121B;
}
}
.payRow {
.payRow {
background: #fff;
border-radius: 8rpx;
padding: 20rpx 20rpx;
margin-bottom: 20rpx;
}
}
.radioItem {
.radioItem {
display: flex;
align-items: center;
}
}
.payInfo {
.payInfo {
display: flex;
align-items: center;
margin-left: 15rpx;
}
}
.payInfo .icon {
.payInfo .icon {
width: 40rpx;
height: 40rpx;
margin-right: 10rpx;
}
}
.payInfo text {
.payInfo text {
font-size: 28rpx;
color: #333;
}
}
.totalRow {
.totalRow {
background: #fff;
border-radius: 8rpx;
padding: 20rpx 20rpx;
......@@ -317,20 +318,20 @@ import config from '@/config.js'
justify-content: space-between;
align-items: center;
margin-top: 10rpx;
}
}
.totalRow .label {
.totalRow .label {
font-size: 28rpx;
color: #333;
}
}
.redBig {
.redBig {
font-size: 32rpx;
color: #C4121B;
font-weight: bold;
}
}
.bottomBtn {
.bottomBtn {
position: fixed;
bottom: 0;
left: 0;
......@@ -338,9 +339,9 @@ import config from '@/config.js'
padding: 20rpx 20rpx;
background: #fff;
border-top: 1rpx solid #eee;
}
}
.payBtn {
.payBtn {
width: 100%;
height: 88rpx;
line-height: 88rpx;
......@@ -350,30 +351,30 @@ import config from '@/config.js'
font-size: 32rpx;
text-align: center;
border: none;
}
}
.payBtn[disabled] {
.payBtn[disabled] {
background-color: #ccc;
color: #999;
}
}
.red {
.red {
color: #C4121B;
}
}
.icon {
.icon {
width: 30px;
}
}
::v-deep .custom-radio .wx-radio-input {
::v-deep .custom-radio .wx-radio-input {
width: 30rpx;
height: 30rpx;
border-radius: 50%;
border: 2rpx solid #ccc;
}
}
::v-deep .custom-radio .wx-radio-input.wx-radio-input-checked {
::v-deep .custom-radio .wx-radio-input.wx-radio-input-checked {
border-color: #C4121B !important;
background: #C4121B !important;
}
}
</style>
......
......@@ -141,6 +141,7 @@ const queryParams = reactive({
pageNum: 1,
pageSize: 10,
type: '0', // 0表示个人会员
subType: '1', //0道馆 1个人
// queryType: '1',
// payStatus: '',
perId: ''
......@@ -269,7 +270,7 @@ const handlePay = async (item) => {
// 申请开票
const makeInvoiceFN = (item) => {
uni.navigateTo({url: `/pages/invoice/apply?orderId=${item.id}amount=${item.price}`});
uni.navigateTo({url: `/pages/invoice/apply?orderId=${item.id}&amount=${item.price}&type=1`});
};
// 取消订单
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!