<template>
  <view class="marketing-recharge-config">
    <view class="config-card border-shadow">
      <view class="config-header">
        <text class="config-title">用户充值配置</text>
      </view>
      
      <view class="config-body">
        <view class="config-item">
          <view class="item-label">
            <text class="label-txt">余额功能启用：</text>
            <text class="label-desc">商城余额功能启用或者关闭</text>
          </view>
          <view class="item-content">
            <view class="radio-group">
              <view class="radio-item" @click="config.balance_enabled = true">
                <view class="radio-circle" :class="{ checked: config.balance_enabled }"></view>
                <text class="radio-txt">开启</text>
              </view>
              <view class="radio-item ml-20" @click="config.balance_enabled = false">
                <view class="radio-circle" :class="{ checked: !config.balance_enabled }"></view>
                <text class="radio-txt">关闭</text>
              </view>
            </view>
          </view>
        </view>

        <view class="config-item">
          <view class="item-label">
            <text class="label-txt">充值注意事项：</text>
            <text class="label-desc">充值注意事项</text>
          </view>
          <view class="item-content">
            <textarea class="config-textarea" v-model="config.notice" placeholder="请输入充值注意事项"></textarea>
          </view>
        </view>

        <view class="config-item">
          <view class="item-label">
            <text class="label-txt">小程序充值开关：</text>
            <text class="label-desc">仅小程序端的充值开关，小程序提交审核前，需要关闭此功能</text>
          </view>
          <view class="item-content">
            <view class="radio-group">
              <view class="radio-item" @click="config.mp_recharge = true">
                <view class="radio-circle" :class="{ checked: config.mp_recharge }"></view>
                <text class="radio-txt">开启</text>
              </view>
              <view class="radio-item ml-20" @click="config.mp_recharge = false">
                <view class="radio-circle" :class="{ checked: !config.mp_recharge }"></view>
                <text class="radio-txt">关闭</text>
              </view>
            </view>
          </view>
        </view>

        <view class="config-item">
          <view class="item-label">
            <text class="label-txt">最低充值金额：</text>
            <text class="label-desc">用户单次最低充值金额</text>
          </view>
          <view class="item-content">
            <input class="config-input" type="number" v-model="config.min_amount" />
          </view>
        </view>

        <view class="config-footer">
          <button class="btn-submit" @click="handleSave">提交</button>
        </view>
      </view>
    </view>
  </view>
</template>

<script setup lang="uts">
import { reactive } from 'vue'

const config = reactive({
  balance_enabled: true,
  notice: '充值后账户的金额不能提现，可用于商城消费使用\n佣金导入账户之后不能再次导出、不可提现\n账户充值出现问题可联系商城客服',
  mp_recharge: false,
  min_amount: 0.01
})

const handleSave = () => {
  uni.showToast({ title: '保存成功', icon: 'success' })
}
</script>

<style scoped lang="scss">
.marketing-recharge-config {
  padding: 16px;
  background: #f0f2f5;
  min-height: 100vh;
}

.border-shadow {
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);
}

.config-card { padding: 24px; }

.config-header {
  border-bottom: 1px solid #e8eaec;
  padding-bottom: 16px;
  margin-bottom: 24px;
}

.config-title {
  font-size: 16px;
  font-weight: bold;
  color: #17233d;
  position: relative;
  padding-left: 12px;
}
.config-title::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  background: #1890ff;
}

.config-item {
  display: flex;
  flex-direction: row;
  margin-bottom: 30px;
  align-items: flex-start;
}

.item-label { width: 220px; display: flex; flex-direction: column; }
.label-txt { font-size: 14px; color: #333; margin-bottom: 4px; }
.label-desc { font-size: 12px; color: #999; }

.item-content { flex: 1; }

.radio-group { display: flex; flex-direction: row; padding-top: 4px; }
.radio-item { display: flex; flex-direction: row; align-items: center; cursor: pointer; }
.radio-circle { width: 14px; height: 14px; border: 1px solid #dcdfe6; border-radius: 50%; margin-right: 6px; position: relative; }
.radio-circle.checked { border-color: #1890ff; }
.radio-circle.checked::after { content: ''; position: absolute; width: 8px; height: 8px; background: #1890ff; border-radius: 50%; top: 2px; left: 2px; }
.radio-txt { font-size: 14px; color: #606266; }
.ml-20 { margin-left: 20px; }

.config-textarea {
  width: 100%;
  max-width: 600px;
  height: 120px;
  border: 1px solid #dcdfe6;
  border-radius: 4px;
  padding: 12px;
  font-size: 14px;
}

.config-input {
  width: 300px;
  height: 32px;
  border: 1px solid #dcdfe6;
  border-radius: 4px;
  padding: 0 12px;
  font-size: 14px;
}

.config-footer {
  margin-top: 40px;
  padding-left: 220px;
}

.btn-submit {
  width: 80px;
  height: 32px;
  line-height: 32px;
  background: #1890ff;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
}
</style>



