Files
medical-mall/pages/mall/admin/setting/interface/payment.uvue
2026-02-24 10:35:34 +08:00

149 lines
7.3 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view class="admin-page-container">
<view class="page-header">
<view class="breadcrumb">
<text class="bc-item">设置</text>
<text class="bc-sep">/</text>
<text class="bc-item">接口配置</text>
<text class="bc-sep">/</text>
<text class="bc-item active">商城支付配置</text>
</view>
</view>
<view class="content-card">
<view class="tabs-header">
<view :class="['tab-item', activeTab == 0 ? 'active' : '']" @click="activeTab = 0">
<text class="tab-text">基础配置</text>
</view>
<view :class="['tab-item', activeTab == 1 ? 'active' : '']" @click="activeTab = 1">
<text class="tab-text">微信支付配置</text>
</view>
</view>
<!-- 基础配置内容 -->
<view class="form-section" v-if="activeTab == 0">
<view class="form-content">
<view class="form-row">
<view class="form-label">余额支付:</view>
<view class="form-input-box">
<radio-group class="form-radio-group" @change="onBaseChange('balancePay', $event)">
<label class="radio-label"><radio value="1" :checked="form.base.balancePay == '1'" color="#2d8cf0" /><text class="radio-text">开启</text></label>
<label class="radio-label"><radio value="0" :checked="form.base.balancePay == '0'" color="#2d8cf0" /><text class="radio-text">关闭</text></label>
</radio-group>
<text class="form-tips">余额支付请选择开启或关闭</text>
</view>
</view>
<view class="form-row">
<view class="form-label">好友代付:</view>
<view class="form-input-box">
<radio-group class="form-radio-group" @change="onBaseChange('friendPay', $event)">
<label class="radio-label"><radio value="1" :checked="form.base.friendPay == '1'" color="#2d8cf0" /><text class="radio-text">开启</text></label>
<label class="radio-label"><radio value="0" :checked="form.base.friendPay == '0'" color="#2d8cf0" /><text class="radio-text">关闭</text></label>
</radio-group>
<text class="form-tips">好友代付开关,关闭后付款类型不显示好友代付</text>
</view>
</view>
<view class="form-actions" style="margin-top: 20px;">
<button class="submit-btn" type="primary" @click="handleSave">提交</button>
</view>
</view>
</view>
<!-- 微信支付配置内容 (保持之前版本) -->
<view class="form-section" v-if="activeTab == 1">
<view class="form-content extra-wide">
<view class="form-row">
<view class="form-label">支付接口类型:</view>
<view class="form-input-box">
<radio-group class="form-radio-group" @change="onWxRadioChange('vVersion', $event)">
<label class="radio-label"><radio value="v2" :checked="form.wx.vVersion == 'v2'" color="#2d8cf0" /><text class="radio-text">v2 (支持企业付款到零钱)</text></label>
<label class="radio-label"><radio value="v3" :checked="form.wx.vVersion == 'v3'" color="#2d8cf0" /><text class="radio-text">v3 (支持商户转账到零钱)</text></label>
</radio-group>
<text class="form-tips highlight">支付接口类型v2对应微信支付旧版v2支付。v3对应微信支付v3支付接口。支付证书可以通用一个支付秘钥和v2旧版支付有区别</text>
</view>
</view>
<view class="form-row">
<view class="form-label">证书序列号:</view>
<view class="form-input-box">
<input class="form-input max-width-input" v-model="form.wx.serialNo" placeholder="请输入证书序列号" />
<text class="form-tips">「商户API证书」的「证书序列号」可以在证书管理里面查看</text>
</view>
</view>
<view class="form-row">
<view class="form-label">微信自动提现场景值:</view>
<view class="form-input-box">
<input class="form-input max-width-input" v-model="form.wx.sceneValue" placeholder="1000" />
</view>
</view>
<view class="form-row">
<view class="form-label">v3支付Key:</view>
<view class="form-input-box">
<input class="form-input max-width-input" v-model="form.wx.v3Key" placeholder="V3支付秘钥" />
</view>
</view>
<view class="form-row">
<view class="form-label">Mchid:</view>
<view class="form-input-box">
<input class="form-input max-width-input" v-model="form.wx.mchid" placeholder="微信商户号" />
</view>
</view>
<view class="form-actions" style="margin-top: 20px;">
<button class="submit-btn" type="primary" @click="handleSave">提交</button>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup lang="uts">
import { ref, reactive } from 'vue'
const activeTab = ref(0)
const form = reactive({
base: {
balancePay: '1',
friendPay: '1'
},
wx: {
vVersion: 'v3',
serialNo: '2C79D0EF62EC9229C93D1017222EF7ED6CB4B88A',
sceneValue: '1000',
v3Key: 'wXID8YARmzbF126iBkpdCyLVz0o3GH95',
mchid: '1481090182'
}
})
const onBaseChange = (key : string, e : any) => { form.base[key] = e.detail.value }
const onWxRadioChange = (key : string, e : any) => { form.wx[key] = e.detail.value }
const handleSave = () => { uni.showToast({ title: '提交成功' }) }
</script>
<style scoped>
.admin-page-container {
/* 使用 Layout 的背景和内边距 */
min-height: 100vh;
}
.breadcrumb { display: flex; flex-direction: row; margin-bottom: 20px; }
.bc-item { font-size: 14px; color: #999; }
.bc-item.active { color: #333; }
.bc-sep { margin: 0 8px; color: #ccc; }
.content-card { background-color: #fff; border-radius: 4px; }
.tabs-header { display: flex; flex-direction: row; border-bottom: 1px solid #f0f0f0; padding: 0 30px; }
.tab-item { padding: 16px 20px; margin-right: 32px; border-bottom: 2px solid transparent; }
.tab-text { font-size: 14px; color: #666; }
.tab-item.active { border-bottom-color: #2d8cf0; }
.tab-item.active .tab-text { color: #2d8cf0; font-weight: bold; }
.form-section { padding: 30px; }
.form-content { max-width: 900px; }
.form-row { display: flex; flex-direction: row; margin-bottom: 24px; }
.form-label { width: 160px; font-size: 14px; color: #333; text-align: right; margin-right: 24px; padding-top: 8px; }
.form-input-box { flex: 1; }
.form-input { width: 100%; border: 1px solid #dcdfe6; border-radius: 4px; height: 34px; padding: 0 12px; font-size: 14px; }
.max-width-input { max-width: 450px; }
.form-tips { display: block; font-size: 12px; color: #999; margin-top: 10px; }
.highlight { color: #c0c4cc; }
.form-radio-group { display: flex; flex-direction: row; align-items: center; height: 34px; }
.radio-label { display: flex; flex-direction: row; align-items: center; margin-right: 24px; }
.radio-text { font-size: 14px; margin-left: 6px; }
.form-actions { padding-left: 184px; }
.submit-btn { width: 65px; height: 32px; background-color: #2d8cf0; color: #fff; border-radius: 4px; font-size: 14px; line-height: 32px; text-align: center; border: none; }
</style>