日常提交

This commit is contained in:
2025-03-31 20:29:13 +08:00
parent 83e3bc95b7
commit 1dd2e60003
42 changed files with 1390 additions and 24 deletions

View File

@ -4,7 +4,7 @@ export default {
genderKV:{
MALE:'先生',FEMALE:'女士'
},
login:(phone,password)=>request.post('/api/user/password-login',{phone,password,role:'deliveryman'}),
login:(phone,password)=>request.post('/api/user/password-login',{phone,password,role:'merchant'}),
info:()=>request.get('/api/user/info'),
@ -13,4 +13,23 @@ export default {
incomeList:(data)=>request.get('/api/account/details',data),
modifyPassword:(phone,new_password,verify_code)=>request.post('/api/user/change-password',{phone,new_password,verify_code}),
summary:()=>request.get('/api/account/summary'),
bankCard:{
list:()=>request.get('/api/bank-cards'),
add:(data)=>request.post('/api/bank-cards',data),
delete:(card_id)=>request.delete(`/api/bank-cards/${card_id}`)
},
withdraw:{
add:(bank_card_id,amount)=>request.post('/api/withdraw',{bank_card_id,amount}),
list:(data)=>request.get('/api/withdraw/user',data),
statusKV:{
PENDING:"提现审核中",APPROVED:"平台受理成功",REJECTED:"审核未通过"
}
},
getRNAuth:()=>request.get('/api/user/auth',{},{noTips:true}),
setRNAuth:(data)=>request.post('/api/user/auth',data)
}

View File

@ -9,7 +9,14 @@
"pages/user/income/list/index",
"pages/index/verification/index",
"pages/user/income/detail/index",
"pages/browser/index"
"pages/browser/index",
"pages/user/info/index",
"pages/user/rnAuth/index",
"pages/user/bank/index/index",
"pages/user/bank/editor/index",
"pages/user/withdraw/index/index",
"pages/user/withdraw/list/index",
"pages/user/withdraw/success/index"
],
"window": {
"navigationBarTextStyle": "black",

BIN
assets/icon/card.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
assets/icon/delete.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 713 B

BIN
assets/icon/plus.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 B

15
package-lock.json generated
View File

@ -9,12 +9,19 @@
"version": "0.0.1",
"license": "ISC",
"dependencies": {
"@beefast-wxmp/background-notice": "^0.0.1",
"@beefast-wxmp/list-view": "^0.0.1",
"@beefast-wxmp/modal-view": "^0.1.7",
"@beefast-wxmp/nav-bar": "^0.0.1",
"@beefast-wxmp/nav-bar": "^0.0.3",
"@beefast-wxmp/swipe-button": "^0.0.3"
}
},
"node_modules/@beefast-wxmp/background-notice": {
"version": "0.0.1",
"resolved": "https://packages.aliyun.com/6486fc420ce788fc1c0798b3/npm/repo-glpby/@beefast-wxmp/background-notice/-/@beefast-wxmp/background-notice-0.0.1.tgz",
"integrity": "sha512-qD3+SdGIbTT8puIBBBu6btvWWG+7dU5gYZKzzaVDtDI4owzcPRdQNDWLZ5LSqd8CbXQJz6uSihU6E7tqm/Fbjw==",
"license": "ISC"
},
"node_modules/@beefast-wxmp/list-view": {
"version": "0.0.1",
"resolved": "https://packages.aliyun.com/6486fc420ce788fc1c0798b3/npm/repo-glpby/@beefast-wxmp/list-view/-/@beefast-wxmp/list-view-0.0.1.tgz",
@ -28,9 +35,9 @@
"license": "ISC"
},
"node_modules/@beefast-wxmp/nav-bar": {
"version": "0.0.1",
"resolved": "https://packages.aliyun.com/6486fc420ce788fc1c0798b3/npm/repo-glpby/@beefast-wxmp/nav-bar/-/@beefast-wxmp/nav-bar-0.0.1.tgz",
"integrity": "sha512-nXbwGu31795qoSnHi5pzOmUWY7cbN+WPbAaA7UsG45Iae1k5AWfh2i65HenjtsN+jkVb/OMLDUcMYnqqEUb6RQ==",
"version": "0.0.3",
"resolved": "https://packages.aliyun.com/6486fc420ce788fc1c0798b3/npm/repo-glpby/@beefast-wxmp/nav-bar/-/@beefast-wxmp/nav-bar-0.0.3.tgz",
"integrity": "sha512-h0CC32cTYguLhH+cap2LAUV7jeB6k6x6gWS3YUjkfYy6+v9XP3ohTAnuWsEDnWjJ+mJlARxdhwy8Phnl/Nuw2A==",
"license": "ISC"
},
"node_modules/@beefast-wxmp/swipe-button": {

View File

@ -9,9 +9,10 @@
"author": "",
"license": "ISC",
"dependencies": {
"@beefast-wxmp/background-notice": "^0.0.1",
"@beefast-wxmp/list-view": "^0.0.1",
"@beefast-wxmp/modal-view": "^0.1.7",
"@beefast-wxmp/nav-bar": "^0.0.1",
"@beefast-wxmp/nav-bar": "^0.0.3",
"@beefast-wxmp/swipe-button": "^0.0.3"
}
}

