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> <template>
<view class="distribution-log-wrap"> <view class="distribution-log-wrap">
<view class="header-box"> <view class="header-box">
<image class="header-bg" :src="sheep.$url.static('/static/img/shop/commission/title2.png')" /> <image class="header-bg" :src="sheep.$url.static('/static/img/shop/commission/title2.png')" />
<view class="ss-flex header-title"> <view class="ss-flex header-title">
<view class="title">实时动态</view> <view class="title">实时动态</view>
<text class="cicon-forward"></text> <text class="cicon-forward"></text>
</view> </view>
</view> </view>
<scroll-view <scroll-view scroll-y="true" @scrolltolower="loadmore" class="scroll-box log-scroll"
scroll-y="true" scroll-with-animation="true">
@scrolltolower="loadmore" <view v-if="state.pagination.data">
class="scroll-box log-scroll" <view class="log-item-box ss-flex ss-row-between" v-for="item in state.pagination.data" :key="item.id">
scroll-with-animation="true" <view class="log-item-wrap">
> <view class="log-item ss-flex ss-ellipsis-1 ss-col-center">
<view v-if="state.pagination.data"> <view class="ss-flex ss-col-center">
<view <image v-if="item.oper_type === 'user'" class="log-img"
class="log-item-box ss-flex ss-row-between" :src="sheep.$url.cdn(item.oper?.avatar)" mode="aspectFill"></image>
v-for="item in state.pagination.data" <image v-else-if="item.oper_type === 'admin'" class="log-img"
:key="item.id" :src="sheep.$url.static('/static/img/shop/avatar/default_user.png')"
> mode="aspectFill"></image>
<view class="log-item-wrap"> <image v-else class="log-img"
<view class="log-item ss-flex ss-ellipsis-1 ss-col-center"> :src="sheep.$url.static('/static/img/shop/avatar/notice.png')" mode="aspectFill">
<view class="ss-flex ss-col-center"> </image>
<image </view>
v-if="item.oper_type === 'user'" <view class="log-text ss-ellipsis-1">{{ item.title }} {{item.price/100}}</view>
class="log-img" </view>
:src="sheep.$url.cdn(item.oper?.avatar)" </view>
mode="aspectFill" <text class="log-time">{{ dayjs(item.createTime).fromNow() }}</text>
></image> </view>
<image </view>
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>
<!-- 加载更多 --> <!-- 加载更多 -->
<uni-load-more <uni-load-more v-if="state.pagination.total > 0" :status="state.loadStatus" color="#333333"
v-if="state.pagination.total > 0" @tap="loadmore" />
:status="state.loadStatus" </scroll-view>
color="#333333" </view>
@tap="loadmore"
/>
</scroll-view>
</view>
</template> </template>
<script setup> <script setup>
import sheep from '@/sheep'; import sheep from '@/sheep';
import { computed, reactive } from 'vue'; import {
import _ from 'lodash'; computed,
import dayjs from 'dayjs'; reactive
} from 'vue';
import _ from 'lodash';
import dayjs from 'dayjs';
const state = reactive({ const state = reactive({
loadStatus: '', loadStatus: '',
pagination: { pagination: {
data: [], data: [],
current_page: 1, current_page: 1,
total: 1, total: 1,
last_page: 1, last_page: 1,
}, },
}); });
async function getLog(page = 1) { async function getLog(page = 1) {
const res = await sheep.$api.commission.log({ state.pagination.current_page = page
page, const res = await sheep.$api.commission.order({
}); page,
if (res.error === 0) { });
let list = _.concat(state.pagination.data, res.data.data); console.log(res, '下面的数据')
state.pagination = { if (res.code === 0) {
...res.data, let list = _.concat(state.pagination.data, res.data.list);
data: list, state.pagination = {
}; ...res.data,
if (state.pagination.current_page < state.pagination.last_page) { data: list,
state.loadStatus = 'more'; };
} else { if (state.pagination.data.length < state.pagination.total) {
state.loadStatus = 'noMore'; state.loadStatus = 'more';
} } else {
} state.loadStatus = 'noMore';
} }
getLog(); }
}
getLog();
// 加载更多 // 加载更多
function loadmore() { function loadmore() {
if (state.loadStatus !== 'noMore') { if (state.loadStatus !== 'noMore') {
getLog(state.pagination.current_page + 1); getLog(state.pagination.current_page + 1);
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.distribution-log-wrap { .distribution-log-wrap {
width: 690rpx; width: 690rpx;
margin: 0 auto; margin: 0 auto;
margin-bottom: 20rpx; margin-bottom: 20rpx;
border-radius: 12rpx; border-radius: 12rpx;
z-index: 3; z-index: 3;
position: relative; 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;
.log-item-box { .header-box {
margin-bottom: 20rpx; width: 690rpx;
.log-time { height: 76rpx;
// margin-left: 30rpx; position: relative;
text-align: right;
font-size: 24rpx;
font-family: OPPOSANS;
font-weight: 400;
color: #c4c4c4;
}
}
.loadmore-wrap { .header-bg {
// line-height: 80rpx; width: 690rpx;
} height: 76rpx;
}
.log-item { .header-title {
// background: rgba(#ffffff, 0.2); position: absolute;
border-radius: 24rpx; left: 20rpx;
padding: 6rpx 20rpx 6rpx 12rpx; top: 24rpx;
}
.log-img { .title {
width: 40rpx; font-size: 28rpx;
height: 40rpx; font-weight: 500;
border-radius: 50%; color: #ffffff;
margin-right: 10rpx; line-height: 30rpx;
} }
.log-text { .cicon-forward {
max-width: 480rpx; font-size: 30rpx;
font-size: 24rpx; font-weight: 400;
font-weight: 500; color: #ffffff;
color: #333333; line-height: 30rpx;
} }
} }
}
} .log-scroll {
</style> 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> <template>
<view class="menu-box ss-flex-col"> <view class="menu-box ss-flex-col">
<view class="header-box"> <view class="header-box">
<image class="header-bg" :src="sheep.$url.static('/static/img/shop/commission/title1.png')" /> <image class="header-bg" :src="sheep.$url.static('/static/img/shop/commission/title1.png')" />
<view class="ss-flex header-title"> <view class="ss-flex header-title">
<view class="title">功能专区</view> <view class="title">功能专区</view>
<text class="cicon-forward"></text> <text class="cicon-forward"></text>
</view> </view>
</view> </view>
<view class="menu-list ss-flex ss-flex-wrap"> <view class="menu-list ss-flex ss-flex-wrap">
<view <view v-for="(item, index) in state.menuList" :key="index" class="item-box ss-flex-col ss-col-center"
v-for="(item, index) in state.menuList" @tap="sheep.$router.go(item.path)">
:key="index" <image class="menu-icon ss-m-b-10" :src="sheep.$url.static(item.img)" mode="aspectFill"></image>
class="item-box ss-flex-col ss-col-center" <view>{{ item.title }}</view>
@tap="sheep.$router.go(item.path)" </view>
> </view>
<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 <uni-grid-item
v-for="(item, index) in state.menuList" v-for="(item, index) in state.menuList"
:index="index" :index="index"
@@ -41,113 +33,132 @@
</view> </view>
</uni-grid-item> </uni-grid-item>
</uni-grid> --> </uni-grid> -->
</view> </view>
</template> </template>
<script setup> <script setup>
import sheep from '@/sheep'; import sheep from '@/sheep';
import { onLoad } from '@dcloudio/uni-app'; import {
import { computed, reactive } from 'vue'; onLoad
} from '@dcloudio/uni-app';
import {
computed,
reactive
} from 'vue';
const state = reactive({ const state = reactive({
menuList: [ menuList: [{
{ img: '/static/img/shop/commission/commission_icon1.png',
img: '/static/img/shop/commission/commission_icon1.png', title: '我的团队',
title: '我的团队', path: '/pages/commission/team',
path: '/pages/commission/team', },
}, {
{ img: '/static/img/shop/commission/commission_icon2.png',
img: '/static/img/shop/commission/commission_icon2.png', title: '佣金明细',
title: '佣金明细', path: '/pages/user/wallet/commission',
path: '/pages/user/wallet/commission', },
}, {
{ img: '/static/img/shop/commission/commission_icon3.png',
img: '/static/img/shop/commission/commission_icon3.png', title: '分销订单',
title: '分销订单', path: '/pages/commission/order',
path: '/pages/commission/order', },
}, {
{ img: '/static/img/shop/commission/commission_icon4.png',
img: '/static/img/shop/commission/commission_icon4.png', title: '推广商品',
title: '推广商品', path: '/pages/commission/goods',
path: '/pages/commission/goods', },
}, // {
{ // img: '/static/img/shop/commission/commission_icon5.png',
img: '/static/img/shop/commission/commission_icon5.png', // title: '我的资料',
title: '我的资料', // path: '/pages/commission/apply',
path: '/pages/commission/apply', // isAgentFrom: true,
isAgentFrom: true, // },
}, // todo @芋艿:邀请海报需要登录后的个人数据
{ {
img: '/static/img/shop/commission/commission_icon7.png', img: '/static/img/shop/commission/commission_icon7.png',
title: '邀请海报', title: '邀请海报',
path: 'action:showShareModal', path: 'action:showShareModal',
}, }, {
{ // img: '/static/img/shop/commission/commission_icon7.png',
img: '/static/img/shop/commission/commission_icon8.png', title: '推广人排行榜',
title: '分享记录', path: '/pages/commission/promoter',
path: '/pages/commission/share-log', }, {
}, // 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> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.menu-box { .menu-box {
margin: 0 auto; margin: 0 auto;
width: 690rpx; width: 690rpx;
margin-bottom: 20rpx; margin-bottom: 20rpx;
margin-top: 20rpx; margin-top: 20rpx;
border-radius: 12rpx; border-radius: 12rpx;
z-index: 3; z-index: 3;
position: relative; 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-list { .header-box {
padding: 50rpx 0 10rpx 0; width: 690rpx;
background: #fdfae9; height: 76rpx;
border-radius: 0 0 12rpx 12rpx; position: relative;
}
.item-box {
width: 25%;
margin-bottom: 40rpx;
}
.menu-icon { .header-bg {
width: 68rpx; width: 690rpx;
height: 68rpx; height: 76rpx;
background: #ffffff; }
border-radius: 50%;
}
.menu-title { .header-title {
font-size: 26rpx; position: absolute;
font-weight: 500; left: 20rpx;
color: #ffffff; top: 24rpx;
} }
</style>
.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> <template>
<s-layout navbar="inner" class="index-wrap" title="分销中心" :bgStyle="bgStyle" onShareAppMessage> <s-layout navbar="inner" class="index-wrap" title="分销中心" :bgStyle="bgStyle" onShareAppMessage>
<!-- 分销商信息 --> <!-- 分销商信息 -->
<commission-info /> <commission-info />
<!-- 账户信息 --> <!-- 账户信息 -->
<account-info /> <account-info />
<!-- 菜单栏 --> <!-- 菜单栏 -->
<commission-menu /> <commission-menu />
<!-- 分销记录 --> <!-- 分销记录 -->
<commission-log /> <commission-log />
<!-- 弹框 --> <!-- 弹框 -->
<commission-condition :error="state.error" :errorData="state.errorData" /> <commission-condition :error="state.error" :errorData="state.errorData" />
<!-- 权限 --> <!-- 权限 -->
<commission-auth :error="state.error" @getAgentInfo="getAgentInfo" /> <commission-auth :error="state.error" @getAgentInfo="getAgentInfo" />
</s-layout> </s-layout>
</template> </template>
<script setup> <script setup>
import sheep from '@/sheep'; import sheep from '@/sheep';
import { onShow } from '@dcloudio/uni-app'; import {
import { computed, reactive } from 'vue'; onShow
import commissionInfo from './components/commission-info.vue'; } from '@dcloudio/uni-app';
import accountInfo from './components/account-info.vue'; import {
import commissionLog from './components/commission-log.vue'; computed,
import commissionMenu from './components/commission-menu.vue'; reactive
import commissionAuth from './components/commission-auth.vue'; } from 'vue';
import commissionCondition from './components/commission-condition.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({ const state = reactive({
error: 0, error: 0,
errorData: {}, errorData: {},
config: { config: {
background: '/storage/default/20220704/29ac76a3c9d0d983200d612e45a052ca.png', background: '/storage/default/20220704/29ac76a3c9d0d983200d612e45a052ca.png',
}, },
}); });
const agentInfo = computed(() => sheep.$store('user').agentInfo); const agentInfo = computed(() => sheep.$store('user').agentInfo);
const bgStyle = { const bgStyle = {
color: '#F7D598', color: '#F7D598',
}; };
async function getAgentInfo() { async function getAgentInfo() {
const { error, data } = await sheep.$store('user').getAgentInfo(); const {
if (error !== 0) { error,
state.error = error; data
state.errorData = data; } = await sheep.$store('user').getAgentInfo();
} if (error !== 0) {
} state.error = error;
onShow(() => { state.errorData = data;
getAgentInfo(); }
}); }
onShow(() => {
getAgentInfo();
});
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
:deep(.page-main) { :deep(.page-main) {
background-size: 100% 100% !important; background-size: 100% 100% !important;
} }
</style> </style>
+34 -28
View File
@@ -8,15 +8,15 @@
}, },
]"> ]">
<!-- 团队数据总览 --> <!-- 团队数据总览 -->
<view class="team-data-box ss-flex ss-col-center ss-row-between"> <view class="team-data-box ss-flex ss-col-center ss-row-between" style="width:100%">
<view class="data-card"> <view class="data-card" style="width:100%">
<view class="total-item"> <view class="total-item" style="width:100%">
<view class="item-title">团队订单数量</view> <view class="item-title" style='text-align: center;'>累计推广订单</view>
<view class="total-num"> <view class="total-num" style='text-align: center;'>
{{ state.agentInfo.child_order_count_all || 0 }} {{ state.totals||state.pagination.total|| 0 }}
</view> </view>
</view> </view>
<view class="category-item ss-flex"> <!-- <view class="category-item ss-flex">
<view class="ss-flex-1"> <view class="ss-flex-1">
<view class="item-title">一级订单</view> <view class="item-title">一级订单</view>
<view class="category-num"> <view class="category-num">
@@ -29,9 +29,9 @@
{{ state.agentInfo.child_order_count_2 || 0 }} {{ state.agentInfo.child_order_count_2 || 0 }}
</view> </view>
</view> </view>
</view> </view> -->
</view> </view>
<view class="data-card"> <!-- <view class="data-card">
<view class="total-item"> <view class="total-item">
<view class="item-title">团队订单金额</view> <view class="item-title">团队订单金额</view>
<view class="total-num"> <view class="total-num">
@@ -52,10 +52,10 @@
</view> </view>
</view> </view>
</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="direct-item">
<view class="item-title">自购分销订单数量</view> <view class="item-title">自购分销订单数量</view>
<view class="item-value"> <view class="item-value">
@@ -68,7 +68,7 @@
{{ state.agentInfo.child_order_money_0 || '0.00' }} {{ state.agentInfo.child_order_money_0 || '0.00' }}
</view> </view>
</view> </view>
</view> </view> -->
</view> </view>
<!-- tab --> <!-- tab -->
@@ -131,7 +131,7 @@
} from '@dcloudio/uni-app'; } from '@dcloudio/uni-app';
import { import {
computed, computed,
reactive reactive,
} from 'vue'; } from 'vue';
import _ from 'lodash'; import _ from 'lodash';
import { import {
@@ -149,10 +149,11 @@
}); });
const state = reactive({ const state = reactive({
totals: 0,
pagination: { pagination: {
data: [], data: [],
current_page: 1, current_page: 1,
total: 1, total: '',
last_page: 1, last_page: 1,
}, },
loadStatus: '', loadStatus: '',
@@ -170,24 +171,24 @@
// value: 'no' // value: 'no'
// }, // },
{ {
name: '已计入', name: '待结算',
value: 'yes', value: 'yes',
}, },
{ {
name: '已扣除', name: '已结算',
value: 'back', value: 'back',
}, },
{ // {
name: '已取消', // name: '已取消',
value: 'cancel', // value: 'cancel',
}, // },
]; ];
// 切换选项卡 // 切换选项卡
function onTabsChange(e) { function onTabsChange(e) {
state.pagination = { state.pagination = {
data: [], data: [],
current_page: 1, current_page: 1,
total: 1, total: 0,
last_page: 1, last_page: 1,
}; };
state.currentTab = e.index; state.currentTab = e.index;
@@ -196,19 +197,24 @@
// 获取订单列表 // 获取订单列表
async function getOrderList(page = 1, list_rows = 5) { async function getOrderList(page = 1, list_rows = 5) {
// todo @芋艿:没有测试数据,还需对接请求参数,和返回的数据字段
state.loadStatus = 'loading'; state.loadStatus = 'loading';
let res = await sheep.$api.commission.order({ let res = await sheep.$api.commission.order({
type: tabMaps[state.currentTab].value, // type: tabMaps[state.currentTab].value,
list_rows, pageSize: list_rows,
page, pageNo: page,
// status
// bizType
}); });
if (res.error === 0) { if (res.code === 0) {
let orderList = _.concat(state.pagination.data, res.data.data); let orderList = _.concat(state.pagination.data, res.data.list);
state.pagination = { state.pagination = {
...res.data, ...res.data,
data: orderList, 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'; state.loadStatus = 'more';
} else { } else {
state.loadStatus = 'noMore'; state.loadStatus = 'noMore';
@@ -228,7 +234,7 @@
} }
onLoad(() => { onLoad(() => {
getAgentInfo(); // getAgentInfo();
getOrderList(); getOrderList();
}); });
File diff suppressed because one or more lines are too long
+238 -229
View File
@@ -1,257 +1,266 @@
<!-- 页面 --> <!-- 页面 -->
<template> <template>
<s-layout title="我的团队" :class="state.scrollTop ? 'team-wrap' : ''" navbar="inner"> <s-layout title="我的团队" :class="state.scrollTop ? 'team-wrap' : ''" navbar="inner">
<view <view class="header-box" :style="[
class="header-box"
:style="[
{ {
marginTop: '-' + Number(statusBarHeight + 88) + 'rpx', marginTop: '-' + Number(statusBarHeight + 88) + 'rpx',
paddingTop: Number(statusBarHeight + 108) + 'rpx', paddingTop: Number(statusBarHeight + 108) + 'rpx',
}, },
]" ]">
> <!-- 推荐人 -->
<!-- 推荐人 --> <view v-if="userInfo.parent_user" class="referrer-box ss-flex ss-col-center">
<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)"
<image mode="aspectFill">
class="referrer-avatar ss-m-r-10" </image>
:src="sheep.$url.cdn(userInfo.parent_user.avatar)" {{ userInfo.parent_user.nickname }}
mode="aspectFill" </view>
> <!-- 团队数据总览 -->
</image> <view class="team-data-box ss-flex ss-col-center ss-row-between">
{{ userInfo.parent_user.nickname }} <view class="data-card">
</view> <view class="total-item">
<!-- 团队数据总览 --> <view class="item-title">团队总人数</view>
<view class="team-data-box ss-flex ss-col-center ss-row-between"> <view class="total-num">
<view class="data-card"> {{ (state.getSummary.firstBrokerageUserCount+ state.getSummary.secondBrokerageUserCount)|| 0 }}
<view class="total-item"> </view>
<view class="item-title">团队总人数</view> </view>
<view class="total-num">{{ agentInfo.child_user_count_all || 0 }}</view> <view class="category-item ss-flex">
</view> <view class="ss-flex-1">
<view class="category-item ss-flex"> <view class="item-title">一级成员</view>
<view class="ss-flex-1"> <view class="category-num">{{ state.getSummary.firstBrokerageUserCount || 0 }}</view>
<view class="item-title">一级成员</view> </view>
<view class="category-num">{{ agentInfo.child_user_count_1 || 0 }}</view> <view class="ss-flex-1">
</view> <view class="item-title">二级成员</view>
<view class="ss-flex-1"> <view class="category-num">{{ state.getSummary.secondBrokerageUserCount || 0 }}</view>
<view class="item-title">二级成员</view> </view>
<view class="category-num">{{ agentInfo.child_user_count_2 || 0 }}</view> </view>
</view> </view>
</view> <view class="data-card">
</view> <view class="total-item">
<view class="data-card"> <view class="item-title">团队分销商人数</view>
<view class="total-item"> <view class="total-num">{{ agentInfo.child_agent_count_all || 0 }}</view>
<view class="item-title">团队分销商人数</view> </view>
<view class="total-num">{{ agentInfo.child_agent_count_all || 0 }}</view> <view class="category-item ss-flex">
</view> <view class="ss-flex-1">
<view class="category-item ss-flex"> <view class="item-title">一级分销商</view>
<view class="ss-flex-1"> <view class="category-num">{{ agentInfo.child_agent_count_1 || 0 }}</view>
<view class="item-title">一级分销商</view> </view>
<view class="category-num">{{ agentInfo.child_agent_count_1 || 0 }}</view> <view class="ss-flex-1">
</view> <view class="item-title">二级分销商</view>
<view class="ss-flex-1"> <view class="category-num">{{ agentInfo.child_agent_count_2 || 0 }}</view>
<view class="item-title">二级分销商</view> </view>
<view class="category-num">{{ agentInfo.child_agent_count_2 || 0 }}</view> </view>
</view> </view>
</view> </view>
</view> </view>
</view> <view class="list-box">
</view> <uni-list :border="false">
<view class="list-box"> <uni-list-chat v-for="item in state.pagination.data" :key="item.id" :avatar-circle="true"
<uni-list :border="false"> :title="item.nickname" :avatar="sheep.$url.cdn(item.avatar)"
<uni-list-chat :note="filterUserNum(item.agent?.child_user_count_1)">
v-for="item in state.pagination.data" <view class="chat-custom-right">
:key="item.id" <view v-if="item.avatar" class="tag-box ss-flex ss-col-center">
:avatar-circle="true" <image class="tag-img" :src="sheep.$url.cdn(item.avatar)" mode="aspectFill">
:title="item.nickname" </image>
:avatar="sheep.$url.cdn(item.avatar)" <text class="tag-title">{{ item.nickname }}</text>
:note="filterUserNum(item.agent?.child_user_count_1)" </view>
> <text
<view class="chat-custom-right"> class="time-text">{{ sheep.$helper.timeFormat(item.brokerageTime, 'yyyy-mm-dd hh:MM:ss') }}</text>
<view v-if="item.agent?.level_info" class="tag-box ss-flex ss-col-center"> </view>
<image </uni-list-chat>
class="tag-img" </uni-list>
:src="sheep.$url.cdn(item.agent.level_info.image)" </view>
mode="aspectFill" <s-empty v-if="state.pagination.total === 0" icon="/static/data-empty.png" text="暂无团队信息">
> </s-empty>
</image> </s-layout>
<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>
</template> </template>
<script setup> <script setup>
import sheep from '@/sheep'; import sheep from '@/sheep';
import { onLoad, onReachBottom } from '@dcloudio/uni-app'; import {
import { computed, reactive } from 'vue'; onLoad,
import _ from 'lodash'; onReachBottom
import { onPageScroll } from '@dcloudio/uni-app'; } 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 statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
const agentInfo = computed(() => sheep.$store('user').agentInfo); const agentInfo = computed(() => sheep.$store('user').agentInfo);
const userInfo = computed(() => sheep.$store('user').userInfo); const userInfo = computed(() => sheep.$store('user').userInfo);
const headerBg = sheep.$url.css('/static/img/shop/user/withdraw_bg.png'); const headerBg = sheep.$url.css('/static/img/shop/user/withdraw_bg.png');
onPageScroll((e) => { onPageScroll((e) => {
if (e.scrollTop > 100) { if (e.scrollTop > 100) {
state.scrollTop = false; state.scrollTop = false;
} else { } else {
state.scrollTop = true; state.scrollTop = true;
} }
}); });
const state = reactive({ const state = reactive({
pagination: { getSummary: {},
data: [], pagination: {
current_page: 1, data: [],
total: 1, current_page: 1,
last_page: 1, total: 1,
}, last_page: 1,
loadStatus: '', },
}); loadStatus: '',
});
function filterUserNum(num) { function filterUserNum(num) {
if (_.isNil(num)) { if (_.isNil(num)) {
return ''; return '';
} }
return `下级团队${num}`; return `下级团队${num}`;
} }
async function getTeamList(page = 1, list_rows = 8) { async function getTeamList(page = 1, list_rows = 8) {
state.loadStatus = 'loading'; state.loadStatus = 'loading';
let res = await sheep.$api.commission.team({ // nickname: this.nickname,
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';
}
}
}
onLoad(async () => {
getTeamList();
});
// 加载更多 let res = await sheep.$api.commission.team({
function loadmore() { pageSize: list_rows,
if (state.loadStatus !== 'noMore') { pageNo: page,
getTeamList(state.pagination.current_page + 1); 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';
}
}
}
// 上拉加载更多 onLoad(async () => {
onReachBottom(() => { getTeamList();
loadmore(); 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> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.header-box { .header-box {
box-sizing: border-box; box-sizing: border-box;
padding: 0 20rpx 20rpx 20rpx; padding: 0 20rpx 20rpx 20rpx;
width: 750rpx; width: 750rpx;
z-index: 3; z-index: 3;
position: relative; position: relative;
background: v-bind(headerBg) no-repeat, background: v-bind(headerBg) no-repeat,
linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient)); linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
background-size: 750rpx 100%; background-size: 750rpx 100%;
// 团队信息总览
.team-data-box {
.data-card {
width: 305rpx;
background: #ffffff;
border-radius: 20rpx;
padding: 20rpx;
.item-title { // 团队信息总览
font-size: 22rpx; .team-data-box {
font-weight: 500; .data-card {
color: #999999; width: 305rpx;
line-height: 30rpx; background: #ffffff;
margin-bottom: 10rpx; border-radius: 20rpx;
} padding: 20rpx;
.total-item { .item-title {
margin-bottom: 30rpx; font-size: 22rpx;
} font-weight: 500;
color: #999999;
line-height: 30rpx;
margin-bottom: 10rpx;
}
.total-num { .total-item {
font-size: 38rpx; margin-bottom: 30rpx;
font-weight: 500; }
color: #333333;
font-family: OPPOSANS;
}
.category-num { .total-num {
font-size: 26rpx; font-size: 38rpx;
font-weight: 500; font-weight: 500;
color: #333333; color: #333333;
font-family: OPPOSANS; font-family: OPPOSANS;
} }
}
}
}
.list-box {
z-index: 3;
position: relative;
}
.chat-custom-right {
.time-text {
font-size: 22rpx;
font-weight: 400;
color: #999999;
}
.tag-box { .category-num {
background: rgba(0, 0, 0, 0.2); font-size: 26rpx;
border-radius: 21rpx; font-weight: 500;
line-height: 30rpx; color: #333333;
padding: 5rpx 10rpx; font-family: OPPOSANS;
width: 140rpx; }
}
}
}
.tag-img { .list-box {
width: 34rpx; z-index: 3;
height: 34rpx; position: relative;
margin-right: 6rpx; }
border-radius: 50%;
}
.tag-title { .chat-custom-right {
font-size: 18rpx; .time-text {
font-weight: 500; font-size: 22rpx;
color: rgba(255, 255, 255, 1); font-weight: 400;
line-height: 20rpx; color: #999999;
} }
}
}
// 推荐人 .tag-box {
.referrer-box { background: rgba(0, 0, 0, 0.2);
font-size: 28rpx; border-radius: 21rpx;
font-weight: 500; line-height: 30rpx;
color: #ffffff; padding: 5rpx 10rpx;
padding: 20rpx; width: 140rpx;
.referrer-avatar { .tag-img {
width: 34rpx; width: 34rpx;
height: 34rpx; height: 34rpx;
border-radius: 50%; margin-right: 6rpx;
} border-radius: 50%;
} }
</style>
.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> <template>
<su-popup :show="show" class="ss-checkout-counter-wrap" @close="hideModal"> <su-popup :show="show" class="ss-checkout-counter-wrap" @close="hideModal">
<view class="ss-modal-box bg-white ss-flex-col"> <view class="ss-modal-box bg-white ss-flex-col">
<view class="modal-header ss-flex-col ss-col-left"> <view class="modal-header ss-flex-col ss-col-left">
<text class="modal-title ss-m-b-20">选择提现方式</text> <text class="modal-title ss-m-b-20">选择提现方式</text>
</view> </view>
<view class="modal-content ss-flex-1 ss-p-b-100"> <view class="modal-content ss-flex-1 ss-p-b-100">
<radio-group @change="onChange"> <radio-group @change="onChange">
<label <label class="container-list ss-p-l-34 ss-p-r-24 ss-flex ss-col-center ss-row-center"
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">
v-for="(item, index) in typeList" <view class="container-icon ss-flex ss-m-r-20">
:key="index" <image :src="sheep.$url.static(item.icon)" />
> </view>
<view class="container-icon ss-flex ss-m-r-20"> <view class="ss-flex-1">{{ item.title }}</view>
<image :src="sheep.$url.static(item.icon)" />
</view>
<view class="ss-flex-1">{{ item.title }}</view>
<radio <radio :value="item.value" color="var(--ui-BG-Main)"
:value="item.value" :checked="item.value === state.currentValue" />
color="var(--ui-BG-Main)" <!-- :disabled="!methods.includes(item.value)" -->
:checked="item.value === state.currentValue" </label>
:disabled="!methods.includes(item.value)" </radio-group>
/> </view>
</label> <view class="modal-footer ss-flex ss-row-center ss-col-center">
</radio-group> <button class="ss-reset-button save-btn" @tap="onConfirm">确定</button>
</view> </view>
<view class="modal-footer ss-flex ss-row-center ss-col-center"> </view>
<button class="ss-reset-button save-btn" @tap="onConfirm">确定</button> </su-popup>
</view>
</view>
</su-popup>
</template> </template>
<script setup> <script setup>
import { reactive, onBeforeMount, nextTick } from 'vue'; import {
import sheep from '@/sheep'; reactive,
onBeforeMount,
nextTick
} from 'vue';
import sheep from '@/sheep';
const props = defineProps({ const props = defineProps({
modelValue: { modelValue: {
type: Object, type: Object,
default() {}, default () {},
}, },
show: { show: {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
methods: { methods: {
type: Array, type: Array,
default: [], default: [],
}, },
}); });
const emits = defineEmits(['update:modelValue', 'change', 'close']); const emits = defineEmits(['update:modelValue', 'change', 'close']);
const state = reactive({ const state = reactive({
currentValue: '', currentValue: '0',
}); });
const typeList = [ const typeList = [{
{ // icon: '/static/img/shop/pay/wechat.png',
icon: '/static/img/shop/pay/wechat.png', title: '工商银行',
title: '微信零钱', value: '0',
value: 'wechat', },
}, {
{ // icon: '/static/img/shop/pay/alipay.png',
icon: '/static/img/shop/pay/alipay.png', title: '建设银行',
title: '支付宝账户', value: '1',
value: 'alipay', },
}, {
{ // icon: '/static/img/shop/pay/bank.png',
icon: '/static/img/shop/pay/bank.png', title: '农业',
title: '银行卡转账', value: '2',
value: 'bank', },
}, ];
]; const getWalletAccountInfo = async () => {
const getWalletAccountInfo = async () => { return new Promise(async (resolve, reject) => {
return new Promise(async (resolve, reject) => { let res = await sheep.$api.user.account.info({
let res = await sheep.$api.user.account.info({ type: state.currentValue,
type: state.currentValue, });
}); if (res.error === 0) {
if (res.error === 0) { if (!props.methods.includes(res.data.type)) {
if (!props.methods.includes(res.data.type)) { return;
return; }
} state.currentValue = res.data.type;
state.currentValue = res.data.type; emits('update:modelValue', {
emits('update:modelValue', { type: res.data.type,
type: res.data.type, account_header: res.data.account_header,
account_header: res.data.account_header, account_name: res.data.account_name,
account_name: res.data.account_name, account_no: res.data.account_no,
account_no: res.data.account_no, });
}); } else {
} else { emits('update:modelValue', {
emits('update:modelValue', { type: state.currentValue,
type: state.currentValue, });
}); }
} resolve();
resolve(); });
}); };
};
function onChange(e) { function onChange(e) {
state.currentValue = e.detail.value; state.currentValue = e.detail.value;
} }
const onConfirm = async () => { const onConfirm = async () => {
if (state.currentValue === '') { if (state.currentValue === '') {
sheep.$helper.toast('请选择提现方式'); sheep.$helper.toast('请选择提现方式');
return; return;
} }
await getWalletAccountInfo(); await getWalletAccountInfo();
emits('close'); emits('close');
}; };
const hideModal = () => { const hideModal = () => {
emits('close'); emits('close');
}; };
onBeforeMount(async () => { onBeforeMount(async () => {
await getWalletAccountInfo(); await getWalletAccountInfo();
}); });
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.ss-modal-box { .ss-modal-box {
border-radius: 30rpx 30rpx 0 0; border-radius: 30rpx 30rpx 0 0;
max-height: 1000rpx; max-height: 1000rpx;
.modal-header { .modal-header {
position: relative; position: relative;
padding: 60rpx 40rpx 40rpx; padding: 60rpx 40rpx 40rpx;
.modal-title { .modal-title {
font-size: 32rpx; font-size: 32rpx;
font-weight: bold; font-weight: bold;
} }
.close-icon { .close-icon {
position: absolute; position: absolute;
top: 10rpx; top: 10rpx;
right: 20rpx; right: 20rpx;
font-size: 46rpx; font-size: 46rpx;
opacity: 0.2; opacity: 0.2;
} }
} }
.modal-content { .modal-content {
overflow-y: auto; overflow-y: auto;
.container-list { .container-list {
height: 96rpx; height: 96rpx;
border-bottom: 2rpx solid rgba(#dfdfdf, 0.5); border-bottom: 2rpx solid rgba(#dfdfdf, 0.5);
font-size: 28rpx; font-size: 28rpx;
font-weight: 500; font-weight: 500;
color: #333333; color: #333333;
.container-icon { .container-icon {
width: 36rpx; width: 36rpx;
height: 36rpx; height: 36rpx;
} }
} }
} }
.modal-footer { .modal-footer {
height: 120rpx; height: 120rpx;
.save-btn { .save-btn {
width: 710rpx; width: 710rpx;
height: 80rpx; height: 80rpx;
border-radius: 40rpx; border-radius: 40rpx;
background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient)); background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
color: $white; color: $white;
} }
} }
} }
image { image {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
</style> </style>
+357 -329
View File
@@ -1,380 +1,408 @@
<template> <template>
<s-layout title="申请提现" class="withdraw-wrap" navbar="inner"> <s-layout title="申请提现" class="withdraw-wrap" navbar="inner">
<!-- <view class="page-bg"></view> --> <!-- <view class="page-bg"></view> -->
<view <!-- <view class="wallet-num-box ss-flex ss-col-center ss-row-between" :style="[
class="wallet-num-box ss-flex ss-col-center ss-row-between"
:style="[
{ {
marginTop: '-' + Number(statusBarHeight + 88) + 'rpx', marginTop: '-' + Number(statusBarHeight + 88) + 'rpx',
paddingTop: Number(statusBarHeight + 108) + 'rpx', paddingTop: Number(statusBarHeight + 108) + 'rpx',
}, },
]" ]">
> <view class="">
<view class=""> <view class="num-title">可提现金额</view>
<view class="num-title">可提现金额</view> <view class="wallet-num">{{ userInfo.commission }}</view>
<view class="wallet-num">{{ userInfo.commission }}</view> </view>
</view> <button class="ss-reset-button log-btn" @tap="sheep.$router.go('/pages/pay/withdraw-log')">提现记录</button>
<button class="ss-reset-button log-btn" @tap="sheep.$router.go('/pages/pay/withdraw-log')" </view> -->
>提现记录</button <!-- 提现输入卡片-->
> <view class="draw-card">
</view> <view class="card-title">提现金额</view>
<!-- 提现输入卡片--> <view class="input-box ss-flex ss-col-center border-bottom">
<view class="draw-card"> <view class="unit"></view>
<view class="card-title">提现金额</view> <uni-easyinput :inputBorder="false" class="ss-flex-1 ss-p-l-10" v-model="state.amount" type="number"
<view class="input-box ss-flex ss-col-center border-bottom"> placeholder="请输入提现金额" />
<view class="unit"></view> </view>
<uni-easyinput <view class="card-title">持卡人</view>
:inputBorder="false" <view class="input-box ss-flex ss-col-center border-bottom">
class="ss-flex-1 ss-p-l-10" <view class="unit"></view>
v-model="state.amount" <uni-easyinput :inputBorder="false" class="ss-flex-1 ss-p-l-10" v-model="state.name"
type="number" placeholder="请输入持卡人姓名" />
placeholder="请输入提现金额" </view>
/> <view class="card-title">卡号</view>
</view> <view class="input-box ss-flex ss-col-center border-bottom">
<view class="bank-box ss-flex ss-col-center ss-row-between ss-m-b-30"> <view class="unit"></view>
<view class="name">提现至</view> <uni-easyinput :inputBorder="false" class="ss-flex-1 ss-p-l-10" v-model="state.accountNo"
<view class="bank-list ss-flex ss-col-center" @tap="onAccountSelect(true)"> placeholder="请输卡号" />
<view v-if="!state.accountInfo.type" class="empty-text">请选择提现方式</view> </view>
<view v-if="state.accountInfo.type === 'wechat'" class="empty-text">微信零钱</view> <view class="bank-box ss-flex ss-col-center ss-row-between ss-m-b-30">
<view v-if="state.accountInfo.type === 'alipay'" class="empty-text">支付宝账户</view> <view class="name">选择银行</view>
<view v-if="state.accountInfo.type === 'bank'" class="empty-text">银行卡转账</view> <view class="bank-list ss-flex ss-col-center" @tap="onAccountSelect(true)">
<text class="cicon-forward"></text> <view v-if="!state.accountInfo.type" class="empty-text">请选择提现方式</view>
</view> <view v-if="state.accountInfo.type === '0'" class="empty-text">工商银行</view>
</view> <view v-if="state.accountInfo.type === '1'" class="empty-text">建设银行</view>
<view class="bind-box ss-flex ss-col-center ss-row-between" v-if="state.accountInfo.type"> <view v-if="state.accountInfo.type === '2'" class="empty-text">农业银行</view>
<view class="placeholder-text" v-if="state.accountInfo.account_name"> <!-- <view v-if="!state.accountInfo.type" class="empty-text">请选择提现方式</view>
{{ state.accountInfo.account_header }}|{{ state.accountInfo.account_name }} <view v-if="state.accountInfo.type === 'wechat'" class="empty-text">微信零钱</view>
</view> <view v-if="state.accountInfo.type === 'alipay'" class="empty-text">支付宝账户</view>
<view class="placeholder-text" v-else>暂无提现账户</view> <view v-if="state.accountInfo.type === 'bank'" class="empty-text">银行卡转账</view> -->
<button class="add-btn ss-reset-button" @tap="onAccountEdit(true)"> <text class="cicon-forward"></text>
{{ state.accountInfo.account_name ? '修改' : '添加' }} </view>
</button> </view>
</view> <view class="bind-box ss-flex ss-col-center ss-row-between" v-if="state.accountInfo.type">
<button class="ss-reset-button save-btn ui-BG-Main-Gradient ui-Shadow-Main" @tap="onConfirm"> <view class="placeholder-text" v-if="state.accountInfo.account_name">
确认提现 {{ state.accountInfo.account_header }}|{{ state.accountInfo.account_name }}
</button> </view>
</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="draw-notice">
<view class="title ss-m-b-30">提现说明</view> <view class="title ss-m-b-30">提现说明</view>
<view class="draw-list" v-for="(rule, index) in state.rulesList" :key="index"> <!-- <view class="draw-list" v-for="(rule, index) in state.rulesList" :key="index">
{{ index + 1 }}.{{ rule }} {{ index + 1 }}.{{ rule }}
</view> </view>-->
</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 <account-type-select :show="state.accountSelect" @close="onAccountSelect(false)" round="10"
:show="state.accountSelect" v-model="state.accountInfo" :methods="state.rules.methods" />
@close="onAccountSelect(false)" <!-- 编辑账户信息 -->
round="10" <account-info-modal v-if="state.accountInfo.type" v-model="state.accountInfo" :show="state.accountEdit"
v-model="state.accountInfo" @close="onAccountEdit(false)" round="10" />
:methods="state.rules.methods" </s-layout>
/>
<!-- 编辑账户信息 -->
<account-info-modal
v-if="state.accountInfo.type"
v-model="state.accountInfo"
:show="state.accountEdit"
@close="onAccountEdit(false)"
round="10"
/>
</s-layout>
</template> </template>
<script setup> <script setup>
import { computed, reactive, onBeforeMount } from 'vue'; import {
import sheep from '@/sheep'; computed,
import accountTypeSelect from './components/account-type-select.vue'; reactive,
import accountInfoModal from './components/account-info-modal.vue'; onBeforeMount
import { onPageScroll } from '@dcloudio/uni-app'; } from 'vue';
const headerBg = sheep.$url.css('/static/img/shop/user/withdraw_bg.png'); import sheep from '@/sheep';
onPageScroll(() => {}); import accountTypeSelect from './components/account-type-select.vue';
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2; import accountInfoModal from './components/account-info-modal.vue';
function filterRules(rules) { import {
let list = []; onPageScroll
let str1 = ''; } from '@dcloudio/uni-app';
if (rules.min_amount > 0) { const headerBg = sheep.$url.css('/static/img/shop/user/withdraw_bg.png');
str1 += `最少 ${rules.min_amount}元; `; onPageScroll(() => {});
} const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
if (rules.max_amount > 0) {
str1 += `最多 ${rules.max_amount}元;`;
}
if (str1 !== '') {
list.push('单次提现金额 ' + str1);
}
if (rules.max_num > 0) { function filterRules(rules) {
list.push(`${rules.num_unit === 'day' ? '天' : '月'}最多可提现 ${rules.max_num} 次;`); 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) { if (rules.max_num > 0) {
list.push(`次收取提现手续费 ${rules.charge_rate_format}%;`); list.push(`${rules.num_unit === 'day' ? '天' : '月'}最多可提现 ${rules.max_num};`);
} }
list.push(
`提现申请后将${rules.auto_arrival ? '自动' : '审核后'}到账, 到账结果请查收对应渠道服务通知;`,
);
list.push('如有疑问请及时联系客服.');
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'); return list;
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: [],
});
const onAccountEdit = (e) => { const userStore = sheep.$store('user');
state.accountEdit = e; 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) => { const onAccountEdit = (e) => {
state.accountSelect = e; state.accountEdit = e;
}; };
const onConfirm = async () => { const onAccountSelect = (e) => {
let payload = { state.accountSelect = e;
money: state.amount, };
...state.accountInfo,
};
if (payload.money > userInfo.commission || payload.money <= 0) { const onConfirm = async () => {
sheep.$helper.toast('请输入正确的提现金额'); let payload = {
return; 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) { // if (!payload.type) {
sheep.$helper.toast('请选择提现方式'); // sheep.$helper.toast('请选择提现方式');
return; // return;
} // }
if (!payload.account_name || !payload.account_header || !payload.account_no) { // if (!payload.account_name || !payload.account_header || !payload.account_no) {
sheep.$helper.toast('请完善您的账户信息'); // sheep.$helper.toast('请完善您的账户信息');
return; // return;
} // }
if (sheep.$platform.name === 'H5' && payload.type === 'wechat') { // if (sheep.$platform.name === 'H5' && payload.type === 'wechat') {
sheep.$helper.toast('请使用微信浏览器操作'); // sheep.$helper.toast('请使用微信浏览器操作');
return; // return;
} // }
let { error, msg, data } = await sheep.$api.pay.withdraw.apply(payload); let {
if (error === -1) { code,
sheep.$platform.useProvider('wechat').bind(); msg,
} data
if (error === 0) { } = await sheep.$api.pay.withdraw.apply(payload);
userStore.getInfo(); if (code === -1) {
uni.showModal({ sheep.$platform.useProvider('wechat').bind();
title: '操作成功', }
content: '您的提现申请已成功提交', if (code === 0) {
cancelText: '继续提现', userStore.getInfo();
confirmText: '查看记录', uni.showModal({
success: function (res) { title: '操作成功',
res.confirm && sheep.$router.go('/pages/pay/withdraw-log'); content: '您的提现申请已成功提交',
}, cancelText: '继续提现',
}); confirmText: '查看记录',
} success: function(res) {
}; res.confirm && sheep.$router.go('/pages/pay/withdraw-log');
},
});
}
};
async function getWithdrawRules() { async function getWithdrawRules() {
let { error, data } = await sheep.$api.pay.withdraw.rules(); let {
if (error === 0) { error,
state.rules = data; data
state.rulesList = filterRules(state.rules); } = await sheep.$api.pay.withdraw.rules();
} if (error === 0) {
} state.rules = data;
state.rulesList = filterRules(state.rules);
}
}
onBeforeMount(() => { onBeforeMount(async () => {
getWithdrawRules(); getWithdrawRules();
}); let res = await sheep.$api.pay.withdraw.userGet();
state.userGet = res.data
});
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
:deep() { :deep() {
.uni-input-input { .uni-input-input {
font-family: OPPOSANS !important; font-family: OPPOSANS !important;
} }
} }
.wallet-num-box { .wallet-num-box {
padding: 0 40rpx 80rpx; padding: 0 40rpx 80rpx;
background: var(--ui-BG-Main) v-bind(headerBg) center/750rpx 100% no-repeat; background: var(--ui-BG-Main) v-bind(headerBg) center/750rpx 100% no-repeat;
border-radius: 0 0 5% 5%; border-radius: 0 0 5% 5%;
.num-title { .num-title {
font-size: 26rpx; font-size: 26rpx;
font-weight: 500; font-weight: 500;
color: $white; color: $white;
margin-bottom: 20rpx; margin-bottom: 20rpx;
} }
.wallet-num { .wallet-num {
font-size: 60rpx; font-size: 60rpx;
font-weight: 500; font-weight: 500;
color: $white; color: $white;
font-family: OPPOSANS; font-family: OPPOSANS;
} }
.log-btn { .log-btn {
width: 170rpx; width: 170rpx;
height: 60rpx; height: 60rpx;
line-height: 60rpx; line-height: 60rpx;
border: 1rpx solid $white; border: 1rpx solid $white;
border-radius: 30rpx; border-radius: 30rpx;
padding: 0; padding: 0;
font-size: 26rpx; font-size: 26rpx;
font-weight: 500; font-weight: 500;
color: $white; color: $white;
} }
} }
// 提现输入卡片 // 提现输入卡片
.draw-card { .draw-card {
background-color: $white; background-color: $white;
border-radius: 20rpx; border-radius: 20rpx;
width: 690rpx; width: 690rpx;
min-height: 560rpx; min-height: 560rpx;
margin: -60rpx 30rpx 30rpx 30rpx; margin: -60rpx 30rpx 30rpx 30rpx;
padding: 30rpx; padding: 30rpx;
position: relative; position: relative;
z-index: 3; z-index: 3;
box-sizing: border-box; box-sizing: border-box;
.card-title { .card-title {
font-size: 30rpx; font-size: 30rpx;
font-weight: 500; font-weight: 500;
margin-bottom: 30rpx; margin-bottom: 30rpx;
} }
.bank-box { .bank-box {
.name { .name {
font-size: 28rpx; font-size: 28rpx;
font-weight: 500; font-weight: 500;
} }
.bank-list { .bank-list {
.empty-text { .empty-text {
font-size: 28rpx; font-size: 28rpx;
font-weight: 400; font-weight: 400;
color: $dark-9; color: $dark-9;
} }
.cicon-forward { .cicon-forward {
color: $dark-9; color: $dark-9;
} }
} }
.input-box { .input-box {
width: 624rpx; width: 624rpx;
height: 100rpx; height: 100rpx;
margin-bottom: 40rpx; margin-bottom: 40rpx;
.unit { .unit {
font-size: 48rpx; font-size: 48rpx;
color: #333; color: #333;
font-weight: 500; font-weight: 500;
} }
.uni-easyinput__placeholder-class { .uni-easyinput__placeholder-class {
font-size: 30rpx; font-size: 30rpx;
height: 36rpx; height: 36rpx;
} }
:deep(.uni-easyinput__content-input) { :deep(.uni-easyinput__content-input) {
font-size: 48rpx; font-size: 48rpx;
} }
} }
.save-btn { .save-btn {
width: 616rpx; width: 616rpx;
height: 86rpx; height: 86rpx;
line-height: 86rpx; line-height: 86rpx;
border-radius: 40rpx; border-radius: 40rpx;
margin-top: 80rpx; margin-top: 80rpx;
} }
} }
.bind-box { .bind-box {
.placeholder-text { .placeholder-text {
font-size: 26rpx; font-size: 26rpx;
color: $dark-9; color: $dark-9;
} }
.add-btn { .add-btn {
width: 100rpx; width: 100rpx;
height: 50rpx; height: 50rpx;
border-radius: 25rpx; border-radius: 25rpx;
line-height: 50rpx; line-height: 50rpx;
font-size: 22rpx; font-size: 22rpx;
color: var(--ui-BG-Main); color: var(--ui-BG-Main);
background-color: var(--ui-BG-Main-light); background-color: var(--ui-BG-Main-light);
} }
} }
.input-box { .input-box {
width: 624rpx; width: 624rpx;
height: 100rpx; height: 100rpx;
margin-bottom: 40rpx; margin-bottom: 40rpx;
.unit { .unit {
font-size: 48rpx; font-size: 48rpx;
color: #333; color: #333;
font-weight: 500; font-weight: 500;
} }
.uni-easyinput__placeholder-class { .uni-easyinput__placeholder-class {
font-size: 30rpx; font-size: 30rpx;
} }
:deep(.uni-easyinput__content-input) { :deep(.uni-easyinput__content-input) {
font-size: 48rpx; font-size: 48rpx;
} }
} }
.save-btn { .save-btn {
width: 616rpx; width: 616rpx;
height: 86rpx; height: 86rpx;
line-height: 86rpx; line-height: 86rpx;
border-radius: 40rpx; border-radius: 40rpx;
margin-top: 80rpx; margin-top: 80rpx;
} }
} }
// 提现说明 // 提现说明
.draw-notice { .draw-notice {
width: 684rpx; width: 684rpx;
background: #ffffff; background: #ffffff;
border: 2rpx solid #fffaee; border: 2rpx solid #fffaee;
border-radius: 20rpx; border-radius: 20rpx;
margin: 20rpx 32rpx 0 32rpx; margin: 20rpx 32rpx 0 32rpx;
padding: 30rpx; padding: 30rpx;
box-sizing: border-box; box-sizing: border-box;
.title { .title {
font-weight: 500; font-weight: 500;
color: #333333; color: #333333;
font-size: 30rpx; font-size: 30rpx;
} }
.draw-list { .draw-list {
font-size: 24rpx; font-size: 24rpx;
color: #999999; color: #999999;
line-height: 46rpx; line-height: 46rpx;
} }
} }
</style> </style>
+427 -453
View File
@@ -1,510 +1,484 @@
<template> <template>
<s-layout class="wallet-wrap" title="佣金"> <s-layout class="wallet-wrap" title="佣金">
<!-- 钱包卡片 --> <!-- 钱包卡片 -->
<view class="header-box ss-flex ss-row-center ss-col-center"> <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-box ui-BG-Main ui-Shadow-Main">
<view class="card-head ss-flex ss-col-center"> <view class="card-head ss-flex ss-col-center">
<view class="card-title ss-m-r-10">我的佣金</view> <view class="card-title ss-m-r-10">当前佣金</view>
<view <view @tap="state.showMoney = !state.showMoney" class="ss-eye-icon"
@tap="state.showMoney = !state.showMoney" :class="state.showMoney ? 'cicon-eye' : 'cicon-eye-off'"></view>
class="ss-eye-icon" </view>
:class="state.showMoney ? 'cicon-eye' : 'cicon-eye-off'" <view class="ss-flex ss-row-between ss-col-center ss-m-t-30">
></view> <view class="money-num">{{ state.showMoney ? state.userInfo.withdrawPrice : '*****' }}</view>
</view> <view class="ss-flex">
<view class="ss-flex ss-row-between ss-col-center ss-m-t-30"> <view class="ss-m-r-20">
<view class="money-num">{{ state.showMoney ? userInfo.commission : '*****' }}</view> <button class="ss-reset-button withdraw-btn" @tap="sheep.$router.go('/pages/pay/withdraw')">
<view class="ss-flex"> 提现
<view class="ss-m-r-20"> </button>
<button </view>
class="ss-reset-button withdraw-btn" <button class="ss-reset-button balance-btn ss-m-l-20" @tap="state.showModal = true">
@tap="sheep.$router.go('/pages/pay/withdraw')" 转余额
> </button>
提现 </view>
</button> </view>
</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="ss-flex">
<view class="loading-money"> <view class="loading-money">
<view class="loading-money-title">待入账佣金</view> <view class="loading-money-title">冻结佣金</view>
<view class="loading-money-num">{{ <view class="loading-money-num">{{
state.showMoney ? agentInfo.pending_reward || '0.00' : '*****' state.showMoney ? state.userInfo.frozenPrice || '0.00' : '*****'
}}</view> }}</view>
</view> </view>
<view class="loading-money ss-m-l-100"> <view class="loading-money ss-m-l-100">
<view class="loading-money-title">可提现佣金</view> <view class="loading-money-title">可提现佣金</view>
<view class="loading-money-num">{{ <view class="loading-money-num">{{
state.showMoney ? userInfo.commission || '0.00' : '*****' state.showMoney ? state.userInfo.brokeragePrice || '0.00' : '*****'
}}</view> }}</view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<su-sticky> <su-sticky>
<!-- 统计 --> <!-- 统计 -->
<view class="filter-box ss-p-x-30 ss-flex ss-col-center ss-row-between"> <view class="filter-box ss-p-x-30 ss-flex ss-col-center ss-row-between">
<uni-datetime-picker <uni-datetime-picker v-model="state.data" type="daterange" @change="onChangeTime" :end="state.today">
v-model="state.data" <button class="ss-reset-button date-btn">
type="daterange" <text>{{ dateFilterText }}</text>
@change="onChangeTime" <text class="cicon-drop-down ss-seldate-icon"></text>
:end="state.today" </button>
> </uni-datetime-picker>
<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="total-box">
<view class="ss-m-b-10">总收入{{ state.pagination.income.toFixed(2) }}</view> <!-- <view class="ss-m-b-10">总收入{{ state.pagination.income.toFixed(2) }}</view> -->
<view>总支出{{ (-state.pagination.expense).toFixed(2) }}</view> <!-- <view>总支出{{ (-state.pagination.expense).toFixed(2) }}</view> -->
</view> </view>
</view> </view>
<su-tabs <su-tabs :list="tabMaps" @change="onChangeTab" :scrollable="false" :current="state.currentTab"></su-tabs>
:list="tabMaps" </su-sticky>
@change="onChangeTab" <s-empty v-if="state.pagination.total === 0" icon="/static/data-empty.png" text="暂无数据"></s-empty>
:scrollable="false" <!-- 转余额弹框 -->
:current="state.currentTab" <su-popup :show="state.showModal" type="bottom" round="20" @close="state.showModal = false" showClose>
></su-tabs> <view class="ss-p-x-20 ss-p-y-30">
</su-sticky> <view class="model-title ss-m-b-30 ss-m-l-20">转余额</view>
<s-empty <view class="model-subtitle ss-m-b-100 ss-m-l-20">将您的佣金转到余额中继续消费</view>
v-if="state.pagination.total === 0" <view class="input-box ss-flex ss-col-center border-bottom ss-m-b-70 ss-m-x-20">
icon="/static/data-empty.png" <view class="unit"></view>
text="暂无数据" <uni-easyinput :inputBorder="false" class="ss-flex-1 ss-p-l-10" v-model="state.amount" type="number"
></s-empty> placeholder="请输入金额" />
<!-- 转余额弹框 --> </view>
<su-popup <button class="ss-reset-button model-btn ui-BG-Main-Gradient ui-Shadow-Main" @tap="onConfirm">
:show="state.showModal" 确定
type="bottom" </button>
round="20" </view>
@close="state.showModal = false" </su-popup>
showClose <!-- 钱包记录 -->
> <view v-if="state.pagination.total > 0">
<view class="ss-p-x-20 ss-p-y-30"> <view class="wallet-list ss-flex border-bottom" v-for="item in state.pagination.data" :key="item.id">
<view class="model-title ss-m-b-30 ss-m-l-20">转余额</view> <view class="list-content">
<view class="model-subtitle ss-m-b-100 ss-m-l-20">将您的佣金转到余额中继续消费</view> <view class="title-box ss-flex ss-row-between ss-m-b-20">
<view class="input-box ss-flex ss-col-center border-bottom ss-m-b-70 ss-m-x-20"> <!-- {{ item.memo ? '-' + item.memo : '' }} -->
<view class="unit"></view> <text class="title ss-line-1">{{ item.title }}</text>
<uni-easyinput <view class="money">
:inputBorder="false" <text v-if="item.amount >= 0" class="add">+{{ item.price }}</text>
class="ss-flex-1 ss-p-l-10" <text v-else class="minus">{{ item.price }}</text>
v-model="state.amount" </view>
type="number" </view>
placeholder="请输入金额" <text class="time">{{ sheep.$helper.timeFormat(item.createTime, 'yyyy-mm-dd hh:MM:ss') }}</text>
/> </view>
</view> </view>
<button </view>
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>
<!-- <u-gap></u-gap> --> <!-- <u-gap></u-gap> -->
<uni-load-more <uni-load-more v-if="state.pagination.total > 0" :status="state.loadStatus" :content-text="{
v-if="state.pagination.total > 0"
:status="state.loadStatus"
:content-text="{
contentdown: '上拉加载更多', contentdown: '上拉加载更多',
}" }" />
/> </s-layout>
</s-layout>
</template> </template>
<script setup> <script setup>
import { computed, reactive } from 'vue'; import {
import { onLoad, onReachBottom } from '@dcloudio/uni-app'; computed,
import sheep from '@/sheep'; reactive
import dayjs from 'dayjs'; } from 'vue';
import _ from 'lodash'; 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 = { const pagination = {
data: [], data: [],
current_page: 1, current_page: 1,
total: 1, total: 1,
last_page: 1, last_page: 1,
expense: 0, expense: 0,
income: 0, income: 0,
}; };
const state = reactive({ const state = reactive({
showMoney: false, userInfo: {},
date: [], showMoney: false,
currentTab: 0, date: [],
pagination, currentTab: 0,
loadStatus: '', pagination,
showModal: false, loadStatus: '',
today: '', showModal: false,
}); today: '',
});
const tabMaps = [ const tabMaps = [{
{ name: '分佣',
name: '全部', value: 'all',
value: 'all', },
}, {
{ name: '提现',
name: '收入', value: 'income',
value: 'income', }
}, // {
{ // name: '支出',
name: '支出', // value: 'expense',
value: 'expense', // },
}, ];
]; const userInfo = computed(() => sheep.$store('user').userInfo);
const userInfo = computed(() => sheep.$store('user').userInfo);
const agentInfo = computed(() => sheep.$store('user').agentInfo); const agentInfo = computed(() => sheep.$store('user').agentInfo);
const dateFilterText = computed(() => { const dateFilterText = computed(() => {
if (state.date[0] === state.date[1]) { if (state.date[0] === state.date[1]) {
return state.date[0]; return state.date[0];
} else { } else {
return state.date.join('~'); return state.date.join('~');
} }
}); });
async function getLogList(page = 1, list_rows = 8) { async function getLogList(page = 1, list_rows = 4) {
state.loadStatus = 'loading'; state.loadStatus = 'loading';
let res = await sheep.$api.user.wallet.log({ let ress = await sheep.$api.commission.getSummary();
type: 'commission', state.userInfo = ress.data;
tab: tabMaps[state.currentTab].value, let res = await sheep.$api.user.wallet.log3({
list_rows, // type: 'commission',
page, // tab: tabMaps[state.currentTab].value,
date: appendTimeHMS(state.date), pageSize: list_rows,
}); pageNo: page,
if (res.error === 0) { // date: appendTimeHMS(state.date),
let list = _.concat(state.pagination.data, res.data.list.data); });
state.pagination = { if (res.code === 0) {
...res.data.list, let list = _.concat(state.pagination.data, res.data.list);
data: list, state.pagination = {
income: res.data.income, current_page: page,
expense: res.data.expense, ...res.data,
}; data: list,
if (state.pagination.current_page < state.pagination.last_page) { // income: res.data.income,
state.loadStatus = 'more'; // expense: res.data.expense,
} else { };
state.loadStatus = 'noMore'; if (state.pagination.data.length < state.pagination.total) {
} state.loadStatus = 'more';
} } else {
} state.loadStatus = 'noMore';
}
}
}
function onChangeTab(e) { function onChangeTab(e) {
state.pagination = pagination; state.pagination = pagination;
state.currentTab = e.index; state.currentTab = e.index;
getLogList(); getLogList();
} }
function onChangeTime(e) { function onChangeTime(e) {
state.date[0] = e[0]; state.date[0] = e[0];
state.date[1] = e[e.length - 1]; state.date[1] = e[e.length - 1];
state.pagination = pagination; state.pagination = pagination;
getLogList(); getLogList();
} }
function appendTimeHMS(arr) { function appendTimeHMS(arr) {
return [arr[0] + ' 00:00:00', arr[1] + ' 23:59:59']; return [arr[0] + ' 00:00:00', arr[1] + ' 23:59:59'];
} }
// 确认操作 // 确认操作
async function onConfirm() { async function onConfirm() {
if (state.amount <= 0) { if (state.amount <= 0) {
sheep.$helper.toast('请输入正确的金额'); sheep.$helper.toast('请输入正确的金额');
return; return;
} }
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: '确认把您的佣金转入到余额钱包中?', content: '确认把您的佣金转入到余额钱包中?',
success: async function (res) { success: async function(res) {
if (res.confirm) { if (res.confirm) {
const { error } = await sheep.$api.commission.transfer({ const {
amount: state.amount, error
}); } = await sheep.$api.commission.transfer({
if (error === 0) { amount: state.amount,
state.showModal = false; });
sheep.$store('user').getInfo(); if (error === 0) {
onChangeTab({ index: 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'); async function getAgentInfo() {
state.date = [state.today, state.today]; const {
getLogList(); code,
getAgentInfo(); 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(() => { onReachBottom(() => {
if (state.loadStatus !== 'noMore') { if (state.loadStatus !== 'noMore') {
getLogList(state.pagination.current_page + 1); getLogList(state.pagination.current_page + 1);
} }
}); });
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
// 钱包 // 钱包
.header-box { .header-box {
background-color: $white; background-color: $white;
padding: 30rpx; padding: 30rpx;
.card-box { .card-box {
width: 100%; width: 100%;
min-height: 300rpx; min-height: 300rpx;
padding: 40rpx; padding: 40rpx;
background-size: 100% 100%; background-size: 100% 100%;
border-radius: 30rpx; border-radius: 30rpx;
overflow: hidden; overflow: hidden;
position: relative; position: relative;
z-index: 1; z-index: 1;
box-sizing: border-box; box-sizing: border-box;
&::after { &::after {
content: ''; content: '';
display: block; display: block;
width: 100%; width: 100%;
height: 100%; height: 100%;
z-index: 2; z-index: 2;
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
background: v-bind(headerBg) no-repeat; background: v-bind(headerBg) no-repeat;
pointer-events: none; pointer-events: none;
} }
.card-head { .card-head {
color: $white; color: $white;
font-size: 24rpx; font-size: 24rpx;
} }
.ss-eye-icon { .ss-eye-icon {
font-size: 40rpx; font-size: 40rpx;
color: $white; color: $white;
} }
.money-num { .money-num {
font-size: 40rpx; font-size: 40rpx;
line-height: normal; line-height: normal;
font-weight: 500; font-weight: 500;
color: $white; color: $white;
font-family: OPPOSANS; font-family: OPPOSANS;
} }
.reduce-num { .reduce-num {
font-size: 26rpx; font-size: 26rpx;
font-weight: 400; font-weight: 400;
color: $white; color: $white;
} }
.withdraw-btn { .withdraw-btn {
width: 120rpx; width: 120rpx;
height: 60rpx; height: 60rpx;
line-height: 60rpx; line-height: 60rpx;
border-radius: 30px; border-radius: 30px;
font-size: 24rpx; font-size: 24rpx;
font-weight: 500; font-weight: 500;
background-color: $white; background-color: $white;
color: var(--ui-BG-Main); color: var(--ui-BG-Main);
} }
.balance-btn { .balance-btn {
width: 120rpx; width: 120rpx;
height: 60rpx; height: 60rpx;
line-height: 60rpx; line-height: 60rpx;
border-radius: 30px; border-radius: 30px;
font-size: 24rpx; font-size: 24rpx;
font-weight: 500; font-weight: 500;
color: $white; color: $white;
border: 1px solid $white; border: 1px solid $white;
} }
} }
} }
.loading-money { .loading-money {
margin-top: 56rpx; margin-top: 56rpx;
.loading-money-title {
font-size: 24rpx;
font-weight: 400;
color: #ffffff;
line-height: normal;
margin-bottom: 30rpx;
}
.loading-money-num { .loading-money-title {
font-size: 30rpx; font-size: 24rpx;
font-family: OPPOSANS; font-weight: 400;
font-weight: 500; color: #ffffff;
color: #fefefe; 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 { .filter-box {
font-size: 24rpx; height: 120rpx;
font-weight: 500; padding: 0 30rpx;
color: $dark-9; background-color: $bg-page;
}
.date-btn { .total-box {
background-color: $white; font-size: 24rpx;
line-height: 54rpx; font-weight: 500;
border-radius: 27rpx; color: $dark-9;
padding: 0 20rpx; }
font-size: 24rpx;
font-weight: 500;
color: $dark-6;
.ss-seldate-icon { .date-btn {
font-size: 50rpx; background-color: $white;
color: $dark-9; line-height: 54rpx;
} border-radius: 27rpx;
} padding: 0 20rpx;
} font-size: 24rpx;
font-weight: 500;
color: $dark-6;
// tab .ss-seldate-icon {
.wallet-tab-card { font-size: 50rpx;
.tab-item { color: $dark-9;
height: 80rpx; }
position: relative; }
}
.tab-title { // tab
font-size: 30rpx; .wallet-tab-card {
} .tab-item {
height: 80rpx;
position: relative;
.cur-tab-title { .tab-title {
font-weight: $font-weight-bold; font-size: 30rpx;
} }
.tab-line { .cur-tab-title {
width: 60rpx; font-weight: $font-weight-bold;
height: 6rpx; }
border-radius: 6rpx;
position: absolute;
left: 50%;
transform: translateX(-50%);
bottom: 2rpx;
background-color: var(--ui-BG-Main);
}
}
}
// 钱包记录 .tab-line {
.wallet-list { width: 60rpx;
padding: 30rpx; height: 6rpx;
background-color: #ffff; border-radius: 6rpx;
position: absolute;
left: 50%;
transform: translateX(-50%);
bottom: 2rpx;
background-color: var(--ui-BG-Main);
}
}
}
.head-img { // 钱包记录
width: 70rpx; .wallet-list {
height: 70rpx; padding: 30rpx;
border-radius: 50%; background-color: #ffff;
background: $gray-c;
}
.list-content { .head-img {
justify-content: space-between; width: 70rpx;
align-items: flex-start; height: 70rpx;
flex: 1; border-radius: 50%;
background: $gray-c;
}
.title { .list-content {
font-size: 28rpx; justify-content: space-between;
color: $dark-3; align-items: flex-start;
width: 400rpx; flex: 1;
}
.time { .title {
color: $gray-c; font-size: 28rpx;
font-size: 22rpx; color: $dark-3;
} width: 400rpx;
} }
.money { .time {
font-size: 28rpx; color: $gray-c;
font-weight: bold; font-size: 22rpx;
font-family: OPPOSANS; }
}
.add { .money {
color: var(--ui-BG-Main); font-size: 28rpx;
} font-weight: bold;
font-family: OPPOSANS;
.minus { .add {
color: $dark-3; color: var(--ui-BG-Main);
} }
}
}
.model-title { .minus {
font-size: 36rpx; color: $dark-3;
font-weight: bold; }
color: #333333; }
} }
.model-subtitle { .model-title {
font-size: 26rpx; font-size: 36rpx;
color: #c2c7cf; font-weight: bold;
} color: #333333;
}
.model-btn { .model-subtitle {
width: 100%; font-size: 26rpx;
height: 80rpx; color: #c2c7cf;
border-radius: 40rpx; }
font-size: 28rpx;
font-weight: 500;
color: #ffffff;
line-height: normal;
}
.input-box { .model-btn {
height: 100rpx; width: 100%;
height: 80rpx;
border-radius: 40rpx;
font-size: 28rpx;
font-weight: 500;
color: #ffffff;
line-height: normal;
}
.unit { .input-box {
font-size: 48rpx; height: 100rpx;
color: #333;
font-weight: 500;
line-height: normal;
}
.uni-easyinput__placeholder-class { .unit {
font-size: 30rpx; font-size: 48rpx;
height: 40rpx; color: #333;
line-height: normal; font-weight: 500;
} line-height: normal;
} }
</style>
.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', url: '/app-api/member/sign-in/record/get-summary',
method: 'GET', 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) => order: (params) =>
request({ request({
url: 'commission/order', url: '/app-api/trade/brokerage-record/page',
method: 'GET', method: 'GET',
params, params,
}), }),
@@ -52,7 +52,7 @@ export default {
// 我的团队 // 我的团队
team: (params) => team: (params) =>
request({ request({
url: 'commission/agent/team', url: '/app-api/trade/brokerage-user/child-summary-page',
method: 'GET', method: 'GET',
params, params,
}), }),
@@ -68,4 +68,22 @@ export default {
url: '/app-api/trade/brokerage-user/get-summary', url: '/app-api/trade/brokerage-user/get-summary',
method: 'GET', 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'; import request from '@/sheep/request';
export default { export default {
// 预支付 // 预支付
prepay: (data) => prepay: (data) =>
request({ request({
url: 'pay/prepay', url: 'pay/prepay',
method: 'POST', method: 'POST',
data, data,
custom: { custom: {
loadingMsg: '支付中', loadingMsg: '支付中',
}, },
}), }),
// 发起提现 // 发起提现
withdraw: { withdraw: {
list: (params) => list: (params) =>
request({ request({
url: 'withdraw', url: 'withdraw',
method: 'GET', method: 'GET',
params, params,
custom: { custom: {
auth: true, auth: true,
}, },
}), }),
rules: () => rules: () =>
request({ request({
url: 'withdraw/rules', url: 'withdraw/rules',
method: 'GET', method: 'GET',
custom: { custom: {
auth: true, auth: true,
}, },
}), }),
apply: (data) => apply: (data) =>
request({ request({
url: 'withdraw/apply', url: '/app-api/trade/brokerage-withdraw/create',
method: 'POST', method: 'POST',
data, data,
custom: { custom: {
loadingMsg: '申请中', loadingMsg: '申请中',
auth: true, // 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'; import request from '@/sheep/request';
const DiyTemplateApi = { const DiyTemplateApi = {
// TODO 芋艿:测试 // TODO 芋艿:测试
getUsedDiyTemplate: () => { // getUsedDiyTemplate: () => {
return request({ // return request({
url: '/app-api/promotion/diy-template/used', // url: '/app-api/promotion/diy-template/used',
method: 'GET', // method: 'GET',
}); // });
}, // },
getDiyTemplate: (id) => { getDiyTemplate: (id) => {
return request({ return request({
url: '/app-api/promotion/diy-template/get', url: '/app-api/promotion/diy-template/get',
method: 'GET', method: 'GET',
params: { id } params: {
}); id
}, }
});
},
}; };
export default DiyTemplateApi; export default DiyTemplateApi;
+7
View File
@@ -264,6 +264,13 @@ export default {
params, params,
custom: {}, custom: {},
}), }),
log3: (params) =>
request({
url: '/app-api/trade/brokerage-record/page',
// url: 'pay/wallet-transaction/page',
method: 'GET',
params,
}),
}, },
account: { account: {
info: (params) => 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>