<?php /** @var array $v */ /** @var string $seg */ ?>
<div class="page-head"><div><h1>支付设置</h1><div class="desc">配置支付宝 / 微信支付通道；未配置商户号时默认「演示模式」，整条支付链路可正常走通。</div></div></div>
<div class="admin-card">
 <form method="post" action="<?php echo site_url('admin/payments'); ?>">
   <?php echo csrf_field(); ?>
   <div class="form-grid">
     <div class="field"><label>支付开关</label>
       <select name="pay_enabled">
         <option value="1" <?php echo $v['pay_enabled'] === '1' ? 'selected' : ''; ?>>开启</option>
         <option value="0" <?php echo $v['pay_enabled'] === '0' ? 'selected' : ''; ?>>关闭</option>
       </select>
     </div>
     <div class="field"><label>运行模式</label>
       <select name="pay_mode">
         <option value="demo" <?php echo $v['pay_mode'] === 'demo' ? 'selected' : ''; ?>>演示模式（模拟支付）</option>
         <option value="live" <?php echo $v['pay_mode'] === 'live' ? 'selected' : ''; ?>>真实收款（需填下方商户号）</option>
       </select>
     </div>
   </div>

   <h3 style="margin:18px 0 8px">支付宝（电脑网站支付）</h3>
   <div class="field"><label>AppID</label><input name="pay_alipay_appid" value="<?php echo e($v['pay_alipay_appid']); ?>"></div>
   <div class="field"><label>应用私钥 private_key</label><textarea name="pay_alipay_private_key"><?php echo e($v['pay_alipay_private_key']); ?></textarea></div>
   <div class="field"><label>支付宝公钥 public_key</label><textarea name="pay_alipay_public_key"><?php echo e($v['pay_alipay_public_key']); ?></textarea></div>
   <div class="field"><label>网关地址</label><input name="pay_alipay_gateway" value="<?php echo e($v['pay_alipay_gateway']); ?>"></div>

   <h3 style="margin:18px 0 8px">微信支付（NATIVE 扫码）</h3>
   <div class="field"><label>商户号 mch_id</label><input name="pay_wechat_mchid" value="<?php echo e($v['pay_wechat_mchid']); ?>"></div>
   <div class="field"><label>AppID</label><input name="pay_wechat_appid" value="<?php echo e($v['pay_wechat_appid']); ?>"></div>
   <div class="field"><label>API 密钥 key</label><input name="pay_wechat_key" value="<?php echo e($v['pay_wechat_key']); ?>"></div>

   <div style="margin-top:8px"><button class="btn-primary" type="submit">保存支付设置</button></div>
 </form>
</div>