View File

@ -8,7 +8,9 @@ Page({
* 页面的初始数据
*/
data: {
isShowVerify:false,
verifyData:{},
verifyCode:''
},
/**
@ -26,14 +28,10 @@ Page({
if(res.scanType=='QR_CODE'){
orderApi.queryVerifyCode(res.result).then((data)=>{
if(data.order){
wx.navigateTo({
url: `/pages/index/verification/index?code=${res.result}`,
success(){
//传 code 供测试用,因为热更新下面的数据就没有了
const pages = getCurrentPages();
const currentPage = pages[pages.length-1];
currentPage.setOrder(data);
}
this.setData({
verifyData:data,
verifyCode:res.result,
isShowVerify:true
})
}
})
@ -47,6 +45,16 @@ Page({
})
},
verify(){
orderApi.verify(this.data.verifyCode).then((data)=>{
this.setData({
isShowVerify:false
});
wx.showToast({
title: '核销成功'
});
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/

View File

@ -1,4 +1,6 @@
{
"usingComponents": {},
"usingComponents": {
"modal-view":"/miniprogram_npm/@beefast-wxmp/modal-view"
},
"navigationStyle": "custom"
}

View File

@ -10,7 +10,7 @@
</view>
<view class="main">
<view class="row1">
<navigator url="/pages/user/income/list/index" class="cell row1-1">
<navigator url="/pages/user/info/index" class="cell row1-1">
<view class="title right-arrow">累计收益 (元)</view>
<view class="number">88</view>
</navigator>
@ -31,3 +31,18 @@
</view>
</view>
</view>
<modal-view class="verify-view" show="{{isShowVerify}}" titleText="兑换信息" overlayClose="{{false}}" isShowCancel="{{false}}" ok-button-text="立即核销" bind:ok="verify">
<view class="spliter"></view>
<view class="product">
<image class="avatar" src="{{verifyData.product.optimized_image_url}}"/>
<view class="info">
<view class="name">{{verifyData.product.name}}</view>
<view class="qty">x {{verifyData.order.qty}}</view>
</view>
</view>
<view class="amount">
<view>订单总价</view>
<view class="money">{{verifyData.order.order_amount}}</view>
</view>
</modal-view>

View File

@ -73,3 +73,34 @@
font-size: 44rpx;
font-weight: 500;
}
.verify-view .spliter{
margin:30rpx 0;
}
.verify-view .product{
display: flex;
gap: 24rpx;
}
.verify-view .product .avatar{
width:132rpx;height:132rpx;
border-radius: 12rpx;
}
.verify-view .product .info{
font-size: 32rpx;
height:132rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
padding:4rpx 0;
box-sizing: border-box;
}
.verify-view .product .qty{
color:#888;
}
.verify-view .amount{
margin-top:44rpx;
display:flex;
justify-content: space-between;
align-items: center;
}

View File

@ -0,0 +1,93 @@
import userApi from '../../../../api/user';
const app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
name:'',
bankName:'',
cardNumber:'',//16-19
},
validator:{
name:{minLength:2,message:'持卡人姓名至少 2 个字',autoFocus:true,shake:true},
bankName:{required:true,message:'请输入开户银行',autoFocus:true,shake:true},
cardNumber:{minLength:16,maxLength:19,message:'银行卡号 16-19 位数字',autoFocus:true,shake:true}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
addCard(){
const valid = app.validateForm(this.validator,this);
if(valid.length==0){
userApi.bankCard.add({
name:this.data.name,
card_number:this.data.cardNumber,
bank_name:this.data.bankName
}).then(()=>{
wx.navigateBack({
success(){
wx.showToast({
icon:'success',
title: '添加成功',
})
}
});
})
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "添加银行卡"
}

View File

@ -0,0 +1,29 @@
<view class="cells">
<view class="cell">
<view class="cell-hd">持卡姓名</view>
<view class="cell-bd">
<input placeholder="请输入持卡姓名" model:value="{{name}}"
animation="{{nameAnimation}}" focus="{{nameFocus}}"/>
<view class="error">{{nameMessage}}</view>
</view>
</view>
<view class="cell">
<view class="cell-hd">开户银行</view>
<view class="cell-bd">
<input placeholder="请输入开户银行" model:value="{{bankName}}"
animation="{{bankNameAnimation}}" focus="{{bankNameFocus}}"/>
<view class="error">{{bankNameMessage}}</view>
</view>
</view>
<view class="cell">
<view class="cell-hd">银行卡号</view>
<view class="cell-bd">
<input placeholder="请输入银行卡号" model:value="{{cardNumber}}" type="number"
animation="{{cardNumberAnimation}}" focus="{{cardNumberFocus}}"/>
<view class="error">{{cardNumberMessage}}</view>
</view>
</view>
</view>
<view class="bottom-bar">
<button type="primary" class="save-btn" bind:tap="addCard">提交并认证</button>
</view>

View File

@ -0,0 +1 @@
/* pages/user/bank/editor/index.wxss */

View File

@ -0,0 +1,102 @@
import userApi from '../../../../api/user';
Page({
/**
* 页面的初始数据
*/
data: {
cardList:[],
listLoading:false,
isShowConfirm:false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
navToAdd(){
wx.navigateTo({
url: '/pages/user/bank/editor/index',
})
},
showConfirm(event){
const card = event.currentTarget.dataset.item;
this.currentCard = card;
this.setData({
isShowConfirm:true
});
},
deleteCard(){
userApi.cardList.delete(this.currentCard.id).then((data)=>{
wx.showToast({
icon:'success',
title: '删除成功',
})
this.getCardList();
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
this.getCardList();
},
getCardList(){
if(this.data.listLoading)return;
this.setData({
listLoading:true
});
wx.showNavigationBarLoading();
userApi.bankCard.list().then((data)=>{
wx.hideNavigationBarLoading();
this.setData({
cardList:data,
listLoading:false
})
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@ -0,0 +1,6 @@
{
"usingComponents": {
"modal-view":"/miniprogram_npm/@beefast-wxmp/modal-view"
},
"navigationBarTitleText": "银行卡管理"
}

View File

@ -0,0 +1,25 @@
<view class="bank-card">
<view class="page-title">
<label>提现用卡</label>
<view class="tag">个人账户</view>
</view>
<view class="card" wx:for="{{cardList}}" wx:key="index">
<view class="head">
<image class="icon-card" src="/assets/icon/card.png"/>
<view class="name">{{item.bank_name}}</view>
<image class="icon-delete" src="/assets/icon/delete.png" bind:tap="showConfirm" data-item="{{item}}"/>
</view>
<view class="spliter"></view>
<view class="info-item">
<view class="key">持卡人</view>
<view class="value">{{item.name}}</view>
</view>
<view class="info-item">
<view class="key">银行卡号</view>
<view class="value card-no">{{item.card_number}}</view>
</view>
</view>
<button bind:tap="navToAdd" class="add-card-btn">添加银行卡</button>
</view>
<modal-view show="{{isShowConfirm}}" titleText="是否确认删除此银行卡" bind:ok="deleteCard"/>

View File

@ -0,0 +1,72 @@
.bank-card{
min-height: 100vh;
box-sizing: border-box;
background-color: #fff;
padding:60rpx 30rpx;
}
.page-title{
font-size: 40rpx;
display: flex;
align-items: flex-end;
}
.page-title .tag{
font-size: 24rpx;
background-color: rgba(255, 195, 0, 0.1);
padding:5rpx 8rpx;
color: #FFC300;
margin-left:22rpx;
}
.card{
background: linear-gradient(298deg, #FFC300 0%, #FFDE74 98%);
box-shadow: 0px 3px 6px 2px rgba(0, 0, 0, 0.1);
border-radius: 20rpx;
padding:30rpx 0 40rpx 30rpx;
margin-top:46rpx;
}
.card .head{
display: flex;
align-items: center;
padding-right:30rpx;
}
.card .head .icon-card{
width:44rpx;height:44rpx;
}
.card .head .name{
font-size: 33rpx;
flex: 1;
margin-left:18rpx;
}
.card .head .icon-delete{
width:32rpx;height:32rpx;
padding:4rpx;
}
.card .spliter{
margin:24rpx 0 0 0;
}
.card .info-item{
margin-top:40rpx;
}
.card .info-item .key{
color: #555555;
font-size: 24rpx;
}
.card .info-item .value{
font-size: 36rpx;
margin-top:24rpx;
}
.card .info-item .card-no{
font-weight: 500;
}
.add-card-btn{
margin-top:40rpx;
background-color: rgba(153, 153, 153, 0.15);
}
.list-empty{
padding:200rpx 0;
}
.list-empty .icon{
margin-top:0;
}

View File

@ -7,7 +7,8 @@ Page({
*/
data: {
userInfo:{},
appConfig:{}
appConfig:{},
isStartLoopOrder:false
},
/**
@ -42,6 +43,39 @@ Page({
}
})
},
findNewOrder(){
console.log(123);
},
bgNoticeSuccess(){
this.setData({
bgNoticeLoadResult:{
error:false,
loading:false
}
})
},
bgNoticeError(){
wx.showToast({
icon:'error',
title: '资源加载失败',
})
this.setData({
bgNoticeLoadResult:{
error:true,
loading:false
}
})
},
stopBGNotice(){
this.setData({
isStartLoopOrder:false
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/

View File

@ -1,4 +1,6 @@
{
"usingComponents": {},
"usingComponents": {
"background-notice":"/miniprogram_npm/@beefast-wxmp/background-notice"
},
"navigationStyle": "custom"
}

View File

@ -18,8 +18,12 @@
<view class="text">用户协议</view>
</view>
</view>
<view class="page-container bg-notice">
<!-- <view class="page-container bg-notice">
<view class="">语音播报</view>
<switch/>
</view>
</view> -->
<button class="btn-logout" type="primary" bind:tap="logout">退出登录</button>
<!-- <background-notice bind:onTrigger="findNewOrder" id="orderBackgroundNotice"
start="{{isStartLoopOrder}}" bind:initSuccess="bgNoticeSuccess"
bind:initError="bgNoticeError" bind:stop="stopBGNotice"/> -->

82
pages/user/info/index.js Normal file
View File

@ -0,0 +1,82 @@
import userApi from '../../../api/user';
const app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
summary:{},
refreshTrigger:false,
isAuth:false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
refreshSummary(){
userApi.summary().then((data)=>{
this.setData({
summary:data,
refreshTrigger:false
})
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
this.refreshSummary();
app.getUserInfo().then((data)=>{
this.setData({
isAuth:data.is_auth
})
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@ -0,0 +1,6 @@
{
"usingComponents": {
"nav-bar":"/miniprogram_npm/@beefast-wxmp/nav-bar"
},
"navigationStyle": "custom"
}

View File

@ -0,0 +1,45 @@
<view class="bg">
<nav-bar back home-url="/pages/index/index/index"/>
</view>
<scroll-view scroll-y class="scroll-view" refresher-enabled enhanced show-scrollbar="{{false}}"
bindrefresherrefresh="refreshSummary" refresher-triggered="{{refreshTrigger}}">
<view class="scroll-view-top-margin"></view>
<view class="page-container user-info">
<view class="title">账户余额 (元)</view>
<view class="_money">{{summary.balance}}</view>
<view class="today">今日收益(元) {{summary.today_income}}</view>
<navigator url="/pages/user/withdraw/index/index">
<button class="button" type="primary" disabled="{{summary.balance==0}}">提现</button>
</navigator>
</view>
<view class="cells cells-access">
<navigator url="/pages/user/income/list/index" class="cell" hover-class="cell-active">
<view class="cell-bd invite-cell">
<view>交易明细</view>
</view>
<view class="cell-ft"></view>
</navigator>
<navigator url="/pages/user/withdraw/list/index" class="cell" hover-class="cell-active">
<view class="cell-bd">
<view>提现记录</view>
</view>
<view class="cell-ft"></view>
</navigator>
<navigator url="/pages/user/rnAuth/index" class="cell" hover-class="cell-active">
<view class="cell-bd">
<view>实名认证</view>
</view>
<view class="cell-ft">
<label class="main-color">{{isAuth?'已认证':'未认证'}}</label>
</view>
</navigator>
<navigator url="/pages/user/bank/index/index" class="cell" hover-class="cell-active">
<view class="cell-bd">
<view>银行卡管理</view>
</view>
<view class="cell-ft"></view>
</navigator>
</view>
</scroll-view>

View File

@ -0,0 +1,28 @@
.bg{
background-color: var(--main-color);
border-radius: 0 0 20rpx 20rpx;
padding-bottom:240rpx;
}
.scroll-view{
position: fixed;
top:15vh;left:0;
height:85vh;
}
.user-info{
text-align: center;
padding-top:60rpx;
}
.user-info ._money{
font-size: 80rpx;
margin-top:50rpx;
font-weight: 600;
}
.user-info .today{
font-size: 28rpx;
color: #555555;
margin-top:50rpx;
}
.user-info .button{
border-radius: 60rpx;
margin-top:70rpx;
}

100
pages/user/rnAuth/index.js Normal file
View File

@ -0,0 +1,100 @@
import userApi from '../../../api/user';
const app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
name:'',
idCard:'',
already:false
},
validator:{
name:{minLength:2,message:'请输入真实的姓名',autoFocus:true,shake:true},
idCard:{length:18,message:'请输入正确的身份证号码',autoFocus:true,shake:true}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
userApi.getRNAuth().then((data)=>{
if(data&&data.id_number){
this.setData({
name:data.name,
idCard:data.id_number,
already:true
})
}
});
},
save(){
app.resetUserInfoUpdateTag();
const valid = app.validateForm(this.validator,this);
if(valid.length==0){
userApi.setRNAuth({
name:this.data.name,
id_number:this.data.idCard
}).then((data)=>{
wx.navigateBack({
success(){
wx.showToast({
title: '保存成功',
})
}
})
})
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "实名认证"
}

View File

@ -0,0 +1,38 @@
<view class="cells">
<view class="cell">
<view class="cell-hd">真实姓名</view>
<view class="cell-bd">
<label wx:if="{{already}}">{{name}}</label>
<input focus="{{nameFocus}}" animation="{{nameAnimation}}" placeholder="请输入真实姓名" model:value="{{name}}" wx:else/>
<view class="error">{{nameMessage}}</view>
</view>
</view>
<view class="cell">
<view class="cell-hd">身份证号</view>
<view class="cell-bd">
<label wx:if="{{already}}">{{idCard}}</label>
<input focus="{{idCardFocus}}" animation="{{idCardAnimation}}" placeholder="请输入身份证号" model:value="{{idCard}}" wx:else/>
<view class="error">{{idCardMessage}}</view>
</view>
</view>
<!-- <view class="cell">
<view class="cell-hd">手机号码</view>
<view class="cell-bd">
<input placeholder="请输入手机号码"/>
</view>
<view class="cell-ft">
<button type="primary" size="mini">获取验证码</button>
</view>
</view>
<view class="cell">
<view class="cell-hd">验证码</view>
<view class="cell-bd">
<input placeholder="请输入验证码"/>
</view>
</view> -->
</view>
<view class="bottom-bar" wx:if="{{!already}}">
<button type="primary" class="save-btn" bind:tap="save">保存并使用</button>
</view>

View File

View File

@ -0,0 +1,167 @@
import userApi from '../../../../api/user';
const app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
bankList:[],
amount:'',
amountMessage:'',
summary:{},
inputFocus:false,
bank:''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
userApi.bankCard.list().then((data)=>{
data.map((item)=>{
item.endNumber = item.card_number.substr(item.card_number.length-4,item.card_number.length);
});
this.setData({
bank:data.length>0?data[0].id:'',
bankList:data
})
});
this.getSummary();
},
getSummary(){
userApi.summary().then((data)=>{
this.setData({
summary:data
})
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
setAmountAll(){
this.setData({
amount:this.data.summary.balance
})
},
widthdraw(){
if(this.data.amount==''){
this.setData({
amountMessage:'请输入提现金额',
inputFocus:true
})
return;
}else{
this.setData({
amountMessage:''
})
}
if(this.data.bank){
userApi.withdraw.add(this.data.bank,this.data.amount).then((data)=>{
this.getSummary();
this.setData({
amount:''
})
const bank = this.data.bankList.find((item)=>item.id==data.bank_card_id);
console.log(bank,data.id);
const showText = `${bank.bank_name}${bank.endNumber}`;
wx.navigateTo({
url: `/pages/withdraw/success/index?amount=${data.amount}&bank=${showText}`,
})
});
}else{
wx.showToast({
icon:'error',
title: this.data.bankList.length==0?'请添加银行卡':'请选择银行卡',
})
}
},
amountInput(event){
console.log(event.detail);
let amount = event.detail.value;
if(amount&&isNaN(parseFloat(amount))){
amount = 0;
}else{
let a = amount.split('.');
if(a.length>1&&a[1]==''){
}else{
if(a.length>1){
amount = parseFloat(amount).toFixed(1);
}else if(a.length==1&&a[0]!=''){
amount = `${parseInt(amount)}`;
}
if(amount>this.data.summary.balance){
amount = this.data.summary.balance;
}
}
}
this.setData({
amount:amount
});
},
amountBlur(){
const a = this.data.amount.split('.');
if(a[1]==''){
this.setData({
amount:parseInt(a)
})
}
},
navToAddCard(){
wx.navigateTo({
url: '/pages/user/bank/editor/index',
})
},
bankChange(event){
this.setData({
bank:event.detail.value
})
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "账户提现"
}

View File

@ -0,0 +1,37 @@
<view class="page-container amount">
<view class="head">
<view class="key">提现金额</view>
<view class="value">24小时到账</view>
</view>
<view class="input-area">
<input class="input" placeholder-class="input-placeholder"
placeholder="请输入提现金额" type="digit" focus="{{inputFocus}}"
value="{{amount}}" bindinput="amountInput" bindblur="amountBlur"/>
<view class="error">{{amountMessage}}</view>
</view>
<view class="bottom">
<view class="key">账户余额:{{summary.balance}}</view>
<view class="value" bind:tap="setAmountAll">全部提现</view>
</view>
</view>
<view class="page-container banks">
<view class="head">提现方式</view>
<view class="spliter"></view>
<radio-group bindchange="bankChange" class="bank-list">
<label class="item" wx:for="{{bankList}}" wx:key="index">
<image class="icon" src="/assets/icon/card.png"/>
<view class="name">{{item.bank_name}}({{item.endNumber}})</view>
<radio class="checkbox" value="{{item.id}}" checked="{{index==0}}"/>
</label>
<view class="item" bind:tap="navToAddCard">
<view class="icon plus">
<image src="/assets/icon/plus.png" class="plus"/>
</view>
<view class="name">添加银行卡</view>
</view>
</radio-group>
</view>
<button type="primary" class="widthdraw-btn" bind:tap="widthdraw">立即提现</button>

View File

@ -0,0 +1,93 @@
.amount{
padding-bottom:0;
}
.amount .head{
display: flex;
align-items: center;
justify-content: space-between;
}
.amount .head .key{
font-size: 32rpx;
}
.amount .head .value{
font-size: 26rpx;
color: #888888;
}
.amount .input-area{
display: flex;
align-items: center;
margin-top:60rpx;
position: relative;
}
.amount .input-area .error{
position: absolute;
bottom:-15rpx;left:55rpx;
color:red;
font-size: 24rpx;
}
.amount .input-area::before{
content: '¥';
font-size: 50rpx;
font-weight: 500;
}
.amount .input{
flex: 1;
font-size: 76rpx;
font-weight: 600;
height:114rpx;
margin-left:24rpx;
}
.amount .input-placeholder{
font-size: 56rpx;
}
.amount .bottom{
display: flex;
align-items: center;
justify-content: space-between;
font-size: 26rpx;
}
.amount .bottom .value{
padding:32rpx 0 32rpx 32rpx;
color:var(--main-color);
}
.banks{
}
.banks .spliter{
margin-top:30rpx;
}
.banks .bank-list{
margin-top:20rpx;
}
.banks .item{
display: flex;
align-items: center;
padding:20rpx 0;
margin:0;
}
.banks .icon{
width:44rpx;height:44rpx;
}
.banks .icon.plus{
background-color: var(--main-color);
border-radius: 50%;
color:#fff;
display: flex;
align-items: center;
justify-content: center;
}
.banks .icon .plus{
width:28rpx;height:28rpx;
}
.banks .name{
font-size: 32rpx;
margin-left:30rpx;
flex:1;
}
.banks .checkbox{}
.widthdraw-btn{
margin:40rpx 20rpx 0 20rpx!important;
}

View File

@ -0,0 +1,111 @@
import userApi from '../../../../api/user';
Page({
/**
* 页面的初始数据
*/
data: {
pager:{limit:10,loading:false,loadAll:false,pageIndex:0,refreshTrigger:false},
list:[],
statusKV:userApi.withdraw.statusKV
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.loadList();
},
refreshList(){
this.data.pager.pageIndex = 0;
this.data.pager.loadAll = false;
this.setData({
pager:this.data.pager
});
this.loadList();
},
loadList(){
if(this.data.pager.loading||this.data.pager.loadAll){
return;
}
this.setData({
"pager.loading":true
})
userApi.withdraw.list({
skip:this.data.pager.pageIndex*this.data.pager.limit,
limit:this.data.pager.limit
}).then((data)=>{
data.items.map((item)=>{
item.displayName = `${item.bank_name}(${item.bank_card_number.substr(item.bank_card_number.length-4,4)})`;
})
if(this.data.pager.pageIndex==0){
this.data.list = data.items;
}else{
this.data.list = this.data.list.concat(data.items);
}
this.data.pager.loading = false;
this.data.pager.pageIndex++;
this.data.pager.refreshTrigger = false;
if(data.items.length<this.data.pager.limit){
this.data.pager.loadAll = true;
}
this.setData({
list:this.data.list,
pager:this.data.pager
})
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@ -0,0 +1,6 @@
{
"usingComponents": {
"list-view":"/miniprogram_npm/@beefast-wxmp/list-view"
},
"navigationBarTitleText": "提现记录"
}

View File

@ -0,0 +1,20 @@
<list-view bind:refresh="refreshList"
bind:loadMore="loadList" class="withdraw-list"
refresher-triggered="{{pager.refreshTrigger}}"
show-load-more="{{!(list.length==0&&pager.loadAll)}}"
loading="{{pager.loading}}" load-all="{{pager.loadAll}}">
<view class="item" wx:for="{{list}}" wx:key="index">
<view class="title">
<view class="left">{{item.displayName}}</view>
<view class="right money">{{item.amount}}</view>
</view>
<view class="sub-title">
<view class="left">{{item.create_time}}</view>
<view class="status {{item.status}}">{{statusKV[item.status]}}</view>
</view>
</view>
<view class="list-empty" wx:if="{{list.length==0&&pager.loadAll}}">
<image src="/assets/icon/list-empty.png" class="icon"/>
<view class="title">暂无记录</view>
</view>
</list-view>

View File

@ -0,0 +1,36 @@
.withdraw-list{
margin-top:20rpx;
height: 100vh;
}
.withdraw-list .item{
padding:40rpx 30rpx;
background-color: #ffffff;
border-bottom: 1rpx solid rgba(153, 153, 153, 0.2);
}
.withdraw-list .item .title{
display: flex;
}
.withdraw-list .item .left{
flex:1;
}
.withdraw-list .item .sub-title{
display: flex;
margin-top:38rpx;
color: #999999;
}
.withdraw-list .item .money{
color:var(--main-font-color);
font-size: 36rpx;
font-weight: 500;
}
.withdraw-list .item .status{
font-size: 27rpx;
}
.withdraw-list .item .status.PENDING{
color:var(--main-color);
}
.withdraw-list .item .status.APPROVED{
color: #00A643;
}

View File

@ -0,0 +1,74 @@
// pages/withdraw/success/index.js
Page({
/**
* 页面的初始数据
*/
data: {
amount:'',
bank:''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.setData({
amount:options.amount,
bank:options.bank
})
},
done(){
wx.navigateBack({
delta:2
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "账户提现"
}

View File

@ -0,0 +1,22 @@
<view class="page-container success-info">
<image src="/assets/icon/success.png" class="icon"/>
<view class="title">提现申请成功</view>
<view class="sub-title">24小时到账 (周末节假日顺延),以实际到账时间为准!</view>
</view>
<view class="cells order-info">
<view class="cell">
<view class="cell-hd">提现类型</view>
<view class="cell-bd">账户提现</view>
</view>
<view class="cell">
<view class="cell-hd">提现金额</view>
<view class="cell-bd money money-normal">{{amount}}</view>
</view>
<view class="cell">
<view class="cell-hd">到账方式</view>
<view class="cell-bd">{{bank}}</view>
</view>
</view>
<button type="primary" class="done-btn" bind:tap="done">完成</button>

View File

@ -0,0 +1,27 @@
.success-info{
text-align: center;
padding-top:70rpx
}
.success-info .icon{
width:90rpx;height:90rpx;
}
.success-info .title{
font-size: 44rpx;
margin-top:40rpx;
font-weight: 500;
}
.success-info .sub-title{
font-size: 24rpx;
color: #555555;
margin-top:40rpx;
}
.order-info .cell-hd{
color:#555555;
}
.order-info .cell-bd{
font-weight: 500;
}
.done-btn{
margin:40rpx 20rpx 0 20rpx!important;
}