文件
fenleixinxi/uniapp/components/fc-call-modal/fc-call-modal.vue
MiAn f13fb6cdab feat: 完成二级分类真实实拍图替换与功能优化
本次提交内容包括:
1. 替换13个二级分类为真实商业实拍图,同步更新本地与线上数据库
2. 新增会员拨打额度耗尽引导开通会员功能
3. 优化发布页分类选择逻辑,增加会员权益展示
4. 修复分类名称显示问题,完善相关交互逻辑
5. 新增图片同步工具脚本,确保线上线下数据一致性
2026-10-28 14:13:32 +08:00

352 行
8.3 KiB
Vue

此文件含有模棱两可的 Unicode 字符

此文件含有可能会与其他字符混淆的 Unicode 字符。 如果您是想特意这样的,可以安全地忽略该警告。 使用 Escape 按钮显示他们。

<template>
<view v-if="show" class="call-modal__mask" @click="handleClose" @touchmove.stop.prevent>
<view class="call-modal" @click.stop>
<!-- 头部标题 -->
<view class="call-modal__header">
<text class="call-modal__title">温馨提示</text>
<text class="call-modal__close" @click="handleClose">✕</text>
</view>
<!-- 联系提示(不展示号码,确认后直接调起拨号) -->
<view class="call-modal__target">
<view class="call-modal__phone-row">
<image class="fc-icon fc-icon--md" :src="iconUrl('phone-orange')" mode="aspectFit" />
<text class="call-modal__phone">{{ contactLabel }}</text>
</view>
<text class="call-modal__quota" :class="{ 'call-modal__quota--warn': isQuotaEmpty }">
{{ quotaText }}
</text>
</view>
<!-- 额度耗尽引导开通会员 -->
<view v-if="isQuotaEmpty" class="call-modal__vip-box" @click="goMember">
<image class="fc-icon fc-icon--sm" :src="iconUrl('crown')" mode="aspectFit" />
<view class="call-modal__vip-info">
<text class="call-modal__vip-title">开通同城 VIP 会员</text>
<text class="call-modal__vip-desc">每日无限次拨打 · 免费浏览 · 极速发布</text>
</view>
<text class="call-modal__vip-arrow">去开通 ›</text>
</view>
<!-- 风险提示 -->
<view class="call-modal__warn">
<image class="fc-icon fc-icon--sm" :src="iconUrl('info')" mode="aspectFit" />
<text class="call-modal__warn-text">请自行鉴别农产品信息真伪,在未核实清楚前不要提前给对方转账,慎防诈骗!</text>
</view>
<!-- 免责声明勾选(额度耗尽无需勾选) -->
<view v-if="!isQuotaEmpty" class="call-modal__agree" @click="agree = !agree">
<view class="call-modal__checkbox" :class="{ 'call-modal__checkbox--on': agree }">
<text v-if="agree" class="call-modal__checkbox-tick">✓</text>
</view>
<text class="call-modal__agree-text">我已阅读并同意</text>
<text class="call-modal__agree-link" @click.stop="goDisclaimer">《平台免责声明》</text>
</view>
<!-- 主操作按钮:有额度显示立即拨打,耗尽显示开通会员 -->
<view
class="call-modal__btn"
:class="{
'call-modal__btn--disabled': loading && !isQuotaEmpty,
'call-modal__btn--vip': isQuotaEmpty
}"
@click="handleDial"
>
<image class="fc-icon fc-icon--sm" :src="iconUrl(isQuotaEmpty ? 'crown' : 'phone')" mode="aspectFit" />
<text>{{ isQuotaEmpty ? '开通会员立即拨打' : (loading ? '连接中…' : '立即拨打') }}</text>
</view>
</view>
</view>
</template>
<script>
/**
* 免责声明拨打确认弹窗(信息详情页 / 商家详情页通用)
* 流程:确认联系对象 → 勾选免责声明 → 确认后由父级调用
* POST /post/:id/dial 或 POST /merchant/:id/dial 扣减当日拨打额度并调起系统拨号
* 号码保护:弹窗不展示任何形式的手机号,确认后由系统拨号盘直接呼出
*/
import { iconUrl } from '@/common/store/ui.js'
export default {
name: 'FcCallModal',
props: {
/** 弹窗显隐 */
show: { type: Boolean, default: false },
/** 联系对象文案(联系人姓名,如:夏先生) */
contactName: { type: String, default: '' },
/** 今日拨打总额度(0 代表不限次数) */
quotaTotal: { type: Number, default: 0 },
/** 今日剩余额度 */
quotaLeft: { type: Number, default: 0 },
/** 是否不限次数 */
unlimited: { type: Boolean, default: false },
/** 请求中状态(防止重复提交) */
loading: { type: Boolean, default: false },
},
data() {
return {
agree: false,
}
},
watch: {
/** 每次打开弹窗重置勾选态,确保用户逐次确认免责声明 */
show(val) {
if (val) this.agree = false
},
},
computed: {
/**
* 联系对象名称脱敏或提示
*/
contactLabel() {
return this.contactName ? `联系 ${this.contactName}` : '确认后直接拨打'
},
/**
* 额度是否已用尽
*/
isQuotaEmpty() {
return !this.unlimited && Number(this.quotaTotal) > 0 && Number(this.quotaLeft) <= 0
},
/**
* 额度展示文案
*/
quotaText() {
if (this.unlimited || this.quotaTotal === 0) return '会员尊享 · 不限拨打次数'
const left = Math.max(0, Number(this.quotaLeft) || 0)
if (left <= 0) return '今日拨打额度已用完(0 次)'
return `今日剩余 ${left} 次拨打机会`
},
},
methods: {
iconUrl,
/**
* 关闭弹窗
*/
handleClose() {
this.$emit('close')
},
/**
* 点击拨打或引导开通会员
*/
handleDial() {
if (this.isQuotaEmpty) {
this.goMember()
return
}
if (this.loading) return
if (!this.agree) {
uni.showToast({ title: '请先勾选同意平台免责声明', icon: 'none' })
return
}
this.$emit('confirm')
},
/**
* 跳转会员中心开通特权
*/
goMember() {
this.handleClose()
uni.navigateTo({ url: '/pages/member/index' })
},
/**
* 查看平台免责声明详情
*/
goDisclaimer() {
uni.navigateTo({ url: '/pages/auth/agreement?type=disclaimer' })
},
},
}
</script>
<style lang="scss" scoped>
.call-modal__mask {
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
background: rgba(15, 23, 42, 0.55);
z-index: 999;
display: flex;
align-items: center;
justify-content: center;
padding: 60rpx;
}
.call-modal {
width: 100%;
max-width: 620rpx;
background: #ffffff;
border-radius: 28rpx;
padding: 36rpx 32rpx calc(32rpx);
box-shadow: 0 20rpx 60rpx rgba(4, 48, 30, 0.18);
}
.call-modal__header {
display: flex;
align-items: center;
justify-content: space-between;
}
.call-modal__title {
font-size: 34rpx;
font-weight: 700;
color: #1e293b;
}
.call-modal__close {
font-size: 30rpx;
color: #94a3b8;
padding: 6rpx 10rpx;
}
.call-modal__target {
margin-top: 28rpx;
background: linear-gradient(180deg, #d6f7e5, #f2fef7);
border-radius: 20rpx;
padding: 28rpx 24rpx;
display: flex;
flex-direction: column;
align-items: center;
}
.call-modal__phone-row {
display: flex;
align-items: center;
gap: 12rpx;
}
.call-modal__phone {
font-size: 42rpx;
font-weight: 800;
color: #00a854;
letter-spacing: 2rpx;
}
.call-modal__quota {
margin-top: 12rpx;
font-size: 22rpx;
color: #64748b;
&--warn {
color: #e65100;
font-weight: 700;
}
}
.call-modal__vip-box {
margin-top: 20rpx;
padding: 18rpx 20rpx;
border-radius: 18rpx;
background: linear-gradient(135deg, #f0fdf4, #fff8e8);
border: 1rpx solid #ffe3a6;
display: flex;
align-items: center;
gap: 16rpx;
}
.call-modal__vip-info {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
}
.call-modal__vip-title {
font-size: 26rpx;
font-weight: 700;
color: #8a5a00;
}
.call-modal__vip-desc {
margin-top: 4rpx;
font-size: 20rpx;
color: #b45309;
}
.call-modal__vip-arrow {
font-size: 24rpx;
font-weight: 700;
color: #f5a623;
flex-shrink: 0;
}
.call-modal__warn {
margin-top: 24rpx;
background: #fef7ec;
border: 1rpx solid #fde68a;
border-radius: 16rpx;
padding: 20rpx 22rpx;
display: flex;
align-items: flex-start;
gap: 10rpx;
}
.call-modal__warn-text {
flex: 1;
font-size: 24rpx;
line-height: 1.6;
color: #92400e;
font-weight: 500;
}
.call-modal__agree {
margin-top: 26rpx;
display: flex;
align-items: center;
gap: 10rpx;
}
.call-modal__checkbox {
width: 34rpx;
height: 34rpx;
border-radius: 10rpx;
border: 2rpx solid #cbd5e1;
background: #ffffff;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
transition: all 0.15s ease;
&--on {
background: #00d26a;
border-color: #00d26a;
}
}
.call-modal__checkbox-tick {
font-size: 22rpx;
color: #ffffff;
font-weight: 700;
line-height: 1;
}
.call-modal__agree-text {
font-size: 24rpx;
color: #334155;
}
.call-modal__agree-link {
font-size: 24rpx;
color: #00a854;
font-weight: 600;
}
.call-modal__btn {
margin-top: 30rpx;
height: 92rpx;
border-radius: 46rpx;
background: linear-gradient(135deg, #00d26a, #00e070);
color: #ffffff;
font-size: 30rpx;
font-weight: 700;
display: flex;
align-items: center;
justify-content: center;
gap: 10rpx;
box-shadow: 0 8rpx 24rpx rgba(0, 210, 106, 0.35);
&:active {
transform: scale(0.98);
opacity: 0.92;
}
&--disabled {
opacity: 0.6;
}
&--vip {
background: linear-gradient(135deg, #00e070, #00d26a 45%, #f5a623);
color: #04301e;
box-shadow: 0 8rpx 24rpx rgba(245, 166, 35, 0.35);
}
}
</style>