|
@@ -0,0 +1,369 @@
|
|
|
|
|
+<template>
|
|
|
|
|
+ <view class="recharge-wrapper">
|
|
|
|
|
+ <scroll-view class="recharge-scroll" scroll-y="true">
|
|
|
|
|
+ <view class="recharge-container">
|
|
|
|
|
+ <!-- 充值金额输入 -->
|
|
|
|
|
+ <view class="input-section">
|
|
|
|
|
+ <view class="input-label">充值金额</view>
|
|
|
|
|
+ <view class="input-wrapper">
|
|
|
|
|
+ <input
|
|
|
|
|
+ type="digit"
|
|
|
|
|
+ placeholder="请输入金额"
|
|
|
|
|
+ v-model="rForm.rechargeAmount"
|
|
|
|
|
+ :adjust-position="false"
|
|
|
|
|
+ class="amount-input"
|
|
|
|
|
+ :focus="rechargeInputFocus"
|
|
|
|
|
+ :cursor-spacing="20"
|
|
|
|
|
+ confirm-type="done"
|
|
|
|
|
+ confirm-hold="true"
|
|
|
|
|
+ @blur="onRechargeInputBlur"
|
|
|
|
|
+ />
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </view>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 付款方式 -->
|
|
|
|
|
+ <view class="input-section">
|
|
|
|
|
+ <view class="input-label">付款方式</view>
|
|
|
|
|
+ <view class="payment-buttons">
|
|
|
|
|
+ <button
|
|
|
|
|
+ class="admin-button-com middle"
|
|
|
|
|
+ :class="[rForm.rechargePayWay == 0 ? 'blue' : 'default']"
|
|
|
|
|
+ @click="rForm.rechargePayWay = 0"
|
|
|
|
|
+ >微信</button>
|
|
|
|
|
+ <button
|
|
|
|
|
+ class="admin-button-com middle"
|
|
|
|
|
+ :class="[rForm.rechargePayWay == 1 ? 'blue' : 'default']"
|
|
|
|
|
+ @click="rForm.rechargePayWay = 1"
|
|
|
|
|
+ >支付宝</button>
|
|
|
|
|
+ <button
|
|
|
|
|
+ class="admin-button-com middle"
|
|
|
|
|
+ :class="[rForm.rechargePayWay == 4 ? 'blue' : 'default']"
|
|
|
|
|
+ @click="rForm.rechargePayWay = 4"
|
|
|
|
|
+ >现金</button>
|
|
|
|
|
+ <button
|
|
|
|
|
+ class="admin-button-com middle"
|
|
|
|
|
+ :class="[rForm.rechargePayWay == 5 ? 'blue' : 'default']"
|
|
|
|
|
+ @click="rForm.rechargePayWay = 5"
|
|
|
|
|
+ >银行卡</button>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </view>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 备注输入 -->
|
|
|
|
|
+ <view class="input-section">
|
|
|
|
|
+ <view class="input-label">备注</view>
|
|
|
|
|
+ <view class="input-wrapper">
|
|
|
|
|
+ <input
|
|
|
|
|
+ type="text"
|
|
|
|
|
+ v-model="rForm.rechargeRemark"
|
|
|
|
|
+ class="remark-input"
|
|
|
|
|
+ placeholder="选填"
|
|
|
|
|
+ />
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </view>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 充值升级优惠 -->
|
|
|
|
|
+ <view v-if="rechargeWeal == 1" class="recharge-options">
|
|
|
|
|
+ <view class="options-title">充值活动:</view>
|
|
|
|
|
+ <view v-for="(item,index) in weal" :key="index" class="option-item">
|
|
|
|
|
+ <button
|
|
|
|
|
+ @click="getRecharge(item.recharge)"
|
|
|
|
|
+ class="recharge-option-btn"
|
|
|
|
|
+ :class="[rForm.rechargeAmount == item.recharge ? 'selected' : '']"
|
|
|
|
|
+ >
|
|
|
|
|
+ <view class="option-content">
|
|
|
|
|
+ <view class="option-left">
|
|
|
|
|
+ <text class="recharge-amount">充值{{ item.recharge }}元</text>
|
|
|
|
|
+ <text class="upgrade-info">升{{ item.name }}</text>
|
|
|
|
|
+ <text class="discount-info">({{item.discount*100}}折)</text>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <view class="option-right">
|
|
|
|
|
+ {{ rForm.rechargeAmount == item.recharge ? '✓' : '选择' }}
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </button>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </view>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 充值送金额 -->
|
|
|
|
|
+ <view v-if="rechargeWeal == 2" class="recharge-options">
|
|
|
|
|
+ <view class="options-title">充值优惠方案:</view>
|
|
|
|
|
+ <view v-for="(item,index) in weal" :key="index" class="option-item">
|
|
|
|
|
+ <button
|
|
|
|
|
+ @click="getRecharge(item.recharge)"
|
|
|
|
|
+ class="recharge-option-btn"
|
|
|
|
|
+ :class="[rForm.rechargeAmount == item.recharge ? 'selected' : '']"
|
|
|
|
|
+ >
|
|
|
|
|
+ <view class="option-content">
|
|
|
|
|
+ <view class="option-left">
|
|
|
|
|
+ <text class="recharge-amount">充值{{ item.recharge }}元</text>
|
|
|
|
|
+ <text class="give-info">送{{ item.give }}元</text>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <view class="option-right">
|
|
|
|
|
+ {{ rForm.rechargeAmount == item.recharge ? '✓' : '选择' }}
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </button>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </scroll-view>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 底部按钮 -->
|
|
|
|
|
+ <view class="footer-buttons">
|
|
|
|
|
+ <button class="admin-button-com middle" @click="cancelRecharge">取消</button>
|
|
|
|
|
+ <button class="admin-button-com middle blue" @click="confirmRecharge">充值</button>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </view>
|
|
|
|
|
+</template>
|
|
|
|
|
+
|
|
|
|
|
+<script>
|
|
|
|
|
+import { getWeal } from "@/api/member"
|
|
|
|
|
+import { toManRecharge } from "@/api/recharge"
|
|
|
|
|
+
|
|
|
|
|
+export default {
|
|
|
|
|
+ name: "recharge",
|
|
|
|
|
+ props: {
|
|
|
|
|
+ customId: {
|
|
|
|
|
+ type: Number,
|
|
|
|
|
+ default: 0
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ data() {
|
|
|
|
|
+ return {
|
|
|
|
|
+ rechargeInputFocus: false,
|
|
|
|
|
+ weal: [],
|
|
|
|
|
+ rechargeWeal: 0,
|
|
|
|
|
+ rForm: {
|
|
|
|
|
+ rechargeAmount: '',
|
|
|
|
|
+ rechargeRemark: '',
|
|
|
|
|
+ rechargePayWay: 0,
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+ },
|
|
|
|
|
+ created() {
|
|
|
|
|
+ this.getWealData()
|
|
|
|
|
+ },
|
|
|
|
|
+ methods: {
|
|
|
|
|
+ getWealData() {
|
|
|
|
|
+ getWeal().then(res => {
|
|
|
|
|
+ if (res.code == 1) {
|
|
|
|
|
+ this.weal = res.data.weal ? res.data.weal : []
|
|
|
|
|
+ this.rechargeWeal = res.data.rechargeWeal ? res.data.rechargeWeal : 0
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ getRecharge(amount) {
|
|
|
|
|
+ this.rForm.rechargeAmount = amount
|
|
|
|
|
+ },
|
|
|
|
|
+ onRechargeInputBlur() {
|
|
|
|
|
+ this.rechargeInputFocus = false
|
|
|
|
|
+ },
|
|
|
|
|
+ cancelRecharge() {
|
|
|
|
|
+ this.$emit('cancel')
|
|
|
|
|
+ },
|
|
|
|
|
+ confirmRecharge() {
|
|
|
|
|
+ if (this.$util.isEmpty(this.rForm.rechargeAmount)) {
|
|
|
|
|
+ this.$msg('请填写充值金额')
|
|
|
|
|
+ return false
|
|
|
|
|
+ }
|
|
|
|
|
+ if (Number(this.rForm.rechargeAmount) < 0) {
|
|
|
|
|
+ this.$msg('充值金额要大于0')
|
|
|
|
|
+ return false
|
|
|
|
|
+ }
|
|
|
|
|
+ this.$util.confirmModal({ content: '确认充值?' }, () => {
|
|
|
|
|
+ uni.showLoading({ mask: true })
|
|
|
|
|
+ toManRecharge({
|
|
|
|
|
+ amount: this.rForm.rechargeAmount,
|
|
|
|
|
+ remark: this.rForm.rechargeRemark,
|
|
|
|
|
+ payWay: this.rForm.rechargePayWay,
|
|
|
|
|
+ customId: this.customId
|
|
|
|
|
+ }).then(res => {
|
|
|
|
|
+ uni.hideLoading()
|
|
|
|
|
+ if (res.code == 1) {
|
|
|
|
|
+ this.$msg('充值成功')
|
|
|
|
|
+ this.$emit('success')
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+</script>
|
|
|
|
|
+
|
|
|
|
|
+<style lang="scss" scoped>
|
|
|
|
|
+.recharge-wrapper {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ flex-direction: column;
|
|
|
|
|
+ height: 100%;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.recharge-scroll {
|
|
|
|
|
+ flex: 1;
|
|
|
|
|
+ height: calc(100% - 56px);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.recharge-container {
|
|
|
|
|
+ padding: 15px;
|
|
|
|
|
+ background: #fff;
|
|
|
|
|
+ border-radius: 8px;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.input-section {
|
|
|
|
|
+ margin-bottom: 15px;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.input-label {
|
|
|
|
|
+ font-size: 14px;
|
|
|
|
|
+ color: #333;
|
|
|
|
|
+ margin-bottom: 6px;
|
|
|
|
|
+ font-weight: 500;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.input-wrapper {
|
|
|
|
|
+ position: relative;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.amount-input, .remark-input {
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ height: 36px;
|
|
|
|
|
+ padding: 0 10px;
|
|
|
|
|
+ border: 1px solid #e9ecef;
|
|
|
|
|
+ border-radius: 4px;
|
|
|
|
|
+ font-size: 14px;
|
|
|
|
|
+ text-align: center;
|
|
|
|
|
+ background: #fff;
|
|
|
|
|
+ box-sizing: border-box;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.amount-input:focus, .remark-input:focus {
|
|
|
|
|
+ border-color: #3385FF;
|
|
|
|
|
+ background: #f8f9fa;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.payment-buttons {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ flex-wrap: wrap;
|
|
|
|
|
+ gap: 6px;
|
|
|
|
|
+
|
|
|
|
|
+ button {
|
|
|
|
|
+ flex: 1;
|
|
|
|
|
+ min-width: 60px;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.recharge-options {
|
|
|
|
|
+ margin-top: 10px;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.options-title {
|
|
|
|
|
+ font-size: 13px;
|
|
|
|
|
+ color: #666;
|
|
|
|
|
+ margin-bottom: 8px;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.option-item {
|
|
|
|
|
+ margin-bottom: 8px;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.recharge-option-btn {
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ padding: 8px 10px;
|
|
|
|
|
+ background: #f8f9fa;
|
|
|
|
|
+ border: 1px solid #e9ecef;
|
|
|
|
|
+ border-radius: 4px;
|
|
|
|
|
+ text-align: left;
|
|
|
|
|
+ transition: all 0.3s;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.recharge-option-btn.selected {
|
|
|
|
|
+ border-color: #3385FF;
|
|
|
|
|
+ background: #f0f7ff;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.option-content {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ justify-content: space-between;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.option-left {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ flex-wrap: wrap;
|
|
|
|
|
+ gap: 5px;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.recharge-amount {
|
|
|
|
|
+ font-weight: 500;
|
|
|
|
|
+ font-size: 13px;
|
|
|
|
|
+ color: #333;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.upgrade-info {
|
|
|
|
|
+ font-size: 12px;
|
|
|
|
|
+ color: #666;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.discount-info, .give-info {
|
|
|
|
|
+ font-size: 12px;
|
|
|
|
|
+ color: #ff6b35;
|
|
|
|
|
+ font-weight: bold;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.option-right {
|
|
|
|
|
+ color: #3385FF;
|
|
|
|
|
+ font-size: 12px;
|
|
|
|
|
+ font-weight: bold;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.footer-buttons {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ gap: 8px;
|
|
|
|
|
+ padding: 10px 8px;
|
|
|
|
|
+ background: #fff;
|
|
|
|
|
+ border-top: 1px solid #eee;
|
|
|
|
|
+
|
|
|
|
|
+ button {
|
|
|
|
|
+ flex: 1;
|
|
|
|
|
+ min-width: 0;
|
|
|
|
|
+ height: 36px;
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ justify-content: center;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/* 按钮样式 */
|
|
|
|
|
+.admin-button-com {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ justify-content: center;
|
|
|
|
|
+ border-radius: 4px;
|
|
|
|
|
+ font-size: 13px;
|
|
|
|
|
+ border: none;
|
|
|
|
|
+ padding: 0 12px;
|
|
|
|
|
+
|
|
|
|
|
+ &.middle {
|
|
|
|
|
+ height: 32px;
|
|
|
|
|
+ font-size: 13px;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ &.blue {
|
|
|
|
|
+ background-color: #3385FF;
|
|
|
|
|
+ color: #fff;
|
|
|
|
|
+
|
|
|
|
|
+ &:active {
|
|
|
|
|
+ background-color: #2970d6;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ &.default {
|
|
|
|
|
+ background-color: #f0f0f0;
|
|
|
|
|
+ color: #333;
|
|
|
|
|
+
|
|
|
|
|
+ &:active {
|
|
|
|
|
+ background-color: #e0e0e0;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+</style>
|