diff --git a/api/order.js b/api/order.js
index b304c5d..eaa3b26 100644
--- a/api/order.js
+++ b/api/order.js
@@ -18,10 +18,11 @@ export default {
},
buildingList:(community_id,status)=>request.get('/api/order/community_building/count',{community_id,status}),
- list:(data)=>request.get('/api/order/deliveryman/list',data,true),
+ list:(data)=>request.get('/api/order/deliveryman/list',data,{delayLoading:true}),
+ detail:(orderid)=>request.get(`/api/order/${orderid}`),
statusDetail:(community_id)=>request.get('/api/order/status/count',{community_id}),
receive:(orderid)=>request.post(`/api/order/${orderid}/deliveryman/receive`),
pickup:(orderid)=>request.post(`/api/order/${orderid}/deliveryman/pickup`),
- complete:(orderid,images)=>request.post(`/api/order/${orderid}/deliveryman/complete`,{images:JSON.stringify(images)})
+ complete:(orderid,images)=>request.post(`/api/order/${orderid}/deliveryman/complete`,{images:images})
}
\ No newline at end of file
diff --git a/api/request.js b/api/request.js
index f3fe8b1..0c7bdbf 100644
--- a/api/request.js
+++ b/api/request.js
@@ -4,7 +4,7 @@ let app = getApp();
const sendRequest = (options)=>{
if(!app)app = getApp();
let timer;
- if(options.delayLoading){
+ if(options.options.delayLoading){
timer = setTimeout(()=>{
wx.showLoading({
title: '加载中...',
@@ -23,16 +23,21 @@ const sendRequest = (options)=>{
if(result.data.code==200){
rs(result.data.data);
}else{
- wx.showToast({
- icon:'error',
- title: result.data.message,
- });
+
+ if(!options.options.noTips){
+ wx.showToast({
+ icon:'error',
+ title: result.data.message,
+ });
+ }
rj(result.data);
}
}else if(result.statusCode==401){
wx.navigateTo({
url: '/pages/login/login',
})
+ }else{
+ rj(result.data);
}
},
@@ -54,16 +59,16 @@ const sendRequest = (options)=>{
export default {
baseUrl:baseUrl,
- get(url,data,delayLoading){
- return sendRequest({url,method:'get',data,delayLoading});
+ get(url,data,options){
+ return sendRequest({url,method:'get',data,options:options||{}});
},
- post(url,data){
- return sendRequest({url,method:'post',data});
+ post(url,data,options){
+ return sendRequest({url,method:'post',data,options:options||{}});
},
- put(url,data){
- return sendRequest({url,method:'put',data});
+ put(url,data,options){
+ return sendRequest({url,method:'put',data,options:options||{}});
},
- delete(url,data){
- return sendRequest({url,method:'delete',data});
+ delete(url,data,options){
+ return sendRequest({url,method:'delete',data,options:options||{}});
}
}
\ No newline at end of file
diff --git a/api/user.js b/api/user.js
index ca6fa70..2daf611 100644
--- a/api/user.js
+++ b/api/user.js
@@ -9,11 +9,26 @@ export default {
login:(phone,password)=>request.post('/api/user/password-login',{phone,password,role:'deliveryman'}),
userInfo:()=>request.get('/api/user/info'),
summary:()=>request.get('/api/account/summary'),
+ orderSummary:()=>request.get('/api/order/deliveryman/summary'),
incomeList:(data)=>request.get('/api/account/details',data),
- getRNAuth:()=>request.get('/api/user/auth'),
+ getRNAuth:()=>request.get('/api/user/auth',{noTips:true}),
setRNAuth:(data)=>request.post('/api/user/auth',data),
+ 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}`)
+ },
+ verifyCode:(phone)=>request.post('/api/user/send-code',{phone}),
+ modifyPassword:(new_password,verify_code)=>request.post('/api/user/change-password',{new_password,verify_code}),
+
+ withdraw:{
+ add:(bank_card_id,amount)=>request.post('/api/withdraw',{bank_card_id,amount}),
+ list:(status)=>request.get('/api/withdraw/user',status?{status}:{}),
+ },
+
uploadImg(file,progress){
+ if(!app)app = getApp();
return new Promise((rs,rj)=>{
const task = wx.uploadFile({
filePath: file.tempFilePath,
diff --git a/app.js b/app.js
index a9115ed..a4864ab 100644
--- a/app.js
+++ b/app.js
@@ -1,8 +1,9 @@
import userApi from './api/user';
const token = wx.getStorageSync('accessToken');
-
+// console.log()
const date = new Date();
App({
+ verifyCodeWaitingTime:60,
onLaunch() {
if(!token){
wx.navigateTo({
@@ -47,6 +48,49 @@ App({
this.globalData.summaryGetTime = new Date();
return data;
},
+ validateForm(rules,page){
+ const result = [];
+ for(var key in rules){
+ ((rules[key] instanceof Array)?rules[key]:[rules[key]]).map((item)=>{
+ let valid = true;
+ //非空
+ if(item.required){
+ if(page.data[key].trim()==''){
+ valid = false;
+ }
+ }else if(item.length){
+ //绝对长度
+ if(page.data[key].trim().length!=item.length){
+ valid = false;
+ }
+ }
+ if(valid){
+ page.setData({
+ [`${key}Message`]:''
+ });
+ }else{
+ page.setData({
+ [`${key}Message`]:item.message
+ });
+ result.push({
+ [key]:item.message
+ })
+ }
+ })
+ }
+ return result;
+ },
+ validateInput(rule,page){
+ if(rule.required){
+ if(page.data[key].trim()==''){
+ page.setData({
+ [`${key}Message`]:rule.message
+ });
+ return false;
+ }
+ }
+ return true;
+ },
globalData: {
userInfo: null,
accessToken:token,
diff --git a/app.json b/app.json
index bf78bbd..00cd0e5 100644
--- a/app.json
+++ b/app.json
@@ -9,7 +9,9 @@
"pages/user/income/index",
"pages/user/rnAuth/index",
"pages/user/bank/index/index",
- "pages/user/bank/editor/index"
+ "pages/user/bank/editor/index",
+ "pages/user/password/index",
+ "pages/withdraw/list/index"
],
"window": {
"navigationBarTextStyle": "black",
diff --git a/app.wxss b/app.wxss
index 8cc41f2..e505b22 100644
--- a/app.wxss
+++ b/app.wxss
@@ -39,7 +39,7 @@ button[plain]{
border: 1rpx solid rgba(255, 195, 0, 0.5);
color: #FFC300;
}
-button:not([plain])[type=primary]:hover{
+button:not([plain]):not([disabled])[type=primary]:hover{
background-color:var(--main-hover-color);
}
button[type=default]{
@@ -224,7 +224,6 @@ page-container .content{
display: flex;
align-items: center;
padding:0 40rpx;
- min-height: 116rpx;
font-size: 30rpx;
position: relative;
}
@@ -251,13 +250,28 @@ page-container .content{
}
.cells .cell-bd{
flex:1;
+ display: flex;
+ align-items: center;
+ position:relative;
+ min-height: 116rpx;
+}
+.cells .cell-bd .error{
+ color:red;
+ position: absolute;
+ left:0;bottom:10rpx;
+ font-size: 24rpx;
+}
+.cells .cell-bd input{
+ height:100rpx;
}
.cells .cell-ft{
position: relative;
- padding-right:40rpx;
color:#999;
}
-.cells .cell-ft::after{
+.cells.cells-access .cell-ft{
+ padding-right: 40rpx;
+}
+.cells.cells-access .cell-ft::after{
content:" ";
width:24rpx;height:48rpx;
-webkit-mask-position:0 0;
@@ -309,6 +323,10 @@ page-container .content{
navigator button{
vertical-align: middle;
}
+.navigator-hover{
+ background-color: transparent;
+ opacity: 1;
+}
.list-empty{
diff --git a/pages/index/index.js b/pages/index/index.js
index c03e42c..1a469a5 100644
--- a/pages/index/index.js
+++ b/pages/index/index.js
@@ -22,6 +22,7 @@ Page({
userInfo:{},
userInfoTrigger:false,
summary:{},
+ orderSummary:{},
statusDetail:{
created:{
key:'CREATED',value:0,text:"待接单"
@@ -55,10 +56,7 @@ Page({
scrollViewHeight:windowInfo.windowHeight-windowInfo.statusBarHeight-44 - 125
});
- app.getUserInfo().then((data)=>{
- this.setData({
- userInfo:data
- });
+ this.getUserInfo().then(()=>{
return this.loadStatusDetail();
}).then((data)=>{
return this.loadBuilding();
@@ -71,20 +69,30 @@ Page({
});
});
},
- getUserInfo(){
- app.forceGetUserInfo().then((data)=>{
+ async getUserInfo(){
+ await app.forceGetUserInfo().then((data)=>{
this.setData({
userInfo:data,
userInfoTrigger:false
})
+ });
+ userApi.orderSummary().then((data)=>{
+ this.setData({
+ orderSummary:data
+ })
+ });
+ userApi.summary().then((data)=>{
+ this.setData({
+ summary:data
+ })
})
},
setStatus(event){
const status = event.currentTarget.dataset.item;
console.log(status);
//先不setData 让加载出来之后再设置
+ this.data.statusDetailKey = status.key.toLowerCase();
this.loadBuilding().then((data)=>{
- this.data.statusDetailKey = status.key.toLowerCase();
this.data.pager.pageIndex = 0;
this.data.pager.loadAll = false;
this.loadList();
@@ -109,8 +117,8 @@ Page({
},
async loadStatusDetail(){
const data = await orderApi.statusDetail(this.data.userInfo.community_id);
+ this.data.statusDetail.completed.value = 0;
data.map((item)=>{
- this.data.statusDetail.completed.value = 0;
if(item.status==this.data.orderStatus.unpaid||item.status==this.data.orderStatus.completed){
this.data.statusDetail.completed.value += item.count;
}else{
@@ -119,14 +127,19 @@ Page({
}
}
});
+ console.log(this.data.statusDetail);
this.setData({
statusDetail:this.data.statusDetail
})
},
async loadBuilding(){
const cid = this.data.userInfo.community_id;
- const status = this.data.statusDetailKey;
- const data = await orderApi.buildingList(cid,status);
+ const status = this.data.statusDetail[this.data.statusDetailKey];
+ let _status = status.key;
+ if(status.key==this.data.orderStatus.completed){
+ _status = `${this.data.orderStatus.unpaid},${this.data.orderStatus.completed}`;
+ }
+ const data = await orderApi.buildingList(cid,_status);
this.setData({
buildingList:data
});
@@ -146,7 +159,7 @@ Page({
if(this.data.statusDetailKey=='completed'){
params.status = `${this.data.orderStatus.unpaid},${this.data.orderStatus.completed}`
}else{
- params.status = this.data.statusDetailKey;
+ params.status = this.data.statusDetail[this.data.statusDetailKey].key;
}
orderApi.list(params).then((data)=>{
if(this.data.pager.pageIndex==0){
@@ -206,10 +219,6 @@ Page({
placeholderText:'请输入退款原因',
editable:true,
complete: (res) => {
- if (res.cancel) {
-
- }
-
if (res.confirm) {
}
@@ -219,6 +228,8 @@ Page({
chooseImage(){
wx.chooseMedia({
count:this.data.maxChooseImgCount - this.data.tempImgs.length,
+ mediaType:['image'],
+ sourceType:['camera'],
success:(res)=>{
console.log(res);
this.setData({
@@ -227,9 +238,10 @@ Page({
}
});
},
- navToOrderDetail(){
+ navToOrderDetail(event){
+ const id = event.currentTarget.dataset.id;
wx.navigateTo({
- url: '/pages/order-detail/index',
+ url: `/pages/order-detail/index?id=${id}`,
})
},
@@ -278,9 +290,11 @@ Page({
this.data.tempImgs.map((item)=>{
urls.push(item.serverUrl);
})
- console.log('uploadAndConfirmSend',urls);
- // return;
orderApi.complete(this.currentOrder.orderid,urls).then((data)=>{
+ this.setData({
+ isShowConfirm:false
+ })
+ this.refreshList();
wx.showToast({
icon:'success',
title: '订单已完成',
@@ -330,9 +344,14 @@ Page({
})
}
},
- navToUserInfo(){
- wx.navigateTo({
- url: '/pages/user/info/index',
+ logout(){
+ wx.removeStorage({
+ key: 'accessToken',
+ success(){
+ wx.redirectTo({
+ url: '/pages/login/index',
+ })
+ }
})
}
})
diff --git a/pages/index/index.wxml b/pages/index/index.wxml
index 2a71194..f531644 100644
--- a/pages/index/index.wxml
+++ b/pages/index/index.wxml
@@ -26,7 +26,7 @@
refresher-triggered="{{pager.refreshTrigger}}"
show-load-more="{{!(list.length==0&&pager.loadAll)}}"
loading="{{pager.loading}}" load-all="{{pager.loadAll}}">
-
@@ -34,7 +34,10 @@
{{pItem.pickup_codes.length}}件包裹:
-
+
@@ -117,35 +120,35 @@
总量订单
- {{summary.total}}
+ {{orderSummary.total_count}}
昨日订单
- {{summary.yesterday_total}}
+ {{orderSummary.yesterday_count}}
今日订单
- {{summary.today_total}}
+ {{orderSummary.today_count}}
-
+
{{summary.balance}}
-
+
-
+
{{summary.today_income}}
-
+
@@ -153,17 +156,17 @@
在线客服
-
+
修改密码
-
+
用户协议
-
+
diff --git a/pages/order-detail/index.js b/pages/order-detail/index.js
index 8f99607..c0938f2 100644
--- a/pages/order-detail/index.js
+++ b/pages/order-detail/index.js
@@ -1,21 +1,79 @@
-// pages/order-detail/index.js
+import orderApi from '../../api/order';
+import userApi from '../../api/user';
Page({
+
+ orderId:'',
/**
* 页面的初始数据
*/
data: {
+ orderDetail:{},
+ refreshTrigger:false,
+
+
+ orderStatus:orderApi.status,
+ orderStatusKV:orderApi.statusKV,
+
+ deliverStatusKV:orderApi.deliverStatusKV,
+
+ genderKV:userApi.genderKV,
+
+ orderStep:0,
+ scrollViewHeight:0
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
-
+ const windowInfo = wx.getWindowInfo();
+ this.setData({
+ scrollViewHeight:windowInfo.windowHeight
+ });
+ this.orderId = options.id;
+ this.getOrderDetail();
+ },
+ getOrderDetail(){
+ orderApi.detail(this.orderId).then((data)=>{
+ let orderStep = 0;
+ if(data.order.status==this.data.orderStatus.received){
+ orderStep = 1;
+ }else if(data.order.status==this.data.orderStatus.delivering){
+ orderStep = 2;
+ }else if(data.order.status==this.data.orderStatus.unpaid||data.order.status==this.data.orderStatus.completed){
+ orderStep = 3;
+ }
+ data.order.complete_time = this.formatTime(data.order.complete_time);
+ data.order.pickup_time = this.formatTime(data.order.pickup_time);
+ data.order.received_time = this.formatTime(data.order.received_time);
+ data.packages.map((item)=>{
+ item.pickup_codes = item.pickup_codes.split(',')
+ })
+ this.setData({
+ orderDetail:data,
+ refreshTrigger:false,
+ orderStep
+ })
+ }).catch(()=>{
+ this.setData({
+ refreshTrigger:false
+ })
+ })
},
copyOrderId(){
wx.setClipboardData({
- data: 'data',
+ data: this.data.orderDetail.order.orderid,
+ })
+ },
+ formatTime(time){
+ return (time||'').substr(5,11);
+ },
+ preview(event){
+ const current = event.currentTarget.dataset.url;
+ wx.previewImage({
+ current:current,
+ urls: this.data.orderDetail.order.complete_images,
})
},
/**
diff --git a/pages/order-detail/index.wxml b/pages/order-detail/index.wxml
index 259f157..67a06da 100644
--- a/pages/order-detail/index.wxml
+++ b/pages/order-detail/index.wxml
@@ -1,60 +1,73 @@
-
-
-
- 菜鸟驿站(丽晶公馆)
-
- 4件包裹:
-
-
+
+
+
+
+ {{item.station_name}}
+
+ {{item.pickup_codes.length}} 件包裹:
+
+
+
-
-
- 佳兆业丽晶公馆3栋2单元2702
- 冯先生:158****3822丨放在门口
-
-
-
-
-
- 接单
- 07-01 14:23
+
+
+ {{orderDetail.order.community_name}}
+ {{orderDetail.order.building_name}}
+ {{orderDetail.order.address_detail}}
+
+
+ {{orderDetail.order.address_name}}
+ {{genderKV[orderDetail.order.address_gender]}}:{{orderDetail.order.address_phone}}丨{{deliverStatusKV[orderDetail.order.delivery_method]}}
+
-
-
- 取货
- 07-01 14:23
+
+
+
+ 接单
+ {{orderDetail.order.received_time}}
+
+
+
+
+ 取货
+ {{orderDetail.order.pickup_time}}
+
+
+
+
+ 送达
+ {{orderDetail.order.complete_time}}
+
-
-
- 送达
- 07-01 14:23
+
+ 拍照留证
+
+
-
-
- 拍照留证
-
-
+
+
+
-
-
-
-
-
-
-
- 订单编号
- 2024071166325555
-
- 复制
+
+
+ 订单编号
+ {{orderDetail.order.orderid}}
+
+ 复制
+
+
+
+ 下单时间
+ {{orderDetail.order.create_time}}
-
- 下单时间
- 2024071166325555
-
-
+
+
diff --git a/pages/order-detail/index.wxss b/pages/order-detail/index.wxss
index a054ae5..f0b8287 100644
--- a/pages/order-detail/index.wxss
+++ b/pages/order-detail/index.wxss
@@ -55,6 +55,9 @@
}
.package-info .package .value{
flex:1;
+ display: flex;
+ flex-wrap: wrap;
+ gap: 16rpx;
}
.package-info .address{
diff --git a/pages/user/bank/editor/index.js b/pages/user/bank/editor/index.js
index a1aa05d..06fa3a1 100644
--- a/pages/user/bank/editor/index.js
+++ b/pages/user/bank/editor/index.js
@@ -1,11 +1,14 @@
-// pages/user/bank/editor/index.js
+import userApi from '../../../../api/user';
+
Page({
/**
* 页面的初始数据
*/
data: {
-
+ name:'',
+ bankName:'',
+ cardNumber:'',//16-19
},
/**
@@ -15,6 +18,22 @@ Page({
},
+ addCard(){
+ 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: '添加成功',
+ })
+ }
+ });
+ })
+ },
/**
* 生命周期函数--监听页面初次渲染完成
*/
diff --git a/pages/user/bank/editor/index.json b/pages/user/bank/editor/index.json
index 8835af0..419ed82 100644
--- a/pages/user/bank/editor/index.json
+++ b/pages/user/bank/editor/index.json
@@ -1,3 +1,4 @@
{
- "usingComponents": {}
+ "usingComponents": {},
+ "navigationBarTitleText": "添加银行卡"
}
\ No newline at end of file
diff --git a/pages/user/bank/editor/index.wxml b/pages/user/bank/editor/index.wxml
index 5d0fb0c..c6e8ca1 100644
--- a/pages/user/bank/editor/index.wxml
+++ b/pages/user/bank/editor/index.wxml
@@ -3,23 +3,23 @@
持卡姓名
-
+
开户银行
-
+
银行卡号
-
+
-
+
\ No newline at end of file
diff --git a/pages/user/bank/index/index.js b/pages/user/bank/index/index.js
index 1ede127..be40085 100644
--- a/pages/user/bank/index/index.js
+++ b/pages/user/bank/index/index.js
@@ -1,24 +1,44 @@
-// pages/user/bank/index/index.js
+import userApi from '../../../../api/user';
+
Page({
/**
* 页面的初始数据
*/
data: {
-
+ cardList:[],
+ listLoading:false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
-
},
navToAdd(){
wx.navigateTo({
url: '/pages/user/bank/editor/index',
})
},
+ deleteCard(event){
+ const card = event.currentTarget.dataset.item;
+ const endNumber = card.card_number.substr(card.card_number.length-4,card.card_number.length);
+ wx.showModal({
+ title: '是否确认删除此银行卡',
+ content: `尾号(${endNumber})`,
+ complete: (res) => {
+ if (res.confirm) {
+ userApi.cardList.delete(card.id).then((data)=>{
+ wx.showToast({
+ icon:'success',
+ title: '删除成功',
+ })
+ this.getCardList();
+ });
+ }
+ }
+ })
+ },
/**
* 生命周期函数--监听页面初次渲染完成
*/
@@ -30,7 +50,21 @@ Page({
* 生命周期函数--监听页面显示
*/
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
+ })
+ })
},
/**
diff --git a/pages/user/bank/index/index.wxml b/pages/user/bank/index/index.wxml
index 2ff767b..017b929 100644
--- a/pages/user/bank/index/index.wxml
+++ b/pages/user/bank/index/index.wxml
@@ -1,23 +1,27 @@
-
+
个人账户
-
+
- 中国工商银行
-
+ {{item.bank_name}}
+
持卡人
- 仙人模斗
+ {{item.name}}
银行卡号
- **** **** **** ***9 009
+ {{item.card_number}}
+
+
+ 暂无银行卡
+
\ No newline at end of file
diff --git a/pages/user/bank/index/index.wxss b/pages/user/bank/index/index.wxss
index dff8d57..a32cffd 100644
--- a/pages/user/bank/index/index.wxss
+++ b/pages/user/bank/index/index.wxss
@@ -5,12 +5,12 @@
padding:60rpx 30rpx;
}
-.title{
+.page-title{
font-size: 40rpx;
display: flex;
align-items: flex-end;
}
-.title .tag{
+.page-title .tag{
font-size: 24rpx;
background-color: rgba(255, 195, 0, 0.1);
padding:5rpx 8rpx;
@@ -62,4 +62,11 @@
.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;
}
\ No newline at end of file
diff --git a/pages/user/income/index.js b/pages/user/income/index.js
index 666342e..73305f8 100644
--- a/pages/user/income/index.js
+++ b/pages/user/income/index.js
@@ -7,16 +7,56 @@ Page({
* 页面的初始数据
*/
data: {
-
+ scrollViewHeight:0,
+ pager:{limit:10,loading:false,loadAll:false,pageIndex:0,refreshTrigger:false},
+ list:[]
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
- userApi.incomeList();
+ const windowInfo = wx.getWindowInfo();
+ this.setData({
+ scrollViewHeight:windowInfo.windowHeight
+ })
+ 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.incomeList().then((data)=>{
+ 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
-
-
- 订单编号6777跑腿收益
- 2024.10.10 12:15:51
+
+
+
+
+ {{item.description}}
+ {{item.create_time}}
+
+ {{item.amount}}
- 3.0
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/pages/user/income/index.wxss b/pages/user/income/index.wxss
index f5ca93c..d0722f0 100644
--- a/pages/user/income/index.wxss
+++ b/pages/user/income/index.wxss
@@ -17,4 +17,8 @@
.income-list .item .sub-title{
margin-top:32rpx;
color: #888888;
+}
+
+.income-list .item .money{
+ color:var(--main-color);
}
\ No newline at end of file
diff --git a/pages/user/info/index.js b/pages/user/info/index.js
index a592206..22bf1d2 100644
--- a/pages/user/info/index.js
+++ b/pages/user/info/index.js
@@ -15,7 +15,6 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad(options) {
- this.refreshSummary();
},
refreshSummary(){
@@ -37,7 +36,7 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow() {
-
+ this.refreshSummary();
},
/**
diff --git a/pages/user/info/index.wxml b/pages/user/info/index.wxml
index 35ec6f7..c6bf447 100644
--- a/pages/user/info/index.wxml
+++ b/pages/user/info/index.wxml
@@ -6,9 +6,9 @@
账户余额 (元)
{{summary.balance}}
- 今日收益(元) {{summary.today_total}}
+ 今日收益(元) {{summary.today_income}}
-
+
@@ -19,7 +19,7 @@
-
+
提现记录
diff --git a/pages/user/password/index.js b/pages/user/password/index.js
new file mode 100644
index 0000000..d0c0f64
--- /dev/null
+++ b/pages/user/password/index.js
@@ -0,0 +1,163 @@
+const app = getApp();
+import userApi from '../../../api/user';
+Page({
+
+ verifyCodeTimer:null,
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ phone:'',
+ verifyCode:'',
+ password:'',
+ rePassword:'',
+ codeLoading:false,
+ getCodeBtnText:'获取验证码',
+ waitingTime:app.verifyCodeWaitingTime,
+ modifyLoading:false
+ },
+ validator:{
+ verifyCode:[
+ {required:true,message:'请输入验证码'},
+ {length:6,message:'请输入 6 位数验证码'}
+ ],
+ password:{required:true,message:'请输入新密码'},
+ rePassword:{required:true,message:'请输入确认新密码'},
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad(options) {
+ app.getUserInfo().then((data)=>{
+ this.setData({
+ phone:data.phone
+ })
+ });
+ let time = wx.getStorageSync('password-verify-code-time');
+ if(time){
+ let remainTime = app.verifyCodeWaitingTime*1000 - ((new Date()).getTime() - time);
+ if(remainTime>0){
+ this.setData({
+ waitingTime:parseInt(remainTime/1000),
+ codeLoading:true
+ })
+ this.startTimer();
+ }else{
+ wx.removeStorageSync('password-verify-code-time')
+ }
+ }
+ },
+ getVerifyCode(){
+ if(this.data.codeLoading)return;
+ this.setData({
+ codeLoading:true
+ });
+ userApi.verifyCode(this.data.phone).then((data)=>{
+ this.setData({
+ getCodeBtnText:`${this.data.waitingTime}S`
+ });
+
+ const time = new Date();
+ wx.setStorageSync('password-verify-code-time', time.getTime());
+ this.startTimer();
+ })
+ },
+ startTimer(){
+ console.log(this.data.waitingTime);
+ if(this.data.waitingTime<=0){
+ this.setData({
+ codeLoading:false,
+ getCodeBtnText:'获取验证码',
+ waitingTime:app.verifyCodeWaitingTime
+ });
+ wx.removeStorageSync('password-verify-code-time')
+ }else{
+ this.setData({
+ getCodeBtnText:`${this.data.waitingTime--}S`
+ });
+ this.verifyCodeTimer = setTimeout(this.startTimer,1000);
+ }
+ },
+ save(){
+ if(this.data.modifyLoading)return;
+ const valid = app.validateForm(this.validator,this);
+ if(valid.length==0){
+ if(this.data.password==this.data.rePassword){
+ this.setData({
+ rePasswordMessage:''
+ });
+ this.setData({
+ modifyLoading:true
+ });
+ userApi.modifyPassword(this.data.rePassword,this.data.verifyCode).then((data)=>{
+ wx.navigateBack({
+ success(){
+ wx.showToast({
+ icon:'success',
+ title: '修改成功',
+ })
+ }
+ })
+ }).catch(()=>{
+ console.log(11111,'errro');
+ this.setData({
+ modifyLoading:false
+ })
+ })
+ }else{
+ this.setData({
+ rePasswordMessage:'两次密码不一致'
+ })
+ }
+ }
+ },
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady() {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow() {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面隐藏
+ */
+ onHide() {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面卸载
+ */
+ onUnload() {
+ clearTimeout(this.verifyCodeTimer);
+ },
+
+ /**
+ * 页面相关事件处理函数--监听用户下拉动作
+ */
+ onPullDownRefresh() {
+
+ },
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom() {
+
+ },
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage() {
+
+ }
+})
\ No newline at end of file
diff --git a/pages/user/password/index.json b/pages/user/password/index.json
new file mode 100644
index 0000000..7c6e72b
--- /dev/null
+++ b/pages/user/password/index.json
@@ -0,0 +1,4 @@
+{
+ "usingComponents": {},
+ "navigationBarTitleText": "修改密码"
+}
\ No newline at end of file
diff --git a/pages/user/password/index.wxml b/pages/user/password/index.wxml
new file mode 100644
index 0000000..cd0d43f
--- /dev/null
+++ b/pages/user/password/index.wxml
@@ -0,0 +1,34 @@
+
+
+ 手机号码
+ {{phone}}
+
+
+ 验证码
+
+
+ {{verifyCodeMessage}}
+
+
+
+
+
+
+ 新密码
+
+
+ {{passwordMessage}}
+
+
+
+ 确认新密码
+
+
+ {{rePasswordMessage}}
+
+
+
+
\ No newline at end of file
diff --git a/pages/user/password/index.wxss b/pages/user/password/index.wxss
new file mode 100644
index 0000000..4013f42
--- /dev/null
+++ b/pages/user/password/index.wxss
@@ -0,0 +1,15 @@
+.verify-btn{
+ font-weight: normal;
+}
+.verify-btn[disabled]{
+ background-color: #fff;
+ border: 2rpx solid var(--main-color);
+ color:var(--main-color)!important;
+}
+
+.cells .cell-hd{
+ width:155rpx;
+}
+.save-btn{
+ margin:60rpx 30rpx 30rpx!important;
+}
\ No newline at end of file
diff --git a/pages/user/rnAuth/index.js b/pages/user/rnAuth/index.js
index 6e7d1ef..43d102f 100644
--- a/pages/user/rnAuth/index.js
+++ b/pages/user/rnAuth/index.js
@@ -1,20 +1,38 @@
-// pages/user/rnAuth/index.js
+import user from '../../../api/user';
+import userApi from '../../../api/user';
+
Page({
/**
* 页面的初始数据
*/
data: {
-
+ name:'',
+ idCard:'',
+ already:false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
-
+ userApi.getRNAuth().then((data)=>{
+ if(data&&data.id_number){
+ this.setData({
+ name:data.name,
+ idCard:data.id_number,
+ already:true
+ })
+ }
+ });
},
+ save(){
+ userApi.setRNAuth({
+ name:this.data.name,
+ id_number:this.data.idCard
+ })
+ },
/**
* 生命周期函数--监听页面初次渲染完成
*/
diff --git a/pages/user/rnAuth/index.wxml b/pages/user/rnAuth/index.wxml
index 843c911..7dc32ec 100644
--- a/pages/user/rnAuth/index.wxml
+++ b/pages/user/rnAuth/index.wxml
@@ -3,16 +3,18 @@
真实姓名
-
+
+
身份证号
-
+
+
-
+
-
-
+
+
\ No newline at end of file
diff --git a/pages/withdraw/index/index.js b/pages/withdraw/index/index.js
index bce20f1..cfe3d8c 100644
--- a/pages/withdraw/index/index.js
+++ b/pages/withdraw/index/index.js
@@ -1,29 +1,88 @@
-// pages/withdraw/index.js
+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({
+ bankList:data
+ })
+ });
+ this.getSummary();
+ },
+ getSummary(){
+ app.forceGetSummary().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?'请添加银行卡':'请选择银行卡',
+ })
+ }
+ },
+ navToAddCard(){
wx.navigateTo({
- url: '/pages/withdraw/success/index',
+ url: '/pages/user/bank/editor/index',
})
},
/**
diff --git a/pages/withdraw/index/index.json b/pages/withdraw/index/index.json
index 8835af0..b7d6b8b 100644
--- a/pages/withdraw/index/index.json
+++ b/pages/withdraw/index/index.json
@@ -1,3 +1,4 @@
{
- "usingComponents": {}
+ "usingComponents": {},
+ "navigationBarTitleText": "账户提现"
}
\ No newline at end of file
diff --git a/pages/withdraw/index/index.wxml b/pages/withdraw/index/index.wxml
index 1adf5c2..180fef8 100644
--- a/pages/withdraw/index/index.wxml
+++ b/pages/withdraw/index/index.wxml
@@ -4,30 +4,26 @@
24小时到账
-
+
+ {{amountMessage}}
- 账户余额:4500.0
- 全部提现
+ 账户余额:{{summary.balance}}
+ 全部提现
提现方式
-
-