Merge branch 'master-vue3' of https://gitee.com/huizhizao/yudao-mall-uniapp into master-vue3

# Conflicts:
#	sheep/request/index.js
#	sheep/request2/index.js
This commit is contained in:
YunaiV
2023-12-25 23:47:50 +08:00
19 changed files with 4394 additions and 2266 deletions
+702 -673
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
+372
View File
@@ -0,0 +1,372 @@
<template>
<s-layout title='砍价列表'>
<view style='background-color: red;height:100vh;'>
<view class='bargain-list'>
<!-- #ifdef H5 -->
<view class='iconfont icon-xiangzuo' @tap='goBack' :style="'top:'+ (state.navH/2) +'rpx'"
v-if="state.returnShow">
</view>
<!-- #endif -->
<!-- 砍价记录的概要 -->
<view class='header'>
<view class="pic">
<view class='swipers'>
<swiper :indicator-dots="state.indicatorDots" :autoplay="state.autoplay" interval="2500"
duration="500" vertical="true" circular="true">
<block v-for="(item,index) in state.bargainSuccessList" :key='index'>
<swiper-item>
<view class="acea-row row-middle" style='display:flex'>
<image :src="item.avatar" class="mr9"></image>
<view class='mr9 nickName'>{{ item.nickname }}</view>
<text class='mr9'>拿了</text>
<view class='line1'>{{ item.activityName }}</view>
</view>
</swiper-item>
</block>
</swiper>
</view>
</view>
<view class="tit">已有{{ state.bargainTotal }}人砍成功</view>
</view>
<!-- 砍价活动列表 -->
<view class='list'>
<block v-for="(item,index) in state.bargainList" :key="index">
<view style='display:flex' class='item acea-row row-between-wrapper'
@tap="openSubscribe('/pages/activity/bargainingDetail?id='+ item.id)">
<view class='pictrue'>
<image :src='item.picUrl'></image>
</view>
<view class='text acea-row row-column-around'>
<view class='name line2'>{{ item.name }}</view>
<view class="acea-row" style="margin-bottom: 14rpx;display:flex">
<s-count-down :tipText="' '" :bgColor="state.bgColor" :dayText="':'" :hourText="':'"
:minuteText="':'" :secondText="' '" :datatime="item.endTime / 1000"
:isDay="true" />
<text class="txt">后结束</text>
</view>
<view v-if="item.stock === 0">
<view style="font-size: 22rpx;"
@tap="openSubscribe('/pages/activity/goods_bargain_details/index?id='+ item.id +'&startBargainUid='+ uid)">
已售罄</view>
</view>
<view class='money font-color'>最低: <text
class='price'>{{ fen2yuan(item.bargainMinPrice) }}</text></view>
</view>
<view v-if="item.stock > 0" class='cutBnt bg-color'>参与砍价</view>
<view v-if="item.stock === 0" class='cutBnt bg-color-hui'>已售罄</view>
</view>
</block>
<view class='loadingicon acea-row row-center-wrapper' v-if='state.bargainList.length > 0'
style='text-align: center;'>
<text class='loading iconfont icon-jiazai' :hidden='!loading'></text>{{state.loadTitle}}
</view>
</view>
</view>
</view>
</s-layout>
</template>
<script setup>
import {
computed,
reactive
} from 'vue';
import sheep from '@/sheep';
import _ from 'lodash';
import {
onLoad,
onReachBottom
} from '@dcloudio/uni-app';
import {
useDurationTime
} from '@/sheep/hooks/useGoods';
import {
showShareModal
} from '@/sheep/hooks/useModal';
import {
isEmpty
} from 'lodash';
const state = reactive({
navH: '',
returnShow: true,
// ========== 砍价记录概要的相关变量 ==========
bargainTotal: 0,
bargainSuccessList: [],
autoplay: true,
indicatorDots: false,
// ========== 砍价活动的相关变量 ==========
bargainList: [],
page: 1,
limit: 10,
loading: false,
loadend: false,
bgColor: {
'bgColor': '#E93323',
'Color': '#fff',
'width': '44rpx',
'timeTxtwidth': '16rpx',
'isDay': true
},
loadTitle: '加载更多',
});
function getBargainHeader() {
sheep.$api.activity.getBargainRecordSummary().then(res => {
state.bargainTotal = res.data.successUserCount;
state.bargainSuccessList = res.data.successList;
}).catch(err => {
return state.$util.Tips({
title: err
});
})
}
function getBargainList() {
if (state.loadend || state.loading) {
return;
}
state.loading = true;
state.loadTitle = '';
sheep.$api.activity.getBargainActivityPage({
pageNo: state.page,
pageSize: state.limit
}).then(res => {
const list = res.data.list;
const bargainList = _.concat(state.bargainList, list);
const loadend = list.length < state.limit;
state.loadend = loadend;
state.loading = false;
state.loadTitle = loadend ? '已全部加载' : '加载更多';
// this.$set(this, 'bargainList', bargainList);
state.bargainList = res.data.list
// this.$set(this, 'page', this.page + 1);
state.page = state.page + 1;
}).catch(res => {
state.loading = false;
state.loadTitle = '加载更多';
});
}
function openSubscribe(e) {
console.log(e)
uni.navigateTo({
url: page,
});
return;
let page = e;
// #ifndef MP
uni.navigateTo({
url: page
});
// #endif
// #ifdef MP
uni.showLoading({
title: '正在加载',
})
openBargainSubscribe().then(res => {
uni.hideLoading();
}).catch((err) => {
uni.hideLoading();
});
// #endif
}
onLoad(function() {
getBargainHeader();
getBargainList();
})
onReachBottom(() => {
getBargainList();
});
// 工具函数
function fen2yuan(price) {
return (price / 100.0).toFixed(2)
}
</script>
<style lang='scss' scoped>
page,
.page-app {
background-color: #e93323 !important;
}
.font-color {
color: red;
}
.mr9 {
margin-right: 9rpx;
}
.swipers {
height: 100%;
width: 76%;
margin: auto;
overflow: hidden;
font-size: 22rpx;
color: #fff;
image {
width: 24rpx;
height: 24rpx;
border-radius: 50%;
overflow: hidden;
}
swiper {
height: 100%;
width: 100%;
overflow: hidden;
}
.line1 {
width: 195rpx;
}
}
.bargain-list .icon-xiangzuo {
font-size: 40rpx;
color: #fff;
position: fixed;
left: 30rpx;
z-index: 99;
transform: translateY(-20%);
height: 100%
}
.bargain-list .header {
/* TODO 芋艿:此处原来采用base64 但是过长编辑到小程序卡死 目前采用网络地址 需解决 */
background-image: url('https://huizhizao-1314830814.cos.ap-shanghai.myqcloud.com/huizhizao-1314830814/bdc8a9210710b83bcd88a14703f440fc7091792706b5cb71b54361488a547298.png');
babackground-repeat: no-repeat;
background-size: 100% 100%;
width: 750rpx;
height: 420rpx;
.acea-row {
height: 50rpx;
line-height: 50rpx;
left: 50rpx;
.nickName {
width: 65rpx;
overflow: hidden;
white-space: nowrap;
}
}
.pic {
width: 478rpx;
height: 50rpx;
margin: 0 auto;
/* TODO 芋艿:此处原来是本地地址小程序不支持,需改为线上 */
background-image: url('https://huizhizao-1314830814.cos.ap-shanghai.myqcloud.com/huizhizao-1314830814/d111ac53e1390618f22fcc03e415bcd584b3f409ae52421aef95c2ab9b02aa30.png');
babackground-repeat: no-repeat;
background-size: 100% 100%;
}
.tit {
color: #FFFFFF;
font-size: 24rpx;
font-weight: 400;
text-align: center;
margin-top: 304rpx;
}
}
.bargain-list .list {
padding: 0 30rpx;
}
.bargain-list .list .item {
position: relative;
height: 250rpx;
background-color: #fff;
border-radius: 14rpx;
margin-bottom: 20rpx;
padding: 30rpx 25rpx;
}
.bargain-list .list .item .pictrue {
width: 190rpx;
height: 190rpx;
}
.bargain-list .list .item .pictrue image {
width: 100%;
height: 100%;
border-radius: 14rpx;
}
.bargain-list .list .item .text {
width: 432rpx;
font-size: 28rpx;
color: #333333;
.txt {
font-size: 22rpx;
margin-left: 4rpx;
color: #666666;
line-height: 36rpx;
}
}
.bargain-list .list .item .text .name {
width: 100%;
height: 68rpx;
line-height: 36rpx;
font-size: 28rpx;
margin-bottom: 26rpx;
}
.bargain-list .list .item .text .num {
font-size: 26rpx;
color: #999;
}
.bargain-list .list .item .text .num .iconfont {
font-size: 35rpx;
margin-right: 7rpx;
}
.bargain-list .list .item .text .money {
font-size: 24rpx;
font-weight: bold;
}
.bargain-list .list .item .text .money .price {
font-size: 38rpx;
}
.bargain-list .list .item .cutBnt {
position: absolute;
width: 162rpx;
height: 52rpx;
border-radius: 50rpx;
font-size: 24rpx;
color: #fff;
text-align: center;
line-height: 52rpx;
right: 24rpx;
bottom: 30rpx;
background: linear-gradient(90deg, #FF7931 0%, #E93323 100%);
}
.bargain-list .list .item .cutBnt .iconfont {
margin-right: 8rpx;
font-size: 30rpx;
}
.bargain-list .list .load {
font-size: 24rpx;
height: 85rpx;
text-align: center;
line-height: 85rpx;
}
</style>
File diff suppressed because one or more lines are too long
+157 -167
View File
@@ -1,184 +1,174 @@
<!-- 分销明细 -->
<template>
<view class="distribution-log-wrap">
<view class="header-box">
<image class="header-bg" :src="sheep.$url.static('/static/img/shop/commission/title2.png')" />
<view class="ss-flex header-title">
<view class="title">实时动态</view>
<text class="cicon-forward"></text>
</view>
</view>
<scroll-view
scroll-y="true"
@scrolltolower="loadmore"
class="scroll-box log-scroll"
scroll-with-animation="true"
>
<view v-if="state.pagination.data">
<view
class="log-item-box ss-flex ss-row-between"
v-for="item in state.pagination.data"
:key="item.id"
>
<view class="log-item-wrap">
<view class="log-item ss-flex ss-ellipsis-1 ss-col-center">
<view class="ss-flex ss-col-center">
<image
v-if="item.oper_type === 'user'"
class="log-img"
:src="sheep.$url.cdn(item.oper?.avatar)"
mode="aspectFill"
></image>
<image
v-else-if="item.oper_type === 'admin'"
class="log-img"
:src="sheep.$url.static('/static/img/shop/avatar/default_user.png')"
mode="aspectFill"
></image>
<image
v-else
class="log-img"
:src="sheep.$url.static('/static/img/shop/avatar/notice.png')"
mode="aspectFill"
></image>
</view>
<view class="log-text ss-ellipsis-1">{{ item.remark }}</view>
</view>
</view>
<text class="log-time">{{ dayjs(item.create_time).fromNow() }}</text>
</view>
</view>
<view class="distribution-log-wrap">
<view class="header-box">
<image class="header-bg" :src="sheep.$url.static('/static/img/shop/commission/title2.png')" />
<view class="ss-flex header-title">
<view class="title">实时动态</view>
<text class="cicon-forward"></text>
</view>
</view>
<scroll-view scroll-y="true" @scrolltolower="loadmore" class="scroll-box log-scroll"
scroll-with-animation="true">
<view v-if="state.pagination.data">
<view class="log-item-box ss-flex ss-row-between" v-for="item in state.pagination.data" :key="item.id">
<view class="log-item-wrap">
<view class="log-item ss-flex ss-ellipsis-1 ss-col-center">
<view class="ss-flex ss-col-center">
<image v-if="item.oper_type === 'user'" class="log-img"
:src="sheep.$url.cdn(item.oper?.avatar)" mode="aspectFill"></image>
<image v-else-if="item.oper_type === 'admin'" class="log-img"
:src="sheep.$url.static('/static/img/shop/avatar/default_user.png')"
mode="aspectFill"></image>
<image v-else class="log-img"
:src="sheep.$url.static('/static/img/shop/avatar/notice.png')" mode="aspectFill">
</image>
</view>
<view class="log-text ss-ellipsis-1">{{ item.title }} {{item.price/100}}</view>
</view>
</view>
<text class="log-time">{{ dayjs(item.createTime).fromNow() }}</text>
</view>
</view>
<!-- 加载更多 -->
<uni-load-more
v-if="state.pagination.total > 0"
:status="state.loadStatus"
color="#333333"
@tap="loadmore"
/>
</scroll-view>
</view>
<!-- 加载更多 -->
<uni-load-more v-if="state.pagination.total > 0" :status="state.loadStatus" color="#333333"
@tap="loadmore" />
</scroll-view>
</view>
</template>
<script setup>
import sheep from '@/sheep';
import { computed, reactive } from 'vue';
import _ from 'lodash';
import dayjs from 'dayjs';
import sheep from '@/sheep';
import {
computed,
reactive
} from 'vue';
import _ from 'lodash';
import dayjs from 'dayjs';
const state = reactive({
loadStatus: '',
pagination: {
data: [],
current_page: 1,
total: 1,
last_page: 1,
},
});
const state = reactive({
loadStatus: '',
pagination: {
data: [],
current_page: 1,
total: 1,
last_page: 1,
},
});
async function getLog(page = 1) {
const res = await sheep.$api.commission.log({
page,
});
if (res.error === 0) {
let list = _.concat(state.pagination.data, res.data.data);
state.pagination = {
...res.data,
data: list,
};
if (state.pagination.current_page < state.pagination.last_page) {
state.loadStatus = 'more';
} else {
state.loadStatus = 'noMore';
}
}
}
getLog();
async function getLog(page = 1) {
state.pagination.current_page = page
const res = await sheep.$api.commission.order({
page,
});
console.log(res, '下面的数据')
if (res.code === 0) {
let list = _.concat(state.pagination.data, res.data.list);
state.pagination = {
...res.data,
data: list,
};
if (state.pagination.data.length < state.pagination.total) {
state.loadStatus = 'more';
} else {
state.loadStatus = 'noMore';
}
}
}
getLog();
// 加载更多
function loadmore() {
if (state.loadStatus !== 'noMore') {
getLog(state.pagination.current_page + 1);
}
}
// 加载更多
function loadmore() {
if (state.loadStatus !== 'noMore') {
getLog(state.pagination.current_page + 1);
}
}
</script>
<style lang="scss" scoped>
.distribution-log-wrap {
width: 690rpx;
margin: 0 auto;
margin-bottom: 20rpx;
border-radius: 12rpx;
z-index: 3;
position: relative;
.header-box {
width: 690rpx;
height: 76rpx;
position: relative;
.header-bg {
width: 690rpx;
height: 76rpx;
}
.header-title {
position: absolute;
left: 20rpx;
top: 24rpx;
}
.title {
font-size: 28rpx;
font-weight: 500;
color: #ffffff;
line-height: 30rpx;
}
.cicon-forward {
font-size: 30rpx;
font-weight: 400;
color: #ffffff;
line-height: 30rpx;
}
}
.log-scroll {
height: 600rpx;
background: #fdfae9;
padding: 10rpx 20rpx 0;
box-sizing: border-box;
border-radius: 0 0 12rpx 12rpx;
.distribution-log-wrap {
width: 690rpx;
margin: 0 auto;
margin-bottom: 20rpx;
border-radius: 12rpx;
z-index: 3;
position: relative;
.log-item-box {
margin-bottom: 20rpx;
.log-time {
// margin-left: 30rpx;
text-align: right;
font-size: 24rpx;
font-family: OPPOSANS;
font-weight: 400;
color: #c4c4c4;
}
}
.header-box {
width: 690rpx;
height: 76rpx;
position: relative;
.loadmore-wrap {
// line-height: 80rpx;
}
.header-bg {
width: 690rpx;
height: 76rpx;
}
.log-item {
// background: rgba(#ffffff, 0.2);
border-radius: 24rpx;
padding: 6rpx 20rpx 6rpx 12rpx;
.header-title {
position: absolute;
left: 20rpx;
top: 24rpx;
}
.log-img {
width: 40rpx;
height: 40rpx;
border-radius: 50%;
margin-right: 10rpx;
}
.title {
font-size: 28rpx;
font-weight: 500;
color: #ffffff;
line-height: 30rpx;
}
.log-text {
max-width: 480rpx;
font-size: 24rpx;
font-weight: 500;
color: #333333;
}
}
}
}
</style>
.cicon-forward {
font-size: 30rpx;
font-weight: 400;
color: #ffffff;
line-height: 30rpx;
}
}
.log-scroll {
height: 600rpx;
background: #fdfae9;
padding: 10rpx 20rpx 0;
box-sizing: border-box;
border-radius: 0 0 12rpx 12rpx;
.log-item-box {
margin-bottom: 20rpx;
.log-time {
// margin-left: 30rpx;
text-align: right;
font-size: 24rpx;
font-family: OPPOSANS;
font-weight: 400;
color: #c4c4c4;
}
}
.loadmore-wrap {
// line-height: 80rpx;
}
.log-item {
// background: rgba(#ffffff, 0.2);
border-radius: 24rpx;
padding: 6rpx 20rpx 6rpx 12rpx;
.log-img {
width: 40rpx;
height: 40rpx;
border-radius: 50%;
margin-right: 10rpx;
}
.log-text {
max-width: 480rpx;
font-size: 24rpx;
font-weight: 500;
color: #333333;
}
}
}
}
</style>
+135 -124
View File
@@ -1,30 +1,22 @@
<!-- 分销商菜单栏 -->
<template>
<view class="menu-box ss-flex-col">
<view class="header-box">
<image class="header-bg" :src="sheep.$url.static('/static/img/shop/commission/title1.png')" />
<view class="ss-flex header-title">
<view class="title">功能专区</view>
<text class="cicon-forward"></text>
</view>
</view>
<view class="menu-list ss-flex ss-flex-wrap">
<view
v-for="(item, index) in state.menuList"
:key="index"
class="item-box ss-flex-col ss-col-center"
@tap="sheep.$router.go(item.path)"
>
<image
class="menu-icon ss-m-b-10"
:src="sheep.$url.static(item.img)"
mode="aspectFill"
></image>
<view>{{ item.title }}</view>
</view>
</view>
<view class="menu-box ss-flex-col">
<view class="header-box">
<image class="header-bg" :src="sheep.$url.static('/static/img/shop/commission/title1.png')" />
<view class="ss-flex header-title">
<view class="title">功能专区</view>
<text class="cicon-forward"></text>
</view>
</view>
<view class="menu-list ss-flex ss-flex-wrap">
<view v-for="(item, index) in state.menuList" :key="index" class="item-box ss-flex-col ss-col-center"
@tap="sheep.$router.go(item.path)">
<image class="menu-icon ss-m-b-10" :src="sheep.$url.static(item.img)" mode="aspectFill"></image>
<view>{{ item.title }}</view>
</view>
</view>
<!-- <uni-grid :column="4" :showBorder="false" :highlight="false">
<!-- <uni-grid :column="4" :showBorder="false" :highlight="false">
<uni-grid-item
v-for="(item, index) in state.menuList"
:index="index"
@@ -41,113 +33,132 @@
</view>
</uni-grid-item>
</uni-grid> -->
</view>
</view>
</template>
<script setup>
import sheep from '@/sheep';
import { onLoad } from '@dcloudio/uni-app';
import { computed, reactive } from 'vue';
import sheep from '@/sheep';
import {
onLoad
} from '@dcloudio/uni-app';
import {
computed,
reactive
} from 'vue';
const state = reactive({
menuList: [
{
img: '/static/img/shop/commission/commission_icon1.png',
title: '我的团队',
path: '/pages/commission/team',
},
{
img: '/static/img/shop/commission/commission_icon2.png',
title: '佣金明细',
path: '/pages/user/wallet/commission',
},
{
img: '/static/img/shop/commission/commission_icon3.png',
title: '分销订单',
path: '/pages/commission/order',
},
{
img: '/static/img/shop/commission/commission_icon4.png',
title: '推广商品',
path: '/pages/commission/goods',
},
{
img: '/static/img/shop/commission/commission_icon5.png',
title: '我的资料',
path: '/pages/commission/apply',
isAgentFrom: true,
},
{
img: '/static/img/shop/commission/commission_icon7.png',
title: '邀请海报',
path: 'action:showShareModal',
},
{
img: '/static/img/shop/commission/commission_icon8.png',
title: '分享记录',
path: '/pages/commission/share-log',
},
],
});
const state = reactive({
menuList: [{
img: '/static/img/shop/commission/commission_icon1.png',
title: '我的团队',
path: '/pages/commission/team',
},
{
img: '/static/img/shop/commission/commission_icon2.png',
title: '佣金明细',
path: '/pages/user/wallet/commission',
},
{
img: '/static/img/shop/commission/commission_icon3.png',
title: '分销订单',
path: '/pages/commission/order',
},
{
img: '/static/img/shop/commission/commission_icon4.png',
title: '推广商品',
path: '/pages/commission/goods',
},
// {
// img: '/static/img/shop/commission/commission_icon5.png',
// title: '我的资料',
// path: '/pages/commission/apply',
// isAgentFrom: true,
// },
// todo @芋艿:邀请海报需要登录后的个人数据
{
img: '/static/img/shop/commission/commission_icon7.png',
title: '邀请海报',
path: 'action:showShareModal',
}, {
// img: '/static/img/shop/commission/commission_icon7.png',
title: '推广人排行榜',
path: '/pages/commission/promoter',
}, {
// img: '/static/img/shop/commission/commission_icon7.png',
title: '佣金排行榜',
path: '/pages/commission/commission-ranking',
},
// {
// img: '/static/img/shop/commission/commission_icon8.png',
// title: '分享记录',
// path: '/pages/commission/share-log',
// },
],
});
</script>
<style lang="scss" scoped>
.menu-box {
margin: 0 auto;
width: 690rpx;
margin-bottom: 20rpx;
margin-top: 20rpx;
border-radius: 12rpx;
z-index: 3;
position: relative;
}
.header-box {
width: 690rpx;
height: 76rpx;
position: relative;
.header-bg {
width: 690rpx;
height: 76rpx;
}
.header-title {
position: absolute;
left: 20rpx;
top: 24rpx;
}
.title {
font-size: 28rpx;
font-weight: 500;
color: #ffffff;
line-height: 30rpx;
}
.cicon-forward {
font-size: 30rpx;
font-weight: 400;
color: #ffffff;
line-height: 30rpx;
}
}
.menu-box {
margin: 0 auto;
width: 690rpx;
margin-bottom: 20rpx;
margin-top: 20rpx;
border-radius: 12rpx;
z-index: 3;
position: relative;
}
.menu-list {
padding: 50rpx 0 10rpx 0;
background: #fdfae9;
border-radius: 0 0 12rpx 12rpx;
}
.item-box {
width: 25%;
margin-bottom: 40rpx;
}
.header-box {
width: 690rpx;
height: 76rpx;
position: relative;
.menu-icon {
width: 68rpx;
height: 68rpx;
background: #ffffff;
border-radius: 50%;
}
.header-bg {
width: 690rpx;
height: 76rpx;
}
.menu-title {
font-size: 26rpx;
font-weight: 500;
color: #ffffff;
}
</style>
.header-title {
position: absolute;
left: 20rpx;
top: 24rpx;
}
.title {
font-size: 28rpx;
font-weight: 500;
color: #ffffff;
line-height: 30rpx;
}
.cicon-forward {
font-size: 30rpx;
font-weight: 400;
color: #ffffff;
line-height: 30rpx;
}
}
.menu-list {
padding: 50rpx 0 10rpx 0;
background: #fdfae9;
border-radius: 0 0 12rpx 12rpx;
}
.item-box {
width: 25%;
margin-bottom: 40rpx;
}
.menu-icon {
width: 68rpx;
height: 68rpx;
background: #ffffff;
border-radius: 50%;
}
.menu-title {
font-size: 26rpx;
font-weight: 500;
color: #ffffff;
}
</style>
+56 -48
View File
@@ -1,61 +1,69 @@
<!-- 分销中心 -->
<template>
<s-layout navbar="inner" class="index-wrap" title="分销中心" :bgStyle="bgStyle" onShareAppMessage>
<!-- 分销商信息 -->
<commission-info />
<!-- 账户信息 -->
<account-info />
<!-- 菜单栏 -->
<commission-menu />
<!-- 分销记录 -->
<commission-log />
<!-- 弹框 -->
<commission-condition :error="state.error" :errorData="state.errorData" />
<s-layout navbar="inner" class="index-wrap" title="分销中心" :bgStyle="bgStyle" onShareAppMessage>
<!-- 分销商信息 -->
<commission-info />
<!-- 账户信息 -->
<account-info />
<!-- 菜单栏 -->
<commission-menu />
<!-- 分销记录 -->
<commission-log />
<!-- 弹框 -->
<commission-condition :error="state.error" :errorData="state.errorData" />
<!-- 权限 -->
<commission-auth :error="state.error" @getAgentInfo="getAgentInfo" />
</s-layout>
<!-- 权限 -->
<commission-auth :error="state.error" @getAgentInfo="getAgentInfo" />
</s-layout>
</template>
<script setup>
import sheep from '@/sheep';
import { onShow } from '@dcloudio/uni-app';
import { computed, reactive } from 'vue';
import commissionInfo from './components/commission-info.vue';
import accountInfo from './components/account-info.vue';
import commissionLog from './components/commission-log.vue';
import commissionMenu from './components/commission-menu.vue';
import commissionAuth from './components/commission-auth.vue';
import commissionCondition from './components/commission-condition.vue';
import sheep from '@/sheep';
import {
onShow
} from '@dcloudio/uni-app';
import {
computed,
reactive
} from 'vue';
import commissionInfo from './components/commission-info.vue';
import accountInfo from './components/account-info.vue';
import commissionLog from './components/commission-log.vue';
import commissionMenu from './components/commission-menu.vue';
import commissionAuth from './components/commission-auth.vue';
import commissionCondition from './components/commission-condition.vue';
const state = reactive({
error: 0,
errorData: {},
config: {
background: '/storage/default/20220704/29ac76a3c9d0d983200d612e45a052ca.png',
},
});
const state = reactive({
error: 0,
errorData: {},
config: {
background: '/storage/default/20220704/29ac76a3c9d0d983200d612e45a052ca.png',
},
});
const agentInfo = computed(() => sheep.$store('user').agentInfo);
const agentInfo = computed(() => sheep.$store('user').agentInfo);
const bgStyle = {
color: '#F7D598',
};
const bgStyle = {
color: '#F7D598',
};
async function getAgentInfo() {
const { error, data } = await sheep.$store('user').getAgentInfo();
if (error !== 0) {
state.error = error;
state.errorData = data;
}
}
onShow(() => {
getAgentInfo();
});
async function getAgentInfo() {
const {
error,
data
} = await sheep.$store('user').getAgentInfo();
if (error !== 0) {
state.error = error;
state.errorData = data;
}
}
onShow(() => {
getAgentInfo();
});
</script>
<style lang="scss" scoped>
:deep(.page-main) {
background-size: 100% 100% !important;
}
</style>
:deep(.page-main) {
background-size: 100% 100% !important;
}
</style>
+34 -28
View File
@@ -8,15 +8,15 @@
},
]">
<!-- 团队数据总览 -->
<view class="team-data-box ss-flex ss-col-center ss-row-between">
<view class="data-card">
<view class="total-item">
<view class="item-title">团队订单数量</view>
<view class="total-num">
{{ state.agentInfo.child_order_count_all || 0 }}
<view class="team-data-box ss-flex ss-col-center ss-row-between" style="width:100%">
<view class="data-card" style="width:100%">
<view class="total-item" style="width:100%">
<view class="item-title" style='text-align: center;'>累计推广订单</view>
<view class="total-num" style='text-align: center;'>
{{ state.totals||state.pagination.total|| 0 }}
</view>
</view>
<view class="category-item ss-flex">
<!-- <view class="category-item ss-flex">
<view class="ss-flex-1">
<view class="item-title">一级订单</view>
<view class="category-num">
@@ -29,9 +29,9 @@
{{ state.agentInfo.child_order_count_2 || 0 }}
</view>
</view>
</view>
</view> -->
</view>
<view class="data-card">
<!-- <view class="data-card">
<view class="total-item">
<view class="item-title">团队订单金额</view>
<view class="total-num">
@@ -52,10 +52,10 @@
</view>
</view>
</view>
</view>
</view> -->
</view>
<!-- 自购 -->
<view class="direct-box ss-flex ss-row-between">
<!-- <view class="direct-box ss-flex ss-row-between">
<view class="direct-item">
<view class="item-title">自购分销订单数量</view>
<view class="item-value">
@@ -68,7 +68,7 @@
{{ state.agentInfo.child_order_money_0 || '0.00' }}
</view>
</view>
</view>
</view> -->
</view>
<!-- tab -->
@@ -131,7 +131,7 @@
} from '@dcloudio/uni-app';
import {
computed,
reactive
reactive,
} from 'vue';
import _ from 'lodash';
import {
@@ -149,10 +149,11 @@
});
const state = reactive({
totals: 0,
pagination: {
data: [],
current_page: 1,
total: 1,
total: '',
last_page: 1,
},
loadStatus: '',
@@ -170,24 +171,24 @@
// value: 'no'
// },
{
name: '已计入',
name: '待结算',
value: 'yes',
},
{
name: '已扣除',
name: '已结算',
value: 'back',
},
{
name: '已取消',
value: 'cancel',
},
// {
// name: '已取消',
// value: 'cancel',
// },
];
// 切换选项卡
function onTabsChange(e) {
state.pagination = {
data: [],
current_page: 1,
total: 1,
total: 0,
last_page: 1,
};
state.currentTab = e.index;
@@ -196,19 +197,24 @@
// 获取订单列表
async function getOrderList(page = 1, list_rows = 5) {
// todo @芋艿:没有测试数据,还需对接请求参数,和返回的数据字段
state.loadStatus = 'loading';
let res = await sheep.$api.commission.order({
type: tabMaps[state.currentTab].value,
list_rows,
page,
// type: tabMaps[state.currentTab].value,
pageSize: list_rows,
pageNo: page,
// status
// bizType
});
if (res.error === 0) {
let orderList = _.concat(state.pagination.data, res.data.data);
if (res.code === 0) {
let orderList = _.concat(state.pagination.data, res.data.list);
state.pagination = {
...res.data,
data: orderList,
};
if (state.pagination.current_page < state.pagination.last_page) {
state.totals = res.data.total;
console.log(state)
if (state.pagination.data.length < state.totals) {
state.loadStatus = 'more';
} else {
state.loadStatus = 'noMore';
@@ -228,7 +234,7 @@
}
onLoad(() => {
getAgentInfo();
// getAgentInfo();
getOrderList();
});
File diff suppressed because one or more lines are too long
+238 -229
View File
@@ -1,257 +1,266 @@
<!-- 页面 -->
<template>
<s-layout title="我的团队" :class="state.scrollTop ? 'team-wrap' : ''" navbar="inner">
<view
class="header-box"
:style="[
<s-layout title="我的团队" :class="state.scrollTop ? 'team-wrap' : ''" navbar="inner">
<view class="header-box" :style="[
{
marginTop: '-' + Number(statusBarHeight + 88) + 'rpx',
paddingTop: Number(statusBarHeight + 108) + 'rpx',
},
]"
>
<!-- 推荐人 -->
<view v-if="userInfo.parent_user" class="referrer-box ss-flex ss-col-center">
推荐人
<image
class="referrer-avatar ss-m-r-10"
:src="sheep.$url.cdn(userInfo.parent_user.avatar)"
mode="aspectFill"
>
</image>
{{ userInfo.parent_user.nickname }}
</view>
<!-- 团队数据总览 -->
<view class="team-data-box ss-flex ss-col-center ss-row-between">
<view class="data-card">
<view class="total-item">
<view class="item-title">团队总人数</view>
<view class="total-num">{{ agentInfo.child_user_count_all || 0 }}</view>
</view>
<view class="category-item ss-flex">
<view class="ss-flex-1">
<view class="item-title">一级成员</view>
<view class="category-num">{{ agentInfo.child_user_count_1 || 0 }}</view>
</view>
<view class="ss-flex-1">
<view class="item-title">二级成员</view>
<view class="category-num">{{ agentInfo.child_user_count_2 || 0 }}</view>
</view>
</view>
</view>
<view class="data-card">
<view class="total-item">
<view class="item-title">团队分销商人数</view>
<view class="total-num">{{ agentInfo.child_agent_count_all || 0 }}</view>
</view>
<view class="category-item ss-flex">
<view class="ss-flex-1">
<view class="item-title">一级分销商</view>
<view class="category-num">{{ agentInfo.child_agent_count_1 || 0 }}</view>
</view>
<view class="ss-flex-1">
<view class="item-title">二级分销商</view>
<view class="category-num">{{ agentInfo.child_agent_count_2 || 0 }}</view>
</view>
</view>
</view>
</view>
</view>
<view class="list-box">
<uni-list :border="false">
<uni-list-chat
v-for="item in state.pagination.data"
:key="item.id"
:avatar-circle="true"
:title="item.nickname"
:avatar="sheep.$url.cdn(item.avatar)"
:note="filterUserNum(item.agent?.child_user_count_1)"
>
<view class="chat-custom-right">
<view v-if="item.agent?.level_info" class="tag-box ss-flex ss-col-center">
<image
class="tag-img"
:src="sheep.$url.cdn(item.agent.level_info.image)"
mode="aspectFill"
>
</image>
<text class="tag-title">{{ item.agent.level_info.name }}</text>
</view>
<text class="time-text">{{ item.create_time }}</text>
</view>
</uni-list-chat>
</uni-list>
</view>
<s-empty v-if="state.pagination.total === 0" icon="/static/data-empty.png" text="暂无团队信息">
</s-empty>
</s-layout>
]">
<!-- 推荐人 -->
<view v-if="userInfo.parent_user" class="referrer-box ss-flex ss-col-center">
推荐人
<image class="referrer-avatar ss-m-r-10" :src="sheep.$url.cdn(userInfo.parent_user.avatar)"
mode="aspectFill">
</image>
{{ userInfo.parent_user.nickname }}
</view>
<!-- 团队数据总览 -->
<view class="team-data-box ss-flex ss-col-center ss-row-between">
<view class="data-card">
<view class="total-item">
<view class="item-title">团队总人数</view>
<view class="total-num">
{{ (state.getSummary.firstBrokerageUserCount+ state.getSummary.secondBrokerageUserCount)|| 0 }}
</view>
</view>
<view class="category-item ss-flex">
<view class="ss-flex-1">
<view class="item-title">一级成员</view>
<view class="category-num">{{ state.getSummary.firstBrokerageUserCount || 0 }}</view>
</view>
<view class="ss-flex-1">
<view class="item-title">二级成员</view>
<view class="category-num">{{ state.getSummary.secondBrokerageUserCount || 0 }}</view>
</view>
</view>
</view>
<view class="data-card">
<view class="total-item">
<view class="item-title">团队分销商人数</view>
<view class="total-num">{{ agentInfo.child_agent_count_all || 0 }}</view>
</view>
<view class="category-item ss-flex">
<view class="ss-flex-1">
<view class="item-title">一级分销商</view>
<view class="category-num">{{ agentInfo.child_agent_count_1 || 0 }}</view>
</view>
<view class="ss-flex-1">
<view class="item-title">二级分销商</view>
<view class="category-num">{{ agentInfo.child_agent_count_2 || 0 }}</view>
</view>
</view>
</view>
</view>
</view>
<view class="list-box">
<uni-list :border="false">
<uni-list-chat v-for="item in state.pagination.data" :key="item.id" :avatar-circle="true"
:title="item.nickname" :avatar="sheep.$url.cdn(item.avatar)"
:note="filterUserNum(item.agent?.child_user_count_1)">
<view class="chat-custom-right">
<view v-if="item.avatar" class="tag-box ss-flex ss-col-center">
<image class="tag-img" :src="sheep.$url.cdn(item.avatar)" mode="aspectFill">
</image>
<text class="tag-title">{{ item.nickname }}</text>
</view>
<text
class="time-text">{{ sheep.$helper.timeFormat(item.brokerageTime, 'yyyy-mm-dd hh:MM:ss') }}</text>
</view>
</uni-list-chat>
</uni-list>
</view>
<s-empty v-if="state.pagination.total === 0" icon="/static/data-empty.png" text="暂无团队信息">
</s-empty>
</s-layout>
</template>
<script setup>
import sheep from '@/sheep';
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
import { computed, reactive } from 'vue';
import _ from 'lodash';
import { onPageScroll } from '@dcloudio/uni-app';
import sheep from '@/sheep';
import {
onLoad,
onReachBottom
} from '@dcloudio/uni-app';
import {
computed,
reactive
} from 'vue';
import _ from 'lodash';
import {
onPageScroll
} from '@dcloudio/uni-app';
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
const agentInfo = computed(() => sheep.$store('user').agentInfo);
const userInfo = computed(() => sheep.$store('user').userInfo);
const headerBg = sheep.$url.css('/static/img/shop/user/withdraw_bg.png');
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
const agentInfo = computed(() => sheep.$store('user').agentInfo);
const userInfo = computed(() => sheep.$store('user').userInfo);
const headerBg = sheep.$url.css('/static/img/shop/user/withdraw_bg.png');
onPageScroll((e) => {
if (e.scrollTop > 100) {
state.scrollTop = false;
} else {
state.scrollTop = true;
}
});
const state = reactive({
pagination: {
data: [],
current_page: 1,
total: 1,
last_page: 1,
},
loadStatus: '',
});
onPageScroll((e) => {
if (e.scrollTop > 100) {
state.scrollTop = false;
} else {
state.scrollTop = true;
}
});
const state = reactive({
getSummary: {},
pagination: {
data: [],
current_page: 1,
total: 1,
last_page: 1,
},
loadStatus: '',
});
function filterUserNum(num) {
if (_.isNil(num)) {
return '';
}
return `下级团队${num}`;
}
function filterUserNum(num) {
if (_.isNil(num)) {
return '';
}
return `下级团队${num}`;
}
async function getTeamList(page = 1, list_rows = 8) {
state.loadStatus = 'loading';
let res = await sheep.$api.commission.team({
list_rows,
page,
});
if (res.error === 0) {
let orderList = _.concat(state.pagination.data, res.data.data);
state.pagination = {
...res.data,
data: orderList,
};
if (state.pagination.current_page < state.pagination.last_page) {
state.loadStatus = 'more';
} else {
state.loadStatus = 'noMore';
}
}
}
async function getTeamList(page = 1, list_rows = 8) {
state.loadStatus = 'loading';
// nickname: this.nickname,
onLoad(async () => {
getTeamList();
});
// 加载更多
function loadmore() {
if (state.loadStatus !== 'noMore') {
getTeamList(state.pagination.current_page + 1);
}
}
let res = await sheep.$api.commission.team({
pageSize: list_rows,
pageNo: page,
level: '1',
'sortingField.order': 'desc',
'sortingField.field': 'userCount',
nickname: ''
});
console.log(res, '分销团队列表');
if (res.code === 0) {
let orderList = _.concat(state.pagination.data, res.data.list);
state.pagination = {
...res.data,
data: orderList,
};
if (state.pagination.data.length < state.pagination.total) {
state.loadStatus = 'more';
} else {
state.loadStatus = 'noMore';
}
}
}
// 上拉加载更多
onReachBottom(() => {
loadmore();
});
onLoad(async () => {
getTeamList();
let res = await sheep.$api.commission.getSummary();
state.getSummary = res.data;
});
// 加载更多
function loadmore() {
if (state.loadStatus !== 'noMore') {
getTeamList(state.pagination.current_page + 1);
}
}
// 上拉加载更多
onReachBottom(() => {
loadmore();
});
</script>
<style lang="scss" scoped>
.header-box {
box-sizing: border-box;
padding: 0 20rpx 20rpx 20rpx;
width: 750rpx;
z-index: 3;
position: relative;
background: v-bind(headerBg) no-repeat,
linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
background-size: 750rpx 100%;
// 团队信息总览
.team-data-box {
.data-card {
width: 305rpx;
background: #ffffff;
border-radius: 20rpx;
padding: 20rpx;
.header-box {
box-sizing: border-box;
padding: 0 20rpx 20rpx 20rpx;
width: 750rpx;
z-index: 3;
position: relative;
background: v-bind(headerBg) no-repeat,
linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
background-size: 750rpx 100%;
.item-title {
font-size: 22rpx;
font-weight: 500;
color: #999999;
line-height: 30rpx;
margin-bottom: 10rpx;
}
// 团队信息总览
.team-data-box {
.data-card {
width: 305rpx;
background: #ffffff;
border-radius: 20rpx;
padding: 20rpx;
.total-item {
margin-bottom: 30rpx;
}
.item-title {
font-size: 22rpx;
font-weight: 500;
color: #999999;
line-height: 30rpx;
margin-bottom: 10rpx;
}
.total-num {
font-size: 38rpx;
font-weight: 500;
color: #333333;
font-family: OPPOSANS;
}
.total-item {
margin-bottom: 30rpx;
}
.category-num {
font-size: 26rpx;
font-weight: 500;
color: #333333;
font-family: OPPOSANS;
}
}
}
}
.list-box {
z-index: 3;
position: relative;
}
.chat-custom-right {
.time-text {
font-size: 22rpx;
font-weight: 400;
color: #999999;
}
.total-num {
font-size: 38rpx;
font-weight: 500;
color: #333333;
font-family: OPPOSANS;
}
.tag-box {
background: rgba(0, 0, 0, 0.2);
border-radius: 21rpx;
line-height: 30rpx;
padding: 5rpx 10rpx;
width: 140rpx;
.category-num {
font-size: 26rpx;
font-weight: 500;
color: #333333;
font-family: OPPOSANS;
}
}
}
}
.tag-img {
width: 34rpx;
height: 34rpx;
margin-right: 6rpx;
border-radius: 50%;
}
.list-box {
z-index: 3;
position: relative;
}
.tag-title {
font-size: 18rpx;
font-weight: 500;
color: rgba(255, 255, 255, 1);
line-height: 20rpx;
}
}
}
.chat-custom-right {
.time-text {
font-size: 22rpx;
font-weight: 400;
color: #999999;
}
// 推荐人
.referrer-box {
font-size: 28rpx;
font-weight: 500;
color: #ffffff;
padding: 20rpx;
.tag-box {
background: rgba(0, 0, 0, 0.2);
border-radius: 21rpx;
line-height: 30rpx;
padding: 5rpx 10rpx;
width: 140rpx;
.referrer-avatar {
width: 34rpx;
height: 34rpx;
border-radius: 50%;
}
}
</style>
.tag-img {
width: 34rpx;
height: 34rpx;
margin-right: 6rpx;
border-radius: 50%;
}
.tag-title {
font-size: 18rpx;
font-weight: 500;
color: rgba(255, 255, 255, 1);
line-height: 20rpx;
}
}
}
// 推荐人
.referrer-box {
font-size: 28rpx;
font-weight: 500;
color: #ffffff;
padding: 20rpx;
.referrer-avatar {
width: 34rpx;
height: 34rpx;
border-radius: 50%;
}
}
</style>
+153 -156
View File
@@ -1,178 +1,175 @@
<template>
<su-popup :show="show" class="ss-checkout-counter-wrap" @close="hideModal">
<view class="ss-modal-box bg-white ss-flex-col">
<view class="modal-header ss-flex-col ss-col-left">
<text class="modal-title ss-m-b-20">选择提现方式</text>
</view>
<view class="modal-content ss-flex-1 ss-p-b-100">
<radio-group @change="onChange">
<label
class="container-list ss-p-l-34 ss-p-r-24 ss-flex ss-col-center ss-row-center"
v-for="(item, index) in typeList"
:key="index"
>
<view class="container-icon ss-flex ss-m-r-20">
<image :src="sheep.$url.static(item.icon)" />
</view>
<view class="ss-flex-1">{{ item.title }}</view>
<su-popup :show="show" class="ss-checkout-counter-wrap" @close="hideModal">
<view class="ss-modal-box bg-white ss-flex-col">
<view class="modal-header ss-flex-col ss-col-left">
<text class="modal-title ss-m-b-20">选择提现方式</text>
</view>
<view class="modal-content ss-flex-1 ss-p-b-100">
<radio-group @change="onChange">
<label class="container-list ss-p-l-34 ss-p-r-24 ss-flex ss-col-center ss-row-center"
v-for="(item, index) in typeList" :key="index">
<view class="container-icon ss-flex ss-m-r-20">
<image :src="sheep.$url.static(item.icon)" />
</view>
<view class="ss-flex-1">{{ item.title }}</view>
<radio
:value="item.value"
color="var(--ui-BG-Main)"
:checked="item.value === state.currentValue"
:disabled="!methods.includes(item.value)"
/>
</label>
</radio-group>
</view>
<view class="modal-footer ss-flex ss-row-center ss-col-center">
<button class="ss-reset-button save-btn" @tap="onConfirm">确定</button>
</view>
</view>
</su-popup>
<radio :value="item.value" color="var(--ui-BG-Main)"
:checked="item.value === state.currentValue" />
<!-- :disabled="!methods.includes(item.value)" -->
</label>
</radio-group>
</view>
<view class="modal-footer ss-flex ss-row-center ss-col-center">
<button class="ss-reset-button save-btn" @tap="onConfirm">确定</button>
</view>
</view>
</su-popup>
</template>
<script setup>
import { reactive, onBeforeMount, nextTick } from 'vue';
import sheep from '@/sheep';
import {
reactive,
onBeforeMount,
nextTick
} from 'vue';
import sheep from '@/sheep';
const props = defineProps({
modelValue: {
type: Object,
default() {},
},
show: {
type: Boolean,
default: false,
},
methods: {
type: Array,
default: [],
},
});
const emits = defineEmits(['update:modelValue', 'change', 'close']);
const state = reactive({
currentValue: '',
});
const typeList = [
{
icon: '/static/img/shop/pay/wechat.png',
title: '微信零钱',
value: 'wechat',
},
{
icon: '/static/img/shop/pay/alipay.png',
title: '支付宝账户',
value: 'alipay',
},
{
icon: '/static/img/shop/pay/bank.png',
title: '银行卡转账',
value: 'bank',
},
];
const getWalletAccountInfo = async () => {
return new Promise(async (resolve, reject) => {
let res = await sheep.$api.user.account.info({
type: state.currentValue,
});
if (res.error === 0) {
if (!props.methods.includes(res.data.type)) {
return;
}
state.currentValue = res.data.type;
emits('update:modelValue', {
type: res.data.type,
account_header: res.data.account_header,
account_name: res.data.account_name,
account_no: res.data.account_no,
});
} else {
emits('update:modelValue', {
type: state.currentValue,
});
}
resolve();
});
};
const props = defineProps({
modelValue: {
type: Object,
default () {},
},
show: {
type: Boolean,
default: false,
},
methods: {
type: Array,
default: [],
},
});
const emits = defineEmits(['update:modelValue', 'change', 'close']);
const state = reactive({
currentValue: '0',
});
const typeList = [{
// icon: '/static/img/shop/pay/wechat.png',
title: '工商银行',
value: '0',
},
{
// icon: '/static/img/shop/pay/alipay.png',
title: '建设银行',
value: '1',
},
{
// icon: '/static/img/shop/pay/bank.png',
title: '农业',
value: '2',
},
];
const getWalletAccountInfo = async () => {
return new Promise(async (resolve, reject) => {
let res = await sheep.$api.user.account.info({
type: state.currentValue,
});
if (res.error === 0) {
if (!props.methods.includes(res.data.type)) {
return;
}
state.currentValue = res.data.type;
emits('update:modelValue', {
type: res.data.type,
account_header: res.data.account_header,
account_name: res.data.account_name,
account_no: res.data.account_no,
});
} else {
emits('update:modelValue', {
type: state.currentValue,
});
}
resolve();
});
};
function onChange(e) {
state.currentValue = e.detail.value;
}
function onChange(e) {
state.currentValue = e.detail.value;
}
const onConfirm = async () => {
if (state.currentValue === '') {
sheep.$helper.toast('请选择提现方式');
return;
}
await getWalletAccountInfo();
emits('close');
};
const onConfirm = async () => {
if (state.currentValue === '') {
sheep.$helper.toast('请选择提现方式');
return;
}
await getWalletAccountInfo();
emits('close');
};
const hideModal = () => {
emits('close');
};
const hideModal = () => {
emits('close');
};
onBeforeMount(async () => {
await getWalletAccountInfo();
});
onBeforeMount(async () => {
await getWalletAccountInfo();
});
</script>
<style lang="scss" scoped>
.ss-modal-box {
border-radius: 30rpx 30rpx 0 0;
max-height: 1000rpx;
.ss-modal-box {
border-radius: 30rpx 30rpx 0 0;
max-height: 1000rpx;
.modal-header {
position: relative;
padding: 60rpx 40rpx 40rpx;
.modal-header {
position: relative;
padding: 60rpx 40rpx 40rpx;
.modal-title {
font-size: 32rpx;
font-weight: bold;
}
.modal-title {
font-size: 32rpx;
font-weight: bold;
}
.close-icon {
position: absolute;
top: 10rpx;
right: 20rpx;
font-size: 46rpx;
opacity: 0.2;
}
}
.close-icon {
position: absolute;
top: 10rpx;
right: 20rpx;
font-size: 46rpx;
opacity: 0.2;
}
}
.modal-content {
overflow-y: auto;
.modal-content {
overflow-y: auto;
.container-list {
height: 96rpx;
border-bottom: 2rpx solid rgba(#dfdfdf, 0.5);
font-size: 28rpx;
font-weight: 500;
color: #333333;
.container-list {
height: 96rpx;
border-bottom: 2rpx solid rgba(#dfdfdf, 0.5);
font-size: 28rpx;
font-weight: 500;
color: #333333;
.container-icon {
width: 36rpx;
height: 36rpx;
}
}
}
.container-icon {
width: 36rpx;
height: 36rpx;
}
}
}
.modal-footer {
height: 120rpx;
.modal-footer {
height: 120rpx;
.save-btn {
width: 710rpx;
height: 80rpx;
border-radius: 40rpx;
background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
color: $white;
}
}
}
.save-btn {
width: 710rpx;
height: 80rpx;
border-radius: 40rpx;
background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
color: $white;
}
}
}
image {
width: 100%;
height: 100%;
}
</style>
image {
width: 100%;
height: 100%;
}
</style>
+357 -329
View File
@@ -1,380 +1,408 @@
<template>
<s-layout title="申请提现" class="withdraw-wrap" navbar="inner">
<!-- <view class="page-bg"></view> -->
<view
class="wallet-num-box ss-flex ss-col-center ss-row-between"
:style="[
<s-layout title="申请提现" class="withdraw-wrap" navbar="inner">
<!-- <view class="page-bg"></view> -->
<!-- <view class="wallet-num-box ss-flex ss-col-center ss-row-between" :style="[
{
marginTop: '-' + Number(statusBarHeight + 88) + 'rpx',
paddingTop: Number(statusBarHeight + 108) + 'rpx',
},
]"
>
<view class="">
<view class="num-title">可提现金额</view>
<view class="wallet-num">{{ userInfo.commission }}</view>
</view>
<button class="ss-reset-button log-btn" @tap="sheep.$router.go('/pages/pay/withdraw-log')"
>提现记录</button
>
</view>
<!-- 提现输入卡片-->
<view class="draw-card">
<view class="card-title">提现金额</view>
<view class="input-box ss-flex ss-col-center border-bottom">
<view class="unit"></view>
<uni-easyinput
:inputBorder="false"
class="ss-flex-1 ss-p-l-10"
v-model="state.amount"
type="number"
placeholder="请输入提现金额"
/>
</view>
<view class="bank-box ss-flex ss-col-center ss-row-between ss-m-b-30">
<view class="name">提现至</view>
<view class="bank-list ss-flex ss-col-center" @tap="onAccountSelect(true)">
<view v-if="!state.accountInfo.type" class="empty-text">请选择提现方式</view>
<view v-if="state.accountInfo.type === 'wechat'" class="empty-text">微信零钱</view>
<view v-if="state.accountInfo.type === 'alipay'" class="empty-text">支付宝账户</view>
<view v-if="state.accountInfo.type === 'bank'" class="empty-text">银行卡转账</view>
<text class="cicon-forward"></text>
</view>
</view>
<view class="bind-box ss-flex ss-col-center ss-row-between" v-if="state.accountInfo.type">
<view class="placeholder-text" v-if="state.accountInfo.account_name">
{{ state.accountInfo.account_header }}|{{ state.accountInfo.account_name }}
</view>
<view class="placeholder-text" v-else>暂无提现账户</view>
<button class="add-btn ss-reset-button" @tap="onAccountEdit(true)">
{{ state.accountInfo.account_name ? '修改' : '添加' }}
</button>
</view>
<button class="ss-reset-button save-btn ui-BG-Main-Gradient ui-Shadow-Main" @tap="onConfirm">
确认提现
</button>
</view>
]">
<view class="">
<view class="num-title">可提现金额</view>
<view class="wallet-num">{{ userInfo.commission }}</view>
</view>
<button class="ss-reset-button log-btn" @tap="sheep.$router.go('/pages/pay/withdraw-log')">提现记录</button>
</view> -->
<!-- 提现输入卡片-->
<view class="draw-card">
<view class="card-title">提现金额</view>
<view class="input-box ss-flex ss-col-center border-bottom">
<view class="unit"></view>
<uni-easyinput :inputBorder="false" class="ss-flex-1 ss-p-l-10" v-model="state.amount" type="number"
placeholder="请输入提现金额" />
</view>
<view class="card-title">持卡人</view>
<view class="input-box ss-flex ss-col-center border-bottom">
<view class="unit"></view>
<uni-easyinput :inputBorder="false" class="ss-flex-1 ss-p-l-10" v-model="state.name"
placeholder="请输入持卡人姓名" />
</view>
<view class="card-title">卡号</view>
<view class="input-box ss-flex ss-col-center border-bottom">
<view class="unit"></view>
<uni-easyinput :inputBorder="false" class="ss-flex-1 ss-p-l-10" v-model="state.accountNo"
placeholder="请输卡号" />
</view>
<view class="bank-box ss-flex ss-col-center ss-row-between ss-m-b-30">
<view class="name">选择银行</view>
<view class="bank-list ss-flex ss-col-center" @tap="onAccountSelect(true)">
<view v-if="!state.accountInfo.type" class="empty-text">请选择提现方式</view>
<view v-if="state.accountInfo.type === '0'" class="empty-text">工商银行</view>
<view v-if="state.accountInfo.type === '1'" class="empty-text">建设银行</view>
<view v-if="state.accountInfo.type === '2'" class="empty-text">农业银行</view>
<!-- <view v-if="!state.accountInfo.type" class="empty-text">请选择提现方式</view>
<view v-if="state.accountInfo.type === 'wechat'" class="empty-text">微信零钱</view>
<view v-if="state.accountInfo.type === 'alipay'" class="empty-text">支付宝账户</view>
<view v-if="state.accountInfo.type === 'bank'" class="empty-text">银行卡转账</view> -->
<text class="cicon-forward"></text>
</view>
</view>
<view class="bind-box ss-flex ss-col-center ss-row-between" v-if="state.accountInfo.type">
<view class="placeholder-text" v-if="state.accountInfo.account_name">
{{ state.accountInfo.account_header }}|{{ state.accountInfo.account_name }}
</view>
<!-- <view class="placeholder-text" v-else>暂无提现账户</view>
<button class="add-btn ss-reset-button" @tap="onAccountEdit(true)">
{{ state.accountInfo.account_name ? '修改' : '添加' }}
</button> -->
</view>
<button class="ss-reset-button save-btn ui-BG-Main-Gradient ui-Shadow-Main" @tap="onConfirm">
确认提现
</button>
</view>
<!-- 提现说明 -->
<view class="draw-notice">
<view class="title ss-m-b-30">提现说明</view>
<view class="draw-list" v-for="(rule, index) in state.rulesList" :key="index">
{{ index + 1 }}.{{ rule }}
</view>
</view>
<!-- 提现说明 -->
<view class="draw-notice">
<view class="title ss-m-b-30">提现说明</view>
<!-- <view class="draw-list" v-for="(rule, index) in state.rulesList" :key="index">
{{ index + 1 }}.{{ rule }}
</view>-->
<view class="draw-list">
当前可提现金额<text>{{state.userGet.brokeragePrice}}</text>
</view>
<view class="draw-list">
冻结佣金<text>{{state.userGet.frozenPrice}}</text>
</view>
<view class="draw-list">
说明每笔佣金冻结期为0天到期后可提现
</view>
</view>
<!-- 选择提现账户 -->
<account-type-select
:show="state.accountSelect"
@close="onAccountSelect(false)"
round="10"
v-model="state.accountInfo"
:methods="state.rules.methods"
/>
<!-- 编辑账户信息 -->
<account-info-modal
v-if="state.accountInfo.type"
v-model="state.accountInfo"
:show="state.accountEdit"
@close="onAccountEdit(false)"
round="10"
/>
</s-layout>
<!-- 选择提现账户 -->
<account-type-select :show="state.accountSelect" @close="onAccountSelect(false)" round="10"
v-model="state.accountInfo" :methods="state.rules.methods" />
<!-- 编辑账户信息 -->
<account-info-modal v-if="state.accountInfo.type" v-model="state.accountInfo" :show="state.accountEdit"
@close="onAccountEdit(false)" round="10" />
</s-layout>
</template>
<script setup>
import { computed, reactive, onBeforeMount } from 'vue';
import sheep from '@/sheep';
import accountTypeSelect from './components/account-type-select.vue';
import accountInfoModal from './components/account-info-modal.vue';
import { onPageScroll } from '@dcloudio/uni-app';
const headerBg = sheep.$url.css('/static/img/shop/user/withdraw_bg.png');
onPageScroll(() => {});
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
function filterRules(rules) {
let list = [];
let str1 = '';
if (rules.min_amount > 0) {
str1 += `最少 ${rules.min_amount}元; `;
}
if (rules.max_amount > 0) {
str1 += `最多 ${rules.max_amount}元;`;
}
if (str1 !== '') {
list.push('单次提现金额 ' + str1);
}
import {
computed,
reactive,
onBeforeMount
} from 'vue';
import sheep from '@/sheep';
import accountTypeSelect from './components/account-type-select.vue';
import accountInfoModal from './components/account-info-modal.vue';
import {
onPageScroll
} from '@dcloudio/uni-app';
const headerBg = sheep.$url.css('/static/img/shop/user/withdraw_bg.png');
onPageScroll(() => {});
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
if (rules.max_num > 0) {
list.push(`${rules.num_unit === 'day' ? '天' : '月'}最多可提现 ${rules.max_num} 次;`);
}
function filterRules(rules) {
let list = [];
let str1 = '';
if (rules.min_amount > 0) {
str1 += `最少 ${rules.min_amount}元; `;
}
if (rules.max_amount > 0) {
str1 += `最多 ${rules.max_amount}元;`;
}
if (str1 !== '') {
list.push('单次提现金额 ' + str1);
}
if (rules.charge_rate_format > 0) {
list.push(`次收取提现手续费 ${rules.charge_rate_format}%;`);
}
list.push(
`提现申请后将${rules.auto_arrival ? '自动' : '审核后'}到账, 到账结果请查收对应渠道服务通知;`,
);
list.push('如有疑问请及时联系客服.');
if (rules.max_num > 0) {
list.push(`${rules.num_unit === 'day' ? '天' : '月'}最多可提现 ${rules.max_num};`);
}
return list;
}
if (rules.charge_rate_format > 0) {
list.push(`每次收取提现手续费 ${rules.charge_rate_format}%;`);
}
list.push(
`提现申请后将${rules.auto_arrival ? '自动' : '审核后'}到账, 到账结果请查收对应渠道服务通知;`,
);
list.push('如有疑问请及时联系客服.');
const userStore = sheep.$store('user');
const userInfo = computed(() => userStore.userInfo);
const state = reactive({
amount: '',
type: '',
accountInfo: {},
accountSelect: false,
accountEdit: false,
rules: {
min_amount: 0,
max_amount: 0,
max_num: 0,
num_unit: 0,
charge_rate_format: 0,
charge_rate: 0,
methods: [],
},
rulesList: [],
});
return list;
}
const onAccountEdit = (e) => {
state.accountEdit = e;
};
const userStore = sheep.$store('user');
const userInfo = computed(() => userStore.userInfo);
const state = reactive({
userGet: {},
accountNo: '',
name: '',
amount: '',
type: '',
accountInfo: {},
accountSelect: false,
accountEdit: false,
rules: {
min_amount: 0,
max_amount: 0,
max_num: 0,
num_unit: 0,
charge_rate_format: 0,
charge_rate: 0,
methods: [],
},
rulesList: [],
});
const onAccountSelect = (e) => {
state.accountSelect = e;
};
const onAccountEdit = (e) => {
state.accountEdit = e;
};
const onConfirm = async () => {
let payload = {
money: state.amount,
...state.accountInfo,
};
const onAccountSelect = (e) => {
state.accountSelect = e;
};
if (payload.money > userInfo.commission || payload.money <= 0) {
sheep.$helper.toast('请输入正确的提现金额');
return;
}
const onConfirm = async () => {
let payload = {
accountNo: state.accountNo,
name: state.name,
bankName: state.accountInfo.type,
type: '2',
price: state.amount * 100
};
console.log(payload);
// return;
// if (payload.money > userInfo.commission || payload.money <= 0) {
// sheep.$helper.toast('请输入正确的提现金额');
// return;
// }
if (!payload.type) {
sheep.$helper.toast('请选择提现方式');
return;
}
// if (!payload.type) {
// sheep.$helper.toast('请选择提现方式');
// return;
// }
if (!payload.account_name || !payload.account_header || !payload.account_no) {
sheep.$helper.toast('请完善您的账户信息');
return;
}
// if (!payload.account_name || !payload.account_header || !payload.account_no) {
// sheep.$helper.toast('请完善您的账户信息');
// return;
// }
if (sheep.$platform.name === 'H5' && payload.type === 'wechat') {
sheep.$helper.toast('请使用微信浏览器操作');
return;
}
// if (sheep.$platform.name === 'H5' && payload.type === 'wechat') {
// sheep.$helper.toast('请使用微信浏览器操作');
// return;
// }
let { error, msg, data } = await sheep.$api.pay.withdraw.apply(payload);
if (error === -1) {
sheep.$platform.useProvider('wechat').bind();
}
if (error === 0) {
userStore.getInfo();
uni.showModal({
title: '操作成功',
content: '您的提现申请已成功提交',
cancelText: '继续提现',
confirmText: '查看记录',
success: function (res) {
res.confirm && sheep.$router.go('/pages/pay/withdraw-log');
},
});
}
};
let {
code,
msg,
data
} = await sheep.$api.pay.withdraw.apply(payload);
if (code === -1) {
sheep.$platform.useProvider('wechat').bind();
}
if (code === 0) {
userStore.getInfo();
uni.showModal({
title: '操作成功',
content: '您的提现申请已成功提交',
cancelText: '继续提现',
confirmText: '查看记录',
success: function(res) {
res.confirm && sheep.$router.go('/pages/pay/withdraw-log');
},
});
}
};
async function getWithdrawRules() {
let { error, data } = await sheep.$api.pay.withdraw.rules();
if (error === 0) {
state.rules = data;
state.rulesList = filterRules(state.rules);
}
}
async function getWithdrawRules() {
let {
error,
data
} = await sheep.$api.pay.withdraw.rules();
if (error === 0) {
state.rules = data;
state.rulesList = filterRules(state.rules);
}
}
onBeforeMount(() => {
getWithdrawRules();
});
onBeforeMount(async () => {
getWithdrawRules();
let res = await sheep.$api.pay.withdraw.userGet();
state.userGet = res.data
});
</script>
<style lang="scss" scoped>
:deep() {
.uni-input-input {
font-family: OPPOSANS !important;
}
}
:deep() {
.uni-input-input {
font-family: OPPOSANS !important;
}
}
.wallet-num-box {
padding: 0 40rpx 80rpx;
background: var(--ui-BG-Main) v-bind(headerBg) center/750rpx 100% no-repeat;
border-radius: 0 0 5% 5%;
.wallet-num-box {
padding: 0 40rpx 80rpx;
background: var(--ui-BG-Main) v-bind(headerBg) center/750rpx 100% no-repeat;
border-radius: 0 0 5% 5%;
.num-title {
font-size: 26rpx;
font-weight: 500;
color: $white;
margin-bottom: 20rpx;
}
.num-title {
font-size: 26rpx;
font-weight: 500;
color: $white;
margin-bottom: 20rpx;
}
.wallet-num {
font-size: 60rpx;
font-weight: 500;
color: $white;
font-family: OPPOSANS;
}
.wallet-num {
font-size: 60rpx;
font-weight: 500;
color: $white;
font-family: OPPOSANS;
}
.log-btn {
width: 170rpx;
height: 60rpx;
line-height: 60rpx;
border: 1rpx solid $white;
border-radius: 30rpx;
padding: 0;
font-size: 26rpx;
font-weight: 500;
color: $white;
}
}
.log-btn {
width: 170rpx;
height: 60rpx;
line-height: 60rpx;
border: 1rpx solid $white;
border-radius: 30rpx;
padding: 0;
font-size: 26rpx;
font-weight: 500;
color: $white;
}
}
// 提现输入卡片
.draw-card {
background-color: $white;
border-radius: 20rpx;
width: 690rpx;
min-height: 560rpx;
margin: -60rpx 30rpx 30rpx 30rpx;
padding: 30rpx;
position: relative;
z-index: 3;
box-sizing: border-box;
// 提现输入卡片
.draw-card {
background-color: $white;
border-radius: 20rpx;
width: 690rpx;
min-height: 560rpx;
margin: -60rpx 30rpx 30rpx 30rpx;
padding: 30rpx;
position: relative;
z-index: 3;
box-sizing: border-box;
.card-title {
font-size: 30rpx;
font-weight: 500;
margin-bottom: 30rpx;
}
.card-title {
font-size: 30rpx;
font-weight: 500;
margin-bottom: 30rpx;
}
.bank-box {
.name {
font-size: 28rpx;
font-weight: 500;
}
.bank-box {
.name {
font-size: 28rpx;
font-weight: 500;
}
.bank-list {
.empty-text {
font-size: 28rpx;
font-weight: 400;
color: $dark-9;
}
.bank-list {
.empty-text {
font-size: 28rpx;
font-weight: 400;
color: $dark-9;
}
.cicon-forward {
color: $dark-9;
}
}
.cicon-forward {
color: $dark-9;
}
}
.input-box {
width: 624rpx;
height: 100rpx;
margin-bottom: 40rpx;
.input-box {
width: 624rpx;
height: 100rpx;
margin-bottom: 40rpx;
.unit {
font-size: 48rpx;
color: #333;
font-weight: 500;
}
.unit {
font-size: 48rpx;
color: #333;
font-weight: 500;
}
.uni-easyinput__placeholder-class {
font-size: 30rpx;
height: 36rpx;
}
.uni-easyinput__placeholder-class {
font-size: 30rpx;
height: 36rpx;
}
:deep(.uni-easyinput__content-input) {
font-size: 48rpx;
}
}
:deep(.uni-easyinput__content-input) {
font-size: 48rpx;
}
}
.save-btn {
width: 616rpx;
height: 86rpx;
line-height: 86rpx;
border-radius: 40rpx;
margin-top: 80rpx;
}
}
.save-btn {
width: 616rpx;
height: 86rpx;
line-height: 86rpx;
border-radius: 40rpx;
margin-top: 80rpx;
}
}
.bind-box {
.placeholder-text {
font-size: 26rpx;
color: $dark-9;
}
.bind-box {
.placeholder-text {
font-size: 26rpx;
color: $dark-9;
}
.add-btn {
width: 100rpx;
height: 50rpx;
border-radius: 25rpx;
line-height: 50rpx;
font-size: 22rpx;
color: var(--ui-BG-Main);
background-color: var(--ui-BG-Main-light);
}
}
.add-btn {
width: 100rpx;
height: 50rpx;
border-radius: 25rpx;
line-height: 50rpx;
font-size: 22rpx;
color: var(--ui-BG-Main);
background-color: var(--ui-BG-Main-light);
}
}
.input-box {
width: 624rpx;
height: 100rpx;
margin-bottom: 40rpx;
.input-box {
width: 624rpx;
height: 100rpx;
margin-bottom: 40rpx;
.unit {
font-size: 48rpx;
color: #333;
font-weight: 500;
}
.unit {
font-size: 48rpx;
color: #333;
font-weight: 500;
}
.uni-easyinput__placeholder-class {
font-size: 30rpx;
}
.uni-easyinput__placeholder-class {
font-size: 30rpx;
}
:deep(.uni-easyinput__content-input) {
font-size: 48rpx;
}
}
:deep(.uni-easyinput__content-input) {
font-size: 48rpx;
}
}
.save-btn {
width: 616rpx;
height: 86rpx;
line-height: 86rpx;
border-radius: 40rpx;
margin-top: 80rpx;
}
}
.save-btn {
width: 616rpx;
height: 86rpx;
line-height: 86rpx;
border-radius: 40rpx;
margin-top: 80rpx;
}
}
// 提现说明
.draw-notice {
width: 684rpx;
background: #ffffff;
border: 2rpx solid #fffaee;
border-radius: 20rpx;
margin: 20rpx 32rpx 0 32rpx;
padding: 30rpx;
box-sizing: border-box;
// 提现说明
.draw-notice {
width: 684rpx;
background: #ffffff;
border: 2rpx solid #fffaee;
border-radius: 20rpx;
margin: 20rpx 32rpx 0 32rpx;
padding: 30rpx;
box-sizing: border-box;
.title {
font-weight: 500;
color: #333333;
font-size: 30rpx;
}
.title {
font-weight: 500;
color: #333333;
font-size: 30rpx;
}
.draw-list {
font-size: 24rpx;
color: #999999;
line-height: 46rpx;
}
}
</style>
.draw-list {
font-size: 24rpx;
color: #999999;
line-height: 46rpx;
}
}
</style>
+427 -453
View File
@@ -1,510 +1,484 @@
<template>
<s-layout class="wallet-wrap" title="佣金">
<!-- 钱包卡片 -->
<view class="header-box ss-flex ss-row-center ss-col-center">
<view class="card-box ui-BG-Main ui-Shadow-Main">
<view class="card-head ss-flex ss-col-center">
<view class="card-title ss-m-r-10">我的佣金</view>
<view
@tap="state.showMoney = !state.showMoney"
class="ss-eye-icon"
:class="state.showMoney ? 'cicon-eye' : 'cicon-eye-off'"
></view>
</view>
<view class="ss-flex ss-row-between ss-col-center ss-m-t-30">
<view class="money-num">{{ state.showMoney ? userInfo.commission : '*****' }}</view>
<view class="ss-flex">
<view class="ss-m-r-20">
<button
class="ss-reset-button withdraw-btn"
@tap="sheep.$router.go('/pages/pay/withdraw')"
>
提现
</button>
</view>
<button class="ss-reset-button balance-btn ss-m-l-20" @tap="state.showModal = true">
转余额
</button>
</view>
</view>
<s-layout class="wallet-wrap" title="佣金">
<!-- 钱包卡片 -->
<view class="header-box ss-flex ss-row-center ss-col-center">
<view class="card-box ui-BG-Main ui-Shadow-Main">
<view class="card-head ss-flex ss-col-center">
<view class="card-title ss-m-r-10">当前佣金</view>
<view @tap="state.showMoney = !state.showMoney" class="ss-eye-icon"
:class="state.showMoney ? 'cicon-eye' : 'cicon-eye-off'"></view>
</view>
<view class="ss-flex ss-row-between ss-col-center ss-m-t-30">
<view class="money-num">{{ state.showMoney ? state.userInfo.withdrawPrice : '*****' }}</view>
<view class="ss-flex">
<view class="ss-m-r-20">
<button class="ss-reset-button withdraw-btn" @tap="sheep.$router.go('/pages/pay/withdraw')">
提现
</button>
</view>
<button class="ss-reset-button balance-btn ss-m-l-20" @tap="state.showModal = true">
转余额
</button>
</view>
</view>
<view class="ss-flex">
<view class="loading-money">
<view class="loading-money-title">待入账佣金</view>
<view class="loading-money-num">{{
state.showMoney ? agentInfo.pending_reward || '0.00' : '*****'
<view class="ss-flex">
<view class="loading-money">
<view class="loading-money-title">冻结佣金</view>
<view class="loading-money-num">{{
state.showMoney ? state.userInfo.frozenPrice || '0.00' : '*****'
}}</view>
</view>
<view class="loading-money ss-m-l-100">
<view class="loading-money-title">可提现佣金</view>
<view class="loading-money-num">{{
state.showMoney ? userInfo.commission || '0.00' : '*****'
</view>
<view class="loading-money ss-m-l-100">
<view class="loading-money-title">可提现佣金</view>
<view class="loading-money-num">{{
state.showMoney ? state.userInfo.brokeragePrice || '0.00' : '*****'
}}</view>
</view>
</view>
</view>
</view>
<su-sticky>
<!-- 统计 -->
<view class="filter-box ss-p-x-30 ss-flex ss-col-center ss-row-between">
<uni-datetime-picker
v-model="state.data"
type="daterange"
@change="onChangeTime"
:end="state.today"
>
<button class="ss-reset-button date-btn">
<text>{{ dateFilterText }}</text>
<text class="cicon-drop-down ss-seldate-icon"></text>
</button>
</uni-datetime-picker>
</view>
</view>
</view>
</view>
<su-sticky>
<!-- 统计 -->
<view class="filter-box ss-p-x-30 ss-flex ss-col-center ss-row-between">
<uni-datetime-picker v-model="state.data" type="daterange" @change="onChangeTime" :end="state.today">
<button class="ss-reset-button date-btn">
<text>{{ dateFilterText }}</text>
<text class="cicon-drop-down ss-seldate-icon"></text>
</button>
</uni-datetime-picker>
<view class="total-box">
<view class="ss-m-b-10">总收入{{ state.pagination.income.toFixed(2) }}</view>
<view>总支出{{ (-state.pagination.expense).toFixed(2) }}</view>
</view>
</view>
<su-tabs
:list="tabMaps"
@change="onChangeTab"
:scrollable="false"
:current="state.currentTab"
></su-tabs>
</su-sticky>
<s-empty
v-if="state.pagination.total === 0"
icon="/static/data-empty.png"
text="暂无数据"
></s-empty>
<!-- 转余额弹框 -->
<su-popup
:show="state.showModal"
type="bottom"
round="20"
@close="state.showModal = false"
showClose
>
<view class="ss-p-x-20 ss-p-y-30">
<view class="model-title ss-m-b-30 ss-m-l-20">转余额</view>
<view class="model-subtitle ss-m-b-100 ss-m-l-20">将您的佣金转到余额中继续消费</view>
<view class="input-box ss-flex ss-col-center border-bottom ss-m-b-70 ss-m-x-20">
<view class="unit"></view>
<uni-easyinput
:inputBorder="false"
class="ss-flex-1 ss-p-l-10"
v-model="state.amount"
type="number"
placeholder="请输入金额"
/>
</view>
<button
class="ss-reset-button model-btn ui-BG-Main-Gradient ui-Shadow-Main"
@tap="onConfirm"
>
确定
</button>
</view>
</su-popup>
<!-- 钱包记录 -->
<view v-if="state.pagination.total > 0">
<view
class="wallet-list ss-flex border-bottom"
v-for="item in state.pagination.data"
:key="item.id"
>
<view class="list-content">
<view class="title-box ss-flex ss-row-between ss-m-b-20">
<text class="title ss-line-1"
>{{ item.event_text }}{{ item.memo ? '-' + item.memo : '' }}</text
>
<view class="money">
<text v-if="item.amount >= 0" class="add">+{{ item.amount }}</text>
<text v-else class="minus">{{ item.amount }}</text>
</view>
</view>
<text class="time">{{ item.create_time }}</text>
</view>
</view>
</view>
<view class="total-box">
<!-- <view class="ss-m-b-10">总收入{{ state.pagination.income.toFixed(2) }}</view> -->
<!-- <view>总支出{{ (-state.pagination.expense).toFixed(2) }}</view> -->
</view>
</view>
<su-tabs :list="tabMaps" @change="onChangeTab" :scrollable="false" :current="state.currentTab"></su-tabs>
</su-sticky>
<s-empty v-if="state.pagination.total === 0" icon="/static/data-empty.png" text="暂无数据"></s-empty>
<!-- 转余额弹框 -->
<su-popup :show="state.showModal" type="bottom" round="20" @close="state.showModal = false" showClose>
<view class="ss-p-x-20 ss-p-y-30">
<view class="model-title ss-m-b-30 ss-m-l-20">转余额</view>
<view class="model-subtitle ss-m-b-100 ss-m-l-20">将您的佣金转到余额中继续消费</view>
<view class="input-box ss-flex ss-col-center border-bottom ss-m-b-70 ss-m-x-20">
<view class="unit"></view>
<uni-easyinput :inputBorder="false" class="ss-flex-1 ss-p-l-10" v-model="state.amount" type="number"
placeholder="请输入金额" />
</view>
<button class="ss-reset-button model-btn ui-BG-Main-Gradient ui-Shadow-Main" @tap="onConfirm">
确定
</button>
</view>
</su-popup>
<!-- 钱包记录 -->
<view v-if="state.pagination.total > 0">
<view class="wallet-list ss-flex border-bottom" v-for="item in state.pagination.data" :key="item.id">
<view class="list-content">
<view class="title-box ss-flex ss-row-between ss-m-b-20">
<!-- {{ item.memo ? '-' + item.memo : '' }} -->
<text class="title ss-line-1">{{ item.title }}</text>
<view class="money">
<text v-if="item.amount >= 0" class="add">+{{ item.price }}</text>
<text v-else class="minus">{{ item.price }}</text>
</view>
</view>
<text class="time">{{ sheep.$helper.timeFormat(item.createTime, 'yyyy-mm-dd hh:MM:ss') }}</text>
</view>
</view>
</view>
<!-- <u-gap></u-gap> -->
<uni-load-more
v-if="state.pagination.total > 0"
:status="state.loadStatus"
:content-text="{
<!-- <u-gap></u-gap> -->
<uni-load-more v-if="state.pagination.total > 0" :status="state.loadStatus" :content-text="{
contentdown: '上拉加载更多',
}"
/>
</s-layout>
}" />
</s-layout>
</template>
<script setup>
import { computed, reactive } from 'vue';
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
import sheep from '@/sheep';
import dayjs from 'dayjs';
import _ from 'lodash';
import {
computed,
reactive
} from 'vue';
import {
onLoad,
onReachBottom
} from '@dcloudio/uni-app';
import sheep from '@/sheep';
import dayjs from 'dayjs';
import _ from 'lodash';
const headerBg = sheep.$url.css('/static/img/shop/user/wallet_card_bg.png');
const headerBg = sheep.$url.css('/static/img/shop/user/wallet_card_bg.png');
// 数据
const pagination = {
data: [],
current_page: 1,
total: 1,
last_page: 1,
expense: 0,
income: 0,
};
const state = reactive({
showMoney: false,
date: [],
currentTab: 0,
pagination,
loadStatus: '',
showModal: false,
today: '',
});
// 数据
const pagination = {
data: [],
current_page: 1,
total: 1,
last_page: 1,
expense: 0,
income: 0,
};
const state = reactive({
userInfo: {},
showMoney: false,
date: [],
currentTab: 0,
pagination,
loadStatus: '',
showModal: false,
today: '',
});
const tabMaps = [
{
name: '全部',
value: 'all',
},
{
name: '收入',
value: 'income',
},
{
name: '支出',
value: 'expense',
},
];
const userInfo = computed(() => sheep.$store('user').userInfo);
const tabMaps = [{
name: '分佣',
value: 'all',
},
{
name: '提现',
value: 'income',
}
// {
// name: '支出',
// value: 'expense',
// },
];
const userInfo = computed(() => sheep.$store('user').userInfo);
const agentInfo = computed(() => sheep.$store('user').agentInfo);
const agentInfo = computed(() => sheep.$store('user').agentInfo);
const dateFilterText = computed(() => {
if (state.date[0] === state.date[1]) {
return state.date[0];
} else {
return state.date.join('~');
}
});
const dateFilterText = computed(() => {
if (state.date[0] === state.date[1]) {
return state.date[0];
} else {
return state.date.join('~');
}
});
async function getLogList(page = 1, list_rows = 8) {
state.loadStatus = 'loading';
let res = await sheep.$api.user.wallet.log({
type: 'commission',
tab: tabMaps[state.currentTab].value,
list_rows,
page,
date: appendTimeHMS(state.date),
});
if (res.error === 0) {
let list = _.concat(state.pagination.data, res.data.list.data);
state.pagination = {
...res.data.list,
data: list,
income: res.data.income,
expense: res.data.expense,
};
if (state.pagination.current_page < state.pagination.last_page) {
state.loadStatus = 'more';
} else {
state.loadStatus = 'noMore';
}
}
}
async function getLogList(page = 1, list_rows = 4) {
state.loadStatus = 'loading';
let ress = await sheep.$api.commission.getSummary();
state.userInfo = ress.data;
let res = await sheep.$api.user.wallet.log3({
// type: 'commission',
// tab: tabMaps[state.currentTab].value,
pageSize: list_rows,
pageNo: page,
// date: appendTimeHMS(state.date),
});
if (res.code === 0) {
let list = _.concat(state.pagination.data, res.data.list);
state.pagination = {
current_page: page,
...res.data,
data: list,
// income: res.data.income,
// expense: res.data.expense,
};
if (state.pagination.data.length < state.pagination.total) {
state.loadStatus = 'more';
} else {
state.loadStatus = 'noMore';
}
}
}
function onChangeTab(e) {
state.pagination = pagination;
state.currentTab = e.index;
getLogList();
}
function onChangeTab(e) {
state.pagination = pagination;
state.currentTab = e.index;
getLogList();
}
function onChangeTime(e) {
state.date[0] = e[0];
state.date[1] = e[e.length - 1];
state.pagination = pagination;
getLogList();
}
function onChangeTime(e) {
state.date[0] = e[0];
state.date[1] = e[e.length - 1];
state.pagination = pagination;
getLogList();
}
function appendTimeHMS(arr) {
return [arr[0] + ' 00:00:00', arr[1] + ' 23:59:59'];
}
function appendTimeHMS(arr) {
return [arr[0] + ' 00:00:00', arr[1] + ' 23:59:59'];
}
// 确认操作
async function onConfirm() {
if (state.amount <= 0) {
sheep.$helper.toast('请输入正确的金额');
return;
}
uni.showModal({
title: '提示',
content: '确认把您的佣金转入到余额钱包中?',
success: async function (res) {
if (res.confirm) {
const { error } = await sheep.$api.commission.transfer({
amount: state.amount,
});
if (error === 0) {
state.showModal = false;
sheep.$store('user').getInfo();
onChangeTab({ index: 0 });
}
}
},
});
}
async function getAgentInfo() {
const { code, data } = await sheep.$store('user').getAgentInfo();
}
onLoad(async (options) => {
state.today = dayjs().format('YYYY-MM-DD');
state.date = [state.today, state.today];
getLogList();
getAgentInfo();
});
// 确认操作
async function onConfirm() {
if (state.amount <= 0) {
sheep.$helper.toast('请输入正确的金额');
return;
}
uni.showModal({
title: '提示',
content: '确认把您的佣金转入到余额钱包中?',
success: async function(res) {
if (res.confirm) {
const {
error
} = await sheep.$api.commission.transfer({
amount: state.amount,
});
if (error === 0) {
state.showModal = false;
sheep.$store('user').getInfo();
onChangeTab({
index: 0
});
}
}
},
});
}
async function getAgentInfo() {
const {
code,
data
} = await sheep.$store('user').getAgentInfo();
}
onLoad(async (options) => {
state.today = dayjs().format('YYYY-MM-DD');
state.date = [state.today, state.today];
getLogList();
getAgentInfo();
});
onReachBottom(() => {
if (state.loadStatus !== 'noMore') {
getLogList(state.pagination.current_page + 1);
}
});
onReachBottom(() => {
if (state.loadStatus !== 'noMore') {
getLogList(state.pagination.current_page + 1);
}
});
</script>
<style lang="scss" scoped>
// 钱包
.header-box {
background-color: $white;
padding: 30rpx;
// 钱包
.header-box {
background-color: $white;
padding: 30rpx;
.card-box {
width: 100%;
min-height: 300rpx;
padding: 40rpx;
background-size: 100% 100%;
border-radius: 30rpx;
overflow: hidden;
position: relative;
z-index: 1;
box-sizing: border-box;
.card-box {
width: 100%;
min-height: 300rpx;
padding: 40rpx;
background-size: 100% 100%;
border-radius: 30rpx;
overflow: hidden;
position: relative;
z-index: 1;
box-sizing: border-box;
&::after {
content: '';
display: block;
width: 100%;
height: 100%;
z-index: 2;
position: absolute;
top: 0;
left: 0;
background: v-bind(headerBg) no-repeat;
pointer-events: none;
}
&::after {
content: '';
display: block;
width: 100%;
height: 100%;
z-index: 2;
position: absolute;
top: 0;
left: 0;
background: v-bind(headerBg) no-repeat;
pointer-events: none;
}
.card-head {
color: $white;
font-size: 24rpx;
}
.card-head {
color: $white;
font-size: 24rpx;
}
.ss-eye-icon {
font-size: 40rpx;
color: $white;
}
.ss-eye-icon {
font-size: 40rpx;
color: $white;
}
.money-num {
font-size: 40rpx;
line-height: normal;
font-weight: 500;
color: $white;
font-family: OPPOSANS;
}
.money-num {
font-size: 40rpx;
line-height: normal;
font-weight: 500;
color: $white;
font-family: OPPOSANS;
}
.reduce-num {
font-size: 26rpx;
font-weight: 400;
color: $white;
}
.reduce-num {
font-size: 26rpx;
font-weight: 400;
color: $white;
}
.withdraw-btn {
width: 120rpx;
height: 60rpx;
line-height: 60rpx;
border-radius: 30px;
font-size: 24rpx;
font-weight: 500;
background-color: $white;
color: var(--ui-BG-Main);
}
.withdraw-btn {
width: 120rpx;
height: 60rpx;
line-height: 60rpx;
border-radius: 30px;
font-size: 24rpx;
font-weight: 500;
background-color: $white;
color: var(--ui-BG-Main);
}
.balance-btn {
width: 120rpx;
height: 60rpx;
line-height: 60rpx;
border-radius: 30px;
font-size: 24rpx;
font-weight: 500;
color: $white;
border: 1px solid $white;
}
}
}
.balance-btn {
width: 120rpx;
height: 60rpx;
line-height: 60rpx;
border-radius: 30px;
font-size: 24rpx;
font-weight: 500;
color: $white;
border: 1px solid $white;
}
}
}
.loading-money {
margin-top: 56rpx;
.loading-money-title {
font-size: 24rpx;
font-weight: 400;
color: #ffffff;
line-height: normal;
margin-bottom: 30rpx;
}
.loading-money {
margin-top: 56rpx;
.loading-money-num {
font-size: 30rpx;
font-family: OPPOSANS;
font-weight: 500;
color: #fefefe;
}
}
.loading-money-title {
font-size: 24rpx;
font-weight: 400;
color: #ffffff;
line-height: normal;
margin-bottom: 30rpx;
}
// 筛选
.loading-money-num {
font-size: 30rpx;
font-family: OPPOSANS;
font-weight: 500;
color: #fefefe;
}
}
.filter-box {
height: 120rpx;
padding: 0 30rpx;
background-color: $bg-page;
// 筛选
.total-box {
font-size: 24rpx;
font-weight: 500;
color: $dark-9;
}
.filter-box {
height: 120rpx;
padding: 0 30rpx;
background-color: $bg-page;
.date-btn {
background-color: $white;
line-height: 54rpx;
border-radius: 27rpx;
padding: 0 20rpx;
font-size: 24rpx;
font-weight: 500;
color: $dark-6;
.total-box {
font-size: 24rpx;
font-weight: 500;
color: $dark-9;
}
.ss-seldate-icon {
font-size: 50rpx;
color: $dark-9;
}
}
}
.date-btn {
background-color: $white;
line-height: 54rpx;
border-radius: 27rpx;
padding: 0 20rpx;
font-size: 24rpx;
font-weight: 500;
color: $dark-6;
// tab
.wallet-tab-card {
.tab-item {
height: 80rpx;
position: relative;
.ss-seldate-icon {
font-size: 50rpx;
color: $dark-9;
}
}
}
.tab-title {
font-size: 30rpx;
}
// tab
.wallet-tab-card {
.tab-item {
height: 80rpx;
position: relative;
.cur-tab-title {
font-weight: $font-weight-bold;
}
.tab-title {
font-size: 30rpx;
}
.tab-line {
width: 60rpx;
height: 6rpx;
border-radius: 6rpx;
position: absolute;
left: 50%;
transform: translateX(-50%);
bottom: 2rpx;
background-color: var(--ui-BG-Main);
}
}
}
.cur-tab-title {
font-weight: $font-weight-bold;
}
// 钱包记录
.wallet-list {
padding: 30rpx;
background-color: #ffff;
.tab-line {
width: 60rpx;
height: 6rpx;
border-radius: 6rpx;
position: absolute;
left: 50%;
transform: translateX(-50%);
bottom: 2rpx;
background-color: var(--ui-BG-Main);
}
}
}
.head-img {
width: 70rpx;
height: 70rpx;
border-radius: 50%;
background: $gray-c;
}
// 钱包记录
.wallet-list {
padding: 30rpx;
background-color: #ffff;
.list-content {
justify-content: space-between;
align-items: flex-start;
flex: 1;
.head-img {
width: 70rpx;
height: 70rpx;
border-radius: 50%;
background: $gray-c;
}
.title {
font-size: 28rpx;
color: $dark-3;
width: 400rpx;
}
.list-content {
justify-content: space-between;
align-items: flex-start;
flex: 1;
.time {
color: $gray-c;
font-size: 22rpx;
}
}
.title {
font-size: 28rpx;
color: $dark-3;
width: 400rpx;
}
.money {
font-size: 28rpx;
font-weight: bold;
font-family: OPPOSANS;
.time {
color: $gray-c;
font-size: 22rpx;
}
}
.add {
color: var(--ui-BG-Main);
}
.money {
font-size: 28rpx;
font-weight: bold;
font-family: OPPOSANS;
.minus {
color: $dark-3;
}
}
}
.add {
color: var(--ui-BG-Main);
}
.model-title {
font-size: 36rpx;
font-weight: bold;
color: #333333;
}
.minus {
color: $dark-3;
}
}
}
.model-subtitle {
font-size: 26rpx;
color: #c2c7cf;
}
.model-title {
font-size: 36rpx;
font-weight: bold;
color: #333333;
}
.model-btn {
width: 100%;
height: 80rpx;
border-radius: 40rpx;
font-size: 28rpx;
font-weight: 500;
color: #ffffff;
line-height: normal;
}
.model-subtitle {
font-size: 26rpx;
color: #c2c7cf;
}
.input-box {
height: 100rpx;
.model-btn {
width: 100%;
height: 80rpx;
border-radius: 40rpx;
font-size: 28rpx;
font-weight: 500;
color: #ffffff;
line-height: normal;
}
.unit {
font-size: 48rpx;
color: #333;
font-weight: 500;
line-height: normal;
}
.input-box {
height: 100rpx;
.uni-easyinput__placeholder-class {
font-size: 30rpx;
height: 40rpx;
line-height: normal;
}
}
</style>
.unit {
font-size: 48rpx;
color: #333;
font-weight: 500;
line-height: normal;
}
.uni-easyinput__placeholder-class {
font-size: 30rpx;
height: 40rpx;
line-height: normal;
}
}
</style>
+16
View File
@@ -60,5 +60,21 @@ export default {
url: '/app-api/member/sign-in/record/get-summary',
method: 'GET',
}),
getBargainRecordSummary: () =>
request({
url: '/app-api/promotion/bargain-record/get-summary',
method: 'GET',
}),
getBargainActivityPage: () =>
request({
url: '/app-api/promotion/bargain-activity/page',
method: 'GET',
}),
getBargainActivityDetail: (params) =>
request({
url: '/app-api/promotion/bargain-activity/get-detail',
method: 'GET',
params
}),
};
+20 -2
View File
@@ -37,7 +37,7 @@ export default {
// 分销订单
order: (params) =>
request({
url: 'commission/order',
url: '/app-api/trade/brokerage-record/page',
method: 'GET',
params,
}),
@@ -52,7 +52,7 @@ export default {
// 我的团队
team: (params) =>
request({
url: 'commission/agent/team',
url: '/app-api/trade/brokerage-user/child-summary-page',
method: 'GET',
params,
}),
@@ -68,4 +68,22 @@ export default {
url: '/app-api/trade/brokerage-user/get-summary',
method: 'GET',
}),
getBrokerageRankNumber: (params) =>
request({
url: '/app-api/trade/brokerage-user/get-rank-by-price',
method: 'GET',
params
}),
getBrokerageRankList: (params) =>
request({
url: '/app-api/trade/brokerage-user/rank-page-by-price',
method: 'GET',
params
}),
getRanklist: (params) =>
request({
url: '/app-api/trade/brokerage-user/rank-page-by-user-count',
method: 'GET',
params
}),
};
+51 -41
View File
@@ -1,44 +1,54 @@
import request from '@/sheep/request';
export default {
// 预支付
prepay: (data) =>
request({
url: 'pay/prepay',
method: 'POST',
data,
custom: {
loadingMsg: '支付中',
},
}),
// 发起提现
withdraw: {
list: (params) =>
request({
url: 'withdraw',
method: 'GET',
params,
custom: {
auth: true,
},
}),
rules: () =>
request({
url: 'withdraw/rules',
method: 'GET',
custom: {
auth: true,
},
}),
apply: (data) =>
request({
url: 'withdraw/apply',
method: 'POST',
data,
custom: {
loadingMsg: '申请中',
auth: true,
},
}),
},
};
// 预支付
prepay: (data) =>
request({
url: 'pay/prepay',
method: 'POST',
data,
custom: {
loadingMsg: '支付中',
},
}),
// 发起提现
withdraw: {
list: (params) =>
request({
url: 'withdraw',
method: 'GET',
params,
custom: {
auth: true,
},
}),
rules: () =>
request({
url: 'withdraw/rules',
method: 'GET',
custom: {
auth: true,
},
}),
apply: (data) =>
request({
url: '/app-api/trade/brokerage-withdraw/create',
method: 'POST',
data,
custom: {
loadingMsg: '申请中',
// auth: true,
},
}),
userGet: (params) =>
request({
url: '/app-api/trade/brokerage-user/get',
method: 'GET',
params,
// custom: {
// loadingMsg: '申请中',
// auth: true,
// },
}),
},
};
+18 -16
View File
@@ -1,20 +1,22 @@
import request from '@/sheep/request';
const DiyTemplateApi = {
// TODO 芋艿:测试
getUsedDiyTemplate: () => {
return request({
url: '/app-api/promotion/diy-template/used',
method: 'GET',
});
},
getDiyTemplate: (id) => {
return request({
url: '/app-api/promotion/diy-template/get',
method: 'GET',
params: { id }
});
},
const DiyTemplateApi = {
// TODO 芋艿:测试
// getUsedDiyTemplate: () => {
// return request({
// url: '/app-api/promotion/diy-template/used',
// method: 'GET',
// });
// },
getDiyTemplate: (id) => {
return request({
url: '/app-api/promotion/diy-template/get',
method: 'GET',
params: {
id
}
});
},
};
export default DiyTemplateApi;
export default DiyTemplateApi;
+7
View File
@@ -264,6 +264,13 @@ export default {
params,
custom: {},
}),
log3: (params) =>
request({
url: '/app-api/trade/brokerage-record/page',
// url: 'pay/wallet-transaction/page',
method: 'GET',
params,
}),
},
account: {
info: (params) =>
@@ -0,0 +1,173 @@
<template>
<view class="time" :style="justifyLeft">
<text class="" v-if="tipText">{{ tipText }}</text>
<text class="styleAll p6" v-if="isDay === true"
:style="{background:bgColor.bgColor,color:bgColor.Color}">{{ day }}{{bgColor.isDay?'天':''}}</text>
<text class="timeTxt" v-if="dayText"
:style="{width:bgColor.timeTxtwidth,color:bgColor.bgColor}">{{ dayText }}</text>
<text class="styleAll" :class='isCol?"timeCol":""'
:style="{background:bgColor.bgColor,color:bgColor.Color,width:bgColor.width}">{{ hour }}</text>
<text class="timeTxt" v-if="hourText" :class='isCol?"whit":""'
:style="{width:bgColor.timeTxtwidth,color:bgColor.bgColor}">{{ hourText }}</text>
<text class="styleAll" :class='isCol?"timeCol":""'
:style="{background:bgColor.bgColor,color:bgColor.Color,width:bgColor.width}">{{ minute }}</text>
<text class="timeTxt" v-if="minuteText" :class='isCol?"whit":""'
:style="{width:bgColor.timeTxtwidth,color:bgColor.bgColor}">{{ minuteText }}</text>
<text class="styleAll" :class='isCol?"timeCol":""'
:style="{background:bgColor.bgColor,color:bgColor.Color,width:bgColor.width}">{{ second }}</text>
<text class="timeTxt" v-if="secondText">{{ secondText }}</text>
</view>
</template>
<script>
export default {
name: "countDown",
props: {
justifyLeft: {
type: String,
default: ""
},
//距离开始提示文字
tipText: {
type: String,
default: "倒计时"
},
dayText: {
type: String,
default: "天"
},
hourText: {
type: String,
default: "时"
},
minuteText: {
type: String,
default: "分"
},
secondText: {
type: String,
default: "秒"
},
datatime: {
type: Number,
default: 0
},
isDay: {
type: Boolean,
default: true
},
isCol: {
type: Boolean,
default: false
},
bgColor: {
type: Object,
default: null
}
},
data: function() {
return {
day: "00",
hour: "00",
minute: "00",
second: "00"
};
},
created: function() {
this.show_time();
},
mounted: function() {},
methods: {
show_time: function() {
let that = this;
function runTime() {
//时间函数
let intDiff = that.datatime - Date.parse(new Date()) / 1000; //获取数据中的时间戳的时间差;
let day = 0,
hour = 0,
minute = 0,
second = 0;
if (intDiff > 0) {
//转换时间
if (that.isDay === true) {
day = Math.floor(intDiff / (60 * 60 * 24));
} else {
day = 0;
}
hour = Math.floor(intDiff / (60 * 60)) - day * 24;
minute = Math.floor(intDiff / 60) - day * 24 * 60 - hour * 60;
second =
Math.floor(intDiff) -
day * 24 * 60 * 60 -
hour * 60 * 60 -
minute * 60;
if (hour <= 9) hour = "0" + hour;
if (minute <= 9) minute = "0" + minute;
if (second <= 9) second = "0" + second;
that.day = day;
that.hour = hour;
that.minute = minute;
that.second = second;
} else {
that.day = "00";
that.hour = "00";
that.minute = "00";
that.second = "00";
}
}
runTime();
setInterval(runTime, 1000);
}
}
};
</script>
<style scoped>
.p6 {
padding: 0 8rpx;
}
.styleAll {
/* color: #fff; */
font-size: 24rpx;
height: 36rpx;
line-height: 36rpx;
border-radius: 6rpx;
text-align: center;
/* padding: 0 6rpx; */
}
.timeTxt {
text-align: center;
/* width: 16rpx; */
height: 36rpx;
line-height: 36rpx;
display: inline-block;
}
.whit {
color: #fff !important;
}
.time {
display: flex;
justify-content: center;
}
.red {
color: #fc4141;
margin: 0 4rpx;
}
.timeCol {
/* width: 40rpx;
height: 40rpx;
line-height: 40rpx;
text-align:center;
border-radius: 6px;
background: #fff;
font-size: 24rpx; */
color: #E93323;
}
</style>