20260929
This commit is contained in:
@@ -0,0 +1,328 @@
|
||||
<template>
|
||||
<view class="bonus-page">
|
||||
<view class="page-hero">
|
||||
<AppNavbar title="记录" show-back/>
|
||||
<view class="intro-card">
|
||||
<view class="card-title">
|
||||
<view class="title-bar"></view>
|
||||
<text>记录</text>
|
||||
</view>
|
||||
<!-- <text class="intro-text">展示历史订单记录,按来源拆分提成(药动销、跑店/巡店、药分享、自主填报),保持蓝色系设计。</text>-->
|
||||
<!-- <view class="hero-tags">-->
|
||||
<!-- <view :class="['chip', { 'chip--active': activeFilter === 0 }]" @tap="toggleFilter(0)">药动销</view>-->
|
||||
<!-- <view :class="['chip', { 'chip--active': activeFilter === 4 }]" @tap="toggleFilter(4)">跑店/巡店</view>-->
|
||||
<!-- <view :class="['chip', { 'chip--active': activeFilter === 1 }]" @tap="toggleFilter(1)">药分享</view>-->
|
||||
<!-- <view :class="['chip', { 'chip--active': activeFilter === 6 }]" @tap="toggleFilter(6)">自主填报</view>-->
|
||||
<!-- </view>-->
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- <view class="card summary">-->
|
||||
<!-- <view class="sum-item">-->
|
||||
<!-- <view class="sum-value">¥ {{ summary.movement }}</view>-->
|
||||
<!-- <view class="sum-label">药动销提成</view>-->
|
||||
<!-- </view>-->
|
||||
<!-- <view class="sum-item">-->
|
||||
<!-- <view class="sum-value">¥ {{ summary.storeVisit }}</view>-->
|
||||
<!-- <view class="sum-label">跑店/巡店提成</view>-->
|
||||
<!-- </view>-->
|
||||
<!-- <view class="sum-item">-->
|
||||
<!-- <view class="sum-value">¥ {{ summary.share }}</view>-->
|
||||
<!-- <view class="sum-label">药分享提成</view>-->
|
||||
<!-- </view>-->
|
||||
<!-- <view class="sum-item">-->
|
||||
<!-- <view class="sum-value">¥ {{ summary.selfReport }}</view>-->
|
||||
<!-- <view class="sum-label">自主填报提成</view>-->
|
||||
<!-- </view>-->
|
||||
<!-- </view>-->
|
||||
|
||||
<!-- <view class="card withdraw-entry">-->
|
||||
<!-- <view>-->
|
||||
<!-- <view class="withdraw-title">可提现奖金</view>-->
|
||||
<!-- <view class="withdraw-amount">¥ {{ user.balance }}</view>-->
|
||||
<!-- </view>-->
|
||||
<!-- <view class="primary-btn withdraw-btn" @tap="goWithdraw">奖金提现</view>-->
|
||||
<!-- </view>-->
|
||||
|
||||
<view class="card block">
|
||||
<view class="section-title">历史收入记录</view>
|
||||
<view v-if="loading" class="empty">加载中...</view>
|
||||
<view v-else-if="filteredRecords.length === 0" class="empty">暂无记录</view>
|
||||
<view v-else class="record" v-for="(item, idx) in filteredRecords" :key="idx">
|
||||
<view>
|
||||
<view class="record-name">{{ item.title }}</view>
|
||||
<!-- <view class="record-meta">{{ item.source }} · 订单号:{{ item.orderNo }}</view>-->
|
||||
<view class="record-meta">日期:{{ item.date }}</view>
|
||||
</view>
|
||||
<!-- <view class="record-amount">+¥{{ item.amount }}</view>-->
|
||||
</view>
|
||||
</view>
|
||||
<Login ref="Login" @done="getUserData"/>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {userBalanceLogListReq} from "@/api/bonus";
|
||||
import {getUserInfo} from "@/util/user";
|
||||
import {userInfoReq} from "@/api/user";
|
||||
import Login from "@/components/Login.vue";
|
||||
import AppNavbar from "@/components/AppNavbar.vue";
|
||||
|
||||
export default {
|
||||
components: {Login, AppNavbar},
|
||||
data() {
|
||||
return {
|
||||
summary: {
|
||||
movement: '0.00',
|
||||
storeVisit: '0.00',
|
||||
share: '0.00',
|
||||
selfReport: '0.00',
|
||||
withdrawable: '0.00'
|
||||
},
|
||||
records: [],
|
||||
loading: false,
|
||||
activeFilter: null,
|
||||
user: {
|
||||
balance: 0
|
||||
},
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
filteredRecords() {
|
||||
if (this.activeFilter === null || this.activeFilter === undefined) return this.records
|
||||
return this.records.filter(item => Number(item.scene) === Number(this.activeFilter))
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
if (getUserInfo().token) {
|
||||
this.isLoggedIn = true
|
||||
this.getUserData()
|
||||
this.fetchBalanceLogs()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async getUserData(){
|
||||
const {data} = await userInfoReq()
|
||||
this.isLoggedIn = true
|
||||
this.user = data
|
||||
},
|
||||
async fetchBalanceLogs() {
|
||||
this.loading = true
|
||||
try {
|
||||
const {data} = await userBalanceLogListReq({})
|
||||
const list = Array.isArray(data) ? data : (data && data.list ? data.list : [])
|
||||
this.records = list.map(this.normalizeRecord)
|
||||
const movementTotal = this.records
|
||||
.filter(item => item.scene === 0)
|
||||
.reduce((sum, item) => sum + Number(item.amount || 0), 0)
|
||||
const storeVisitTotal = this.records
|
||||
.filter(item => item.scene === 4)
|
||||
.reduce((sum, item) => sum + Number(item.amount || 0), 0)
|
||||
const shareTotal = this.records
|
||||
.filter(item => item.scene === 1)
|
||||
.reduce((sum, item) => sum + Number(item.amount || 0), 0)
|
||||
const selfReportTotal = this.records
|
||||
.filter(item => item.scene === 6)
|
||||
.reduce((sum, item) => sum + Number(item.amount || 0), 0)
|
||||
const withdrawable = movementTotal + storeVisitTotal + shareTotal + selfReportTotal
|
||||
this.summary = {
|
||||
movement: movementTotal.toFixed(2),
|
||||
storeVisit: storeVisitTotal.toFixed(2),
|
||||
share: shareTotal.toFixed(2),
|
||||
selfReport: selfReportTotal.toFixed(2),
|
||||
withdrawable: withdrawable.toFixed(2)
|
||||
}
|
||||
} catch (err) {
|
||||
uni.showToast({
|
||||
title: '加载失败',
|
||||
icon: 'none'
|
||||
})
|
||||
} finally {
|
||||
this.loading = false
|
||||
}
|
||||
},
|
||||
normalizeRecord(item) {
|
||||
const sceneValue = Number(item.scene)
|
||||
const source = sceneValue === 0
|
||||
? '药动销'
|
||||
: (sceneValue === 4 ? '跑店/巡店' : (sceneValue === 1 ? '药分享' : (sceneValue === 6 ? '自主填报' : '其他')))
|
||||
const amount = Number(item.amount || item.money || item.changeAmount || 0)
|
||||
return {
|
||||
scene: sceneValue,
|
||||
title: item.title || item.remark || `${source}记录`,
|
||||
source,
|
||||
orderNo: item.orderNo || item.order_no || item.bizNo || '-',
|
||||
date: item.createTime || item.createdAt || item.date || '-',
|
||||
amount: amount.toFixed(2)
|
||||
}
|
||||
},
|
||||
toggleFilter(scene) {
|
||||
this.activeFilter = this.activeFilter === scene ? null : scene
|
||||
},
|
||||
goWithdraw() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/bonus/withdraw'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.bonus-page {
|
||||
min-height: 100vh;
|
||||
//padding: 0 20rpx 40rpx;
|
||||
background: #f5f5f5;
|
||||
}
|
||||
|
||||
.page-hero {
|
||||
//padding: 30rpx 6rpx 18rpx;
|
||||
background: url('https://yaodongxiao.oss-cn-guangzhou.aliyuncs.com/20260126/462bfa04cf0eff8698884c38b9d17519.png') no-repeat
|
||||
top center / 100% auto;
|
||||
}
|
||||
|
||||
.page-navbar {
|
||||
padding: 0 6rpx;
|
||||
}
|
||||
|
||||
.intro-card {
|
||||
margin: 18rpx 20rpx 0;
|
||||
padding: 20rpx 18rpx;
|
||||
border-radius: 20rpx;
|
||||
background: rgba(255, 255, 255, 0.9);
|
||||
box-shadow: 0 10rpx 20rpx rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
|
||||
.card-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12rpx;
|
||||
font-size: 28rpx;
|
||||
font-weight: 700;
|
||||
color: #1f2937;
|
||||
}
|
||||
|
||||
.title-bar {
|
||||
width: 6rpx;
|
||||
height: 30rpx;
|
||||
border-radius: 999rpx;
|
||||
background: #2fc6a7;
|
||||
}
|
||||
|
||||
.intro-text {
|
||||
margin-top: 12rpx;
|
||||
font-size: 26rpx;
|
||||
color: #6b7280;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.hero-tags {
|
||||
display: flex;
|
||||
gap: 12rpx;
|
||||
margin-top: 12rpx;
|
||||
}
|
||||
|
||||
.chip {
|
||||
padding: 6rpx 16rpx;
|
||||
border-radius: 999rpx;
|
||||
border: 1rpx solid #c7d2fe;
|
||||
color: #4f46e5;
|
||||
font-size: 22rpx;
|
||||
font-weight: 700;
|
||||
background: #eef2ff;
|
||||
}
|
||||
|
||||
.chip--active {
|
||||
border-color: #2fc6a7;
|
||||
color: #2fc6a7;
|
||||
background: #e6fffa;
|
||||
}
|
||||
|
||||
.summary {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: 12rpx;
|
||||
margin: 18rpx 20rpx 0;
|
||||
}
|
||||
|
||||
.withdraw-entry {
|
||||
margin: 18rpx 20rpx 0;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.withdraw-title {
|
||||
color: var(--text-sub);
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.withdraw-amount {
|
||||
color: var(--brand-primary);
|
||||
font-size: 32rpx;
|
||||
font-weight: 800;
|
||||
margin-top: 4rpx;
|
||||
}
|
||||
|
||||
.withdraw-btn {
|
||||
padding: 10rpx 18rpx;
|
||||
height: 56rpx;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.sum-item {
|
||||
background: linear-gradient(135deg, #f0f5ff, #ffffff);
|
||||
border-radius: 14rpx;
|
||||
padding: 16rpx;
|
||||
border: 1rpx solid #e7eef8;
|
||||
}
|
||||
|
||||
.sum-value {
|
||||
font-size: 32rpx;
|
||||
font-weight: 800;
|
||||
color: var(--brand-primary);
|
||||
}
|
||||
|
||||
.sum-label {
|
||||
color: var(--text-sub);
|
||||
font-size: 24rpx;
|
||||
margin-top: 4rpx;
|
||||
}
|
||||
|
||||
.block {
|
||||
margin: 18rpx 20rpx 0;
|
||||
}
|
||||
|
||||
.record {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 12rpx 0;
|
||||
border-bottom: 1rpx solid #edf1f7;
|
||||
}
|
||||
|
||||
.record:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.record-name {
|
||||
font-size: 26rpx;
|
||||
color: var(--text-main);
|
||||
}
|
||||
|
||||
.record-meta {
|
||||
color: var(--text-sub);
|
||||
font-size: 24rpx;
|
||||
margin-top: 2rpx;
|
||||
}
|
||||
|
||||
.record-amount {
|
||||
color: #ff3b30;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.empty {
|
||||
color: var(--text-sub);
|
||||
text-align: center;
|
||||
padding: 16rpx 0;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,254 @@
|
||||
<template>
|
||||
<view class="withdraw-record-page">
|
||||
<view class="page-hero">
|
||||
<AppNavbar title="提现记录" show-back/>
|
||||
<view class="intro-card">
|
||||
<view class="card-title">
|
||||
<view class="title-bar"></view>
|
||||
<text>提现记录</text>
|
||||
</view>
|
||||
<text class="intro-text">查看历史提现申请与审核状态</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="card block">
|
||||
<view class="section-title">历史提现</view>
|
||||
<view v-if="loading" class="empty">加载中...</view>
|
||||
<view v-else-if="records.length === 0" class="empty">暂无记录</view>
|
||||
<view v-else class="record" v-for="(item, idx) in records" :key="idx">
|
||||
<view class="record-left">
|
||||
<view class="record-amount">¥ {{ item.money }}</view>
|
||||
<view class="record-meta">申请时间:{{ item.date }}</view>
|
||||
<view class="record-tags">
|
||||
<view :class="['record-tag', payTypeClass(item.payType)]">{{ payTypeLabel(item.payType) }}</view>
|
||||
</view>
|
||||
<view v-if="item.applyStatus === 2 && item.rejectReason" class="record-reject">
|
||||
拒绝原因:{{ item.rejectReason }}
|
||||
</view>
|
||||
</view>
|
||||
<view :class="['record-status', statusClass(item.applyStatus)]">{{ statusLabel(item.applyStatus) }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AppNavbar from "@/components/AppNavbar.vue";
|
||||
import {dealerWithdrawListReq} from "@/api/user";
|
||||
import dayjs from 'dayjs'
|
||||
|
||||
export default {
|
||||
components: {AppNavbar},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
records: []
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.fetchRecords()
|
||||
},
|
||||
methods: {
|
||||
statusLabel(status) {
|
||||
if (status === 0) return '待审核'
|
||||
if (status === 1) return '审核通过'
|
||||
if (status === 2) return '已驳回'
|
||||
if (status === 3) return '已打款'
|
||||
return '未知状态'
|
||||
},
|
||||
statusClass(status) {
|
||||
if (status === 1) return 'success'
|
||||
if (status === 2) return 'danger'
|
||||
if (status === 3) return 'info'
|
||||
return 'pending'
|
||||
},
|
||||
payTypeLabel(payType) {
|
||||
if (payType === 10) return '微信'
|
||||
if (payType === 20) return '支付宝'
|
||||
if (payType === 30) return '银行卡'
|
||||
return '未知方式'
|
||||
},
|
||||
payTypeClass(payType) {
|
||||
if (payType === 10) return 'wechat'
|
||||
if (payType === 20) return 'alipay'
|
||||
if (payType === 30) return 'bank'
|
||||
return 'unknown'
|
||||
},
|
||||
normalizeRecord(item) {
|
||||
const money = Number(item.money || item.amount || item.cash || 0).toFixed(2)
|
||||
const applyStatus = Number(item.applyStatus)
|
||||
return {
|
||||
money,
|
||||
applyStatus: Number.isFinite(applyStatus) ? applyStatus : -1,
|
||||
payType: Number(item.payType),
|
||||
rejectReason: item.rejectReason || item.reject_reason || '',
|
||||
date: dayjs(item.createTime).format('YYYY-MM-DD HH:mm:ss') || item.createdAt || item.create_time || '-'
|
||||
}
|
||||
},
|
||||
async fetchRecords() {
|
||||
this.loading = true
|
||||
try {
|
||||
const {data} = await dealerWithdrawListReq({})
|
||||
const list = Array.isArray(data) ? data : (data && data.list ? data.list : [])
|
||||
this.records = list.map(this.normalizeRecord)
|
||||
} catch (err) {
|
||||
uni.showToast({
|
||||
title: '加载失败',
|
||||
icon: 'none'
|
||||
})
|
||||
} finally {
|
||||
this.loading = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.withdraw-record-page {
|
||||
min-height: 100vh;
|
||||
background: #f5f5f5;
|
||||
}
|
||||
|
||||
.page-hero {
|
||||
background: url('https://yaodongxiao.oss-cn-guangzhou.aliyuncs.com/20260126/462bfa04cf0eff8698884c38b9d17519.png') no-repeat
|
||||
top center / 100% auto;
|
||||
}
|
||||
|
||||
.intro-card {
|
||||
margin: 18rpx 20rpx 0;
|
||||
padding: 20rpx 18rpx;
|
||||
border-radius: 20rpx;
|
||||
background: rgba(255, 255, 255, 0.9);
|
||||
box-shadow: 0 10rpx 20rpx rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
|
||||
.card-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12rpx;
|
||||
font-size: 28rpx;
|
||||
font-weight: 700;
|
||||
color: #1f2937;
|
||||
}
|
||||
|
||||
.title-bar {
|
||||
width: 6rpx;
|
||||
height: 30rpx;
|
||||
border-radius: 999rpx;
|
||||
background: #2fc6a7;
|
||||
}
|
||||
|
||||
.intro-text {
|
||||
margin-top: 12rpx;
|
||||
font-size: 26rpx;
|
||||
color: #6b7280;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.block {
|
||||
margin: 18rpx 20rpx 0;
|
||||
}
|
||||
|
||||
.record {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 16rpx;
|
||||
padding: 16rpx 0;
|
||||
border-bottom: 1rpx solid #edf1f7;
|
||||
}
|
||||
|
||||
.record:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.record-left {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.record-amount {
|
||||
font-size: 28rpx;
|
||||
font-weight: 700;
|
||||
color: #111827;
|
||||
}
|
||||
|
||||
.record-meta {
|
||||
margin-top: 6rpx;
|
||||
font-size: 24rpx;
|
||||
color: #6b7280;
|
||||
}
|
||||
|
||||
.record-reject {
|
||||
margin-top: 6rpx;
|
||||
font-size: 24rpx;
|
||||
color: #ef4444;
|
||||
}
|
||||
|
||||
.record-tags {
|
||||
margin-top: 8rpx;
|
||||
display: flex;
|
||||
gap: 8rpx;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.record-tag {
|
||||
padding: 4rpx 12rpx;
|
||||
border-radius: 999rpx;
|
||||
font-size: 22rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.record-tag.wechat {
|
||||
color: #16a34a;
|
||||
background: #dbeafe;
|
||||
}
|
||||
|
||||
.record-tag.alipay {
|
||||
color: #1d4ed8;
|
||||
background: #dbeafe;
|
||||
}
|
||||
|
||||
.record-tag.bank {
|
||||
color: #0f766e;
|
||||
background: #ccfbf1;
|
||||
}
|
||||
|
||||
.record-tag.unknown {
|
||||
color: #6b7280;
|
||||
background: #f3f4f6;
|
||||
}
|
||||
|
||||
.record-status {
|
||||
font-size: 24rpx;
|
||||
font-weight: 700;
|
||||
padding: 6rpx 14rpx;
|
||||
border-radius: 999rpx;
|
||||
align-self: center;
|
||||
}
|
||||
|
||||
.record-status.pending {
|
||||
color: #f59e0b;
|
||||
background: #fff7ed;
|
||||
}
|
||||
|
||||
.record-status.success {
|
||||
color: #16a34a;
|
||||
background: #ecfdf5;
|
||||
}
|
||||
|
||||
.record-status.danger {
|
||||
color: #ef4444;
|
||||
background: #fee2e2;
|
||||
}
|
||||
|
||||
.record-status.info {
|
||||
color: #2563eb;
|
||||
background: #e0f2fe;
|
||||
}
|
||||
|
||||
.empty {
|
||||
color: var(--text-sub);
|
||||
text-align: center;
|
||||
padding: 16rpx 0;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,369 @@
|
||||
<template>
|
||||
<view class="withdraw-page">
|
||||
<view class="page-hero">
|
||||
<AppNavbar title="提现" show-back/>
|
||||
<view class="intro-card">
|
||||
<view class="card-title">
|
||||
<view class="title-bar"></view>
|
||||
<text>提现</text>
|
||||
</view>
|
||||
<text class="intro-text">提交提现申请,到账时间以平台审核为准</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="card block">
|
||||
<view class="section-title">提现信息</view>
|
||||
<!-- <view class="info-row">-->
|
||||
<!-- <view>可提现余额</view>-->
|
||||
<!-- <view class="balance">¥ {{ withdrawable }}</view>-->
|
||||
<!-- </view>-->
|
||||
<view class="form-row">
|
||||
<view class="label">提现金额</view>
|
||||
<input v-model="form.money" class="input" type="digit" placeholder="请输入金额(0.5~200元)"/>
|
||||
</view>
|
||||
<view class="form-row">
|
||||
<view class="label">提现方式</view>
|
||||
<view class="pay-types">
|
||||
<view :class="['pay-type', form.payType === 10 ? 'active' : '']" @tap="form.payType = 10">微信</view>
|
||||
<!-- <view :class="['pay-type', form.payType === 20 ? 'active' : '']" @tap="form.payType = 20">支付宝</view>-->
|
||||
<!-- <view :class="['pay-type', form.payType === 30 ? 'active' : '']" @tap="form.payType = 30">银行卡</view>-->
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="form.payType === 20" class="form-row">
|
||||
<view class="label">支付宝姓名</view>
|
||||
<input v-model="form.alipayName" class="input" placeholder="请输入支付宝姓名"/>
|
||||
</view>
|
||||
<view v-if="form.payType === 20" class="form-row">
|
||||
<view class="label">支付宝账号</view>
|
||||
<input v-model="form.alipayAccount" class="input" placeholder="请输入支付宝账号"/>
|
||||
</view>
|
||||
<view v-if="form.payType === 30" class="form-row">
|
||||
<view class="label">开户行名称</view>
|
||||
<input v-model="form.bankName" class="input" placeholder="请输入开户行名称"/>
|
||||
</view>
|
||||
<view v-if="form.payType === 30" class="form-row">
|
||||
<view class="label">银行开户名</view>
|
||||
<input v-model="form.bankAccount" class="input" placeholder="请输入银行开户名"/>
|
||||
</view>
|
||||
<view v-if="form.payType === 30" class="form-row">
|
||||
<view class="label">银行卡号</view>
|
||||
<input v-model="form.bankCard" class="input" placeholder="请输入银行卡号"/>
|
||||
</view>
|
||||
<view class="form-row">
|
||||
<view class="label">备注</view>
|
||||
<input v-model="form.remark" class="input" placeholder="选填"/>
|
||||
</view>
|
||||
<view class="primary-btn submit" @tap="submitWithdraw">提交申请</view>
|
||||
</view>
|
||||
|
||||
<view class="info-row clickable" @tap="goWithdrawRecords">
|
||||
<view>提现记录</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AppNavbar from "@/components/AppNavbar.vue";
|
||||
import {dealerWithdrawAddReq, userInfoReq, updateDealerWithdraw} from "@/api/user";
|
||||
import dayjs from 'dayjs'
|
||||
|
||||
export default {
|
||||
components: {AppNavbar},
|
||||
data() {
|
||||
return {
|
||||
withdrawable: 0,
|
||||
form: {
|
||||
payType: 10,
|
||||
money: '',
|
||||
alipayName: '',
|
||||
alipayAccount: '',
|
||||
bankName: '',
|
||||
bankAccount: '',
|
||||
bankCard: '',
|
||||
remark: ''
|
||||
},
|
||||
user: {
|
||||
balance: 0
|
||||
}
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.getUserData()
|
||||
},
|
||||
methods: {
|
||||
async getUserData() {
|
||||
const {data} = await userInfoReq()
|
||||
this.user = data
|
||||
this.withdrawable = this.user.balance
|
||||
},
|
||||
async submitWithdraw() {
|
||||
const money = Number(this.form.money)
|
||||
if (!money || money <= 0) {
|
||||
uni.showToast({
|
||||
title: '请输入正确金额',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
if (money < 0.5) {
|
||||
uni.showToast({
|
||||
title: '提现金额不能小于0.5元',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
if (money > 200) {
|
||||
uni.showToast({
|
||||
title: '提现金额不能大于200元',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
if (money > this.withdrawable) {
|
||||
uni.showToast({
|
||||
title: '超过可提现余额',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
if (this.form.payType === 20) {
|
||||
if (!this.form.alipayName) {
|
||||
uni.showToast({
|
||||
title: '请输入支付宝姓名',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
if (!this.form.alipayAccount) {
|
||||
uni.showToast({
|
||||
title: '请输入支付宝账号',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
} else if (this.form.payType === 30) {
|
||||
if (!this.form.bankName) {
|
||||
uni.showToast({
|
||||
title: '请输入开户行名称',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
if (!this.form.bankAccount) {
|
||||
uni.showToast({
|
||||
title: '请输入银行开户名',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
if (!this.form.bankCard) {
|
||||
uni.showToast({
|
||||
title: '请输入银行卡号',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
}
|
||||
uni.showLoading({
|
||||
title: '提交中...',
|
||||
})
|
||||
const _this = this
|
||||
const res = await dealerWithdrawAddReq(this.form).catch(err => {
|
||||
uni.hideLoading()
|
||||
setTimeout(() => {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon: 'none'
|
||||
})
|
||||
}, 200)
|
||||
_this.getUserData()
|
||||
})
|
||||
if (res) {
|
||||
console.log(res)
|
||||
uni.hideLoading()
|
||||
if (this.form.payType === 10) {
|
||||
if (!wx.canIUse('requestMerchantTransfer')) {
|
||||
wx.showModal({
|
||||
content: '你的微信版本过低,请更新至最新版本。',
|
||||
showCancel: false,
|
||||
});
|
||||
return
|
||||
}
|
||||
wx.requestMerchantTransfer({
|
||||
mchId: '1738840566', // 商户号
|
||||
appId: 'wx0c1587a63b0b9db5', // appId
|
||||
package: res.data.package_info,
|
||||
success: (res) => {
|
||||
uni.navigateBack()
|
||||
},
|
||||
fail: async (err) => {
|
||||
console.log('err', err)
|
||||
uni.showToast({
|
||||
title: '您取消了提现',
|
||||
icon: 'none'
|
||||
})
|
||||
|
||||
await updateDealerWithdraw({
|
||||
id: res.data.id,
|
||||
rejectReason: "用户取消",
|
||||
applyStatus: 2,
|
||||
auditTime: dayjs().unix()
|
||||
})
|
||||
await _this.getUserData()
|
||||
},
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '提现申请已提交',
|
||||
icon: 'success'
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 1500)
|
||||
}
|
||||
|
||||
} else {
|
||||
uni.hideLoading()
|
||||
}
|
||||
},
|
||||
goWithdrawRecords() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/bonus/withdraw-record'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.withdraw-page {
|
||||
min-height: 100vh;
|
||||
//padding: 0 20rpx 40rpx;
|
||||
background: #f5f5f5;
|
||||
}
|
||||
|
||||
.page-hero {
|
||||
//padding: 30rpx 6rpx 18rpx;
|
||||
background: url('https://yaodongxiao.oss-cn-guangzhou.aliyuncs.com/20260126/462bfa04cf0eff8698884c38b9d17519.png') no-repeat top center / 100% auto;
|
||||
}
|
||||
|
||||
.page-navbar {
|
||||
padding: 0 6rpx;
|
||||
}
|
||||
|
||||
.intro-card {
|
||||
margin: 18rpx 20rpx 0;
|
||||
padding: 20rpx 18rpx;
|
||||
border-radius: 20rpx;
|
||||
background: rgba(255, 255, 255, 0.9);
|
||||
box-shadow: 0 10rpx 20rpx rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
|
||||
.card-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12rpx;
|
||||
font-size: 28rpx;
|
||||
font-weight: 700;
|
||||
color: #1f2937;
|
||||
}
|
||||
|
||||
.title-bar {
|
||||
width: 6rpx;
|
||||
height: 30rpx;
|
||||
border-radius: 999rpx;
|
||||
background: #2fc6a7;
|
||||
}
|
||||
|
||||
.intro-text {
|
||||
margin-top: 12rpx;
|
||||
font-size: 26rpx;
|
||||
color: #6b7280;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.block {
|
||||
margin: 18rpx 20rpx 0;
|
||||
}
|
||||
|
||||
.info-row {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 10rpx 0;
|
||||
border-bottom: 1rpx solid #edf1f7;
|
||||
color: var(--brand-primary);
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
.info-row.clickable {
|
||||
color: #1f2937;
|
||||
}
|
||||
|
||||
.arrow {
|
||||
color: #9ca3af;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.balance {
|
||||
color: var(--brand-primary);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.form-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 12rpx 0;
|
||||
border-bottom: 1rpx solid #edf1f7;
|
||||
}
|
||||
|
||||
.form-row:last-of-type {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.label {
|
||||
color: var(--text-main);
|
||||
font-size: 26rpx;
|
||||
min-width: 140rpx;
|
||||
}
|
||||
|
||||
.input {
|
||||
flex: 1;
|
||||
text-align: right;
|
||||
font-size: 26rpx;
|
||||
color: var(--text-main);
|
||||
}
|
||||
|
||||
.pay-types {
|
||||
display: flex;
|
||||
gap: 12rpx;
|
||||
justify-content: flex-end;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.pay-type {
|
||||
padding: 6rpx 16rpx;
|
||||
border-radius: 999rpx;
|
||||
border: 1rpx solid #c7d2fe;
|
||||
color: #4f46e5;
|
||||
font-size: 22rpx;
|
||||
font-weight: 700;
|
||||
background: #eef2ff;
|
||||
}
|
||||
|
||||
.pay-type.active {
|
||||
border-color: #2fc6a7;
|
||||
color: #2fc6a7;
|
||||
background: #e6fffa;
|
||||
}
|
||||
|
||||
.submit {
|
||||
margin-top: 18rpx;
|
||||
padding: 14rpx;
|
||||
height: 60rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user