分销商品列表-分销账户信息

pull/29/head
落日晚风 2023-12-18 17:58:00 +08:00
parent 4cb256af6c
commit 4a487b5894
9 changed files with 801 additions and 771 deletions

View File

@ -1,108 +1,117 @@
<!-- 账户 --> <!-- 账户 -->
<template> <template>
<view class="account-card"> <view class="account-card">
<view class="account-card-box"> <view class="account-card-box">
<view class="ss-flex ss-row-between card-box-header"> <view class="ss-flex ss-row-between card-box-header">
<view class="ss-flex"> <view class="ss-flex">
<view class="header-title ss-m-r-16">账户信息</view> <view class="header-title ss-m-r-16">账户信息</view>
<button <button class="ss-reset-button look-btn ss-flex" @tap="state.showMoney = !state.showMoney">
class="ss-reset-button look-btn ss-flex" <uni-icons :type="state.showMoney ? 'eye-filled' : 'eye-slash-filled'" color="#A57A55"
@tap="state.showMoney = !state.showMoney" size="20"></uni-icons>
> </button>
<uni-icons </view>
:type="state.showMoney ? 'eye-filled' : 'eye-slash-filled'" <view class="ss-flex" @tap="sheep.$router.go('/pages/user/wallet/commission')">
color="#A57A55" <view class="header-title ss-m-r-4">查看明细</view>
size="20" <text class="cicon-play-arrow"></text>
></uni-icons> </view>
</button> </view>
</view> <!-- 收益 -->
<view class="ss-flex" @tap="sheep.$router.go('/pages/user/wallet/commission')"> <view class="card-content ss-flex">
<view class="header-title ss-m-r-4">查看明细</view> <view class="ss-flex-1 ss-flex-col ss-col-center">
<text class="cicon-play-arrow"></text> <view class="item-title">当前佣金()</view>
</view> <view class="item-detail">
</view> {{ state.showMoney ? userInfo.brokeragePrice || '0.00' : '***' }}
<!-- 收益 --> </view>
<view class="card-content ss-flex"> </view>
<view class="ss-flex-1 ss-flex-col ss-col-center"> <view class="ss-flex-1 ss-flex-col ss-col-center">
<view class="item-title">总收益()</view> <view class="item-title">昨天的佣金()</view>
<view class="item-detail"> <view class="item-detail">
{{ state.showMoney ? agentInfo.total_income || '0.00' : '***' }} {{ state.showMoney ? userInfo.yesterdayPrice || '0.00' : '***' }}
</view> </view>
</view> </view>
<view class="ss-flex-1 ss-flex-col ss-col-center"> <view class="ss-flex-1 ss-flex-col ss-col-center">
<view class="item-title">我的佣金()</view> <view class="item-title">累计已提()</view>
<view class="item-detail"> <view class="item-detail">
{{ state.showMoney ? userInfo.commission || '0.00' : '***' }} {{ state.showMoney ? userInfo.withdrawPrice || '0.00' : '***' }}
</view> </view>
</view> </view>
<view class="ss-flex-1 ss-flex-col ss-col-center"> </view>
<view class="item-title">我的消费()</view> </view>
<view class="item-detail"> </view>
{{ state.showMoney ? userInfo.total_consume || '0.00' : '***' }}
</view>
</view>
</view>
</view>
</view>
</template> </template>
<script setup> <script setup>
import sheep from '@/sheep'; import sheep from '@/sheep';
import { computed, reactive } from 'vue'; import {
computed,
reactive,
onMounted
} from 'vue';
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 state = reactive({ const state = reactive({
showMoney: false, showMoney: false,
}); });
onMounted(async () => {
let res = await sheep.$api.commission.getSummary();
userInfo = res.data;
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.account-card { .account-card {
width: 694rpx; width: 694rpx;
margin: 0 auto; margin: 0 auto;
padding: 2rpx; padding: 2rpx;
background: linear-gradient(180deg, #ffffff 0.88%, #fff9ec 100%); background: linear-gradient(180deg, #ffffff 0.88%, #fff9ec 100%);
border-radius: 12rpx; border-radius: 12rpx;
z-index: 3; z-index: 3;
position: relative; position: relative;
.account-card-box {
background: #ffefd6; .account-card-box {
.card-box-header { background: #ffefd6;
padding: 0 30rpx;
height: 72rpx; .card-box-header {
box-shadow: 0px 2px 6px #f2debe; padding: 0 30rpx;
.header-title { height: 72rpx;
font-size: 24rpx; box-shadow: 0px 2px 6px #f2debe;
font-weight: 500;
color: #a17545; .header-title {
line-height: 30rpx; font-size: 24rpx;
} font-weight: 500;
.cicon-play-arrow { color: #a17545;
color: #a17545; line-height: 30rpx;
font-size: 24rpx; }
line-height: 30rpx;
} .cicon-play-arrow {
} color: #a17545;
.card-content { font-size: 24rpx;
height: 190rpx; line-height: 30rpx;
background: #fdfae9; }
.item-title { }
font-size: 24rpx;
font-weight: 500; .card-content {
color: #cba67e; height: 190rpx;
line-height: 30rpx; background: #fdfae9;
margin-bottom: 24rpx;
} .item-title {
.item-detail { font-size: 24rpx;
font-size: 36rpx; font-weight: 500;
font-family: OPPOSANS; color: #cba67e;
font-weight: bold; line-height: 30rpx;
color: #692e04; margin-bottom: 24rpx;
line-height: 30rpx; }
}
} .item-detail {
} font-size: 36rpx;
} font-family: OPPOSANS;
</style> font-weight: bold;
color: #692e04;
line-height: 30rpx;
}
}
}
}
</style>

View File

@ -1,126 +1,126 @@
<!-- 分销商信息 --> <!-- 分销商信息 -->
<template> <template>
<!-- 用户资料 --> <!-- 用户资料 -->
<view class="user-card ss-flex ss-col-bottom"> <view class="user-card ss-flex ss-col-bottom">
<view class="card-top ss-flex ss-row-between"> <view class="card-top ss-flex ss-row-between">
<view class="ss-flex"> <view class="ss-flex">
<view class="head-img-box"> <view class="head-img-box">
<image class="head-img" :src="sheep.$url.cdn(userInfo.avatar)" mode="aspectFill"></image> <image class="head-img" :src="sheep.$url.cdn(userInfo.avatar)" mode="aspectFill"></image>
</view> </view>
<view class="ss-flex-col"> <view class="ss-flex-col">
<view class="user-name">{{ userInfo.nickname }}</view> <view class="user-name">{{ userInfo.nickname }}</view>
<view class="user-info-box ss-flex"> <view class="user-info-box ss-flex">
<view class="tag-box ss-flex" v-if="agentInfo.level_info"> <view class="tag-box ss-flex" v-if="agentInfo.level_info">
<image <image v-if="agentInfo.level_info?.image" class="tag-img"
v-if="agentInfo.level_info?.image" :src="sheep.$url.cdn(agentInfo.level_info?.image)" mode="aspectFill">
class="tag-img" </image>
:src="sheep.$url.cdn(agentInfo.level_info?.image)" <text class="tag-title">{{ agentInfo.level_info?.name }}</text>
mode="aspectFill" </view>
> <view class="ss-iconfont uicon-arrow-right" style="color: #fff; font-size: 28rpx">
</image> </view>
<text class="tag-title">{{ agentInfo.level_info?.name }}</text> </view>
</view> </view>
<view class="ss-iconfont uicon-arrow-right" style="color: #fff; font-size: 28rpx"> </view>
</view> </view>
</view> </view>
</view>
</view>
</view>
</view>
</template> </template>
<script setup> <script setup>
import sheep from '@/sheep'; import sheep from '@/sheep';
import { computed, reactive } from 'vue'; import {
computed,
reactive
} from 'vue';
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 headerBg = sheep.$url.css('/static/img/shop/commission/background.png'); const headerBg = sheep.$url.css('/static/img/shop/commission/background.png');
console.log(userInfo);
const state = reactive({ const state = reactive({
showMoney: false, showMoney: false,
}); });
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
// //
.user-card { .user-card {
width: 690rpx; width: 690rpx;
height: 192rpx; height: 192rpx;
margin: -88rpx 20rpx 0 20rpx; margin: -88rpx 20rpx 0 20rpx;
padding-top: 88rpx; padding-top: 88rpx;
background: v-bind(headerBg) no-repeat; background: v-bind(headerBg) no-repeat;
background-size: 100% 100%; background-size: 100% 100%;
.head-img-box { .head-img-box {
margin-right: 20rpx; margin-right: 20rpx;
width: 100rpx; width: 100rpx;
height: 100rpx; height: 100rpx;
border-radius: 50%; border-radius: 50%;
position: relative; position: relative;
background: #fce0ad; background: #fce0ad;
.head-img { .head-img {
width: 92rpx; width: 92rpx;
height: 92rpx; height: 92rpx;
border-radius: 50%; border-radius: 50%;
position: absolute; position: absolute;
top: 50%; top: 50%;
left: 50%; left: 50%;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
} }
} }
.card-top { .card-top {
box-sizing: border-box; box-sizing: border-box;
padding-bottom: 34rpx; padding-bottom: 34rpx;
.user-name {
font-size: 32rpx;
font-weight: bold;
color: #692e04;
line-height: 30rpx;
margin-bottom: 20rpx;
}
.log-btn { .user-name {
width: 84rpx; font-size: 32rpx;
height: 42rpx; font-weight: bold;
border: 2rpx solid rgba(#ffffff, 0.33); color: #692e04;
border-radius: 21rpx; line-height: 30rpx;
font-size: 22rpx; margin-bottom: 20rpx;
font-weight: 400; }
color: #ffffff;
margin-bottom: 20rpx;
}
.look-btn { .log-btn {
color: #fff; width: 84rpx;
width: 40rpx; height: 42rpx;
height: 40rpx; border: 2rpx solid rgba(#ffffff, 0.33);
} border-radius: 21rpx;
} font-size: 22rpx;
font-weight: 400;
color: #ffffff;
margin-bottom: 20rpx;
}
.user-info-box { .look-btn {
.tag-box { color: #fff;
background: #ff6000; width: 40rpx;
border-radius: 18rpx; height: 40rpx;
line-height: 36rpx; }
}
.tag-img { .user-info-box {
width: 36rpx; .tag-box {
height: 36rpx; background: #ff6000;
border-radius: 50%; border-radius: 18rpx;
margin-left: -2rpx; line-height: 36rpx;
}
.tag-title { .tag-img {
font-size: 24rpx; width: 36rpx;
padding: 0 10rpx; height: 36rpx;
font-weight: 500; border-radius: 50%;
line-height: 36rpx; margin-left: -2rpx;
color: #fff; }
}
} .tag-title {
} font-size: 24rpx;
} padding: 0 10rpx;
</style> font-weight: 500;
line-height: 36rpx;
color: #fff;
}
}
}
}
</style>

View File

@ -1,137 +1,123 @@
<!-- 页面 --> <!-- 页面 -->
<template> <template>
<s-layout title="推广商品" :onShareAppMessage="state.shareInfo"> <s-layout title="推广商品" :onShareAppMessage="state.shareInfo">
<view class="goods-item ss-m-20" v-for="item in state.pagination.data" :key="item.id"> <view class="goods-item ss-m-20" v-for="item in state.pagination.data" :key="item.id">
<s-goods-item <s-goods-item size="lg" :img="item.picUrl" :title="item.name" :subTitle="item.subtitle" :price="item.price"
size="lg" :originPrice="item.original_price" priceColor="#333"
:img="item.image" @tap="sheep.$router.go('/pages/goods/index', { id: item.id })">
:title="item.title" <template #rightBottom>
:subTitle="item.subtitle" <view class="ss-flex ss-row-between">
:price="item.price[0]" <view class="commission-num">预计佣金{{ item.commission }}</view>
:originPrice="item.original_price" <button class="ss-reset-button share-btn ui-BG-Main-Gradient" @tap.stop="onShareGoods(item)">
priceColor="#333" 分享赚
@tap="sheep.$router.go('/pages/goods/index', { id: item.id })" </button>
> </view>
<template #rightBottom> </template>
<view class="ss-flex ss-row-between"> </s-goods-item>
<view class="commission-num">预计佣金{{ item.commission }}</view> </view>
<button <s-empty v-if="state.pagination.total === 0" icon="/static/goods-empty.png" text="暂无推广商品"></s-empty>
class="ss-reset-button share-btn ui-BG-Main-Gradient" <!-- 加载更多 -->
@tap.stop="onShareGoods(item)" <uni-load-more v-if="state.pagination.total > 0" :status="state.loadStatus" :content-text="{
>
分享赚
</button>
</view>
</template>
</s-goods-item>
</view>
<s-empty
v-if="state.pagination.total === 0"
icon="/static/goods-empty.png"
text="暂无推广商品"
></s-empty>
<!-- 加载更多 -->
<uni-load-more
v-if="state.pagination.total > 0"
:status="state.loadStatus"
:content-text="{
contentdown: '上拉加载更多', contentdown: '上拉加载更多',
}" }" @tap="loadmore" />
@tap="loadmore" </s-layout>
/>
</s-layout>
</template> </template>
<script setup> <script setup>
import sheep from '@/sheep'; import sheep from '@/sheep';
import $share from '@/sheep/platform/share'; import $share from '@/sheep/platform/share';
import { onLoad, onReachBottom } from '@dcloudio/uni-app'; import {
import { computed, reactive } from 'vue'; onLoad,
import _ from 'lodash'; onReachBottom
import { showShareModal } from '@/sheep/hooks/useModal'; } from '@dcloudio/uni-app';
import {
computed,
reactive
} from 'vue';
import _ from 'lodash';
import {
showShareModal
} from '@/sheep/hooks/useModal';
const state = reactive({ const state = reactive({
pagination: { pagination: {
data: [], data: [],
current_page: 1, current_page: 1,
total: 1, total: 1,
last_page: 1, last_page: 1,
}, },
loadStatus: '', loadStatus: '',
shareInfo: {}, shareInfo: {},
}); });
function onShareGoods(goodsInfo) { function onShareGoods(goodsInfo) {
state.shareInfo = $share.getShareInfo( state.shareInfo = $share.getShareInfo({
{ title: goodsInfo.title,
title: goodsInfo.title, image: sheep.$url.cdn(goodsInfo.image),
image: sheep.$url.cdn(goodsInfo.image), desc: goodsInfo.subtitle,
desc: goodsInfo.subtitle, params: {
params: { page: '2',
page: '2', query: goodsInfo.id,
query: goodsInfo.id, },
}, }, {
}, type: 'goods', //
{ title: goodsInfo.title, //
type: 'goods', // image: sheep.$url.cdn(goodsInfo.image), //
title: goodsInfo.title, // price: goodsInfo.price[0], //
image: sheep.$url.cdn(goodsInfo.image), // original_price: goodsInfo.original_price, //
price: goodsInfo.price[0], // }, );
original_price: goodsInfo.original_price, // showShareModal();
}, }
); async function getGoodsList(page = 1, list_rows = 8) {
showShareModal(); state.pagination.current_page = page;
} state.loadStatus = 'loading';
let res = await sheep.$api.commission.goods({
pageSize: list_rows,
pageNo: page,
});
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';
}
}
}
async function getGoodsList(page = 1, list_rows = 8) { onLoad(async () => {
state.loadStatus = 'loading'; getGoodsList();
let res = await sheep.$api.commission.goods({ });
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 () => { //
getGoodsList(); function loadmore() {
}); if (state.loadStatus !== 'noMore') {
getGoodsList(state.pagination.current_page + 1);
}
}
// //
function loadmore() { onReachBottom(() => {
if (state.loadStatus !== 'noMore') { loadmore();
getGoodsList(state.pagination.current_page + 1); });
}
}
//
onReachBottom(() => {
loadmore();
});
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.goods-item { .goods-item {
.commission-num { .commission-num {
font-size: 24rpx; font-size: 24rpx;
font-weight: 500; font-weight: 500;
color: $red; color: $red;
} }
.share-btn { .share-btn {
width: 120rpx; width: 120rpx;
height: 50rpx; height: 50rpx;
border-radius: 25rpx; border-radius: 25rpx;
} }
} }
</style> </style>

View File

@ -1,417 +1,411 @@
<!-- 分销订单 --> <!-- 分销订单 -->
<template> <template>
<s-layout title="分销订单" :class="state.scrollTop ? 'order-warp' : ''" navbar="inner"> <s-layout title="分销订单" :class="state.scrollTop ? 'order-warp' : ''" 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 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"> <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"> {{ state.agentInfo.child_order_count_all || 0 }}
{{ state.agentInfo.child_order_count_all || 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"> {{ state.agentInfo.child_order_count_1 || 0 }}
{{ state.agentInfo.child_order_count_1 || 0 }} </view>
</view> </view>
</view> <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"> {{ 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"> {{ state.agentInfo.child_order_money_all || '0.00' }}
{{ state.agentInfo.child_order_money_all || '0.00' }} </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"> {{ state.agentInfo.child_order_money_1 || '0.00' }}
{{ state.agentInfo.child_order_money_1 || '0.00' }} </view>
</view> </view>
</view> <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"> {{ state.agentInfo.child_order_money_2 || '0.00' }}
{{ state.agentInfo.child_order_money_2 || '0.00' }} </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"> {{ state.agentInfo.child_order_count_0 || 0 }}
{{ state.agentInfo.child_order_count_0 || 0 }} </view>
</view> </view>
</view> <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"> {{ 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 -->
<su-sticky bgColor="#fff"> <su-sticky bgColor="#fff">
<su-tabs <su-tabs :list="tabMaps" :scrollable="false" :current="state.currentTab" @change="onTabsChange">
:list="tabMaps" </su-tabs>
:scrollable="false" </su-sticky>
:current="state.currentTab"
@change="onTabsChange"
>
</su-tabs>
</su-sticky>
<!-- 订单 --> <!-- 订单 -->
<view class="order-box"> <view class="order-box">
<view class="order-item" v-for="item in state.pagination.data" :key="item"> <view class="order-item" v-for="item in state.pagination.data" :key="item">
<view class="order-header"> <view class="order-header">
<view class="no-box ss-flex ss-col-center ss-row-between"> <view class="no-box ss-flex ss-col-center ss-row-between">
<text class="order-code">订单编号{{ item.order.order_sn }}</text> <text class="order-code">订单编号{{ item.order.order_sn }}</text>
<text class="order-state">{{ item.order_item.status_text }}</text> <text class="order-state">{{ item.order_item.status_text }}</text>
</view> </view>
<view class="order-from ss-flex ss-col-center ss-row-between"> <view class="order-from ss-flex ss-col-center ss-row-between">
<view class="from-user ss-flex ss-col-center"> <view class="from-user ss-flex ss-col-center">
<text>下单人</text> <text>下单人</text>
<image class="user-avatar" :src="sheep.$url.cdn(item.buyer.avatar)" mode="aspectFill"> <image class="user-avatar" :src="sheep.$url.cdn(item.buyer.avatar)" mode="aspectFill">
</image> </image>
<text class="user-name">{{ item.buyer.nickname }}</text> <text class="user-name">{{ item.buyer.nickname }}</text>
</view> </view>
<view class="order-time">{{ item.create_time }}</view> <view class="order-time">{{ item.create_time }}</view>
</view> </view>
</view> </view>
<s-goods-item <s-goods-item class="border-bottom" :img="item.order_item.goods_image"
class="border-bottom" :title="item.order_item.goods_title" :skuText="item.order_item.goods_sku_text"
:img="item.order_item.goods_image" :price="item.order_item.goods_price" :num="item.order_item.goods_num">
:title="item.order_item.goods_title" <template #rightBottom>
:skuText="item.order_item.goods_sku_text" <view class="ss-flex commission-box ss-row-between ss-m-t-10">
:price="item.order_item.goods_price" <view class="ss-flex">
:num="item.order_item.goods_num" <text class="name">佣金</text>
> <text class="commission-num">{{ item.rewards[0]?.commission }}</text>
<template #rightBottom> </view>
<view class="ss-flex commission-box ss-row-between ss-m-t-10"> <view class="order-status">
<view class="ss-flex"> {{ item.commission_order_status_text }}
<text class="name">佣金</text> </view>
<text class="commission-num">{{ item.rewards[0]?.commission }}</text> </view>
</view> </template>
<view class="order-status"> </s-goods-item>
{{ item.commission_order_status_text }} </view>
</view> <!-- 数据为空 -->
</view> <s-empty v-if="state.pagination.total === 0" icon="/static/order-empty.png" text="暂无订单">
</template> </s-empty>
</s-goods-item> <!-- 加载更多 -->
</view> <uni-load-more v-if="state.pagination.total > 0" :status="state.loadStatus" :content-text="{
<!-- 数据为空 -->
<s-empty v-if="state.pagination.total === 0" icon="/static/order-empty.png" text="暂无订单">
</s-empty>
<!-- 加载更多 -->
<uni-load-more
v-if="state.pagination.total > 0"
:status="state.loadStatus"
:content-text="{
contentdown: '上拉加载更多', contentdown: '上拉加载更多',
}" }" @tap="loadmore" />
@tap="loadmore" </view>
/> <!-- </view> -->
</view> </s-layout>
<!-- </view> -->
</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 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: { pagination: {
data: [], data: [],
current_page: 1, current_page: 1,
total: 1, total: 1,
last_page: 1, last_page: 1,
}, },
loadStatus: '', loadStatus: '',
currentTab: 0, currentTab: 0,
agentInfo: {}, agentInfo: {},
scrollTop: false, scrollTop: false,
}); });
const tabMaps = [ const tabMaps = [{
{ name: '全部',
name: '全部', value: 'all',
value: 'all', },
}, // {
// { // name: '',
// name: '', // 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: 1, last_page: 1,
last_page: 1, };
}; state.currentTab = e.index;
state.currentTab = e.index; getOrderList();
getOrderList(); }
}
// //
async function getOrderList(page = 1, list_rows = 5) { async function getOrderList(page = 1, list_rows = 5) {
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, list_rows,
page, page,
}); });
if (res.error === 0) { if (res.error === 0) {
let orderList = _.concat(state.pagination.data, res.data.data); let orderList = _.concat(state.pagination.data, res.data.data);
state.pagination = { state.pagination = {
...res.data, ...res.data,
data: orderList, data: orderList,
}; };
if (state.pagination.current_page < state.pagination.last_page) { if (state.pagination.current_page < state.pagination.last_page) {
state.loadStatus = 'more'; state.loadStatus = 'more';
} else { } else {
state.loadStatus = 'noMore'; state.loadStatus = 'noMore';
} }
} }
} }
async function getAgentInfo() { async function getAgentInfo() {
const { error, data, msg } = await sheep.$api.commission.agent(); const {
if (error === 0) { error,
state.agentInfo = data; data,
} msg
} } = await sheep.$api.commission.agent();
if (error === 0) {
state.agentInfo = data;
}
}
onLoad(() => { onLoad(() => {
getAgentInfo(); getAgentInfo();
getOrderList(); getOrderList();
}); });
// //
function loadmore() { function loadmore() {
if (state.loadStatus !== 'noMore') { if (state.loadStatus !== 'noMore') {
getOrderList(state.pagination.current_page + 1); getOrderList(state.pagination.current_page + 1);
} }
} }
// //
onReachBottom(() => { onReachBottom(() => {
loadmore(); 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;
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;
.total-item { //
margin-bottom: 30rpx; .team-data-box {
.data-card {
width: 305rpx;
background: #ffffff;
border-radius: 20rpx;
padding: 20rpx;
.item-title { .total-item {
font-size: 24rpx; margin-bottom: 30rpx;
font-weight: 500;
color: #999999;
line-height: normal;
margin-bottom: 20rpx;
}
.total-num { .item-title {
font-size: 38rpx; font-size: 24rpx;
font-weight: 500; font-weight: 500;
color: #333333; color: #999999;
font-family: OPPOSANS; line-height: normal;
} margin-bottom: 20rpx;
} }
.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;
} }
} }
}
// .category-num {
.direct-box { font-size: 26rpx;
margin-top: 20rpx; font-weight: 500;
color: #333333;
font-family: OPPOSANS;
}
}
}
.direct-item { //
width: 340rpx; .direct-box {
background: #ffffff; margin-top: 20rpx;
border-radius: 20rpx;
padding: 20rpx;
box-sizing: border-box;
.item-title { .direct-item {
font-size: 22rpx; width: 340rpx;
font-weight: 500; background: #ffffff;
color: #999999; border-radius: 20rpx;
margin-bottom: 6rpx; padding: 20rpx;
} box-sizing: border-box;
.item-value { .item-title {
font-size: 38rpx; font-size: 22rpx;
font-weight: 500; font-weight: 500;
color: #333333; color: #999999;
font-family: OPPOSANS; margin-bottom: 6rpx;
} }
}
}
}
// .item-value {
.order-box { font-size: 38rpx;
.order-item { font-weight: 500;
background: #ffffff; color: #333333;
border-radius: 10rpx; font-family: OPPOSANS;
margin: 20rpx; }
}
}
}
.order-footer { //
padding: 20rpx; .order-box {
font-size: 24rpx; .order-item {
color: #999; background: #ffffff;
} border-radius: 10rpx;
margin: 20rpx;
.order-header { .order-footer {
.no-box { padding: 20rpx;
padding: 20rpx; font-size: 24rpx;
color: #999;
}
.order-code { .order-header {
font-size: 26rpx; .no-box {
font-weight: 500; padding: 20rpx;
color: #333333;
}
.order-state { .order-code {
font-size: 26rpx; font-size: 26rpx;
font-weight: 500; font-weight: 500;
color: var(--ui-BG-Main); color: #333333;
} }
}
.order-from { .order-state {
padding: 20rpx; font-size: 26rpx;
font-weight: 500;
color: var(--ui-BG-Main);
}
}
.from-user { .order-from {
font-size: 24rpx; padding: 20rpx;
font-weight: 400;
color: #666666;
.user-avatar { .from-user {
width: 26rpx; font-size: 24rpx;
height: 26rpx; font-weight: 400;
border-radius: 50%; color: #666666;
margin-right: 8rpx;
}
.user-name { .user-avatar {
font-size: 24rpx; width: 26rpx;
font-weight: 400; height: 26rpx;
color: #999999; border-radius: 50%;
} margin-right: 8rpx;
} }
.order-time { .user-name {
font-size: 24rpx; font-size: 24rpx;
font-weight: 400; font-weight: 400;
color: #999999; color: #999999;
} }
} }
}
.commission-box { .order-time {
.name { font-size: 24rpx;
font-size: 24rpx; font-weight: 400;
font-weight: 400; color: #999999;
color: #999999; }
} }
} }
.commission-num { .commission-box {
font-size: 30rpx; .name {
font-weight: 500; font-size: 24rpx;
color: $red; font-weight: 400;
font-family: OPPOSANS; color: #999999;
}
}
&::before { .commission-num {
content: '¥'; font-size: 30rpx;
font-size: 22rpx; font-weight: 500;
} color: $red;
} font-family: OPPOSANS;
.order-status { &::before {
line-height: 30rpx; content: '¥';
padding: 0 10rpx; font-size: 22rpx;
border-radius: 30rpx; }
margin-left: 20rpx; }
font-size: 24rpx;
color: var(--ui-BG-Main); .order-status {
} line-height: 30rpx;
} padding: 0 10rpx;
} border-radius: 30rpx;
</style> margin-left: 20rpx;
font-size: 24rpx;
color: var(--ui-BG-Main);
}
}
}
</style>

