391d911a by lttnew

订单

1 parent f584c37d
......@@ -1574,6 +1574,25 @@ export function certifiedNew(data) {
})
}
// 再次支付订单
export function payForOrder(data) {
let url = '/system/certifiedNew/payForOrder'
const params = []
if (data.id) params.push(`id=${data.id}`)
if (data.renewYear) params.push(`renewYear=${data.renewYear}`)
params.push(`type=${data.type}`)
if (data.contactPerson) params.push(`contactPerson=${data.contactPerson}`)
if (data.contactTel) params.push(`contactTel=${data.contactTel}`)
if (params.length > 0) {
url += '?' + params.join('&')
}
return request({
url,
method: 'post',
showLoading: false
})
}
// 订单详情
export function orderDetail(orderId) {
return request({
......@@ -1734,6 +1753,15 @@ export function getMyRecentExam() {
})
}
// 取消订单
export function cancelOrder(id) {
return request({
url: `/common/order/cancelOrder/${id}`,
method: 'post',
data: { id }
})
}
// 考点申请列表
export function examPointApplyList(params) {
return request({
......
......@@ -6,8 +6,8 @@
<text class="modal-title">{{ title }}</text>
</view>
<view class="modal-body">
<rich-text v-if="isHtml" :nodes="content"></rich-text>
<text v-else class="modal-text">{{ content }}</text>
<text class="modal-text">{{ content }}</text>
<text v-if="extraContent && !isHtml" class="modal-extra">{{ extraContent }}</text>
</view>
<view class="modal-footer">
<button class="btn-cancel" @click="onCancel" v-if="showCancel">{{ cancelText }}</button>
......@@ -33,6 +33,10 @@ const props = defineProps({
type: Boolean,
default: false
},
extraContent: {
type: String,
default: ''
},
showCancel: {
type: Boolean,
default: true
......@@ -51,7 +55,7 @@ const props = defineProps({
},
maskCloseable: {
type: Boolean,
default: true
default: false
}
})
......@@ -156,6 +160,17 @@ defineExpose({ open, close })
word-break: break-word;
}
.modal-extra {
display: block;
margin-top: 16rpx;
font-size: 28rpx;
color: #AD181F;
line-height: 1.6;
text-align: left;
white-space: pre-wrap;
word-break: break-word;
}
.modal-footer {
display: flex;
padding: 0 30rpx 30rpx;
......
// dev
// const baseUrl_api = 'http://192.168.1.134:8787'
const baseUrl_api = 'http://192.168.1.134:8787'
// const baseUrl_api = 'http://47.98.186.233:8787'
const baseUrl_api = 'https://tk001.wxjylt.com/stage-api/'
// 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'
......
......@@ -106,6 +106,8 @@ import * as api from '@/common/api.js'
import {minShengPay} from '@/common/pay.js'
import config from '@/config.js'
// 订单信息(再次支付时传入)
const payForm = ref({})
const form = ref({
renewYear: 1,
contactPerson: '',
......@@ -122,11 +124,11 @@ const payName = ref('')
const assoName = ref('')
const memberTotalFee = computed(() => {
const total = memberFee.value * form.value.renewYear
if (preferentialPolicy.value) {
return (memberFee.value * form.value.renewYear - memberFee.value * 1).toFixed(2)
} else {
return (memberFee.value * form.value.renewYear).toFixed(2)
return (total - memberFee.value).toFixed(2)
}
return total.toFixed(2)
})
// 年限减
......@@ -183,39 +185,52 @@ const handelPay = async () => {
}
}
// 显示 loading
uni.showLoading({
title: '支付中...',
mask: true
title: '加载中...'
})
if (isPaying.value) return
isPaying.value = true
// 构建请求参数
const params = {
let data
// 再次支付
if (payForm.value.id && payForm.value.payStatus === '0') {
const [err, res] = await to(api.payForOrder({
id: payForm.value.id,
renewYear: form.value.renewYear,
type: payType.value,
contactPerson: form.value.contactPerson,
contactTel: form.value.contactTel
}))
if (err || res.code !== 200) {
uni.hideLoading()
isPaying.value = false
uni.showToast({
title: res?.msg || '创建订单失败',
icon: 'none'
})
return
}
// 对公转账需要传联系人信息
if (payType.value === '3') {
params.contactPerson = form.value.contactPerson
params.contactTel = form.value.contactTel
}
// 创建订单 - 参考PC端逻辑
const [orderErr, orderRes] = await to(api.certifiedNew(params))
if (orderErr) {
data = res.data
} else {
// 第一次下单
const [err, res] = await to(api.certifiedNew({
renewYear: form.value.renewYear,
type: payType.value,
contactPerson: form.value.contactPerson,
contactTel: form.value.contactTel
}))
if (err || res.code !== 200) {
uni.hideLoading()
isPaying.value = false
uni.showToast({
title: '创建订单失败',
title: res?.msg || '创建订单失败',
icon: 'none'
})
return
}
data = res.data
}
const data = orderRes.data
// 无需支付,直接成功
if (data.payFlag == 0) {
uni.hideLoading()
......@@ -238,18 +253,17 @@ const handelPay = async () => {
// 民生支付
if (data.payResult && data.payResult.encryptedData) {
uni.hideLoading()
try {
const res = await minShengPay(data.orderId, data.payResult.encryptedData)
if (res == 'OK') {
isPaying.value = false
// 支付成功,跳转到成功页面
uni.redirectTo({
url: `/myCenter/sucPay?orderId=${data.orderId}`
})
}
} catch (e) {
console.error('支付失败', e)
uni.hideLoading()
isPaying.value = false
}
return
......@@ -260,10 +274,25 @@ const handelPay = async () => {
onLoad((option) => {
console.log(66, option)
// 接收订单ID(再次支付时)
if (option.orderId) {
payForm.value.id = option.orderId
payForm.value.payStatus = '0'
// 获取订单详情
to(api.orderDetail(option.orderId)).then(([err, res]) => {
if (!err && res.data) {
const content = res.data.content ? JSON.parse(res.data.content) : {}
form.value.renewYear = content.yearCount || 1
payName.value = res.data.orderName || ''
}
})
}
// 接收年限
form.value.renewYear = Number(option.renewYear || 1)
if (option.renewYear) {
form.value.renewYear = Number(option.renewYear)
}
// 接收缴费单位和所属协会
payName.value = decodeURIComponent(option.payName || '')
payName.value = payName.value || decodeURIComponent(option.payName || '')
console.log(77, payName.value)
assoName.value = decodeURIComponent(option.assoName || '')
// 初始化获取费用和优惠
......
......@@ -119,6 +119,17 @@
<view class="modal-tip">友情提示:非考点无法申请级位考试</view>
</view>
</uni-popup>
<uni-popup ref="unpaidPopup" type="center" :mask-click="false">
<view class="custom-modal">
<view class="modal-title">系统提示</view>
<view class="modal-content">您有一笔订单尚未支付,请及时支付或取消订单。</view>
<view class="modal-btns">
<button class="btn-cancel" @click="closeUnpaidPopup()">取消订单</button>
<button class="btn-confirm" @click="goToPay()">去支付</button>
</view>
</view>
</uni-popup>
</view>
</template>
......@@ -139,7 +150,9 @@
const verifyPopup = ref(null)
const applyPopup = ref(null)
const unpaidPopup = ref(null)
const verifyResult = ref({})
const payForm = ref({})
const form = ref({
type: '1',
......@@ -237,6 +250,7 @@
await getForm()
await canUseDiscountApi()
await getZtxDiscountPolicyApi()
handelGetMyRecent()
}
async function getMyMemberCertUnitFeeApi() {
......@@ -485,6 +499,13 @@
return
}
// 检查是否有未支付订单
try {
await handelGetMyRecent()
} catch (e) {
return
}
try {
const res = await handelVerify()
verifyResult.value = res
......@@ -516,6 +537,50 @@
submitData()
}
// 新增:关闭未支付订单弹窗
function closeUnpaidPopup() {
unpaidPopup.value.close()
handelCancelOrder()
}
// 新增:去支付
function goToPay() {
unpaidPopup.value.close()
uni.navigateTo({
url: `/myCenter/goPay?payName=${encodeURIComponent(form.value.name || '')}&orderId=${payForm.value.id}`
})
}
// 新增:获取最近认证记录,判断是否有未支付订单
function handelGetMyRecent() {
return new Promise(async (resolve, reject) => {
const res = await api.getMyRecent() ?? {}
payForm.value = res.data?.comOrder ?? {}
if (payForm.value.content) payForm.value.content = JSON.parse(payForm.value.content)
if (payForm.value.payStatus === '0') {
unpaidPopup.value.open()
return reject(res)
} else {
return resolve(true)
}
})
}
// 新增:取消订单
async function handelCancelOrder() {
if (!payForm.value.id) return
uni.showLoading({ title: '取消中...' })
try {
await api.cancelOrder(payForm.value.id)
uni.showToast({ title: '取消成功', icon: 'success' })
await init()
} catch (e) {
uni.showToast({ title: '取消失败', icon: 'none' })
} finally {
uni.hideLoading()
}
}
// 新增:打开考点申请弹窗(备用,如需调用可加触发逻辑)
function openApplyPopup() {
applyPopup.value.open()
......@@ -902,22 +967,26 @@
}
.btn-red {
background-color: #F56C6C;
background: linear-gradient(135deg, #AD181F 0%, #c42a2a 100%);
color: #fff;
border-radius: 8rpx;
height: 80rpx;
line-height: 80rpx;
border-radius: 44rpx;
height: 88rpx;
line-height: 88rpx;
font-size: 32rpx;
width: 100%;
border: none;
}
.fixedBottom {
display: flex;
justify-content: center;
padding: 30rpx;
position: fixed;
bottom: 0;
left: 0;
right: 0;
padding: 20rpx 30rpx;
background: #fff;
box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.05);
z-index: 99;
}
......
......@@ -119,7 +119,8 @@ const onTabSwitch = () => {
<style lang="scss" scoped>
.notice-page {
position: relative;
min-height: 100vh;
height: 100vh;
overflow: hidden;
background: #ededf0;
box-sizing: border-box;
}
......
......@@ -202,7 +202,7 @@
<view class="date">
<view class="data-header">
<text class="member-label">{{ getOrderLabel(item) }}·</text>
<text class="value ">{{ item.orderName || '——' }}</text>
<text class="value ">{{ item.wfCode || '——' }} · {{ item.payType == '3' ? '对公转账' : '民生付' }}</text>
</view>
<text :class="{
'status-wait': item.payStatus == 3,
......@@ -214,25 +214,6 @@
</text>
</view>
</view>
<!-- <view class="card-header code-row">
<view class="date">
<view class="data-header">
<text class="value">
<text class="tradeNo">订单编号:</text>
{{ item.tradeNo || '——' }}
</text>
</view>
</view>
</view> -->
<!-- <view class="card-header code-row">
<view class="date">
<view class="data-header">
<text class="value">
{{ item.wfCode || '——' }}
</text>
</view>
</view>
</view> -->
<view class="member-time">
<view class="label">
<text class="star"></text>
......@@ -249,49 +230,14 @@
</view>
</view>
<!-- 核心:前2tab仅展示缴费年限,后2tab仅展示人数合计 -->
<!-- <view v-if="item.content" class="info-section flex f-j-s">
<view v-if="currentTab === '0' || currentTab === '1'" class="single-info">
<view class="label">缴费年限:</view>
<view class="value">{{ item.content.yearCount || 0 }}</view>
</view>
<view v-if="currentTab === '2' || currentTab === '3' || currentTab === '4'" class="single-info">
<view class="label">人数合计</view>
<view class="value">{{ item.content.personCount || 0 }}</view>
</view>
<view class="line"></view>
<view class="single-info">
<view class="label">订单状态</view>
<view :class="item.effect == 1 ? 'text-success' : 'text-warning'" class="value">
{{ item.effect == 1 ? '已生效' : '未生效' }}
</view>
</view>
<view class="line"></view>
<view class="single-info">
<view class="label">缴费状态</view>
<view
:class="{
'text-primary': item.payStatus == 0,
'text-success': item.payStatus == 1,
'text-danger': item.payStatus == 2
}"
class="value"
>
{{ item.payStatus == 0 ? '待缴费' : item.payStatus == 1 ? '缴费成功' : '订单取消' }}
</view>
</view>
<!-- 缴费方式 -->
<!-- <view class="pay-way-row">
<text class="pay-way-label">缴费方式:</text>
<text class="pay-way-value">{{ item.payType == '3' ? '对公转账' : '民生付' }}</text>
</view> -->
<!-- 按钮组:靠右紧凑展示 -->
<!-- 按钮组:靠右展示 -->
<view class="btn-group">
<view>
<text class="more" @click.stop="goToDetail(item)">更多</text>
</view>
<view class="btn-flex">
<!-- 已缴费:申请开票/已开票(需要审核通过才能开票) -->
<template>
<button class="btn btn-info" @click.stop="goToDetail(item)">查看明细</button>
</template>
<!-- 已缴费:申请开票/已开票(需要审核通过才能开票) -->
<template v-if="item.payStatus == 1 && item.invoiceStatus != 1&& item.auditStatus == 2 &&item.price>0">
<button :disabled="item.invoiceStatus === 1" class="btn btn-view-invoice"
......@@ -304,12 +250,11 @@
<button class="btn btn-invoice" @click.stop="viewInvoice(item)">查看票据</button>
</template>
<!-- 未缴费:去缴费 + 取消订单 -->
<!-- <template v-if="item.payStatus == 0">
<button class="btn btn-cancel" @click="handleCancel(item)">取消订单</button>
<button class="btn btn-pay" @click="handlePay(item)">去缴费</button>
</template> -->
</view>
<template v-if="item.payStatus == 0">
<!-- 支付按钮:仅 auditStatus==='0' && payStatus==='0' 时可点 -->
<button :disabled="!(item.auditStatus == '0' && item.payStatus == 0)" class="btn btn-pay" @click.stop="handlePay(item)">去支付</button>
<button :disabled="item.payStatus != 0" class="btn btn-cancel" @click.stop="handleCancel(item)">取消订单</button>
</template>
</view>
</view>
</view>
......@@ -575,7 +520,7 @@ const getAuditStatusText = (status) => {
const getOrderLabel = (item) => {
const map = {
0: '会员',
0: '个人',
1: '单位',
2: '级位',
3: '段位',
......@@ -608,8 +553,10 @@ const initData = async () => {
console.log("接口返回:", res);
if (!res || !res.rows || res.rows.length === 0) {
if (pageNum.value === 1) {
list.value = [];
}
hasMore.value = false;
loading.value = false;
return;
}
// 安全解析content字段
......@@ -669,8 +616,6 @@ const confirmDel = async () => {
};
const goToDetail = (item) => {
console.log("goToDetail:", item);
console.log("currentTab.value", currentTab.value);
const form = encodeURIComponent(JSON.stringify(item))
switch (currentTab.value) {
case '1':
......@@ -696,15 +641,13 @@ const closeDelPopup = () => {
currentOrder.value = null;
};
// 去缴费
// 去缴费 - 跳转到单位会员支付页面
const handlePay = async (item) => {
if (item.payStatus !== 0) return;
try {
await api.goPay({id: item.id});
uni.navigateTo({url: `/pages/pay/pay?orderId=${item.id}`});
} catch (e) {
uni.showToast({title: '发起支付失败', icon: 'none'});
}
// 跳转到单位会员支付页面
uni.navigateTo({
url: `/myCenter/goPay?orderId=${item.id}&renewYear=${item.content?.yearCount || 1}`
});
};
// 申请开票
......@@ -781,7 +724,7 @@ const handleCancel = (item) => {
const confirmCancel = async () => {
if (!currentOrder.value) return;
try {
await api.cancelPay(currentOrder.value.id);
await api.cancelOrder(currentOrder.value.id);
uni.showToast({title: '取消成功', icon: 'success'});
pageNum.value = 1;
list.value = [];
......@@ -811,7 +754,8 @@ const onTabSwitch = (index, url) => {
height: 100vh;
display: flex;
flex-direction: column;
padding-bottom: calc(120rpx + env(safe-area-inset-bottom));
overflow: hidden;
padding-bottom: 0;
box-sizing: border-box;
&.no-scroll {
......@@ -985,14 +929,17 @@ const onTabSwitch = (index, url) => {
// 滚动列表容器
.order-list-scroll {
flex: 1;
height: auto;
overflow: auto;
height: 0;
min-height: 0;
overflow: hidden;
background: #ededf0;
}
// 订单列表
.order-list {
padding: 0 24rpx 34rpx;
min-height: 100%;
box-sizing: border-box;
padding: 0 24rpx calc(180rpx + env(safe-area-inset-bottom));
.order-card {
background: #fff;
......@@ -1192,29 +1139,18 @@ const onTabSwitch = (index, url) => {
// 按钮组
.btn-group {
display: flex;
justify-content: space-between;
justify-content: flex-end;
align-items: center;
gap: 16rpx;
width: 100%;
margin-top: 16rpx;
.more {
color: #999;
font-size: 26rpx;
font-weight: 700;
}
.btn-flex {
display: flex;
justify-content: flex-end;
gap: 16rpx;
}
flex-wrap: wrap;
.btn {
// 固定宽度,所有按钮一样大
width: 126rpx;
height: 44rpx;
line-height: 44rpx;
width: 140rpx;
height: 48rpx;
line-height: 48rpx;
padding: 0;
border-radius: 10rpx;
font-size: 24rpx;
......@@ -1276,6 +1212,26 @@ const onTabSwitch = (index, url) => {
}
}
// 缴费方式行
.pay-way-row {
display: flex;
align-items: center;
padding: 10rpx 0;
border-top: 1rpx dashed #f0f0f0;
margin-top: 8rpx;
.pay-way-label {
font-size: 26rpx;
color: #999;
flex-shrink: 0;
}
.pay-way-value {
font-size: 26rpx;
color: #333;
font-weight: 500;
}
}
// 加载/无更多提示
.loading-tip, .no-more {
......
......@@ -87,6 +87,19 @@
</view>
</view>
</uni-popup>
<uni-popup ref="unpaidPopup" type="center" :mask-click="false">
<view class="dialog-wrapper">
<view class="dialog-title">系统提示</view>
<view class="dialog-message">您有一笔订单尚未支付,请及时支付或取消订单。</view>
<view class="dialog-footer">
<button class="dialog-btn cancel" @click="handelCancelOrder()">取消订单</button>
<button class="dialog-btn confirm" @click="goToPay()">去支付</button>
</view>
</view>
</uni-popup>
<CustomModal ref="customModalRef" :title="modalConfig.title" :content="modalConfig.content" :extraContent="modalConfig.extraContent" :showCancel="modalConfig.showCancel" :showConfirm="modalConfig.showConfirm" :cancelText="modalConfig.cancelText" :confirmText="modalConfig.confirmText" @confirm="modalConfig.onConfirm" @cancel="modalConfig.onCancel" />
</view>
</template>
......@@ -94,9 +107,11 @@
import config from '@/config.js'
import { computed, ref } from 'vue'
import { onLoad, onShow } from '@dcloudio/uni-app'
import to from 'await-to-js'
import * as api from '@/common/api.js'
import { getInfo } from '@/common/login'
import DaoGuanTabBar from '@/components/dao-guan-tab-bar.vue'
import CustomModal from '@/components/custom-modal.vue'
const app = getApp()
const userType = ref('1')
......@@ -109,10 +124,22 @@ const authPayPopup = ref(null)
const authPayPopupMsg = ref('')
const passwordTipPopup = ref(null)
const examPointPopup = ref(null)
const unpaidPopup = ref(null)
const payForm = ref({})
const customModalRef = ref(null)
const modalConfig = ref({})
const showDirectlyForAuthPay = ref(false)
const directUnderFlagForAuthPay = ref(0)
const associateIdForAuthPay = ref(0)
// 图片是否存在标识
const btn01Exist = ref(true)
const btn02Exist = ref(true)
const btn03Exist = ref(true)
const btn04Exist = ref(true)
const btn05Exist = ref(true)
const btn06Exist = ref(true)
const memberName = computed(() => {
return memberInfo.value.name || deptInfo.value.deptName || app.globalData?.dept?.deptName || '--'
})
......@@ -157,6 +184,8 @@ onShow(() => {
})
function init() {
checkImgExist()
handelGetMyRecent()
api.getMyOwnMemberInfo().then(res => {
const data = res && res.data ? res.data : {}
app.globalData.authenticationStatus = data.authenticationStatus
......@@ -183,6 +212,27 @@ function init() {
})
}
// 检查图片是否存在,不存在则显示按钮
function checkImgExist() {
const btnKeys = ['btn01Exist', 'btn02Exist', 'btn03Exist', 'btn04Exist', 'btn05Exist', 'btn06Exist']
const refsMap = { btn01Exist, btn02Exist, btn03Exist, btn04Exist, btn05Exist, btn06Exist }
const paths = [
'/fs/static/img/btn01.png',
'/fs/static/img/btn02.png',
'/fs/static/img/btn03.png',
'/fs/static/img/btn04.png',
'/fs/static/img/btn05.png',
'/fs/static/img/btn06.png'
]
btnKeys.forEach((key, index) => {
uni.getImageInfo({
src: config.baseUrl_api + paths[index],
success: () => { /* 图片存在 */ },
fail: () => { refsMap[key].value = false }
})
})
}
function handleAccountStatus() {
console.log('handleAccountStatus22',userType.value , app.globalData.authenticationStatus)
if (userType.value != '1' && app.globalData.authenticationStatus != '2' && app.globalData.authenticationStatus != '4') {
......@@ -313,10 +363,10 @@ function goAuthPayV2() {
showAuthPayDialog('当前账号状态暂无法办理缴费业务')
return
}
if (authPayDisabled.value) {
showAuthPayDialog('您有一笔缴费正在审核中,请勿重复缴费。您可前往【认证详情】查看审核进度。')
return
}
// if (authPayDisabled.value) {
// showAuthPayDialog('您有一笔缴费正在审核中,请勿重复缴费。您可前往【认证详情】查看审核进度。')
// return
// }
goPath('/myCenter/perfect')
}
......@@ -360,6 +410,69 @@ console.log('checkDialogs',app.globalData.memberInfo?.activeStatus,app.globalDat
const onTabSwitch = () => {
// tab switch handled by component
}
// 订单未支付相关方法
function showModal(options) {
modalConfig.value = {
title: options.title || '',
content: options.content || '',
extraContent: options.extraContent || '',
showCancel: options.showCancel !== false,
showConfirm: options.showConfirm !== false,
cancelText: options.cancelText || '取消',
confirmText: options.confirmText || '确定',
onConfirm: options.onConfirm,
onCancel: options.onCancel
}
customModalRef.value?.open()
}
function closeUnpaidPopup() {
unpaidPopup.value?.close()
}
function goToPay() {
const memberInfoData = memberInfo.value || app.globalData.memberInfo || {}
const assoName = memberInfoData.associateName || memberInfoData.assoName || ''
uni.navigateTo({
url: `/myCenter/goPay?payName=${encodeURIComponent(payForm.value.orderName || memberInfoData.deptName || '')}&assoName=${encodeURIComponent(assoName)}&orderId=${payForm.value.id}`
})
}
function handelCancelOrder() {
if (!payForm.value.id) return
showModal({
title: '确认取消',
content: '确定要取消该订单吗?',
cancelText: '取消',
confirmText: '确定',
onConfirm: async () => {
uni.showLoading({ title: '加载中...', mask: true })
const [err, result] = await to(api.cancelOrder(payForm.value.id))
uni.hideLoading()
if (!err && result?.code === 200) {
uni.showToast({ title: '订单已取消', icon: 'none' })
unpaidPopup.value?.close()
} else {
uni.showToast({ title: result?.msg || '取消失败', icon: 'none' })
}
}
})
}
function handelGetMyRecent() {
return new Promise(async (resolve) => {
const res = await to(api.getMyRecent())
if (res[0] || !res[1]?.data) return resolve(false)
payForm.value = res[1].data?.comOrder || {}
if (payForm.value.content) payForm.value.content = JSON.parse(payForm.value.content)
if (payForm.value.payStatus === '0') {
unpaidPopup.value?.open()
return resolve(false)
}
return resolve(true)
})
}
</script>
<style lang="scss" scoped>
......@@ -598,4 +711,16 @@ const onTabSwitch = () => {
font-size: 24rpx;
text-align: right;
}
.action-btn {
width: 100%;
height: 88rpx;
line-height: 88rpx;
background: linear-gradient(135deg, #AD181F 0%, #c42a2a 100%);
color: #fff;
font-size: 30rpx;
font-weight: 500;
text-align: center;
border-radius: 44rpx;
}
</style>
......
......@@ -842,85 +842,68 @@ function goAuthPay() {
goPath('/myCenter/perfect')
}
function init() {
async function init() {
isInit.value = true
loginServer.getMyOwnMemberInfo().then(res => {
try {
const res = await loginServer.getMyOwnMemberInfo()
console.log(43, res)
userType.value = app.globalData.userType
memberInfo.value = app.globalData.memberInfo
const memberResData = res && res.data ? res.data : {}
updateAuthPayDisabled(memberResData)
updateAuthPayRule(memberResData)
// deptInfo.value = app.globalData.dept || {}
// app.globalData.deptInfo = res.dept || {}
if (userType.value != '1' && app.globalData.authenticationStatus != '2' && app.globalData.authenticationStatus != '4') {
// 注册引导
uni.navigateTo({
url: '/pages/index/perfect'
});
uni.navigateTo({ url: '/pages/index/perfect' })
return
}
// console.log(userType.value, app.globalData.authenticationStatus)
if (app.globalData.authenticationStatus == '5') {
if (app.globalData.genFlag == 1) {
uni.showModal({
title: '提示',
content: '您的会员已过期',
success: function (res) {
}
})
uni.showModal({ title: '提示', content: '您的会员已过期' })
} else {
uni.showModal({
title: '提示',
content: '会员已过期,请及时续费',
success: function (res) {
if (res.confirm) {
uni.navigateTo({
url: '/myCenter/auth'
});
uni.navigateTo({ url: '/myCenter/auth' })
}
}
})
}
return
}
if (app.globalData.authenticationStatus == '4') {
uni.showModal({
title: '提示',
content: '你的会员即将过期,将会影响你的业务,请及时续费!',
success: function (res) {
}
})
uni.showModal({ title: '提示', content: '你的会员即将过期,将会影响你的业务,请及时续费!' })
}
if (app.globalData.memberInfo?.activeStatus == 0) {
uni.showModal({
content: '账号未激活,请前去激活',
success: function (res) {
if (res.confirm) {
uni.navigateTo({
url: '/myCenter/auth'
});
uni.navigateTo({ url: '/myCenter/auth' })
}
}
})
return
}
checkDialogs()
uni.hideLoading();
})
api.getRemindCount().then(res => {
numData.value = res.data
})
uni.hideLoading()
api.getBlack().then(res => {
isBlack.value = res.data
})
// 以下接口只在不需要跳转时调用
const [countRes, blackRes] = await Promise.all([
api.getRemindCount(),
api.getBlack()
])
numData.value = countRes.data
isBlack.value = blackRes.data
getNews()
} catch (e) {
console.log('init error:', e)
}
}
function getNews() {
......
......@@ -266,6 +266,7 @@
:cancelText="modalConfig.cancelText"
:confirmText="modalConfig.confirmText"
:content="modalConfig.content"
:extraContent="modalConfig.extraContent"
:isHtml="modalConfig.isHtml"
:showCancel="modalConfig.showCancel"
:showConfirm="modalConfig.showConfirm"
......@@ -325,6 +326,7 @@ function showModal(options) {
modalConfig.value = {
title: options.title || '',
content: options.content || '',
extraContent: options.extraContent || '',
isHtml: options.isHtml || false,
showCancel: options.showCancel !== false,
showConfirm: options.showConfirm !== false,
......@@ -475,6 +477,66 @@ function switchStep(step) {
}
}
// 订单信息(用于待支付订单弹框)
const payForm = ref({})
// 获取最近认证记录,判断是否有未支付订单
function handelGetMyRecent() {
return new Promise(async (resolve, reject) => {
const res = await api.getMyRecent() ?? {}
payForm.value = res.data?.comOrder ?? {}
// payStatus: '0' 未支付, '1' 已支付, '2' 已取消
if (payForm.value.content) payForm.value.content = JSON.parse(payForm.value.content)
if (payForm.value.payStatus === '0') {
showModal({
title: '系统提示',
content: '您有一笔订单尚未支付,请及时支付或取消订单。',
cancelText: '取消订单',
confirmText: '去支付',
onConfirm: () => {
// 去支付,跳转到缴费页面
const assoName = assoFullName.value
uni.navigateTo({
url: `/myCenter/goPay?payName=${encodeURIComponent(payForm.value.orderName || form.value.name || '')}&assoName=${encodeURIComponent(assoName)}&orderId=${payForm.value.id}`
})
},
onCancel: () => {
handelCancelOrder()
}
})
return reject(res)
} else {
return resolve(true)
}
})
}
// 取消订单
async function handelCancelOrder() {
if (!payForm.value.id) return
const res = await new Promise((resolve) => {
showModal({
title: '确认取消',
content: '是否确认取消该订单?',
cancelText: '否',
confirmText: '是',
onConfirm: () => resolve(true),
onCancel: () => resolve(false)
})
})
if (!res) return
uni.showLoading({ title: '取消中...' })
try {
await api.cancelOrder(payForm.value.id)
uni.showToast({ title: '取消成功', icon: 'success' })
await init()
} catch (e) {
uni.showToast({ title: '取消失败', icon: 'none' })
} finally {
uni.hideLoading()
}
}
// 获取审核详情
function getMyCertStageFN() {
auditLoading.value = true
......@@ -533,9 +595,14 @@ function getImageUrl(url) {
function getBusinessLicenseUrl() {
if (!form.value.businessLicense) return ''
try {
const arr = JSON.parse(form.value.businessLicense)
if (Array.isArray(arr) && arr.length > 0) {
return arr[0].url || ''
const license = JSON.parse(form.value.businessLicense)
// 如果是数组,取第一个元素的url
if (Array.isArray(license) && license.length > 0) {
return license[0].url || ''
}
// 如果是对象,直接取url
if (typeof license === 'object' && license.url) {
return license.url
}
} catch (e) {
// 如果不是JSON格式,可能是直接返回的URL
......@@ -562,11 +629,11 @@ onLoad(option => {
function init() {
getDetail()
getRegionsList()
// getMyMemberCertUnitFeeApi()
canUseDiscountApi()
getZtxDiscountPolicyApi()
getMyStatusAPI()
handelGetMyRecent()
}
// 获取详情
......@@ -630,13 +697,19 @@ function getDetail() {
form.value.legalIdcPhoto2 = photos[1] || ''
}
// 处理营业执照
// 处理营业执照,保留原始数据格式
if (form.value.businessLicense) {
try {
const license = JSON.parse(form.value.businessLicense)
form.value.businessLicense = license.url || license
form.value.businessLicenseName = license.name
// 如果是数组,取第一个元素的名称
if (Array.isArray(license) && license.length > 0) {
form.value.businessLicenseName = license[0].name || ''
} else if (typeof license === 'object' && license.url) {
form.value.businessLicenseName = license.name || ''
}
// businessLicense 保持原始值,不做转换
} catch (e) {
// 已经是纯URL字符串,不做处理
}
}
......@@ -911,42 +984,55 @@ async function submitStep2() {
return
}
// 检查是否有未支付订单
try {
await handelGetMyRecent()
} catch (e) {
return
}
const creditCodePass = await onCreditCodeBlur(false)
if (!creditCodePass) {
uni.showToast({title: '社会信用代码已存在,请联系中跆协修改', icon: 'none', duration: 3000})
return
}
// 先校验企业信息
uni.showLoading({title: '验证中...'})
await api.checkBusinessLicense({
let checkRes
try {
checkRes = await api.checkBusinessLicense({
creditCode: form.value.creditCode,
companyName: form.value.companyName,
legalIdcCode: form.value.legalIdcCode,
legal: form.value.legal
}).then(checkRes => {
})
} catch (e) {
uni.hideLoading()
if (checkRes.code != 200 || !checkRes.data.passFlag) {
showModal({
title: '系统提示',
content: '企业信息异常请检查相关资料信息,确认无误后再次提交!',
content: '企业信息验证失败,请检查相关资料信息,确认无误后再次提交!',
cancelText: '返回修改',
confirmText: '确认无误',
onConfirm: () => submitCertification()
})
} else {
// 校验通过,提交认证(PC端逻辑)
submitCertification()
return
}
}).catch(() => {
uni.hideLoading()
if (checkRes.code != 200 || !checkRes.data?.passFlag) {
const errMsg = checkRes.data?.msg || ''
showModal({
title: '系统提示',
content: '企业信息异常请检查相关资料信息,确认无误后再次提交!',
content: errMsg,
extraContent: '企业信息异常请检查相关资料信息,确认无误后再次提交!',
cancelText: '返回修改',
confirmText: '确认无误',
onConfirm: () => submitCertification()
})
})
} else {
submitCertification()
}
}
// 提交认证信息(100%对齐PC端入参格式)
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!