70 lines
2.0 KiB
JavaScript
70 lines
2.0 KiB
JavaScript
import request from './request';
|
|
let app = getApp();
|
|
|
|
export default {
|
|
genderKV:{
|
|
MALE:'先生',FEMALE:'女士'
|
|
},
|
|
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',{},{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:(data)=>request.get('/api/withdraw/user',data),
|
|
statusKV:{
|
|
PENDING:"提现审核中",APPROVED:"平台受理成功",REJECTED:"审核未通过"
|
|
}
|
|
},
|
|
|
|
uploadImg(file,progress){
|
|
if(!app)app = getApp();
|
|
return new Promise((rs,rj)=>{
|
|
const task = wx.uploadFile({
|
|
filePath: file.tempFilePath,
|
|
name: 'file',
|
|
header:{
|
|
Authorization: `Bearer ${app?.globalData?.accessToken}`
|
|
},
|
|
url: request.baseUrl+'/api/upload/image',
|
|
success:(res)=>{
|
|
const response = JSON.parse(res.data);
|
|
rs(response.data);
|
|
},
|
|
fail:(res)=>{
|
|
rj(res);
|
|
}
|
|
});
|
|
if(progress){
|
|
progress.task = task;
|
|
task.onProgressUpdate(progress);
|
|
}
|
|
});
|
|
},
|
|
downloadFile(url,filePath){
|
|
return new Promise((rs,rj)=>{
|
|
wx.downloadFile({
|
|
url: url,
|
|
filePath: filePath,
|
|
success: (result) => {
|
|
rs()
|
|
},
|
|
fail: (res) => {
|
|
rj()
|
|
}
|
|
})
|
|
})
|
|
}
|
|
} |