28
project.config.json Normal file
View File

@ -0,0 +1,28 @@
{
"appid": "wxd4da84f87dcafd80",
"compileType": "miniprogram",
"libVersion": "3.2.4",
"packOptions": {
"ignore": [],
"include": []
},
"setting": {
"coverView": true,
"es6": true,
"postcss": true,
"minified": true,
"enhance": true,
"showShadowRootInWxmlPanel": true,
"packNpmRelationList": [],
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
}
},
"condition": {},
"editorSetting": {
"tabIndent": "insertSpaces",
"tabSize": 2
}
}

View File

@ -0,0 +1,7 @@
{
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"projectname": "uni3",
"setting": {
"compileHotReLoad": true
}
}

View File

@ -1,65 +1,71 @@
import request from '@/sheep/request'; import request from '@/sheep/request';
export default { export default {
// 分销商详情 // 分销商详情
agent: () => agent: () =>
request({ request({
url: 'commission/agent', url: 'commission/agent',
method: 'GET', method: 'GET',
custom: { custom: {
showLoading: false, showLoading: false,
showError: false, showError: false,
}, },
}), }),
// 分销表单 // 分销表单
form: () => form: () =>
request({ request({
url: 'commission/agent/form', url: 'commission/agent/form',
method: 'GET', method: 'GET',
}), }),
// 申请分销商 // 申请分销商
apply: (data) => apply: (data) =>
request({ request({
url: 'commission/agent/apply', url: 'commission/agent/apply',
method: 'POST', method: 'POST',
data, data,
custom: { custom: {
showSuccess: true, showSuccess: true,
}, },
}), }),
// 分销动态 // 分销动态
log: (params) => log: (params) =>
request({ request({
url: 'commission/log', url: 'commission/log',
method: 'GET', method: 'GET',
params, params,
}), }),
// 分销订单 // 分销订单
order: (params) => order: (params) =>
request({ request({
url: 'commission/order', url: 'commission/order',
method: 'GET', method: 'GET',
params, params,
}), }),
// 分销商品
goods: (params) => // 分销商品
request({ goods: (params) =>
url: 'commission/goods', request({
method: 'GET', url: '/app-api/product/spu/page',
params, method: 'GET',
}), params,
// 我的团队 }),
team: (params) => // 我的团队
request({ team: (params) =>
url: 'commission/agent/team', request({
method: 'GET', url: 'commission/agent/team',
params, method: 'GET',
}), params,
// 佣金转余额 }),
transfer: (data) => // 佣金转余额
request({ transfer: (data) =>
url: 'commission/agent/transfer', request({
method: 'POST', url: 'commission/agent/transfer',
data, method: 'POST',
}), data,
}; }),
getSummary: (data) =>
request({
url: '/app-api/trade/brokerage-user/get-summary',
method: 'GET',
}),
};

View File

@ -94,7 +94,7 @@ http.interceptors.request.use(
if (config.url.indexOf('/app-api/') !== -1) { if (config.url.indexOf('/app-api/') !== -1) {
config.header['Accept'] = '*/*' config.header['Accept'] = '*/*'
config.header['tenant-id'] = '1'; config.header['tenant-id'] = '1';
config.header['terminal'] = '20'; config.header['terminal'] = '20';
config.header['Authorization'] = 'Bearer test247'; config.header['Authorization'] = 'Bearer test247';
} }
return config; return config;
@ -113,7 +113,7 @@ http.interceptors.response.use(
if (response.header.authorization || response.header.Authorization) { if (response.header.authorization || response.header.Authorization) {
$store('user').setToken(response.header.authorization || response.header.Authorization); $store('user').setToken(response.header.authorization || response.header.Authorization);
} }
// TODO 芋艿:如果是登录的 API则自动设置 token // TODO 芋艿:如果是登录的 API则自动设置 token
response.config.custom.showLoading && closeLoading(); response.config.custom.showLoading && closeLoading();
if (response.data.error !== 0 && response.data.code !== 0) { if (response.data.error !== 0 && response.data.code !== 0) {
@ -125,10 +125,10 @@ http.interceptors.response.use(
}); });
return Promise.resolve(response.data); return Promise.resolve(response.data);
} }
// 成功时的提示 // 成功时的提示
if ( if (
(response.data.error === 0 || response.data.code === 0) && (response.data.error === 0 || response.data.code === 0) &&
( response.data.msg !== '' || response.config.custom.successMsg !== '' ) && (response.data.msg !== '' || response.config.custom.successMsg !== '') &&
response.config.custom.showSuccess response.config.custom.showSuccess
) { ) {
uni.showToast({ uni.showToast({
@ -215,8 +215,8 @@ const request = (config) => {
} }
// TODO 芋艿:额外拼接 // TODO 芋艿:额外拼接
if (config.url.indexOf('/app-api/') >= 0) { if (config.url.indexOf('/app-api/') >= 0) {
// config.url = 'http://api-dashboard.yudao.iocoder.cn' + config.url; // 调用【云端】 config.url = 'http://api-dashboard.yudao.iocoder.cn' + config.url; // 调用【云端】
config.url = 'http://127.0.0.1:48080' + config.url; // 调用【本地】 // config.url = 'http://127.0.0.1:48080' + config.url; // 调用【本地】
} }
return http.middleware(config); return http.middleware(config);
}; };

View File

@ -95,8 +95,8 @@ http.interceptors.request.use(
if (config.url.indexOf('/app-api/') !== -1) { if (config.url.indexOf('/app-api/') !== -1) {
config.header['Accept'] = '*/*' config.header['Accept'] = '*/*'
config.header['tenant-id'] = '1'; config.header['tenant-id'] = '1';
config.header['terminal'] = '20'; config.header['terminal'] = '20';
config.header['Authorization'] = 'Bearer test247'; config.header['Authorization'] = 'Bearer test247';
} }
return config; return config;
}, },