✨ 分销:相关逻辑接入 100%
parent
ae52aa69f6
commit
74b450ec3c
24
pages.json
24
pages.json
|
@ -309,18 +309,6 @@
|
||||||
"group": "用户中心"
|
"group": "用户中心"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"path": "wallet/commission",
|
|
||||||
"style": {
|
|
||||||
"navigationBarTitleText": "我的佣金"
|
|
||||||
},
|
|
||||||
"meta": {
|
|
||||||
"auth": true,
|
|
||||||
"sync": true,
|
|
||||||
"title": "用户佣金",
|
|
||||||
"group": "分销中心"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"path": "wallet/score",
|
"path": "wallet/score",
|
||||||
"style": {
|
"style": {
|
||||||
|
@ -349,6 +337,18 @@
|
||||||
"group": "分销商城"
|
"group": "分销商城"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "wallet",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "我的佣金"
|
||||||
|
},
|
||||||
|
"meta": {
|
||||||
|
"auth": true,
|
||||||
|
"sync": true,
|
||||||
|
"title": "用户佣金",
|
||||||
|
"group": "分销中心"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "goods",
|
"path": "goods",
|
||||||
"style": {
|
"style": {
|
||||||
|
|
|
@ -1,290 +0,0 @@
|
||||||
<!-- 申请分销商 -->
|
|
||||||
<template>
|
|
||||||
<s-layout title="申请分销商" class="apply-wrap" navbar="inner">
|
|
||||||
<s-empty
|
|
||||||
v-if="state.error === 1"
|
|
||||||
paddingTop="0"
|
|
||||||
icon="/static/comment-empty.png"
|
|
||||||
text="未开启分销商申请"
|
|
||||||
></s-empty>
|
|
||||||
|
|
||||||
<view v-if="state.error === 0" class="distribution-apply-wrap">
|
|
||||||
<view class="apply-header">
|
|
||||||
<view class="header-box ss-flex">
|
|
||||||
<image
|
|
||||||
class="bg-img"
|
|
||||||
:src="sheep.$url.cdn(state.background)"
|
|
||||||
mode="widthFix"
|
|
||||||
@load="onImgLoad"
|
|
||||||
></image>
|
|
||||||
<view class="heaer-title">申请分销商</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="apply-box bg-white" :style="{ marginTop: state.imgHeight + 'rpx' }">
|
|
||||||
<uni-forms
|
|
||||||
label-width="200"
|
|
||||||
:model="state.model"
|
|
||||||
:rules="state.rules"
|
|
||||||
border
|
|
||||||
class="form-box"
|
|
||||||
>
|
|
||||||
<view class="item-box">
|
|
||||||
<uni-forms-item
|
|
||||||
v-for="(item, index) in state.formList"
|
|
||||||
:key="index"
|
|
||||||
:label="item.name"
|
|
||||||
:required="true"
|
|
||||||
:label-position="item.type == 'image' ? 'top' : 'left'"
|
|
||||||
>
|
|
||||||
<uni-easyinput
|
|
||||||
v-if="item.type !== 'image'"
|
|
||||||
:inputBorder="false"
|
|
||||||
:type="item.type"
|
|
||||||
:styles="{ disableColor: '#fff' }"
|
|
||||||
placeholderStyle="color:#BBBBBB;font-size:28rpx;line-height:normal"
|
|
||||||
v-model="item.value"
|
|
||||||
:placeholder="`请填写${item.name}`"
|
|
||||||
/>
|
|
||||||
<s-uploader
|
|
||||||
v-if="item.type === 'image'"
|
|
||||||
v-model:url="item.value"
|
|
||||||
fileMediatype="image"
|
|
||||||
limit="1"
|
|
||||||
mode="grid"
|
|
||||||
:imageStyles="{ width: '168rpx', height: '168rpx' }"
|
|
||||||
class="file-picker"
|
|
||||||
/>
|
|
||||||
</uni-forms-item>
|
|
||||||
</view>
|
|
||||||
</uni-forms>
|
|
||||||
<label class="ss-flex ss-m-t-20" v-if="state.protocol?.status == 1" @tap="onChange">
|
|
||||||
<radio
|
|
||||||
:checked="state.isAgree"
|
|
||||||
color="var(--ui-BG-Main)"
|
|
||||||
style="transform: scale(0.6)"
|
|
||||||
@tap.stop="onChange"
|
|
||||||
/>
|
|
||||||
<view class="agreement-text ss-flex">
|
|
||||||
<view class="ss-m-r-4">勾选代表同意</view>
|
|
||||||
<view
|
|
||||||
class="tcp-text"
|
|
||||||
@tap.stop="
|
|
||||||
sheep.$router.go('/pages/public/richtext', {
|
|
||||||
id: state.protocol.id,
|
|
||||||
title: state.protocol.title,
|
|
||||||
})
|
|
||||||
"
|
|
||||||
>
|
|
||||||
《{{ state.protocol.title }}》
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</label>
|
|
||||||
<su-fixed bottom placeholder>
|
|
||||||
<view class="submit-box ss-flex ss-row-center ss-p-30">
|
|
||||||
<button class="submit-btn ss-reset-button ui-BG-Main ui-Shadow-Main" @tap="submit">
|
|
||||||
{{ submitText }}
|
|
||||||
</button>
|
|
||||||
</view>
|
|
||||||
</su-fixed>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</s-layout>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup>
|
|
||||||
import sheep from '@/sheep';
|
|
||||||
import { onLoad } from '@dcloudio/uni-app';
|
|
||||||
import { computed, reactive } from 'vue';
|
|
||||||
import { isEmpty } from 'lodash';
|
|
||||||
|
|
||||||
const state = reactive({
|
|
||||||
error: -1,
|
|
||||||
status: '-',
|
|
||||||
config: {},
|
|
||||||
isAgree: false,
|
|
||||||
formList: [],
|
|
||||||
protocol: {},
|
|
||||||
applyInfo: [],
|
|
||||||
background: '',
|
|
||||||
imgHeight: 400,
|
|
||||||
});
|
|
||||||
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
|
|
||||||
|
|
||||||
//勾选协议
|
|
||||||
function onChange() {
|
|
||||||
state.isAgree = !state.isAgree;
|
|
||||||
}
|
|
||||||
|
|
||||||
const submitText = computed(() => {
|
|
||||||
if (state.status === 'normal') return '修改信息';
|
|
||||||
if (state.status === 'needinfo') return '提交审核';
|
|
||||||
if (state.status === 'reject') return '重新提交';
|
|
||||||
return '';
|
|
||||||
});
|
|
||||||
|
|
||||||
async function getAgentForm() {
|
|
||||||
const { error, data } = await sheep.$api.commission.form();
|
|
||||||
state.error = error;
|
|
||||||
if (error === 0) {
|
|
||||||
state.status = data.status;
|
|
||||||
state.background = data.background;
|
|
||||||
state.formList = data.form;
|
|
||||||
state.applyInfo = data.applyInfo;
|
|
||||||
state.protocol = data.protocol;
|
|
||||||
|
|
||||||
if (data.protocol.status != 1) {
|
|
||||||
state.isAgree = true;
|
|
||||||
}
|
|
||||||
mergeFormList();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function onImgLoad(e) {
|
|
||||||
state.imgHeight = (e.detail.height / e.detail.width) * 750 - 88 - statusBarHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function submit() {
|
|
||||||
if (!state.isAgree) {
|
|
||||||
sheep.$helper.toast('请同意申请协议');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const validate = state.formList.every((item) => {
|
|
||||||
if (isEmpty(item.value)) {
|
|
||||||
if (item.type !== 'image') {
|
|
||||||
sheep.$helper.toast(`请填写${item.name}`);
|
|
||||||
} else {
|
|
||||||
sheep.$helper.toast(`请上传${item.name}`);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!validate) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const { error } = await sheep.$api.commission.apply({
|
|
||||||
data: state.formList,
|
|
||||||
});
|
|
||||||
if (error === 0) {
|
|
||||||
sheep.$router.back();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onLoad(() => {
|
|
||||||
getAgentForm();
|
|
||||||
});
|
|
||||||
|
|
||||||
// 初始化formData
|
|
||||||
function mergeFormList() {
|
|
||||||
state.formList.forEach((form) => {
|
|
||||||
const apply = state.applyInfo.find(
|
|
||||||
(info) => info.type === form.type && info.name === form.name,
|
|
||||||
);
|
|
||||||
if (typeof apply !== 'undefined') form.value = apply.value;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
:deep() {
|
|
||||||
.uni-forms-item__label .label-text {
|
|
||||||
font-size: 28rpx !important;
|
|
||||||
color: #333333 !important;
|
|
||||||
line-height: normal !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.file-picker__progress {
|
|
||||||
height: 0 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.uni-list-item__content-title {
|
|
||||||
font-size: 28rpx !important;
|
|
||||||
color: #333333 !important;
|
|
||||||
line-height: normal !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.uni-icons {
|
|
||||||
font-size: 40rpx !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.is-disabled {
|
|
||||||
color: #333333;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.distribution-apply-wrap {
|
|
||||||
// height: 100vh;
|
|
||||||
// width: 100vw;
|
|
||||||
// position: absolute;
|
|
||||||
// left: 0;
|
|
||||||
// top: 0;
|
|
||||||
// background-color: #fff;
|
|
||||||
// overflow-y: auto;
|
|
||||||
|
|
||||||
.submit-btn {
|
|
||||||
width: 690px;
|
|
||||||
height: 86rpx;
|
|
||||||
border-radius: 43rpx;
|
|
||||||
}
|
|
||||||
.apply-header {
|
|
||||||
position: absolute;
|
|
||||||
left: 0;
|
|
||||||
top: 0;
|
|
||||||
}
|
|
||||||
.header-box {
|
|
||||||
width: 100%;
|
|
||||||
position: relative;
|
|
||||||
.bg-img {
|
|
||||||
width: 750rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.heaer-title {
|
|
||||||
position: absolute;
|
|
||||||
left: 30rpx;
|
|
||||||
top: 50%;
|
|
||||||
transform: translateY(-50%);
|
|
||||||
font-size: 50rpx;
|
|
||||||
font-weight: bold;
|
|
||||||
color: #ffffff;
|
|
||||||
z-index: 11;
|
|
||||||
|
|
||||||
&::before {
|
|
||||||
content: '';
|
|
||||||
width: 51rpx;
|
|
||||||
height: 8rpx;
|
|
||||||
background: #ffffff;
|
|
||||||
border-radius: 4rpx;
|
|
||||||
position: absolute;
|
|
||||||
z-index: 12;
|
|
||||||
bottom: -20rpx;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.apply-box {
|
|
||||||
padding: 0 40rpx;
|
|
||||||
|
|
||||||
.item-box {
|
|
||||||
border-bottom: 2rpx solid #eee;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.agreement-text {
|
|
||||||
font-size: 24rpx;
|
|
||||||
color: #c4c4c4;
|
|
||||||
line-height: normal;
|
|
||||||
|
|
||||||
.tcp-text {
|
|
||||||
color: var(--ui-BG-Main);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-image {
|
|
||||||
width: 140rpx;
|
|
||||||
height: 140rpx;
|
|
||||||
border-radius: 50%;
|
|
||||||
}
|
|
||||||
</style>
|
|
File diff suppressed because one or more lines are too long
|
@ -9,16 +9,6 @@
|
||||||
</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="tag-box ss-flex" v-if="agentInfo.level_info">
|
|
||||||
<image v-if="agentInfo.level_info?.image" class="tag-img"
|
|
||||||
:src="sheep.$url.cdn(agentInfo.level_info?.image)" mode="aspectFill">
|
|
||||||
</image>
|
|
||||||
<text class="tag-title">{{ agentInfo.level_info?.name }}</text>
|
|
||||||
</view>
|
|
||||||
<view class="ss-iconfont uicon-arrow-right" style="color: #fff; font-size: 28rpx">
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -30,7 +20,6 @@
|
||||||
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 headerBg = sheep.$url.css('/static/img/shop/commission/background.png');
|
const headerBg = sheep.$url.css('/static/img/shop/commission/background.png');
|
||||||
|
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
{
|
{
|
||||||
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/commission/wallet',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
img: '/static/img/shop/commission/commission_icon3.png',
|
img: '/static/img/shop/commission/commission_icon3.png',
|
||||||
|
|
|
@ -1,123 +1,150 @@
|
||||||
<!-- 页面 -->
|
<!-- 分销商品列表 -->
|
||||||
<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.list" :key="item.id">
|
||||||
<s-goods-item size="lg" :img="item.picUrl" :title="item.name" :subTitle="item.subtitle" :price="item.price"
|
<s-goods-item
|
||||||
:originPrice="item.original_price" priceColor="#333"
|
size="lg"
|
||||||
@tap="sheep.$router.go('/pages/goods/index', { id: item.id })">
|
:img="item.picUrl"
|
||||||
<template #rightBottom>
|
:title="item.name"
|
||||||
<view class="ss-flex ss-row-between">
|
:subTitle="item.introduction"
|
||||||
<view class="commission-num">预计佣金:¥{{ item.commission }}</view>
|
:price="item.price"
|
||||||
<button class="ss-reset-button share-btn ui-BG-Main-Gradient" @tap.stop="onShareGoods(item)">
|
:originPrice="item.marketPrice"
|
||||||
分享赚
|
priceColor="#333"
|
||||||
</button>
|
@tap="sheep.$router.go('/pages/goods/index', { id: item.id })"
|
||||||
</view>
|
>
|
||||||
</template>
|
<template #rightBottom>
|
||||||
</s-goods-item>
|
<view class="ss-flex ss-row-between">
|
||||||
</view>
|
<view class="commission-num" v-if="item.brokerageMinPrice === undefined">预计佣金:计算中</view>
|
||||||
<s-empty v-if="state.pagination.total === 0" icon="/static/goods-empty.png" text="暂无推广商品"></s-empty>
|
<view class="commission-num" v-else-if="item.brokerageMinPrice === item.brokerageMaxPrice">
|
||||||
<!-- 加载更多 -->
|
预计佣金:{{ fen2yuan(item.brokerageMinPrice) }}
|
||||||
<uni-load-more v-if="state.pagination.total > 0" :status="state.loadStatus" :content-text="{
|
</view>
|
||||||
|
<view class="commission-num" v-else>
|
||||||
|
预计佣金:{{ fen2yuan(item.brokerageMinPrice) }} ~ {{ fen2yuan(item.brokerageMaxPrice) }}
|
||||||
|
</view>
|
||||||
|
<button
|
||||||
|
class="ss-reset-button share-btn ui-BG-Main-Gradient"
|
||||||
|
@tap.stop="onShareGoods(item)"
|
||||||
|
>
|
||||||
|
分享赚
|
||||||
|
</button>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
</s-goods-item>
|
||||||
|
</view>
|
||||||
|
<s-empty
|
||||||
|
v-if="state.pagination.total === 0"
|
||||||
|
icon="/static/goods-empty.png"
|
||||||
|
text="暂无推广商品"
|
||||||
|
/>
|
||||||
|
<!-- 加载更多 -->
|
||||||
|
<uni-load-more
|
||||||
|
v-if="state.pagination.total > 0"
|
||||||
|
:status="state.loadStatus"
|
||||||
|
:content-text="{
|
||||||
contentdown: '上拉加载更多',
|
contentdown: '上拉加载更多',
|
||||||
}" @tap="loadmore" />
|
}"
|
||||||
</s-layout>
|
@tap="loadMore"
|
||||||
|
/>
|
||||||
|
</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 {
|
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
||||||
onLoad,
|
import { reactive } from 'vue';
|
||||||
onReachBottom
|
import _ from 'lodash';
|
||||||
} from '@dcloudio/uni-app';
|
import { showShareModal } from '@/sheep/hooks/useModal';
|
||||||
import {
|
import SpuApi from '@/sheep/api/product/spu';
|
||||||
computed,
|
import BrokerageApi from '@/sheep/api/trade/brokerage';
|
||||||
reactive
|
import { fen2yuan } from '../../sheep/hooks/useGoods';
|
||||||
} from 'vue';
|
|
||||||
import _ from 'lodash';
|
|
||||||
import {
|
|
||||||
showShareModal
|
|
||||||
} from '@/sheep/hooks/useModal';
|
|
||||||
|
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
pagination: {
|
pagination: {
|
||||||
data: [],
|
list: [],
|
||||||
current_page: 1,
|
total: 0,
|
||||||
total: 1,
|
pageNo: 1,
|
||||||
last_page: 1,
|
pageSize: 1,
|
||||||
},
|
},
|
||||||
loadStatus: '',
|
loadStatus: '',
|
||||||
shareInfo: {},
|
shareInfo: {},
|
||||||
});
|
});
|
||||||
|
|
||||||
function onShareGoods(goodsInfo) {
|
// TODO 芋艿:分享的接入
|
||||||
state.shareInfo = $share.getShareInfo({
|
function onShareGoods(goodsInfo) {
|
||||||
title: goodsInfo.title,
|
state.shareInfo = $share.getShareInfo(
|
||||||
image: sheep.$url.cdn(goodsInfo.image),
|
{
|
||||||
desc: goodsInfo.subtitle,
|
title: goodsInfo.title,
|
||||||
params: {
|
image: sheep.$url.cdn(goodsInfo.image),
|
||||||
page: '2',
|
desc: goodsInfo.subtitle,
|
||||||
query: goodsInfo.id,
|
params: {
|
||||||
},
|
page: '2',
|
||||||
}, {
|
query: goodsInfo.id,
|
||||||
type: 'goods', // 商品海报
|
},
|
||||||
title: goodsInfo.title, // 商品标题
|
},
|
||||||
image: sheep.$url.cdn(goodsInfo.image), // 商品主图
|
{
|
||||||
price: goodsInfo.price[0], // 商品价格
|
type: 'goods', // 商品海报
|
||||||
original_price: goodsInfo.original_price, // 商品原价
|
title: goodsInfo.title, // 商品标题
|
||||||
}, );
|
image: sheep.$url.cdn(goodsInfo.image), // 商品主图
|
||||||
showShareModal();
|
price: goodsInfo.price[0], // 商品价格
|
||||||
}
|
original_price: goodsInfo.original_price, // 商品原价
|
||||||
async function getGoodsList(page = 1, list_rows = 8) {
|
},
|
||||||
state.pagination.current_page = page;
|
);
|
||||||
state.loadStatus = 'loading';
|
showShareModal();
|
||||||
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';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onLoad(async () => {
|
async function getGoodsList() {
|
||||||
getGoodsList();
|
state.loadStatus = 'loading';
|
||||||
});
|
let { code, data } = await SpuApi.getSpuPage({
|
||||||
|
pageSize: state.pagination.pageSize,
|
||||||
|
pageNo: state.pagination.pageNo,
|
||||||
|
});
|
||||||
|
if (code !== 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
state.pagination.list = _.concat(state.pagination.list, data.list);
|
||||||
|
state.pagination.total = data.total;
|
||||||
|
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
||||||
|
// 补充分佣金额
|
||||||
|
data.list.forEach((item) => {
|
||||||
|
BrokerageApi.getProductBrokeragePrice(item.id).then((res) => {
|
||||||
|
item.brokerageMinPrice = res.data.brokerageMinPrice;
|
||||||
|
item.brokerageMaxPrice = res.data.brokerageMaxPrice;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// 加载更多
|
onLoad(() => {
|
||||||
function loadmore() {
|
getGoodsList();
|
||||||
if (state.loadStatus !== 'noMore') {
|
});
|
||||||
getGoodsList(state.pagination.current_page + 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 上拉加载更多
|
// 加载更多
|
||||||
onReachBottom(() => {
|
function loadMore() {
|
||||||
loadmore();
|
if (state.loadStatus === 'noMore') {
|
||||||
});
|
return;
|
||||||
|
}
|
||||||
|
state.pagination.pageNo++;
|
||||||
|
getGoodsList();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 上拉加载更多
|
||||||
|
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>
|
|
@ -1,417 +1,331 @@
|
||||||
<!-- 分销订单 -->
|
<!-- 分销 - 订单明细 -->
|
||||||
<template>
|
<template>
|
||||||
<s-layout title="分销订单" :class="state.scrollTop ? 'order-warp' : ''" navbar="inner">
|
<s-layout title="分销订单" :class="state.scrollTop ? 'order-warp' : ''" navbar="inner">
|
||||||
<view class="header-box" :style="[
|
<view
|
||||||
|
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" style="width:100%">
|
<!-- 团队数据总览 -->
|
||||||
<view class="data-card" style="width:100%">
|
<view class="team-data-box ss-flex ss-col-center ss-row-between" style="width: 100%">
|
||||||
<view class="total-item" style="width:100%">
|
<view class="data-card" style="width: 100%">
|
||||||
<view class="item-title" style='text-align: center;'>累计推广订单(单)</view>
|
<view class="total-item" style="width: 100%">
|
||||||
<view class="total-num" style='text-align: center;'>
|
<view class="item-title" style="text-align: center">累计推广订单(单)</view>
|
||||||
{{ state.totals||state.pagination.total|| 0 }}
|
<view class="total-num" style="text-align: center">
|
||||||
</view>
|
{{ state.totals }}
|
||||||
</view>
|
</view>
|
||||||
<!-- <view class="category-item ss-flex">
|
</view>
|
||||||
<view class="ss-flex-1">
|
</view>
|
||||||
<view class="item-title">一级订单</view>
|
</view>
|
||||||
<view class="category-num">
|
</view>
|
||||||
{{ state.agentInfo.child_order_count_1 || 0 }}
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="ss-flex-1">
|
|
||||||
<view class="item-title">二级订单</view>
|
|
||||||
<view class="category-num">
|
|
||||||
{{ state.agentInfo.child_order_count_2 || 0 }}
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view> -->
|
|
||||||
</view>
|
|
||||||
<!-- <view class="data-card">
|
|
||||||
<view class="total-item">
|
|
||||||
<view class="item-title">团队订单金额(元)</view>
|
|
||||||
<view class="total-num">
|
|
||||||
{{ state.agentInfo.child_order_money_all || '0.00' }}
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="category-item ss-flex">
|
|
||||||
<view class="ss-flex-1">
|
|
||||||
<view class="item-title">一级订单</view>
|
|
||||||
<view class="category-num">
|
|
||||||
{{ state.agentInfo.child_order_money_1 || '0.00' }}
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="ss-flex-1">
|
|
||||||
<view class="item-title">二级订单</view>
|
|
||||||
<view class="category-num">
|
|
||||||
{{ state.agentInfo.child_order_money_2 || '0.00' }}
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view> -->
|
|
||||||
</view>
|
|
||||||
<!-- 自购 -->
|
|
||||||
<!-- <view class="direct-box ss-flex ss-row-between">
|
|
||||||
<view class="direct-item">
|
|
||||||
<view class="item-title">自购分销订单数量(单)</view>
|
|
||||||
<view class="item-value">
|
|
||||||
{{ state.agentInfo.child_order_count_0 || 0 }}
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="direct-item">
|
|
||||||
<view class="item-title">自购分销订单金额(元)</view>
|
|
||||||
<view class="item-value">
|
|
||||||
{{ state.agentInfo.child_order_money_0 || '0.00' }}
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view> -->
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<!-- tab -->
|
<!-- tab -->
|
||||||
<su-sticky bgColor="#fff">
|
<su-sticky bgColor="#fff">
|
||||||
<su-tabs :list="tabMaps" :scrollable="false" :current="state.currentTab" @change="onTabsChange">
|
<su-tabs
|
||||||
</su-tabs>
|
:list="tabMaps"
|
||||||
</su-sticky>
|
:scrollable="false"
|
||||||
|
: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.list" :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.bizId }}</text>
|
||||||
<text class="order-state">{{ item.order_item.status_text }}</text>
|
<text class="order-state">
|
||||||
</view>
|
{{
|
||||||
<view class="order-from ss-flex ss-col-center ss-row-between">
|
item.status === 0 ? '待结算'
|
||||||
<view class="from-user ss-flex ss-col-center">
|
: item.status === 1 ? '已结算' : '已取消'
|
||||||
<text>下单人:</text>
|
}}
|
||||||
<image class="user-avatar" :src="sheep.$url.cdn(item.buyer.avatar)" mode="aspectFill">
|
( 佣金 {{ fen2yuan(item.price) }} 元 )
|
||||||
</image>
|
</text>
|
||||||
<text class="user-name">{{ item.buyer.nickname }}</text>
|
</view>
|
||||||
</view>
|
<view class="order-from ss-flex ss-col-center ss-row-between">
|
||||||
<view class="order-time">{{ item.create_time }}</view>
|
<view class="from-user ss-flex ss-col-center">
|
||||||
</view>
|
<text>{{ item.title }}</text>
|
||||||
</view>
|
</view>
|
||||||
<s-goods-item class="border-bottom" :img="item.order_item.goods_image"
|
<view class="order-time">
|
||||||
:title="item.order_item.goods_title" :skuText="item.order_item.goods_sku_text"
|
{{ sheep.$helper.timeFormat(item.createTime, 'yyyy-mm-dd hh:MM:ss') }}
|
||||||
:price="item.order_item.goods_price" :num="item.order_item.goods_num">
|
</view>
|
||||||
<template #rightBottom>
|
</view>
|
||||||
<view class="ss-flex commission-box ss-row-between ss-m-t-10">
|
</view>
|
||||||
<view class="ss-flex">
|
</view>
|
||||||
<text class="name">佣金:</text>
|
<!-- 数据为空 -->
|
||||||
<text class="commission-num">{{ item.rewards[0]?.commission }}</text>
|
<s-empty v-if="state.pagination.total === 0" icon="/static/order-empty.png" text="暂无订单" />
|
||||||
</view>
|
<!-- 加载更多 -->
|
||||||
<view class="order-status">
|
<uni-load-more
|
||||||
{{ item.commission_order_status_text }}
|
v-if="state.pagination.total > 0"
|
||||||
</view>
|
:status="state.loadStatus"
|
||||||
</view>
|
:content-text="{
|
||||||
</template>
|
|
||||||
</s-goods-item>
|
|
||||||
</view>
|
|
||||||
<!-- 数据为空 -->
|
|
||||||
<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" />
|
}"
|
||||||
</view>
|
@tap="loadMore"
|
||||||
<!-- </view> -->
|
/>
|
||||||
</s-layout>
|
</view>
|
||||||
|
</s-layout>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
import {
|
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
||||||
onLoad,
|
import { reactive } from 'vue';
|
||||||
onReachBottom
|
import _ from 'lodash';
|
||||||
} from '@dcloudio/uni-app';
|
import { onPageScroll } from '@dcloudio/uni-app';
|
||||||
import {
|
import { resetPagination } from '@/sheep/util';
|
||||||
computed,
|
import BrokerageApi from '@/sheep/api/trade/brokerage';
|
||||||
reactive,
|
import { fen2yuan } from '../../sheep/hooks/useGoods';
|
||||||
} 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) => {
|
|
||||||
if (e.scrollTop > 100) {
|
|
||||||
state.scrollTop = false;
|
|
||||||
} else {
|
|
||||||
state.scrollTop = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const state = reactive({
|
onPageScroll((e) => {
|
||||||
totals: 0,
|
state.scrollTop = e.scrollTop <= 100;
|
||||||
pagination: {
|
});
|
||||||
data: [],
|
|
||||||
current_page: 1,
|
|
||||||
total: '',
|
|
||||||
last_page: 1,
|
|
||||||
},
|
|
||||||
loadStatus: '',
|
|
||||||
currentTab: 0,
|
|
||||||
agentInfo: {},
|
|
||||||
scrollTop: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
const tabMaps = [{
|
const state = reactive({
|
||||||
name: '全部',
|
totals: 0, // 累计推广订单(单)
|
||||||
value: 'all',
|
scrollTop: false,
|
||||||
},
|
|
||||||
// {
|
|
||||||
// name: '不计入',
|
|
||||||
// value: 'no'
|
|
||||||
// },
|
|
||||||
{
|
|
||||||
name: '待结算',
|
|
||||||
value: 'yes',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '已结算',
|
|
||||||
value: 'back',
|
|
||||||
},
|
|
||||||
// {
|
|
||||||
// name: '已取消',
|
|
||||||
// value: 'cancel',
|
|
||||||
// },
|
|
||||||
];
|
|
||||||
// 切换选项卡
|
|
||||||
function onTabsChange(e) {
|
|
||||||
state.pagination = {
|
|
||||||
data: [],
|
|
||||||
current_page: 1,
|
|
||||||
total: 0,
|
|
||||||
last_page: 1,
|
|
||||||
};
|
|
||||||
state.currentTab = e.index;
|
|
||||||
getOrderList();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取订单列表
|
currentTab: 0,
|
||||||
async function getOrderList(page = 1, list_rows = 5) {
|
loadStatus: '',
|
||||||
// todo @芋艿:没有测试数据,还需对接请求参数,和返回的数据字段
|
pagination: {
|
||||||
state.loadStatus = 'loading';
|
list: [],
|
||||||
let res = await sheep.$api.commission.order({
|
total: 0,
|
||||||
// type: tabMaps[state.currentTab].value,
|
pageNo: 1,
|
||||||
pageSize: list_rows,
|
pageSize: 1,
|
||||||
pageNo: page,
|
},
|
||||||
// status
|
});
|
||||||
// bizType
|
|
||||||
});
|
|
||||||
if (res.code === 0) {
|
|
||||||
let orderList = _.concat(state.pagination.data, res.data.list);
|
|
||||||
state.pagination = {
|
|
||||||
...res.data,
|
|
||||||
data: orderList,
|
|
||||||
};
|
|
||||||
state.totals = res.data.total;
|
|
||||||
console.log(state)
|
|
||||||
if (state.pagination.data.length < state.totals) {
|
|
||||||
state.loadStatus = 'more';
|
|
||||||
} else {
|
|
||||||
state.loadStatus = 'noMore';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function getAgentInfo() {
|
const tabMaps = [
|
||||||
const {
|
{
|
||||||
error,
|
name: '全部',
|
||||||
data,
|
value: 'all',
|
||||||
msg
|
},
|
||||||
} = await sheep.$api.commission.agent();
|
{
|
||||||
if (error === 0) {
|
name: '待结算',
|
||||||
state.agentInfo = data;
|
value: '0', // 待结算
|
||||||
}
|
},
|
||||||
}
|
{
|
||||||
|
name: '已结算',
|
||||||
|
value: '1', // 已结算
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
onLoad(() => {
|
// 切换选项卡
|
||||||
// getAgentInfo();
|
function onTabsChange(e) {
|
||||||
getOrderList();
|
resetPagination(state.pagination);
|
||||||
});
|
state.currentTab = e.index;
|
||||||
|
getOrderList();
|
||||||
|
}
|
||||||
|
|
||||||
// 加载更多
|
// 获取订单列表
|
||||||
function loadmore() {
|
async function getOrderList() {
|
||||||
if (state.loadStatus !== 'noMore') {
|
state.loadStatus = 'loading';
|
||||||
getOrderList(state.pagination.current_page + 1);
|
let { code, data } = await BrokerageApi.getBrokerageRecordPage({
|
||||||
}
|
pageSize: state.pagination.pageSize,
|
||||||
}
|
pageNo: state.pagination.pageSize,
|
||||||
|
bizType: 1, // 获得推广佣金
|
||||||
|
status: state.currentTab > 0 ? state.currentTab : undefined,
|
||||||
|
});
|
||||||
|
if (code !== 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
state.pagination.list = _.concat(state.pagination.list, data.list);
|
||||||
|
state.pagination.total = data.total;
|
||||||
|
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
||||||
|
if (state.currentTab === 0) {
|
||||||
|
state.totals = data.total;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 上拉加载更多
|
onLoad(() => {
|
||||||
onReachBottom(() => {
|
getOrderList();
|
||||||
loadmore();
|
});
|
||||||
});
|
|
||||||
|
// 加载更多
|
||||||
|
function loadMore() {
|
||||||
|
if (state.loadStatus === 'noMore') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
state.pagination.pageNo++;
|
||||||
|
getOrderList();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 上拉加载更多
|
||||||
|
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;
|
||||||
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 {
|
.team-data-box {
|
||||||
.data-card {
|
.data-card {
|
||||||
width: 305rpx;
|
width: 305rpx;
|
||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
border-radius: 20rpx;
|
border-radius: 20rpx;
|
||||||
padding: 20rpx;
|
padding: 20rpx;
|
||||||
|
|
||||||
.total-item {
|
.total-item {
|
||||||
margin-bottom: 30rpx;
|
margin-bottom: 30rpx;
|
||||||
|
|
||||||
.item-title {
|
.item-title {
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: #999999;
|
color: #999999;
|
||||||
line-height: normal;
|
line-height: normal;
|
||||||
margin-bottom: 20rpx;
|
margin-bottom: 20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.total-num {
|
.total-num {
|
||||||
font-size: 38rpx;
|
font-size: 38rpx;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: #333333;
|
color: #333333;
|
||||||
font-family: OPPOSANS;
|
font-family: OPPOSANS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.category-num {
|
.category-num {
|
||||||
font-size: 26rpx;
|
font-size: 26rpx;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: #333333;
|
color: #333333;
|
||||||
font-family: OPPOSANS;
|
font-family: OPPOSANS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 直推
|
// 直推
|
||||||
.direct-box {
|
.direct-box {
|
||||||
margin-top: 20rpx;
|
margin-top: 20rpx;
|
||||||
|
|
||||||
.direct-item {
|
.direct-item {
|
||||||
width: 340rpx;
|
width: 340rpx;
|
||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
border-radius: 20rpx;
|
border-radius: 20rpx;
|
||||||
padding: 20rpx;
|
padding: 20rpx;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
|
||||||
.item-title {
|
.item-title {
|
||||||
font-size: 22rpx;
|
font-size: 22rpx;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: #999999;
|
color: #999999;
|
||||||
margin-bottom: 6rpx;
|
margin-bottom: 6rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-value {
|
.item-value {
|
||||||
font-size: 38rpx;
|
font-size: 38rpx;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: #333333;
|
color: #333333;
|
||||||
font-family: OPPOSANS;
|
font-family: OPPOSANS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 订单
|
// 订单
|
||||||
.order-box {
|
.order-box {
|
||||||
.order-item {
|
.order-item {
|
||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
border-radius: 10rpx;
|
border-radius: 10rpx;
|
||||||
margin: 20rpx;
|
margin: 20rpx;
|
||||||
|
|
||||||
.order-footer {
|
.order-footer {
|
||||||
padding: 20rpx;
|
padding: 20rpx;
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
color: #999;
|
color: #999;
|
||||||
}
|
}
|
||||||
|
|
||||||
.order-header {
|
.order-header {
|
||||||
.no-box {
|
.no-box {
|
||||||
padding: 20rpx;
|
padding: 20rpx;
|
||||||
|
|
||||||
.order-code {
|
.order-code {
|
||||||
font-size: 26rpx;
|
font-size: 26rpx;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: #333333;
|
color: #333333;
|
||||||
}
|
}
|
||||||
|
|
||||||
.order-state {
|
.order-state {
|
||||||
font-size: 26rpx;
|
font-size: 26rpx;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: var(--ui-BG-Main);
|
color: var(--ui-BG-Main);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.order-from {
|
.order-from {
|
||||||
padding: 20rpx;
|
padding: 20rpx;
|
||||||
|
|
||||||
.from-user {
|
.from-user {
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
color: #666666;
|
color: #666666;
|
||||||
|
|
||||||
.user-avatar {
|
.user-avatar {
|
||||||
width: 26rpx;
|
width: 26rpx;
|
||||||
height: 26rpx;
|
height: 26rpx;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
margin-right: 8rpx;
|
margin-right: 8rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-name {
|
.user-name {
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
color: #999999;
|
color: #999999;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.order-time {
|
.order-time {
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
color: #999999;
|
color: #999999;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.commission-box {
|
.commission-box {
|
||||||
.name {
|
.name {
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
color: #999999;
|
color: #999999;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.commission-num {
|
.commission-num {
|
||||||
font-size: 30rpx;
|
font-size: 30rpx;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: $red;
|
color: $red;
|
||||||
font-family: OPPOSANS;
|
font-family: OPPOSANS;
|
||||||
|
|
||||||
&::before {
|
&::before {
|
||||||
content: '¥';
|
content: '¥';
|
||||||
font-size: 22rpx;
|
font-size: 22rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.order-status {
|
.order-status {
|
||||||
line-height: 30rpx;
|
line-height: 30rpx;
|
||||||
padding: 0 10rpx;
|
padding: 0 10rpx;
|
||||||
border-radius: 30rpx;
|
border-radius: 30rpx;
|
||||||
margin-left: 20rpx;
|
margin-left: 20rpx;
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
color: var(--ui-BG-Main);
|
color: var(--ui-BG-Main);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
|
@ -4,33 +4,33 @@
|
||||||
<view class="redBg bg-color">
|
<view class="redBg bg-color">
|
||||||
<view class="header">
|
<view class="header">
|
||||||
<view class="nav acea-row row-center-wrapper" style='display:flex'>
|
<view class="nav acea-row row-center-wrapper" style='display:flex'>
|
||||||
<view class="item" :class="state.active === index ? 'font-color' : ''"
|
<view class="item" :class="state.currentTab === index ? 'font-color' : ''"
|
||||||
v-for="(item, index) in state.navList" :key="index" @click="switchTap(index)">
|
v-for="(item, index) in tabMaps" :key="index" @click="switchTap(index)">
|
||||||
{{ item }}
|
{{ item }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- top3 排名 -->
|
<!-- top3 排名 -->
|
||||||
<view class="rank acea-row row-bottom row-around">
|
<view class="rank acea-row row-bottom row-around">
|
||||||
<view class="item" v-show="state.Two.id">
|
<view class="item" v-show="state.two.id">
|
||||||
<view class="pictrue">
|
<view class="pictrue">
|
||||||
<image :src="state.Two.avatar"></image>
|
<image :src="state.two.avatar"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="name line1">{{state.Two.nickname}}</view>
|
<view class="name line1">{{state.two.nickname}}</view>
|
||||||
<view class="num">{{ state.Two.brokerageUserCount }}人</view>
|
<view class="num">{{ state.two.brokerageUserCount }}人</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item" v-show="state.One.id">
|
<view class="item" v-show="state.one.id">
|
||||||
<view class="pictrue">
|
<view class="pictrue">
|
||||||
<image :src="state.One.avatar"></image>
|
<image :src="state.one.avatar"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="name line1">{{state.One.nickname}}</view>
|
<view class="name line1">{{state.one.nickname}}</view>
|
||||||
<view class="num">{{ state.One.brokerageUserCount }}人</view>
|
<view class="num">{{ state.one.brokerageUserCount }}人</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item" v-show="state.Three.id">
|
<view class="item" v-show="state.three.id">
|
||||||
<view class="pictrue">
|
<view class="pictrue">
|
||||||
<image :src="state.Three.avatar"></image>
|
<image :src="state.three.avatar"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="name line1">{{state.Three.nickname}}</view>
|
<view class="name line1">{{state.three.nickname}}</view>
|
||||||
<view class="num">{{ state.Three.brokerageUserCount }}人</view>
|
<view class="num">{{ state.three.brokerageUserCount }}人</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -54,66 +54,57 @@
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
import $share from '@/sheep/platform/share';
|
import { onLoad } from '@dcloudio/uni-app';
|
||||||
import {
|
import { reactive } from 'vue';
|
||||||
onLoad,
|
import BrokerageApi from '@/sheep/api/trade/brokerage';
|
||||||
onReachBottom
|
|
||||||
} from '@dcloudio/uni-app';
|
const tabMaps = ['周排行', '月排行'];
|
||||||
import {
|
|
||||||
computed,
|
const state = reactive({
|
||||||
reactive
|
currentTab: 0,
|
||||||
} from 'vue';
|
|
||||||
import _ from 'lodash';
|
|
||||||
|
|
||||||
const state = reactive({
|
|
||||||
navList: ["周榜", "月榜"],
|
|
||||||
active: 0,
|
|
||||||
page: 1,
|
|
||||||
limit: 10,
|
|
||||||
type: 'week',
|
|
||||||
loading: false,
|
|
||||||
loadend: false,
|
|
||||||
rankList: [],
|
rankList: [],
|
||||||
times: [],
|
times: [],
|
||||||
One: {}, // 排名第一
|
|
||||||
Two: {}, // 排名第二
|
one: {}, // 排名第一
|
||||||
Three: {}, // 排名第三
|
two: {}, // 排名第二
|
||||||
|
three: {}, // 排名第三
|
||||||
});
|
});
|
||||||
|
|
||||||
function switchTap(index) {
|
function switchTap(index) {
|
||||||
if (state.active === index) {
|
if (state.currentTab === index) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
state.active = index;
|
state.currentTab = index;
|
||||||
// week
|
|
||||||
state.type = index ? 'month' : 'week';
|
|
||||||
// this.page = 1;
|
|
||||||
// this.loadend = false;
|
|
||||||
// this.$set(this, 'rankList', []);
|
|
||||||
// this.Two = {};
|
|
||||||
// this.One = {};
|
|
||||||
// this.Three = {};
|
|
||||||
calculateTimes();
|
calculateTimes();
|
||||||
getRanklist();
|
getRankList();
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function getRanklist() {
|
|
||||||
// todo @芋艿:编码传参
|
|
||||||
sheep.$api.commission.getBrokerageRankNumber({
|
|
||||||
pageNo: state.page,
|
|
||||||
pageSize: state.limit,
|
|
||||||
'times[0]': state.times[0],
|
|
||||||
'times[1]': state.times[1],
|
|
||||||
}).then(res => {
|
|
||||||
console.log(res)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function getRankList() {
|
||||||
|
// 重置数据
|
||||||
|
state.one = {};
|
||||||
|
state.two = {};
|
||||||
|
state.three = {};
|
||||||
|
state.rankList = [];
|
||||||
|
// 查询
|
||||||
|
const { code, data } = await BrokerageApi.getBrokerageUserRankPageByUserCount({
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
'times[0]': state.times[0],
|
||||||
|
'times[1]': state.times[1],
|
||||||
|
});
|
||||||
|
if (code !== 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
state.rankList = data.list;
|
||||||
|
state.one = state.rankList.shift() || {};
|
||||||
|
state.two = state.rankList.shift() || {};
|
||||||
|
state.trhee = state.rankList.shift() || {};
|
||||||
|
}
|
||||||
|
|
||||||
function calculateTimes() {
|
function calculateTimes() {
|
||||||
let times;
|
let times;
|
||||||
if (state.type === 'week') {
|
if (state.currentTab === 0) {
|
||||||
times = getWeekTimes();
|
times = getWeekTimes();
|
||||||
} else {
|
} else {
|
||||||
times = getMonthTimes();
|
times = getMonthTimes();
|
||||||
|
@ -121,10 +112,17 @@
|
||||||
state.times = [formatDate(times[0]), formatDate(times[1])]
|
state.times = [formatDate(times[0]), formatDate(times[1])]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onLoad(function () {
|
||||||
|
calculateTimes();
|
||||||
|
getRankList();
|
||||||
|
});
|
||||||
|
|
||||||
function formatDate(date) {
|
function formatDate(date) {
|
||||||
return sheep.$helper.timeFormat(date, 'yyyy-mm-dd hh:MM:ss');
|
return sheep.$helper.timeFormat(date, 'yyyy-mm-dd hh:MM:ss');
|
||||||
}
|
}
|
||||||
// 此处可考虑抽离
|
|
||||||
|
// TODO 芋艿:此处可考虑抽离
|
||||||
|
// 此处可考虑抽离
|
||||||
/**
|
/**
|
||||||
* 获得当前周的开始和结束时间
|
* 获得当前周的开始和结束时间
|
||||||
*/
|
*/
|
||||||
|
@ -149,6 +147,7 @@
|
||||||
const endDate = new Date(nextMonth.getTime() - 1);
|
const endDate = new Date(nextMonth.getTime() - 1);
|
||||||
return [startDate, endDate]
|
return [startDate, endDate]
|
||||||
}
|
}
|
||||||
|
// TODO 芋艿:css 需要优化下;并且展示样式有问题
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang='scss' scoped>
|
<style lang='scss' scoped>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<!-- 页面 -->
|
<!-- 页面 TODO 芋艿:检查未开发 -->
|
||||||
<template>
|
<template>
|
||||||
<s-layout title="我的团队" :class="state.scrollTop ? 'team-wrap' : ''" navbar="inner">
|
<s-layout title="我的团队" :class="state.scrollTop ? 'team-wrap' : ''" navbar="inner">
|
||||||
<view class="header-box" :style="[
|
<view class="header-box" :style="[
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
<!-- 分销 - 佣金明细 -->
|
||||||
<template>
|
<template>
|
||||||
<s-layout class="wallet-wrap" title="佣金">
|
<s-layout class="wallet-wrap" title="佣金">
|
||||||
<!-- 钱包卡片 -->
|
<!-- 钱包卡片 -->
|
||||||
|
@ -6,10 +7,10 @@
|
||||||
<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 @tap="state.showMoney = !state.showMoney" class="ss-eye-icon"
|
<view @tap="state.showMoney = !state.showMoney" class="ss-eye-icon"
|
||||||
:class="state.showMoney ? 'cicon-eye' : 'cicon-eye-off'"></view>
|
:class="state.showMoney ? 'cicon-eye' : 'cicon-eye-off'" />
|
||||||
</view>
|
</view>
|
||||||
<view class="ss-flex ss-row-between ss-col-center ss-m-t-30">
|
<view class="ss-flex ss-row-between ss-col-center ss-m-t-30">
|
||||||
<view class="money-num">{{ state.showMoney ? state.userInfo.withdrawPrice : '*****' }}</view>
|
<view class="money-num">{{ state.showMoney ? fen2yuan(state.summary.withdrawPrice || 0) : '*****' }}</view>
|
||||||
<view class="ss-flex">
|
<view class="ss-flex">
|
||||||
<view class="ss-m-r-20">
|
<view class="ss-m-r-20">
|
||||||
<button class="ss-reset-button withdraw-btn" @tap="sheep.$router.go('/pages/pay/withdraw')">
|
<button class="ss-reset-button withdraw-btn" @tap="sheep.$router.go('/pages/pay/withdraw')">
|
||||||
|
@ -25,62 +26,65 @@
|
||||||
<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 ? state.userInfo.frozenPrice || '0.00' : '*****'
|
{{ state.showMoney ? fen2yuan(state.summary.frozenPrice || 0) : '*****' }}
|
||||||
}}</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 ? state.userInfo.brokeragePrice || '0.00' : '*****'
|
{{ state.showMoney ? fen2yuan(state.summary.brokeragePrice || 0) : '*****' }}
|
||||||
}}</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 v-model="state.data" type="daterange" @change="onChangeTime" :end="state.today">
|
<uni-datetime-picker v-model="state.date" type="daterange" @change="onChangeTime" :end="state.today">
|
||||||
<button class="ss-reset-button date-btn">
|
<button class="ss-reset-button date-btn">
|
||||||
<text>{{ dateFilterText }}</text>
|
<text>{{ dateFilterText }}</text>
|
||||||
<text class="cicon-drop-down ss-seldate-icon"></text>
|
<text class="cicon-drop-down ss-seldate-icon" />
|
||||||
</button>
|
</button>
|
||||||
</uni-datetime-picker>
|
</uni-datetime-picker>
|
||||||
|
|
||||||
<view class="total-box">
|
<view class="total-box">
|
||||||
|
<!-- TODO 芋艿:这里暂时不考虑做 -->
|
||||||
<!-- <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 :list="tabMaps" @change="onChangeTab" :scrollable="false" :current="state.currentTab"></su-tabs>
|
<su-tabs :list="tabMaps" @change="onChangeTab" :scrollable="false" :current="state.currentTab" />
|
||||||
</su-sticky>
|
</su-sticky>
|
||||||
<s-empty v-if="state.pagination.total === 0" icon="/static/data-empty.png" text="暂无数据"></s-empty>
|
<s-empty v-if="state.pagination.total === 0" icon="/static/data-empty.png" text="暂无数据"></s-empty>
|
||||||
<!-- 转余额弹框 -->
|
|
||||||
|
<!-- 转余额弹框 -->
|
||||||
<su-popup :show="state.showModal" type="bottom" round="20" @close="state.showModal = false" showClose>
|
<su-popup :show="state.showModal" type="bottom" round="20" @close="state.showModal = false" showClose>
|
||||||
<view class="ss-p-x-20 ss-p-y-30">
|
<view class="ss-p-x-20 ss-p-y-30">
|
||||||
<view class="model-title ss-m-b-30 ss-m-l-20">转余额</view>
|
<view class="model-title ss-m-b-30 ss-m-l-20">转余额</view>
|
||||||
<view class="model-subtitle ss-m-b-100 ss-m-l-20">将您的佣金转到余额中继续消费</view>
|
<view class="model-subtitle ss-m-b-100 ss-m-l-20">将您的佣金转到余额中继续消费</view>
|
||||||
<view class="input-box ss-flex ss-col-center border-bottom ss-m-b-70 ss-m-x-20">
|
<view class="input-box ss-flex ss-col-center border-bottom ss-m-b-70 ss-m-x-20">
|
||||||
<view class="unit">¥</view>
|
<view class="unit">¥</view>
|
||||||
<uni-easyinput :inputBorder="false" class="ss-flex-1 ss-p-l-10" v-model="state.amount" type="number"
|
<uni-easyinput :inputBorder="false" class="ss-flex-1 ss-p-l-10" v-model="state.price" type="number"
|
||||||
placeholder="请输入金额" />
|
placeholder="请输入金额" />
|
||||||
</view>
|
</view>
|
||||||
<button class="ss-reset-button model-btn ui-BG-Main-Gradient ui-Shadow-Main" @tap="onConfirm">
|
<button class="ss-reset-button model-btn ui-BG-Main-Gradient ui-Shadow-Main" @tap="onConfirm">
|
||||||
确定
|
确定
|
||||||
</button>
|
</button>
|
||||||
</view>
|
</view>
|
||||||
</su-popup>
|
</su-popup>
|
||||||
|
|
||||||
<!-- 钱包记录 -->
|
<!-- 钱包记录 -->
|
||||||
<view v-if="state.pagination.total > 0">
|
<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="wallet-list ss-flex border-bottom" v-for="item in state.pagination.list" :key="item.id">
|
||||||
<view class="list-content">
|
<view class="list-content">
|
||||||
<view class="title-box ss-flex ss-row-between ss-m-b-20">
|
<view class="title-box ss-flex ss-row-between ss-m-b-20">
|
||||||
<!-- {{ item.memo ? '-' + item.memo : '' }} -->
|
|
||||||
<text class="title ss-line-1">{{ item.title }}</text>
|
<text class="title ss-line-1">{{ item.title }}</text>
|
||||||
<view class="money">
|
<view class="money">
|
||||||
<text v-if="item.amount >= 0" class="add">+{{ item.price }}</text>
|
<text v-if="item.price >= 0" class="add">+{{ fen2yuan(item.price) }}</text>
|
||||||
<text v-else class="minus">{{ item.price }}</text>
|
<text v-else class="minus">{{ fen2yuan(item.price) }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<text class="time">{{ sheep.$helper.timeFormat(item.createTime, 'yyyy-mm-dd hh:MM:ss') }}</text>
|
<text class="time">{{ sheep.$helper.timeFormat(item.createTime, 'yyyy-mm-dd hh:MM:ss') }}</text>
|
||||||
|
@ -96,56 +100,45 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import {
|
import { computed, reactive } from 'vue';
|
||||||
computed,
|
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
||||||
reactive
|
|
||||||
} from 'vue';
|
|
||||||
import {
|
|
||||||
onLoad,
|
|
||||||
onReachBottom
|
|
||||||
} from '@dcloudio/uni-app';
|
|
||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
import BrokerageApi from '@/sheep/api/trade/brokerage';
|
||||||
|
import { fen2yuan } from '@/sheep/hooks/useGoods';
|
||||||
|
import { resetPagination } from '@/sheep/util';
|
||||||
|
|
||||||
const headerBg = sheep.$url.css('/static/img/shop/user/wallet_card_bg.png');
|
const headerBg = sheep.$url.css('/static/img/shop/user/wallet_card_bg.png');
|
||||||
|
|
||||||
// 数据
|
|
||||||
const pagination = {
|
|
||||||
data: [],
|
|
||||||
current_page: 1,
|
|
||||||
total: 1,
|
|
||||||
last_page: 1,
|
|
||||||
expense: 0,
|
|
||||||
income: 0,
|
|
||||||
};
|
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
userInfo: {},
|
showMoney: false,
|
||||||
showMoney: false,
|
summary: {}, // 分销信息
|
||||||
date: [],
|
|
||||||
|
today: '',
|
||||||
|
date: [],
|
||||||
currentTab: 0,
|
currentTab: 0,
|
||||||
pagination,
|
pagination: {
|
||||||
|
list: [],
|
||||||
|
total: 0,
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 1,
|
||||||
|
},
|
||||||
loadStatus: '',
|
loadStatus: '',
|
||||||
|
|
||||||
|
price: undefined,
|
||||||
showModal: false,
|
showModal: false,
|
||||||
today: '',
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const tabMaps = [{
|
const tabMaps = [{
|
||||||
name: '分佣',
|
name: '分佣',
|
||||||
value: 'all',
|
value: '1', // BrokerageRecordBizTypeEnum.ORDER
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '提现',
|
name: '提现',
|
||||||
value: 'income',
|
value: '2', // BrokerageRecordBizTypeEnum.WITHDRAW
|
||||||
}
|
}
|
||||||
// {
|
|
||||||
// name: '支出',
|
|
||||||
// value: 'expense',
|
|
||||||
// },
|
|
||||||
];
|
];
|
||||||
const userInfo = computed(() => sheep.$store('user').userInfo);
|
|
||||||
|
|
||||||
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]) {
|
||||||
|
@ -155,36 +148,25 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
async function getLogList(page = 1, list_rows = 4) {
|
async function getLogList() {
|
||||||
state.loadStatus = 'loading';
|
state.loadStatus = 'loading';
|
||||||
let ress = await sheep.$api.commission.getSummary();
|
let { code, data } = await BrokerageApi.getBrokerageRecordPage({
|
||||||
state.userInfo = ress.data;
|
pageSize: state.pagination.pageSize,
|
||||||
let res = await sheep.$api.user.wallet.log3({
|
pageNo: state.pagination.pageNo,
|
||||||
// type: 'commission',
|
bizType: tabMaps[state.currentTab].value,
|
||||||
// tab: tabMaps[state.currentTab].value,
|
'createTime[0]': state.date[0] + ' 00:00:00',
|
||||||
pageSize: list_rows,
|
'createTime[1]': state.date[1] + ' 23:59:59',
|
||||||
pageNo: page,
|
|
||||||
// date: appendTimeHMS(state.date),
|
|
||||||
});
|
});
|
||||||
if (res.code === 0) {
|
if (code !== 0) {
|
||||||
let list = _.concat(state.pagination.data, res.data.list);
|
return;
|
||||||
state.pagination = {
|
|
||||||
current_page: page,
|
|
||||||
...res.data,
|
|
||||||
data: list,
|
|
||||||
// income: res.data.income,
|
|
||||||
// expense: res.data.expense,
|
|
||||||
};
|
|
||||||
if (state.pagination.data.length < state.pagination.total) {
|
|
||||||
state.loadStatus = 'more';
|
|
||||||
} else {
|
|
||||||
state.loadStatus = 'noMore';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
state.pagination.list = _.concat(state.pagination.list, data.list);
|
||||||
|
state.pagination.total = data.total;
|
||||||
|
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
||||||
}
|
}
|
||||||
|
|
||||||
function onChangeTab(e) {
|
function onChangeTab(e) {
|
||||||
state.pagination = pagination;
|
resetPagination(state.pagination);
|
||||||
state.currentTab = e.index;
|
state.currentTab = e.index;
|
||||||
getLogList();
|
getLogList();
|
||||||
}
|
}
|
||||||
|
@ -192,17 +174,13 @@
|
||||||
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;
|
resetPagination(state.pagination);
|
||||||
getLogList();
|
getLogList();
|
||||||
}
|
}
|
||||||
|
|
||||||
function appendTimeHMS(arr) {
|
// 确认操作(转账到余额)
|
||||||
return [arr[0] + ' 00:00:00', arr[1] + ' 23:59:59'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// 确认操作
|
|
||||||
async function onConfirm() {
|
async function onConfirm() {
|
||||||
if (state.amount <= 0) {
|
if (state.price <= 0) {
|
||||||
sheep.$helper.toast('请输入正确的金额');
|
sheep.$helper.toast('请输入正确的金额');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -210,30 +188,33 @@
|
||||||
title: '提示',
|
title: '提示',
|
||||||
content: '确认把您的佣金转入到余额钱包中?',
|
content: '确认把您的佣金转入到余额钱包中?',
|
||||||
success: async function(res) {
|
success: async function(res) {
|
||||||
if (res.confirm) {
|
if (!res.confirm) {
|
||||||
const {
|
return;
|
||||||
error
|
|
||||||
} = await sheep.$api.commission.transfer({
|
|
||||||
amount: state.amount,
|
|
||||||
});
|
|
||||||
if (error === 0) {
|
|
||||||
state.showModal = false;
|
|
||||||
sheep.$store('user').getInfo();
|
|
||||||
onChangeTab({
|
|
||||||
index: 0
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
const { code } = await BrokerageApi.createBrokerageWithdraw({
|
||||||
|
type: 1, // 钱包
|
||||||
|
price: state.price * 100,
|
||||||
|
});
|
||||||
|
if (code === 0) {
|
||||||
|
state.showModal = false;
|
||||||
|
await getAgentInfo();
|
||||||
|
onChangeTab({
|
||||||
|
index: 1
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getAgentInfo() {
|
async function getAgentInfo() {
|
||||||
const {
|
const { code, data } = await BrokerageApi.getBrokerageUserSummary();
|
||||||
code,
|
if (code !== 0) {
|
||||||
data
|
return;
|
||||||
} = await sheep.$store('user').getAgentInfo();
|
}
|
||||||
|
state.summary = data;
|
||||||
}
|
}
|
||||||
onLoad(async (options) => {
|
|
||||||
|
onLoad(async () => {
|
||||||
state.today = dayjs().format('YYYY-MM-DD');
|
state.today = dayjs().format('YYYY-MM-DD');
|
||||||
state.date = [state.today, state.today];
|
state.date = [state.today, state.today];
|
||||||
getLogList();
|
getLogList();
|
||||||
|
@ -241,9 +222,11 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
onReachBottom(() => {
|
onReachBottom(() => {
|
||||||
if (state.loadStatus !== 'noMore') {
|
if (state.loadStatus === 'noMore') {
|
||||||
getLogList(state.pagination.current_page + 1);
|
return;
|
||||||
}
|
}
|
||||||
|
state.pagination.pageNo++;
|
||||||
|
getLogList();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,47 +1,6 @@
|
||||||
import request from '@/sheep/request';
|
import request from '@/sheep/request';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
// 分销商详情
|
|
||||||
agent: () =>
|
|
||||||
request({
|
|
||||||
url: 'commission/agent',
|
|
||||||
method: 'GET',
|
|
||||||
custom: {
|
|
||||||
showLoading: false,
|
|
||||||
showError: false,
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
// 分销表单
|
|
||||||
form: () =>
|
|
||||||
request({
|
|
||||||
url: 'commission/agent/form',
|
|
||||||
method: 'GET',
|
|
||||||
}),
|
|
||||||
// 申请分销商
|
|
||||||
apply: (data) =>
|
|
||||||
request({
|
|
||||||
url: 'commission/agent/apply',
|
|
||||||
method: 'POST',
|
|
||||||
data,
|
|
||||||
custom: {
|
|
||||||
showSuccess: true,
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
// 分销动态
|
|
||||||
log: (params) =>
|
|
||||||
request({
|
|
||||||
url: 'commission/log',
|
|
||||||
method: 'GET',
|
|
||||||
params,
|
|
||||||
}),
|
|
||||||
|
|
||||||
// 分销商品
|
|
||||||
goods: (params) =>
|
|
||||||
request({
|
|
||||||
url: '/app-api/product/spu/page',
|
|
||||||
method: 'GET',
|
|
||||||
params,
|
|
||||||
}),
|
|
||||||
// 我的团队
|
// 我的团队
|
||||||
team: (params) =>
|
team: (params) =>
|
||||||
request({
|
request({
|
||||||
|
@ -49,34 +8,9 @@ export default {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
params,
|
params,
|
||||||
}),
|
}),
|
||||||
// 佣金转余额
|
|
||||||
transfer: (data) =>
|
|
||||||
request({
|
|
||||||
url: 'commission/agent/transfer',
|
|
||||||
method: 'POST',
|
|
||||||
data,
|
|
||||||
}),
|
|
||||||
getSummary: (data) =>
|
getSummary: (data) =>
|
||||||
request({
|
request({
|
||||||
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
|
|
||||||
}),
|
|
||||||
};
|
};
|
|
@ -15,14 +15,65 @@ const BrokerageApi = {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 分销订单
|
// 获得分销记录分页
|
||||||
getBrokerageRecordPage: (params) => {
|
getBrokerageRecordPage: (params) => {
|
||||||
|
if (params.status === undefined) {
|
||||||
|
delete params.status
|
||||||
|
}
|
||||||
|
const queryString = Object.keys(params)
|
||||||
|
.map((key) => encodeURIComponent(key) + '=' + params[key])
|
||||||
|
.join('&');
|
||||||
return request({
|
return request({
|
||||||
url: '/app-api/trade/brokerage-record/page',
|
url: `/app-api/trade/brokerage-record/page?${queryString}`,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
params,
|
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
|
// 创建分销提现
|
||||||
|
createBrokerageWithdraw: (data) => {
|
||||||
|
return request({
|
||||||
|
url: '/app-api/trade/brokerage-withdraw/create',
|
||||||
|
method: 'POST',
|
||||||
|
data,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 获得商品的分销金额
|
||||||
|
getProductBrokeragePrice: (spuId) => {
|
||||||
|
return request({
|
||||||
|
url: '/app-api/trade/brokerage-record/get-product-brokerage-price',
|
||||||
|
method: 'GET',
|
||||||
|
params: {
|
||||||
|
spuId
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 获得分销用户排行(基于佣金)
|
||||||
|
getRankByPrice: (params) => {
|
||||||
|
const queryString = `times=${params.times[0]}×=${params.times[1]}`;
|
||||||
|
return request({
|
||||||
|
url: `/app-api/trade/brokerage-user/get-rank-by-price?${queryString}`,
|
||||||
|
method: 'GET',
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 获得分销用户排行分页(基于佣金)
|
||||||
|
getBrokerageUserChildSummaryPageByPrice: (params) => {
|
||||||
|
const queryString = Object.keys(params)
|
||||||
|
.map((key) => encodeURIComponent(key) + '=' + params[key])
|
||||||
|
.join('&');
|
||||||
|
return request({
|
||||||
|
url: `/app-api/trade/brokerage-user/rank-page-by-price?${queryString}`,
|
||||||
|
method: 'GET',
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 获得分销用户排行分页(基于用户量)
|
||||||
|
getBrokerageUserRankPageByUserCount: (params) => {
|
||||||
|
const queryString = Object.keys(params)
|
||||||
|
.map((key) => encodeURIComponent(key) + '=' + params[key])
|
||||||
|
.join('&');
|
||||||
|
return request({
|
||||||
|
url: `/app-api/trade/brokerage-user/rank-page-by-user-count?${queryString}`,
|
||||||
|
method: 'GET',
|
||||||
|
});
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
export default BrokerageApi
|
export default BrokerageApi
|
||||||
|
|
|
@ -264,13 +264,6 @@ 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) =>
|
||||||
|
|
|
@ -12,6 +12,7 @@ const platformMap = ['H5', 'WechatOfficialAccount', 'WechatMiniProgram', 'App'];
|
||||||
// 设置分享方式: 1=直接转发,2=海报,3=复制链接,...按需扩展
|
// 设置分享方式: 1=直接转发,2=海报,3=复制链接,...按需扩展
|
||||||
const fromMap = ['forward', 'poster', 'link'];
|
const fromMap = ['forward', 'poster', 'link'];
|
||||||
|
|
||||||
|
// TODO 芋艿:分享的接入
|
||||||
// 设置分享信息参数
|
// 设置分享信息参数
|
||||||
const getShareInfo = (
|
const getShareInfo = (
|
||||||
scene = {
|
scene = {
|
||||||
|
|
|
@ -23,7 +23,6 @@ const defaultUserInfo = {
|
||||||
gender: 0, // 性别
|
gender: 0, // 性别
|
||||||
mobile: '', // 手机号
|
mobile: '', // 手机号
|
||||||
money: '--', // 余额
|
money: '--', // 余额
|
||||||
commission: '--', // 佣金 TODO 芋艿:干掉
|
|
||||||
score: '--', // 积分
|
score: '--', // 积分
|
||||||
verification: {}, // 认证字段
|
verification: {}, // 认证字段
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue