新增余额提现,余额充值功能

master
lemon橪 2021-06-28 18:04:17 +08:00
parent 5612636b29
commit 8239aad928
11 changed files with 555 additions and 225 deletions

View File

@ -1,22 +1,49 @@
import storage from "@/utils/storage"
import {http, Method} from '@/utils/request.js';
import storage from "@/utils/storage";
import { http, Method } from "@/utils/request.js";
/**
* 意见反馈
*/
export function feedBack(params) {
return http.request({
url: '/feedback',
url: "/feedback",
method: Method.POST,
needToken: true,
params,
});
}
// 提现
export function withdrawalApply(params) {
return http.request({
url: "/members/wallet/withdrawal",
method: Method.POST,
needToken: true,
params,
});
}
/**
* 支付结果查询
* @param orderType 交易类型,可用值:TRADE,ORDER,RECHARGE
* @param sn 订单编号
*/
export function payCallback(params) {
return http.request({
url: `/cashier/result`,
method: Method.GET,
params,
});
}
// 在线充值
export function recharge(params) {
return http.request({
url: "/trade/recharge",
method: Method.POST,
params,
});
}
/**
* 分页获取预存款充值记录
@ -44,16 +71,13 @@ import {http, Method} from '@/utils/request.js';
});
}
/**
* 获取优惠券列表
* @param params
*/
export function getCoupons(params) {
return http.request({
url: '/promotion/coupon/getCoupons',
url: "/promotion/coupon/getCoupons",
method: Method.GET,
needToken: true,
params,
@ -79,14 +103,13 @@ export function receiveCoupons(couponId) {
*/
export function getPointsData(params) {
return http.request({
url: 'member/memberPointsHistory/getByPage',
url: "member/memberPointsHistory/getByPage",
method: Method.GET,
needToken: true,
params,
});
}
/**
* 获取我的评论列表
* @param params
@ -94,7 +117,7 @@ export function getPointsData(params) {
*/
export function getComments(params) {
return http.request({
url: '/memberEvaluation',
url: "/memberEvaluation",
method: Method.GET,
needToken: true,
params,
@ -108,26 +131,23 @@ export function getComments(params) {
*/
export function getFootprintNum(params) {
return http.request({
url: '/footprint/getFootprintNum',
url: "/footprint/getFootprintNum",
method: Method.GET,
needToken: true,
params,
});
}
/**
* 订单评论
* @param params
*/
export function commentsMemberOrder(params) {
return http.request({
url: '/memberEvaluation',
url: "/memberEvaluation",
method: Method.POST,
needToken: true,
header:{'content-type':"application/x-www-form-urlencoded"},
header: { "content-type": "application/x-www-form-urlencoded" },
data: params,
});
}
@ -138,10 +158,10 @@ export function commentsMemberOrder(params) {
*/
export function AppendCommentsOrder(params) {
return http.request({
url: 'members/comments/additional',
url: "members/comments/additional",
method: Method.POST,
needToken: true,
header:{'content-type':"application/x-www-form-urlencoded"},
header: { "content-type": "application/x-www-form-urlencoded" },
data: params,
});
}
@ -154,14 +174,14 @@ export function AppendCommentsOrder(params) {
*/
export function consultating(goods_id, ask_content, anonymous) {
return http.request({
url: 'members/asks',
url: "members/asks",
method: Method.POST,
header:{'content-type':"application/x-www-form-urlencoded"},
header: { "content-type": "application/x-www-form-urlencoded" },
needToken: true,
data: {
goods_id,
ask_content,
anonymous
anonymous,
},
});
}
@ -182,8 +202,6 @@ export function getGoodsCollection(params,type) {
});
}
/**
* 收藏商品
* @returns {AxiosPromise}
@ -193,12 +211,9 @@ export function collectionGoods(id,type) {
url: `/member/collection/add/${type}/${id}`,
method: Method.POST,
needToken: true,
});
}
/**
* 删除商品收藏
* @param ids 收藏ID集合或单个商品ID
@ -206,7 +221,7 @@ export function collectionGoods(id,type) {
*/
export function deleteGoodsCollection(ids) {
if (Array.isArray(ids)) {
ids = ids.join(',');
ids = ids.join(",");
}
return http.request({
url: `/member/collection/delete/GOODS/${ids}`,
@ -228,7 +243,6 @@ export function getGoodsIsCollect(good_id,type) {
});
}
/**
* 收藏店铺
* @param store_id 店铺ID
@ -236,8 +250,8 @@ export function getGoodsIsCollect(good_id,type) {
*/
export function collectionStore(store_id) {
return http.request({
url: 'members/collection/store',
header:{'content-type':"application/x-www-form-urlencoded"},
url: "members/collection/store",
header: { "content-type": "application/x-www-form-urlencoded" },
method: Method.POST,
data: { store_id },
});
@ -255,14 +269,13 @@ export function deleteStoreCollection(store_id) {
});
}
/**
* 获取当前登录的用户信息
* @returns {AxiosPromise}
*/
export function getUserInfo() {
return http.request({
url: '/members',
url: "/members",
method: Method.GET,
needToken: true,
});
@ -274,7 +287,7 @@ export function deleteStoreCollection(store_id) {
*/
export function getUserWallet() {
return http.request({
url: '/members/wallet',
url: "/members/wallet",
method: Method.GET,
needToken: true,
});
@ -287,30 +300,27 @@ export function getUserWallet() {
*/
export function saveUserInfo(params) {
return http.request({
url: '/members/editOwn',
url: "/members/editOwn",
method: Method.PUT,
header:{'content-type':"application/x-www-form-urlencoded"},
header: { "content-type": "application/x-www-form-urlencoded" },
needToken: true,
data: params,
});
}
/**
* 添加发票
* @param params
*/
export function addReceipt(params) {
return http.request({
url: '/trade/receipt',
url: "/trade/receipt",
method: Method.POST,
needToken: true,
params,
});
}
/**
* 获取商品评论列表
* @param goodsId
@ -337,7 +347,6 @@ export function getGoodsCommentsCount(goodsId) {
});
}
/**
* 获取未读消息数量信息
*/
@ -345,8 +354,8 @@ export function getNoReadMessageNum() {
return http.request({
url: `members/member-nocice-logs/number`,
method: Method.GET,
needToken: true
})
needToken: true,
});
}
/**
@ -359,7 +368,7 @@ export function myTrackList(params) {
url: `/footprint`,
method: Method.GET,
needToken: true,
params
params,
});
}
@ -371,8 +380,8 @@ export function deleteHistoryListId(ids) {
return http.request({
url: `/footprint/delByIds/${ids}`,
method: Method.DELETE,
needToken: true
})
needToken: true,
});
}
/**
@ -384,8 +393,8 @@ export function getMemberCoupons(data) {
url: `/promotion/coupon/getCoupons`,
method: Method.GET,
needToken: true,
params:data
})
params: data,
});
}
/**
@ -396,8 +405,8 @@ export function getCouponsNum() {
return http.request({
url: `/promotion/coupon/getCouponsNum`,
method: Method.GET,
needToken: true
})
needToken: true,
});
}
/**
@ -407,6 +416,6 @@ export function getCouponsNum() {
export function getMemberPointSum() {
return http.request({
url: `member/memberPointsHistory/getMemberPointsHistoryVO`,
method: Method.GET
})
method: Method.GET,
});
}

View File

@ -168,7 +168,28 @@
{
"path": "deposit/index",
"style": {
"navigationBarTitleText": "预存款列表"
"navigationStyle": "custom"
}
},
{
"path": "deposit/operation",
"style": {
"navigationStyle": "custom"
}
},
{
"path": "deposit/recharge",
"style": {
"navigationBarTitleText": "充值金额"
}
},
{
"path": "deposit/withdrawal",
"style": {
"navigationBarTitleText": "提现金额"
}
},

View File

@ -45,7 +45,7 @@
</template>
<script>
import * as API_Trade from "@/api/trade";
import {payCallback} from '@/api/members'
export default {
data() {
return {
@ -71,6 +71,7 @@
walletValue: 0.0,
//
autoCancel: 0,
};
},
onLoad(val) {
@ -91,12 +92,23 @@
// h5appJSAPI
this.paymentClient = this.isWeiXin() ? "JSAPI" : "H5";
//#endif
//
},
onBackPress(e) {
if (e.from == "backbutton") {
if(this.routerVal.recharge_sn){
uni.switchTab({
url: '/pages/tabbar/user/my'
});
}
else{
uni.redirectTo({
url: "/pages/order/myOrder?status=0",
});
}
return true; //
}
},
@ -104,16 +116,28 @@
this.cashierData();
},
methods: {
navigateTo(url) {
/**
* 支付成功后跳转
*/
callback(paymentMethod){
uni.navigateTo({
url,
url: "/pages/cart/payment/success?paymentMethod=" +
paymentMethod +
"&payPrice=" +
this.cashierParams.price+
"&orderType="+this.orderType
});
},
//
/**
* 获取收银详情
*/
cashierData() {
let parms = {};
if (this.routerVal.recharge_sn) {
//
this.sn = this.routerVal.recharge_sn;
this.orderType = "RECHARGE";
} else if (this.routerVal.trade_sn) {
@ -136,8 +160,18 @@
});
// #endif
// #ifndef MP-WEIXIN
if(this.routerVal.recharge_sn){
this.payList = res.data.result.support.filter((item) => {
return item != "WALLET";
})
}
else{
this.payList = res.data.result.support;
}
// #endif
this.walletValue = res.data.result.walletValue;
this.autoCancel =
@ -154,6 +188,7 @@
//
async pay(payment) {
//
const sn = this.sn;
// |
@ -188,7 +223,6 @@
let payForm = signXml.data.result;
console.log(payForm)
let paymentType = paymentMethod === "WECHAT" ? "wxpay" : "alipay";
uni.requestPayment({
provider: paymentType,
@ -199,12 +233,10 @@
icon: "none",
title: "支付成功!",
});
uni.navigateTo({
url: "/pages/payment/success?paymentType=" +
paymentType +
"&payPrice=" +
this.cashierParams.price,
});
this.callback(paymentMethod)
},
fail: (e) => {
console.log(e);
@ -253,12 +285,8 @@
icon: "none",
title: "支付成功!",
});
uni.navigateTo({
url: "/pages/cart/payment/success?paymentMethod=" +
paymentMethod +
"&payPrice=" +
this.cashierParams.price,
});
this.callback(paymentMethod)
} else {
uni.showModal({
content: "支付失败,如果您已支付,请勿反复支付",
@ -276,12 +304,7 @@
icon: "none",
});
if (response.success) {
uni.navigateTo({
url: "/pages/cart/payment/success?paymentMethod=" +
paymentMethod +
"&payPrice=" +
this.cashierParams.price,
});
this.callback(paymentMethod)
}
}
}
@ -317,12 +340,8 @@
icon: "none",
title: "支付成功!",
});
uni.navigateTo({
url: "/pages/cart/payment/success?paymentMethod=" +
paymentType +
"&payPrice=" +
this.cashierParams.price,
});
this.callback(paymentMethod)
},
fail: (e) => {
console.log(e);
@ -338,12 +357,8 @@
icon: "none",
title: "支付成功!",
});
uni.navigateTo({
url: "/pages/cart/payment/success?paymentMethod=" +
paymentMethod +
"&payPrice=" +
this.cashierParams.price,
});
this.callback(paymentMethod)
}
}
);

View File

@ -2,10 +2,10 @@
<div class="wrapper">
<div class="pay-wrapper">
<div class="pay-money">
{{ payPrice | unitPrice }}
{{ Number(payPrice) | unitPrice }}
</div>
<div class="pay-btns">
<div v-show="!from" @click="navigateTo('/pages/order/myOrder?status=0')"></div>
<div v-show="!from" @click="checkOrder">{{this.orderType == "RECHARGE" ? '' : ''}}</div>
<div @click="navigateTo('/pages/tabbar/home/index', 'switch')">回到首页</div>
</div>
@ -88,11 +88,26 @@ export default {
onLoad(options) {
this.paymentMethod = options.paymentMethod || "";
this.from = options.from || "";
this.payPrice = parseInt(options.payPrice) || 0;
this.payPrice = options.payPrice || 0;
this.orderType = options.orderType;
//
this.initGoods();
},
methods: {
checkOrder() {
/**
* 查看订单
* 1.充值跳转到明细里面
* 2.支付跳转到订单详情
*/
if (this.orderType == "RECHARGE") {
uni.reLaunch({
url: `/pages/mine/deposit/operation`
})
} else {
this.navigateTo("/pages/order/myOrder?status=0");
}
},
changeStatus(val) {
if (val) {
this.sendMessage();

View File

@ -1,14 +1,17 @@
<template>
<view class="wap">
<u-navbar back-text="" title="预存款列表">
</u-navbar>
<view class="wrapper-show-money">
<view class="money-view">
<h3>预存款金额 </h3>
<view class="money">{{walletNum | unitPrice }}</view>
</view>
</view>
<view class="wrapper-tabs">
<swiper class="swiper-box" @change="changeSwiper" :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish">
<swiper class="swiper-box" :current="swiperCurrent">
<swiper-item class="swiper-item" v-for="index in list.length" :key="index">
<scroll-view class="scroll-v view-wrapper" enableBackToTop="true" scroll-with-animation scroll-y @scrolltolower="loadMore">
<view v-if="datas.length!=0" class="view-item" v-for="(logItem, logIndex) in datas" :key="logIndex">
@ -37,7 +40,6 @@
<script>
import { getUserRecharge, getWalletLog } from "@/api/members";
import storage from "@/utils/storage.js";
import { getUserWallet } from "@/api/members";
export default {
data() {
@ -77,6 +79,7 @@ export default {
this.walletNum = result.data.result.memberWallet;
},
methods: {
/**分页获取预存款充值记录 */
getRecharge() {
this.status = "loading";
@ -105,10 +108,7 @@ export default {
});
},
// swiper
changeSwiper() {
this.groupBuy = [];
},
changed(index) {
this.datas = [];
this.swiperCurrent = index;
@ -121,19 +121,6 @@ export default {
}
},
// swiper-itemtabs
transition({ detail: { dx } }) {
this.$refs.tabs.setDx(dx);
},
// swiperswiperdx
// swipertabsswiper
animationfinish(e) {
// this.groupBuy = []
let current = e.detail.current;
this.$refs.tabs.setFinishCurrent(current);
this.swiperCurrent = current;
this.current = current;
},
loadMore() {
this.params.pageNumber++;
this.getWallet();
@ -184,9 +171,12 @@ export default {
margin: 0 auto;
height: 90rpx;
}
.wap {
}
.operation {
font-size: 32rpx;
margin-right: 24rpx;
color: rgb(96, 98, 102);
}
.money {
font-size: 40rpx;
font-weight: bold;

View File

@ -0,0 +1,110 @@
<template>
<div class="wrapper">
<u-navbar :custom-back="back" title="余额"></u-navbar>
<div class="box">
<div class="deposit">预存款金额</div>
<div class="money">{{walletNum | unitPrice }}</div>
<div class="operation-btns">
<div class="operation-btn light" @click="navgition('/pages/mine/deposit/withdrawal')"></div>
<div class="operation-btn" @click="navgition('/pages/mine/deposit/recharge')"></div>
</div>
</div>
<div class="box list" @click="navgition('/pages/mine/deposit/index')">
<div class="list-left">预存款明细</div>
<div class="list-right">
<u-icon name="arrow-right"></u-icon>
</div>
</div>
</div>
</template>
<script>
import { getUserWallet } from "@/api/members";
export default {
data() {
return {
walletNum: 0,
};
},
async mounted() {
let result = await getUserWallet(); //
this.walletNum = result.data.result.memberWallet;
},
methods: {
back() {
uni.switchTab({
url: "/pages/tabbar/user/my",
});
},
/**
* 跳转
*/
navgition(url) {
uni.navigateTo({
url,
});
},
},
};
</script>
<style lang="scss" scoped>
.list {
display: flex;
justify-content: center;
align-items: center;
}
.list-left {
flex: 8;
}
.list-right {
flex: 2;
text-align: right;
}
.wrapper {
width: 94%;
margin: 0 3%;
}
.box {
margin: 20rpx 0;
background: #fff;
border-radius: 20rpx;
padding: 40rpx;
}
.operation-btns {
display: flex;
justify-content: center;
align-items: center;
}
.money {
text-align: center;
color: #333;
font-size: 50rpx;
margin: 20rpx 0 40rpx 0;
letter-spacing: 2rpx;
}
.deposit {
margin-top: 50rpx;
text-align: center;
color: #999;
font-size: 28rpx;
letter-spacing: 2rpx;
}
.operation-btn {
background: #ee6d41;
color: #fff;
height: 90rpx;
width: 240rpx;
margin: 0 20rpx;
border-radius: 10rpx;
text-align: center;
line-height: 90rpx;
font-size: 32rpx;
}
.light {
background: #fdf2ee;
color: #ee6d41;
}
</style>

View File

@ -0,0 +1,50 @@
<template>
<view>
<view class="-list">
<view class="title">充值金额</view>
<view class="content">
<view class="price">
<span> </span>
<u-input v-model="price" placeholder="" type="number" />
</view>
</view>
</view>
<view class="submit" :class="{'light':flag}" @click="handlerRecharge"></view>
</view>
</template>
<script>
import { recharge } from "@/api/members";
export default {
data() {
return {
price: 0,
flag: true,
};
},
watch: {
price(val) {
val <= 0 ? (this.flag = true) : (this.flag = false);
},
},
mounted() {},
methods: {
//
async handlerRecharge() {
if (this.price > 0) {
let res = await recharge({ price: this.price });
if (res.data.success) {
uni.navigateTo({
url: `/pages/cart/payment/payOrder?orderType=RECHARGE&recharge_sn=${res.data.result.rechargeSn}`,
});
}
}
},
},
};
</script>
<style lang="scss" scoped>
@import './style.scss';
</style>

View File

@ -0,0 +1,46 @@
/deep/ .u-input__input,
.u-input {
font-size: 80rpx !important;
height: 102rpx !important;
}
/deep/ .u-input__input {
height: 100%;
font-size: 80rpx;
}
.content {
display: flex;
> .price {
width: 60%;
margin: 20rpx 0;
font-size: 80rpx;
display: flex;
}
> .all {
justify-content: center;
width: 40%;
display: flex;
flex-direction: column;
align-items: flex-end;
}
}
.-list {
margin: 20rpx 0;
background: #fff;
padding: 16rpx 32rpx;
}
.title {
font-size: 35rpx;
}
.light {
opacity: 0.6;
}
.submit {
margin: 80rpx auto;
width: 94%;
background: $light-color;
height: 90rpx;
color: #fff;
border-radius: 10rpx;
text-align: center;
line-height: 90rpx;
}

View File

@ -0,0 +1,70 @@
<template>
<view>
<view class="-list">
<view class="title">提现金额</view>
<view class="content">
<view class="price">
<span> </span>
<u-input v-model="price" placeholder="" type="number" />
</view>
<view class="all">
<view @click="handleAll" :style="{ color: $mainColor }">全部</view>
<view style="font-size: 24rpx; color: #999">可提现金额<span>{{ walletNum | unitPrice }}</span></view>
</view>
</view>
</view>
<view class="submit" @click="cashd"></view>
</view>
</template>
<script>
import { getUserWallet,withdrawalApply } from "@/api/members";
export default {
data() {
return {
price: 0,
walletNum: 0,
};
},
async mounted() {
let result = await getUserWallet(); //
this.walletNum = result.data.result.memberWallet;
},
methods: {
cashd() {
this.price = this.price + "";
if (this.$u.test.amount(parseInt(this.price))) {
withdrawalApply({ price: this.price }).then((res) => {
if (res.data.success) {
uni.showToast({
title: "提现成功!",
duration: 2000,
icon: "none",
});
setTimeout(() => {
uni.navigateBack({
delta: 1,
});
}, 1000);
}
});
} else {
uni.showToast({
title: "请输入正确金额",
duration: 2000,
icon: "none",
});
}
},
handleAll() {
this.price = this.walletNum;
},
},
};
</script>
<style lang="scss" scoped>
@import "./style.scss";
</style>

View File

@ -90,7 +90,8 @@ export default {
uni.showLoading({
title: "正在获取验证码",
});
sendMobile(this.codeForm.mobile).then((res) => {
sendMobile(this.codeForm.mobile)
.then((res) => {
uni.hideLoading();
// this.start()
if (res.data.success) {
@ -102,6 +103,9 @@ export default {
icon: "none",
});
}
})
.catch((e) => {
this.$refs.uCode.start();
});
} else {
this.$u.toast("请倒计时结束后再发送");

View File

@ -20,7 +20,7 @@
<!-- 积分优惠券关注 -->
<div class="pointBox">
<u-row text-align="center" gutter="16" class="point">
<u-col text-align="center" span="4" @click="navigateTo('/pages/mine/deposit/index')">
<u-col text-align="center" span="4" @click="navigateTo('/pages/mine/deposit/operation')">
<view>预存款</view>
<view class="money">{{ walletNum | unitPrice}}</view>
</u-col>