271 行
6.3 KiB
Vue
271 行
6.3 KiB
Vue
<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">
|
||
{{ quotaText }}
|
||
</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 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 }"
|
||
@click="handleDial"
|
||
>
|
||
<image class="fc-icon fc-icon--sm" :src="iconUrl('phone')" mode="aspectFit" />
|
||
<text>{{ 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}` : '确认后直接拨打'
|
||
},
|
||
quotaText() {
|
||
if (this.unlimited || this.quotaTotal === 0) return '会员尊享 · 不限拨打次数'
|
||
const left = Math.max(0, Number(this.quotaLeft) || 0)
|
||
return `今日剩余 ${left} 次拨打机会`
|
||
},
|
||
},
|
||
methods: {
|
||
iconUrl,
|
||
/**
|
||
* 关闭弹窗
|
||
*/
|
||
handleClose() {
|
||
this.$emit('close')
|
||
},
|
||
/**
|
||
* 点击拨打:先校验免责声明勾选,再交由父级执行拨打接口
|
||
*/
|
||
handleDial() {
|
||
if (this.loading) return
|
||
if (!this.agree) {
|
||
uni.showToast({ title: '请先勾选同意平台免责声明', icon: 'none' })
|
||
return
|
||
}
|
||
this.$emit('confirm')
|
||
},
|
||
/**
|
||
* 查看平台免责声明详情
|
||
*/
|
||
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;
|
||
}
|
||
|
||
.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;
|
||
}
|
||
}
|
||
</style>
|