init
This commit is contained in:
@@ -0,0 +1,332 @@
|
||||
<template>
|
||||
<s-pages title="收银台" :goLeft="false" @onClickLeft="onClickLeft">
|
||||
<view class="p-x-32">
|
||||
<view class="center p-t-96 weight500 size100"><span class="size48">¥</span>
|
||||
{{ fen2yuan(state.orderInfo.payPrice) }}
|
||||
</view>
|
||||
<view class="center m-t-20 m-b-66">{{ payDescText }}</view>
|
||||
<view>
|
||||
<radio-group @change="onTapPay">
|
||||
<label class="" v-for="item in state.payMethods" :key="item.title">
|
||||
<view class="flex-center ju-between m-b-40" :class="{ 'disabled-pay-item': item.disabled }">
|
||||
<view class="flex-center">
|
||||
<image class="h_64 w_64" v-if="item.disabled"
|
||||
:src="sheep.$url.static('/static/img/shop/pay/cod_disabled.png')"
|
||||
mode="aspectFit" />
|
||||
<image class="h_64 w_64" v-else :src="sheep.$url.static(item.icon)" mode="aspectFit" />
|
||||
<text class="pay-title m-l-12">{{ item.title }}</text>
|
||||
</view>
|
||||
<view class="check-box ss-flex ss-col-center ss-p-l-10">
|
||||
<view class="userInfo-money ss-m-r-10" v-if="item.value === 'wallet'">
|
||||
余额: {{ fen2yuan(totalRecharge) }}元
|
||||
</view>
|
||||
<view class="">
|
||||
<radio :value="item.value" color="var(--ui-BG-Main)"
|
||||
backgroundColor="rgba(255, 255, 255, 0)" :disabled="item.disabled"
|
||||
:checked="state.payment === item.value" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</label>
|
||||
</radio-group>
|
||||
</view>
|
||||
|
||||
<!-- 工具 -->
|
||||
<view class="modal-footer ss-flex ss-row-center ss-col-center ss-m-t-80 ss-m-b-40">
|
||||
<button v-if="state.payStatus === 0" class="ss-reset-button past-due-btn">
|
||||
检测支付环境中
|
||||
</button>
|
||||
<button v-else-if="state.payStatus === -1" class="ss-reset-button past-due-btn" disabled>
|
||||
支付已过期
|
||||
</button>
|
||||
<button v-else class="ai-button2" @tap="onPay" :disabled="state.payStatus !== 1"
|
||||
:class="{ 'disabled-btn': state.payStatus !== 1 }">
|
||||
立即支付
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</s-pages>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
ref,
|
||||
reactive,
|
||||
onMounted,
|
||||
onUnmounted,
|
||||
getCurrentInstance,
|
||||
watch,
|
||||
nextTick,
|
||||
computed,
|
||||
} from 'vue';
|
||||
let { proxy } = getCurrentInstance();
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import * as api from '@/sheep/api/ai/index';
|
||||
import sheep from '@/sheep';
|
||||
import PayChannelApi from '@/sheep/api/pay/channel';
|
||||
import { fen2yuan, useDurationTime } from '@/sheep/hooks/useGoods';
|
||||
import { getPayMethods, goPayResult } from '@/sheep/platform/pay';
|
||||
import { SYSCONST } from '@/sheep/helper/const';
|
||||
import { getWallet } from '@/sheep/api/home/pay';
|
||||
let id = ref('');
|
||||
let payOrderId = ref('');
|
||||
let orderInfo = ref({});
|
||||
const userWallet = ref();
|
||||
|
||||
let totalRecharge = ref();
|
||||
// 检测支付环境
|
||||
const state = reactive({
|
||||
orderType: 'aiGoods', // 订单类型; goods - 商品订单, recharge - 充值订单 aiRecharge
|
||||
orderInfo: {}, // 支付单信息
|
||||
payStatus: 0, // 0=检测支付环境, -2=未查询到支付单信息, -1=支付已过期, 1=待支付,2=订单已支付
|
||||
payMethods: [], // 可选的支付方式
|
||||
payment: '', // 选中的支付方式
|
||||
});
|
||||
const getOrderDetail = async () => {
|
||||
let { code, data } = await api.getOrderDetail({ id: id.value });
|
||||
console.log('订单详情', code, data);
|
||||
if (code !== 0 || !data) {
|
||||
state.payStatus = -2;
|
||||
return;
|
||||
}
|
||||
state.orderInfo = data || {};
|
||||
// 设置支付状态
|
||||
checkPayStatus();
|
||||
// 获得支付方式
|
||||
await setPayMethods();
|
||||
};
|
||||
|
||||
// 获得支付方式
|
||||
async function setPayMethods() {
|
||||
const { data, code } = await PayChannelApi.getEnableChannelCodeList(state.orderInfo.appId || 1);
|
||||
// console.log('支付方式', code, data);
|
||||
if (code !== 0) {
|
||||
return;
|
||||
}
|
||||
state.payMethods = getPayMethods(data);
|
||||
console.log('支付方式', state.payMethods);
|
||||
// 金额超出阈值,仅允许余额支付
|
||||
if (state.orderInfo?.totalPrice >= SYSCONST.MAX_PRICE) {
|
||||
state.payMethods = state.payMethods.map((item) => ({
|
||||
...item,
|
||||
disabled: item.value !== 'wallet' ? true : item.disabled,
|
||||
}));
|
||||
state.payment = 'wallet';
|
||||
}
|
||||
state.payMethods.find((item) => {
|
||||
if (item.value && !item.disabled) {
|
||||
state.payment = item.value;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
// 支付文案提示
|
||||
const payDescText = computed(() => {
|
||||
if (state.payStatus === 2) {
|
||||
return '该订单已支付';
|
||||
}
|
||||
if (state.payStatus === 1 && state.orderInfo?.payExpireTime) {
|
||||
const time = useDurationTime(state.orderInfo.payExpireTime);
|
||||
if (time?.ms <= 0) {
|
||||
state.payStatus = -1;
|
||||
return '';
|
||||
}
|
||||
return `剩余支付时间 ${time?.h}:${time?.m}:${time?.s} `;
|
||||
}
|
||||
if (state.payStatus === -2) {
|
||||
return '未查询到支付单信息';
|
||||
}
|
||||
return '';
|
||||
});
|
||||
|
||||
// 状态转换:payOrder.status => payStatus
|
||||
function checkPayStatus() {
|
||||
if (state.orderInfo.status === 10 || state.orderInfo.status === 20) {
|
||||
// 支付成功
|
||||
state.payStatus = 2;
|
||||
// 跳转回支付成功页
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '订单已支付',
|
||||
confirmColor: '#FA7E31',
|
||||
showCancel: false,
|
||||
success: function () {
|
||||
goPayResult(state.orderInfo.id, state.orderType);
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (state.orderInfo.status === 30) {
|
||||
// 支付关闭
|
||||
state.payStatus = -1;
|
||||
return;
|
||||
}
|
||||
state.payStatus = 1; // 待支付
|
||||
}
|
||||
|
||||
// 切换支付方式
|
||||
function onTapPay(e) {
|
||||
state.payment = e.detail.value;
|
||||
}
|
||||
let type = ref(); //2充值
|
||||
onLoad(async (options) => {
|
||||
id.value = options.id || '';
|
||||
payOrderId.value = options.payOrderId || '';
|
||||
type.value = options.type || '';
|
||||
|
||||
if (type.value == 2) {
|
||||
state.orderType = 'aiRecharge';
|
||||
state.orderInfo.totalPrice = options.price * 100;
|
||||
// state.orderInfo.price = options.price || '';
|
||||
|
||||
// 设置支付状态
|
||||
checkPayStatus();
|
||||
// 获得支付方式
|
||||
await setPayMethods();
|
||||
} else {
|
||||
getOrderDetail();
|
||||
}
|
||||
});
|
||||
onShow(() => {
|
||||
getWallet().then((res) => {
|
||||
if (res.code === 0) {
|
||||
totalRecharge.value = res.data.totalRecharge;
|
||||
}
|
||||
});
|
||||
});
|
||||
const onPay = () => {
|
||||
// console.log(userWallet.value.totalRecharge);
|
||||
if (state.payment === '') {
|
||||
sheep.$helper.toast('请选择支付方式');
|
||||
return;
|
||||
}
|
||||
if (state.orderInfo.totalPrice >= SYSCONST.MAX_PRICE && state.payment !== 'wallet') {
|
||||
sheep.$helper.toast('请选择余额支付');
|
||||
return;
|
||||
}
|
||||
if (state.payment === 'wallet') {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定要支付吗?',
|
||||
confirmColor: '#FA7E31',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
// sheep.$platform.pay(state.payment, state.orderType, payOrderId.value);
|
||||
if (totalRecharge.value < state.orderInfo.totalPrice) {
|
||||
uni.showToast({
|
||||
title: '余额不足请充值',
|
||||
icon: 'none',
|
||||
});
|
||||
setTimeout(() => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/home/recharge',
|
||||
});
|
||||
}, 1000);
|
||||
} else {
|
||||
sheep.$platform.pay(state.payment, state.orderType, payOrderId.value);
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
} else {
|
||||
sheep.$platform.pay(state.payment, state.orderType, payOrderId.value);
|
||||
}
|
||||
};
|
||||
const onClickLeft = () => {
|
||||
uni.navigateBack({
|
||||
delta: 1,
|
||||
});
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.pay-icon {
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
margin-right: 26rpx;
|
||||
}
|
||||
|
||||
.ss-modal-box {
|
||||
// max-height: 1000rpx;
|
||||
|
||||
.modal-header {
|
||||
position: relative;
|
||||
padding: 60rpx 20rpx 40rpx;
|
||||
|
||||
.money-text {
|
||||
color: $red;
|
||||
font-size: 46rpx;
|
||||
font-weight: bold;
|
||||
font-family: OPPOSANS;
|
||||
|
||||
&::before {
|
||||
content: '¥';
|
||||
font-size: 30rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.time-text {
|
||||
font-size: 26rpx;
|
||||
color: $gray-b;
|
||||
}
|
||||
|
||||
.close-icon {
|
||||
position: absolute;
|
||||
top: 10rpx;
|
||||
right: 20rpx;
|
||||
font-size: 46rpx;
|
||||
opacity: 0.2;
|
||||
}
|
||||
}
|
||||
|
||||
.modal-content {
|
||||
overflow-y: auto;
|
||||
|
||||
.pay-title {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.pay-tip {
|
||||
font-size: 26rpx;
|
||||
color: #bbbbbb;
|
||||
}
|
||||
|
||||
.pay-item {
|
||||
height: 86rpx;
|
||||
}
|
||||
|
||||
.disabled-pay-item {
|
||||
.pay-title {
|
||||
color: #999999;
|
||||
}
|
||||
}
|
||||
|
||||
.userInfo-money {
|
||||
font-size: 26rpx;
|
||||
color: #bbbbbb;
|
||||
line-height: normal;
|
||||
}
|
||||
}
|
||||
|
||||
.save-btn {
|
||||
width: 710rpx;
|
||||
height: 80rpx;
|
||||
border-radius: 40rpx;
|
||||
background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
|
||||
color: $white;
|
||||
}
|
||||
|
||||
.disabled-btn {
|
||||
background: #e5e5e5;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.past-due-btn {
|
||||
width: 710rpx;
|
||||
height: 80rpx;
|
||||
border-radius: 40rpx;
|
||||
background-color: #999;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,470 @@
|
||||
<template>
|
||||
<s-layout title="商品详情">
|
||||
<view>
|
||||
<detailSkeleton v-if="state.skeletonLoading" />
|
||||
<!-- 下架/售罄提醒 -->
|
||||
<s-empty v-else-if="state.goodsInfo === null" text="商品不存在或已下架" icon="/static/soldout-empty.png" showAction
|
||||
actionText="再逛逛" actionUrl="/pages/AI/index" />
|
||||
<block v-else>
|
||||
<view class="detail-swiper-selector">
|
||||
<!-- 商品轮播图 -->
|
||||
<su-swiper class="" isPreview :list="formatGoodsSwiper(state.goodsInfo.sliderPicUrls)" otStyle="tag"
|
||||
imageMode="widthFix" dotCur="bg-mask-40" :seizeHeight="750" />
|
||||
<!-- 限时折扣/会员价的优惠信息 -->
|
||||
<view v-if="!show" class="session">
|
||||
<view class="bg w100 h100 h_152">
|
||||
<image class="w100 h100" :src="$url + 'ai/2.png'" mode="scaleToFill" />
|
||||
</view>
|
||||
<view class="sessionCon w100 h100 h_152 flex-center ju-between p-x-40">
|
||||
<view>
|
||||
<view class="flex-row al-flex-end m-b-8" style="color: #fff">
|
||||
<view class="size44 weight500">
|
||||
<span class="size32">¥</span>{{ $fen2yuan(state.goodsInfo.discountedPrice?state.goodsInfo.discountedPrice:state.goodsInfo.price) }}
|
||||
</view>
|
||||
<view class="size24 m-l-14 m-r-6 through" v-if="state.goodsInfo.marketPrice">
|
||||
¥{{ $fen2yuan(state.goodsInfo.discountedPrice?state.goodsInfo.price:state.goodsInfo.marketPrice) }}</view>
|
||||
<view class="size24">已售</view>
|
||||
</view>
|
||||
<view class="flex-row relative">
|
||||
<view class="w_348 h_37">
|
||||
<image class="w100 h100" :src="$url + 'ai/3.png'" mode="scaleToFill" />
|
||||
</view>
|
||||
<view class="absolute t0 l0 size20 c27 line37 p-l-10">
|
||||
限时省{{ $fen2yuan(state.goodsInfo.marketPrice - state.goodsInfo.price) }}元
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view>
|
||||
<view class="c15 size28 m-b-22">距离活动{{ timeText }}</view>
|
||||
<view>
|
||||
<uni-countdown color="#FFFFFF" background-color="#FF393A" border-color="#FF393A" :show-day="false"
|
||||
:hour="hour" :minute="minute" :second="second" @timeup="timeup"></uni-countdown>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 价格+标题 -->
|
||||
<view class="title-card detail-card ss-p-y-32 ss-p-x-32" :class="{ 'm-t-52': !show }">
|
||||
<view class="title-text ss-line-2 ss-m-b-6 flex-center ju-flex-start">
|
||||
<view class="label m-r-10 shrink" v-if="state.goodsInfo.tagSaleName">{{
|
||||
state.goodsInfo.tagSaleName
|
||||
}}</view>
|
||||
<view>{{ state.goodsInfo.name }}</view>
|
||||
</view>
|
||||
<view class="subtitle-text ss-line-1">{{ state.goodsInfo.introduction }}</view>
|
||||
</view>
|
||||
|
||||
<!-- 功能卡片 -->
|
||||
<view class="detail-cell-card detail-card ss-flex-col">
|
||||
<detail-cell-sku v-model="state.selectedSku.goods_sku_text" :sku="state.selectedSku" @tap="addCar" theme="2"
|
||||
v-if="timeText !== '开始'" />
|
||||
<detail-cell v-if="state.goodsInfo.deliverPlace || state.goodsInfo.deliverTime" label="发货" :value="`${state.goodsInfo.deliverPlace || ''} ${state.goodsInfo.deliverPlace || state.goodsInfo.deliverTime ? '|' : ''
|
||||
} ${state.goodsInfo.deliverTime || ''}`" />
|
||||
<detail-cell theme="2" label="运费" value="免运费(请以提交订单为准)" />
|
||||
</view>
|
||||
|
||||
<!-- 详情 -->
|
||||
<detail-content-card class="detail-content-selector" :content="state.goodsInfo.description" />
|
||||
</view>
|
||||
</block>
|
||||
<view class="theme-ai">
|
||||
<card_payment ref="paymentRef" source="orderInfo" :actionStatus="timeText" @addCar="addCar" />
|
||||
</view>
|
||||
</view>
|
||||
</s-layout>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted, onUnmounted, getCurrentInstance, watch, nextTick } from 'vue';
|
||||
import { onLoad, onPageScroll } from '@dcloudio/uni-app';
|
||||
import sheep from '@/sheep';
|
||||
// import { onPageScroll} from '@dcloudio/uni-app';
|
||||
|
||||
import card_payment from '@/components/card_payment/card_payment';
|
||||
import detailNavbar from '../goods/components/detail/detail-navbar.vue';
|
||||
import detailCellSku from '../goods/components/detail/detail-cell-sku.vue';
|
||||
|
||||
import detailCell from '../goods/components/detail/detail-cell.vue';
|
||||
import detailTabbar from '../goods/components/detail/detail-tabbar.vue';
|
||||
import detailSkeleton from '../goods/components/detail/detail-skeleton.vue';
|
||||
import detailCommentCard from '../goods/components/detail/detail-comment-card.vue';
|
||||
import detailContentCard from '../goods/components/detail/detail-content-card.vue';
|
||||
import detailActivityTip from '../goods/components/detail/detail-activity-tip.vue';
|
||||
import {
|
||||
formatSales,
|
||||
formatGoodsSwiper,
|
||||
fen2yuan,
|
||||
fen2yuanSimple,
|
||||
formatDiscountPercent,
|
||||
getRewardActivityRuleItemDescriptions,
|
||||
} from '@/sheep/hooks/useGoods';
|
||||
import * as api from '@/sheep/api/ai/index';
|
||||
let { proxy } = getCurrentInstance();
|
||||
const state = reactive({
|
||||
skeletonLoading: false,
|
||||
goodsInfo: {},
|
||||
selectedSku: {}, // 选中的 SKU
|
||||
});
|
||||
const getInfo = async () => {
|
||||
let res = await api.getSpuDetail(id.value, shoppingPlazaId.value);
|
||||
if (res.code === 0) {
|
||||
state.goodsInfo = res.data;
|
||||
timeChange();
|
||||
}
|
||||
};
|
||||
let id = ref();
|
||||
let shoppingPlazaId = ref();
|
||||
onLoad(async (options) => {
|
||||
// 滚到顶部
|
||||
uni.pageScrollTo({
|
||||
scrollTop: 0,
|
||||
});
|
||||
id.value = options.id;
|
||||
shoppingPlazaId.value = options.shopId;
|
||||
getInfo();
|
||||
}); // 规格变更
|
||||
function onSkuChange(e) {
|
||||
state.selectedSku = e;
|
||||
state.settlementSku = e;
|
||||
}
|
||||
const onAddCart = () => { };
|
||||
const onBuy = () => { };
|
||||
let paymentRef = ref(null);
|
||||
const addCar = () => {
|
||||
paymentRef.value.addCar({ ...state.goodsInfo, shoppingPlazaId: shoppingPlazaId.value });
|
||||
};
|
||||
/**
|
||||
* 倒计时
|
||||
*/
|
||||
|
||||
let show = ref(false);
|
||||
let timeText = ref('开始');
|
||||
let hour = ref(0);
|
||||
let minute = ref(0);
|
||||
let second = ref(0);
|
||||
const timeup = () => {
|
||||
show.value = true;
|
||||
timeChange();
|
||||
};
|
||||
const timeChange = () => {
|
||||
show.value = false;
|
||||
let data = state.goodsInfo;
|
||||
let endTime = data.endTime;
|
||||
let startTime = data.startTime;
|
||||
// 当前时间戳
|
||||
let currentTime = Date.now();
|
||||
let time = null;
|
||||
if (currentTime < startTime) {
|
||||
timeText.value = '开始';
|
||||
time = startTime - currentTime;
|
||||
} else if (currentTime > startTime && currentTime < endTime) {
|
||||
timeText.value = '结束';
|
||||
time = endTime - currentTime;
|
||||
} else {
|
||||
show.value = true;
|
||||
timeText.value = '已结束';
|
||||
}
|
||||
if (time) {
|
||||
hour.value = Math.floor(time / 1000 / 60 / 60);
|
||||
minute.value = Math.floor(time / 1000 / 60) % 60;
|
||||
second.value = Math.floor(time / 1000) % 60;
|
||||
}
|
||||
};
|
||||
// inner
|
||||
let navBar = ref('inner');
|
||||
let scrollTop = ref(0);
|
||||
onPageScroll((e) => {
|
||||
//console.log(e)
|
||||
scrollTop.value = e.scrollTop;
|
||||
if (e.scrollTop > 20) {
|
||||
navBar.value = 'normal';
|
||||
} else {
|
||||
navBar.value = 'inner';
|
||||
}
|
||||
});
|
||||
|
||||
let sysInfo = uni.getSystemInfoSync();
|
||||
const windowHeight = sysInfo.windowHeight;
|
||||
let height = ref(0);
|
||||
height.value = sysInfo.statusBarHeight + uni.upx2px(88);
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.detail-card {
|
||||
background-color: #ffffff;
|
||||
border-radius: 10rpx;
|
||||
overflow: hidden;
|
||||
margin-bottom: 40rpx;
|
||||
// color: #ffffff;
|
||||
}
|
||||
|
||||
// 价格标题卡片
|
||||
.title-card {
|
||||
.price-box {
|
||||
.price-text {
|
||||
font-size: 42rpx;
|
||||
font-weight: 500;
|
||||
color: #ff3000;
|
||||
line-height: 30rpx;
|
||||
font-family: OPPOSANS;
|
||||
|
||||
&::before {
|
||||
content: '¥';
|
||||
font-size: 30rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.origin-price-text {
|
||||
font-size: 26rpx;
|
||||
font-weight: 400;
|
||||
text-decoration: line-through;
|
||||
color: $gray-c;
|
||||
font-family: OPPOSANS;
|
||||
|
||||
&::before {
|
||||
content: '¥';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.sales-text {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: $gray-c;
|
||||
}
|
||||
|
||||
.discounts-box {
|
||||
.tag-content {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.tag-box {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.tag {
|
||||
flex-shrink: 0;
|
||||
padding: 4rpx 10rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
border-radius: 4rpx;
|
||||
color: var(--ui-BG-Main);
|
||||
background: var(--ui-BG-Main-tag);
|
||||
}
|
||||
|
||||
.discounts-title {
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: var(--ui-BG-Main);
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.cicon-forward {
|
||||
color: var(--ui-BG-Main);
|
||||
font-size: 24rpx;
|
||||
line-height: normal;
|
||||
margin-top: 4rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.title-text {
|
||||
font-size: 32rpx;
|
||||
line-height: 42rpx;
|
||||
}
|
||||
|
||||
.subtitle-text {
|
||||
font-size: 26rpx;
|
||||
font-weight: 400;
|
||||
color: $dark-9;
|
||||
line-height: 42rpx;
|
||||
}
|
||||
}
|
||||
|
||||
// 购买
|
||||
.buy-box {
|
||||
.add-btn {
|
||||
width: 240rpx;
|
||||
height: 72rpx;
|
||||
font-weight: 500;
|
||||
font-size: 30rpx;
|
||||
border-radius: 12rpx 0 0 12rpx;
|
||||
background: #fa8735;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.buy-btn {
|
||||
width: 240rpx;
|
||||
height: 72rpx;
|
||||
font-weight: 500;
|
||||
font-size: 30rpx;
|
||||
border-radius: 0 12rpx 12rpx 0;
|
||||
background: #fe3b48;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.disabled-btn {
|
||||
width: 428rpx;
|
||||
height: 72rpx;
|
||||
border-radius: 40rpx;
|
||||
background: #999999;
|
||||
color: $white;
|
||||
}
|
||||
}
|
||||
|
||||
.model-box {
|
||||
height: 60vh;
|
||||
|
||||
.model-content {
|
||||
height: 56vh;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
|
||||
// 限时折扣
|
||||
.discount {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.disImg {
|
||||
width: 750rpx;
|
||||
height: 100rpx;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
.discountCont {
|
||||
width: 680rpx;
|
||||
height: 90rpx;
|
||||
margin: 10rpx auto 0 auto;
|
||||
// background-color: gold;
|
||||
}
|
||||
|
||||
.disContT {
|
||||
width: 680rpx;
|
||||
height: 50rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.disContT1 {
|
||||
// width: 400rpx;
|
||||
// height: 50rpx;
|
||||
// background-color: green;
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.disContT2 {
|
||||
width: 200rpx;
|
||||
height: 50rpx;
|
||||
line-height: 50rpx;
|
||||
// background-color: gold;
|
||||
font-size: 30rpx;
|
||||
text-align: end;
|
||||
color: #ff393a;
|
||||
font-weight: bolder;
|
||||
font-style: oblique 20deg;
|
||||
letter-spacing: 0.1rem;
|
||||
}
|
||||
|
||||
.disContT1P {
|
||||
color: white;
|
||||
font-size: 44rpx;
|
||||
}
|
||||
|
||||
.disContT1End {
|
||||
// width: 180rpx;
|
||||
padding: 0 20rpx;
|
||||
height: 36rpx;
|
||||
line-height: 36rpx;
|
||||
text-align: center;
|
||||
background-color: #fee2be;
|
||||
color: #f71b1b;
|
||||
font-size: 23rpx;
|
||||
border-radius: 20rpx;
|
||||
margin-left: 26rpx;
|
||||
}
|
||||
|
||||
.disContB {
|
||||
width: 680rpx;
|
||||
height: 40rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: 20rpx;
|
||||
color: white;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.disContB1 {
|
||||
width: 300rpx;
|
||||
height: 40rpx;
|
||||
line-height: 40rpx;
|
||||
color: #ffcccc;
|
||||
font-size: 24rpx;
|
||||
// 删除线
|
||||
text-decoration: line-through;
|
||||
padding-left: 6rpx;
|
||||
}
|
||||
|
||||
.disContB2 {
|
||||
width: 300rpx;
|
||||
height: 40rpx;
|
||||
line-height: 40rpx;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.label {
|
||||
display: inline-block;
|
||||
font-size: 20rpx;
|
||||
color: #ff5040;
|
||||
border: 1px solid #ff5040;
|
||||
border-radius: 8rpx;
|
||||
padding: 0 8rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.session {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.bg {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
top: -100rpx;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.sessionCon {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
top: -100rpx;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
:deep(.uni-countdown__number) {
|
||||
font-size: 24rpx !important;
|
||||
width: 40rpx !important;
|
||||
height: 40rpx !important;
|
||||
line-height: 40rpx !important;
|
||||
}
|
||||
|
||||
:deep(.uni-countdown__splitor) {
|
||||
color: #ff393a !important;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,357 @@
|
||||
<template>
|
||||
<s-pages title="收银台" :goLeft="false" @onClickLeft="onClickLeft">
|
||||
<view class="p-x-32">
|
||||
<view class="center p-t-96 weight500 size100"
|
||||
><span class="size48">¥</span>
|
||||
<!-- {{ fen2yuan(state.orderInfo.totalPrice) }} -->
|
||||
{{ fen2yuan(state.orderInfo.totalPrice) }}
|
||||
</view>
|
||||
<view class="center m-t-20 m-b-66">{{ payDescText }}</view>
|
||||
<view>
|
||||
<radio-group @change="onTapPay">
|
||||
<label class="" v-for="item in state.payMethods" :key="item.title">
|
||||
<view
|
||||
class="flex-center ju-between m-b-40"
|
||||
:class="{ 'disabled-pay-item': item.disabled }"
|
||||
>
|
||||
<view class="flex-center">
|
||||
<image
|
||||
class="h_64 w_64"
|
||||
v-if="item.disabled"
|
||||
:src="sheep.$url.static('/static/img/shop/pay/cod_disabled.png')"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
<image
|
||||
class="h_64 w_64"
|
||||
v-else
|
||||
:src="sheep.$url.static(item.icon)"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
<text class="pay-title m-l-12">{{ item.title }}</text>
|
||||
</view>
|
||||
<view class="check-box ss-flex ss-col-center ss-p-l-10">
|
||||
<view class="userInfo-money ss-m-r-10" v-if="item.value === 'wallet'">
|
||||
余额: {{ fen2yuan(totalRecharge) }}元
|
||||
</view>
|
||||
<view class="">
|
||||
<radio
|
||||
:value="item.value"
|
||||
color="#366DEE"
|
||||
backgroundColor="rgba(255, 255, 255, 0)"
|
||||
:disabled="item.disabled"
|
||||
:checked="state.payment === item.value"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="">
|
||||
<radio :value="item.value" color="#366DEE" backgroundColor="rgba(255, 255, 255, 0)"
|
||||
:disabled="item.disabled" :checked="state.payment === item.value" />
|
||||
</view> -->
|
||||
</view>
|
||||
</label>
|
||||
</radio-group>
|
||||
</view>
|
||||
|
||||
<!-- 工具 -->
|
||||
<view class="modal-footer ss-flex ss-row-center ss-col-center ss-m-t-80 ss-m-b-40">
|
||||
<button v-if="state.payStatus === 0" class="ss-reset-button past-due-btn">
|
||||
检测支付环境中
|
||||
</button>
|
||||
<button v-else-if="state.payStatus === -1" class="ss-reset-button past-due-btn" disabled>
|
||||
支付已过期
|
||||
</button>
|
||||
<button
|
||||
v-else
|
||||
class="ai-button2"
|
||||
@tap="onPay"
|
||||
:disabled="state.payStatus !== 1"
|
||||
:class="{ 'disabled-btn': state.payStatus !== 1 }"
|
||||
>
|
||||
立即支付
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</s-pages>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
ref,
|
||||
reactive,
|
||||
onMounted,
|
||||
onUnmounted,
|
||||
getCurrentInstance,
|
||||
watch,
|
||||
nextTick,
|
||||
computed,
|
||||
} from 'vue';
|
||||
let { proxy } = getCurrentInstance();
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import * as api from '@/sheep/api/ai/index';
|
||||
import sheep from '@/sheep';
|
||||
import PayChannelApi from '@/sheep/api/pay/channel';
|
||||
import { fen2yuan, useDurationTime } from '@/sheep/hooks/useGoods';
|
||||
import { getPayMethods, goPayResult } from '@/sheep/platform/pay';
|
||||
import { SYSCONST } from '@/sheep/helper/const';
|
||||
import { getWallet } from '@/sheep/api/home/pay';
|
||||
let id = ref('');
|
||||
let payOrderId = ref('');
|
||||
let orderInfo = ref({});
|
||||
const userWallet = ref();
|
||||
|
||||
let totalRecharge = ref();
|
||||
// 检测支付环境
|
||||
const state = reactive({
|
||||
orderType: 'aiGoods', // 订单类型; goods - 商品订单, recharge - 充值订单 aiRecharge
|
||||
orderInfo: {}, // 支付单信息
|
||||
payStatus: 0, // 0=检测支付环境, -2=未查询到支付单信息, -1=支付已过期, 1=待支付,2=订单已支付
|
||||
payMethods: [], // 可选的支付方式
|
||||
payment: '', // 选中的支付方式
|
||||
});
|
||||
const getOrderDetail = async () => {
|
||||
let { code, data } = await api.getGiftOrderDetail({ id: id.value });
|
||||
if (code !== 0 || !data) {
|
||||
state.payStatus = -2;
|
||||
return;
|
||||
}
|
||||
state.orderInfo = data || {};
|
||||
// 设置支付状态
|
||||
checkPayStatus();
|
||||
// 获得支付方式
|
||||
await setPayMethods();
|
||||
};
|
||||
|
||||
// 获得支付方式
|
||||
async function setPayMethods() {
|
||||
const { data, code } = await PayChannelApi.getEnableChannelCodeList(state.orderInfo.appId || 1);
|
||||
if (code !== 0) {
|
||||
return;
|
||||
}
|
||||
state.payMethods = getPayMethods(data);
|
||||
// 金额超出阈值,仅允许余额支付
|
||||
if (state.orderInfo?.totalPrice >= SYSCONST.MAX_PRICE) {
|
||||
state.payMethods = state.payMethods.map((item) => ({
|
||||
...item,
|
||||
disabled: item.value !== 'wallet' ? true : item.disabled,
|
||||
}));
|
||||
state.payment = 'wallet';
|
||||
}
|
||||
state.payMethods.find((item) => {
|
||||
if (item.value && !item.disabled) {
|
||||
state.payment = item.value;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
// 支付文案提示
|
||||
const payDescText = computed(() => {
|
||||
if (state.payStatus === 2) {
|
||||
return '该订单已支付';
|
||||
}
|
||||
if (state.payStatus === 1 && state.orderInfo?.payExpireTime) {
|
||||
const time = useDurationTime(state.orderInfo.payExpireTime);
|
||||
if (time?.ms <= 0) {
|
||||
state.payStatus = -1;
|
||||
return '';
|
||||
}
|
||||
return `剩余支付时间 ${time?.h}:${time?.m}:${time?.s} `;
|
||||
}
|
||||
if (state.payStatus === -2) {
|
||||
return '未查询到支付单信息';
|
||||
}
|
||||
return '';
|
||||
});
|
||||
|
||||
// 状态转换:payOrder.status => payStatus
|
||||
function checkPayStatus() {
|
||||
if (state.orderInfo.status === 10 || state.orderInfo.status === 20) {
|
||||
// 支付成功
|
||||
state.payStatus = 2;
|
||||
// 跳转回支付成功页
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '订单已支付',
|
||||
confirmColor: '#FA7E31',
|
||||
showCancel: false,
|
||||
success: function () {
|
||||
goPayResult(state.orderInfo.id, state.orderType);
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (state.orderInfo.status === 30) {
|
||||
// 支付关闭
|
||||
state.payStatus = -1;
|
||||
return;
|
||||
}
|
||||
state.payStatus = 1; // 待支付
|
||||
}
|
||||
|
||||
// 切换支付方式
|
||||
function onTapPay(e) {
|
||||
state.payment = e.detail.value;
|
||||
}
|
||||
let type = ref(); //2充值
|
||||
onLoad(async (options) => {
|
||||
// console.log(options);
|
||||
|
||||
id.value = options.id || '';
|
||||
payOrderId.value = options.payOrderId || '';
|
||||
type.value = options.type || '';
|
||||
|
||||
if (type.value == 2) {
|
||||
state.orderType = 'aiRecharge';
|
||||
state.orderInfo.totalPrice = options.price * 100;
|
||||
// state.orderInfo.price = options.price;
|
||||
|
||||
// 设置支付状态
|
||||
checkPayStatus();
|
||||
// 获得支付方式
|
||||
await setPayMethods();
|
||||
} else {
|
||||
getOrderDetail();
|
||||
}
|
||||
});
|
||||
onShow(() => {
|
||||
getWallet().then((res) => {
|
||||
if (res.code === 0) {
|
||||
totalRecharge.value = res.data.totalRecharge;
|
||||
}
|
||||
});
|
||||
});
|
||||
const onPay = () => {
|
||||
// console.log(userWallet.value.totalRecharge);
|
||||
if (state.payment === '') {
|
||||
sheep.$helper.toast('请选择支付方式');
|
||||
return;
|
||||
}
|
||||
if (state.orderInfo.totalPrice >= SYSCONST.MAX_PRICE && state.payment !== 'wallet') {
|
||||
sheep.$helper.toast('请选择余额支付');
|
||||
return;
|
||||
}
|
||||
if (state.payment === 'wallet') {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定要支付吗?',
|
||||
confirmColor: '#FA7E31',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
// sheep.$platform.pay(state.payment, state.orderType, payOrderId.value);
|
||||
if (totalRecharge.value < state.orderInfo.totalPrice) {
|
||||
uni.showToast({
|
||||
title: '余额不足请充值',
|
||||
icon: 'none',
|
||||
});
|
||||
setTimeout(() => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/home/recharge',
|
||||
});
|
||||
}, 1000);
|
||||
} else {
|
||||
sheep.$platform.pay(state.payment, state.orderType, payOrderId.value);
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
} else {
|
||||
sheep.$platform.pay(state.payment, state.orderType, payOrderId.value);
|
||||
}
|
||||
};
|
||||
const onClickLeft = () => {
|
||||
uni.navigateBack({
|
||||
delta: 1,
|
||||
});
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.pay-icon {
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
margin-right: 26rpx;
|
||||
}
|
||||
|
||||
.ss-modal-box {
|
||||
// max-height: 1000rpx;
|
||||
|
||||
.modal-header {
|
||||
position: relative;
|
||||
padding: 60rpx 20rpx 40rpx;
|
||||
|
||||
.money-text {
|
||||
color: $red;
|
||||
font-size: 46rpx;
|
||||
font-weight: bold;
|
||||
font-family: OPPOSANS;
|
||||
|
||||
&::before {
|
||||
content: '¥';
|
||||
font-size: 30rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.time-text {
|
||||
font-size: 26rpx;
|
||||
color: $gray-b;
|
||||
}
|
||||
|
||||
.close-icon {
|
||||
position: absolute;
|
||||
top: 10rpx;
|
||||
right: 20rpx;
|
||||
font-size: 46rpx;
|
||||
opacity: 0.2;
|
||||
}
|
||||
}
|
||||
|
||||
.modal-content {
|
||||
overflow-y: auto;
|
||||
|
||||
.pay-title {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.pay-tip {
|
||||
font-size: 26rpx;
|
||||
color: #bbbbbb;
|
||||
}
|
||||
|
||||
.pay-item {
|
||||
height: 86rpx;
|
||||
}
|
||||
|
||||
.disabled-pay-item {
|
||||
.pay-title {
|
||||
color: #999999;
|
||||
}
|
||||
}
|
||||
|
||||
.userInfo-money {
|
||||
font-size: 26rpx;
|
||||
color: #bbbbbb;
|
||||
line-height: normal;
|
||||
}
|
||||
}
|
||||
|
||||
.save-btn {
|
||||
width: 710rpx;
|
||||
height: 80rpx;
|
||||
border-radius: 40rpx;
|
||||
background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
|
||||
color: $white;
|
||||
}
|
||||
|
||||
.disabled-btn {
|
||||
background: #e5e5e5;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.past-due-btn {
|
||||
width: 710rpx;
|
||||
height: 80rpx;
|
||||
border-radius: 40rpx;
|
||||
background-color: #999;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,160 @@
|
||||
<template>
|
||||
<s-pages title="确认订单">
|
||||
<view class="p-b-132">
|
||||
<AddressSelection v-model="addressState" theme="2" @getSettlementInfo="getSettlementInfo" />
|
||||
<view class="p-x-32 m-t-24">
|
||||
<view class="bg24 p-x-20 p-t-20 radius16">
|
||||
<view v-if="settlementInfo.items && settlementInfo.items.length">
|
||||
<view class="m-b-24 no-click-wrap" v-for="(v, i) in settlementInfo.items" :key="i">
|
||||
<aiOrder :data="v" :source="3" />
|
||||
<view class="no-click-block" @click.stop.prevent></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-row ju-between m-b-36">
|
||||
<view class="c25 size28">商品金额</view>
|
||||
<view>¥{{ $fen2yuan(settlementInfo?.price?.totalPrice || 0) }}</view>
|
||||
</view>
|
||||
<view class="flex-row ju-between m-b-36">
|
||||
<view class="c25 size28">运费</view>
|
||||
<view>¥{{ $fen2yuan(settlementInfo?.price?.deliveryPrice || 0) }}</view>
|
||||
</view>
|
||||
<view class="flex-center ju-flex-end borderTop">
|
||||
<span class="size26 line96">合计: </span>
|
||||
<span class="c13 size28 m-l-12 line96 weight900"
|
||||
>¥{{ $fen2yuan(settlementInfo?.price?.payPrice || 0) }}</span
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="p-x-32 btn">
|
||||
<view class="ai-button2" @click="sub">确认订单</view>
|
||||
</view>
|
||||
</s-pages>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, getCurrentInstance } from 'vue';
|
||||
import AddressSelection from '@/pages/order/addressSelection.vue';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import aiOrder from '@/components/ai_order/ai_order';
|
||||
let { proxy } = getCurrentInstance();
|
||||
import api from '@/sheep/api/member/address';
|
||||
import * as SpuApi from '@/sheep/api/ai/index';
|
||||
|
||||
const addressState = ref({
|
||||
addressInfo: {},
|
||||
deliveryType: 1,
|
||||
isPickUp: false,
|
||||
pickUpInfo: {},
|
||||
receiverName: '',
|
||||
receiverMobile: '',
|
||||
});
|
||||
let remark_value = ref();
|
||||
let spuId = ref();
|
||||
let spuPrice = ref();
|
||||
|
||||
const settlementInfo = ref<any>({});
|
||||
let addressId = ref('');
|
||||
const getSettlementInfo = (id = '') => {
|
||||
addressId.value = id;
|
||||
SpuApi.getGiftSettlementInfo({
|
||||
id: id,
|
||||
spuId: spuId.value,
|
||||
}).then((res: any) => {
|
||||
settlementInfo.value = res.data || {};
|
||||
// 设置收货地址
|
||||
if (res.data.address) {
|
||||
addressState.value.addressInfo = res.data.address;
|
||||
}
|
||||
// if (settlementInfo.value?.items?.length) {
|
||||
// settlementInfo.value.items.forEach((e) => {
|
||||
// e.skuArr = e.items;
|
||||
// e.skuArr.forEach((item) => {
|
||||
// item.propertyText = '';
|
||||
// if(item.properties){
|
||||
// item.properties.forEach((e1) => {
|
||||
// item.propertyText += e1.valueName + ' ';
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
// }
|
||||
});
|
||||
};
|
||||
const sub = async () => {
|
||||
if (!addressId.value) return proxy.utils.toast('请选择地址');
|
||||
let res: any = await SpuApi.createOrderOpen({
|
||||
id: addressId.value,
|
||||
spuId: spuId.value,
|
||||
userRemark: remark_value.value,
|
||||
});
|
||||
if (res.code === 0) {
|
||||
proxy.utils.toast('下单成功');
|
||||
setTimeout(() => {
|
||||
proxy.utils.go('/pages/AI/giftCashierDesk', {
|
||||
id: res.data.id,
|
||||
payOrderId: res.data.payOrderId,
|
||||
});
|
||||
}, 1000);
|
||||
}
|
||||
};
|
||||
const getAddress = () => {
|
||||
api.getAddressList().then((res) => {
|
||||
if (res.code === 0 && res.data?.length) {
|
||||
// addressState.value.addressInfo = res.data[0];
|
||||
// getSettlementInfo(res.data[0].id);
|
||||
let index = res.data.findIndex((e) => e.defaultStatus);
|
||||
if (index !== -1) {
|
||||
addressState.value.addressInfo = res.data[index];
|
||||
getSettlementInfo(res.data[index].id);
|
||||
} else {
|
||||
getSettlementInfo();
|
||||
}
|
||||
} else {
|
||||
getSettlementInfo();
|
||||
}
|
||||
});
|
||||
};
|
||||
// onLoad((options: any) => {
|
||||
// if (options.id) {
|
||||
// spuId.value = options.id;
|
||||
// }
|
||||
// if (options.price) {
|
||||
// spuPrice.value = options.price;
|
||||
// }
|
||||
// getSettlementInfo();
|
||||
// });
|
||||
onLoad((e) => {
|
||||
// getCartList();
|
||||
spuId.value = e.id;
|
||||
// console.log(e.id);
|
||||
});
|
||||
onShow(() => {
|
||||
getAddress();
|
||||
});
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.no-click-wrap {
|
||||
position: relative;
|
||||
}
|
||||
.no-click-block {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.btn {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
padding-bottom: calc(env(safe-area-inset-bottom) + 12rpx);
|
||||
z-index: 100;
|
||||
background: transparent;
|
||||
}
|
||||
.borderTop {
|
||||
border-top: 1rpx solid #dfdfdf;
|
||||
padding: 12rpx 0;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,534 @@
|
||||
<!-- 订单详情 -->
|
||||
<template>
|
||||
<s-pages title="订单详情">
|
||||
<view class="flex-center al-flex-end ju-between p-x-32 m-b-54">
|
||||
<view>
|
||||
<view class="size40 weight500 m-b-16">{{ statusObj[state.orderInfo.status]?.text }}</view>
|
||||
<view class="size24">{{ statusObj[state.orderInfo.status]?.text1 }}</view>
|
||||
</view>
|
||||
<view class="w_120 h_120" v-if="statusObj[state.orderInfo.status]?.icon">
|
||||
<image
|
||||
class="w100 h100"
|
||||
:src="statusObj[state.orderInfo.status]?.icon"
|
||||
mode="scaleToFill"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 收货地址 -->
|
||||
<view class="order-address-box flex-row bg24 c0" v-if="state.orderInfo.receiverAreaId > 0">
|
||||
<view class="cityImg">
|
||||
<image :src="`${$url}goods/city1.png`" mode="scaleToFill" />
|
||||
</view>
|
||||
<view class="size32">
|
||||
<view class="ss-flex ss-col-center">
|
||||
<text class="address-username">
|
||||
{{ state.orderInfo.receiverName }}
|
||||
</text>
|
||||
<text class="address-phone">{{ state.orderInfo.receiverMobile }}</text>
|
||||
</view>
|
||||
<view class="address-detail size32">
|
||||
{{ state.orderInfo.receiverAreaName }} {{ state.orderInfo.receiverDetailAddress }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="detail-goods"
|
||||
:style="[{ marginTop: state.orderInfo.receiverAreaId > 0 ? '0' : '-40rpx' }]"
|
||||
>
|
||||
<card_order
|
||||
theme="2"
|
||||
class="order-goods"
|
||||
v-if="state?.orderInfo?.items?.length > 0"
|
||||
:data="state.orderInfo"
|
||||
type="4"
|
||||
@getOrderDetail="getOrderDetail"
|
||||
></card_order>
|
||||
|
||||
<!-- 价格信息 -->
|
||||
<view class="order-price-box bg24">
|
||||
<view class="notice-item ss-flex ss-row-between" v-for="(v, i) in priceArr" :key="i">
|
||||
<text class="title c25">{{ v.title }}</text>
|
||||
<view class="ss-flex">
|
||||
<text class="detail c0" :class="{ 'all-price': v.value == 'payPrice' }"
|
||||
><span>{{ v.type == 2 ? '-' : '' }}</span
|
||||
>¥{{ fen2yuan(state.orderInfo[v.value]) }}</text
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 订单信息 -->
|
||||
<view
|
||||
class="notice-box bg24"
|
||||
:class="{
|
||||
'm-b-90':
|
||||
statusObj[state.orderInfo.status]?.btn1 || statusObj[state.orderInfo.status]?.btn2,
|
||||
}"
|
||||
>
|
||||
<view class="notice-box__content">
|
||||
<view class="notice-item--center">
|
||||
<view class="ss-flex ss-flex-1 flex-row ju-between">
|
||||
<text class="title c25">订单编号</text>
|
||||
<text class="detail right c0">{{ state.orderInfo.no }}</text>
|
||||
</view>
|
||||
<view class="copy" @click.stop="onCopy">
|
||||
<image :src="`${$url}goods/copy1.png`" mode="scaleToFill" />
|
||||
</view>
|
||||
<truckLine :data="state.orderInfo" :code="3" v-if="state.orderInfo.deliveryTime"></truckLine>
|
||||
</view>
|
||||
<view class="notice-item flex-row ju-between">
|
||||
<text class="title c25">下单时间</text>
|
||||
<text class="detail right c0">
|
||||
{{ sheep.$helper.timeFormat(state.orderInfo.createTime, 'yyyy-mm-dd hh:MM:ss') }}
|
||||
</text>
|
||||
</view>
|
||||
<view class="notice-item flex-row ju-between" v-if="state.orderInfo.payTime">
|
||||
<text class="title c25">支付时间:</text>
|
||||
<text class="detail right c0">
|
||||
{{ sheep.$helper.timeFormat(state.orderInfo.payTime, 'yyyy-mm-dd hh:MM:ss') }}
|
||||
</text>
|
||||
</view>
|
||||
<view class="notice-item flex-row ju-between">
|
||||
<text class="title c25">支付方式</text>
|
||||
<text class="detail right c0">{{ state.orderInfo.payChannelName || '-' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="flex btns bg16"
|
||||
v-if="statusObj[state.orderInfo.status]?.btn1 || statusObj[state.orderInfo.status]?.btn2"
|
||||
>
|
||||
<view
|
||||
class="ai-button1 h_70 line70 size28"
|
||||
:class="{
|
||||
'm-r-28': statusObj[state.orderInfo.status]?.btn2,
|
||||
}"
|
||||
v-if="statusObj[state.orderInfo.status]?.btn1"
|
||||
@click="btn(1)"
|
||||
>
|
||||
{{ statusObj[state.orderInfo.status]?.btn1 }}</view
|
||||
>
|
||||
<view
|
||||
class="ai-button3 h_70 line70 size28"
|
||||
v-if="statusObj[state.orderInfo.status]?.btn2"
|
||||
@click="btn(2)"
|
||||
>{{ statusObj[state.orderInfo.status]?.btn2 }}</view
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</s-pages>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import sheep from '@/sheep';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import { reactive, ref, getCurrentInstance } from 'vue';
|
||||
import { isEmpty } from 'lodash-es';
|
||||
import {
|
||||
fen2yuan,
|
||||
formatOrderStatus,
|
||||
formatOrderStatusDescription,
|
||||
handleOrderButtons,
|
||||
} from '@/sheep/hooks/useGoods';
|
||||
import * as OrderApi from '@/sheep/api/ai/index';
|
||||
import DeliveryApi from '@/sheep/api/trade/delivery';
|
||||
import PickUpVerify from '@/pages/order/pickUpVerify.vue';
|
||||
import card_order from '@/components/orderItem/card_order.vue';
|
||||
|
||||
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
|
||||
const headerBg = sheep.$url.css('/static/img/shop/order/order_bg.png');
|
||||
let { proxy } = getCurrentInstance();
|
||||
|
||||
const state = reactive({
|
||||
orderInfo: {},
|
||||
merchantTradeNo: '', // 商户订单号
|
||||
comeinType: '', // 进入订单详情的来源类型
|
||||
});
|
||||
let statusObj = ref({
|
||||
0: {
|
||||
text: '待付款',
|
||||
text1: '付款时间还剩余',
|
||||
btn1: '去支付',
|
||||
btn2: '取消订单',
|
||||
},
|
||||
10: {
|
||||
text: '待发货',
|
||||
text1: '您的商品即将发货...',
|
||||
icon: `${proxy.$url}ai/member/12.png`,
|
||||
},
|
||||
20: {
|
||||
text: '待收货',
|
||||
text1: '您的商品已发货,待您确认收货...',
|
||||
icon: `${proxy.$url}ai/member/12.png`,
|
||||
btn1: '确认收货',
|
||||
},
|
||||
30: {
|
||||
text: '已完成',
|
||||
text1: '您的订单已完成,感谢您的购买!',
|
||||
},
|
||||
40: {
|
||||
text: '已取消',
|
||||
text1: '您的订单已取消!',
|
||||
},
|
||||
});
|
||||
|
||||
// ========== 门店自提(核销) ==========
|
||||
const systemStore = ref({}); // 门店信息
|
||||
|
||||
// 复制
|
||||
const onCopy = () => {
|
||||
sheep.$helper.copyText(state.orderInfo.no);
|
||||
};
|
||||
|
||||
const pickUpVerifyRef = ref();
|
||||
let orderId = ref();
|
||||
|
||||
async function getOrderDetail() {
|
||||
let id = orderId.value;
|
||||
// 对详情数据进行适配
|
||||
let res;
|
||||
res = await OrderApi.getGiftOrderInfo({
|
||||
id,
|
||||
});
|
||||
if (res.code === 0) {
|
||||
state.orderInfo = res.data;
|
||||
handleOrderButtons(state.orderInfo);
|
||||
if (state.orderInfo.deliveryType === 2 && state.orderInfo.payStatus) {
|
||||
pickUpVerifyRef.value && pickUpVerifyRef.value.markCode(res.data.pickUpVerifyCode);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
onShow(async () => {
|
||||
//onShow中获取订单列表,保证跳转后页面为最新状态
|
||||
await getOrderDetail();
|
||||
});
|
||||
onLoad(async (options) => {
|
||||
if (options.id) {
|
||||
orderId.value = options.id;
|
||||
}
|
||||
await getOrderDetail();
|
||||
});
|
||||
|
||||
const priceArr = ref([
|
||||
{
|
||||
title: '商品金额',
|
||||
value: 'totalPrice',
|
||||
type: 1,
|
||||
},
|
||||
{
|
||||
title: '运费',
|
||||
value: 'deliveryPrice',
|
||||
type: 1,
|
||||
},
|
||||
{
|
||||
title: '实付金额',
|
||||
value: 'payPrice',
|
||||
type: 1,
|
||||
},
|
||||
]);
|
||||
const btn = async (type) => {
|
||||
if (state.orderInfo.status === 0 && type === 1) {
|
||||
// 去支付
|
||||
goPay();
|
||||
}
|
||||
if (state.orderInfo.status === 0 && type === 2) {
|
||||
// 取消订单
|
||||
cancelOrder();
|
||||
}
|
||||
if (state.orderInfo.status === 20 && type === 1) {
|
||||
// 确认收货confirmReceive
|
||||
OrderApi.giftConfirmReceive({
|
||||
id: orderId.value,
|
||||
}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
getOrderDetail();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
const goPay = () => {
|
||||
proxy.utils.go('/pages/AI/cashierDesk', {
|
||||
id: state.orderInfo.id,
|
||||
payOrderId: state.orderInfo.payOrderId,
|
||||
});
|
||||
};
|
||||
const cancelOrder = () => {
|
||||
OrderApi.cancelOrder({
|
||||
id: orderId.value,
|
||||
}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
getOrderDetail();
|
||||
}
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.score-img {
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
margin: 0 4rpx;
|
||||
}
|
||||
|
||||
.apply-btn {
|
||||
width: 140rpx;
|
||||
height: 50rpx;
|
||||
border-radius: 25rpx;
|
||||
font-size: 24rpx;
|
||||
border: 2rpx solid #dcdcdc;
|
||||
line-height: normal;
|
||||
margin-left: 16rpx;
|
||||
}
|
||||
|
||||
.state-box {
|
||||
color: rgba(#fff, 0.9);
|
||||
width: 100%;
|
||||
background: v-bind(headerBg) no-repeat,
|
||||
linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
|
||||
background-size: 750rpx 100%;
|
||||
box-sizing: border-box;
|
||||
|
||||
.state-img {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.order-address-box {
|
||||
background-color: #fff;
|
||||
border-radius: 12rpx;
|
||||
margin: 20rpx 32rpx 24rpx 32rpx;
|
||||
padding: 24rpx 30rpx 24rpx 20rpx;
|
||||
font-size: 32rpx;
|
||||
box-sizing: border-box;
|
||||
color: #1b1b21;
|
||||
|
||||
.address-username {
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.address-detail {
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.detail-goods {
|
||||
border-radius: 10rpx;
|
||||
padding: 0 32rpx;
|
||||
|
||||
.order-list {
|
||||
margin-bottom: 20rpx;
|
||||
background-color: #fff;
|
||||
|
||||
.order-card {
|
||||
padding: 20rpx 0;
|
||||
|
||||
.order-sku {
|
||||
font-size: 24rpx;
|
||||
|
||||
font-weight: 400;
|
||||
color: rgba(153, 153, 153, 1);
|
||||
width: 450rpx;
|
||||
margin-bottom: 20rpx;
|
||||
|
||||
.order-num {
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.tag-btn {
|
||||
margin-left: 16rpx;
|
||||
font-size: 24rpx;
|
||||
height: 36rpx;
|
||||
color: var(--ui-BG-Main);
|
||||
border: 2rpx solid var(--ui-BG-Main);
|
||||
border-radius: 14rpx;
|
||||
padding: 0 4rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 订单信息。
|
||||
.notice-box {
|
||||
background: #fff;
|
||||
border-radius: 12rpx;
|
||||
margin-bottom: 24rpx;
|
||||
|
||||
.notice-box__head {
|
||||
font-size: 30rpx;
|
||||
|
||||
font-weight: 500;
|
||||
color: rgba(51, 51, 51, 1);
|
||||
line-height: 80rpx;
|
||||
border-bottom: 1rpx solid #dfdfdf;
|
||||
padding: 0 25rpx;
|
||||
}
|
||||
|
||||
.notice-box__content {
|
||||
padding: 20rpx;
|
||||
|
||||
.self-pickup-box {
|
||||
width: 100%;
|
||||
|
||||
.self-pickup--img {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
margin: 40rpx 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.notice-item,
|
||||
.notice-item--center {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
line-height: normal;
|
||||
margin-bottom: 24rpx;
|
||||
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
color: #3b3b3b;
|
||||
}
|
||||
|
||||
.detail {
|
||||
font-size: 28rpx;
|
||||
color: #323232;
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.copy-btn {
|
||||
width: 100rpx;
|
||||
line-height: 50rpx;
|
||||
border-radius: 25rpx;
|
||||
padding: 0;
|
||||
background: rgba(238, 238, 238, 1);
|
||||
font-size: 22rpx;
|
||||
font-weight: 400;
|
||||
color: rgba(51, 51, 51, 1);
|
||||
}
|
||||
|
||||
// 订单价格信息
|
||||
.order-price-box {
|
||||
background-color: #fff;
|
||||
border-radius: 12rpx;
|
||||
padding: 20rpx;
|
||||
margin-bottom: 24rpx;
|
||||
|
||||
.notice-item {
|
||||
line-height: 70rpx;
|
||||
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
color: #3b3b3b;
|
||||
}
|
||||
|
||||
.detail {
|
||||
font-size: 28rpx;
|
||||
color: #323232;
|
||||
font-family: OPPOSANS;
|
||||
}
|
||||
}
|
||||
|
||||
.all-rpice-item {
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
|
||||
.title {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #3b3b3b;
|
||||
line-height: normal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.all-price {
|
||||
color: #ee0a24 !important;
|
||||
}
|
||||
|
||||
// 底部
|
||||
.footer-box {
|
||||
height: 100rpx;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
border-radius: 10rpx;
|
||||
padding-right: 20rpx;
|
||||
|
||||
.cancel-btn {
|
||||
width: 160rpx;
|
||||
height: 60rpx;
|
||||
background: #eeeeee;
|
||||
border-radius: 30rpx;
|
||||
margin-right: 20rpx;
|
||||
font-size: 26rpx;
|
||||
font-weight: 400;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.pay-btn {
|
||||
width: 160rpx;
|
||||
height: 60rpx;
|
||||
font-size: 26rpx;
|
||||
border-radius: 30rpx;
|
||||
font-weight: 500;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.cityImg {
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
margin-top: 16rpx;
|
||||
margin-right: 16rpx;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.order-goods {
|
||||
padding: 24rpx 20rpx;
|
||||
box-sizing: border-box;
|
||||
background-color: #fff;
|
||||
margin-bottom: 24rpx;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
|
||||
.right {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.copy {
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
margin-left: 14rpx;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.orderBan {
|
||||
height: 100rpx;
|
||||
width: 100%;
|
||||
padding: 0 24rpx;
|
||||
box-sizing: border-box;
|
||||
box-shadow: 0px -4px 30px 0px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.btns {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
padding: 10rpx 32rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,365 @@
|
||||
<template>
|
||||
<s-pages title="AI店铺" :goLeft="false" @onClickLeft="onClickLeft">
|
||||
<view class="p-x-32 h100 flex-column">
|
||||
<view class="search flex-center m-t-48 m-b-56">
|
||||
<view class="searchLeft flex1 flex-center p-l-40 p-r-40">
|
||||
<uni-icons class="m-r-20" type="search" color="#8F8F8F" size="" />
|
||||
<uni-easyinput
|
||||
class="flex1"
|
||||
v-model="searchText"
|
||||
type="text"
|
||||
placeholder="请搜索想要的商品"
|
||||
:inputBorder="false"
|
||||
@blur="search"
|
||||
@clear="clearSearch"
|
||||
placeholderStyle="color: #D3D3D3;font-size: 28rpx;"
|
||||
:styles="{ color: '', fontSize: '28rpx' }"
|
||||
/>
|
||||
</view>
|
||||
<view class="m-l-24" @click="search">搜索</view>
|
||||
</view>
|
||||
<view class="flex1">
|
||||
<card_pages
|
||||
ref="pageCommodity"
|
||||
:navList="nav"
|
||||
:currentTab="index"
|
||||
@upCallback="getData"
|
||||
:height="height + 'px'"
|
||||
:oneShow="true"
|
||||
>
|
||||
<template #nav>
|
||||
<view class="flex-center ju-flex-start">
|
||||
<view
|
||||
v-for="(tab, i) in nav"
|
||||
:key="tab.id"
|
||||
class="m-r-32 navItem flex-center flex-column size28 line32 c28"
|
||||
:class="{ active: index == i, c29: index == i }"
|
||||
@click="navChange(i)"
|
||||
>
|
||||
<view class="">
|
||||
{{ tab.name }}
|
||||
</view>
|
||||
<view class="navIcon p-b-10">
|
||||
<image class="w100" :src="$ygUrl + 'ai_index_current.png'" mode="widthFix" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="m-b-20" v-if="timeRound.length && index === 0">
|
||||
<scroll-view scroll-x class="time-scroll">
|
||||
<view class="flex">
|
||||
<view
|
||||
v-for="(item, i) in timeRound"
|
||||
:key="i"
|
||||
class="timeNav m-r-30"
|
||||
:class="{ activeTime: selectedTimeId === item.id }"
|
||||
@click="changeTimeRound(item, i)"
|
||||
>
|
||||
{{ item.name }}
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
<template #content>
|
||||
<view class="p-t-16">
|
||||
<view class="m-b-24" v-for="(v, i) in dataList" :key="i">
|
||||
<aiOrder
|
||||
:data="v"
|
||||
@addCar="addCar"
|
||||
:source="index"
|
||||
@update="update"
|
||||
@shipment="shipment"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
</card_pages>
|
||||
</view>
|
||||
</view>
|
||||
<view class="" v-if="payShow">
|
||||
<card_payment
|
||||
ref="paymentRef"
|
||||
@updataList="clearSearch"
|
||||
@updatePrice="updatePrice"
|
||||
:addShow="addShow"
|
||||
:minSalesCountShow="navName == '折扣区' ? true : false"
|
||||
/>
|
||||
</view>
|
||||
</s-pages>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref, reactive, onMounted, watch, getCurrentInstance } from 'vue';
|
||||
import SpuApi from '@/sheep/api/product/spu';
|
||||
import CartApi from '@/sheep/api/trade/cart.js';
|
||||
import * as api from '@/sheep/api/ai/index';
|
||||
import aiOrder from '@/components/ai_order/ai_order';
|
||||
import card_payment from '@/components/card_payment/card_payment';
|
||||
import { onShow } from '@dcloudio/uni-app';
|
||||
const { proxy } = getCurrentInstance();
|
||||
const searchText = ref('');
|
||||
const search = (text = '') => {
|
||||
pageCommodity.value.downCallback();
|
||||
};
|
||||
const clearSearch = () => {
|
||||
searchText.value = '';
|
||||
pageCommodity.value.downCallback();
|
||||
};
|
||||
const getCartList = async () => {
|
||||
let res = await api.getShopCartList({});
|
||||
if (res.code === 0) {
|
||||
if (res.data.length || addShow.value) {
|
||||
payShow.value = true;
|
||||
} else {
|
||||
payShow.value = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/* 选品广场时间轮次 */
|
||||
const timeRound = ref([]);
|
||||
const selectedTimeId = ref(null);
|
||||
let navName = ref('');
|
||||
function changeTimeRound(e, i) {
|
||||
navName.value = e.name;
|
||||
selectedTimeId.value = e?.id ?? null;
|
||||
if (pageCommodity.value) {
|
||||
pageCommodity.value.downCallback();
|
||||
}
|
||||
}
|
||||
|
||||
function getSpuTimeList() {
|
||||
api.getSpuTimeList({}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
timeRound.value = res.data || [];
|
||||
selectedTimeId.value = timeRound.value?.[0]?.id ?? null;
|
||||
navName.value = timeRound.value?.[0]?.name;
|
||||
}
|
||||
});
|
||||
}
|
||||
/* */
|
||||
onShow(() => {
|
||||
getSpuTimeList();
|
||||
getCartList();
|
||||
|
||||
// if(paymentRef.value){
|
||||
// paymentRef.value.getCartList()
|
||||
// }
|
||||
});
|
||||
const update = () => {
|
||||
if (pageCommodity.value) {
|
||||
pageCommodity.value.downCallback();
|
||||
}
|
||||
};
|
||||
// 购物车数据
|
||||
let carArr = ref([]);
|
||||
let height = ref(0);
|
||||
let system = uni.getSystemInfoSync();
|
||||
let h =
|
||||
system.windowHeight -
|
||||
system.statusBarHeight -
|
||||
uni.upx2px(88) -
|
||||
uni.upx2px(76) -
|
||||
uni.upx2px(48) -
|
||||
uni.upx2px(67) -
|
||||
uni.upx2px(70) +
|
||||
uni.upx2px(8);
|
||||
let index = ref(0);
|
||||
let price = ref(0);
|
||||
let payShow = ref(false);
|
||||
let addShow = ref(false);
|
||||
watch(
|
||||
() => [payShow.value],
|
||||
() => {
|
||||
if (payShow.value) {
|
||||
height.value = h - uni.upx2px(128);
|
||||
} else {
|
||||
height.value = h;
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
deep: true,
|
||||
},
|
||||
);
|
||||
// watch(
|
||||
// () => [carArr.value, index.value,price.value],
|
||||
// () => {
|
||||
// if (carArr.value.length && !index.value && price.value > 0) {
|
||||
// payShow.value = true
|
||||
// height.value = h - uni.upx2px(128);
|
||||
// } else {
|
||||
// payShow.value = false
|
||||
// height.value = h;
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// immediate: true,
|
||||
// deep: true,
|
||||
// },
|
||||
// );
|
||||
let nav = ref([
|
||||
{
|
||||
name: '选品广场',
|
||||
id: 1,
|
||||
},
|
||||
{
|
||||
name: '我的店铺',
|
||||
id: 2,
|
||||
},
|
||||
]);
|
||||
let pageCommodity = ref(null);
|
||||
let dataList = ref([]);
|
||||
const getData = async (mescroll) => {
|
||||
if (mescroll.dataObj.index != index.value) {
|
||||
return;
|
||||
}
|
||||
let res = null;
|
||||
if (index.value) {
|
||||
res = await api.getOrderPage({
|
||||
pageNo: mescroll?.num || 1,
|
||||
pageSize: mescroll?.size || 10,
|
||||
keyWord: searchText.value,
|
||||
});
|
||||
} else {
|
||||
res = await api.getSpuPage({
|
||||
pageNo: mescroll?.num || 1,
|
||||
pageSize: mescroll?.size || 10,
|
||||
keyWord: searchText.value,
|
||||
timeId: selectedTimeId.value,
|
||||
...mescroll.params,
|
||||
});
|
||||
}
|
||||
|
||||
// CartApi.getCartList()
|
||||
if (res.code !== 0) {
|
||||
pageCommodity.value.getState(false);
|
||||
return;
|
||||
}
|
||||
let curPageData = []; // 当前页数据
|
||||
if (index.value) {
|
||||
let list = res.data.list;
|
||||
let arr = [];
|
||||
if (list.length) {
|
||||
list.forEach((e) => {
|
||||
e.items1 = JSON.parse(JSON.stringify(e.items));
|
||||
if (e?.items?.length) {
|
||||
e.items.forEach((item) => {
|
||||
item.skuArr = item.items;
|
||||
item.status = e.status;
|
||||
item.id = item.spuId;
|
||||
item.spuId = e.payOrderId;
|
||||
item.shoppingPlazaId = e.roundTimeId;
|
||||
item.items1 = e.items1
|
||||
arr.push(item);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
// 多规格
|
||||
if (arr.length) {
|
||||
arr.forEach((e) => {
|
||||
if (e.skuArr && e.skuArr.length) {
|
||||
e.skuArr.forEach((item) => {
|
||||
item.propertyText = '';
|
||||
if (item?.properties) {
|
||||
item.properties.forEach((e1) => {
|
||||
item.propertyText += e1.valueName + ' ';
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
curPageData = arr;
|
||||
} else {
|
||||
curPageData = res.data?.list || [];
|
||||
}
|
||||
if (mescroll?.num == 1) {
|
||||
dataList.value = [];
|
||||
}
|
||||
dataList.value = dataList.value.concat(curPageData);
|
||||
console.log(dataList.value);
|
||||
pageCommodity.value.getState(true, curPageData.length);
|
||||
};
|
||||
let paymentRef = ref(null);
|
||||
const addCar = (data) => {
|
||||
payShow.value = true;
|
||||
addShow.value = true;
|
||||
setTimeout(() => {
|
||||
if (paymentRef.value) {
|
||||
paymentRef.value.addCar(data);
|
||||
}
|
||||
}, 500);
|
||||
};
|
||||
const navChange = (i) => {
|
||||
index.value = i;
|
||||
dataList.value = [];
|
||||
if (pageCommodity.value) {
|
||||
pageCommodity.value.downCallback();
|
||||
}
|
||||
if (index.value) {
|
||||
payShow.value = false;
|
||||
} else {
|
||||
payShow.value = true;
|
||||
}
|
||||
};
|
||||
const onClickLeft = () => {
|
||||
uni.reLaunch({
|
||||
url: '/pages/AI/member',
|
||||
});
|
||||
};
|
||||
const updatePrice = (val) => {
|
||||
addShow.value = val;
|
||||
getCartList();
|
||||
};
|
||||
//延迟/立即发货
|
||||
function shipment(e) {
|
||||
pageCommodity.value.downCallback();
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.time-scroll {
|
||||
width: 100%;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.timeNav {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
.searchLeft {
|
||||
background: #fff;
|
||||
height: 72rpx;
|
||||
border-radius: 36rpx;
|
||||
}
|
||||
|
||||
.navItem {
|
||||
.navIcon {
|
||||
opacity: 0;
|
||||
width: 39rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.active {
|
||||
font-size: 32rpx !important;
|
||||
|
||||
.navIcon {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.c28 {
|
||||
color: #000 !important;
|
||||
}
|
||||
|
||||
.c29 {
|
||||
color: #fb4d32 !important;
|
||||
}
|
||||
|
||||
.activeTime {
|
||||
color: #fb4d32;
|
||||
font-weight: 600;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,632 @@
|
||||
<template>
|
||||
<s-layout navbar="inner" :goLeft="false" @onClickLeft="onClickLeft" theme="2" color="#ffffff" :index="1000">
|
||||
<view class="theme-ai pages bg1" :style="{ top: -height + 'px' }">
|
||||
<view class="w100 bg">
|
||||
<image class="w100" :src="$ygUrl + 'ai_member_bg.png'" mode="widthFix" />
|
||||
</view>
|
||||
<view class="con p-t-282 p-x-32">
|
||||
<view class="w100 flex-center m-b-48">
|
||||
<view class="titleImg">
|
||||
<image class="w100" :src="$ygUrl + 'member_1.png'" mode="widthFix" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="arr flex-row wrap w100 m-b-24">
|
||||
<view class="item m-b-32" v-for="(v, i) in arr" :key="i">
|
||||
<view class="itemBg">
|
||||
<image class="w100" :src="$ygUrl + 'member_2.png'" mode="scaleToFill" />
|
||||
</view>
|
||||
<view class="itemCon flex-center p-y-24 p-l-8 p-r-22">
|
||||
<view class="itemIcon shrink">
|
||||
<image :src="v.icon" mode="widthFix" />
|
||||
</view>
|
||||
<view>
|
||||
<view class="t1 size28 m-b-8 line38">{{ v.title }}</view>
|
||||
<view class="t2 size22">{{ v.title1 }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 等级 -->
|
||||
<view class="card3" v-if="!status && openStatus === 0">
|
||||
<view class="card3_bg">
|
||||
<image class="w100" :src="$ygUrl + 'ai_member_bg2.png'" mode="scaleToFill" />
|
||||
</view>
|
||||
<view class="text1 size24 p-x-14"> 限时福利 </view>
|
||||
<view class="card3_img1">
|
||||
<image class="w100" :src="$url + 'ai/member/9.png'" mode="widthFix" />
|
||||
</view>
|
||||
|
||||
<view class="card3_con flex-center ju-flex-start p-t-54 p-b-44 p-l-22">
|
||||
<view class="card3_img m-r-30">
|
||||
<image class="w100" :src="$ygUrl + 'member_icon_5.png'" mode="widthFix" />
|
||||
</view>
|
||||
<view class="m-r-16">
|
||||
<view class="m-b-8 c_money size56 weight900"><span class="size32">¥</span>{{
|
||||
getPriceRes.activityPrice }}</view>
|
||||
<view class="c12 through size24">原价¥{{ getPriceRes.originalPrice }}</view>
|
||||
</view>
|
||||
<view>
|
||||
<view class="size32 c10 f500">数字居民</view>
|
||||
<view class="size24 c11">尊贵身份 居民特享</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="status && levelObj && levelObj.bgIcon" class="h_244 m-b-32 relative">
|
||||
<view class="h100 w100">
|
||||
<image class="h100 w100" :src="$url + levelObj.bgIcon" mode="scaleToFill" />
|
||||
</view>
|
||||
<view class="absolute w100 h100 flex-column ju-between t0 l0">
|
||||
<view class="flex-row">
|
||||
<view class="size22 p-x-16 h_40 line40 center m-t-4 m-l-4" :style="{
|
||||
background: levelObj.color2,
|
||||
color: levelObj.color1,
|
||||
borderRadius: '16rpx 0 16rpx 0',
|
||||
}">
|
||||
当前等级<span v-if="level">V{{ level }}</span>
|
||||
</view>
|
||||
</view>
|
||||
<view class="w_190 h_174 absolute t-32 r40">
|
||||
<image class="w100 h100" :src="$url + levelObj.icon1" mode="scaleToFill" />
|
||||
</view>
|
||||
<view class="flex al-flex-end h_72">
|
||||
<image class="w_208 h100 m-l-34" :src="$url + levelObj.textIcon" mode="scaleToFill" />
|
||||
<!-- <view class="m-b-10">
|
||||
<uni-icons type="star-filled" size="18" :color="levelObj.color1" v-for="(item,i) in 0" :key="i" />
|
||||
</view> -->
|
||||
<uni-rate :value="levelObj.levelStartNum" :max="levelObj.levelStarMax" size="18"
|
||||
:color="levelObj.color2" :active-color="levelObj.color1" readonly class="m-b-10"
|
||||
v-if="level !== 3 && status === 1" />
|
||||
</view>
|
||||
<view class="progress relative m-l-34">
|
||||
<view class="w100 absolute t0 l0 h_8" :style="{ background: levelObj.bg2 }"></view>
|
||||
<view class="absolute t0 l0 h_8" :style="{
|
||||
background: levelObj.bg1,
|
||||
width: `${userInfo?.progress?.currentProgress || 0}%`,
|
||||
}">
|
||||
</view>
|
||||
<view class="absolute t-4 w_16 h_16 qiu radius16" :style="{
|
||||
background: levelObj.bg1,
|
||||
left: `${userInfo?.progress?.currentProgress || 0}%`,
|
||||
}">
|
||||
</view>
|
||||
<view class="absolute t-34 w_80 center size20" :style="{
|
||||
color: levelObj.bg1,
|
||||
marginLeft: '-40rpx',
|
||||
left: `${userInfo?.progress?.currentProgress || 0}%`,
|
||||
}">
|
||||
<!-- {{ parseInt(userInfo?.progress?.currentProgress) || 0 }}% -->
|
||||
</view>
|
||||
</view>
|
||||
<view class="m-l-34 m-b-18 weight500 size22" :style="{ color: levelObj.color3 }">
|
||||
{{ levelObj.text }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- m-b-258 -->
|
||||
<view class="card4" v-if="mesArr.length">
|
||||
<maoScroll :data="mesArr" :lineHeight="72" :animation="1000" :animationScroll="1000" :showNum="3">
|
||||
<template #default="{ line }">
|
||||
<view class="bg14 radius8 p-x-16 flex-center ju-flex-start h100"
|
||||
style="display: line-block">
|
||||
<view class="m-r-18 userImg flex-center">
|
||||
<image class="w_56 h_56" :src="line.avatar" mode="scaleToFill" v-if="line.avatar"
|
||||
style="border-radius: 50%" />
|
||||
<image v-else class="w_56 h_56" :src="`${$url}home/head.png`" mode="scaleToFill"
|
||||
style="border-radius: 50%" />
|
||||
<view class="userType" v-if="userType[parseInt(line.userType)]?.icon">
|
||||
<image class="w_20 h_20" :src="$url + userType[parseInt(line.userType)]?.icon"
|
||||
mode="scaleToFill" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="size28 line54" v-html="line.messageContent"></view>
|
||||
</view>
|
||||
</template>
|
||||
</maoScroll>
|
||||
</view>
|
||||
|
||||
<!-- 商品 v-if="!status"-->
|
||||
<view class="goods-wrap m-b-258">
|
||||
<view class="goods-item" v-for="(item, i) in goods_list">
|
||||
<view class="pic">
|
||||
<view class="buy-status" v-if="status"> 已购买 </view>
|
||||
<image :src="item.picUrl" />
|
||||
</view>
|
||||
<view class="right">
|
||||
<view>
|
||||
<view class="title lineTwo">
|
||||
{{ item.name }}
|
||||
</view>
|
||||
<view class="spec">
|
||||
<!-- xx | xx -->
|
||||
</view>
|
||||
</view>
|
||||
<view class="bottom">
|
||||
<view class="price"> <text>¥</text>{{ $fen2yuan(item.price) }} </view>
|
||||
<view class="btn" @click="buyGoods(item)" v-if="!status && num"> 立即购买 </view>
|
||||
<view class="btn" @click="goOrderDetail(item)" v-if="status"> 订单详情 </view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="card6 bg1">
|
||||
<view class="ai-button" @click="sub" v-if="!status && num && openStatus === 0">
|
||||
立即开通
|
||||
</view>
|
||||
<view class="ai-button" @click="sub" v-if="status"> 进入店铺 </view>
|
||||
<view class="card5">
|
||||
<view class="radio-box">
|
||||
<radio-group @change="radioChange">
|
||||
<label class="flex-center ju-flex-start">
|
||||
<radio color="#FB4D32" class="radio" value="1" :checked="radioValue" />
|
||||
<view class="flex-center size24">
|
||||
我已阅读并同意
|
||||
<text class="c8" @click="go()">《臻选优购服务协议》</text>
|
||||
</view>
|
||||
</label>
|
||||
</radio-group>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</s-layout>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted, onUnmounted, getCurrentInstance, watch, nextTick } from 'vue';
|
||||
import { onShow } from '@dcloudio/uni-app';
|
||||
import maoScroll from '@/components/mao-scroll/mao-scroll';
|
||||
import { userType } from '@/sheep/helper/user';
|
||||
import * as api from '@/sheep/api/ai';
|
||||
import sheep from '@/sheep';
|
||||
let openStatus = ref(0); //判断是需要开通商品 0-不发货,1-发货
|
||||
let { proxy } = getCurrentInstance();
|
||||
let arr = ref([
|
||||
{
|
||||
icon: proxy.$ygUrl + 'member_icon_1.png',
|
||||
title: '品牌中国 数字家园',
|
||||
title1: '中国塑品牌 数字建家园',
|
||||
},
|
||||
{
|
||||
icon: proxy.$ygUrl + 'member_icon_2.png',
|
||||
title: '权益代码 数字账本',
|
||||
title1: '代码明权属 账本存变动',
|
||||
},
|
||||
{
|
||||
icon: proxy.$ygUrl + 'member_icon_3.png',
|
||||
title: '数据驱动 平台赋能',
|
||||
title1: '数据驱决策 平台赋动能',
|
||||
},
|
||||
{
|
||||
icon: proxy.$ygUrl + 'member_icon_4.png',
|
||||
title: '高维素质 数字世界',
|
||||
title1: '素质提维度 适配数字境',
|
||||
},
|
||||
]);
|
||||
let mesArr = ref([]);
|
||||
let orderId = ref();
|
||||
let getPriceRes = reactive({
|
||||
originalPrice: 0,
|
||||
activityPrice: 0,
|
||||
});
|
||||
const radioValue = ref();
|
||||
let goods_list = ref([]);
|
||||
const radioChange = (e) => {
|
||||
radioValue.value = e.detail.value;
|
||||
};
|
||||
const go = () => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/home/agreement?type=4',
|
||||
});
|
||||
};
|
||||
const goAIindex = () => {
|
||||
proxy.utils.go('/pages/AI/index');
|
||||
};
|
||||
function buyGoods(e) {
|
||||
if (!radioValue.value) {
|
||||
proxy.utils.toast('请先阅读并同意协议');
|
||||
return;
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: `/pages/AI/giftOrder?id=${e.id}`,
|
||||
});
|
||||
}
|
||||
function goOrderDetail(e) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/AI/giftOrderInfo?id=${orderId.value}`,
|
||||
});
|
||||
}
|
||||
const sub = async () => {
|
||||
if (radioValue.value) {
|
||||
// proxy.utils.toast('开通成功');
|
||||
// setTimeout(() => {
|
||||
// proxy.utils.go('/pages/AI/index');
|
||||
// }, 1000);
|
||||
if (status.value) {
|
||||
proxy.utils.go('/pages/AI/index');
|
||||
return;
|
||||
}
|
||||
let res = await api.createOpen({});
|
||||
setTimeout(() => {
|
||||
proxy.utils.go('/pages/AI/cashierDesk', {
|
||||
id: res.data.id,
|
||||
payOrderId: res.data.payOrderId,
|
||||
type: 2,
|
||||
price: getPriceRes.activityPrice,
|
||||
});
|
||||
}, 1000);
|
||||
} else {
|
||||
proxy.utils.toast('请先阅读并同意协议');
|
||||
}
|
||||
};
|
||||
let userInfo = ref({});
|
||||
let level = ref(0);
|
||||
let levelObj = ref({});
|
||||
const getInfo = async () => {
|
||||
let res: any = await api.getLevelInfo({});
|
||||
if (res.code === 0) {
|
||||
userInfo.value = res.data;
|
||||
level.value = res.data.currentLevel?.level;
|
||||
levelObj.value = userType[level.value];
|
||||
//星星(推荐人)最大数量限制
|
||||
if (level.value === 0) {
|
||||
levelObj.value.levelStarMax = 5;
|
||||
} else {
|
||||
levelObj.value.levelStarMax = 3;
|
||||
}
|
||||
//星星(推荐人)数量
|
||||
if (res.data.currentLevel.level === 3) {
|
||||
levelObj.value.levelStartNum = 3;
|
||||
} else {
|
||||
levelObj.value.levelStartNum = 5 - Number(res.data.progress.upgradeRequirements.slice(2, 3));
|
||||
}
|
||||
// console.log(levelObj.value);
|
||||
}
|
||||
};
|
||||
let num = ref(0);
|
||||
let status = ref(0); // 0 未开通 1 已开通
|
||||
//获取是否开通商品发货
|
||||
async function getOpenStatus() {
|
||||
const res = await api.getAiOpenStatus();
|
||||
openStatus.value = res.data;
|
||||
return res;
|
||||
}
|
||||
const loadPageData = async () => {
|
||||
uni.showLoading({ title: '加载中' });
|
||||
try {
|
||||
const [openStatusRes, statusRes, messageRes, remainingRes, priceRes] = await Promise.all([
|
||||
api.getAiOpenStatus(),
|
||||
api.checkShopStatus({}),
|
||||
api.getMessageList({ pageNo: 1, pageSize: 10 }),
|
||||
api.getRemainingCount({}),
|
||||
api.getPrice(),
|
||||
]);
|
||||
openStatus.value = openStatusRes.data;
|
||||
status.value = statusRes.data;
|
||||
await getProduct(status.value);
|
||||
if (status.value) {
|
||||
radioValue.value = true;
|
||||
await getInfo();
|
||||
}
|
||||
mesArr.value = messageRes.code === 0 ? messageRes.data : [];
|
||||
num.value = remainingRes.data;
|
||||
if (remainingRes.code === 0 && remainingRes.data <= 0 && !status.value) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: 'AI店铺开通数量已用完,请联系客服',
|
||||
cancelText: '返回',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
} else if (res.cancel) {
|
||||
uni.navigateBack({ delta: 1 });
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
getPriceRes.activityPrice = Number(priceRes.data.activityPrice).toFixed(2);
|
||||
getPriceRes.originalPrice = Number(priceRes.data.originalPrice).toFixed(2);
|
||||
} finally {
|
||||
uni.hideLoading();
|
||||
}
|
||||
};
|
||||
onShow(async () => {
|
||||
await loadPageData();
|
||||
});
|
||||
const onClickLeft = () => {
|
||||
uni.switchTab({ url: '/pages/index/index' });
|
||||
};
|
||||
let sysInfo = uni.getSystemInfoSync();
|
||||
const windowHeight = sysInfo.windowHeight;
|
||||
let height = ref(0);
|
||||
height.value = sysInfo.statusBarHeight + uni.upx2px(88);
|
||||
|
||||
//获取开通ai店铺赠送商品
|
||||
function getProduct(status) {
|
||||
if (status === 1) {
|
||||
api.getGiftOrder().then((res) => {
|
||||
orderId.value = res.data.id;
|
||||
// console.log(res);
|
||||
if (res.data) {
|
||||
res.data.items.forEach((e) => {
|
||||
e.name = e.spuName;
|
||||
});
|
||||
goods_list.value = res.data.items;
|
||||
}
|
||||
});
|
||||
} else if (status === 0) {
|
||||
if (openStatus.value === 1) {
|
||||
api.getAiProduct({
|
||||
pageNo: 1,
|
||||
pageSize: 100,
|
||||
}).then((res) => {
|
||||
goods_list.value = res.data.list;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.card4 {
|
||||
margin-bottom: 60rpx;
|
||||
}
|
||||
|
||||
.pages {
|
||||
min-height: 100vh;
|
||||
position: relative;
|
||||
padding-bottom: 84rpx;
|
||||
|
||||
.bg {
|
||||
z-index: 1;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.con {
|
||||
position: relative;
|
||||
z-index: 20;
|
||||
|
||||
.goods-wrap {
|
||||
.goods-item {
|
||||
margin-bottom: 24rpx;
|
||||
display: flex;
|
||||
|
||||
.pic {
|
||||
width: 206rpx;
|
||||
min-width: 206rpx;
|
||||
height: 206rpx;
|
||||
background: #d8d8d8;
|
||||
border-radius: 12rpx;
|
||||
overflow: hidden;
|
||||
margin-right: 16rpx;
|
||||
position: relative;
|
||||
z-index: 0;
|
||||
|
||||
.buy-status {
|
||||
background: #366eee;
|
||||
// display: inline-flex;
|
||||
border-radius: 0 0 12rpx 0;
|
||||
font-size: 16rpx;
|
||||
line-height: 28rpx;
|
||||
padding: 0 8rpx;
|
||||
position: absolute;
|
||||
color: #fff;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.right {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
// color: #FFFFFF;
|
||||
line-height: 34rpx;
|
||||
}
|
||||
|
||||
.spec {
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
line-height: 30rpx;
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
|
||||
.bottom {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
.price {
|
||||
color: #ee0a24;
|
||||
line-height: 42rpx;
|
||||
|
||||
text {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.btn {
|
||||
line-height: 54rpx;
|
||||
border-radius: 94rpx;
|
||||
background: linear-gradient(270deg, var(--color3) 0%, var(--color2) 99%);
|
||||
padding: 0 24rpx;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.titleImg {
|
||||
width: calc(566 / 686 * 100%);
|
||||
}
|
||||
|
||||
.arr {
|
||||
.item {
|
||||
width: calc(100% / 2 - 15rpx);
|
||||
margin-right: 30rpx;
|
||||
|
||||
&:nth-child(2n) {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
position: relative;
|
||||
|
||||
.itemBg {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.itemIcon {
|
||||
width: 60rpx;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.itemCon {
|
||||
position: relative;
|
||||
|
||||
.t1 {
|
||||
color: #f13428;
|
||||
}
|
||||
|
||||
.t2 {
|
||||
color: #f7772e;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.card3 {
|
||||
position: relative;
|
||||
margin-bottom: 44rpx;
|
||||
|
||||
.f500 {
|
||||
color: #fb4d32 !important;
|
||||
}
|
||||
|
||||
.c11 {
|
||||
color: #f7772e !important;
|
||||
}
|
||||
|
||||
.card3_img {
|
||||
width: 108rpx;
|
||||
}
|
||||
|
||||
.card3_bg {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.card3_con {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.text1 {
|
||||
position: absolute;
|
||||
left: 28rpx;
|
||||
top: -20rpx;
|
||||
line-height: 40rpx;
|
||||
background: linear-gradient(128deg, #f1873b 0%, #ec5d2d 99%);
|
||||
color: #fff;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
|
||||
.card3_img1 {
|
||||
width: 129rpx;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.card4 {
|
||||
.bg14 {
|
||||
background: #fff !important;
|
||||
}
|
||||
}
|
||||
|
||||
.card5 {
|
||||
margin-top: 20rpx;
|
||||
|
||||
.c8 {
|
||||
color: #fb4d32 !important;
|
||||
}
|
||||
|
||||
.radio-box {}
|
||||
|
||||
.radio {
|
||||
transform: scale(0.6);
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.uni-radio-input) {
|
||||
background-color: rgba($color: #000000, $alpha: 0);
|
||||
}
|
||||
|
||||
.userImg {
|
||||
position: relative;
|
||||
|
||||
.userType {
|
||||
position: absolute;
|
||||
bottom: 0rpx;
|
||||
right: -10rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.card5 {}
|
||||
|
||||
.card6 {
|
||||
width: 100%;
|
||||
position: fixed;
|
||||
bottom: 0rpx;
|
||||
left: 0;
|
||||
padding: 0 32rpx;
|
||||
box-sizing: border-box;
|
||||
padding-top: 24rpx;
|
||||
padding-bottom: 50rpx;
|
||||
|
||||
.ai-button {
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.progress {
|
||||
width: 63%;
|
||||
}
|
||||
|
||||
.qiu {}
|
||||
|
||||
.level-title {
|
||||
font-family: YouSheBiaoTiHei, YouSheBiaoTiHei;
|
||||
font-weight: 400;
|
||||
font-size: 51rpx;
|
||||
line-height: 66rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,524 @@
|
||||
<!-- 订单详情 -->
|
||||
<template>
|
||||
<s-pages title="订单详情">
|
||||
<view class="flex-center al-flex-end ju-between p-x-32 m-b-54">
|
||||
<view>
|
||||
<view class="size40 weight500 m-b-16">{{ statusObj[state.orderInfo.status]?.text }}</view>
|
||||
<view class="size24">{{ statusObj[state.orderInfo.status]?.text1 }}</view>
|
||||
</view>
|
||||
<view class="w_120 h_120" v-if="statusObj[state.orderInfo.status]?.icon">
|
||||
<image
|
||||
class="w100 h100"
|
||||
:src="statusObj[state.orderInfo.status]?.icon"
|
||||
mode="scaleToFill"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 收货地址 -->
|
||||
<view class="order-address-box flex-row bg24 c0" v-if="state.orderInfo.receiverAreaId > 0">
|
||||
<view class="cityImg">
|
||||
<image :src="`${$url}goods/city1.png`" mode="scaleToFill" />
|
||||
</view>
|
||||
<view class="size32">
|
||||
<view class="ss-flex ss-col-center">
|
||||
<text class="address-username">
|
||||
{{ state.orderInfo.receiverName }}
|
||||
</text>
|
||||
<text class="address-phone">{{ state.orderInfo.receiverMobile }}</text>
|
||||
</view>
|
||||
<view class="address-detail size32">
|
||||
{{ state.orderInfo.receiverAreaName }} {{ state.orderInfo.receiverDetailAddress }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view
|
||||
class="detail-goods"
|
||||
:style="[{ marginTop: state.orderInfo.receiverAreaId > 0 ? '0' : '-40rpx' }]"
|
||||
>
|
||||
<card_order
|
||||
theme="2"
|
||||
class="order-goods"
|
||||
v-if="state?.orderInfo?.items?.length > 0"
|
||||
:data="state.orderInfo"
|
||||
type="4"
|
||||
@getOrderDetail="getOrderDetail"
|
||||
></card_order>
|
||||
|
||||
<!-- 价格信息 -->
|
||||
<view class="order-price-box bg24">
|
||||
<view class="notice-item ss-flex ss-row-between" v-for="(v, i) in priceArr" :key="i">
|
||||
<text class="title c25">{{ v.title }}</text>
|
||||
<view class="ss-flex">
|
||||
<text class="detail c0" :class="{ 'all-price': v.value == 'payPrice' }"
|
||||
><span>{{ v.type == 2 ? '-' : '' }}</span
|
||||
>¥{{ fen2yuan(state.orderInfo[v.value]) }}</text
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 订单信息 -->
|
||||
<view
|
||||
class="notice-box bg24"
|
||||
:class="{
|
||||
'm-b-90':
|
||||
statusObj[state.orderInfo.status]?.btn1 || statusObj[state.orderInfo.status]?.btn2,
|
||||
}"
|
||||
>
|
||||
<view class="notice-box__content">
|
||||
<view class="notice-item--center">
|
||||
<view class="ss-flex ss-flex-1 flex-row ju-between">
|
||||
<text class="title c25">订单编号</text>
|
||||
<text class="detail right c0">{{ state.orderInfo.no }}</text>
|
||||
</view>
|
||||
<view class="copy" @click.stop="onCopy">
|
||||
<image :src="`${$url}goods/copy2.svg`" mode="scaleToFill" />
|
||||
</view>
|
||||
<!-- <truckLine :data="state.orderInfo" :code="2" v-if="state.orderInfo.deliveryTime"></truckLine> -->
|
||||
</view>
|
||||
<view class="notice-item flex-row ju-between">
|
||||
<text class="title c25">下单时间</text>
|
||||
<text class="detail right c0">
|
||||
{{ sheep.$helper.timeFormat(state.orderInfo.createTime, 'yyyy-mm-dd hh:MM:ss') }}
|
||||
</text>
|
||||
</view>
|
||||
<view class="notice-item flex-row ju-between" v-if="state.orderInfo.payTime">
|
||||
<text class="title c25">支付时间:</text>
|
||||
<text class="detail right c0">
|
||||
{{ sheep.$helper.timeFormat(state.orderInfo.payTime, 'yyyy-mm-dd hh:MM:ss') }}
|
||||
</text>
|
||||
</view>
|
||||
<view class="notice-item flex-row ju-between">
|
||||
<text class="title c25">支付方式</text>
|
||||
<text class="detail right c0">{{ state.orderInfo.payChannelName || '-' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="flex btns bg16"
|
||||
v-if="statusObj[state.orderInfo.status]?.btn1 || statusObj[state.orderInfo.status]?.btn2"
|
||||
>
|
||||
<view
|
||||
class="ai-button1 h_70 line70 size28"
|
||||
:class="{
|
||||
'm-r-28': statusObj[state.orderInfo.status]?.btn2,
|
||||
}"
|
||||
v-if="statusObj[state.orderInfo.status]?.btn1"
|
||||
@click="btn(1)"
|
||||
>{{ statusObj[state.orderInfo.status]?.btn1 }}</view
|
||||
>
|
||||
<view
|
||||
class="ai-button3 h_70 line70 size28"
|
||||
v-if="statusObj[state.orderInfo.status]?.btn2"
|
||||
@click="btn(2)"
|
||||
>{{ statusObj[state.orderInfo.status]?.btn2 }}</view
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</s-pages>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import sheep from '@/sheep';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import { reactive, ref, getCurrentInstance } from 'vue';
|
||||
import { isEmpty } from 'lodash-es';
|
||||
import {
|
||||
fen2yuan,
|
||||
formatOrderStatus,
|
||||
formatOrderStatusDescription,
|
||||
handleOrderButtons,
|
||||
} from '@/sheep/hooks/useGoods';
|
||||
import * as OrderApi from '@/sheep/api/ai/index';
|
||||
import DeliveryApi from '@/sheep/api/trade/delivery';
|
||||
import PickUpVerify from '@/pages/order/pickUpVerify.vue';
|
||||
import card_order from '@/components/orderItem/card_order.vue';
|
||||
|
||||
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
|
||||
const headerBg = sheep.$url.css('/static/img/shop/order/order_bg.png');
|
||||
let { proxy } = getCurrentInstance();
|
||||
|
||||
const state = reactive({
|
||||
orderInfo: {},
|
||||
merchantTradeNo: '', // 商户订单号
|
||||
comeinType: '', // 进入订单详情的来源类型
|
||||
});
|
||||
let statusObj = ref({
|
||||
0: {
|
||||
text: '待付款',
|
||||
text1: '付款时间还剩余',
|
||||
btn1: '去支付',
|
||||
btn2: '取消订单',
|
||||
},
|
||||
10: {
|
||||
text: '待发货',
|
||||
text1: '您的商品即将发货...',
|
||||
icon: `${proxy.$url}ai/member/12.png`,
|
||||
},
|
||||
20: {
|
||||
text: '待收货',
|
||||
text1: '您的商品已发货,待您确认收货...',
|
||||
icon: `${proxy.$url}ai/member/12.png`,
|
||||
btn1: '确认收货',
|
||||
},
|
||||
30: {
|
||||
text: '已完成',
|
||||
text1: '您的订单已完成,感谢您的购买!',
|
||||
},
|
||||
40: {
|
||||
text: '已取消',
|
||||
text1: '您的订单已取消!',
|
||||
},
|
||||
});
|
||||
|
||||
// ========== 门店自提(核销) ==========
|
||||
const systemStore = ref({}); // 门店信息
|
||||
|
||||
// 复制
|
||||
const onCopy = () => {
|
||||
sheep.$helper.copyText(state.orderInfo.no);
|
||||
};
|
||||
|
||||
const pickUpVerifyRef = ref();
|
||||
let orderId = ref();
|
||||
|
||||
async function getOrderDetail() {
|
||||
let id = orderId.value;
|
||||
// 对详情数据进行适配
|
||||
let res;
|
||||
res = await OrderApi.getOrderDetail({ id });
|
||||
if (res.code === 0) {
|
||||
state.orderInfo = res.data;
|
||||
handleOrderButtons(state.orderInfo);
|
||||
if (state.orderInfo.deliveryType === 2 && state.orderInfo.payStatus) {
|
||||
pickUpVerifyRef.value && pickUpVerifyRef.value.markCode(res.data.pickUpVerifyCode);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
onShow(async () => {
|
||||
//onShow中获取订单列表,保证跳转后页面为最新状态
|
||||
await getOrderDetail();
|
||||
});
|
||||
onLoad(async (options) => {
|
||||
if (options.id) {
|
||||
orderId.value = options.id;
|
||||
}
|
||||
// await getOrderDetail();
|
||||
});
|
||||
|
||||
const priceArr = ref([
|
||||
{
|
||||
title: '商品金额',
|
||||
value: 'totalPrice',
|
||||
type: 1,
|
||||
},
|
||||
{
|
||||
title: '运费',
|
||||
value: 'deliveryPrice',
|
||||
type: 1,
|
||||
},
|
||||
{
|
||||
title: '实付金额',
|
||||
value: 'payPrice',
|
||||
type: 1,
|
||||
},
|
||||
]);
|
||||
const btn = async (type) => {
|
||||
if (state.orderInfo.status === 0 && type === 1) {
|
||||
// 去支付
|
||||
goPay();
|
||||
}
|
||||
if (state.orderInfo.status === 0 && type === 2) {
|
||||
// 取消订单
|
||||
cancelOrder();
|
||||
}
|
||||
if (state.orderInfo.status === 20 && type === 1) {
|
||||
// 确认收货confirmReceive
|
||||
OrderApi.confirmReceive({
|
||||
id: orderId.value,
|
||||
}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
getOrderDetail();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
const goPay = () => {
|
||||
proxy.utils.go('/pages/AI/cashierDesk', {
|
||||
id: state.orderInfo.id,
|
||||
payOrderId: state.orderInfo.payOrderId,
|
||||
});
|
||||
};
|
||||
const cancelOrder = () => {
|
||||
OrderApi.cancelOrder({
|
||||
id: orderId.value,
|
||||
}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
getOrderDetail();
|
||||
}
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.score-img {
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
margin: 0 4rpx;
|
||||
}
|
||||
|
||||
.apply-btn {
|
||||
width: 140rpx;
|
||||
height: 50rpx;
|
||||
border-radius: 25rpx;
|
||||
font-size: 24rpx;
|
||||
border: 2rpx solid #dcdcdc;
|
||||
line-height: normal;
|
||||
margin-left: 16rpx;
|
||||
}
|
||||
|
||||
.state-box {
|
||||
color: rgba(#fff, 0.9);
|
||||
width: 100%;
|
||||
background: v-bind(headerBg) no-repeat,
|
||||
linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
|
||||
background-size: 750rpx 100%;
|
||||
box-sizing: border-box;
|
||||
|
||||
.state-img {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.order-address-box {
|
||||
background-color: #fff;
|
||||
border-radius: 12rpx;
|
||||
margin: 20rpx 32rpx 24rpx 32rpx;
|
||||
padding: 24rpx 30rpx 24rpx 20rpx;
|
||||
font-size: 32rpx;
|
||||
box-sizing: border-box;
|
||||
color: #1b1b21;
|
||||
|
||||
.address-username {
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.address-detail {
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.detail-goods {
|
||||
border-radius: 10rpx;
|
||||
padding: 0 32rpx;
|
||||
|
||||
.order-list {
|
||||
margin-bottom: 20rpx;
|
||||
background-color: #fff;
|
||||
|
||||
.order-card {
|
||||
padding: 20rpx 0;
|
||||
|
||||
.order-sku {
|
||||
font-size: 24rpx;
|
||||
|
||||
font-weight: 400;
|
||||
color: rgba(153, 153, 153, 1);
|
||||
width: 450rpx;
|
||||
margin-bottom: 20rpx;
|
||||
|
||||
.order-num {
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.tag-btn {
|
||||
margin-left: 16rpx;
|
||||
font-size: 24rpx;
|
||||
height: 36rpx;
|
||||
color: var(--ui-BG-Main);
|
||||
border: 2rpx solid var(--ui-BG-Main);
|
||||
border-radius: 14rpx;
|
||||
padding: 0 4rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 订单信息。
|
||||
.notice-box {
|
||||
background: #fff;
|
||||
border-radius: 12rpx;
|
||||
margin-bottom: 24rpx;
|
||||
|
||||
.notice-box__head {
|
||||
font-size: 30rpx;
|
||||
|
||||
font-weight: 500;
|
||||
color: rgba(51, 51, 51, 1);
|
||||
line-height: 80rpx;
|
||||
border-bottom: 1rpx solid #dfdfdf;
|
||||
padding: 0 25rpx;
|
||||
}
|
||||
|
||||
.notice-box__content {
|
||||
padding: 20rpx;
|
||||
|
||||
.self-pickup-box {
|
||||
width: 100%;
|
||||
|
||||
.self-pickup--img {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
margin: 40rpx 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.notice-item,
|
||||
.notice-item--center {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
line-height: normal;
|
||||
margin-bottom: 24rpx;
|
||||
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
color: #3b3b3b;
|
||||
}
|
||||
|
||||
.detail {
|
||||
font-size: 28rpx;
|
||||
color: #323232;
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.copy-btn {
|
||||
width: 100rpx;
|
||||
line-height: 50rpx;
|
||||
border-radius: 25rpx;
|
||||
padding: 0;
|
||||
background: rgba(238, 238, 238, 1);
|
||||
font-size: 22rpx;
|
||||
font-weight: 400;
|
||||
color: rgba(51, 51, 51, 1);
|
||||
}
|
||||
|
||||
// 订单价格信息
|
||||
.order-price-box {
|
||||
background-color: #fff;
|
||||
border-radius: 12rpx;
|
||||
padding: 20rpx;
|
||||
margin-bottom: 24rpx;
|
||||
|
||||
.notice-item {
|
||||
line-height: 70rpx;
|
||||
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
color: #3b3b3b;
|
||||
}
|
||||
|
||||
.detail {
|
||||
font-size: 28rpx;
|
||||
color: #323232;
|
||||
font-family: OPPOSANS;
|
||||
}
|
||||
}
|
||||
|
||||
.all-rpice-item {
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
|
||||
.title {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #3b3b3b;
|
||||
line-height: normal;
|
||||
}
|
||||
}
|
||||
}
|
||||
.all-price {
|
||||
color: #ee0a24 !important;
|
||||
}
|
||||
|
||||
// 底部
|
||||
.footer-box {
|
||||
height: 100rpx;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
border-radius: 10rpx;
|
||||
padding-right: 20rpx;
|
||||
|
||||
.cancel-btn {
|
||||
width: 160rpx;
|
||||
height: 60rpx;
|
||||
background: #eeeeee;
|
||||
border-radius: 30rpx;
|
||||
margin-right: 20rpx;
|
||||
font-size: 26rpx;
|
||||
font-weight: 400;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.pay-btn {
|
||||
width: 160rpx;
|
||||
height: 60rpx;
|
||||
font-size: 26rpx;
|
||||
border-radius: 30rpx;
|
||||
font-weight: 500;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
.cityImg {
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
margin-top: 16rpx;
|
||||
margin-right: 16rpx;
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
.order-goods {
|
||||
padding: 24rpx 20rpx;
|
||||
box-sizing: border-box;
|
||||
background-color: #fff;
|
||||
margin-bottom: 24rpx;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
.right {
|
||||
text-align: right;
|
||||
}
|
||||
.copy {
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
margin-left: 14rpx;
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.orderBan {
|
||||
height: 100rpx;
|
||||
width: 100%;
|
||||
padding: 0 24rpx;
|
||||
box-sizing: border-box;
|
||||
box-shadow: 0px -4px 30px 0px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
.btns {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
padding: 10rpx 32rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,152 @@
|
||||
<template>
|
||||
<s-pages title="确认订单">
|
||||
<view class="p-b-132">
|
||||
<AddressSelection v-model="addressState" theme="2" @getSettlementInfo="getSettlementInfo" />
|
||||
<view class="p-x-32 m-t-24">
|
||||
<view class="bg24 p-x-20 p-t-20 radius16">
|
||||
<view v-if="settlementInfo.items && settlementInfo.items.length">
|
||||
<view class="m-b-24" v-for="(v, i) in settlementInfo.items" :key="i">
|
||||
<aiOrder :data="v" :source="3" idName="spuId"/>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-row ju-between m-b-36">
|
||||
<view class="c25 size28">商品金额</view>
|
||||
<view>¥{{ $fen2yuan(settlementInfo?.price?.payPrice || 0) }}</view>
|
||||
</view>
|
||||
<view class="flex-row ju-between m-b-36">
|
||||
<view class="c25 size28">运费</view>
|
||||
<view>¥{{ $fen2yuan(settlementInfo?.price?.deliveryPrice || 0) }}</view>
|
||||
</view>
|
||||
<view class="flex-center ju-flex-end borderTop">
|
||||
<span class="size26 line96">合计: </span>
|
||||
<span class="c13 size28 m-l-12 line96 weight900"
|
||||
>¥{{ $fen2yuan(settlementInfo?.price?.payPrice || 0) }}</span
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="p-x-32 btn">
|
||||
<view class="ai-button2" @click="sub">确认订单</view>
|
||||
</view>
|
||||
</s-pages>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted, onUnmounted, getCurrentInstance, watch, nextTick } from 'vue';
|
||||
import AddressSelection from '@/pages/order/addressSelection.vue';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import aiOrder from '@/components/ai_order/ai_order';
|
||||
import api from '@/sheep/api/member/address';
|
||||
let { proxy } = getCurrentInstance();
|
||||
import * as SpuApi from '@/sheep/api/ai/index';
|
||||
|
||||
const addressState = ref({
|
||||
addressInfo: {}, // 选择的收货地址
|
||||
deliveryType: 1, // 收货方式:1-快递配送,2-门店自提
|
||||
isPickUp: false, // 门店自提是否开启
|
||||
pickUpInfo: {}, // 选择的自提门店信息
|
||||
receiverName: '', // 收件人名称
|
||||
receiverMobile: '', // 收件人手机
|
||||
});
|
||||
|
||||
const cartList = ref([]);
|
||||
const getCartList = () => {
|
||||
SpuApi.getShopCartList({}).then((res) => {
|
||||
let list = res.data || [];
|
||||
if (list.length) {
|
||||
list.forEach((e) => {
|
||||
e.skuArr = JSON.parse(e.specification);
|
||||
});
|
||||
}
|
||||
cartList.value = list;
|
||||
});
|
||||
};
|
||||
// 获取订单结算信息
|
||||
const settlementInfo = ref({});
|
||||
let addressId = ref('');
|
||||
const getSettlementInfo = (id = '') => {
|
||||
addressId.value = id;
|
||||
SpuApi.getSettlementInfo({
|
||||
id: id,
|
||||
}).then((res) => {
|
||||
settlementInfo.value = res.data || {};
|
||||
|
||||
if (proxy.$fen2yuan(settlementInfo?.price?.payPrice || 0) >= 5000) {
|
||||
proxy.utils.toast('订单金额不能超过5000元');
|
||||
}
|
||||
if (settlementInfo.value?.items?.length) {
|
||||
settlementInfo.value.items.forEach((e) => {
|
||||
e.skuArr = e.items;
|
||||
e.skuArr.forEach((item) => {
|
||||
item.propertyText = '';
|
||||
item.properties.forEach((e1) => {
|
||||
item.propertyText += e1.valueName + ' ';
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
const sub = async () => {
|
||||
if (proxy.$fen2yuan(settlementInfo?.price?.payPrice || 0) >= 5000) {
|
||||
proxy.utils.toast('订单金额不能超过5000元, 请重新选择商品');
|
||||
return;
|
||||
}
|
||||
if (!addressId.value) return proxy.utils.toast('请选择地址');
|
||||
let res: any = await SpuApi.createOrder({ id: addressId.value });
|
||||
if (res.code === 0) {
|
||||
proxy.utils.toast('下单成功');
|
||||
setTimeout(() => {
|
||||
// proxy.utils.go('/pages/AI/cashierDesk', {
|
||||
// id: res.data.id,
|
||||
// payOrderId: res.data.payOrderId,
|
||||
// });
|
||||
uni.redirectTo({
|
||||
url: '/pages/AI/cashierDesk?id=' + res.data.id + '&payOrderId=' + res.data.payOrderId,
|
||||
});
|
||||
}, 1000);
|
||||
} else {
|
||||
}
|
||||
};
|
||||
const getAddress = () => {
|
||||
api.getAddressList().then((res) => {
|
||||
if (res.code === 0 && res.data?.length) {
|
||||
// addressState.value.addressInfo = res.data[0];
|
||||
// getSettlementInfo(res.data[0].id);
|
||||
let index = res.data.findIndex((e) => e.defaultStatus);
|
||||
if (index !== -1) {
|
||||
addressState.value.addressInfo = res.data[index];
|
||||
getSettlementInfo(res.data[index].id);
|
||||
} else {
|
||||
getSettlementInfo();
|
||||
}
|
||||
} else {
|
||||
getSettlementInfo();
|
||||
}
|
||||
});
|
||||
};
|
||||
onLoad(() => {
|
||||
// getCartList();
|
||||
getAddress();
|
||||
});
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.pages {
|
||||
}
|
||||
|
||||
.bottom {
|
||||
}
|
||||
|
||||
.borderTop {
|
||||
border-top: 1px solid #d4d4d4;
|
||||
}
|
||||
|
||||
.btn {
|
||||
width: 100%;
|
||||
position: fixed;
|
||||
bottom: 0rpx;
|
||||
padding-top: 10rpx;
|
||||
padding-bottom: 20rpx;
|
||||
// background: #03011d;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,551 @@
|
||||
<!-- 拼团订单的详情 -->
|
||||
<template>
|
||||
<s-layout
|
||||
title="拼团详情"
|
||||
class="detail-wrap"
|
||||
:navbar="state.data && !state.loading ? 'inner' : 'normal'"
|
||||
:onShareAppMessage="shareInfo"
|
||||
>
|
||||
<view v-if="state.loading"></view>
|
||||
<view v-if="state.data && !state.loading">
|
||||
<!-- 团长信息 + 活动信息 -->
|
||||
<view
|
||||
class="recharge-box"
|
||||
v-if="state.data.headRecord"
|
||||
:style="[
|
||||
{
|
||||
marginTop: '-' + Number(statusBarHeight + 88) + 'rpx',
|
||||
paddingTop: Number(statusBarHeight + 108) + 'rpx',
|
||||
},
|
||||
]"
|
||||
>
|
||||
<s-goods-item
|
||||
class="goods-box"
|
||||
:img="state.data.headRecord.picUrl"
|
||||
:title="state.data.headRecord.spuName"
|
||||
:price="state.data.headRecord.combinationPrice"
|
||||
priceColor="#E1212B"
|
||||
@tap="
|
||||
sheep.$router.go('/pages/goods/groupon', {
|
||||
id: state.data.headRecord.activityId,
|
||||
})
|
||||
"
|
||||
:style="[{ top: Number(statusBarHeight + 108) + 'rpx' }]"
|
||||
>
|
||||
<template #groupon>
|
||||
<view class="ss-flex">
|
||||
<view class="sales-title">{{ state.data.headRecord.userSize }}人团</view>
|
||||
<view class="num-title ss-m-l-20">已拼{{ state.data.headRecord.userCount }}件</view>
|
||||
</view>
|
||||
</template>
|
||||
</s-goods-item>
|
||||
</view>
|
||||
|
||||
<view class="countdown-box detail-card ss-p-t-44 ss-flex-col ss-col-center">
|
||||
<!-- 情况一:拼团成功 -->
|
||||
<view v-if="state.data.headRecord.status === 1">
|
||||
<view v-if="state.data.orderId">
|
||||
<view class="countdown-title ss-flex">
|
||||
<text class="cicon-check-round" />
|
||||
恭喜您~拼团成功
|
||||
</view>
|
||||
</view>
|
||||
<view v-else>
|
||||
<view class="countdown-title ss-flex">
|
||||
<text class="cicon-info" />
|
||||
抱歉~该团已满员
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 情况二:拼团失败 -->
|
||||
<view v-if="state.data.headRecord.status === 2">
|
||||
<view class="countdown-title ss-flex">
|
||||
<text class="cicon-info"></text>
|
||||
{{ state.data.orderId ? '拼团超时,已自动退款' : '该团已解散' }}
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 情况三:拼团进行中 -->
|
||||
<view v-if="state.data.headRecord.status === 0">
|
||||
<view v-if="state.data.headRecord.expireTime <= new Date().getTime()">
|
||||
<view class="countdown-title ss-flex">
|
||||
<text class="cicon-info"></text>
|
||||
拼团已结束,请关注下次活动
|
||||
</view>
|
||||
</view>
|
||||
<view class="countdown-title ss-flex" v-else>
|
||||
还差
|
||||
<view class="num"
|
||||
>{{ state.data.headRecord.userSize - state.data.headRecord.userCount }}人</view
|
||||
>
|
||||
拼团成功
|
||||
<view class="ss-flex countdown-time">
|
||||
<view class="countdown-h ss-flex ss-row-center">{{ endTime.h }}</view>
|
||||
<view class="ss-m-x-4">:</view>
|
||||
<view class="countdown-num ss-flex ss-row-center">
|
||||
{{ endTime.m }}
|
||||
</view>
|
||||
<view class="ss-m-x-4">:</view>
|
||||
<view class="countdown-num ss-flex ss-row-center">
|
||||
{{ endTime.s }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 拼团的记录列表,展示每个参团人 -->
|
||||
<view class="ss-m-t-60 ss-flex ss-flex-wrap ss-row-center">
|
||||
<!-- 团长 -->
|
||||
<view class="header-avatar ss-m-r-24 ss-m-b-20">
|
||||
<image
|
||||
:src="
|
||||
sheep.$url.cdn(state.data.headRecord.avatar) ||
|
||||
sheep.$url.static('/static/img/shop/default_avatar.png')
|
||||
"
|
||||
class="avatar-img"
|
||||
></image>
|
||||
<view class="header-tag ss-flex ss-col-center ss-row-center">团长</view>
|
||||
</view>
|
||||
<!-- 团员 -->
|
||||
<view
|
||||
class="header-avatar ss-m-r-24 ss-m-b-20"
|
||||
v-for="item in state.data.memberRecords"
|
||||
:key="item.id"
|
||||
>
|
||||
<image
|
||||
:src="
|
||||
sheep.$url.cdn(item.avatar) ||
|
||||
sheep.$url.static('/static/img/shop/default_avatar.png')
|
||||
"
|
||||
class="avatar-img"
|
||||
></image>
|
||||
<view
|
||||
class="header-tag ss-flex ss-col-center ss-row-center"
|
||||
v-if="item.is_leader == '1'"
|
||||
>
|
||||
团长
|
||||
</view>
|
||||
</view>
|
||||
<!-- 还有几个坑位 -->
|
||||
<view
|
||||
class="default-avatar ss-m-r-24 ss-m-b-20"
|
||||
v-for="item in state.remainNumber"
|
||||
:key="item"
|
||||
>
|
||||
<image
|
||||
:src="sheep.$url.static('/static/img/shop/avatar/unknown.png')"
|
||||
class="avatar-img"
|
||||
></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 情况一:拼团成功;情况二:拼团失败 -->
|
||||
<view
|
||||
v-if="state.data.headRecord.status === 1 || state.data.headRecord.status === 2"
|
||||
class="ss-m-t-40 ss-flex ss-row-center"
|
||||
>
|
||||
<button
|
||||
class="ss-reset-button order-btn"
|
||||
v-if="state.data.orderId"
|
||||
@tap="onDetail(state.data.orderId)"
|
||||
>
|
||||
查看订单
|
||||
</button>
|
||||
<button class="ss-reset-button join-btn" v-else @tap="onCreateGroupon"> 我要开团 </button>
|
||||
</view>
|
||||
|
||||
<!-- 情况三:拼团进行中,查看订单或参加或邀请好友或参加 -->
|
||||
<view v-if="state.data.headRecord.status === 0" class="ss-m-t-40 ss-flex ss-row-center">
|
||||
<view v-if="state.data.headRecord.expireTime <= new Date().getTime()">
|
||||
<button
|
||||
class="ss-reset-button join-btn"
|
||||
v-if="state.data.orderId"
|
||||
@tap="onDetail(state.data.orderId)"
|
||||
>
|
||||
查看订单
|
||||
</button>
|
||||
<button
|
||||
class="ss-reset-button disabled-btn"
|
||||
v-else
|
||||
disabled
|
||||
@tap="onDetail(state.data.orderId)"
|
||||
>
|
||||
去参团
|
||||
</button>
|
||||
</view>
|
||||
<view v-else class="ss-flex ss-row-center">
|
||||
<view v-if="state.data.orderId">
|
||||
<button class="ss-reset-button join-btn" :disabled="endTime.ms <= 0" @tap="onShare">
|
||||
邀请好友来拼团
|
||||
</button>
|
||||
</view>
|
||||
<view v-else>
|
||||
<button
|
||||
class="ss-reset-button join-btn"
|
||||
:disabled="endTime.ms <= 0"
|
||||
@tap="onJoinGroupon()"
|
||||
>
|
||||
立即参团
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-if="!isEmpty(state.goodsInfo)">
|
||||
<!-- 规格与数量弹框 -->
|
||||
<s-select-groupon-sku
|
||||
:show="state.showSelectSku"
|
||||
:goodsInfo="state.goodsInfo"
|
||||
:grouponAction="state.grouponAction"
|
||||
:grouponNum="state.grouponNum"
|
||||
@buy="onBuy"
|
||||
@change="onSkuChange"
|
||||
@close="state.showSelectSku = false"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<s-empty v-if="!state.data && !state.loading" icon="/static/goods-empty.png" />
|
||||
</s-layout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, reactive } from 'vue';
|
||||
import sheep from '@/sheep';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import { fen2yuan, useDurationTime } from '@/sheep/hooks/useGoods';
|
||||
import { showShareModal } from '@/sheep/hooks/useModal';
|
||||
import { isEmpty } from 'lodash-es';
|
||||
import CombinationApi from '@/sheep/api/promotion/combination';
|
||||
import SpuApi from '@/sheep/api/product/spu';
|
||||
import { SharePageEnum } from '@/sheep/helper/const';
|
||||
|
||||
const headerBg = sheep.$url.css('/static/img/shop/user/withdraw_bg.png');
|
||||
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
|
||||
const state = reactive({
|
||||
data: {}, // 拼团详情
|
||||
goodsId: 0, // 商品ID
|
||||
goodsInfo: {}, // 商品信息
|
||||
showSelectSku: false, // 显示规格弹框
|
||||
selectedSkuPrice: {}, // 选中的规格价格
|
||||
activity: {}, // 团购活动
|
||||
grouponId: 0, // 团购ID
|
||||
grouponNum: 0, // 团购人数
|
||||
grouponAction: 'create', // 团购操作
|
||||
combinationHeadId: null, // 拼团团长编号
|
||||
loading: true,
|
||||
});
|
||||
|
||||
const shareInfo = computed(() => {
|
||||
if (isEmpty(state.data)) return {};
|
||||
return sheep.$platform.share.getShareInfo(
|
||||
{
|
||||
title: state.data.headRecord.spuName,
|
||||
image: sheep.$url.cdn(state.data.headRecord.picUrl),
|
||||
desc: state.data.goods?.subtitle,
|
||||
params: {
|
||||
page: SharePageEnum.GROUPON_DETAIL.value,
|
||||
query: state.data.headRecord.id,
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'groupon', // 邀请拼团海报
|
||||
title: state.data.headRecord.spuName, // 商品标题
|
||||
image: sheep.$url.cdn(state.data.headRecord.picUrl), // 商品主图
|
||||
price: fen2yuan(state.data.headRecord.combinationPrice), // 商品价格
|
||||
grouponNum: state.data.headRecord.userSize, // 拼团人数
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
// 订单详情
|
||||
function onDetail(orderId) {
|
||||
sheep.$router.go('/pages/order/detail', {
|
||||
id: orderId,
|
||||
});
|
||||
}
|
||||
|
||||
// 去开团
|
||||
function onCreateGroupon() {
|
||||
state.grouponAction = 'create';
|
||||
state.grouponId = 0;
|
||||
state.showSelectSku = true;
|
||||
}
|
||||
|
||||
// 规格变更
|
||||
function onSkuChange(e) {
|
||||
state.selectedSkuPrice = e;
|
||||
}
|
||||
|
||||
// 立即参团
|
||||
function onJoinGroupon() {
|
||||
state.grouponAction = 'join';
|
||||
state.grouponId = state.data.headRecord.activityId;
|
||||
state.combinationHeadId = state.data.headRecord.id;
|
||||
state.grouponNum = state.data.headRecord.userSize;
|
||||
state.showSelectSku = true;
|
||||
}
|
||||
|
||||
// 立即购买
|
||||
function onBuy(sku) {
|
||||
sheep.$router.go('/pages/order/confirm', {
|
||||
data: JSON.stringify({
|
||||
order_type: 'goods',
|
||||
combinationActivityId: state.activity.id,
|
||||
combinationHeadId: state.combinationHeadId,
|
||||
items: [
|
||||
{
|
||||
skuId: sku.id,
|
||||
count: sku.count,
|
||||
},
|
||||
],
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
const endTime = computed(() => {
|
||||
return useDurationTime(state.data.headRecord.expireTime);
|
||||
});
|
||||
|
||||
// 获取拼团团队详情
|
||||
async function getGrouponDetail(id) {
|
||||
const { code, data } = await CombinationApi.getCombinationRecordDetail(id);
|
||||
if (code === 0) {
|
||||
state.data = data;
|
||||
const remainNumber = Number(state.data.headRecord.userSize - state.data.headRecord.userCount);
|
||||
state.remainNumber = remainNumber > 0 ? remainNumber : 0;
|
||||
|
||||
// 获取活动信息
|
||||
const { data: activity } = await CombinationApi.getCombinationActivity(
|
||||
data.headRecord.activityId,
|
||||
);
|
||||
state.activity = activity;
|
||||
state.grouponNum = activity.userSize;
|
||||
// 加载商品信息
|
||||
const { data: spu } = await SpuApi.getSpuDetail(activity.spuId);
|
||||
state.goodsId = spu.id;
|
||||
// 默认显示最低价
|
||||
activity.products.forEach((product) => {
|
||||
spu.price = Math.min(spu.price, product.combinationPrice); // 设置 SPU 的最低价格
|
||||
});
|
||||
state.goodsInfo = spu;
|
||||
// 价格、库存使用活动的
|
||||
spu.skus.forEach((sku) => {
|
||||
const product = activity.products.find((product) => product.skuId === sku.id);
|
||||
if (product) {
|
||||
sku.price = product.combinationPrice;
|
||||
} else {
|
||||
// 找不到可能是没配置,则不能发起秒杀
|
||||
sku.stock = 0;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
state.data = null;
|
||||
}
|
||||
state.loading = false;
|
||||
}
|
||||
|
||||
function onShare() {
|
||||
showShareModal();
|
||||
}
|
||||
|
||||
onLoad((options) => {
|
||||
getGrouponDetail(options.id);
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.recharge-box {
|
||||
position: relative;
|
||||
margin-bottom: 120rpx;
|
||||
background: v-bind(headerBg) center/750rpx 100% no-repeat,
|
||||
linear-gradient(115deg, #f44739 0%, #ff6600 100%);
|
||||
border-radius: 0 0 5% 5%;
|
||||
height: 100rpx;
|
||||
|
||||
.goods-box {
|
||||
width: 710rpx;
|
||||
border-radius: 20rpx;
|
||||
position: absolute;
|
||||
left: 20rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.sales-title {
|
||||
height: 32rpx;
|
||||
background: rgba(#ffe0e2, 0.29);
|
||||
border-radius: 16rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 400;
|
||||
padding: 6rpx 20rpx;
|
||||
color: #f7979c;
|
||||
}
|
||||
|
||||
.num-title {
|
||||
font-size: 24rpx;
|
||||
font-weight: 400;
|
||||
color: #999999;
|
||||
}
|
||||
}
|
||||
|
||||
.countdown-time {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #383a46;
|
||||
.countdown-h {
|
||||
font-size: 24rpx;
|
||||
font-family: OPPOSANS;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
padding: 0 4rpx;
|
||||
margin-left: 16rpx;
|
||||
height: 40rpx;
|
||||
background: linear-gradient(90deg, #ff6000 0%, #fe832a 100%);
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
.countdown-num {
|
||||
font-size: 24rpx;
|
||||
font-family: OPPOSANS;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
background: linear-gradient(90deg, #ff6000 0%, #fe832a 100%);
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.countdown-box {
|
||||
// height: 364rpx;
|
||||
background: #ffffff;
|
||||
border-radius: 10rpx;
|
||||
box-sizing: border-box;
|
||||
|
||||
.countdown-title {
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
|
||||
.cicon-check-round {
|
||||
color: #42b111;
|
||||
margin-right: 24rpx;
|
||||
}
|
||||
|
||||
.cicon-info {
|
||||
color: #d71e08;
|
||||
margin-right: 24rpx;
|
||||
}
|
||||
|
||||
.num {
|
||||
color: #ff6000;
|
||||
}
|
||||
}
|
||||
|
||||
.header-avatar {
|
||||
width: 86rpx;
|
||||
height: 86rpx;
|
||||
background: #ececec;
|
||||
border-radius: 50%;
|
||||
border: 4rpx solid #edc36c;
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
|
||||
.avatar-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.header-tag {
|
||||
width: 72rpx;
|
||||
height: 36rpx;
|
||||
font-size: 24rpx;
|
||||
line-height: nor;
|
||||
background: linear-gradient(132deg, #f3dfb1, #f3dfb1, #ecbe60);
|
||||
border-radius: 16rpx;
|
||||
position: absolute;
|
||||
left: 4rpx;
|
||||
top: -36rpx;
|
||||
}
|
||||
}
|
||||
.default-avatar {
|
||||
width: 86rpx;
|
||||
height: 86rpx;
|
||||
background: #ececec;
|
||||
border-radius: 50%;
|
||||
.avatar-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
.user-avatar {
|
||||
width: 86rpx;
|
||||
height: 86rpx;
|
||||
background: #ececec;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
.order-btn {
|
||||
width: 668rpx;
|
||||
height: 70rpx;
|
||||
border: 2rpx solid #dfdfdf;
|
||||
border-radius: 35rpx;
|
||||
color: #999999;
|
||||
font-weight: 500;
|
||||
font-size: 26rpx;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.disabled-btn {
|
||||
width: 668rpx;
|
||||
height: 70rpx;
|
||||
background: #dddddd;
|
||||
border-radius: 35rpx;
|
||||
color: #999999;
|
||||
font-weight: 500;
|
||||
font-size: 28rpx;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.join-btn {
|
||||
width: 668rpx;
|
||||
height: 70rpx;
|
||||
background: linear-gradient(90deg, #ff6000 0%, #fe832a 100%);
|
||||
box-shadow: 0px 8rpx 6rpx 0px rgba(255, 104, 4, 0.22);
|
||||
border-radius: 35rpx;
|
||||
color: #fff;
|
||||
font-weight: 500;
|
||||
font-size: 28rpx;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.detail-cell-wrap {
|
||||
width: 100%;
|
||||
padding: 10rpx 20rpx;
|
||||
box-sizing: border-box;
|
||||
border-top: 2rpx solid #dfdfdf;
|
||||
background-color: #fff;
|
||||
// min-height: 60rpx;
|
||||
|
||||
.label-text {
|
||||
font-size: 28rpx;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.cell-content {
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: $dark-6;
|
||||
}
|
||||
|
||||
.right-forwrad-icon {
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: $dark-9;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,225 @@
|
||||
<!-- 拼团活动列表 -->
|
||||
<template>
|
||||
<s-layout :bgStyle="{ color: '#FE832A' }" navbar="inner">
|
||||
<view class="page-bg" :style="[{ marginTop: '-' + Number(statusBarHeight + 88) + 'rpx' }]" />
|
||||
<view class="list-content">
|
||||
<!-- 参团会员统计 -->
|
||||
<view class="content-header ss-flex-col ss-col-center ss-row-center">
|
||||
<view class="content-header-title ss-flex ss-row-center">
|
||||
<view
|
||||
v-for="(item, index) in state.summaryData.avatars"
|
||||
:key="index"
|
||||
class="picture"
|
||||
:style="index === 6 ? 'position: relative' : 'position: static'"
|
||||
>
|
||||
<span class="avatar" :style="`background-image: url(${item})`" />
|
||||
<span v-if="index === 6 && state.summaryData.avatars.length > 3" class="mengceng">
|
||||
<i>···</i>
|
||||
</span>
|
||||
</view>
|
||||
<text class="pic_count">{{ state.summaryData.userCount || 0 }}人参与</text>
|
||||
</view>
|
||||
</view>
|
||||
<scroll-view
|
||||
class="scroll-box"
|
||||
:style="{ height: pageHeight + 'rpx' }"
|
||||
scroll-y="true"
|
||||
:scroll-with-animation="false"
|
||||
:enable-back-to-top="true"
|
||||
>
|
||||
<view class="goods-box ss-m-b-20" v-for="item in state.pagination.list" :key="item.id">
|
||||
<s-goods-column
|
||||
class=""
|
||||
size="lg"
|
||||
:data="item"
|
||||
:grouponTag="true"
|
||||
@click="sheep.$router.go('/pages/goods/groupon', { id: item.id })"
|
||||
>
|
||||
<template v-slot:cart>
|
||||
<button class="ss-reset-button cart-btn">去拼团</button>
|
||||
</template>
|
||||
</s-goods-column>
|
||||
</view>
|
||||
<uni-load-more
|
||||
v-if="state.pagination.total > 0"
|
||||
:status="state.loadStatus"
|
||||
:content-text="{
|
||||
contentdown: '上拉加载更多',
|
||||
}"
|
||||
@tap="loadMore"
|
||||
/>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</s-layout>
|
||||
</template>
|
||||
<script setup>
|
||||
import { reactive } from 'vue';
|
||||
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
||||
import sheep from '@/sheep';
|
||||
import CombinationApi from '@/sheep/api/promotion/combination';
|
||||
|
||||
const { safeAreaInsets, safeArea } = sheep.$platform.device;
|
||||
const sysNavBar = sheep.$platform.navbar;
|
||||
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
|
||||
const pageHeight =
|
||||
(safeArea.height + safeAreaInsets.bottom) * 2 + statusBarHeight - sysNavBar - 350;
|
||||
const headerBg = sheep.$url.css('/static/img/shop/goods/groupon-header.png');
|
||||
|
||||
const state = reactive({
|
||||
pagination: {
|
||||
list: [],
|
||||
total: 0,
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
},
|
||||
loadStatus: '',
|
||||
summaryData: {},
|
||||
});
|
||||
|
||||
// 加载统计数据
|
||||
const getSummary = async () => {
|
||||
const { data } = await CombinationApi.getCombinationRecordSummary();
|
||||
state.summaryData = data;
|
||||
};
|
||||
|
||||
// 加载活动列表
|
||||
async function getList() {
|
||||
state.loadStatus = 'loading';
|
||||
const { data } = await CombinationApi.getCombinationActivityPage({
|
||||
pageNo: state.pagination.pageNo,
|
||||
pageSize: state.pagination.pageSize,
|
||||
});
|
||||
data.list.forEach((activity) => {
|
||||
state.pagination.list.push({ ...activity, price: activity.combinationPrice });
|
||||
});
|
||||
state.pagination.total = data.total;
|
||||
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
||||
}
|
||||
|
||||
// 加载更多
|
||||
function loadMore() {
|
||||
if (state.loadStatus === 'noMore') {
|
||||
return;
|
||||
}
|
||||
state.pagination.pageNo++;
|
||||
getList();
|
||||
}
|
||||
|
||||
// 上拉加载更多
|
||||
onReachBottom(() => loadMore());
|
||||
|
||||
// 页面初始化
|
||||
onLoad(() => {
|
||||
getSummary();
|
||||
getList();
|
||||
});
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.page-bg {
|
||||
width: 100%;
|
||||
height: 458rpx;
|
||||
margin-top: -88rpx;
|
||||
background: v-bind(headerBg) no-repeat;
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
.list-content {
|
||||
position: relative;
|
||||
z-index: 3;
|
||||
margin: -190rpx 20rpx 0 20rpx;
|
||||
background: #fff;
|
||||
border-radius: 20rpx 20rpx 0 0;
|
||||
.content-header {
|
||||
width: 100%;
|
||||
border-radius: 20rpx 20rpx 0 0;
|
||||
height: 100rpx;
|
||||
background: linear-gradient(180deg, #fff4f7, #ffe4d1);
|
||||
.content-header-title {
|
||||
width: 100%;
|
||||
font-size: 30rpx;
|
||||
font-weight: 500;
|
||||
color: #ff2923;
|
||||
line-height: 30rpx;
|
||||
position: relative;
|
||||
.more {
|
||||
position: absolute;
|
||||
right: 30rpx;
|
||||
top: 0;
|
||||
font-size: 24rpx;
|
||||
font-weight: 400;
|
||||
color: #999999;
|
||||
line-height: 30rpx;
|
||||
}
|
||||
|
||||
.picture {
|
||||
display: inline-table;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
width: 38rpx;
|
||||
height: 38rpx;
|
||||
display: inline-table;
|
||||
vertical-align: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
border-radius: 50%;
|
||||
background-repeat: no-repeat;
|
||||
background-size: cover;
|
||||
background-position: 0 0;
|
||||
margin-right: -10rpx;
|
||||
box-shadow: 0 0 0 1px #fe832a;
|
||||
}
|
||||
|
||||
.pic_count {
|
||||
margin-left: 30rpx;
|
||||
font-size: 22rpx;
|
||||
font-weight: 500;
|
||||
width: auto;
|
||||
height: auto;
|
||||
background: linear-gradient(90deg, #ff6600 0%, #fe832a 100%);
|
||||
color: #ffffff;
|
||||
border-radius: 19rpx;
|
||||
padding: 4rpx 14rpx;
|
||||
}
|
||||
|
||||
.mengceng {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
line-height: 36rpx;
|
||||
background: rgba(51, 51, 51, 0.6);
|
||||
text-align: center;
|
||||
border-radius: 50%;
|
||||
opacity: 1;
|
||||
position: absolute;
|
||||
left: -2rpx;
|
||||
color: #fff;
|
||||
top: 2rpx;
|
||||
i {
|
||||
font-style: normal;
|
||||
font-size: 20rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.scroll-box {
|
||||
height: 900rpx;
|
||||
.goods-box {
|
||||
position: relative;
|
||||
.cart-btn {
|
||||
position: absolute;
|
||||
bottom: 10rpx;
|
||||
right: 20rpx;
|
||||
z-index: 11;
|
||||
height: 50rpx;
|
||||
line-height: 50rpx;
|
||||
padding: 0 20rpx;
|
||||
border-radius: 25rpx;
|
||||
font-size: 24rpx;
|
||||
color: #fff;
|
||||
background: linear-gradient(90deg, #ff6600 0%, #fe832a 100%);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,240 @@
|
||||
<!-- 我的拼团订单列表 -->
|
||||
<template>
|
||||
<s-layout title="我的拼团">
|
||||
<su-sticky bgColor="#fff">
|
||||
<su-tabs
|
||||
:list="tabMaps"
|
||||
:scrollable="false"
|
||||
@change="onTabsChange"
|
||||
:current="state.currentTab"
|
||||
></su-tabs>
|
||||
</su-sticky>
|
||||
<s-empty v-if="state.pagination.total === 0" icon="/static/goods-empty.png" />
|
||||
<view v-if="state.pagination.total > 0">
|
||||
<view
|
||||
class="order-list-card-box bg-white ss-r-10 ss-m-t-14 ss-m-20"
|
||||
v-for="record in state.pagination.list"
|
||||
:key="record.id"
|
||||
>
|
||||
<view class="order-card-header ss-flex ss-col-center ss-row-between ss-p-x-20">
|
||||
<view class="order-no">拼团编号:{{ record.id }}</view>
|
||||
<view class="ss-font-26" :class="formatOrderColor(record)">
|
||||
{{ tabMaps.find((item) => item.value === record.status).name }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="border-bottom">
|
||||
<s-goods-item
|
||||
:img="record.picUrl"
|
||||
:title="record.spuName"
|
||||
:price="record.combinationPrice"
|
||||
>
|
||||
<template #groupon>
|
||||
<view class="ss-flex">
|
||||
<view class="sales-title"> {{ record.userSize }} 人团 </view>
|
||||
</view>
|
||||
</template>
|
||||
</s-goods-item>
|
||||
</view>
|
||||
<view class="order-card-footer ss-flex ss-row-right ss-p-x-20">
|
||||
<button
|
||||
class="detail-btn ss-reset-button"
|
||||
@tap="sheep.$router.go('/pages/order/detail', { id: record.orderId })"
|
||||
>
|
||||
订单详情
|
||||
</button>
|
||||
<button
|
||||
class="tool-btn ss-reset-button"
|
||||
:class="{ 'ui-BG-Main-Gradient': record.status === 0 }"
|
||||
@tap="sheep.$router.go('/pages/activity/groupon/detail', { id: record.id })"
|
||||
>
|
||||
{{ record.status === 0 ? '邀请拼团' : '拼团详情' }}
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<uni-load-more
|
||||
v-if="state.pagination.total > 0"
|
||||
:status="state.loadStatus"
|
||||
:content-text="{
|
||||
contentdown: '上拉加载更多',
|
||||
}"
|
||||
@tap="loadMore"
|
||||
/>
|
||||
</s-layout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive } from 'vue';
|
||||
import { onLoad, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app';
|
||||
import sheep from '@/sheep';
|
||||
import _ from 'lodash-es';
|
||||
import { formatOrderColor } from '@/sheep/hooks/useGoods';
|
||||
import { resetPagination } from '@/sheep/helper/utils';
|
||||
import CombinationApi from '@/sheep/api/promotion/combination';
|
||||
|
||||
// 数据
|
||||
const state = reactive({
|
||||
currentTab: 0,
|
||||
pagination: {
|
||||
list: [],
|
||||
total: 0,
|
||||
pageNo: 1,
|
||||
pageSize: 5,
|
||||
},
|
||||
loadStatus: '',
|
||||
deleteOrderId: 0,
|
||||
});
|
||||
|
||||
const tabMaps = [
|
||||
{
|
||||
name: '全部',
|
||||
},
|
||||
{
|
||||
name: '进行中',
|
||||
value: 0,
|
||||
},
|
||||
{
|
||||
name: '拼团成功',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
name: '拼团失败',
|
||||
value: 2,
|
||||
},
|
||||
];
|
||||
|
||||
// 切换选项卡
|
||||
function onTabsChange(e) {
|
||||
resetPagination(state.pagination);
|
||||
state.currentTab = e.index;
|
||||
getGrouponList();
|
||||
}
|
||||
|
||||
// 获取订单列表
|
||||
async function getGrouponList() {
|
||||
state.loadStatus = 'loading';
|
||||
const { code, data } = await CombinationApi.getCombinationRecordPage({
|
||||
pageNo: state.pagination.pageNo,
|
||||
pageSize: state.pagination.pageSize,
|
||||
status: tabMaps[state.currentTab].value,
|
||||
});
|
||||
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';
|
||||
}
|
||||
|
||||
onLoad((options) => {
|
||||
if (options.type) {
|
||||
state.currentTab = options.type;
|
||||
}
|
||||
getGrouponList();
|
||||
});
|
||||
|
||||
// 加载更多
|
||||
function loadMore() {
|
||||
if (state.loadStatus === 'noMore') {
|
||||
return;
|
||||
}
|
||||
state.pagination.pageNo++;
|
||||
getGrouponList();
|
||||
}
|
||||
|
||||
// 上拉加载更多
|
||||
onReachBottom(() => {
|
||||
loadMore();
|
||||
});
|
||||
|
||||
//下拉刷新
|
||||
onPullDownRefresh(() => {
|
||||
resetPagination(state.pagination);
|
||||
getGrouponList();
|
||||
setTimeout(function () {
|
||||
uni.stopPullDownRefresh();
|
||||
}, 800);
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.swiper-box {
|
||||
flex: 1;
|
||||
|
||||
.swiper-item {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.order-list-card-box {
|
||||
.order-card-header {
|
||||
height: 80rpx;
|
||||
|
||||
.order-no {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
|
||||
.order-card-footer {
|
||||
height: 100rpx;
|
||||
|
||||
.detail-btn {
|
||||
width: 210rpx;
|
||||
height: 66rpx;
|
||||
border: 2rpx solid #dfdfdf;
|
||||
border-radius: 33rpx;
|
||||
font-size: 26rpx;
|
||||
font-weight: 400;
|
||||
color: #999999;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
.tool-btn {
|
||||
width: 210rpx;
|
||||
height: 66rpx;
|
||||
border-radius: 33rpx;
|
||||
font-size: 26rpx;
|
||||
font-weight: 400;
|
||||
margin-right: 20rpx;
|
||||
background: #f6f6f6;
|
||||
}
|
||||
|
||||
.invite-btn {
|
||||
width: 210rpx;
|
||||
height: 66rpx;
|
||||
background: linear-gradient(90deg, #fe832a, #ff6600);
|
||||
box-shadow: 0px 8rpx 6rpx 0px rgba(255, 104, 4, 0.22);
|
||||
border-radius: 33rpx;
|
||||
color: #fff;
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.sales-title {
|
||||
height: 32rpx;
|
||||
background: rgba(#ffe0e2, 0.29);
|
||||
border-radius: 16rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 400;
|
||||
padding: 6rpx 20rpx;
|
||||
color: #f7979c;
|
||||
}
|
||||
|
||||
.num-title {
|
||||
font-size: 24rpx;
|
||||
font-weight: 400;
|
||||
color: #999999;
|
||||
}
|
||||
.warning-color {
|
||||
color: #faad14;
|
||||
}
|
||||
.danger-color {
|
||||
color: #ff3000;
|
||||
}
|
||||
.success-color {
|
||||
color: #52c41a;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,214 @@
|
||||
<!-- 指定满减送的活动列表 -->
|
||||
<template>
|
||||
<s-layout class="activity-wrap" :title="state.activityInfo.title">
|
||||
<!-- 活动信息 -->
|
||||
<su-sticky bgColor="#fff">
|
||||
<view class="ss-flex ss-col-top tip-box">
|
||||
<view class="type-text ss-flex ss-row-center">满减:</view>
|
||||
<view class="ss-flex-1">
|
||||
<view class="tip-content" v-for="item in state.activityInfo.rules" :key="item">
|
||||
{{ item.description }}
|
||||
</view>
|
||||
</view>
|
||||
<image class="activity-left-image" src="/static/activity-left.png" />
|
||||
<image class="activity-right-image" src="/static/activity-right.png" />
|
||||
</view>
|
||||
</su-sticky>
|
||||
|
||||
<!-- 商品信息 -->
|
||||
<view class="ss-flex ss-flex-wrap ss-p-x-20 ss-m-t-20 ss-col-top">
|
||||
<view class="goods-list-box">
|
||||
<view class="left-list" v-for="item in state.leftGoodsList" :key="item.id">
|
||||
<s-goods-column
|
||||
class="goods-md-box"
|
||||
size="md"
|
||||
:data="item"
|
||||
@click="sheep.$router.go('/pages/goods/index', { id: item.id })"
|
||||
@getHeight="mountMasonry($event, 'left')"
|
||||
>
|
||||
<template v-slot:cart>
|
||||
<button class="ss-reset-button cart-btn"> </button>
|
||||
</template>
|
||||
</s-goods-column>
|
||||
</view>
|
||||
</view>
|
||||
<view class="goods-list-box">
|
||||
<view class="right-list" v-for="item in state.rightGoodsList" :key="item.id">
|
||||
<s-goods-column
|
||||
class="goods-md-box"
|
||||
size="md"
|
||||
:data="item"
|
||||
@click="sheep.$router.go('/pages/goods/index', { id: item.id })"
|
||||
@getHeight="mountMasonry($event, 'right')"
|
||||
>
|
||||
<template v-slot:cart>
|
||||
<button class="ss-reset-button cart-btn" />
|
||||
</template>
|
||||
</s-goods-column>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<uni-load-more
|
||||
v-if="state.pagination.total > 0"
|
||||
:status="state.loadStatus"
|
||||
:content-text="{
|
||||
contentdown: '上拉加载更多',
|
||||
}"
|
||||
@tap="loadMore"
|
||||
/>
|
||||
</s-layout>
|
||||
</template>
|
||||
<script setup>
|
||||
import { reactive } from 'vue';
|
||||
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
||||
import sheep from '@/sheep';
|
||||
import _ from 'lodash-es';
|
||||
import RewardActivityApi from '@/sheep/api/promotion/rewardActivity';
|
||||
import SpuApi from '@/sheep/api/product/spu';
|
||||
import { appendSettlementProduct } from '@/sheep/hooks/useGoods';
|
||||
import OrderApi from '@/sheep/api/trade/order';
|
||||
|
||||
const state = reactive({
|
||||
activityId: 0, // 获得编号
|
||||
activityInfo: {}, // 获得信息
|
||||
|
||||
pagination: {
|
||||
list: [],
|
||||
total: 1,
|
||||
pageNo: 1,
|
||||
pageSize: 8,
|
||||
},
|
||||
loadStatus: '',
|
||||
leftGoodsList: [],
|
||||
rightGoodsList: [],
|
||||
});
|
||||
|
||||
// 加载瀑布流
|
||||
let count = 0;
|
||||
let leftHeight = 0;
|
||||
let rightHeight = 0;
|
||||
|
||||
function mountMasonry(height = 0, where = 'left') {
|
||||
if (!state.pagination.list[count]) return;
|
||||
|
||||
if (where === 'left') {
|
||||
leftHeight += height;
|
||||
} else {
|
||||
rightHeight += height;
|
||||
}
|
||||
if (leftHeight <= rightHeight) {
|
||||
state.leftGoodsList.push(state.pagination.list[count]);
|
||||
} else {
|
||||
state.rightGoodsList.push(state.pagination.list[count]);
|
||||
}
|
||||
count++;
|
||||
}
|
||||
|
||||
// 加载商品信息
|
||||
async function getList() {
|
||||
// 处理拓展参数
|
||||
const params = {};
|
||||
if (state.activityInfo.productScope === 2) {
|
||||
params.ids = state.activityInfo.productSpuIds.join(',');
|
||||
} else if (state.activityInfo.productScope === 3) {
|
||||
params.categoryIds = state.activityInfo.productSpuIds.join(',');
|
||||
}
|
||||
// 请求数据
|
||||
state.loadStatus = 'loading';
|
||||
const { code, data } = await SpuApi.getSpuPage({
|
||||
pageNo: state.pagination.pageNo,
|
||||
pageSize: state.pagination.pageSize,
|
||||
...params,
|
||||
});
|
||||
if (code !== 0) {
|
||||
return;
|
||||
}
|
||||
// 拼接结算信息(营销)
|
||||
await OrderApi.getSettlementProduct(data.list.map((item) => item.id).join(',')).then((res) => {
|
||||
if (res.code !== 0) {
|
||||
return;
|
||||
}
|
||||
appendSettlementProduct(data.list, res.data);
|
||||
});
|
||||
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';
|
||||
mountMasonry();
|
||||
}
|
||||
|
||||
// 加载活动信息
|
||||
async function getActivity(id) {
|
||||
const { code, data } = await RewardActivityApi.getRewardActivity(id);
|
||||
if (code === 0) {
|
||||
state.activityInfo = data;
|
||||
}
|
||||
}
|
||||
|
||||
// 加载更多
|
||||
function loadMore() {
|
||||
if (state.loadStatus === 'noMore') {
|
||||
return;
|
||||
}
|
||||
state.pagination.pageNo++;
|
||||
getList();
|
||||
}
|
||||
|
||||
// 上拉加载更多
|
||||
onReachBottom(() => {
|
||||
loadMore();
|
||||
});
|
||||
|
||||
onLoad(async (options) => {
|
||||
state.activityId = options.activityId;
|
||||
await getActivity(state.activityId);
|
||||
await getList(state.activityId);
|
||||
});
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.goods-list-box {
|
||||
width: 50%;
|
||||
box-sizing: border-box;
|
||||
.left-list {
|
||||
margin-right: 10rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
.right-list {
|
||||
margin-left: 10rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
}
|
||||
.tip-box {
|
||||
background: #fff0e7;
|
||||
padding: 20rpx;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
.activity-left-image {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 58rpx;
|
||||
height: 36rpx;
|
||||
}
|
||||
.activity-right-image {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 72rpx;
|
||||
height: 50rpx;
|
||||
}
|
||||
.type-text {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #ff6000;
|
||||
line-height: 42rpx;
|
||||
}
|
||||
.tip-content {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #ff6000;
|
||||
line-height: 42rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,76 @@
|
||||
<!-- 积分商城:商品列表 -->
|
||||
<template>
|
||||
<s-layout title="积分商城" navbar="normal" :leftWidth="0" :rightWidth="0">
|
||||
<scroll-view
|
||||
class="scroll-box"
|
||||
:style="{ height: pageHeight + 'rpx' }"
|
||||
scroll-y="true"
|
||||
:scroll-with-animation="false"
|
||||
:enable-back-to-top="true"
|
||||
>
|
||||
<s-point-card ref="sPointCardRef" class="ss-p-x-20 ss-m-t-20" />
|
||||
<s-empty
|
||||
v-if="activityTotal === 0"
|
||||
icon="/static/goods-empty.png"
|
||||
text="暂无积分商品"
|
||||
></s-empty>
|
||||
<uni-load-more
|
||||
v-if="activityTotal > 0"
|
||||
:status="loadStatus"
|
||||
:content-text="{
|
||||
contentdown: '上拉加载更多',
|
||||
}"
|
||||
@tap="loadMore"
|
||||
/>
|
||||
</scroll-view>
|
||||
</s-layout>
|
||||
</template>
|
||||
<script setup>
|
||||
import sheep from '@/sheep';
|
||||
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
||||
import { reactive, ref } from 'vue';
|
||||
import PointApi from '@/sheep/api/promotion/point';
|
||||
import SLayout from '@/sheep/components/s-layout/s-layout.vue';
|
||||
|
||||
// 计算页面高度
|
||||
const { safeAreaInsets, safeArea } = sheep.$platform.device;
|
||||
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
|
||||
const pageHeight =
|
||||
(safeArea.height + safeAreaInsets.bottom) * 2 + statusBarHeight - sheep.$platform.navbar - 350;
|
||||
|
||||
const sPointCardRef = ref();
|
||||
// 查询活动列表
|
||||
const activityPageParams = reactive({
|
||||
pageNo: 1, // 页码
|
||||
pageSize: 5, // 每页数量
|
||||
});
|
||||
|
||||
const activityTotal = ref(0); // 活动总数
|
||||
const activityCount = ref(0); // 已加载活动数量
|
||||
const loadStatus = ref(''); // 页面加载状态
|
||||
async function getActivityList() {
|
||||
loadStatus.value = 'loading';
|
||||
const { data } = await PointApi.getPointActivityPage(activityPageParams);
|
||||
await sPointCardRef.value.concatActivity(data.list);
|
||||
activityCount.value = sPointCardRef.value.getActivityCount();
|
||||
activityTotal.value = data.total;
|
||||
|
||||
loadStatus.value = activityCount.value < activityTotal.value ? 'more' : 'noMore';
|
||||
}
|
||||
|
||||
// 加载更多
|
||||
function loadMore() {
|
||||
if (loadStatus.value !== 'noMore') {
|
||||
activityPageParams.pageNo += 1;
|
||||
getActivityList();
|
||||
}
|
||||
}
|
||||
|
||||
// 上拉加载更多
|
||||
onReachBottom(() => {
|
||||
loadMore();
|
||||
});
|
||||
onLoad(() => {
|
||||
getActivityList();
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,460 @@
|
||||
<!-- 秒杀活动列表 -->
|
||||
<template>
|
||||
<s-layout :bgStyle="{ color: 'rgb(245,28,19)' }" navbar="inner">
|
||||
<!--顶部背景图-->
|
||||
<view
|
||||
class="page-bg"
|
||||
:style="[{ marginTop: '-' + Number(statusBarHeight + 88) + 'rpx' }]"
|
||||
></view>
|
||||
<!-- 时间段轮播图 -->
|
||||
<view class="header" v-if="activeTimeConfig?.sliderPicUrls?.length > 0">
|
||||
<swiper
|
||||
indicator-dots="true"
|
||||
autoplay="true"
|
||||
:circular="true"
|
||||
interval="3000"
|
||||
duration="1500"
|
||||
indicator-color="rgba(255,255,255,0.6)"
|
||||
indicator-active-color="#fff"
|
||||
>
|
||||
<block v-for="(picUrl, index) in activeTimeConfig.sliderPicUrls" :key="index">
|
||||
<swiper-item class="borRadius14">
|
||||
<image :src="picUrl" class="slide-image borRadius14" lazy-load />
|
||||
</swiper-item>
|
||||
</block>
|
||||
</swiper>
|
||||
</view>
|
||||
<!-- 时间段列表 -->
|
||||
<view class="flex align-center justify-between ss-p-25">
|
||||
<!-- 左侧图标 -->
|
||||
<view class="time-icon">
|
||||
<image
|
||||
class="ss-w-100 ss-h-100"
|
||||
:src="sheep.$url.static('/static/img/shop/priceTag.png')"
|
||||
/>
|
||||
</view>
|
||||
<scroll-view
|
||||
class="time-list"
|
||||
:scroll-into-view="activeTimeElId"
|
||||
scroll-x
|
||||
scroll-with-animation
|
||||
>
|
||||
<view
|
||||
v-for="(config, index) in timeConfigList"
|
||||
:key="index"
|
||||
:class="['item', { active: activeTimeIndex === index }]"
|
||||
:id="`timeItem${index}`"
|
||||
@tap="handleChangeTimeConfig(index, config.id)"
|
||||
>
|
||||
<!-- 活动起始时间 -->
|
||||
<view class="time">{{ config.startTime }}</view>
|
||||
<!-- 活动状态 -->
|
||||
<view class="status">{{ config?.status }}</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
<!-- 内容区 -->
|
||||
<view class="list-content">
|
||||
<!-- 活动倒计时 -->
|
||||
<view class="content-header ss-flex-col ss-col-center ss-row-center">
|
||||
<view class="content-header-box ss-flex ss-row-center">
|
||||
<view
|
||||
class="countdown-box ss-flex"
|
||||
v-if="activeTimeConfig?.status === TimeStatusEnum.STARTED"
|
||||
>
|
||||
<view class="countdown-title ss-m-r-12">距结束</view>
|
||||
<view class="ss-flex countdown-time">
|
||||
<view class="ss-flex countdown-h">{{ countDown.h }}</view>
|
||||
<view class="ss-m-x-4">:</view>
|
||||
<view class="countdown-num ss-flex ss-row-center">{{ countDown.m }}</view>
|
||||
<view class="ss-m-x-4">:</view>
|
||||
<view class="countdown-num ss-flex ss-row-center">{{ countDown.s }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else> {{ activeTimeConfig?.status }} </view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 活动列表 -->
|
||||
<scroll-view
|
||||
class="scroll-box"
|
||||
:style="{ height: pageHeight + 'rpx' }"
|
||||
scroll-y="true"
|
||||
:scroll-with-animation="false"
|
||||
:enable-back-to-top="true"
|
||||
>
|
||||
<view class="goods-box ss-m-b-20" v-for="activity in activityList" :key="activity.id">
|
||||
<s-goods-column
|
||||
size="lg"
|
||||
:data="{ ...activity, price: activity.seckillPrice }"
|
||||
:goodsFields="goodsFields"
|
||||
:seckillTag="true"
|
||||
>
|
||||
<!-- 抢购进度 -->
|
||||
<template #activity>
|
||||
<view class="limit">
|
||||
限量
|
||||
<text class="ss-m-l-5">{{ activity.stock }} {{ activity.unitName }}</text>
|
||||
</view>
|
||||
<su-progress :percentage="activity.percent" strokeWidth="10" textInside isAnimate />
|
||||
</template>
|
||||
<!-- 抢购按钮 -->
|
||||
<template #cart>
|
||||
<button
|
||||
:class="[
|
||||
'ss-reset-button cart-btn',
|
||||
{ disabled: activeTimeConfig?.status === TimeStatusEnum.END },
|
||||
]"
|
||||
v-if="activeTimeConfig?.status === TimeStatusEnum.WAIT_START"
|
||||
>
|
||||
<span>未开始</span>
|
||||
</button>
|
||||
<button
|
||||
:class="[
|
||||
'ss-reset-button cart-btn',
|
||||
{ disabled: activeTimeConfig?.status === TimeStatusEnum.END },
|
||||
]"
|
||||
@click="sheep.$router.go('/pages/goods/seckill', { id: activity.id })"
|
||||
v-else-if="activeTimeConfig?.status === TimeStatusEnum.STARTED"
|
||||
>
|
||||
<span>马上抢</span>
|
||||
</button>
|
||||
<button
|
||||
:class="[
|
||||
'ss-reset-button cart-btn',
|
||||
{ disabled: activeTimeConfig?.status === TimeStatusEnum.END },
|
||||
]"
|
||||
v-else
|
||||
>
|
||||
<span>已结束</span>
|
||||
</button>
|
||||
</template>
|
||||
</s-goods-column>
|
||||
</view>
|
||||
<uni-load-more
|
||||
v-if="activityTotal > 0"
|
||||
:status="loadStatus"
|
||||
:content-text="{
|
||||
contentdown: '上拉加载更多',
|
||||
}"
|
||||
@tap="loadMore"
|
||||
/>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</s-layout>
|
||||
</template>
|
||||
<script setup>
|
||||
import { computed, nextTick, reactive, ref } from 'vue';
|
||||
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
||||
import sheep from '@/sheep';
|
||||
import { useDurationTime } from '@/sheep/hooks/useGoods';
|
||||
import SeckillApi from '@/sheep/api/promotion/seckill';
|
||||
import dayjs from 'dayjs';
|
||||
import { TimeStatusEnum } from '@/sheep/helper/const';
|
||||
|
||||
// 计算页面高度
|
||||
const { safeAreaInsets, safeArea } = sheep.$platform.device;
|
||||
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
|
||||
const pageHeight =
|
||||
(safeArea.height + safeAreaInsets.bottom) * 2 + statusBarHeight - sheep.$platform.navbar - 350;
|
||||
const headerBg = sheep.$url.css('/static/img/shop/goods/seckill-header.png');
|
||||
|
||||
// 商品控件显示的字段(不显示库存、销量。改为显示自定义的进度条)
|
||||
const goodsFields = {
|
||||
name: {
|
||||
show: true,
|
||||
},
|
||||
introduction: {
|
||||
show: true,
|
||||
},
|
||||
price: {
|
||||
show: true,
|
||||
},
|
||||
marketPrice: {
|
||||
show: true,
|
||||
},
|
||||
};
|
||||
|
||||
//#region 时间段
|
||||
// 时间段列表
|
||||
const timeConfigList = ref([]);
|
||||
// 查询时间段
|
||||
const getSeckillConfigList = async () => {
|
||||
const { data } = await SeckillApi.getSeckillConfigList();
|
||||
const now = dayjs();
|
||||
const today = now.format('YYYY-MM-DD');
|
||||
const select = ref([]);
|
||||
// 判断时间段的状态
|
||||
data.forEach((config, index) => {
|
||||
const startTime = dayjs(`${today} ${config.startTime}`);
|
||||
const endTime = dayjs(`${today} ${config.endTime}`);
|
||||
select.value[index] = config.id;
|
||||
if (now.isBefore(startTime)) {
|
||||
config.status = TimeStatusEnum.WAIT_START;
|
||||
} else if (now.isAfter(endTime)) {
|
||||
config.status = TimeStatusEnum.END;
|
||||
} else {
|
||||
config.status = TimeStatusEnum.STARTED;
|
||||
activeTimeIndex.value = index;
|
||||
}
|
||||
});
|
||||
timeConfigList.value = data;
|
||||
// 默认选中进行中的活动
|
||||
handleChangeTimeConfig(activeTimeIndex.value, select.value[activeTimeIndex.value]);
|
||||
// 滚动到进行中的时间段
|
||||
scrollToTimeConfig(activeTimeIndex.value);
|
||||
};
|
||||
|
||||
// 滚动到指定时间段
|
||||
const activeTimeElId = ref(''); // 当前选中的时间段的元素ID
|
||||
const scrollToTimeConfig = (index) => {
|
||||
nextTick(() => (activeTimeElId.value = `timeItem${index}`));
|
||||
};
|
||||
|
||||
// 切换时间段
|
||||
const activeTimeIndex = ref(0); // 当前选中的时间段的索引
|
||||
const activeTimeConfig = computed(() => timeConfigList.value[activeTimeIndex.value]); // 当前选中的时间段
|
||||
const handleChangeTimeConfig = (index, id) => {
|
||||
activeTimeIndex.value = index;
|
||||
|
||||
// 查询活动列表
|
||||
activityPageParams.pageNo = 1;
|
||||
activityPageParams.configId = id;
|
||||
activityList.value = [];
|
||||
getActivityList();
|
||||
};
|
||||
|
||||
// 倒计时
|
||||
const countDown = computed(() => {
|
||||
const endTime = activeTimeConfig.value?.endTime;
|
||||
if (endTime) {
|
||||
return useDurationTime(`${dayjs().format('YYYY-MM-DD')} ${endTime}`);
|
||||
}
|
||||
});
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region 分页查询活动列表
|
||||
|
||||
// 查询活动列表
|
||||
const activityPageParams = reactive({
|
||||
configId: 0, // 时间段 ID
|
||||
pageNo: 1, // 页码
|
||||
pageSize: 5, // 每页数量
|
||||
});
|
||||
const activityTotal = ref(0); // 活动总数
|
||||
const activityList = ref([]); // 活动列表
|
||||
const loadStatus = ref(''); // 页面加载状态
|
||||
async function getActivityList() {
|
||||
loadStatus.value = 'loading';
|
||||
const { data } = await SeckillApi.getSeckillActivityPage(activityPageParams);
|
||||
data.list.forEach((activity) => {
|
||||
// 计算抢购进度
|
||||
activity.percent = parseInt(
|
||||
(100 * (activity.totalStock - activity.stock)) / activity.totalStock,
|
||||
);
|
||||
});
|
||||
activityList.value = activityList.value.concat(...data.list);
|
||||
activityTotal.value = data.total;
|
||||
|
||||
loadStatus.value = activityList.value.length < activityTotal.value ? 'more' : 'noMore';
|
||||
}
|
||||
|
||||
// 加载更多
|
||||
function loadMore() {
|
||||
if (loadStatus.value !== 'noMore') {
|
||||
activityPageParams.pageNo += 1;
|
||||
getActivityList();
|
||||
}
|
||||
}
|
||||
// 上拉加载更多
|
||||
onReachBottom(() => loadMore());
|
||||
|
||||
//#endregion
|
||||
|
||||
// 页面初始化
|
||||
onLoad(async () => {
|
||||
await getSeckillConfigList();
|
||||
});
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
// 顶部背景图
|
||||
.page-bg {
|
||||
width: 100%;
|
||||
height: 458rpx;
|
||||
background: v-bind(headerBg) no-repeat;
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
|
||||
// 时间段轮播图
|
||||
.header {
|
||||
width: 710rpx;
|
||||
height: 330rpx;
|
||||
margin: -276rpx auto 0 auto;
|
||||
border-radius: 14rpx;
|
||||
overflow: hidden;
|
||||
|
||||
swiper {
|
||||
height: 330rpx !important;
|
||||
border-radius: 14rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 14rpx;
|
||||
overflow: hidden;
|
||||
|
||||
img {
|
||||
border-radius: 14rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 时间段列表:左侧图标
|
||||
.time-icon {
|
||||
width: 75rpx;
|
||||
height: 70rpx;
|
||||
}
|
||||
|
||||
// 时间段列表
|
||||
.time-list {
|
||||
width: 596rpx;
|
||||
white-space: nowrap;
|
||||
|
||||
// 时间段
|
||||
.item {
|
||||
display: inline-block;
|
||||
font-size: 20rpx;
|
||||
color: #666;
|
||||
text-align: center;
|
||||
box-sizing: border-box;
|
||||
margin-right: 30rpx;
|
||||
width: 130rpx;
|
||||
|
||||
// 开始时间
|
||||
.time {
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
// 选中的时间段
|
||||
&.active {
|
||||
.time {
|
||||
color: var(--ui-BG-Main);
|
||||
}
|
||||
|
||||
// 状态
|
||||
.status {
|
||||
height: 30rpx;
|
||||
line-height: 30rpx;
|
||||
border-radius: 15rpx;
|
||||
width: 128rpx;
|
||||
background: linear-gradient(90deg, var(--ui-BG-Main) 0%, var(--ui-BG-Main-gradient) 100%);
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 内容区
|
||||
.list-content {
|
||||
position: relative;
|
||||
z-index: 3;
|
||||
margin: 0 20rpx 0 20rpx;
|
||||
background: #fff;
|
||||
border-radius: 20rpx 20rpx 0 0;
|
||||
|
||||
.content-header {
|
||||
width: 100%;
|
||||
border-radius: 20rpx 20rpx 0 0;
|
||||
height: 150rpx;
|
||||
background: linear-gradient(180deg, #fff4f7, #ffe6ec);
|
||||
|
||||
.content-header-box {
|
||||
width: 678rpx;
|
||||
height: 64rpx;
|
||||
background: rgba($color: #fff, $alpha: 0.66);
|
||||
border-radius: 32px;
|
||||
|
||||
// 场次倒计时内容
|
||||
.countdown-title {
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
line-height: 28rpx;
|
||||
}
|
||||
|
||||
// 场次倒计时
|
||||
.countdown-time {
|
||||
font-size: 28rpx;
|
||||
color: rgba(#ed3c30, 0.23);
|
||||
|
||||
// 场次倒计时:小时部分
|
||||
.countdown-h {
|
||||
font-size: 24rpx;
|
||||
font-family: OPPOSANS;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
padding: 0 4rpx;
|
||||
height: 40rpx;
|
||||
background: rgba(#ed3c30, 0.23);
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
|
||||
// 场次倒计时:分钟、秒
|
||||
.countdown-num {
|
||||
font-size: 24rpx;
|
||||
font-family: OPPOSANS;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
background: rgba(#ed3c30, 0.23);
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 活动列表
|
||||
.scroll-box {
|
||||
height: 900rpx;
|
||||
|
||||
// 活动
|
||||
.goods-box {
|
||||
position: relative;
|
||||
|
||||
// 抢购按钮
|
||||
.cart-btn {
|
||||
position: absolute;
|
||||
bottom: 10rpx;
|
||||
right: 20rpx;
|
||||
z-index: 11;
|
||||
height: 44rpx;
|
||||
line-height: 50rpx;
|
||||
padding: 0 20rpx;
|
||||
border-radius: 25rpx;
|
||||
font-size: 24rpx;
|
||||
color: #fff;
|
||||
background: linear-gradient(90deg, #ff6600 0%, #fe832a 100%);
|
||||
|
||||
&.disabled {
|
||||
background: $gray-b;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
// 秒杀限量商品数
|
||||
.limit {
|
||||
font-size: 22rpx;
|
||||
color: $dark-9;
|
||||
margin-bottom: 5rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,452 @@
|
||||
<!-- 签到界面 -->
|
||||
<template>
|
||||
<s-layout title="签到有礼">
|
||||
<s-empty v-if="state.loading" icon="/static/data-empty.png" text="签到活动还未开始" />
|
||||
<view v-if="state.loading" />
|
||||
<view class="sign-wrap" v-else-if="!state.loading">
|
||||
<!-- 签到日历 -->
|
||||
<view class="content-box calendar">
|
||||
<view class="sign-everyday ss-flex ss-col-center ss-row-between ss-p-x-30">
|
||||
<text class="sign-everyday-title">签到日历</text>
|
||||
<view class="sign-num-box">
|
||||
已连续签到 <text class="sign-num">{{ state.signInfo.continuousDay }}</text> 天
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="list acea-row row-between-wrapper"
|
||||
style="
|
||||
padding: 0 30rpx;
|
||||
height: 240rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
"
|
||||
>
|
||||
<view class="item" v-for="(item, index) in state.signConfigList" :key="index">
|
||||
<view
|
||||
:class="
|
||||
(index === state.signConfigList.length ? 'reward' : '') +
|
||||
' ' +
|
||||
(state.signInfo.continuousDay >= item.day ? 'rewardTxt' : '')
|
||||
"
|
||||
>
|
||||
第{{ item.day }}天
|
||||
</view>
|
||||
<view
|
||||
class="venus"
|
||||
:class="
|
||||
(index + 1 === state.signConfigList.length ? 'reward' : '') +
|
||||
' ' +
|
||||
(state.signInfo.continuousDay >= item.day ? 'venusSelect' : '')
|
||||
"
|
||||
>
|
||||
</view>
|
||||
<view class="num" :class="state.signInfo.continuousDay >= item.day ? 'on' : ''">
|
||||
+ {{ item.point }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 签到按钮 -->
|
||||
<view class="myDateTable">
|
||||
<view class="ss-flex ss-col-center ss-row-center sign-box ss-m-y-40">
|
||||
<button
|
||||
class="ss-reset-button sign-btn"
|
||||
v-if="!state.signInfo.todaySignIn"
|
||||
@tap="onSign"
|
||||
>
|
||||
签到
|
||||
</button>
|
||||
<button class="ss-reset-button already-btn" v-else disabled> 已签到 </button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 签到说明 -->
|
||||
<view class="bg-white ss-m-t-16 ss-p-t-30 ss-p-b-60 ss-p-x-40">
|
||||
<view class="activity-title ss-m-b-30">签到说明</view>
|
||||
<view class="activity-des">1.已累计签到{{ state.signInfo.totalDay }}天</view>
|
||||
<view class="activity-des">
|
||||
2.据说连续签到第 {{ state.maxDay }} 天可获得超额积分,要坚持签到哦~~
|
||||
</view>
|
||||
<view class="activity-des"> 3.积分可以在购物时抵现金结算的哦 ~~</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 签到结果弹窗 -->
|
||||
<su-popup :show="state.showModel" type="center" round="10" :isMaskClick="false">
|
||||
<view class="model-box ss-flex-col">
|
||||
<view class="ss-m-t-56 ss-flex-col ss-col-center">
|
||||
<text class="cicon-check-round"></text>
|
||||
<view class="score-title">
|
||||
<text v-if="state.signResult.point">{{ state.signResult.point }} 积分 </text>
|
||||
<text v-if="state.signResult.experience"> {{ state.signResult.experience }} 经验</text>
|
||||
</view>
|
||||
<view class="model-title ss-flex ss-col-center ss-m-t-22 ss-m-b-30">
|
||||
已连续打卡 {{ state.signResult.day }} 天
|
||||
</view>
|
||||
</view>
|
||||
<view class="model-bg ss-flex-col ss-col-center ss-row-right">
|
||||
<view class="title ss-m-b-64">签到成功</view>
|
||||
<view class="ss-m-b-40">
|
||||
<button class="ss-reset-button confirm-btn" @tap="onConfirm">确认</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</su-popup>
|
||||
</s-layout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import sheep from '@/sheep';
|
||||
import { onReady } from '@dcloudio/uni-app';
|
||||
import { reactive } from 'vue';
|
||||
import SignInApi from '@/sheep/api/member/signin';
|
||||
|
||||
const headerBg = sheep.$url.css('/static/img/shop/app/sign.png');
|
||||
|
||||
const state = reactive({
|
||||
loading: true,
|
||||
|
||||
signInfo: {}, // 签到信息
|
||||
|
||||
signConfigList: [], // 签到配置列表
|
||||
maxDay: 0, // 最大的签到天数
|
||||
|
||||
showModel: false, // 签到弹框
|
||||
signResult: {}, // 签到结果
|
||||
});
|
||||
|
||||
// 发起签到
|
||||
async function onSign() {
|
||||
const { code, data } = await SignInApi.createSignInRecord();
|
||||
if (code !== 0) {
|
||||
return;
|
||||
}
|
||||
state.showModel = true;
|
||||
state.signResult = data;
|
||||
// 重新获得签到信息
|
||||
await getSignInfo();
|
||||
}
|
||||
|
||||
// 签到确认刷新页面
|
||||
function onConfirm() {
|
||||
state.showModel = false;
|
||||
}
|
||||
|
||||
// 获得个人签到统计
|
||||
async function getSignInfo() {
|
||||
const { code, data } = await SignInApi.getSignInRecordSummary();
|
||||
if (code !== 0) {
|
||||
return;
|
||||
}
|
||||
state.signInfo = data;
|
||||
state.loading = false;
|
||||
}
|
||||
|
||||
// 获取签到配置
|
||||
async function getSignConfigList() {
|
||||
const { code, data } = await SignInApi.getSignInConfigList();
|
||||
if (code !== 0) {
|
||||
return;
|
||||
}
|
||||
state.signConfigList = data;
|
||||
if (data.length > 0) {
|
||||
state.maxDay = data[data.length - 1].day;
|
||||
}
|
||||
}
|
||||
|
||||
onReady(() => {
|
||||
getSignInfo();
|
||||
getSignConfigList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.header-box {
|
||||
border-top: 2rpx solid rgba(#dfdfdf, 0.5);
|
||||
}
|
||||
|
||||
// 日历
|
||||
.calendar {
|
||||
background: #fff;
|
||||
|
||||
.sign-everyday {
|
||||
height: 100rpx;
|
||||
background: rgba(255, 255, 255, 1);
|
||||
border: 2rpx solid rgba(223, 223, 223, 0.4);
|
||||
|
||||
.sign-everyday-title {
|
||||
font-size: 32rpx;
|
||||
color: rgba(51, 51, 51, 1);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.sign-num-box {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: rgba(153, 153, 153, 1);
|
||||
|
||||
.sign-num {
|
||||
font-size: 30rpx;
|
||||
font-weight: 600;
|
||||
color: #ff6000;
|
||||
padding: 0 10rpx;
|
||||
font-family: OPPOSANS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 年月日
|
||||
.bar {
|
||||
height: 100rpx;
|
||||
|
||||
.date {
|
||||
font-size: 30rpx;
|
||||
font-family: OPPOSANS;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
line-height: normal;
|
||||
}
|
||||
}
|
||||
|
||||
.cicon-back {
|
||||
margin-top: 6rpx;
|
||||
font-size: 30rpx;
|
||||
color: #c4c4c4;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.cicon-forward {
|
||||
margin-top: 6rpx;
|
||||
font-size: 30rpx;
|
||||
color: #c4c4c4;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
// 星期
|
||||
.week {
|
||||
.week-item {
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: rgba(153, 153, 153, 1);
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
|
||||
// 日历表
|
||||
.myDateTable {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.dateCell {
|
||||
width: calc(750rpx / 7);
|
||||
height: 80rpx;
|
||||
font-size: 26rpx;
|
||||
font-weight: 400;
|
||||
color: rgba(51, 51, 51, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.is-sign {
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
position: relative;
|
||||
|
||||
.is-sign-num {
|
||||
font-size: 24rpx;
|
||||
font-family: OPPOSANS;
|
||||
font-weight: 500;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.is-sign-image {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.cell-num {
|
||||
font-size: 24rpx;
|
||||
font-family: OPPOSANS;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.cicon-title {
|
||||
position: absolute;
|
||||
right: -10rpx;
|
||||
top: -6rpx;
|
||||
font-size: 20rpx;
|
||||
color: red;
|
||||
}
|
||||
|
||||
// 签到按钮
|
||||
.sign-box {
|
||||
height: 140rpx;
|
||||
width: 100%;
|
||||
|
||||
.sign-btn {
|
||||
width: 710rpx;
|
||||
height: 80rpx;
|
||||
border-radius: 35rpx;
|
||||
font-size: 30rpx;
|
||||
font-weight: 500;
|
||||
box-shadow: 0 0.2em 0.5em rgba(#ff6000, 0.4);
|
||||
background: linear-gradient(90deg, #ff6000, #fe832a);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.already-btn {
|
||||
width: 710rpx;
|
||||
height: 80rpx;
|
||||
border-radius: 35rpx;
|
||||
font-size: 30rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
|
||||
.model-box {
|
||||
width: 520rpx;
|
||||
// height: 590rpx;
|
||||
background: linear-gradient(177deg, #ff6000 0%, #fe832a 100%);
|
||||
// background: linear-gradient(177deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
|
||||
border-radius: 10rpx;
|
||||
|
||||
.cicon-check-round {
|
||||
font-size: 70rpx;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.score-title {
|
||||
font-size: 34rpx;
|
||||
font-family: OPPOSANS;
|
||||
font-weight: 500;
|
||||
color: #fcff00;
|
||||
}
|
||||
|
||||
.model-title {
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.model-bg {
|
||||
width: 520rpx;
|
||||
height: 344rpx;
|
||||
background-size: 100% 100%;
|
||||
background-image: v-bind(headerBg);
|
||||
background-repeat: no-repeat;
|
||||
border-radius: 0 0 10rpx 10rpx;
|
||||
|
||||
.title {
|
||||
font-size: 34rpx;
|
||||
font-weight: bold;
|
||||
color: var(--ui-BG-Main-TC);
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.cancel-btn {
|
||||
width: 220rpx;
|
||||
height: 70rpx;
|
||||
border: 2rpx solid #ff6000;
|
||||
border-radius: 35rpx;
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: #ff6000;
|
||||
line-height: normal;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
.confirm-btn {
|
||||
width: 220rpx;
|
||||
height: 70rpx;
|
||||
background: linear-gradient(90deg, #ff6000, #fe832a);
|
||||
box-shadow: 0 0.2em 0.5em rgba(#ff6000, 0.4);
|
||||
border-radius: 35rpx;
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
line-height: normal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//签到说明
|
||||
.activity-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.activity-des {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #666666;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
|
||||
.reward {
|
||||
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEsAAAA4CAYAAAC1+AWFAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQyIDc5LjE2MDkyNCwgMjAxNy8wNy8xMy0wMTowNjozOSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDowYWFmYjU3Mi03MGJhLTRiNDctOTI2Yi0zOThlZDkzZDkxMDkiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6RUEyNzZEMjZEMDFCMTFFOEIzQzhEMjMxNjI1NENDQjciIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6RUEyNzZEMjVEMDFCMTFFOEIzQzhEMjMxNjI1NENDQjciIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTggKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6ZmRjNTM0MmUtNmFkOC1iMDRhLThjZTEtMjk2YWYzM2FkMmUxIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjBhYWZiNTcyLTcwYmEtNGI0Ny05MjZiLTM5OGVkOTNkOTEwOSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PuGQ9m8AAAf3SURBVHja7Jxbb9xEFMe9Xu81u6VJL0kqSCToZ0CCNyp4CQ0FqVAkQAgeEE98EPgEwBOCSoCEQPTCG30BVSpfAaQ2KQ1tc4Fm77v2cv7jmc3UGdvjsTdrJEY68m527Zn5zZlzszeF8XhspWl37/xhZdwK/Di2jqA9ufqM9ndtKz+tTvIpSYdkl7+u52h8lpMjUFdIzvH3VZIPSM6SrHOAM292DkHJ7Rz/rP4/rGhQuQNm5xxUroAVNm//PhUnQ7JEco9LGlBy+znGhsX1O1vNajYbjwm1F0l+JfmN5BeSlwKfx4KybTtWw6TriXao39xpFga8v98q08tPSN7Dn0yvVSqVrEqlbBUKBQvxX78/sIbDoenlxhzs6ySDPNmsj0k+SguqWq0wUGwV6Yj35XIpTXD7Csk3eTPw76c5GUAARtUqlVTA0C5wOzd7WLQF19JoFEAASFRLCQwa9hXJ2rQj+GdJ3sCcQj4vkrw7TVAyMLTBwMiGHSP5luQLEjfkO0O+ZW+ZGPjnuIE8YQoDEyyVnIkdmmaDQxgOR+QU+mku85DkZe5RE23D19KCguYcBSjhEHxNLStBarZTJBdNtuGcqlNVx6q4CBo1iwavipDjsUk6Rdq+I0u1brZdkKpCrDVMYLlBUMVikQ0mGM4EBydWeiYpiaLfWq1GwEbKUAwQPc+Vz3NTlWgEqHq9xo7BpoKVpwbNDwtNbHto9XpdAjaOXWBtWNhWAOV53lQnBiPdarWs+fnjmRr/MLtVLjvUp2O57tCK2wwJ4qxCyECyhXX//n3r3tZWxp4yel4+pPiJRMHydAbR7XYzm5Trutbu3p41pFjq0aNHmV0XY0ywqJ4JrIoOKEwwq7a9s2M5RYe5/+3tnUwXIQGwSlJYyKfeMgVlkprAFu7t/c3OLZfLLLhst9vGmUEKYG/x+WvBQgT7ZTDfE8ZPB5RuCiO33d095o0cx2HhCeThw+1UAbEusIAXbPL5r8XBWuf5UVP2JNgWGLzrelMBhT72yFaVCFSRBK6+SNux1+sxmSYwaDQ0GfOTPGaTc1gPyw2R3nwdTJoRMiCow4U6HXNQKOJ1uz0KAvssGR4MBuw4Gg2ZHyqX/O0HzRKTwHcQw/mhCwLisj8x9EVH9FetViOhYTurkm+EQZgXlAqahf4wvtFoJGsaAshLJD/IcdYaJ1mSV9uvM/mD6fX6oaAANE6jcO6dOxtsUEVKP+yCzVINaJJDAwckTEAu/mG1cRyNXBZlQ8vanY7lkYa77shaWVmJhYVxiSQ7OB6ARLCKz6HNtVqVaR364+Mocy6vkvwEzUKR/6blF/snoDB4ROyixLu/3wodUKMxp5XeQLs2NzdZtGwXAazABolzZZHH4SGgJMCAjF0CaJClpSWr2Wxqb/NWS+0s5Dq+r2Eu30GePJZNkuehWSsyKFmrsPKYWFwqoZsHQlNWV1etra2/2ORlUGF5XhGLxaFiXK5XsM6cXmZbKEm+iPOD2UewXz+tI013SqRdfTmifwqMYOA3SO7GlTUOJ9AHBjLJwyXYamfOLDO7k+Q88c3lpcVEoCYaqkjThH3USI3AZ8PmLz7klcIJcRhFWRWx91VJtDCiSRPbpcVFZqy9iLxNngBGsUigTLytanyYS/Bavn0cMacjadWQ87knQodr3OoPxEm+i+2xFfG3il/qUAEzqVDimsePP0HG2o2EJbRibq7OPKYJqKBxlz2hvIAHc55UIIQ3vBaMs77nVcK2TBkns5WNAQZNTAoM13Y1qhjCrZuACoYNKlAHc+1OlINzuMi5KIPSK5xkS1wEHgzeQUfDkgLr9roJwHanBgoaFfCALc7hSly6A5V7h2RfqCc6hSofxEDZAOt1+4e2GzTN46/F9hQrr5u0q0AdhEKHzQGCXym22ufzv6abSCNivRzMC4O5ol+udZTA9Ap9AxZrjflWw7VOnzrJPF61WmNwvIkJsLW1K9g/dod4LCDchk5eXhYRe5JKaax6IA7DILDqJvZEBJ0O+br5hXlmxEU7eXKBJt2gnPEf2iIdNhlkEY1Gw6D6Opgshka40jcpK8dWUYXhN2mwEdCWEwsL1rFjTeV1EFosLp5ixv3BgwcMmsndueXlZV9L9UridqoafFwIYNKQ0509+3TU40WThpxtdXWFwzKrwWdxtykBrPFkb2dRdweApK1erxvDCltoP2IPv8eQGJbwiOK+4YxuCabS/jDNQgkINldDwSNhFVWBIaDJ/YatWlaqn4UWAYbqoTh8FZ8Fxlo0gdUOrg6LgxSxjsruIC5L+VyVUVNBYZmCMkYrMI0KLGrLxOMhzN9RlTqCEhUYjsfjI9MoPyAeKNMl1bgVzzmg6P+diWbd5BXUS3IFVbFV8XzWXBiwqGg+ac0+rESs6bGxU1I9nxVn4G9FnSylR1e13ElIpK0DzBQUb0hh3iS5nkZ7s3i0+zqHZdR0csmUoJBevJ0WVCaweLuYZjBRwFKC8jioH7OYZCawSLsGJLg5i/tswWwX79fp8wKE27cbKmDI/YRDwBHvFaBw7px0vUJEvxesHD7aLaBd5QPc4H+6jff87+I7yFnOq4DB7eMuTLvdYbfuFWEAzjnPryE3Zb9pzIPSUUzxtzvLJH9a4b+hqfPJvKB5zRsccidlv+awZvyzX11gOqDMVvU/9LPf0C15FKBmarOmACw3oPICSwb2OQlu4+Cxv8/yBCoPNitsAcdWDv9Vwb8CDACdCFE+P8dk8gAAAABJRU5ErkJggg==');
|
||||
width: 75rpx;
|
||||
height: 56rpx;
|
||||
}
|
||||
|
||||
.rewardTxt {
|
||||
width: 74rpx;
|
||||
height: 32rpx;
|
||||
background-color: #f4b409;
|
||||
border-radius: 16rpx;
|
||||
font-size: 20rpx;
|
||||
color: var(--ui-BG-Main-TC);
|
||||
line-height: 32rpx;
|
||||
text-align: center;
|
||||
padding: 2rpx;
|
||||
}
|
||||
|
||||
.venus {
|
||||
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADgAAAA4CAYAAACohjseAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQyIDc5LjE2MDkyNCwgMjAxNy8wNy8xMy0wMTowNjozOSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDowYWFmYjU3Mi03MGJhLTRiNDctOTI2Yi0zOThlZDkzZDkxMDkiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6RDQ3N0E3RkJEMDFCMTFFODhGODVBOTc1NEM5Nzg2NzkiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6RDQ3N0E3RkFEMDFCMTFFODhGODVBOTc1NEM5Nzg2NzkiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTggKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6ZmRjNTM0MmUtNmFkOC1iMDRhLThjZTEtMjk2YWYzM2FkMmUxIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjBhYWZiNTcyLTcwYmEtNGI0Ny05MjZiLTM5OGVkOTNkOTEwOSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PnZClGIAAAT7SURBVHja7JtLcxtFEMdnn1rJUhIrTiS7KLsK/EXwNck3gCMcuUFx4QvACW48buHGMZxJPkiowpjC2LElcKzXSqul/6OdoOB9zezsCCimqmvXtdqd+U33dPf0rq2Tn54zg81KjrGuB75x8FbuddsQWIvkS5IxySA5b5no2DUE94TkKPk7IHmf5JDkUQJdW7MNw623o+Ra698KmAdnDNLeIJwRSHvDcLVDVnYynU771fnLl9eFcLZts+VymQf5iJ6pzfFYJeKgT/IZyTskXdWOPM9jjYbPLMticRyz2Sxk8/lc9XFDksckH1IcDKtq8FOSD6rMIuCCoPHXrBIk/qYDC0MlyO1kTBOSj6uuwXerwPn+63DrrdFo8OsV2ns6nEy3Chwg8lpFyK4OwNrgNGpSvxfFoDzP5etJR8PzsiYETmk+X5BjmpkBrHPGU109TeKqv5X3rT3QQ3ObaPDGRjIZXWZpol+b/cebUUA4iuHw938UoNbk9+zsjP16eqoV4JfjH1uqgLjxe10DiaKIDYZDNqfU7OrqSifjkzxIuwDubV2juLi8ZK7j8oT74uJSJ+BRHqQtC6cS/7A9wtrDvb7v84A9Go2UMyQZSFsWrmz6td4GgyF38a7r8lgGefHiQjnjkYG064ZDmjWktecRnEOCDa9DpjqdTrnUDSk2vJXgsHGdTKa0t5vx/V0Yhvy4WMx5hdf3VqYJDQqTxW+QdmECPM8h8flvPPRFR/QXBEEuKEw9Yz/5AyoDtBkei5zriyw4pGVFmoOHPD7+mQ/ccR1mWzZpyuIacx2Hgzl0FJkIjjBTHBeLiO6LuDZH4zFbRkt63oLt7+8XAmJcIhFP0eTn2C9CgzBTrPjUp7XbW6VSJGjx5OSEBhsz2wGkxc0R967LuukuSWKaFEwMnXJQSL/fZ51Op/QSuL5OdVjY7beFBq2sAlHZ/A8aOTg4YKenv/EBr8Nl5ZUO6jPJRGCg0dJie/d3WbPZlMpPMwpZsN0Y2sOVb7PcOzou22CGe3u7fB3J3Cd+udvvScG9soT0Kt13tAZj4UVRwHmWtZClcj+azX6vxx0GN8ECUFyHjnsEp+KlM8b3TBTKBCDqkA/SIFV20jCbO3duk8OIcgHF7G9ttbinVYFLcTBgeAAP+vc4mAkJVywLibARpZvOjWWA36rApYSI1+DSMhltkJPpRGIyJrXAZeWiWiCnk9kNU4RGl8m5MN1VLFzwWKobLm83kQtZbnMb8lgYJ2aIYH//3g73lEHQ5ECAXYUSu7QWZeCKqmoCcqSyPkQgd8lHbne3uSMRbWenSwNtU476BxtT9oJQOZ3OKKloq6SmmXBlyoZKb3nG4wnXyt1ul9261UkN9ggjvd497mDOz885KGN3pfvKg1OuixY15JCHh2/ymFjUms2AMqD9BFB/qwUQg5ZtrVY9b7H/LxtmZSCbaCr9KgGmpEeG6qpzM2tQBHudb5eKNLfKiUMzgAIyL6uRreHklB9qX4MDlQfLpHUV4AY6AB+rzl4ZyIqa+0aHiX6UlDTwMcK2CqQoEGmEE5+RfFK4N636vWjKh0Cp5ceS38k8JXko8yHQ7W7PXKBPBvYwGegNF4/q12g05mV7HXClqgs1ffEr+/LmaTIx0nCb+uI3U5M64Tadi5aBrBXORLKdB1k7nKndhID8GqUaErze/coEXJ1OJm9CY2bw3wr+FGAAoa6PIUihovYAAAAASUVORK5CYII=');
|
||||
background-repeat: no-repeat;
|
||||
background-size: 100% 100%;
|
||||
width: 56rpx;
|
||||
height: 56rpx;
|
||||
margin: 10rpx auto;
|
||||
}
|
||||
|
||||
.venusSelect {
|
||||
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADgAAAA4CAYAAACohjseAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQyIDc5LjE2MDkyNCwgMjAxNy8wNy8xMy0wMTowNjozOSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDowYWFmYjU3Mi03MGJhLTRiNDctOTI2Yi0zOThlZDkzZDkxMDkiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QzkwRkI4NEFEMDFCMTFFODhDNDdBMDVGOTBBN0U2NTQiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QzkwRkI4NDlEMDFCMTFFODhDNDdBMDVGOTBBN0U2NTQiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTggKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6ZmRjNTM0MmUtNmFkOC1iMDRhLThjZTEtMjk2YWYzM2FkMmUxIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjBhYWZiNTcyLTcwYmEtNGI0Ny05MjZiLTM5OGVkOTNkOTEwOSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PkX00M0AAAfVSURBVHjaxFpdcBNVFD67STbppn9poU0LtSBYykBlgKrjqKOtihbq8ICKILyJwxM+6fjCk2/6pC+O4hs+6fgAbWFw1OID+ICMAwwKlRmKLW3Tpvlrskk3m13Pvdm0NNn//HA73+ymd3Pv+e4595xzT5bJ3DgJNWyMelUqNaD36a8N+9kaEeMR3yAERES952sxsbtya2lIbgQxqH72IT5EbEW8pZKuHkGlugyLyT3aBtW+qpJkKb/qgEeMIAYNnhlUn+Edz2NuokqtNVdTTbqVyhO0Q67qJMt2MnXbTq/cp+9+ZkyOYYFxN4EiLaF5SbokccyKkWRS1z4we4ZDfIE4hmhxvJLNu8HTtg85ekGRRcjOXwIp9pfT4aKIs4iP+f4zYrl78HPEqbLMJNAPXHBI/SQjSTd+PoD3LpCi15wMGVBlSiM+NfSihJ8Jjlt4Rheu5n7wtL+B93IJPO37aH8Z45+ohBdtKUtz7a+jJLK+/dN+BTX5p5MpWh6HF6XNE9iLwr9mSG6VZP65bPR6NVI1BwQZF3BtA+Bq2oG3Pt3HFCVnfUHaX6XQHCeXgVz8Nojz4+SDzTgo2yfIBV9G89utzi5DtRvDcnQ+JSciyd+rH+hdjb22tFOp5mreCUrocg0CPet5LATJvHbldWSiGllIzZpdeR2ZqFPtZTNJSIQeQGv3DucEbcrLmkRSXvP/cs4RZm6Ow/T1McffpyiSJTZ+jDfOZFDlOuARo5p9aKJ2IYkpCN+9AmLsIcSm/3Y0BkWpPCPRX9/nDVI1BTTAI0YRA9r99gWbv3MF90MGvG4WQrfHnRMslWcQMRL55SivbaJk064FjxhFDGj0gad5u22zkrMZiExcBQ7JcW4GlhfuQ3L+gSMTzc9fItcgYiTy8xHeTIOGmnMHtoEn2G971cP3MAUTk+B2MeBBkh4kGbp92ZEGyfxEDj1NLl56j9fbg4U9N6C179zNPZhK7cV7yRZkSYTI3atIjgUXywCLINf03L8gRGZtj0dA5CDyaMg5SPZk+OLhFZLMwtg7hTLDKGJAM09s6QGuY6+upxLTKcgkFmE5FUdFIYQEiHgv4VURl4BjgZon0SA9EeKKi1kZliU8Nnn84OabwIPw+huB8zdR+OqbwdcYMAwB4ux1yEYmtLp+I5WBdft/EApx8Cs9cu6mblyxXXTl9FpOFGDyjzGQMwlwIQlUEDAMagqvhBTVHl4ZplDezpsq+UdOTkMuIcByfBYElCWHmsgpLHQ/NwTe+gaTBH0XWkgGpPgDrfLHl4gTTOj8IVLdTqkF2aIslwF+2zCeGDjzIJ5OwtSVc6Cko9QMCUmWyZMiZJn8cI8E7Lwm11wJOTypBPuHoCG4yVrgz2VBmFBj69pGTvv1hVSN0XSxHE8LRUbaW9G01wdPvHgQQtcugJwMU5LFpIrWDjXMUGIsMNRR5DwcBPcMQV1L0NKchYHIkU2WkiVrTvgT6XEjyN/TY08R5KyAaWc6n3tagMvjhuCzQ+jlOmylVPRZjw/an9kPdYF1lucjIPLJmERoyP9j+8GflIIXPYW4XOKVJAmWZ27Y8nAMaq5t9yB4WjeumJ4hOaIErx/W978JXH2TbY9K5ZNKMhzC5dSjyTapQ5IyFxozvLJGz9Hp/Am+Y7utH8kan+yDhYVp8lVgdDWX33f+ji3gruNpnLPTxNl/8vKtbeTAeKDj0DmhuGShT3Jxkp4guGCv5cnT0QX0hgq4dOnBSshIxxehUbZJbu4OSJEpbXJvnxf0zoP6JMP/keVGTfZYEiCDQlttmXjE1hlTnJ3A+Ketuc53RwSz86AuSXFxitYzueBWUyGWE9E1pqiozoRhXdQJMLAaEyUMMdJyGp2Ux4Lm7iG5h5rkNhweFUpLFtonZANNTmOA3WzmFiGLGY3XlSel0DpOCzRs6gWXj4fkgwnIhKZIcKDhgsTLTCICfMs683gb1tbchiNjgt0TfYFkym7JQkyl8nkoixkMesiGzT1Q19q20t+0dTvwnU/A0iQSDYeoNinBQLOTE/2BjUcvCE5rMoJ2XcSYYBr3FOPmoHHLU+APdtJMpvg7bp8XAr19mKJ1weK9u5CJxUDpMt+HxfJ2HbsoVLzwa1aT4fw8dD3/Au43lv7YYjQF19gAHXv6UYMJa7UepQZFJzMT9fp9lJidorCvgbfkSRXbBB2UDRX5MdREnZYNwZECRcxQXLUnl8s5KPw6MNFsdBFzzdaaE8xGwrUx0eXZORrw3c1NNdEk0ZwUi2OQn7fvZBz9fEZKDjNzFLqn7dYApnVtNtKvecx5oxVfHCsmSt4ts/0rrxiO5NO6jvUWyC0guZgT+SPllu4Jzjr9AT0bjqKWQ1qH0RWQfvKcwzm+s6BB01X6RC1pHIf82w02NRmnsng7WjX28iJqLu5Ec4XXSE5XYg+S91A+UlHS/H2riXfq1n3N8mM2HKOOgutsodkNqZKIMxGQokvFw40jhnFMoZZ70CzyrpLd2S0kb00Oa5KMJDC8LAHL4QEmK4HGKYaSq+/bJFTyZ/GyX+VK3pzUStA1SRJrkTNZrWHG1e8IGuMZt5eqrUH9U8iwUbVci1w1BKnW65RWSVaVnBomAKoI3E9IQEEipX3jap9Q1hxmBElBocp/AmIYcQaRQSQQ36r/E8odvepOxoa5khfRT1pf+8q0/wUYAFU/P0XyeZQPAAAAAElFTkSuQmCC');
|
||||
}
|
||||
|
||||
.num {
|
||||
font-size: 36rpx;
|
||||
font-family: 'Guildford Pro';
|
||||
}
|
||||
|
||||
.item {
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
flex-direction: column;
|
||||
height: 130rpx;
|
||||
}
|
||||
|
||||
.reward {
|
||||
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEsAAAA4CAYAAAC1+AWFAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQyIDc5LjE2MDkyNCwgMjAxNy8wNy8xMy0wMTowNjozOSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDowYWFmYjU3Mi03MGJhLTRiNDctOTI2Yi0zOThlZDkzZDkxMDkiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6RUEyNzZEMjZEMDFCMTFFOEIzQzhEMjMxNjI1NENDQjciIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6RUEyNzZEMjVEMDFCMTFFOEIzQzhEMjMxNjI1NENDQjciIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTggKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6ZmRjNTM0MmUtNmFkOC1iMDRhLThjZTEtMjk2YWYzM2FkMmUxIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjBhYWZiNTcyLTcwYmEtNGI0Ny05MjZiLTM5OGVkOTNkOTEwOSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PuGQ9m8AAAf3SURBVHja7Jxbb9xEFMe9Xu81u6VJL0kqSCToZ0CCNyp4CQ0FqVAkQAgeEE98EPgEwBOCSoCEQPTCG30BVSpfAaQ2KQ1tc4Fm77v2cv7jmc3UGdvjsTdrJEY68m527Zn5zZlzszeF8XhspWl37/xhZdwK/Di2jqA9ufqM9ndtKz+tTvIpSYdkl7+u52h8lpMjUFdIzvH3VZIPSM6SrHOAM292DkHJ7Rz/rP4/rGhQuQNm5xxUroAVNm//PhUnQ7JEco9LGlBy+znGhsX1O1vNajYbjwm1F0l+JfmN5BeSlwKfx4KybTtWw6TriXao39xpFga8v98q08tPSN7Dn0yvVSqVrEqlbBUKBQvxX78/sIbDoenlxhzs6ySDPNmsj0k+SguqWq0wUGwV6Yj35XIpTXD7Csk3eTPw76c5GUAARtUqlVTA0C5wOzd7WLQF19JoFEAASFRLCQwa9hXJ2rQj+GdJ3sCcQj4vkrw7TVAyMLTBwMiGHSP5luQLEjfkO0O+ZW+ZGPjnuIE8YQoDEyyVnIkdmmaDQxgOR+QU+mku85DkZe5RE23D19KCguYcBSjhEHxNLStBarZTJBdNtuGcqlNVx6q4CBo1iwavipDjsUk6Rdq+I0u1brZdkKpCrDVMYLlBUMVikQ0mGM4EBydWeiYpiaLfWq1GwEbKUAwQPc+Vz3NTlWgEqHq9xo7BpoKVpwbNDwtNbHto9XpdAjaOXWBtWNhWAOV53lQnBiPdarWs+fnjmRr/MLtVLjvUp2O57tCK2wwJ4qxCyECyhXX//n3r3tZWxp4yel4+pPiJRMHydAbR7XYzm5Trutbu3p41pFjq0aNHmV0XY0ywqJ4JrIoOKEwwq7a9s2M5RYe5/+3tnUwXIQGwSlJYyKfeMgVlkprAFu7t/c3OLZfLLLhst9vGmUEKYG/x+WvBQgT7ZTDfE8ZPB5RuCiO33d095o0cx2HhCeThw+1UAbEusIAXbPL5r8XBWuf5UVP2JNgWGLzrelMBhT72yFaVCFSRBK6+SNux1+sxmSYwaDQ0GfOTPGaTc1gPyw2R3nwdTJoRMiCow4U6HXNQKOJ1uz0KAvssGR4MBuw4Gg2ZHyqX/O0HzRKTwHcQw/mhCwLisj8x9EVH9FetViOhYTurkm+EQZgXlAqahf4wvtFoJGsaAshLJD/IcdYaJ1mSV9uvM/mD6fX6oaAANE6jcO6dOxtsUEVKP+yCzVINaJJDAwckTEAu/mG1cRyNXBZlQ8vanY7lkYa77shaWVmJhYVxiSQ7OB6ARLCKz6HNtVqVaR364+Mocy6vkvwEzUKR/6blF/snoDB4ROyixLu/3wodUKMxp5XeQLs2NzdZtGwXAazABolzZZHH4SGgJMCAjF0CaJClpSWr2Wxqb/NWS+0s5Dq+r2Eu30GePJZNkuehWSsyKFmrsPKYWFwqoZsHQlNWV1etra2/2ORlUGF5XhGLxaFiXK5XsM6cXmZbKEm+iPOD2UewXz+tI013SqRdfTmifwqMYOA3SO7GlTUOJ9AHBjLJwyXYamfOLDO7k+Q88c3lpcVEoCYaqkjThH3USI3AZ8PmLz7klcIJcRhFWRWx91VJtDCiSRPbpcVFZqy9iLxNngBGsUigTLytanyYS/Bavn0cMacjadWQ87knQodr3OoPxEm+i+2xFfG3il/qUAEzqVDimsePP0HG2o2EJbRibq7OPKYJqKBxlz2hvIAHc55UIIQ3vBaMs77nVcK2TBkns5WNAQZNTAoM13Y1qhjCrZuACoYNKlAHc+1OlINzuMi5KIPSK5xkS1wEHgzeQUfDkgLr9roJwHanBgoaFfCALc7hSly6A5V7h2RfqCc6hSofxEDZAOt1+4e2GzTN46/F9hQrr5u0q0AdhEKHzQGCXym22ufzv6abSCNivRzMC4O5ol+udZTA9Ap9AxZrjflWw7VOnzrJPF61WmNwvIkJsLW1K9g/dod4LCDchk5eXhYRe5JKaax6IA7DILDqJvZEBJ0O+br5hXlmxEU7eXKBJt2gnPEf2iIdNhlkEY1Gw6D6Opgshka40jcpK8dWUYXhN2mwEdCWEwsL1rFjTeV1EFosLp5ixv3BgwcMmsndueXlZV9L9UridqoafFwIYNKQ0509+3TU40WThpxtdXWFwzKrwWdxtykBrPFkb2dRdweApK1erxvDCltoP2IPv8eQGJbwiOK+4YxuCabS/jDNQgkINldDwSNhFVWBIaDJ/YatWlaqn4UWAYbqoTh8FZ8Fxlo0gdUOrg6LgxSxjsruIC5L+VyVUVNBYZmCMkYrMI0KLGrLxOMhzN9RlTqCEhUYjsfjI9MoPyAeKNMl1bgVzzmg6P+diWbd5BXUS3IFVbFV8XzWXBiwqGg+ac0+rESs6bGxU1I9nxVn4G9FnSylR1e13ElIpK0DzBQUb0hh3iS5nkZ7s3i0+zqHZdR0csmUoJBevJ0WVCaweLuYZjBRwFKC8jioH7OYZCawSLsGJLg5i/tswWwX79fp8wKE27cbKmDI/YRDwBHvFaBw7px0vUJEvxesHD7aLaBd5QPc4H+6jff87+I7yFnOq4DB7eMuTLvdYbfuFWEAzjnPryE3Zb9pzIPSUUzxtzvLJH9a4b+hqfPJvKB5zRsccidlv+awZvyzX11gOqDMVvU/9LPf0C15FKBmarOmACw3oPICSwb2OQlu4+Cxv8/yBCoPNitsAcdWDv9Vwb8CDACdCFE+P8dk8gAAAABJRU5ErkJggg==');
|
||||
width: 75rpx;
|
||||
height: 56rpx;
|
||||
}
|
||||
|
||||
.on {
|
||||
color: #f4b409;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,351 @@
|
||||
<template>
|
||||
<s-pages tabbar="/pages/cart/cart" title="购物车" :showLeftButton="false" color="#ffffff">
|
||||
<s-empty
|
||||
v-if="state.list.length === 0"
|
||||
icon="/static/cart-empty.png"
|
||||
text="购物车空空如也,快去逛逛吧~"
|
||||
/>
|
||||
|
||||
<!-- 头部 -->
|
||||
<view v-if="state.list.length" class="cart-box ss-flex ss-flex-col ss-row-between">
|
||||
<view class="cart-header ss-flex ss-col-center ss-row-between ss-p-x-30">
|
||||
<view></view>
|
||||
<view class="header-right">
|
||||
<view v-if="state.editMode" class="" @tap="onChangeEditMode(false)"> 取消 </view>
|
||||
<view v-else class="f500" @tap="onChangeEditMode(true)"> 管理 </view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 内容 -->
|
||||
<view class="cart-content ss-flex-1 ss-p-x-30 ss-m-b-40 m-b-100">
|
||||
<view
|
||||
v-for="item in state.list"
|
||||
:key="item.id"
|
||||
class="goods-box ss-r-10"
|
||||
@click="goInfo(item.spu.id)"
|
||||
>
|
||||
<view class="ss-flex ss-col-center">
|
||||
<label
|
||||
class="check-box ss-flex ss-col-center ss-p-l-10"
|
||||
@tap.stop="onSelectSingle(item.id)"
|
||||
>
|
||||
<radio
|
||||
:checked="state.selectedIds.includes(item.id)"
|
||||
color="var(--color32)"
|
||||
style="transform: scale(0.8)"
|
||||
backgroundColor="var(--color31)"
|
||||
@tap.stop="onSelectSingle(item.id)"
|
||||
/>
|
||||
</label>
|
||||
|
||||
<s-goods-item
|
||||
:img="item.spu.picUrl || item.goods.image"
|
||||
:price="item.sku?.price || 0"
|
||||
:skuText="
|
||||
item.sku?.properties.length > 1
|
||||
? item.sku?.properties.reduce(
|
||||
(items2, items) => items2.valueName + ' ' + items.valueName,
|
||||
)
|
||||
: item.sku?.properties[0].valueName
|
||||
"
|
||||
:title="item.spu.name"
|
||||
:titleWidth="400"
|
||||
priceColor="#FF3000"
|
||||
>
|
||||
<template v-if="!state.editMode" v-slot:tool>
|
||||
<view
|
||||
v-if="item.spu?.status !== 1 && !state.editMode"
|
||||
class="down-box size24"
|
||||
style="text-align: left; color: #999"
|
||||
>
|
||||
该商品已下架
|
||||
</view>
|
||||
<view
|
||||
v-else-if="item.spu?.stock <= 0 && !state.editMode"
|
||||
class="down-box size24"
|
||||
style="text-align: left; color: #999"
|
||||
>
|
||||
该商品无库存
|
||||
</view>
|
||||
<su-number-box
|
||||
v-else
|
||||
v-model="item.count"
|
||||
:max="item.sku?.stock"
|
||||
:min="0"
|
||||
:step="1"
|
||||
@change="onNumberChange($event, item)"
|
||||
background="var(--color18)"
|
||||
color="var(--color34)"
|
||||
/>
|
||||
</template>
|
||||
</s-goods-item>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 底部 -->
|
||||
<su-fixed v-if="state.list.length > 0" :isInset="false" :val="valNum" bottom placeholder>
|
||||
<view class="cart-footer ss-flex ss-col-center ss-row-between ss-p-x-30 border-bottom">
|
||||
<view class="ss-flex ss-col-center flex1">
|
||||
<label class="check-box ss-flex ss-col-center ss-p-r-30 flex1" @tap="onSelectAll">
|
||||
<radio
|
||||
:checked="state.isAllSelected"
|
||||
color="var(--color32)"
|
||||
style="transform: scale(0.8)"
|
||||
backgroundColor="var(--color31)"
|
||||
@tap.stop="onSelectAll"
|
||||
/>
|
||||
<view class="ss-m-l-8 c0"> 全选</view>
|
||||
</label>
|
||||
<view class="flex-center" style="margin-right: 14rpx">
|
||||
<text class="size26 c0">总计:</text>
|
||||
|
||||
<view class="price-text c13">
|
||||
<span class="f500">¥</span>
|
||||
<span class="priceNum">
|
||||
{{ fen2yuan(state.totalPriceSelected) }}
|
||||
</span>
|
||||
</view>
|
||||
<!-- <view class="text-price price-text size34" style="color: #ee0a24">
|
||||
{{ fen2yuan(state.totalPriceSelected) }}
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
<view class="footer-right">
|
||||
<button
|
||||
v-if="state.editMode"
|
||||
class="ss-reset-button pay-btn ui-Shadow-Main"
|
||||
@tap="onDelete"
|
||||
>
|
||||
删除
|
||||
</button>
|
||||
<button v-else class="ss-reset-button pay-btn ui-Shadow-Main" @tap="onConfirm">
|
||||
去结算
|
||||
{{ state.selectedIds?.length ? `(${state.selectedIds.length})` : '' }}
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</su-fixed>
|
||||
</view>
|
||||
</s-pages>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import sheep from '@/sheep';
|
||||
import { onShow, onLoad } from '@dcloudio/uni-app';
|
||||
import SpuApi from '@/sheep/api/product/spu';
|
||||
import { computed, reactive } from 'vue';
|
||||
import { fen2yuan } from '@/sheep/hooks/useGoods';
|
||||
import { isEmpty } from '@/sheep/helper/utils';
|
||||
onLoad(() => {
|
||||
uni.hideNavigationBarLoading();
|
||||
});
|
||||
// 隐藏原生tabBar
|
||||
// uni.hideTabBar({
|
||||
// fail: () => {},
|
||||
// });
|
||||
|
||||
const sys_navBar = sheep.$platform.navbar;
|
||||
const cart = sheep.$store('cart');
|
||||
|
||||
const state = reactive({
|
||||
editMode: computed(() => cart.editMode),
|
||||
list: computed(() => cart.list),
|
||||
selectedList: [],
|
||||
selectedIds: computed(() => cart.selectedIds),
|
||||
isAllSelected: computed(() => cart.isAllSelected),
|
||||
totalPriceSelected: computed(() => cart.totalPriceSelected),
|
||||
});
|
||||
|
||||
// 单选选中
|
||||
function onSelectSingle(id) {
|
||||
cart.selectSingle(id);
|
||||
}
|
||||
|
||||
// 编辑、取消
|
||||
function onChangeEditMode(flag) {
|
||||
cart.onChangeEditMode(flag);
|
||||
}
|
||||
|
||||
// 全选
|
||||
function onSelectAll() {
|
||||
cart.selectAll(!state.isAllSelected);
|
||||
}
|
||||
|
||||
// 结算
|
||||
async function onConfirm() {
|
||||
const items = [];
|
||||
state.selectedList = state.list.filter((item) => state.selectedIds.includes(item.id));
|
||||
state.selectedList.map((item) => {
|
||||
// 此处前端做出修改
|
||||
items.push({
|
||||
skuId: item.sku?.id,
|
||||
count: item.count,
|
||||
cartId: item.id,
|
||||
categoryId: item.spu.categoryId,
|
||||
});
|
||||
});
|
||||
if (isEmpty(items)) {
|
||||
sheep.$helper.toast('请先选择商品');
|
||||
return;
|
||||
}
|
||||
if (fen2yuan(state.totalPriceSelected) >= 5000) {
|
||||
sheep.$helper.toast('订单金额不能超过5000元, 请重新选择商品');
|
||||
return;
|
||||
}
|
||||
await validateDeliveryType(state.selectedList.map((item) => item.spu).map((spu) => spu.id));
|
||||
sheep.$router.go('/pages/order/confirm', {
|
||||
data: JSON.stringify({
|
||||
items,
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验配送方式冲突
|
||||
*
|
||||
* @param {string[]} spuIds - 商品ID数组
|
||||
* @returns {Promise<void>}
|
||||
* @throws {Error} 当配送方式冲突或获取商品信息失败时抛出错误
|
||||
*/
|
||||
async function validateDeliveryType(spuIds) {
|
||||
// 获取商品信息
|
||||
const { data: spuList } = await SpuApi.getSpuListByIds(spuIds.join(','));
|
||||
if (isEmpty(spuList)) {
|
||||
sheep.$helper.toast('未找到商品信息');
|
||||
throw new Error('未找到商品信息');
|
||||
}
|
||||
// 获取所有商品的配送方式列表
|
||||
const deliveryTypesList = spuList.map((item) => item.deliveryTypes);
|
||||
// 检查配送方式冲突
|
||||
const hasConflict = checkDeliveryConflicts(deliveryTypesList);
|
||||
if (hasConflict) {
|
||||
sheep.$helper.toast('选中商品支持的配送方式冲突,不允许提交');
|
||||
throw new Error('选中商品支持的配送方式冲突,不允许提交');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查配送方式列表中是否存在冲突
|
||||
* @description
|
||||
* 示例场景:
|
||||
* A 商品支持:[快递, 自提]
|
||||
* B 商品支持:[快递]
|
||||
* C 商品支持:[自提]
|
||||
*
|
||||
* 对比结果:
|
||||
* A 和 B:不冲突 (有交集:快递)
|
||||
* A 和 C:不冲突 (有交集:自提)
|
||||
* B 和 C:冲突 (无交集)
|
||||
* @param {Array<Array<number>>} deliveryTypesList - 配送方式列表的数组
|
||||
* @returns {boolean} 是否存在冲突
|
||||
*/
|
||||
function checkDeliveryConflicts(deliveryTypesList) {
|
||||
for (let i = 0; i < deliveryTypesList.length - 1; i++) {
|
||||
const currentTypes = deliveryTypesList[i];
|
||||
for (let j = i + 1; j < deliveryTypesList.length; j++) {
|
||||
const nextTypes = deliveryTypesList[j];
|
||||
// 检查是否没有交集(即冲突)
|
||||
const hasNoIntersection = !currentTypes.some((type) => nextTypes.includes(type));
|
||||
if (hasNoIntersection) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function onNumberChange(e, cartItem) {
|
||||
//console.log(e);
|
||||
if (e === 0) {
|
||||
cart.delete(cartItem.id);
|
||||
return;
|
||||
}
|
||||
if (cartItem.goods_num === e) return;
|
||||
cartItem.goods_num = e;
|
||||
cart.update({
|
||||
goods_id: cartItem.id,
|
||||
goods_num: e,
|
||||
goods_sku_price_id: cartItem.goods_sku_price_id,
|
||||
});
|
||||
}
|
||||
|
||||
async function onDelete() {
|
||||
cart.delete(state.selectedIds);
|
||||
}
|
||||
|
||||
function getCartList() {
|
||||
cart.getList();
|
||||
}
|
||||
|
||||
onShow(() => {
|
||||
getCartList();
|
||||
});
|
||||
const goInfo = (id) => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/goods/info?id=' + id,
|
||||
});
|
||||
};
|
||||
let valNum = ref(0);
|
||||
// #ifdef APP-PLUS
|
||||
valNum.value = 0;
|
||||
// #endif
|
||||
|
||||
// #ifndef APP-PLUS
|
||||
valNum.value = 50;
|
||||
// #endif
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
:deep(.ui-fixed) {
|
||||
height: 72rpx;
|
||||
}
|
||||
|
||||
.cart-box {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
border-radius: 0 0 16rpx 16rpx;
|
||||
overflow: hidden;
|
||||
|
||||
.cart-header {
|
||||
height: 70rpx;
|
||||
width: 100%;
|
||||
// position: fixed;
|
||||
// left: 0;
|
||||
// top: v-bind('sys_navBar') rpx;
|
||||
z-index: 1000;
|
||||
box-sizing: border-box;
|
||||
border-radius: 16rpx 16rpx 0 0;
|
||||
}
|
||||
|
||||
.cart-footer {
|
||||
height: 100rpx;
|
||||
background-color: var(--color16);
|
||||
box-shadow: 0px 0px 18px 0px rgba(0, 0, 0, 0.04);
|
||||
|
||||
.pay-btn {
|
||||
width: 180rpx;
|
||||
height: 70rpx;
|
||||
font-size: 28rpx;
|
||||
line-height: 28rpx;
|
||||
font-weight: 500;
|
||||
border-radius: 40rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.cart-content {
|
||||
.goods-box {
|
||||
position: relative;
|
||||
margin-bottom: 22rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
.price-text {
|
||||
.priceNum {
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
.ss-reset-button {
|
||||
background: linear-gradient(270deg, #f7772e 0%, #ee0a24 99%);
|
||||
color: #ffffff;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,19 @@
|
||||
<template>
|
||||
<s-goods-item
|
||||
:title="goodsData.spuName"
|
||||
:img="goodsData.picUrl"
|
||||
:price="goodsData.price"
|
||||
:skuText="goodsData.introduction"
|
||||
priceColor="#FF3000"
|
||||
:titleWidth="400"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
goodsData: {
|
||||
type: Object,
|
||||
default: {},
|
||||
},
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,109 @@
|
||||
<template>
|
||||
<view class="send-wrap ss-flex">
|
||||
<view class="left ss-flex ss-flex-1">
|
||||
<optimize-input
|
||||
class="ss-flex-1 ss-p-l-22"
|
||||
:inputBorder="false"
|
||||
:clearable="false"
|
||||
v-model="message"
|
||||
placeholder="请输入你要咨询的问题"
|
||||
></optimize-input>
|
||||
</view>
|
||||
<text class="sicon-basic bq" @tap.stop="onTools('emoji')"></text>
|
||||
<text
|
||||
v-if="!message"
|
||||
class="sicon-edit"
|
||||
:class="{ 'is-active': toolsMode === 'tools' }"
|
||||
@tap.stop="onTools('tools')"
|
||||
/>
|
||||
<button
|
||||
v-if="message"
|
||||
class="ss-reset-button send-btn"
|
||||
@tap="sendMessage"
|
||||
:disabled="isDisabled || sending"
|
||||
:class="{ disabled: isDisabled || sending }"
|
||||
>
|
||||
<text v-if="sending">发送中</text>
|
||||
<text v-else>发送</text>
|
||||
</button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, ref, onUnmounted } from 'vue';
|
||||
import OptimizeInput from '@/pages/chat/components/optimize-input.vue';
|
||||
/**
|
||||
* 消息发送组件
|
||||
*/
|
||||
const props = defineProps({
|
||||
// 消息
|
||||
modelValue: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
// 工具模式
|
||||
toolsMode: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
});
|
||||
const emits = defineEmits(['update:modelValue', 'onTools', 'sendMessage']);
|
||||
const message = computed({
|
||||
get() {
|
||||
return props.modelValue;
|
||||
},
|
||||
set(newValue) {
|
||||
emits(`update:modelValue`, newValue);
|
||||
},
|
||||
});
|
||||
|
||||
// 打开工具菜单
|
||||
function onTools(mode) {
|
||||
emits('onTools', mode);
|
||||
}
|
||||
|
||||
// 发送消息
|
||||
function sendMessage() {
|
||||
emits('sendMessage');
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.send-wrap {
|
||||
padding: 18rpx 20rpx;
|
||||
background: #fff;
|
||||
|
||||
.left {
|
||||
height: 64rpx;
|
||||
border-radius: 32rpx;
|
||||
background: var(--ui-BG-1);
|
||||
}
|
||||
|
||||
.bq {
|
||||
font-size: 50rpx;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
|
||||
.sicon-edit {
|
||||
font-size: 50rpx;
|
||||
margin-left: 10rpx;
|
||||
transform: rotate(0deg);
|
||||
transition: all linear 0.2s;
|
||||
|
||||
&.is-active {
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
}
|
||||
|
||||
.send-btn {
|
||||
width: 100rpx;
|
||||
height: 60rpx;
|
||||
line-height: 60rpx;
|
||||
border-radius: 30rpx;
|
||||
background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
|
||||
font-size: 26rpx;
|
||||
color: #fff;
|
||||
margin-left: 11rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,293 @@
|
||||
<template>
|
||||
<!-- 聊天列表使用scroll-view原生组件,整体倒置 -->
|
||||
<scroll-view
|
||||
:scroll-top="scroll.top"
|
||||
class="chat-scroll-view"
|
||||
scroll-y
|
||||
:refresher-enabled="false"
|
||||
@scroll="onScroll"
|
||||
@scrolltolower="loadMoreHistory"
|
||||
style="transform: scaleY(-1)"
|
||||
>
|
||||
<!-- 消息列表容器 -->
|
||||
<view class="message-container">
|
||||
<!-- 加载更多提示 -->
|
||||
<view v-if="isLoading" class="loading-more" style="transform: scaleY(-1)">
|
||||
<text>加载中...</text>
|
||||
</view>
|
||||
<!-- 消息列表 -->
|
||||
<view class="message-list">
|
||||
<view
|
||||
v-for="(item, index) in messageList"
|
||||
:key="item.id"
|
||||
class="message-item"
|
||||
style="transform: scaleY(-1)"
|
||||
>
|
||||
<!-- 消息渲染 -->
|
||||
<MessageListItem
|
||||
:message="item"
|
||||
:message-index="index"
|
||||
:message-list="messageList"
|
||||
></MessageListItem>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<!-- 底部聊天输入框 -->
|
||||
<su-fixed bottom>
|
||||
<view v-if="showTip" class="back-top ss-flex ss-row-center ss-m-b-10" @tap="scrollToTop">
|
||||
<text class="back-top-item ss-flex ss-row-center">
|
||||
{{ showNewMessageTip ? '有新消息' : '回到底部' }}
|
||||
</text>
|
||||
</view>
|
||||
<slot name="bottom"></slot>
|
||||
</su-fixed>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import MessageListItem from '@/pages/chat/components/messageListItem.vue';
|
||||
import { onMounted, reactive, ref, computed } from 'vue';
|
||||
import KeFuApi from '@/sheep/api/promotion/kefu';
|
||||
import { isEmpty } from '@/sheep/helper/utils';
|
||||
import { formatDate } from '@/sheep/helper/utils';
|
||||
import sheep from '@/sheep';
|
||||
|
||||
const { safeAreaInsets } = sheep.$platform.device;
|
||||
const safeAreaInsetsBottom = safeAreaInsets.bottom + 'px'; // 底部安全区域
|
||||
const messageList = ref([]); // 消息列表
|
||||
const showTip = ref(false); // 显示提示
|
||||
const showNewMessageTip = ref(false); // 显示有新消息提示
|
||||
const refreshMessage = ref(false); // 更新消息列表
|
||||
const isLoading = ref(false); // 是否正在加载更多
|
||||
const hasMore = ref(true); // 是否还有更多数据
|
||||
const keyboardHeight = ref(0); // 键盘高度
|
||||
const scroll = ref({
|
||||
top: 0,
|
||||
oldTop: 0,
|
||||
}); // 滚动位置记录
|
||||
const queryParams = reactive({
|
||||
no: 1,
|
||||
limit: 20,
|
||||
createTime: undefined,
|
||||
}); // 查询参数
|
||||
|
||||
// 计算聊天窗口高度
|
||||
const chatScrollHeight = computed(() => {
|
||||
const baseHeight = 'calc(100vh - 150px - ' + safeAreaInsetsBottom + ')';
|
||||
if (keyboardHeight.value > 0) {
|
||||
// 键盘弹起状态,减去键盘高度
|
||||
return `calc(${baseHeight} - ${keyboardHeight.value}px)`;
|
||||
}
|
||||
return baseHeight;
|
||||
});
|
||||
|
||||
// 获得消息分页列表
|
||||
const getMessageList = async () => {
|
||||
isLoading.value = true;
|
||||
try {
|
||||
const { data } = await KeFuApi.getKefuMessageList(queryParams);
|
||||
if (isEmpty(data)) {
|
||||
hasMore.value = false;
|
||||
return;
|
||||
}
|
||||
if (queryParams.no > 1 && refreshMessage.value) {
|
||||
const newMessageList = [];
|
||||
for (const message of data) {
|
||||
if (messageList.value.some((val) => val.id === message.id)) {
|
||||
continue;
|
||||
}
|
||||
newMessageList.push(message);
|
||||
}
|
||||
// 新消息追加到开头
|
||||
messageList.value = [...newMessageList, ...messageList.value];
|
||||
refreshMessage.value = false; // 更新好后重置状态
|
||||
return;
|
||||
}
|
||||
|
||||
if (queryParams.no > 1) {
|
||||
// 加载更多历史消息,追加到现有列表末尾(因为是倒置的,所以旧消息在底部/列表末尾)
|
||||
if (data.length < queryParams.limit) {
|
||||
hasMore.value = false; // 如果返回的数据少于请求的数量,说明没有更多数据了
|
||||
}
|
||||
|
||||
// 过滤掉已存在的消息
|
||||
const historyMessages = data.filter(
|
||||
(msg) => !messageList.value.some((existing) => existing.id === msg.id),
|
||||
);
|
||||
|
||||
if (historyMessages.length > 0) {
|
||||
messageList.value = [...messageList.value, ...historyMessages];
|
||||
}
|
||||
} else {
|
||||
// 首次加载
|
||||
messageList.value = data;
|
||||
|
||||
if (data.length < queryParams.limit) {
|
||||
hasMore.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (data.slice(-1).length > 0) {
|
||||
// 设置最后一次历史查询的最后一条消息的 createTime
|
||||
queryParams.createTime = formatDate(data.slice(-1)[0].createTime);
|
||||
}
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
/** 加载更多历史数据 */
|
||||
const loadMoreHistory = async () => {
|
||||
if (isLoading.value || !hasMore.value) return;
|
||||
|
||||
// 增加页码
|
||||
queryParams.no += 1;
|
||||
await getMessageList();
|
||||
};
|
||||
|
||||
/** 刷新消息列表 */
|
||||
const refreshMessageList = async (message = undefined) => {
|
||||
if (typeof message !== 'undefined') {
|
||||
// 追加数据到列表开头(因为是倒置的,所以新消息在顶部/列表开头)
|
||||
messageList.value.unshift(message);
|
||||
showNewMessageTip.value = true;
|
||||
} else {
|
||||
queryParams.createTime = undefined;
|
||||
refreshMessage.value = true;
|
||||
await getMessageList();
|
||||
}
|
||||
|
||||
// 若已是第一页则不做处理
|
||||
if (queryParams.no > 1) {
|
||||
showTip.value = true;
|
||||
} else {
|
||||
scrollToTop();
|
||||
}
|
||||
};
|
||||
|
||||
/** 滚动到顶部(倒置后相当于滚动到最新消息) */
|
||||
const scrollToTop = () => {
|
||||
scroll.value.top = scroll.value.oldTop;
|
||||
setTimeout(() => {
|
||||
scroll.value.top = 0;
|
||||
}, 200); // 等待 view 层同步
|
||||
showTip.value = false;
|
||||
};
|
||||
|
||||
/** 设置键盘高度 */
|
||||
const setKeyboardHeight = (height) => {
|
||||
keyboardHeight.value = height;
|
||||
// 键盘弹起时,滚动到最新消息
|
||||
if (height > 0) {
|
||||
scrollToTop();
|
||||
}
|
||||
};
|
||||
|
||||
defineExpose({ getMessageList, refreshMessageList });
|
||||
|
||||
/** 监听消息列表滚动 */
|
||||
const onScroll = (e) => {
|
||||
const { scrollTop } = e.detail;
|
||||
scroll.value.oldTop = scrollTop;
|
||||
// 当滚动位置超过一定值时,显示"新消息"提示
|
||||
if (scrollTop > 100) {
|
||||
showTip.value = true;
|
||||
} else {
|
||||
showTip.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 监听键盘弹起和收起事件
|
||||
const setupKeyboardListeners = () => {
|
||||
// #ifdef H5
|
||||
// H5环境
|
||||
window.addEventListener('resize', () => {
|
||||
// 窗口大小变化可能是由键盘引起的
|
||||
if (
|
||||
document.activeElement &&
|
||||
(document.activeElement.tagName === 'INPUT' ||
|
||||
document.activeElement.tagName === 'TEXTAREA')
|
||||
) {
|
||||
// 估算键盘高度,实际上是窗口高度变化
|
||||
const currentHeight = window.innerHeight;
|
||||
const viewportHeight = window.visualViewport
|
||||
? window.visualViewport.height
|
||||
: window.innerHeight;
|
||||
const keyboardHeight = currentHeight - viewportHeight;
|
||||
setKeyboardHeight(keyboardHeight > 0 ? keyboardHeight : 0);
|
||||
} else {
|
||||
setKeyboardHeight(0);
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
|
||||
// #ifdef MP-WEIXIN
|
||||
// TODO puhui999: 小程序键盘弹起还有点问题,看看怎么适配
|
||||
// 微信小程序环境
|
||||
uni.onKeyboardHeightChange((res) => {
|
||||
setKeyboardHeight(res.height);
|
||||
});
|
||||
// #endif
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
queryParams.no = 1; // 确保首次加载是第一页
|
||||
scroll.value = {
|
||||
top: 0,
|
||||
oldTop: 0,
|
||||
};
|
||||
getMessageList();
|
||||
setupKeyboardListeners();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.chat-scroll-view {
|
||||
height: v-bind(chatScrollHeight);
|
||||
width: 100%;
|
||||
position: relative;
|
||||
background-color: #f8f8f8;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.message-container {
|
||||
width: 100%;
|
||||
/* 确保容器至少有一屏高度 */
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.message-list {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
|
||||
.message-item {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.loading-more {
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
color: #999;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.back-top {
|
||||
.back-top-item {
|
||||
height: 30px;
|
||||
width: 100px;
|
||||
background-color: #fff;
|
||||
border-radius: 30px;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,297 @@
|
||||
<template>
|
||||
<view class="chat-box">
|
||||
<!-- 消息渲染 -->
|
||||
<view class="message-item ss-flex-col scroll-item">
|
||||
<view class="ss-flex ss-row-center ss-col-center">
|
||||
<!-- 系统消息 -->
|
||||
<view
|
||||
v-if="message.contentType === KeFuMessageContentTypeEnum.SYSTEM"
|
||||
class="system-message"
|
||||
>
|
||||
{{ message.content }}
|
||||
</view>
|
||||
<!-- 日期 - 移到消息内容上方显示 -->
|
||||
<view
|
||||
v-if="
|
||||
message.contentType !== KeFuMessageContentTypeEnum.SYSTEM &&
|
||||
showTime(message, messageIndex)
|
||||
"
|
||||
class="date-message"
|
||||
>
|
||||
{{ formatDate(message.createTime) }}
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 消息体渲染管理员消息和用户消息并左右展示 -->
|
||||
<view
|
||||
v-if="message.contentType !== KeFuMessageContentTypeEnum.SYSTEM"
|
||||
class="ss-flex ss-col-top"
|
||||
:class="[
|
||||
message.senderType === UserTypeEnum.ADMIN
|
||||
? `ss-row-left`
|
||||
: message.senderType === UserTypeEnum.MEMBER
|
||||
? `ss-row-right`
|
||||
: '',
|
||||
]"
|
||||
>
|
||||
<!-- 客服头像 -->
|
||||
<image
|
||||
v-show="message.senderType === UserTypeEnum.ADMIN"
|
||||
class="chat-avatar ss-m-r-24"
|
||||
:src="sheep.$url.cdn(message.senderAvatar) || sheep.$url.static('')"
|
||||
mode="aspectFill"
|
||||
lazy-load
|
||||
/>
|
||||
<!-- 内容 -->
|
||||
<template v-if="message.contentType === KeFuMessageContentTypeEnum.TEXT">
|
||||
<view class="message-box" :class="{ admin: message.senderType === UserTypeEnum.ADMIN }">
|
||||
<mp-html :content="processedContent" :domain="sheep.$url.cdn('')" lazy-load />
|
||||
</view>
|
||||
</template>
|
||||
<template v-if="message.contentType === KeFuMessageContentTypeEnum.IMAGE">
|
||||
<view
|
||||
class="message-box"
|
||||
:class="{ admin: message.senderType === UserTypeEnum.ADMIN }"
|
||||
:style="{ width: '200rpx' }"
|
||||
>
|
||||
<su-image
|
||||
class="message-img"
|
||||
isPreview
|
||||
:previewList="[sheep.$url.cdn(getMessageContent(message).picUrl || message.content)]"
|
||||
:current="0"
|
||||
:src="sheep.$url.cdn(getMessageContent(message).picUrl || message.content)"
|
||||
:height="200"
|
||||
:width="200"
|
||||
mode="aspectFill"
|
||||
/>
|
||||
</view>
|
||||
</template>
|
||||
<template v-if="message.contentType === KeFuMessageContentTypeEnum.PRODUCT">
|
||||
<div class="ss-m-b-10">
|
||||
<GoodsItem
|
||||
:goodsData="getMessageContent(message)"
|
||||
@tap="
|
||||
sheep.$router.go('/pages/goods/index', { id: getMessageContent(message).spuId })
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
<template v-if="message.contentType === KeFuMessageContentTypeEnum.ORDER">
|
||||
<OrderItem
|
||||
:orderData="getMessageContent(message)"
|
||||
@tap="sheep.$router.go('/pages/order/detail', { id: getMessageContent(message).id })"
|
||||
/>
|
||||
</template>
|
||||
<!-- user头像 -->
|
||||
<image
|
||||
v-if="message.senderType === UserTypeEnum.MEMBER"
|
||||
class="chat-avatar ss-m-l-24"
|
||||
:src="
|
||||
sheep.$url.cdn(userInfo.avatar) ||
|
||||
sheep.$url.static('/static/img/shop/chat/default.png')
|
||||
"
|
||||
mode="aspectFill"
|
||||
>
|
||||
</image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, unref } from 'vue';
|
||||
import dayjs from 'dayjs';
|
||||
import { KeFuMessageContentTypeEnum, UserTypeEnum } from '@/pages/chat/util/constants';
|
||||
import { emojiList } from '@/pages/chat/util/emoji';
|
||||
import sheep from '@/sheep';
|
||||
import { formatDate, jsonParse } from '@/sheep/helper/utils';
|
||||
import GoodsItem from '@/pages/chat/components/goods.vue';
|
||||
import OrderItem from '@/pages/chat/components/order.vue';
|
||||
|
||||
const props = defineProps({
|
||||
// 消息
|
||||
message: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
// 消息索引
|
||||
messageIndex: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
// 消息列表
|
||||
messageList: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
});
|
||||
|
||||
const getMessageContent = computed(() => (item) => jsonParse(item.content)); // 解析消息内容
|
||||
const userInfo = computed(() => sheep.$store('user').userInfo);
|
||||
|
||||
//======================= 工具 =======================
|
||||
|
||||
const showTime = computed(() => (item, index) => {
|
||||
if (unref(props.messageList)[index + 1]) {
|
||||
let dateString = dayjs(unref(props.messageList)[index + 1].createTime).fromNow();
|
||||
return dateString !== dayjs(unref(item).createTime).fromNow();
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
// 缓存表情映射
|
||||
const emojiMap = computed(() => {
|
||||
const map = new Map();
|
||||
emojiList.forEach((emoji) => {
|
||||
map.set(emoji.name, emoji.file);
|
||||
});
|
||||
return map;
|
||||
});
|
||||
|
||||
// 处理表情 - 进行缓存优化
|
||||
function replaceEmoji(data) {
|
||||
let newData = data;
|
||||
if (typeof newData !== 'object') {
|
||||
let reg = /\[(.+?)]/g; // [] 中括号
|
||||
let zhEmojiName = newData.match(reg);
|
||||
if (zhEmojiName) {
|
||||
zhEmojiName.forEach((item) => {
|
||||
const emojiFile = emojiMap.value.get(item) || '';
|
||||
if (emojiFile) {
|
||||
newData = newData.replace(
|
||||
item,
|
||||
`<img class="chat-img" style="width: 24px;height: 24px;margin: 0 3px;vertical-align: middle;" src="${sheep.$url.cdn(
|
||||
'/static/img/chat/emoji/' + emojiFile,
|
||||
)}"/>`,
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return newData;
|
||||
}
|
||||
|
||||
// 预处理内容,避免重复计算
|
||||
const processedContent = computed(() => {
|
||||
if (props.message.contentType === KeFuMessageContentTypeEnum.TEXT) {
|
||||
return replaceEmoji(getMessageContent.value(props.message).text || props.message.content);
|
||||
}
|
||||
return props.message.content;
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.message-item {
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.date-message,
|
||||
.system-message {
|
||||
width: fit-content;
|
||||
border-radius: 12rpx;
|
||||
padding: 8rpx 16rpx;
|
||||
margin-bottom: 16rpx;
|
||||
background-color: var(--ui-BG-3);
|
||||
color: #999;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.chat-avatar {
|
||||
width: 70rpx;
|
||||
height: 70rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.send-status {
|
||||
color: #333;
|
||||
height: 80rpx;
|
||||
margin-right: 8rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.loading {
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
-webkit-animation: rotating 2s linear infinite;
|
||||
animation: rotating 2s linear infinite;
|
||||
|
||||
@-webkit-keyframes rotating {
|
||||
0% {
|
||||
transform: rotateZ(0);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: rotateZ(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes rotating {
|
||||
0% {
|
||||
transform: rotateZ(0);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: rotateZ(360deg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.warning {
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
color: #ff3000;
|
||||
}
|
||||
}
|
||||
|
||||
.message-box {
|
||||
max-width: 50%;
|
||||
font-size: 16px;
|
||||
white-space: normal;
|
||||
word-break: break-all;
|
||||
word-wrap: break-word;
|
||||
padding: 20rpx;
|
||||
color: #fff;
|
||||
background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
|
||||
margin-top: 3px;
|
||||
margin-bottom: 9px;
|
||||
border-top-left-radius: 10px;
|
||||
border-bottom-right-radius: 10px;
|
||||
border-bottom-left-radius: 10px;
|
||||
&.admin {
|
||||
background: #fff;
|
||||
color: #333;
|
||||
margin-top: 3px;
|
||||
margin-bottom: 9px;
|
||||
border-radius: 0 10px 10px 10px;
|
||||
}
|
||||
|
||||
:deep() {
|
||||
.imgred {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.imgred,
|
||||
img {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
:deep() {
|
||||
.goods,
|
||||
.order {
|
||||
max-width: 500rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.message-img {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
|
||||
.error-img {
|
||||
width: 400rpx;
|
||||
height: 400rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,539 @@
|
||||
<template>
|
||||
<view
|
||||
class="uni-easyinput"
|
||||
:class="{ 'uni-easyinput-error': msg }"
|
||||
:style="{ color: inputBorder && msg ? '#e43d33' : styles.color }"
|
||||
>
|
||||
<view
|
||||
class="uni-easyinput__content"
|
||||
:class="{
|
||||
'is-input-border': inputBorder,
|
||||
'is-input-error-border': inputBorder && msg,
|
||||
'is-textarea': type === 'textarea',
|
||||
'is-disabled': disabled,
|
||||
}"
|
||||
:style="{
|
||||
'border-color': inputBorder && msg ? '#dd524d' : styles.borderColor,
|
||||
'background-color': disabled ? styles.disableColor : '',
|
||||
}"
|
||||
>
|
||||
<uni-icons
|
||||
v-if="prefixIcon"
|
||||
class="content-clear-icon"
|
||||
:type="prefixIcon"
|
||||
color="#c0c4cc"
|
||||
@click="onClickIcon('prefix')"
|
||||
></uni-icons>
|
||||
<textarea
|
||||
v-if="type === 'textarea'"
|
||||
class="uni-easyinput__content-textarea"
|
||||
:class="{ 'input-padding': inputBorder }"
|
||||
:name="name"
|
||||
:value="val"
|
||||
:placeholder="placeholder"
|
||||
:placeholderStyle="placeholderStyle"
|
||||
:disabled="disabled"
|
||||
placeholder-style="color: #bbbbbb;font-size: 28rpx;font-weight: 400;line-height: normal;"
|
||||
:maxlength="inputMaxlength"
|
||||
:focus="focused"
|
||||
:autoHeight="autoHeight"
|
||||
:adjust-position="false"
|
||||
@input="onInput"
|
||||
@blur="onBlur"
|
||||
@focus="onFocus"
|
||||
@confirm="onConfirm"
|
||||
></textarea>
|
||||
<input
|
||||
v-else
|
||||
:type="type === 'password' ? 'text' : type"
|
||||
class="uni-easyinput__content-input"
|
||||
:style="{
|
||||
'padding-right': type === 'password' || clearable || prefixIcon ? '' : '10px',
|
||||
'padding-left': paddingLeft + 'px',
|
||||
}"
|
||||
:name="name"
|
||||
:value="val"
|
||||
:password="!showPassword && type === 'password'"
|
||||
:placeholder="placeholder"
|
||||
:placeholderStyle="placeholderStyle"
|
||||
placeholder-style="color: #bbbbbb;font-size: 28rpx;font-weight: 400;line-height: normal;"
|
||||
:disabled="disabled"
|
||||
:maxlength="inputMaxlength"
|
||||
:focus="focused"
|
||||
:confirmType="confirmType"
|
||||
:adjust-position="false"
|
||||
@focus="onFocus"
|
||||
@blur="onBlur"
|
||||
@input="onInput"
|
||||
@change="onInput"
|
||||
@confirm="onConfirm"
|
||||
:cursor-spacing="30"
|
||||
always-embed
|
||||
/>
|
||||
<template v-if="type === 'password' && passwordIcon">
|
||||
<uni-icons
|
||||
v-if="val"
|
||||
class="content-clear-icon"
|
||||
:class="{ 'is-textarea-icon': type === 'textarea' }"
|
||||
:type="showPassword ? 'eye-slash-filled' : 'eye-filled'"
|
||||
:size="18"
|
||||
color="#c0c4cc"
|
||||
@click="onEyes"
|
||||
></uni-icons>
|
||||
</template>
|
||||
<template v-else-if="suffixIcon">
|
||||
<uni-icons
|
||||
v-if="suffixIcon"
|
||||
class="content-clear-icon"
|
||||
:type="suffixIcon"
|
||||
color="#c0c4cc"
|
||||
@click="onClickIcon('suffix')"
|
||||
></uni-icons>
|
||||
</template>
|
||||
<template v-else>
|
||||
<uni-icons
|
||||
class="content-clear-icon"
|
||||
:class="{ 'is-textarea-icon': type === 'textarea' }"
|
||||
type="clear"
|
||||
:size="clearSize"
|
||||
v-if="clearable && val && !disabled"
|
||||
color="#c0c4cc"
|
||||
@click="onClear"
|
||||
></uni-icons>
|
||||
</template>
|
||||
<slot name="right"></slot>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// import {
|
||||
// debounce,
|
||||
// throttle
|
||||
// } from './common.js'
|
||||
/**
|
||||
* Easyinput 输入框
|
||||
* @description 此组件可以实现表单的输入与校验,包括 "text" 和 "textarea" 类型。
|
||||
* @tutorial https://ext.dcloud.net.cn/plugin?id=3455
|
||||
* @property {String} value 输入内容
|
||||
* @property {String } type 输入框的类型(默认text) password/text/textarea/..
|
||||
* @value text 文本输入键盘
|
||||
* @value textarea 多行文本输入键盘
|
||||
* @value password 密码输入键盘
|
||||
* @value number 数字输入键盘,注意iOS上app-vue弹出的数字键盘并非9宫格方式
|
||||
* @value idcard 身份证输入键盘,信、支付宝、百度、QQ小程序
|
||||
* @value digit 带小数点的数字键盘 ,App的nvue页面、微信、支付宝、百度、头条、QQ小程序支持
|
||||
* @property {Boolean} clearable 是否显示右侧清空内容的图标控件,点击可清空输入框内容(默认true)
|
||||
* @property {Boolean} autoHeight 是否自动增高输入区域,type为textarea时有效(默认false)
|
||||
* @property {String } placeholder 输入框的提示文字
|
||||
* @property {String } placeholderStyle placeholder的样式(内联样式,字符串),如"color: #ddd"
|
||||
* @property {Boolean} focus 是否自动获得焦点(默认false)
|
||||
* @property {Boolean} disabled 是否禁用(默认false)
|
||||
* @property {Number } maxlength 最大输入长度,设置为 -1 的时候不限制最大长度(默认140)
|
||||
* @property {String } confirmType 设置键盘右下角按钮的文字,仅在type="text"时生效(默认done)
|
||||
* @property {Number } clearSize 清除图标的大小,单位px(默认15)
|
||||
* @property {String} prefixIcon 输入框头部图标
|
||||
* @property {String} suffixIcon 输入框尾部图标
|
||||
* @property {Boolean} trim 是否自动去除两端的空格
|
||||
* @value both 去除两端空格
|
||||
* @value left 去除左侧空格
|
||||
* @value right 去除右侧空格
|
||||
* @value start 去除左侧空格
|
||||
* @value end 去除右侧空格
|
||||
* @value all 去除全部空格
|
||||
* @value none 不去除空格
|
||||
* @property {Boolean} inputBorder 是否显示input输入框的边框(默认true)
|
||||
* @property {Boolean} passwordIcon type=password时是否显示小眼睛图标
|
||||
* @property {Object} styles 自定义颜色
|
||||
* @event {Function} input 输入框内容发生变化时触发
|
||||
* @event {Function} focus 输入框获得焦点时触发
|
||||
* @event {Function} blur 输入框失去焦点时触发
|
||||
* @event {Function} confirm 点击完成按钮时触发
|
||||
* @event {Function} iconClick 点击图标时触发
|
||||
* @example <uni-easyinput v-model="mobile"></uni-easyinput>
|
||||
*/
|
||||
|
||||
export default {
|
||||
name: 'optimize-input',
|
||||
emits: ['click', 'iconClick', 'update:modelValue', 'input', 'focus', 'blur', 'confirm'],
|
||||
model: {
|
||||
prop: 'modelValue',
|
||||
event: 'update:modelValue',
|
||||
},
|
||||
props: {
|
||||
name: String,
|
||||
value: [Number, String],
|
||||
modelValue: [Number, String],
|
||||
type: {
|
||||
type: String,
|
||||
default: 'text',
|
||||
},
|
||||
clearable: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
autoHeight: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
placeholder: String,
|
||||
placeholderStyle: String,
|
||||
focus: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
maxlength: {
|
||||
type: [Number, String],
|
||||
default: 140,
|
||||
},
|
||||
confirmType: {
|
||||
type: String,
|
||||
default: 'done',
|
||||
},
|
||||
clearSize: {
|
||||
type: [Number, String],
|
||||
default: 15,
|
||||
},
|
||||
inputBorder: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
prefixIcon: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
suffixIcon: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
trim: {
|
||||
type: [Boolean, String],
|
||||
default: true,
|
||||
},
|
||||
passwordIcon: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
styles: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {
|
||||
color: '#333',
|
||||
disableColor: '#F7F6F6',
|
||||
borderColor: '#e5e5e5',
|
||||
};
|
||||
},
|
||||
},
|
||||
errorMessage: {
|
||||
type: [String, Boolean],
|
||||
default: '',
|
||||
},
|
||||
paddingLeft: {
|
||||
type: [Number, String],
|
||||
default: 0,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
focused: false,
|
||||
errMsg: '',
|
||||
val: '',
|
||||
showMsg: '',
|
||||
border: false,
|
||||
isFirstBorder: false,
|
||||
showClearIcon: false,
|
||||
showPassword: false,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
msg() {
|
||||
return this.errorMessage || this.errMsg;
|
||||
},
|
||||
// 因为uniapp的input组件的maxlength组件必须要数值,这里转为数值,用户可以传入字符串数值
|
||||
inputMaxlength() {
|
||||
return Number(this.maxlength);
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
value(newVal) {
|
||||
if (this.errMsg) this.errMsg = '';
|
||||
this.val = newVal;
|
||||
// fix by mehaotian is_reset 在 uni-forms 中定义
|
||||
if (this.form && this.formItem && !this.is_reset) {
|
||||
this.is_reset = false;
|
||||
this.formItem.setValue(newVal);
|
||||
}
|
||||
},
|
||||
modelValue(newVal) {
|
||||
if (this.errMsg) this.errMsg = '';
|
||||
this.val = newVal;
|
||||
if (this.form && this.formItem && !this.is_reset) {
|
||||
this.is_reset = false;
|
||||
this.formItem.setValue(newVal);
|
||||
}
|
||||
},
|
||||
focus(newVal) {
|
||||
this.$nextTick(() => {
|
||||
this.focused = this.focus;
|
||||
});
|
||||
},
|
||||
},
|
||||
created() {
|
||||
if (!this.value && this.value !== 0) {
|
||||
this.val = this.modelValue;
|
||||
}
|
||||
if (!this.modelValue && this.modelValue !== 0) {
|
||||
this.val = this.value;
|
||||
}
|
||||
this.form = this.getForm('uniForms');
|
||||
this.formItem = this.getForm('uniFormsItem');
|
||||
if (this.form && this.formItem) {
|
||||
if (this.formItem.name) {
|
||||
if (!this.is_reset) {
|
||||
this.is_reset = false;
|
||||
this.formItem.setValue(this.val);
|
||||
}
|
||||
this.rename = this.formItem.name;
|
||||
this.form.inputChildrens.push(this);
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$nextTick(() => {
|
||||
this.focused = this.focus;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 初始化变量值
|
||||
*/
|
||||
init() {},
|
||||
onClickIcon(type) {
|
||||
this.$emit('iconClick', type);
|
||||
},
|
||||
/**
|
||||
* 获取父元素实例
|
||||
*/
|
||||
getForm(name = 'uniForms') {
|
||||
let parent = this.$parent;
|
||||
let parentName = parent.$options.name;
|
||||
while (parentName !== name) {
|
||||
parent = parent.$parent;
|
||||
if (!parent) return false;
|
||||
parentName = parent.$options.name;
|
||||
}
|
||||
return parent;
|
||||
},
|
||||
|
||||
onEyes() {
|
||||
this.showPassword = !this.showPassword;
|
||||
},
|
||||
onInput(event) {
|
||||
let value = event.detail.value;
|
||||
// 判断是否去除空格
|
||||
if (this.trim) {
|
||||
if (typeof this.trim === 'boolean' && this.trim) {
|
||||
value = this.trimStr(value);
|
||||
}
|
||||
if (typeof this.trim === 'string') {
|
||||
value = this.trimStr(value, this.trim);
|
||||
}
|
||||
}
|
||||
if (this.errMsg) this.errMsg = '';
|
||||
this.val = value;
|
||||
// TODO 兼容 vue2
|
||||
this.$emit('input', value);
|
||||
// TODO 兼容 vue3
|
||||
this.$emit('update:modelValue', value);
|
||||
},
|
||||
onFocus(event) {
|
||||
this.$emit('focus', event);
|
||||
},
|
||||
onBlur(event) {
|
||||
let value = event.detail.value;
|
||||
this.$emit('blur', event);
|
||||
},
|
||||
onConfirm(e) {
|
||||
this.$emit('confirm', e.detail.value);
|
||||
},
|
||||
onClear(event) {
|
||||
this.val = '';
|
||||
// TODO 兼容 vue2
|
||||
this.$emit('input', '');
|
||||
// TODO 兼容 vue2
|
||||
// TODO 兼容 vue3
|
||||
this.$emit('update:modelValue', '');
|
||||
},
|
||||
fieldClick() {
|
||||
this.$emit('click');
|
||||
},
|
||||
trimStr(str, pos = 'both') {
|
||||
if (pos === 'both') {
|
||||
return str.trim();
|
||||
} else if (pos === 'left') {
|
||||
return str.trimLeft();
|
||||
} else if (pos === 'right') {
|
||||
return str.trimRight();
|
||||
} else if (pos === 'start') {
|
||||
return str.trimStart();
|
||||
} else if (pos === 'end') {
|
||||
return str.trimEnd();
|
||||
} else if (pos === 'all') {
|
||||
return str.replace(/\s+/g, '');
|
||||
} else if (pos === 'none') {
|
||||
return str;
|
||||
}
|
||||
return str;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
$uni-error: #e43d33;
|
||||
$uni-border-1: #dcdfe6 !default;
|
||||
.uni-easyinput {
|
||||
/* #ifndef APP-NVUE */
|
||||
width: 100%;
|
||||
/* #endif */
|
||||
flex: 1;
|
||||
position: relative;
|
||||
text-align: left;
|
||||
color: #333;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.uni-easyinput__content {
|
||||
flex: 1;
|
||||
/* #ifndef APP-NVUE */
|
||||
width: 100%;
|
||||
display: flex;
|
||||
box-sizing: border-box;
|
||||
min-height: 72rpx;
|
||||
/* #endif */
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.uni-easyinput__content-input {
|
||||
/* #ifndef APP-NVUE */
|
||||
width: auto;
|
||||
/* #endif */
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
flex: 1;
|
||||
line-height: 56rpx;
|
||||
font-size: 28rpx;
|
||||
height: 56rpx;
|
||||
}
|
||||
.uni-easyinput__placeholder-class {
|
||||
color: #bbbbbb;
|
||||
font-size: 28rpx;
|
||||
font-weight: 400;
|
||||
line-height: normal;
|
||||
}
|
||||
.is-textarea {
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.is-textarea-icon {
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.uni-easyinput__content-textarea {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
flex: 1;
|
||||
line-height: 1.5;
|
||||
font-size: 14px;
|
||||
padding-top: 6px;
|
||||
padding-bottom: 10px;
|
||||
height: 80px;
|
||||
/* #ifndef APP-NVUE */
|
||||
min-height: 80px;
|
||||
width: auto;
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
.input-padding {
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
.content-clear-icon {
|
||||
padding: 0 5px;
|
||||
}
|
||||
|
||||
.label-icon {
|
||||
margin-right: 5px;
|
||||
margin-top: -1px;
|
||||
}
|
||||
|
||||
// 显示边框
|
||||
.is-input-border {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
box-sizing: border-box;
|
||||
/* #endif */
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
border: 1px solid $uni-border-1;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.uni-error-message {
|
||||
position: absolute;
|
||||
bottom: -17px;
|
||||
left: 0;
|
||||
line-height: 12px;
|
||||
color: $uni-error;
|
||||
font-size: 12px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.uni-error-msg--boeder {
|
||||
position: relative;
|
||||
bottom: 0;
|
||||
line-height: 22px;
|
||||
}
|
||||
|
||||
.is-input-error-border {
|
||||
border-color: $uni-error;
|
||||
.uni-easyinput__placeholder-class {
|
||||
// color: mix(#fff, $uni-error, 50%);
|
||||
}
|
||||
}
|
||||
|
||||
.uni-easyinput--border {
|
||||
margin-bottom: 0;
|
||||
padding: 10px 15px;
|
||||
// padding-bottom: 0;
|
||||
border-top: 1px #eee solid;
|
||||
}
|
||||
|
||||
.uni-easyinput-error {
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
.is-first-border {
|
||||
/* #ifndef APP-NVUE */
|
||||
border: none;
|
||||
/* #endif */
|
||||
/* #ifdef APP-NVUE */
|
||||
border-width: 0;
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
.is-disabled {
|
||||
border-color: red;
|
||||
background-color: #f7f6f6;
|
||||
color: #d5d5d5;
|
||||
.uni-easyinput__placeholder-class {
|
||||
color: #d5d5d5;
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,114 @@
|
||||
<template>
|
||||
<view class="bg-white order-list-card-box ss-r-10 ss-m-t-14 ss-m-20" :key="orderData.id">
|
||||
<view class="order-card-header ss-flex ss-col-center ss-row-between ss-p-x-20">
|
||||
<view class="order-no">订单号:{{ orderData.no }}</view>
|
||||
<view class="order-state ss-font-26" :class="formatOrderColor(orderData)">
|
||||
{{ formatOrderStatus(orderData) }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="border-bottom" v-for="item in orderData.items" :key="item.id">
|
||||
<s-goods-item
|
||||
:img="item.picUrl"
|
||||
:title="item.spuName"
|
||||
:skuText="item.properties.map((property) => property.valueName).join(' ')"
|
||||
:price="item.price"
|
||||
:num="item.count"
|
||||
/>
|
||||
</view>
|
||||
<view class="pay-box ss-m-t-30 ss-flex ss-row-right ss-p-r-20">
|
||||
<view class="ss-flex ss-col-center">
|
||||
<view class="discounts-title pay-color"
|
||||
>共 {{ orderData.productCount }} 件商品,总金额:</view
|
||||
>
|
||||
<view class="discounts-money pay-color"> ¥{{ fen2yuan(orderData.payPrice) }} </view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { fen2yuan, formatOrderColor, formatOrderStatus } from '@/sheep/hooks/useGoods';
|
||||
|
||||
const props = defineProps({
|
||||
orderData: {
|
||||
type: Object,
|
||||
default: {},
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.order-list-card-box {
|
||||
.order-card-header {
|
||||
height: 80rpx;
|
||||
|
||||
.order-no {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.order-state {
|
||||
}
|
||||
}
|
||||
.pay-box {
|
||||
.discounts-title {
|
||||
font-size: 24rpx;
|
||||
line-height: normal;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.discounts-money {
|
||||
font-size: 24rpx;
|
||||
line-height: normal;
|
||||
color: #999;
|
||||
font-family: OPPOSANS;
|
||||
}
|
||||
|
||||
.pay-color {
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
.order-card-footer {
|
||||
height: 100rpx;
|
||||
|
||||
.more-item-box {
|
||||
padding: 20rpx;
|
||||
|
||||
.more-item {
|
||||
height: 60rpx;
|
||||
|
||||
.title {
|
||||
font-size: 26rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.more-btn {
|
||||
color: $dark-9;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.content {
|
||||
width: 154rpx;
|
||||
color: #333333;
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
}
|
||||
.warning-color {
|
||||
color: #faad14;
|
||||
}
|
||||
|
||||
.danger-color {
|
||||
color: #ff3000;
|
||||
}
|
||||
|
||||
.success-color {
|
||||
color: #52c41a;
|
||||
}
|
||||
|
||||
.info-color {
|
||||
color: #999999;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,151 @@
|
||||
<template>
|
||||
<su-popup :show="show" showClose round="10" backgroundColor="#eee" @close="emits('close')">
|
||||
<view class="select-popup">
|
||||
<view class="title">
|
||||
<span>{{ mode == 'goods' ? '我的浏览' : '我的订单' }}</span>
|
||||
</view>
|
||||
<scroll-view
|
||||
class="scroll-box"
|
||||
scroll-y="true"
|
||||
:scroll-with-animation="true"
|
||||
:show-scrollbar="false"
|
||||
@scrolltolower="loadmore"
|
||||
>
|
||||
<view
|
||||
class="item"
|
||||
v-for="item in state.pagination.data"
|
||||
:key="item.id"
|
||||
@tap="emits('select', { type: mode, data: item })"
|
||||
>
|
||||
<template v-if="mode == 'goods'">
|
||||
<GoodsItem :goodsData="item" />
|
||||
</template>
|
||||
<template v-if="mode == 'order'">
|
||||
<OrderItem :orderData="item" />
|
||||
</template>
|
||||
</view>
|
||||
<uni-load-more :status="state.loadStatus" :content-text="{ contentdown: '上拉加载更多' }" />
|
||||
</scroll-view>
|
||||
</view>
|
||||
</su-popup>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, watch } from 'vue';
|
||||
import _ from 'lodash-es';
|
||||
import GoodsItem from './goods.vue';
|
||||
import OrderItem from './order.vue';
|
||||
import OrderApi from '@/sheep/api/trade/order';
|
||||
import SpuHistoryApi from '@/sheep/api/product/history';
|
||||
|
||||
const emits = defineEmits(['select', 'close']);
|
||||
const props = defineProps({
|
||||
mode: {
|
||||
type: String,
|
||||
default: 'goods',
|
||||
},
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
|
||||
watch(
|
||||
() => props.mode,
|
||||
() => {
|
||||
state.pagination.data = [];
|
||||
if (props.mode) {
|
||||
getList(state.pagination.page);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
const state = reactive({
|
||||
loadStatus: '',
|
||||
pagination: {
|
||||
data: [],
|
||||
current_page: 1,
|
||||
total: 1,
|
||||
last_page: 1,
|
||||
},
|
||||
});
|
||||
|
||||
async function getList(page, list_rows = 5) {
|
||||
state.loadStatus = 'loading';
|
||||
const res =
|
||||
props.mode == 'goods'
|
||||
? await SpuHistoryApi.getBrowseHistoryPage({
|
||||
page,
|
||||
list_rows,
|
||||
})
|
||||
: await OrderApi.getOrderPage({
|
||||
page,
|
||||
list_rows,
|
||||
});
|
||||
let orderList = _.concat(state.pagination.data, res.data.list);
|
||||
state.pagination = {
|
||||
...res.data,
|
||||
data: orderList,
|
||||
};
|
||||
if (state.pagination.current_page < state.pagination.last_page) {
|
||||
state.loadStatus = 'more';
|
||||
} else {
|
||||
state.loadStatus = 'noMore';
|
||||
}
|
||||
}
|
||||
|
||||
function loadmore() {
|
||||
if (state.loadStatus !== 'noMore') {
|
||||
getList(state.pagination.current_page + 1);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.select-popup {
|
||||
max-height: 600rpx;
|
||||
|
||||
.title {
|
||||
height: 100rpx;
|
||||
line-height: 100rpx;
|
||||
padding: 0 26rpx;
|
||||
background: #fff;
|
||||
border-radius: 20rpx 20rpx 0 0;
|
||||
|
||||
span {
|
||||
font-size: 32rpx;
|
||||
position: relative;
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 2px;
|
||||
z-index: 1;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: -15px;
|
||||
background: var(--ui-BG-Main);
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.scroll-box {
|
||||
height: 500rpx;
|
||||
}
|
||||
|
||||
.item {
|
||||
background: #fff;
|
||||
margin: 26rpx 26rpx 0;
|
||||
border-radius: 20rpx;
|
||||
|
||||
:deep() {
|
||||
.image {
|
||||
width: 140rpx;
|
||||
height: 140rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,164 @@
|
||||
<template>
|
||||
<su-popup :show="showTools" @close="handleClose">
|
||||
<view class="ss-modal-box ss-flex-col">
|
||||
<slot></slot>
|
||||
<view class="content ss-flex ss-flex-1">
|
||||
<template v-if="toolsMode === 'emoji'">
|
||||
<swiper
|
||||
class="emoji-swiper"
|
||||
:indicator-dots="true"
|
||||
circular
|
||||
indicator-active-color="#7063D2"
|
||||
indicator-color="rgba(235, 231, 255, 1)"
|
||||
:autoplay="false"
|
||||
:interval="3000"
|
||||
:duration="1000"
|
||||
>
|
||||
<swiper-item v-for="emoji in emojiPage" :key="emoji">
|
||||
<view class="ss-flex ss-flex-wrap">
|
||||
<image
|
||||
v-for="item in emoji"
|
||||
:key="item"
|
||||
class="emoji-img"
|
||||
:src="sheep.$url.cdn(`/static/img/chat/emoji/${item.file}`)"
|
||||
@tap="onEmoji(item)"
|
||||
>
|
||||
</image>
|
||||
</view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view class="image">
|
||||
<s-uploader
|
||||
file-mediatype="image"
|
||||
:imageStyles="{ width: 50, height: 50, border: false }"
|
||||
@select="imageSelect({ type: 'image', data: $event })"
|
||||
>
|
||||
<image
|
||||
class="icon"
|
||||
:src="sheep.$url.static('/static/img/shop/chat/image.png')"
|
||||
mode="aspectFill"
|
||||
></image>
|
||||
</s-uploader>
|
||||
<view>图片</view>
|
||||
</view>
|
||||
<view class="goods" @tap="onShowSelect('goods')">
|
||||
<image
|
||||
class="icon"
|
||||
:src="sheep.$url.static('/static/img/shop/chat/goods.png')"
|
||||
mode="aspectFill"
|
||||
></image>
|
||||
<view>商品</view>
|
||||
</view>
|
||||
<view class="order" @tap="onShowSelect('order')">
|
||||
<image
|
||||
class="icon"
|
||||
:src="sheep.$url.static('/static/img/shop/chat/order.png')"
|
||||
mode="aspectFill"
|
||||
></image>
|
||||
<view>订单</view>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
</view>
|
||||
</su-popup>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
/**
|
||||
* 聊天工具
|
||||
*/
|
||||
import { emojiPage } from '@/pages/chat/util/emoji';
|
||||
import sheep from '@/sheep';
|
||||
|
||||
const props = defineProps({
|
||||
// 工具模式
|
||||
toolsMode: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
// 控制工具菜单弹出
|
||||
showTools: {
|
||||
type: Boolean,
|
||||
default: () => false,
|
||||
},
|
||||
});
|
||||
const emits = defineEmits(['onEmoji', 'imageSelect', 'onShowSelect', 'close']);
|
||||
|
||||
// 关闭弹出工具菜单
|
||||
function handleClose() {
|
||||
emits('close');
|
||||
}
|
||||
|
||||
// 选择表情
|
||||
function onEmoji(emoji) {
|
||||
emits('onEmoji', emoji);
|
||||
}
|
||||
|
||||
// 选择图片
|
||||
function imageSelect(val) {
|
||||
emits('imageSelect', val);
|
||||
}
|
||||
|
||||
// 选择商品或订单
|
||||
function onShowSelect(mode) {
|
||||
emits('onShowSelect', mode);
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.content {
|
||||
width: 100%;
|
||||
align-content: space-around;
|
||||
border-top: 1px solid #dfdfdf;
|
||||
padding: 20rpx 0 0;
|
||||
|
||||
.emoji-swiper {
|
||||
width: 100%;
|
||||
height: 280rpx;
|
||||
padding: 0 20rpx;
|
||||
|
||||
.emoji-img {
|
||||
width: 50rpx;
|
||||
height: 50rpx;
|
||||
display: inline-block;
|
||||
margin: 10rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.image,
|
||||
.goods,
|
||||
.order {
|
||||
width: 33.3%;
|
||||
height: 280rpx;
|
||||
text-align: center;
|
||||
font-size: 24rpx;
|
||||
color: #333;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.icon {
|
||||
width: 50rpx;
|
||||
height: 50rpx;
|
||||
margin-bottom: 21rpx;
|
||||
}
|
||||
}
|
||||
|
||||
:deep() {
|
||||
.uni-file-picker__container {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.file-picker__box {
|
||||
display: none;
|
||||
|
||||
&:last-of-type {
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,222 @@
|
||||
<template>
|
||||
<s-layout
|
||||
class="chat-wrap"
|
||||
:title="!isReconnecting ? '连接客服成功' : '会话重连中'"
|
||||
navbar="inner"
|
||||
>
|
||||
<!-- 覆盖头部导航栏背景颜色 -->
|
||||
<view class="page-bg" :style="{ height: sys_navBar + 'px' }"></view>
|
||||
<!-- 聊天区域 -->
|
||||
<MessageList ref="messageListRef">
|
||||
<template #bottom>
|
||||
<message-input
|
||||
v-model="chat.msg"
|
||||
@on-tools="onTools"
|
||||
@send-message="onSendMessage"
|
||||
:auto-focus="false"
|
||||
:show-char-count="true"
|
||||
:max-length="500"
|
||||
></message-input>
|
||||
</template>
|
||||
</MessageList>
|
||||
<!-- 聊天工具 -->
|
||||
<tools-popup
|
||||
:show-tools="chat.showTools"
|
||||
:tools-mode="chat.toolsMode"
|
||||
@close="handleToolsClose"
|
||||
@on-emoji="onEmoji"
|
||||
@image-select="onSelect"
|
||||
@on-show-select="onShowSelect"
|
||||
>
|
||||
<message-input
|
||||
v-model="chat.msg"
|
||||
@on-tools="onTools"
|
||||
@send-message="onSendMessage"
|
||||
:auto-focus="false"
|
||||
:show-char-count="true"
|
||||
:max-length="500"
|
||||
></message-input>
|
||||
</tools-popup>
|
||||
<!-- 商品订单选择 -->
|
||||
<SelectPopup
|
||||
:mode="chat.selectMode"
|
||||
:show="chat.showSelect"
|
||||
@select="onSelect"
|
||||
@close="chat.showSelect = false"
|
||||
/>
|
||||
</s-layout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import MessageList from '@/pages/chat/components/messageList.vue';
|
||||
import { reactive, ref, toRefs } from 'vue';
|
||||
import sheep from '@/sheep';
|
||||
import ToolsPopup from '@/pages/chat/components/toolsPopup.vue';
|
||||
import MessageInput from '@/pages/chat/components/messageInput.vue';
|
||||
import SelectPopup from '@/pages/chat/components/select-popup.vue';
|
||||
import {
|
||||
KeFuMessageContentTypeEnum,
|
||||
WebSocketMessageTypeConstants,
|
||||
} from '@/pages/chat/util/constants';
|
||||
import FileApi from '@/sheep/api/infra/file';
|
||||
import KeFuApi from '@/sheep/api/promotion/kefu';
|
||||
import { useWebSocket } from './util/useWebSocket';
|
||||
import { jsonParse } from '@/sheep/helper/utils';
|
||||
|
||||
const sys_navBar = sheep.$platform.navbar;
|
||||
|
||||
const chat = reactive({
|
||||
msg: '',
|
||||
scrollInto: '',
|
||||
showTools: false,
|
||||
toolsMode: '',
|
||||
showSelect: false,
|
||||
selectMode: '',
|
||||
});
|
||||
|
||||
// 发送消息
|
||||
async function onSendMessage() {
|
||||
if (!chat.msg) return;
|
||||
try {
|
||||
const data = {
|
||||
contentType: KeFuMessageContentTypeEnum.TEXT,
|
||||
content: JSON.stringify({ text: chat.msg }),
|
||||
};
|
||||
await KeFuApi.sendKefuMessage(data);
|
||||
chat.msg = '';
|
||||
} finally {
|
||||
chat.showTools = false;
|
||||
}
|
||||
}
|
||||
|
||||
const messageListRef = ref();
|
||||
|
||||
//======================= 聊天工具相关 start =======================
|
||||
|
||||
function handleToolsClose() {
|
||||
chat.showTools = false;
|
||||
chat.toolsMode = '';
|
||||
}
|
||||
|
||||
function onEmoji(item) {
|
||||
chat.msg += item.name;
|
||||
}
|
||||
|
||||
// 点击工具栏开关
|
||||
function onTools(mode) {
|
||||
if (isReconnecting.value) {
|
||||
sheep.$helper.toast('您已掉线!请返回重试');
|
||||
return;
|
||||
}
|
||||
|
||||
// 第二次点击关闭
|
||||
if (chat.showTools && chat.toolsMode === mode) {
|
||||
handleToolsClose();
|
||||
return;
|
||||
}
|
||||
// 切换工具栏
|
||||
if (chat.showTools && chat.toolsMode !== mode) {
|
||||
chat.showTools = false;
|
||||
chat.toolsMode = '';
|
||||
}
|
||||
// 延迟打开等一下过度效果
|
||||
setTimeout(() => {
|
||||
chat.toolsMode = mode;
|
||||
chat.showTools = true;
|
||||
}, 200);
|
||||
}
|
||||
|
||||
function onShowSelect(mode) {
|
||||
chat.showTools = false;
|
||||
chat.showSelect = true;
|
||||
chat.selectMode = mode;
|
||||
}
|
||||
|
||||
async function onSelect({ type, data }) {
|
||||
let msg;
|
||||
switch (type) {
|
||||
case 'image':
|
||||
const res = await FileApi.uploadFile(data.tempFiles[0].path);
|
||||
msg = {
|
||||
contentType: KeFuMessageContentTypeEnum.IMAGE,
|
||||
content: JSON.stringify({ picUrl: res.data }),
|
||||
};
|
||||
break;
|
||||
case 'goods':
|
||||
msg = {
|
||||
contentType: KeFuMessageContentTypeEnum.PRODUCT,
|
||||
content: JSON.stringify(data),
|
||||
};
|
||||
break;
|
||||
case 'order':
|
||||
msg = {
|
||||
contentType: KeFuMessageContentTypeEnum.ORDER,
|
||||
content: JSON.stringify(data),
|
||||
};
|
||||
break;
|
||||
}
|
||||
if (msg) {
|
||||
// 发送消息
|
||||
// scrollBottom();
|
||||
await KeFuApi.sendKefuMessage(msg);
|
||||
await messageListRef.value.refreshMessageList();
|
||||
chat.showTools = false;
|
||||
chat.showSelect = false;
|
||||
chat.selectMode = '';
|
||||
}
|
||||
}
|
||||
|
||||
//======================= 聊天工具相关 end =======================
|
||||
const { options } = useWebSocket({
|
||||
// 连接成功
|
||||
onConnected: async () => {},
|
||||
// 收到消息
|
||||
onMessage: async (data) => {
|
||||
const type = data.type;
|
||||
if (!type) {
|
||||
console.error('未知的消息类型:' + data);
|
||||
return;
|
||||
}
|
||||
// 2.2 消息类型:KEFU_MESSAGE_TYPE
|
||||
if (type === WebSocketMessageTypeConstants.KEFU_MESSAGE_TYPE) {
|
||||
// 刷新消息列表
|
||||
await messageListRef.value.refreshMessageList(jsonParse(data.content));
|
||||
return;
|
||||
}
|
||||
// 2.3 消息类型:KEFU_MESSAGE_ADMIN_READ
|
||||
if (type === WebSocketMessageTypeConstants.KEFU_MESSAGE_ADMIN_READ) {
|
||||
console.log('管理员已读消息');
|
||||
// 更新消息已读状态
|
||||
sheep.$helper.toast('客服已读您的消息');
|
||||
}
|
||||
},
|
||||
});
|
||||
const isReconnecting = toRefs(options).isReconnecting; // 重连状态
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.chat-wrap {
|
||||
.page-bg {
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
background-color: var(--ui-BG-Main);
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.status {
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
z-index: 3;
|
||||
height: 70rpx;
|
||||
padding: 0 30rpx;
|
||||
background: var(--ui-BG-Main-opacity-1);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 30rpx;
|
||||
font-weight: 400;
|
||||
color: var(--ui-BG-Main);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,19 @@
|
||||
export const KeFuMessageContentTypeEnum = {
|
||||
TEXT: 1, // 文本消息
|
||||
IMAGE: 2, // 图片消息
|
||||
VOICE: 3, // 语音消息
|
||||
VIDEO: 4, // 视频消息
|
||||
SYSTEM: 5, // 系统消息
|
||||
// ========== 商城特殊消息 ==========
|
||||
PRODUCT: 10, // 商品消息
|
||||
ORDER: 11, // 订单消息"
|
||||
};
|
||||
export const UserTypeEnum = {
|
||||
MEMBER: 1, // 会员 面向 c 端,普通用户
|
||||
ADMIN: 2, // 管理员 面向 b 端,管理后台
|
||||
};
|
||||
// Promotion 的 WebSocket 消息类型枚举类
|
||||
export const WebSocketMessageTypeConstants = {
|
||||
KEFU_MESSAGE_TYPE: 'kefu_message_type', // 客服消息类型
|
||||
KEFU_MESSAGE_ADMIN_READ: 'kefu_message_read_status_change', // 客服消息管理员已读
|
||||
};
|
||||
@@ -0,0 +1,58 @@
|
||||
export const emojiList = [
|
||||
{ name: '[笑掉牙]', file: 'xiaodiaoya.png' },
|
||||
{ name: '[可爱]', file: 'keai.png' },
|
||||
{ name: '[冷酷]', file: 'lengku.png' },
|
||||
{ name: '[闭嘴]', file: 'bizui.png' },
|
||||
{ name: '[生气]', file: 'shengqi.png' },
|
||||
{ name: '[惊恐]', file: 'jingkong.png' },
|
||||
{ name: '[瞌睡]', file: 'keshui.png' },
|
||||
{ name: '[大笑]', file: 'daxiao.png' },
|
||||
{ name: '[爱心]', file: 'aixin.png' },
|
||||
{ name: '[坏笑]', file: 'huaixiao.png' },
|
||||
{ name: '[飞吻]', file: 'feiwen.png' },
|
||||
{ name: '[疑问]', file: 'yiwen.png' },
|
||||
{ name: '[开心]', file: 'kaixin.png' },
|
||||
{ name: '[发呆]', file: 'fadai.png' },
|
||||
{ name: '[流泪]', file: 'liulei.png' },
|
||||
{ name: '[汗颜]', file: 'hanyan.png' },
|
||||
{ name: '[惊悚]', file: 'jingshu.png' },
|
||||
{ name: '[困~]', file: 'kun.png' },
|
||||
{ name: '[心碎]', file: 'xinsui.png' },
|
||||
{ name: '[天使]', file: 'tianshi.png' },
|
||||
{ name: '[晕]', file: 'yun.png' },
|
||||
{ name: '[啊]', file: 'a.png' },
|
||||
{ name: '[愤怒]', file: 'fennu.png' },
|
||||
{ name: '[睡着]', file: 'shuizhuo.png' },
|
||||
{ name: '[面无表情]', file: 'mianwubiaoqing.png' },
|
||||
{ name: '[难过]', file: 'nanguo.png' },
|
||||
{ name: '[犯困]', file: 'fankun.png' },
|
||||
{ name: '[好吃]', file: 'haochi.png' },
|
||||
{ name: '[呕吐]', file: 'outu.png' },
|
||||
{ name: '[龇牙]', file: 'ziya.png' },
|
||||
{ name: '[懵比]', file: 'mengbi.png' },
|
||||
{ name: '[白眼]', file: 'baiyan.png' },
|
||||
{ name: '[饿死]', file: 'esi.png' },
|
||||
{ name: '[凶]', file: 'xiong.png' },
|
||||
{ name: '[感冒]', file: 'ganmao.png' },
|
||||
{ name: '[流汗]', file: 'liuhan.png' },
|
||||
{ name: '[笑哭]', file: 'xiaoku.png' },
|
||||
{ name: '[流口水]', file: 'liukoushui.png' },
|
||||
{ name: '[尴尬]', file: 'ganga.png' },
|
||||
{ name: '[惊讶]', file: 'jingya.png' },
|
||||
{ name: '[大惊]', file: 'dajing.png' },
|
||||
{ name: '[不好意思]', file: 'buhaoyisi.png' },
|
||||
{ name: '[大闹]', file: 'danao.png' },
|
||||
{ name: '[不可思议]', file: 'bukesiyi.png' },
|
||||
{ name: '[爱你]', file: 'aini.png' },
|
||||
{ name: '[红心]', file: 'hongxin.png' },
|
||||
{ name: '[点赞]', file: 'dianzan.png' },
|
||||
{ name: '[恶魔]', file: 'emo.png' },
|
||||
];
|
||||
|
||||
export let emojiPage = {};
|
||||
emojiList.forEach((item, index) => {
|
||||
if (!emojiPage[Math.floor(index / 30) + 1]) {
|
||||
emojiPage[Math.floor(index / 30) + 1] = [];
|
||||
}
|
||||
emojiPage[Math.floor(index / 30) + 1].push(item);
|
||||
});
|
||||
@@ -0,0 +1,150 @@
|
||||
import { onBeforeUnmount, reactive, ref } from 'vue';
|
||||
import { baseUrl, websocketPath } from '@/sheep/config';
|
||||
import { copyValueToTarget } from '@/sheep/helper/utils';
|
||||
import { getRefreshToken } from '@/sheep/request';
|
||||
|
||||
/**
|
||||
* WebSocket 创建 hook
|
||||
* @param opt 连接配置
|
||||
* @return {{options: *}}
|
||||
*/
|
||||
export function useWebSocket(opt) {
|
||||
const options = reactive({
|
||||
url: (baseUrl + websocketPath).replace('http', 'ws') + '?token=' + getRefreshToken(), // ws 地址
|
||||
isReconnecting: false, // 正在重新连接
|
||||
reconnectInterval: 3000, // 重连间隔,单位毫秒
|
||||
heartBeatInterval: 5000, // 心跳间隔,单位毫秒
|
||||
pingTimeoutDuration: 1000, // 超过这个时间,后端没有返回pong,则判定后端断线了。
|
||||
heartBeatTimer: null, // 心跳计时器
|
||||
destroy: false, // 是否销毁
|
||||
pingTimeout: null, // 心跳检测定时器
|
||||
reconnectTimeout: null, // 重连定时器ID的属性
|
||||
onConnected: () => {}, // 连接成功时触发
|
||||
onClosed: () => {}, // 连接关闭时触发
|
||||
onMessage: (data) => {}, // 收到消息
|
||||
});
|
||||
const SocketTask = ref(null); // SocketTask 由 uni.connectSocket() 接口创建
|
||||
|
||||
const initEventListeners = () => {
|
||||
// 监听 WebSocket 连接打开事件
|
||||
SocketTask.value.onOpen(() => {
|
||||
console.log('WebSocket 连接成功');
|
||||
// 连接成功时触发
|
||||
options.onConnected();
|
||||
// 开启心跳检查
|
||||
startHeartBeat();
|
||||
});
|
||||
// 监听 WebSocket 接受到服务器的消息事件
|
||||
SocketTask.value.onMessage((res) => {
|
||||
try {
|
||||
if (res.data === 'pong') {
|
||||
// 收到心跳重置心跳超时检查
|
||||
resetPingTimeout();
|
||||
} else {
|
||||
options.onMessage(JSON.parse(res.data));
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
});
|
||||
// 监听 WebSocket 连接关闭事件
|
||||
SocketTask.value.onClose((event) => {
|
||||
// 情况一:实例销毁
|
||||
if (options.destroy) {
|
||||
options.onClosed();
|
||||
} else {
|
||||
// 情况二:连接失败重连
|
||||
// 停止心跳检查
|
||||
stopHeartBeat();
|
||||
// 重连
|
||||
reconnect();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 发送消息
|
||||
const sendMessage = (message) => {
|
||||
if (SocketTask.value && !options.destroy) {
|
||||
SocketTask.value.send({ data: message });
|
||||
}
|
||||
};
|
||||
// 开始心跳检查
|
||||
const startHeartBeat = () => {
|
||||
options.heartBeatTimer = setInterval(() => {
|
||||
sendMessage('ping');
|
||||
options.pingTimeout = setTimeout(() => {
|
||||
// 如果在超时时间内没有收到 pong,则认为连接断开
|
||||
reconnect();
|
||||
}, options.pingTimeoutDuration);
|
||||
}, options.heartBeatInterval);
|
||||
};
|
||||
// 停止心跳检查
|
||||
const stopHeartBeat = () => {
|
||||
clearInterval(options.heartBeatTimer);
|
||||
resetPingTimeout();
|
||||
};
|
||||
|
||||
// WebSocket 重连
|
||||
const reconnect = () => {
|
||||
if (options.destroy || !SocketTask.value) {
|
||||
// 如果WebSocket已被销毁或尚未完全关闭,不进行重连
|
||||
return;
|
||||
}
|
||||
|
||||
// 重连中
|
||||
options.isReconnecting = true;
|
||||
|
||||
// 清除现有的重连标志,以避免多次重连
|
||||
if (options.reconnectTimeout) {
|
||||
clearTimeout(options.reconnectTimeout);
|
||||
}
|
||||
|
||||
// 设置重连延迟
|
||||
options.reconnectTimeout = setTimeout(() => {
|
||||
// 检查组件是否仍在运行和WebSocket是否关闭
|
||||
if (!options.destroy) {
|
||||
// 重置重连标志
|
||||
options.isReconnecting = false;
|
||||
// 初始化新的WebSocket连接
|
||||
initSocket();
|
||||
}
|
||||
}, options.reconnectInterval);
|
||||
};
|
||||
|
||||
const resetPingTimeout = () => {
|
||||
if (options.pingTimeout) {
|
||||
clearTimeout(options.pingTimeout);
|
||||
options.pingTimeout = null; // 清除超时ID
|
||||
}
|
||||
};
|
||||
|
||||
const close = () => {
|
||||
options.destroy = true;
|
||||
stopHeartBeat();
|
||||
if (options.reconnectTimeout) {
|
||||
clearTimeout(options.reconnectTimeout);
|
||||
}
|
||||
if (SocketTask.value) {
|
||||
SocketTask.value.close();
|
||||
SocketTask.value = null;
|
||||
}
|
||||
};
|
||||
|
||||
const initSocket = () => {
|
||||
options.destroy = false;
|
||||
copyValueToTarget(options, opt);
|
||||
SocketTask.value = uni.connectSocket({
|
||||
url: options.url,
|
||||
complete: () => {},
|
||||
success: () => {},
|
||||
});
|
||||
initEventListeners();
|
||||
};
|
||||
|
||||
initSocket();
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
close();
|
||||
});
|
||||
return { options };
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,125 @@
|
||||
<!-- 分销账户:展示基本统计信息 -->
|
||||
<template>
|
||||
<view class="account-card">
|
||||
<view class="account-card-box">
|
||||
<view class="ss-flex ss-row-between card-box-header">
|
||||
<view class="ss-flex">
|
||||
<view class="header-title ss-m-r-16">账户信息</view>
|
||||
<button
|
||||
class="ss-reset-button look-btn ss-flex"
|
||||
@tap="state.showMoney = !state.showMoney"
|
||||
>
|
||||
<uni-icons
|
||||
:type="state.showMoney ? 'eye-filled' : 'eye-slash-filled'"
|
||||
color="#A57A55"
|
||||
size="20"
|
||||
/>
|
||||
</button>
|
||||
</view>
|
||||
<view class="ss-flex" @tap="sheep.$router.go('/pages/commission/wallet')">
|
||||
<view class="header-title ss-m-r-4">查看明细</view>
|
||||
<text class="cicon-play-arrow" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 收益 -->
|
||||
<view class="card-content ss-flex">
|
||||
<view class="ss-flex-1 ss-flex-col ss-col-center">
|
||||
<view class="item-title">当前佣金(元)</view>
|
||||
<view class="item-detail">
|
||||
{{ state.showMoney ? fen2yuan(state.summary.brokeragePrice || 0) : '***' }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="ss-flex-1 ss-flex-col ss-col-center">
|
||||
<view class="item-title">昨天的佣金(元)</view>
|
||||
<view class="item-detail">
|
||||
{{ state.showMoney ? fen2yuan(state.summary.yesterdayPrice || 0) : '***' }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="ss-flex-1 ss-flex-col ss-col-center">
|
||||
<view class="item-title">累计已提(元)</view>
|
||||
<view class="item-detail">
|
||||
{{ state.showMoney ? fen2yuan(state.summary.withdrawPrice || 0) : '***' }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import sheep from '@/sheep';
|
||||
import { computed, reactive, onMounted } from 'vue';
|
||||
import BrokerageApi from '@/sheep/api/trade/brokerage';
|
||||
import { fen2yuan } from '@/sheep/hooks/useGoods';
|
||||
|
||||
const userInfo = computed(() => sheep.$store('user').userInfo);
|
||||
|
||||
const state = reactive({
|
||||
showMoney: false,
|
||||
summary: {},
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
let { code, data } = await BrokerageApi.getBrokerageUserSummary();
|
||||
if (code === 0) {
|
||||
state.summary = data || {};
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.account-card {
|
||||
width: 694rpx;
|
||||
margin: 0 auto;
|
||||
padding: 2rpx;
|
||||
background: linear-gradient(180deg, #ffffff 0.88%, #fff9ec 100%);
|
||||
border-radius: 12rpx;
|
||||
z-index: 3;
|
||||
position: relative;
|
||||
|
||||
.account-card-box {
|
||||
background: #ffefd6;
|
||||
|
||||
.card-box-header {
|
||||
padding: 0 30rpx;
|
||||
height: 72rpx;
|
||||
box-shadow: 0px 2px 6px #f2debe;
|
||||
|
||||
.header-title {
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: #a17545;
|
||||
line-height: 30rpx;
|
||||
}
|
||||
|
||||
.cicon-play-arrow {
|
||||
color: #a17545;
|
||||
font-size: 24rpx;
|
||||
line-height: 30rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.card-content {
|
||||
height: 190rpx;
|
||||
background: #fdfae9;
|
||||
|
||||
.item-title {
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: #cba67e;
|
||||
line-height: 30rpx;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.item-detail {
|
||||
font-size: 36rpx;
|
||||
font-family: OPPOSANS;
|
||||
font-weight: bold;
|
||||
color: #692e04;
|
||||
line-height: 30rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,171 @@
|
||||
<!-- 提现方式的 select 组件 -->
|
||||
<template>
|
||||
<su-popup :show="show" class="ss-checkout-counter-wrap" @close="hideModal">
|
||||
<view class="ss-modal-box bg-white ss-flex-col">
|
||||
<view class="modal-header ss-flex-col ss-col-left">
|
||||
<text class="modal-title ss-m-b-20">选择提现方式</text>
|
||||
</view>
|
||||
<view class="modal-content ss-flex-1 ss-p-b-100">
|
||||
<radio-group @change="onChange">
|
||||
<label
|
||||
class="container-list ss-p-l-34 ss-p-r-24 ss-flex ss-col-center ss-row-center"
|
||||
v-for="(item, index) in typeList"
|
||||
:key="index"
|
||||
>
|
||||
<view class="container-icon ss-flex ss-m-r-20">
|
||||
<image :src="sheep.$url.static(item.icon)" />
|
||||
</view>
|
||||
<view class="ss-flex-1">{{ item.title }}</view>
|
||||
<radio
|
||||
:value="item.value"
|
||||
color="var(--ui-BG-Main)"
|
||||
:checked="item.value === state.currentValue"
|
||||
:disabled="!methods.includes(parseInt(item.value))"
|
||||
/>
|
||||
</label>
|
||||
</radio-group>
|
||||
</view>
|
||||
<view class="modal-footer ss-flex ss-row-center ss-col-center">
|
||||
<button class="ss-reset-button save-btn" @tap="onConfirm">确定</button>
|
||||
</view>
|
||||
</view>
|
||||
</su-popup>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive } from 'vue';
|
||||
import sheep from '@/sheep';
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: Object,
|
||||
default() {},
|
||||
},
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
methods: {
|
||||
// 开启的提现方式
|
||||
type: Array,
|
||||
default: [],
|
||||
},
|
||||
});
|
||||
const emits = defineEmits(['update:modelValue', 'change', 'close']);
|
||||
const state = reactive({
|
||||
currentValue: '',
|
||||
});
|
||||
|
||||
const typeList = [
|
||||
{
|
||||
icon: '/static/img/shop/pay/wallet.png',
|
||||
title: '钱包余额',
|
||||
value: '1',
|
||||
},
|
||||
{
|
||||
icon: '/static/img/shop/pay/bank.png',
|
||||
title: '银行卡转账',
|
||||
value: '2',
|
||||
},
|
||||
{
|
||||
icon: '/static/img/shop/pay/wechat.png',
|
||||
title: '微信收款码', // 微信手动转账
|
||||
value: '3',
|
||||
},
|
||||
{
|
||||
icon: '/static/img/shop/pay/alipay.png',
|
||||
title: '支付宝收款码', // 支付宝手动转账
|
||||
value: '4',
|
||||
},
|
||||
{
|
||||
icon: '/static/img/shop/pay/wechat_api.png',
|
||||
title: '微信零钱', // 微信 API 转账
|
||||
value: '5',
|
||||
},
|
||||
{
|
||||
icon: '/static/img/shop/pay/alipay_api.png',
|
||||
title: '支付宝余额', // 支付宝 API 转账
|
||||
value: '6',
|
||||
},
|
||||
];
|
||||
|
||||
function onChange(e) {
|
||||
state.currentValue = e.detail.value;
|
||||
}
|
||||
|
||||
const onConfirm = async () => {
|
||||
if (state.currentValue === '') {
|
||||
sheep.$helper.toast('请选择提现方式');
|
||||
return;
|
||||
}
|
||||
// 赋值
|
||||
emits('update:modelValue', {
|
||||
type: state.currentValue,
|
||||
});
|
||||
// 关闭弹窗
|
||||
emits('close');
|
||||
};
|
||||
|
||||
const hideModal = () => {
|
||||
emits('close');
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.ss-modal-box {
|
||||
border-radius: 30rpx 30rpx 0 0;
|
||||
max-height: 1000rpx;
|
||||
|
||||
.modal-header {
|
||||
position: relative;
|
||||
padding: 60rpx 40rpx 40rpx;
|
||||
|
||||
.modal-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.close-icon {
|
||||
position: absolute;
|
||||
top: 10rpx;
|
||||
right: 20rpx;
|
||||
font-size: 46rpx;
|
||||
opacity: 0.2;
|
||||
}
|
||||
}
|
||||
|
||||
.modal-content {
|
||||
overflow-y: auto;
|
||||
|
||||
.container-list {
|
||||
height: 96rpx;
|
||||
border-bottom: 2rpx solid rgba(#dfdfdf, 0.5);
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
|
||||
.container-icon {
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.modal-footer {
|
||||
height: 120rpx;
|
||||
|
||||
.save-btn {
|
||||
width: 710rpx;
|
||||
height: 80rpx;
|
||||
border-radius: 40rpx;
|
||||
background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
|
||||
color: $white;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,101 @@
|
||||
<!-- 分销权限弹窗:再没有权限时,进行提示 -->
|
||||
<template>
|
||||
<su-popup
|
||||
:show="state.show"
|
||||
type="center"
|
||||
round="10"
|
||||
@close="state.show = false"
|
||||
:isMaskClick="false"
|
||||
maskBackgroundColor="rgba(0, 0, 0, 0.7)"
|
||||
>
|
||||
<view class="notice-box">
|
||||
<view class="img-wrap">
|
||||
<image
|
||||
class="notice-img"
|
||||
:src="sheep.$url.static('/static/img/shop/commission/forbidden.png')"
|
||||
mode="aspectFill"
|
||||
/>
|
||||
</view>
|
||||
<view class="notice-title"> 抱歉!您没有分销权限 </view>
|
||||
<view class="notice-detail"> 该功能暂不可用 </view>
|
||||
<button
|
||||
class="ss-reset-button notice-btn ui-Shadow-Main ui-BG-Main-Gradient"
|
||||
@tap="sheep.$router.back()"
|
||||
>
|
||||
知道了
|
||||
</button>
|
||||
<button class="ss-reset-button back-btn" @tap="sheep.$router.back()"> 返回 </button>
|
||||
</view>
|
||||
</su-popup>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onShow } from '@dcloudio/uni-app';
|
||||
import sheep from '@/sheep';
|
||||
import { reactive } from 'vue';
|
||||
import BrokerageApi from '@/sheep/api/trade/brokerage';
|
||||
|
||||
const state = reactive({
|
||||
show: false,
|
||||
});
|
||||
|
||||
onShow(async () => {
|
||||
// 读取是否有分销权限
|
||||
const { code, data } = await BrokerageApi.getBrokerageUser();
|
||||
if (code === 0 && !data?.brokerageEnabled) {
|
||||
state.show = true;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.notice-box {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background-color: #fff;
|
||||
width: 612rpx;
|
||||
min-height: 658rpx;
|
||||
background: #ffffff;
|
||||
padding: 30rpx;
|
||||
border-radius: 20rpx;
|
||||
.img-wrap {
|
||||
margin-bottom: 50rpx;
|
||||
.notice-img {
|
||||
width: 180rpx;
|
||||
height: 170rpx;
|
||||
}
|
||||
}
|
||||
.notice-title {
|
||||
font-size: 35rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
margin-bottom: 28rpx;
|
||||
}
|
||||
.notice-detail {
|
||||
font-size: 28rpx;
|
||||
font-weight: 400;
|
||||
color: #999999;
|
||||
line-height: 36rpx;
|
||||
margin-bottom: 50rpx;
|
||||
}
|
||||
.notice-btn {
|
||||
width: 492rpx;
|
||||
line-height: 70rpx;
|
||||
border-radius: 35rpx;
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
.back-btn {
|
||||
width: 492rpx;
|
||||
line-height: 70rpx;
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: var(--ui-BG-Main-gradient);
|
||||
background: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,113 @@
|
||||
<!-- 分销商信息 -->
|
||||
<template>
|
||||
<!-- 用户资料 -->
|
||||
<view class="user-card ss-flex ss-col-bottom">
|
||||
<view class="card-top ss-flex ss-row-between">
|
||||
<view class="ss-flex">
|
||||
<view class="head-img-box">
|
||||
<image class="head-img" :src="sheep.$url.cdn(userInfo.avatar)" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="ss-flex-col">
|
||||
<view class="user-name">{{ userInfo.nickname }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import sheep from '@/sheep';
|
||||
import { computed, reactive } from 'vue';
|
||||
|
||||
const userInfo = computed(() => sheep.$store('user').userInfo);
|
||||
const headerBg = sheep.$url.css('/static/img/shop/commission/background.png');
|
||||
|
||||
const state = reactive({
|
||||
showMoney: false,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// 用户资料卡片
|
||||
.user-card {
|
||||
width: 700rpx;
|
||||
height: 192rpx;
|
||||
margin: 0 auto;
|
||||
margin-top: -88rpx;
|
||||
padding-top: 88rpx;
|
||||
background: v-bind(headerBg) no-repeat;
|
||||
background-size: 100% 100%;
|
||||
|
||||
.head-img-box {
|
||||
margin-right: 20rpx;
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
border-radius: 50%;
|
||||
position: relative;
|
||||
background: #fce0ad;
|
||||
|
||||
.head-img {
|
||||
width: 92rpx;
|
||||
height: 92rpx;
|
||||
border-radius: 50%;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
}
|
||||
|
||||
.card-top {
|
||||
box-sizing: border-box;
|
||||
padding-bottom: 34rpx;
|
||||
|
||||
.user-name {
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
color: #692e04;
|
||||
line-height: 30rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.log-btn {
|
||||
width: 84rpx;
|
||||
height: 42rpx;
|
||||
border: 2rpx solid rgba(#ffffff, 0.33);
|
||||
border-radius: 21rpx;
|
||||
font-size: 22rpx;
|
||||
font-weight: 400;
|
||||
color: #ffffff;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.look-btn {
|
||||
color: #fff;
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.user-info-box {
|
||||
.tag-box {
|
||||
background: #ff6000;
|
||||
border-radius: 18rpx;
|
||||
line-height: 36rpx;
|
||||
|
||||
.tag-img {
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
border-radius: 50%;
|
||||
margin-left: -2rpx;
|
||||
}
|
||||
|
||||
.tag-title {
|
||||
font-size: 24rpx;
|
||||
padding: 0 10rpx;
|
||||
font-weight: 500;
|
||||
line-height: 36rpx;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,181 @@
|
||||
<!-- 分销首页:明细列表 -->
|
||||
<template>
|
||||
<view class="distribution-log-wrap">
|
||||
<view class="header-box">
|
||||
<image class="header-bg" :src="sheep.$url.static('/static/img/shop/commission/title2.png')" />
|
||||
<view class="ss-flex header-title">
|
||||
<view class="title">实时动态</view>
|
||||
<text class="cicon-forward" />
|
||||
</view>
|
||||
</view>
|
||||
<scroll-view
|
||||
scroll-y="true"
|
||||
@scrolltolower="loadmore"
|
||||
class="scroll-box log-scroll"
|
||||
scroll-with-animation="true"
|
||||
>
|
||||
<view v-if="state.pagination.list">
|
||||
<view
|
||||
class="log-item-box ss-flex ss-row-between"
|
||||
v-for="item in state.pagination.list"
|
||||
:key="item.id"
|
||||
>
|
||||
<view class="log-item-wrap">
|
||||
<view class="log-item ss-flex ss-ellipsis-1 ss-col-center">
|
||||
<view class="ss-flex ss-col-center">
|
||||
<image
|
||||
class="log-img"
|
||||
:src="sheep.$url.static('/static/img/shop/avatar/notice.png')"
|
||||
mode="aspectFill"
|
||||
/>
|
||||
</view>
|
||||
<view class="log-text ss-ellipsis-1">
|
||||
{{ item.title }} {{ fen2yuan(item.price) }} 元
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<text class="log-time">{{ dayjs(item.createTime).fromNow() }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 加载更多 -->
|
||||
<uni-load-more
|
||||
v-if="state.pagination.total > 0"
|
||||
:status="state.loadStatus"
|
||||
color="#333333"
|
||||
@tap="loadmore"
|
||||
/>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import sheep from '@/sheep';
|
||||
import { reactive } from 'vue';
|
||||
import _ from 'lodash-es';
|
||||
import dayjs from 'dayjs';
|
||||
import BrokerageApi from '@/sheep/api/trade/brokerage';
|
||||
import { fen2yuan } from '../../../sheep/hooks/useGoods';
|
||||
|
||||
const state = reactive({
|
||||
loadStatus: '',
|
||||
pagination: {
|
||||
list: [],
|
||||
total: 0,
|
||||
pageNo: 1,
|
||||
pageSize: 8,
|
||||
},
|
||||
});
|
||||
|
||||
async function getLog() {
|
||||
state.loadStatus = 'loading';
|
||||
const { code, data } = await BrokerageApi.getBrokerageRecordPage({
|
||||
pageNo: state.pagination.pageNo,
|
||||
pageSize: state.pagination.pageSize,
|
||||
});
|
||||
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';
|
||||
}
|
||||
|
||||
getLog();
|
||||
|
||||
// 加载更多
|
||||
function loadmore() {
|
||||
if (state.loadStatus === 'noMore') {
|
||||
return;
|
||||
}
|
||||
state.pagination.pageNo++;
|
||||
getLog();
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.distribution-log-wrap {
|
||||
width: 690rpx;
|
||||
margin: 0 auto;
|
||||
margin-bottom: 20rpx;
|
||||
border-radius: 12rpx;
|
||||
z-index: 3;
|
||||
position: relative;
|
||||
|
||||
.header-box {
|
||||
width: 690rpx;
|
||||
height: 76rpx;
|
||||
position: relative;
|
||||
|
||||
.header-bg {
|
||||
width: 690rpx;
|
||||
height: 76rpx;
|
||||
}
|
||||
|
||||
.header-title {
|
||||
position: absolute;
|
||||
left: 20rpx;
|
||||
top: 24rpx;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
line-height: 30rpx;
|
||||
}
|
||||
|
||||
.cicon-forward {
|
||||
font-size: 30rpx;
|
||||
font-weight: 400;
|
||||
color: #ffffff;
|
||||
line-height: 30rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.log-scroll {
|
||||
height: 600rpx;
|
||||
background: #fdfae9;
|
||||
padding: 10rpx 20rpx 0;
|
||||
box-sizing: border-box;
|
||||
border-radius: 0 0 12rpx 12rpx;
|
||||
|
||||
.log-item-box {
|
||||
margin-bottom: 20rpx;
|
||||
|
||||
.log-time {
|
||||
// margin-left: 30rpx;
|
||||
text-align: right;
|
||||
font-size: 24rpx;
|
||||
font-family: OPPOSANS;
|
||||
font-weight: 400;
|
||||
color: #c4c4c4;
|
||||
}
|
||||
}
|
||||
|
||||
.loadmore-wrap {
|
||||
// line-height: 80rpx;
|
||||
}
|
||||
|
||||
.log-item {
|
||||
// background: rgba(#ffffff, 0.2);
|
||||
border-radius: 24rpx;
|
||||
padding: 6rpx 20rpx 6rpx 12rpx;
|
||||
|
||||
.log-img {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
border-radius: 50%;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
.log-text {
|
||||
max-width: 480rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,145 @@
|
||||
<!-- 分销:商菜单栏 -->
|
||||
<template>
|
||||
<view class="menu-box ss-flex-col">
|
||||
<view class="header-box">
|
||||
<image class="header-bg" :src="sheep.$url.static('/static/img/shop/commission/title1.png')" />
|
||||
<view class="ss-flex header-title">
|
||||
<view class="title">功能专区</view>
|
||||
<text class="cicon-forward"></text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="menu-list ss-flex ss-flex-wrap">
|
||||
<view
|
||||
v-for="(item, index) in state.menuList"
|
||||
:key="index"
|
||||
class="item-box ss-flex-col ss-col-center"
|
||||
@tap="sheep.$router.go(item.path)"
|
||||
>
|
||||
<image
|
||||
class="menu-icon ss-m-b-10"
|
||||
:src="sheep.$url.static(item.img)"
|
||||
mode="aspectFill"
|
||||
></image>
|
||||
<view>{{ item.title }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import sheep from '@/sheep';
|
||||
import { reactive } from 'vue';
|
||||
|
||||
const state = reactive({
|
||||
menuList: [
|
||||
{
|
||||
img: '/static/img/shop/commission/commission_icon1.png',
|
||||
title: '我的团队',
|
||||
path: '/pages/commission/team',
|
||||
},
|
||||
{
|
||||
img: '/static/img/shop/commission/commission_icon2.png',
|
||||
title: '佣金明细',
|
||||
path: '/pages/commission/wallet',
|
||||
},
|
||||
{
|
||||
img: '/static/img/shop/commission/commission_icon3.png',
|
||||
title: '分销订单',
|
||||
path: '/pages/commission/order',
|
||||
},
|
||||
{
|
||||
img: '/static/img/shop/commission/commission_icon4.png',
|
||||
title: '推广商品',
|
||||
path: '/pages/commission/goods',
|
||||
},
|
||||
// {
|
||||
// img: '/static/img/shop/commission/commission_icon5.png',
|
||||
// title: '我的资料',
|
||||
// path: '/pages/commission/apply',
|
||||
// isAgentFrom: true,
|
||||
// },
|
||||
{
|
||||
img: '/static/img/shop/commission/commission_icon7.png',
|
||||
title: '邀请海报',
|
||||
path: 'action:showShareModal',
|
||||
},
|
||||
{
|
||||
img: '/static/img/shop/commission/commission_icon8.png',
|
||||
title: '推广排行',
|
||||
path: '/pages/commission/promoter',
|
||||
},
|
||||
{
|
||||
img: '/static/img/shop/commission/commission_icon9.png',
|
||||
title: '佣金排行',
|
||||
path: '/pages/commission/commission-ranking',
|
||||
},
|
||||
],
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.menu-box {
|
||||
margin: 0 auto;
|
||||
width: 690rpx;
|
||||
margin-bottom: 20rpx;
|
||||
margin-top: 20rpx;
|
||||
border-radius: 12rpx;
|
||||
z-index: 3;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.header-box {
|
||||
width: 690rpx;
|
||||
height: 76rpx;
|
||||
position: relative;
|
||||
|
||||
.header-bg {
|
||||
width: 690rpx;
|
||||
height: 76rpx;
|
||||
}
|
||||
|
||||
.header-title {
|
||||
position: absolute;
|
||||
left: 20rpx;
|
||||
top: 24rpx;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
line-height: 30rpx;
|
||||
}
|
||||
|
||||
.cicon-forward {
|
||||
font-size: 30rpx;
|
||||
font-weight: 400;
|
||||
color: #ffffff;
|
||||
line-height: 30rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.menu-list {
|
||||
padding: 50rpx 0 10rpx 0;
|
||||
background: #fdfae9;
|
||||
border-radius: 0 0 12rpx 12rpx;
|
||||
}
|
||||
|
||||
.item-box {
|
||||
width: 25%;
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
|
||||
.menu-icon {
|
||||
width: 68rpx;
|
||||
height: 68rpx;
|
||||
background: #ffffff;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.menu-title {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,165 @@
|
||||
<!-- 分销商品列表 -->
|
||||
<template>
|
||||
<s-layout title="推广商品" :onShareAppMessage="state.shareInfo">
|
||||
<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.introduction"
|
||||
:price="item.price"
|
||||
:originPrice="item.marketPrice"
|
||||
priceColor="#333"
|
||||
@tap="sheep.$router.go('/pages/goods/index', { id: item.id })"
|
||||
>
|
||||
<template #rightBottom>
|
||||
<view class="ss-flex ss-row-between">
|
||||
<view class="commission-num" v-if="item.brokerageMinPrice === undefined">
|
||||
预计佣金:计算中
|
||||
</view>
|
||||
<view
|
||||
class="commission-num"
|
||||
v-else-if="item.brokerageMinPrice === item.brokerageMaxPrice"
|
||||
>
|
||||
预计佣金:{{ fen2yuan(item.brokerageMinPrice) }}
|
||||
</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: '上拉加载更多',
|
||||
}"
|
||||
@tap="loadMore"
|
||||
/>
|
||||
</s-layout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import sheep from '@/sheep';
|
||||
import $share from '@/sheep/platform/share';
|
||||
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
||||
import { reactive } from 'vue';
|
||||
import _ from 'lodash-es';
|
||||
import { showShareModal } from '@/sheep/hooks/useModal';
|
||||
import SpuApi from '@/sheep/api/product/spu';
|
||||
import BrokerageApi from '@/sheep/api/trade/brokerage';
|
||||
import { fen2yuan } from '@/sheep/hooks/useGoods';
|
||||
|
||||
const state = reactive({
|
||||
pagination: {
|
||||
list: [],
|
||||
total: 0,
|
||||
pageNo: 1,
|
||||
pageSize: 8,
|
||||
},
|
||||
loadStatus: '',
|
||||
shareInfo: {},
|
||||
});
|
||||
|
||||
function onShareGoods(goodsInfo) {
|
||||
state.shareInfo = $share.getShareInfo(
|
||||
{
|
||||
title: goodsInfo.name,
|
||||
image: sheep.$url.cdn(goodsInfo.picUrl),
|
||||
desc: goodsInfo.introduction,
|
||||
params: {
|
||||
page: '2',
|
||||
query: goodsInfo.id,
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'goods', // 商品海报
|
||||
title: goodsInfo.name, // 商品名称
|
||||
image: sheep.$url.cdn(goodsInfo.picUrl), // 商品主图
|
||||
price: fen2yuan(goodsInfo.price), // 商品价格
|
||||
original_price: fen2yuan(goodsInfo.marketPrice), // 商品原价
|
||||
},
|
||||
);
|
||||
showShareModal();
|
||||
}
|
||||
|
||||
async function getGoodsList() {
|
||||
state.loadStatus = 'loading';
|
||||
let { code, data } = await SpuApi.getSpuPage({
|
||||
pageSize: state.pagination.pageSize,
|
||||
pageNo: state.pagination.pageNo,
|
||||
});
|
||||
|
||||
if (code !== 0) {
|
||||
state.loadStatus = 'error'; // 处理错误状态
|
||||
return;
|
||||
}
|
||||
|
||||
// 使用 Promise.all 来等待所有佣金请求完成
|
||||
await Promise.all(
|
||||
data.list.map(async (item) => {
|
||||
try {
|
||||
const res = await BrokerageApi.getProductBrokeragePrice(item.id);
|
||||
item.brokerageMinPrice = res.data.brokerageMinPrice;
|
||||
item.brokerageMaxPrice = res.data.brokerageMaxPrice;
|
||||
} catch (error) {
|
||||
console.error(`获取商品【${item.name}】的佣金时出错:`, error);
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
||||
// 在所有请求完成后合并列表和更新状态
|
||||
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';
|
||||
}
|
||||
|
||||
onLoad(() => {
|
||||
getGoodsList();
|
||||
});
|
||||
|
||||
// 加载更多
|
||||
function loadMore() {
|
||||
if (state.loadStatus === 'noMore') {
|
||||
return;
|
||||
}
|
||||
state.pagination.pageNo++;
|
||||
getGoodsList();
|
||||
}
|
||||
|
||||
// 上拉加载更多
|
||||
onReachBottom(() => {
|
||||
loadMore();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.goods-item {
|
||||
.commission-num {
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: $red;
|
||||
}
|
||||
|
||||
.share-btn {
|
||||
width: 120rpx;
|
||||
height: 50rpx;
|
||||
border-radius: 25rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,57 @@
|
||||
<!-- 分销中心 -->
|
||||
<template>
|
||||
<s-layout
|
||||
navbar="inner"
|
||||
class="index-wrap"
|
||||
title="分销中心"
|
||||
:bgStyle="bgStyle"
|
||||
:onShareAppMessage="shareInfo"
|
||||
>
|
||||
<!-- 分销商信息 -->
|
||||
<commission-info />
|
||||
<!-- 账户信息 -->
|
||||
<account-info />
|
||||
<!-- 菜单栏 -->
|
||||
<commission-menu />
|
||||
<!-- 分销记录 -->
|
||||
<commission-log />
|
||||
|
||||
<!-- 权限弹窗 -->
|
||||
<commission-auth />
|
||||
</s-layout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
import commissionInfo from './components/commission-info.vue';
|
||||
import accountInfo from './components/account-info.vue';
|
||||
import commissionLog from './components/commission-log.vue';
|
||||
import commissionMenu from './components/commission-menu.vue';
|
||||
import commissionAuth from './components/commission-auth.vue';
|
||||
import sheep from '@/sheep';
|
||||
import { SharePageEnum } from '@/sheep/helper/const';
|
||||
|
||||
/** 分销邀请 */
|
||||
const shareInfo = computed(() => {
|
||||
return sheep.$platform.share.getShareInfo(
|
||||
{
|
||||
params: {
|
||||
page: SharePageEnum.HOME.value, // 用户通邀请进入到首页
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'user',
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
const bgStyle = {
|
||||
color: '#F7D598',
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
:deep(.page-main) {
|
||||
background-size: 100% 100% !important;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,332 @@
|
||||
<!-- 分销 - 订单明细 -->
|
||||
<template>
|
||||
<s-layout title="分销订单" :class="state.scrollTop ? 'order-warp' : ''" navbar="inner">
|
||||
<view
|
||||
class="header-box"
|
||||
:style="[
|
||||
{
|
||||
marginTop: '-' + Number(statusBarHeight + 88) + '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="total-item" style="width: 100%">
|
||||
<view class="item-title" style="text-align: center">累计推广订单(单)</view>
|
||||
<view class="total-num" style="text-align: center">
|
||||
{{ state.totals }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- tab -->
|
||||
<su-sticky bgColor="#fff">
|
||||
<su-tabs
|
||||
:list="tabMaps"
|
||||
:scrollable="false"
|
||||
:current="state.currentTab"
|
||||
@change="onTabsChange"
|
||||
>
|
||||
</su-tabs>
|
||||
</su-sticky>
|
||||
|
||||
<!-- 订单 -->
|
||||
<view class="order-box">
|
||||
<view class="order-item" v-for="item in state.pagination.list" :key="item">
|
||||
<view class="order-header">
|
||||
<view class="no-box ss-flex ss-col-center ss-row-between">
|
||||
<text class="order-code">订单编号:{{ item.bizId }}</text>
|
||||
<text class="order-state">
|
||||
{{ item.status === 0 ? '待结算' : item.status === 1 ? '已结算' : '已取消' }}
|
||||
( 佣金 {{ fen2yuan(item.price) }} 元 )
|
||||
</text>
|
||||
</view>
|
||||
<view class="order-from ss-flex ss-col-center ss-row-between">
|
||||
<view class="from-user ss-flex ss-col-center">
|
||||
<text>{{ item.title }}</text>
|
||||
</view>
|
||||
<view class="order-time">
|
||||
{{ sheep.$helper.timeFormat(item.createTime, 'yyyy-mm-dd hh:MM:ss') }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 数据为空 -->
|
||||
<s-empty v-if="state.pagination.total === 0" icon="/static/order-empty.png" text="暂无订单" />
|
||||
<!-- 加载更多 -->
|
||||
<uni-load-more
|
||||
v-if="state.pagination.total > 0"
|
||||
:status="state.loadStatus"
|
||||
:content-text="{
|
||||
contentdown: '上拉加载更多',
|
||||
}"
|
||||
@tap="loadMore"
|
||||
/>
|
||||
</view>
|
||||
</s-layout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import sheep from '@/sheep';
|
||||
import { onLoad, onPageScroll, onReachBottom } from '@dcloudio/uni-app';
|
||||
import { reactive } from 'vue';
|
||||
import _ from 'lodash-es';
|
||||
import { resetPagination } from '@/sheep/helper/utils';
|
||||
import BrokerageApi from '@/sheep/api/trade/brokerage';
|
||||
import { fen2yuan } from '../../sheep/hooks/useGoods';
|
||||
|
||||
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
|
||||
const headerBg = sheep.$url.css('/static/img/shop/user/withdraw_bg.png');
|
||||
|
||||
onPageScroll((e) => {
|
||||
state.scrollTop = e.scrollTop <= 100;
|
||||
});
|
||||
|
||||
const state = reactive({
|
||||
totals: 0, // 累计推广订单(单)
|
||||
scrollTop: false,
|
||||
|
||||
currentTab: 0,
|
||||
loadStatus: '',
|
||||
pagination: {
|
||||
list: [],
|
||||
total: 0,
|
||||
pageNo: 1,
|
||||
pageSize: 8,
|
||||
},
|
||||
});
|
||||
|
||||
const tabMaps = [
|
||||
{
|
||||
name: '全部',
|
||||
value: -1,
|
||||
},
|
||||
{
|
||||
name: '待结算',
|
||||
value: 0, // 待结算
|
||||
},
|
||||
{
|
||||
name: '已结算',
|
||||
value: 1, // 已结算
|
||||
},
|
||||
];
|
||||
|
||||
// 切换选项卡
|
||||
function onTabsChange(e) {
|
||||
resetPagination(state.pagination);
|
||||
state.currentTab = e.index;
|
||||
getOrderList();
|
||||
}
|
||||
|
||||
// 获取订单列表
|
||||
async function getOrderList() {
|
||||
state.loadStatus = 'loading';
|
||||
const tab = tabMaps[state.currentTab];
|
||||
const queryParams = {
|
||||
pageSize: state.pagination.pageSize,
|
||||
pageNo: state.pagination.pageNo,
|
||||
bizType: 1, // 获得推广佣金
|
||||
status: tab.value,
|
||||
};
|
||||
if (tab.value < 0) {
|
||||
delete queryParams.status;
|
||||
}
|
||||
const { code, data } = await BrokerageApi.getBrokerageRecordPage(queryParams);
|
||||
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(() => {
|
||||
getOrderList();
|
||||
});
|
||||
|
||||
// 加载更多
|
||||
function loadMore() {
|
||||
if (state.loadStatus === 'noMore') {
|
||||
return;
|
||||
}
|
||||
state.pagination.pageNo++;
|
||||
getOrderList();
|
||||
}
|
||||
|
||||
// 上拉加载更多
|
||||
onReachBottom(() => {
|
||||
loadMore();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.header-box {
|
||||
box-sizing: border-box;
|
||||
padding: 0 20rpx 20rpx 20rpx;
|
||||
width: 750rpx;
|
||||
background: v-bind(headerBg) no-repeat,
|
||||
linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
|
||||
background-size: 750rpx 100%;
|
||||
|
||||
// 团队信息总览
|
||||
.team-data-box {
|
||||
.data-card {
|
||||
width: 305rpx;
|
||||
background: #ffffff;
|
||||
border-radius: 20rpx;
|
||||
padding: 20rpx;
|
||||
|
||||
.total-item {
|
||||
margin-bottom: 30rpx;
|
||||
|
||||
.item-title {
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: #999999;
|
||||
line-height: normal;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.total-num {
|
||||
font-size: 38rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
font-family: OPPOSANS;
|
||||
}
|
||||
}
|
||||
|
||||
.category-num {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
font-family: OPPOSANS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 直推
|
||||
.direct-box {
|
||||
margin-top: 20rpx;
|
||||
|
||||
.direct-item {
|
||||
width: 340rpx;
|
||||
background: #ffffff;
|
||||
border-radius: 20rpx;
|
||||
padding: 20rpx;
|
||||
box-sizing: border-box;
|
||||
|
||||
.item-title {
|
||||
font-size: 22rpx;
|
||||
font-weight: 500;
|
||||
color: #999999;
|
||||
margin-bottom: 6rpx;
|
||||
}
|
||||
|
||||
.item-value {
|
||||
font-size: 38rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
font-family: OPPOSANS;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 订单
|
||||
.order-box {
|
||||
.order-item {
|
||||
background: #ffffff;
|
||||
border-radius: 10rpx;
|
||||
margin: 20rpx;
|
||||
|
||||
.order-footer {
|
||||
padding: 20rpx;
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.order-header {
|
||||
.no-box {
|
||||
padding: 20rpx;
|
||||
|
||||
.order-code {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.order-state {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: var(--ui-BG-Main);
|
||||
}
|
||||
}
|
||||
|
||||
.order-from {
|
||||
padding: 20rpx;
|
||||
|
||||
.from-user {
|
||||
font-size: 24rpx;
|
||||
font-weight: 400;
|
||||
color: #666666;
|
||||
|
||||
.user-avatar {
|
||||
width: 26rpx;
|
||||
height: 26rpx;
|
||||
border-radius: 50%;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
|
||||
.user-name {
|
||||
font-size: 24rpx;
|
||||
font-weight: 400;
|
||||
color: #999999;
|
||||
}
|
||||
}
|
||||
|
||||
.order-time {
|
||||
font-size: 24rpx;
|
||||
font-weight: 400;
|
||||
color: #999999;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.commission-box {
|
||||
.name {
|
||||
font-size: 24rpx;
|
||||
font-weight: 400;
|
||||
color: #999999;
|
||||
}
|
||||
}
|
||||
|
||||
.commission-num {
|
||||
font-size: 30rpx;
|
||||
font-weight: 500;
|
||||
color: $red;
|
||||
font-family: OPPOSANS;
|
||||
|
||||
&::before {
|
||||
content: '¥';
|
||||
font-size: 22rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.order-status {
|
||||
line-height: 30rpx;
|
||||
padding: 0 10rpx;
|
||||
border-radius: 30rpx;
|
||||
margin-left: 20rpx;
|
||||
font-size: 24rpx;
|
||||
color: var(--ui-BG-Main);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,604 @@
|
||||
<!-- 页面 -->
|
||||
<template>
|
||||
<s-layout title="我的团队" :class="state.scrollTop ? 'team-wrap' : ''" navbar="inner">
|
||||
<view
|
||||
class="header-box"
|
||||
:style="[
|
||||
{
|
||||
marginTop: '-' + Number(statusBarHeight + 88) + 'rpx',
|
||||
paddingTop: Number(statusBarHeight + 108) + 'rpx',
|
||||
},
|
||||
]"
|
||||
>
|
||||
<!-- 推广数据总览 -->
|
||||
<view class="team-data-box ss-flex ss-col-center ss-row-between" style="width: 100%">
|
||||
<view class="data-card" style="width: 100%">
|
||||
<view class="total-item" style="width: 100%">
|
||||
<view class="item-title" style="text-align: center">推广人数</view>
|
||||
<view class="total-num" style="text-align: center">
|
||||
{{
|
||||
state.summary.firstBrokerageUserCount + state.summary.secondBrokerageUserCount || 0
|
||||
}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="promoter-list">
|
||||
<!--<view
|
||||
class="promoterHeader bg-color"
|
||||
style="backgroundcolor: #e93323 !important; height: 218rpx; color: #fff"
|
||||
>
|
||||
<view class="headerCon acea-row row-between" style="padding: 28px 29px 0 29px">
|
||||
<view>
|
||||
<view class="name" style="color: #fff">推广人数</view>
|
||||
<view>
|
||||
<text class="num" style="color: #fff">
|
||||
{{
|
||||
state.summary.firstBrokerageUserCount + state.summary.secondBrokerageUserCount ||
|
||||
0
|
||||
}}
|
||||
</text>
|
||||
人
|
||||
</view>
|
||||
</view>
|
||||
<view class="iconfont icon-tuandui" />
|
||||
</view>
|
||||
</view>-->
|
||||
<view style="padding: 0 20rpx">
|
||||
<view class="nav acea-row row-around l1" style="margin-top: 20rpx">
|
||||
<view :class="state.level == 1 ? 'item on' : 'item'" @click="setType(1)">
|
||||
一级({{ state.summary.firstBrokerageUserCount || 0 }})
|
||||
</view>
|
||||
<view :class="state.level == 2 ? 'item on' : 'item'" @click="setType(2)">
|
||||
二级({{ state.summary.secondBrokerageUserCount || 0 }})
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="search acea-row row-between-wrapper"
|
||||
style="display: flex; height: 100rpx; align-items: center"
|
||||
>
|
||||
<view class="input">
|
||||
<input
|
||||
placeholder="点击搜索会员名称"
|
||||
v-model="state.nickname"
|
||||
confirm-type="search"
|
||||
name="search"
|
||||
@confirm="submitForm"
|
||||
/>
|
||||
</view>
|
||||
<image
|
||||
:src="sheep.$url.static('/static/img/shop/search.png')"
|
||||
mode=""
|
||||
style="width: 60rpx; height: 64rpx"
|
||||
@click="submitForm"
|
||||
/>
|
||||
</view>
|
||||
<view class="list">
|
||||
<view class="sortNav acea-row row-middle" style="display: flex; align-items: center">
|
||||
<view
|
||||
class="sortItem"
|
||||
@click="setSort('userCount', 'asc')"
|
||||
v-if="sort === 'userCountDESC'"
|
||||
>
|
||||
团队排序
|
||||
<image :src="sheep.$url.static('/static/img/shop/sort1.png')" />
|
||||
</view>
|
||||
<view
|
||||
class="sortItem"
|
||||
@click="setSort('userCount', 'desc')"
|
||||
v-else-if="sort === 'userCountASC'"
|
||||
>
|
||||
团队排序
|
||||
<image :src="sheep.$url.static('/static/img/shop/sort3.png')" />
|
||||
</view>
|
||||
<view class="sortItem" @click="setSort('userCount', 'desc')" v-else>
|
||||
团队排序
|
||||
<image :src="sheep.$url.static('/static/img/shop/sort2.png')" />
|
||||
</view>
|
||||
<view class="sortItem" @click="setSort('price', 'asc')" v-if="sort === 'priceDESC'">
|
||||
金额排序
|
||||
<image :src="sheep.$url.static('/static/img/shop/sort1.png')" />
|
||||
</view>
|
||||
<view
|
||||
class="sortItem"
|
||||
@click="setSort('price', 'desc')"
|
||||
v-else-if="sort === 'priceASC'"
|
||||
>
|
||||
金额排序
|
||||
<image :src="sheep.$url.static('/static/img/shop/sort3.png')" />
|
||||
</view>
|
||||
<view class="sortItem" @click="setSort('price', 'desc')" v-else>
|
||||
金额排序
|
||||
<image :src="sheep.$url.static('/static/img/shop/sort2.png')" />
|
||||
</view>
|
||||
<view
|
||||
class="sortItem"
|
||||
@click="setSort('orderCount', 'asc')"
|
||||
v-if="sort === 'orderCountDESC'"
|
||||
>
|
||||
订单排序
|
||||
<image :src="sheep.$url.static('/static/img/shop/sort1.png')" />
|
||||
</view>
|
||||
<view
|
||||
class="sortItem"
|
||||
@click="setSort('orderCount', 'desc')"
|
||||
v-else-if="sort === 'orderCountASC'"
|
||||
>
|
||||
订单排序
|
||||
<image :src="sheep.$url.static('/static/img/shop/sort3.png')" />
|
||||
</view>
|
||||
<view class="sortItem" @click="setSort('orderCount', 'desc')" v-else>
|
||||
订单排序
|
||||
<image :src="sheep.$url.static('/static/img/shop/sort2.png')" />
|
||||
</view>
|
||||
</view>
|
||||
<block v-for="(item, index) in state.pagination.list" :key="index">
|
||||
<view class="item acea-row row-between-wrapper" style="display: flex">
|
||||
<view
|
||||
class="picTxt acea-row row-between-wrapper"
|
||||
style="display: flex; align-items: center"
|
||||
>
|
||||
<view class="pictrue">
|
||||
<image :src="item.avatar" />
|
||||
</view>
|
||||
<view class="text">
|
||||
<view class="name line1">{{ item.nickname }}</view>
|
||||
<view>
|
||||
加入时间:
|
||||
{{ sheep.$helper.timeFormat(item.brokerageTime, 'yyyy-mm-dd hh:MM:ss') }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="right"
|
||||
style="
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
display: flex;
|
||||
margin-left: auto;
|
||||
"
|
||||
>
|
||||
<view>
|
||||
<text class="num font-color">{{ item.brokerageUserCount || 0 }} </text>人
|
||||
</view>
|
||||
<view>
|
||||
<text class="num">{{ item.orderCount || 0 }}</text
|
||||
>单</view
|
||||
>
|
||||
<view>
|
||||
<text class="num">{{ fen2yuan(item.brokeragePrice) || 0 }}</text
|
||||
>元
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
<block v-if="state.pagination.list.length === 0">
|
||||
<view style="text-align: center; margin-top: 30rpx">暂无推广人数</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <home></home> -->
|
||||
|
||||
<!-- <view class="header-box" :style="[
|
||||
{
|
||||
marginTop: '-' + Number(statusBarHeight + 88) + 'rpx',
|
||||
paddingTop: Number(statusBarHeight + 108) + 'rpx',
|
||||
},
|
||||
]">
|
||||
<view v-if="userInfo.parent_user" class="referrer-box ss-flex ss-col-center">
|
||||
推荐人:
|
||||
<image class="referrer-avatar ss-m-r-10" :src="sheep.$url.cdn(userInfo.parent_user.avatar)"
|
||||
mode="aspectFill">
|
||||
</image>
|
||||
{{ userInfo.parent_user.nickname }}
|
||||
</view>
|
||||
<view class="team-data-box ss-flex ss-col-center ss-row-between">
|
||||
<view class="data-card">
|
||||
<view class="total-item">
|
||||
<view class="item-title">团队总人数(人)</view>
|
||||
<view class="total-num">
|
||||
{{ (state.summary.firstBrokerageUserCount+ state.summary.secondBrokerageUserCount)|| 0 }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="category-item ss-flex">
|
||||
<view class="ss-flex-1">
|
||||
<view class="item-title">一级成员</view>
|
||||
<view class="category-num">{{ state.summary.firstBrokerageUserCount || 0 }}</view>
|
||||
</view>
|
||||
<view class="ss-flex-1">
|
||||
<view class="item-title">二级成员</view>
|
||||
<view class="category-num">{{ state.summary.secondBrokerageUserCount || 0 }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="data-card">
|
||||
<view class="total-item">
|
||||
<view class="item-title">团队分销商人数(人)</view>
|
||||
<view class="total-num">{{ agentInfo?.child_agent_count_all || 0 }}</view>
|
||||
</view>
|
||||
<view class="category-item ss-flex">
|
||||
<view class="ss-flex-1">
|
||||
<view class="item-title">一级分销商</view>
|
||||
<view class="category-num">{{ agentInfo?.child_agent_count_1 || 0 }}</view>
|
||||
</view>
|
||||
<view class="ss-flex-1">
|
||||
<view class="item-title">二级分销商</view>
|
||||
<view class="category-num">{{ agentInfo?.child_agent_count_2 || 0 }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="list-box">
|
||||
<uni-list :border="false">
|
||||
<uni-list-chat v-for="item in state.pagination.data" :key="item.id" :avatar-circle="true"
|
||||
:title="item.nickname" :avatar="sheep.$url.cdn(item.avatar)"
|
||||
:note="filterUserNum(item.agent?.child_user_count_1)">
|
||||
<view class="chat-custom-right">
|
||||
<view v-if="item.avatar" class="tag-box ss-flex ss-col-center">
|
||||
<image class="tag-img" :src="sheep.$url.cdn(item.avatar)" mode="aspectFill">
|
||||
</image>
|
||||
<text class="tag-title">{{ item.nickname }}</text>
|
||||
</view>
|
||||
<text
|
||||
class="time-text">{{ sheep.$helper.timeFormat(item.brokerageTime, 'yyyy-mm-dd hh:MM:ss') }}</text>
|
||||
</view>
|
||||
</uni-list-chat>
|
||||
</uni-list>
|
||||
</view>
|
||||
<s-empty v-if="state.pagination.total === 0" icon="/static/data-empty.png" text="暂无团队信息">
|
||||
</s-empty> -->
|
||||
</s-layout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import sheep from '@/sheep';
|
||||
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
||||
import { computed, reactive, ref } from 'vue';
|
||||
import _ from 'lodash-es';
|
||||
import { onPageScroll } from '@dcloudio/uni-app';
|
||||
import BrokerageApi from '@/sheep/api/trade/brokerage';
|
||||
import { fen2yuan } from '../../sheep/hooks/useGoods';
|
||||
|
||||
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
|
||||
// const agentInfo = computed(() => sheep.$store('user').agentInfo);
|
||||
const userInfo = computed(() => sheep.$store('user').userInfo);
|
||||
const headerBg = sheep.$url.css('/static/img/shop/user/withdraw_bg.png');
|
||||
|
||||
onPageScroll((e) => {
|
||||
state.scrollTop = e.scrollTop <= 100;
|
||||
});
|
||||
|
||||
let sort = ref();
|
||||
const state = reactive({
|
||||
summary: {},
|
||||
pagination: {
|
||||
pageNo: 1,
|
||||
pageSize: 8,
|
||||
list: [],
|
||||
total: 0,
|
||||
},
|
||||
loadStatus: '',
|
||||
// ↓ 新 ui 逻辑
|
||||
level: 1,
|
||||
nickname: ref(''),
|
||||
sortKey: '',
|
||||
isAsc: '',
|
||||
});
|
||||
|
||||
function filterUserNum(num) {
|
||||
if (_.isNil(num)) {
|
||||
return '';
|
||||
}
|
||||
return `下级团队${num}人`;
|
||||
}
|
||||
|
||||
function submitForm() {
|
||||
state.pagination.list = [];
|
||||
getTeamList();
|
||||
}
|
||||
|
||||
async function getTeamList() {
|
||||
state.loadStatus = 'loading';
|
||||
let { code, data } = await BrokerageApi.getBrokerageUserChildSummaryPage({
|
||||
pageNo: state.pagination.pageNo,
|
||||
pageSize: state.pagination.pageSize,
|
||||
level: state.level,
|
||||
'sortingField.order': state.isAsc,
|
||||
'sortingField.field': state.sortKey,
|
||||
nickname: state.nickname,
|
||||
});
|
||||
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';
|
||||
}
|
||||
|
||||
function setType(e) {
|
||||
state.pagination.list = [];
|
||||
state.level = e + '';
|
||||
getTeamList();
|
||||
}
|
||||
|
||||
function setSort(sortKey, isAsc) {
|
||||
state.pagination.list = [];
|
||||
sort = sortKey + isAsc.toUpperCase();
|
||||
state.isAsc = isAsc;
|
||||
state.sortKey = sortKey;
|
||||
getTeamList();
|
||||
}
|
||||
|
||||
onLoad(async () => {
|
||||
await getTeamList();
|
||||
// 概要数据
|
||||
let { data } = await BrokerageApi.getBrokerageUserSummary();
|
||||
state.summary = data;
|
||||
});
|
||||
|
||||
// 加载更多
|
||||
function loadMore() {
|
||||
if (state.loadStatus === 'noMore') {
|
||||
return;
|
||||
}
|
||||
state.pagination.pageNo++;
|
||||
getTeamList();
|
||||
}
|
||||
|
||||
// 上拉加载更多
|
||||
onReachBottom(() => {
|
||||
loadMore();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.l1 {
|
||||
background-color: #fff;
|
||||
height: 86rpx;
|
||||
line-height: 86rpx;
|
||||
font-size: 28rpx;
|
||||
color: #282828;
|
||||
border-bottom: 1rpx solid #eee;
|
||||
border-top-left-radius: 14rpx;
|
||||
border-top-right-radius: 14rpx;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.header-box {
|
||||
box-sizing: border-box;
|
||||
padding: 0 20rpx 20rpx 20rpx;
|
||||
width: 750rpx;
|
||||
z-index: 3;
|
||||
position: relative;
|
||||
background: v-bind(headerBg) no-repeat,
|
||||
linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
|
||||
background-size: 750rpx 100%;
|
||||
|
||||
// 团队信息总览
|
||||
.team-data-box {
|
||||
.data-card {
|
||||
width: 305rpx;
|
||||
background: #ffffff;
|
||||
border-radius: 20rpx;
|
||||
padding: 20rpx;
|
||||
|
||||
.item-title {
|
||||
font-size: 22rpx;
|
||||
font-weight: 500;
|
||||
color: #999999;
|
||||
line-height: 30rpx;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.total-item {
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.total-num {
|
||||
font-size: 38rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
font-family: OPPOSANS;
|
||||
}
|
||||
|
||||
.category-num {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
font-family: OPPOSANS;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.list-box {
|
||||
z-index: 3;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.chat-custom-right {
|
||||
.time-text {
|
||||
font-size: 22rpx;
|
||||
font-weight: 400;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.tag-box {
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
border-radius: 21rpx;
|
||||
line-height: 30rpx;
|
||||
padding: 5rpx 10rpx;
|
||||
width: 140rpx;
|
||||
|
||||
.tag-img {
|
||||
width: 34rpx;
|
||||
height: 34rpx;
|
||||
margin-right: 6rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.tag-title {
|
||||
font-size: 18rpx;
|
||||
font-weight: 500;
|
||||
color: rgba(255, 255, 255, 1);
|
||||
line-height: 20rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 推荐人
|
||||
.referrer-box {
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
padding: 20rpx;
|
||||
|
||||
.referrer-avatar {
|
||||
width: 34rpx;
|
||||
height: 34rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
.promoter-list .nav {
|
||||
background-color: #fff;
|
||||
height: 86rpx;
|
||||
line-height: 86rpx;
|
||||
font-size: 28rpx;
|
||||
color: #282828;
|
||||
border-bottom: 1rpx solid #eee;
|
||||
border-top-left-radius: 14rpx;
|
||||
border-top-right-radius: 14rpx;
|
||||
margin-top: -30rpx;
|
||||
}
|
||||
|
||||
.promoter-list .nav .item.on {
|
||||
border-bottom: 5rpx solid;
|
||||
// $theme-color
|
||||
color: var(--ui-BG-Main);
|
||||
// $theme-color
|
||||
}
|
||||
|
||||
.promoter-list .search {
|
||||
width: 100%;
|
||||
background-color: #fff;
|
||||
height: 100rpx;
|
||||
padding: 0 24rpx;
|
||||
box-sizing: border-box;
|
||||
border-bottom-left-radius: 14rpx;
|
||||
border-bottom-right-radius: 14rpx;
|
||||
}
|
||||
|
||||
.promoter-list .search .input {
|
||||
width: 592rpx;
|
||||
height: 60rpx;
|
||||
border-radius: 50rpx;
|
||||
background-color: #f5f5f5;
|
||||
text-align: center;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.promoter-list .search .input input {
|
||||
height: 100%;
|
||||
font-size: 26rpx;
|
||||
width: 610rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.promoter-list .search .input .placeholder {
|
||||
color: #bbb;
|
||||
}
|
||||
|
||||
.promoter-list .search .input .iconfont {
|
||||
position: absolute;
|
||||
right: 28rpx;
|
||||
color: #999;
|
||||
font-size: 28rpx;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
|
||||
.promoter-list .search .iconfont {
|
||||
font-size: 32rpx;
|
||||
color: #515151;
|
||||
height: 60rpx;
|
||||
line-height: 60rpx;
|
||||
}
|
||||
|
||||
.promoter-list .list {
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
.promoter-list .list .sortNav {
|
||||
background-color: #fff;
|
||||
height: 76rpx;
|
||||
border-bottom: 1rpx solid #eee;
|
||||
color: #333;
|
||||
font-size: 28rpx;
|
||||
border-top-left-radius: 14rpx;
|
||||
border-top-right-radius: 14rpx;
|
||||
}
|
||||
|
||||
.promoter-list .list .sortNav .sortItem {
|
||||
text-align: center;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.promoter-list .list .sortNav .sortItem image {
|
||||
width: 24rpx;
|
||||
height: 24rpx;
|
||||
margin-left: 6rpx;
|
||||
vertical-align: -3rpx;
|
||||
}
|
||||
|
||||
.promoter-list .list .item {
|
||||
background-color: #fff;
|
||||
border-bottom: 1rpx solid #eee;
|
||||
height: 152rpx;
|
||||
padding: 0 24rpx;
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.promoter-list .list .item .picTxt .pictrue {
|
||||
width: 106rpx;
|
||||
height: 106rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.promoter-list .list .item .picTxt .pictrue image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 50%;
|
||||
border: 3rpx solid #fff;
|
||||
box-shadow: 0 0 10rpx #aaa;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.promoter-list .list .item .picTxt .text {
|
||||
// width: 304rpx;
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
margin-left: 14rpx;
|
||||
}
|
||||
|
||||
.promoter-list .list .item .picTxt .text .name {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
margin-bottom: 13rpx;
|
||||
}
|
||||
|
||||
.promoter-list .list .item .right {
|
||||
text-align: right;
|
||||
font-size: 22rpx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.promoter-list .list .item .right .num {
|
||||
margin-right: 7rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,644 @@
|
||||
<!-- 分销 - 佣金明细 -->
|
||||
<template>
|
||||
<s-layout class="wallet-wrap" title="佣金">
|
||||
<!-- 钱包卡片 -->
|
||||
<view class="header-box ss-flex ss-row-center ss-col-center">
|
||||
<view class="card-box ui-BG-Main ui-Shadow-Main">
|
||||
<view class="card-head ss-flex ss-col-center">
|
||||
<view class="card-title ss-m-r-10">当前佣金(元)</view>
|
||||
<view
|
||||
@tap="state.showMoney = !state.showMoney"
|
||||
class="ss-eye-icon"
|
||||
:class="state.showMoney ? 'cicon-eye' : 'cicon-eye-off'"
|
||||
/>
|
||||
</view>
|
||||
<view class="ss-flex ss-row-between ss-col-center ss-m-t-30">
|
||||
<view class="money-num">{{
|
||||
state.showMoney ? fen2yuan(state.summary.withdrawPrice || 0) : '*****'
|
||||
}}</view>
|
||||
<view class="ss-flex">
|
||||
<view class="ss-m-r-20">
|
||||
<button
|
||||
class="ss-reset-button withdraw-btn"
|
||||
@tap="sheep.$router.go('/pages/commission/withdraw')"
|
||||
>
|
||||
提现
|
||||
</button>
|
||||
</view>
|
||||
<button class="ss-reset-button balance-btn ss-m-l-20" @tap="state.showModal = true">
|
||||
转余额
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="ss-flex">
|
||||
<view class="loading-money">
|
||||
<view class="loading-money-title">冻结佣金</view>
|
||||
<view class="loading-money-num">
|
||||
{{ state.showMoney ? fen2yuan(state.summary.frozenPrice || 0) : '*****' }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="loading-money ss-m-l-100">
|
||||
<view class="loading-money-title">可提现佣金</view>
|
||||
<view class="loading-money-num">
|
||||
{{ state.showMoney ? fen2yuan(state.summary.brokeragePrice || 0) : '*****' }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<su-sticky>
|
||||
<!-- 统计 -->
|
||||
<view class="filter-box ss-p-x-30 ss-flex ss-col-center ss-row-between">
|
||||
<uni-datetime-picker
|
||||
v-model="state.date"
|
||||
type="daterange"
|
||||
@change="onChangeTime"
|
||||
:end="state.today"
|
||||
>
|
||||
<button class="ss-reset-button date-btn">
|
||||
<text>{{ dateFilterText }}</text>
|
||||
<text class="cicon-drop-down ss-seldate-icon" />
|
||||
</button>
|
||||
</uni-datetime-picker>
|
||||
|
||||
<view class="total-box">
|
||||
<!-- TODO 芋艿:【钱包-可优化】这里暂时不考虑做 -->
|
||||
<!-- <view class="ss-m-b-10">总收入¥{{ state.pagination.income.toFixed(2) }}</view> -->
|
||||
<!-- <view>总支出¥{{ (-state.pagination.expense).toFixed(2) }}</view> -->
|
||||
</view>
|
||||
</view>
|
||||
<su-tabs
|
||||
:list="tabMaps"
|
||||
@change="onChangeTab"
|
||||
:scrollable="false"
|
||||
:current="state.currentTab"
|
||||
/>
|
||||
</su-sticky>
|
||||
<s-empty
|
||||
v-if="state.pagination.total === 0"
|
||||
icon="/static/data-empty.png"
|
||||
text="暂无数据"
|
||||
></s-empty>
|
||||
|
||||
<!-- 转余额弹框 -->
|
||||
<su-popup
|
||||
:show="state.showModal"
|
||||
type="bottom"
|
||||
round="20"
|
||||
@close="state.showModal = false"
|
||||
showClose
|
||||
>
|
||||
<view class="ss-p-x-20 ss-p-y-30">
|
||||
<view class="model-title ss-m-b-30 ss-m-l-20">转余额</view>
|
||||
<view class="model-subtitle ss-m-b-100 ss-m-l-20">将您的佣金转到余额中继续消费</view>
|
||||
<view class="input-box ss-flex ss-col-center border-bottom ss-m-b-70 ss-m-x-20">
|
||||
<view class="unit">¥</view>
|
||||
<uni-easyinput
|
||||
:inputBorder="false"
|
||||
class="ss-flex-1 ss-p-l-10"
|
||||
v-model="state.price"
|
||||
type="number"
|
||||
placeholder="请输入金额"
|
||||
/>
|
||||
</view>
|
||||
<button
|
||||
class="ss-reset-button model-btn ui-BG-Main-Gradient ui-Shadow-Main"
|
||||
@tap="onConfirm"
|
||||
>
|
||||
确定
|
||||
</button>
|
||||
</view>
|
||||
</su-popup>
|
||||
|
||||
<!-- 钱包记录 -->
|
||||
<view v-if="state.pagination.total > 0">
|
||||
<!-- 分佣列表 -->
|
||||
<view v-if="state.currentTab === 0">
|
||||
<view
|
||||
class="wallet-list ss-flex border-bottom"
|
||||
v-for="item in state.pagination.list"
|
||||
:key="item.id"
|
||||
>
|
||||
<view class="list-content">
|
||||
<view class="title-box ss-flex ss-row-between ss-m-b-20">
|
||||
<text class="title ss-line-1">{{ item.title }}</text>
|
||||
<view class="money">
|
||||
<text v-if="item.price >= 0" class="add">+{{ fen2yuan(item.price) }}</text>
|
||||
<text v-else class="minus">{{ fen2yuan(item.price) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="ss-flex ss-row-between ss-col-center">
|
||||
<text class="time">
|
||||
{{ sheep.$helper.timeFormat(item.createTime, 'yyyy-mm-dd hh:MM:ss') }}
|
||||
</text>
|
||||
<view class="ss-flex ss-col-center">
|
||||
<text class="status" :class="'status-' + item.status">{{ item.statusName }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 提现列表 -->
|
||||
<view v-else>
|
||||
<view
|
||||
class="wallet-list ss-flex border-bottom"
|
||||
v-for="item in state.pagination.list"
|
||||
:key="item.id"
|
||||
>
|
||||
<view class="list-content">
|
||||
<view class="title-box ss-flex ss-row-between ss-m-b-20">
|
||||
<text class="title ss-line-1">{{ item.typeName }}</text>
|
||||
<view class="money">
|
||||
<text class="minus">{{ fen2yuan(item.price) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="ss-flex ss-row-between ss-col-center">
|
||||
<text class="time">
|
||||
{{ sheep.$helper.timeFormat(item.createTime, 'yyyy-mm-dd hh:MM:ss') }}
|
||||
</text>
|
||||
<button
|
||||
v-if="item.status === 10 && item.type === 5 && item.payTransferId > 0"
|
||||
class="ss-reset-button confirm-btn ss-m-l-20"
|
||||
@tap="onRequestMerchantTransfer(item)"
|
||||
>
|
||||
确认收款
|
||||
</button>
|
||||
<text v-else class="status" :class="'status-' + item.status">{{
|
||||
item.statusName
|
||||
}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- <u-gap></u-gap> -->
|
||||
<uni-load-more
|
||||
v-if="state.pagination.total > 0"
|
||||
:status="state.loadStatus"
|
||||
:content-text="{
|
||||
contentdown: '上拉加载更多',
|
||||
}"
|
||||
/>
|
||||
</s-layout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, reactive } from 'vue';
|
||||
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
||||
import sheep from '@/sheep';
|
||||
import dayjs from 'dayjs';
|
||||
import _ from 'lodash-es';
|
||||
import BrokerageApi from '@/sheep/api/trade/brokerage';
|
||||
import { fen2yuan } from '@/sheep/hooks/useGoods';
|
||||
import { resetPagination } from '@/sheep/helper/utils';
|
||||
import PayTransferApi from '@/sheep/api/pay/transfer';
|
||||
|
||||
const headerBg = sheep.$url.css('/static/img/shop/user/wallet_card_bg.png');
|
||||
|
||||
const state = reactive({
|
||||
showMoney: false,
|
||||
summary: {}, // 分销信息
|
||||
|
||||
today: '',
|
||||
date: [],
|
||||
currentTab: 0,
|
||||
pagination: {
|
||||
list: [],
|
||||
total: 0,
|
||||
pageNo: 1,
|
||||
pageSize: 8,
|
||||
},
|
||||
loadStatus: '',
|
||||
|
||||
price: undefined,
|
||||
showModal: false,
|
||||
});
|
||||
|
||||
const tabMaps = [
|
||||
{
|
||||
name: '分佣',
|
||||
value: '1',
|
||||
},
|
||||
{
|
||||
name: '提现',
|
||||
value: '2',
|
||||
},
|
||||
];
|
||||
|
||||
const dateFilterText = computed(() => {
|
||||
if (state.date[0] === state.date[1]) {
|
||||
return state.date[0];
|
||||
} else {
|
||||
return state.date.join('~');
|
||||
}
|
||||
});
|
||||
|
||||
async function getLogList() {
|
||||
state.loadStatus = 'loading';
|
||||
let { code, data } = await (state.currentTab === 0
|
||||
? BrokerageApi.getBrokerageRecordPage({
|
||||
pageSize: state.pagination.pageSize,
|
||||
pageNo: state.pagination.pageNo,
|
||||
'createTime[0]': state.date[0] + ' 00:00:00',
|
||||
'createTime[1]': state.date[1] + ' 23:59:59',
|
||||
})
|
||||
: BrokerageApi.getBrokerageWithdrawPage({
|
||||
pageSize: state.pagination.pageSize,
|
||||
pageNo: state.pagination.pageNo,
|
||||
'createTime[0]': state.date[0] + ' 00:00:00',
|
||||
'createTime[1]': state.date[1] + ' 23:59:59',
|
||||
}));
|
||||
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';
|
||||
}
|
||||
|
||||
function onChangeTab(e) {
|
||||
resetPagination(state.pagination);
|
||||
state.currentTab = e.index;
|
||||
getLogList();
|
||||
}
|
||||
|
||||
function onChangeTime(e) {
|
||||
state.date[0] = e[0];
|
||||
state.date[1] = e[e.length - 1];
|
||||
resetPagination(state.pagination);
|
||||
getLogList();
|
||||
}
|
||||
|
||||
// 确认操作(转账到余额)
|
||||
async function onConfirm() {
|
||||
if (state.price <= 0) {
|
||||
sheep.$helper.toast('请输入正确的金额');
|
||||
return;
|
||||
}
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确认把您的佣金转入到余额钱包中?',
|
||||
confirmColor: '#FA7E31',
|
||||
success: async function (res) {
|
||||
if (!res.confirm) {
|
||||
return;
|
||||
}
|
||||
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() {
|
||||
const { code, data } = await BrokerageApi.getBrokerageUserSummary();
|
||||
if (code !== 0) {
|
||||
return;
|
||||
}
|
||||
state.summary = data;
|
||||
}
|
||||
|
||||
// 微信场景下:用户确认收款
|
||||
// 可见 https://pay.weixin.qq.com/doc/v3/merchant/4012716430 文档
|
||||
async function onRequestMerchantTransfer(item) {
|
||||
const requestMerchantTransfer = sheep.$platform.useProvider()
|
||||
? sheep.$platform.useProvider().requestMerchantTransfer
|
||||
: undefined;
|
||||
if (!requestMerchantTransfer) {
|
||||
sheep.$helper.toast('仅微信平台支持该功能');
|
||||
return;
|
||||
}
|
||||
// 获取提现详情
|
||||
const { code, data } = await BrokerageApi.getBrokerageWithdraw(item.id);
|
||||
if (code !== 0) {
|
||||
return;
|
||||
}
|
||||
if (data.status === 11) {
|
||||
sheep.$helper.toast('该提现单已确认收款');
|
||||
item.status = 11;
|
||||
return;
|
||||
}
|
||||
if (!data.transferChannelMchId || !data.transferChannelPackageInfo) {
|
||||
sheep.$helper.toast('提现信息异常,请稍后再试');
|
||||
return;
|
||||
}
|
||||
// 调用微信确认收款
|
||||
const payTransferId = data.payTransferId;
|
||||
await requestMerchantTransfer(
|
||||
data.transferChannelMchId,
|
||||
data.transferChannelPackageInfo,
|
||||
async (res) => {
|
||||
if (res.result !== 'success') {
|
||||
sheep.$helper.toast(res.errMsg);
|
||||
return;
|
||||
}
|
||||
// 同步转账单状态
|
||||
try {
|
||||
const syncTransferResult = await PayTransferApi.syncTransfer(payTransferId);
|
||||
console.log('syncTransferResult 结果', syncTransferResult);
|
||||
} catch (e) {
|
||||
console.error('syncTransferResult 异常', e);
|
||||
}
|
||||
// 查询提现单最新状态
|
||||
const { data } = await BrokerageApi.getBrokerageWithdraw(item.id);
|
||||
if (data && data.status !== 11) {
|
||||
sheep.$helper.toast('确认收款成功,但数据存在延迟,请以实际【微信支付】到账为准');
|
||||
return;
|
||||
}
|
||||
sheep.$helper.toast('确认收款成功');
|
||||
// 更新到列表中
|
||||
item.status = 11;
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
onLoad(async (options) => {
|
||||
state.today = dayjs().format('YYYY-MM-DD');
|
||||
state.date = [state.today, state.today];
|
||||
if (options.type === '2') {
|
||||
// 切换到"提现" tab 下
|
||||
state.currentTab = 1;
|
||||
}
|
||||
getLogList();
|
||||
getAgentInfo();
|
||||
});
|
||||
|
||||
onReachBottom(() => {
|
||||
if (state.loadStatus === 'noMore') {
|
||||
return;
|
||||
}
|
||||
state.pagination.pageNo++;
|
||||
getLogList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// 钱包
|
||||
.header-box {
|
||||
background-color: $white;
|
||||
padding: 30rpx;
|
||||
|
||||
.card-box {
|
||||
width: 100%;
|
||||
min-height: 300rpx;
|
||||
padding: 40rpx;
|
||||
background-size: 100% 100%;
|
||||
border-radius: 30rpx;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
box-sizing: border-box;
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 2;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
background: v-bind(headerBg) no-repeat;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.card-head {
|
||||
color: $white;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.ss-eye-icon {
|
||||
font-size: 40rpx;
|
||||
color: $white;
|
||||
}
|
||||
|
||||
.money-num {
|
||||
font-size: 40rpx;
|
||||
line-height: normal;
|
||||
font-weight: 500;
|
||||
color: $white;
|
||||
font-family: OPPOSANS;
|
||||
}
|
||||
|
||||
.reduce-num {
|
||||
font-size: 26rpx;
|
||||
font-weight: 400;
|
||||
color: $white;
|
||||
}
|
||||
|
||||
.withdraw-btn {
|
||||
width: 120rpx;
|
||||
height: 60rpx;
|
||||
line-height: 60rpx;
|
||||
border-radius: 30px;
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
background-color: $white;
|
||||
color: var(--ui-BG-Main);
|
||||
}
|
||||
|
||||
.balance-btn {
|
||||
width: 120rpx;
|
||||
height: 60rpx;
|
||||
line-height: 60rpx;
|
||||
border-radius: 30px;
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: $white;
|
||||
border: 1px solid $white;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.loading-money {
|
||||
margin-top: 56rpx;
|
||||
|
||||
.loading-money-title {
|
||||
font-size: 24rpx;
|
||||
font-weight: 400;
|
||||
color: #ffffff;
|
||||
line-height: normal;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.loading-money-num {
|
||||
font-size: 30rpx;
|
||||
font-family: OPPOSANS;
|
||||
font-weight: 500;
|
||||
color: #fefefe;
|
||||
}
|
||||
}
|
||||
|
||||
// 筛选
|
||||
|
||||
.filter-box {
|
||||
height: 120rpx;
|
||||
padding: 0 30rpx;
|
||||
background-color: $bg-page;
|
||||
|
||||
.total-box {
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: $dark-9;
|
||||
}
|
||||
|
||||
.date-btn {
|
||||
background-color: $white;
|
||||
line-height: 54rpx;
|
||||
border-radius: 27rpx;
|
||||
padding: 0 20rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: $dark-6;
|
||||
|
||||
.ss-seldate-icon {
|
||||
font-size: 50rpx;
|
||||
color: $dark-9;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// tab
|
||||
.wallet-tab-card {
|
||||
.tab-item {
|
||||
height: 80rpx;
|
||||
position: relative;
|
||||
|
||||
.tab-title {
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
.cur-tab-title {
|
||||
font-weight: $font-weight-bold;
|
||||
}
|
||||
|
||||
.tab-line {
|
||||
width: 60rpx;
|
||||
height: 6rpx;
|
||||
border-radius: 6rpx;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
bottom: 2rpx;
|
||||
background-color: var(--ui-BG-Main);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 钱包记录
|
||||
.wallet-list {
|
||||
padding: 30rpx;
|
||||
background-color: #ffff;
|
||||
|
||||
.head-img {
|
||||
width: 70rpx;
|
||||
height: 70rpx;
|
||||
border-radius: 50%;
|
||||
background: $gray-c;
|
||||
}
|
||||
|
||||
.list-content {
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
flex: 1;
|
||||
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
color: $dark-3;
|
||||
width: 400rpx;
|
||||
}
|
||||
|
||||
.time {
|
||||
color: $gray-c;
|
||||
font-size: 22rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.money {
|
||||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
font-family: OPPOSANS;
|
||||
|
||||
.add {
|
||||
color: var(--ui-BG-Main);
|
||||
}
|
||||
|
||||
.minus {
|
||||
color: $dark-3;
|
||||
}
|
||||
}
|
||||
|
||||
.confirm-btn {
|
||||
font-size: 22rpx;
|
||||
color: var(--ui-BG-Main);
|
||||
background: rgba(var(--ui-BG-Main-rgb), 0.1);
|
||||
padding: 4rpx 16rpx;
|
||||
margin: 0;
|
||||
line-height: 1.4;
|
||||
border-radius: 20rpx;
|
||||
border: 1px solid var(--ui-BG-Main);
|
||||
}
|
||||
}
|
||||
|
||||
.model-title {
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.model-subtitle {
|
||||
font-size: 26rpx;
|
||||
color: #c2c7cf;
|
||||
}
|
||||
|
||||
.model-btn {
|
||||
width: 100%;
|
||||
height: 80rpx;
|
||||
border-radius: 40rpx;
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.input-box {
|
||||
height: 100rpx;
|
||||
|
||||
.unit {
|
||||
font-size: 48rpx;
|
||||
color: #333;
|
||||
font-weight: 500;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.uni-easyinput__placeholder-class {
|
||||
font-size: 30rpx;
|
||||
height: 40rpx;
|
||||
line-height: normal;
|
||||
}
|
||||
}
|
||||
|
||||
.status {
|
||||
font-size: 22rpx;
|
||||
&.status-0 {
|
||||
color: #ff9900;
|
||||
}
|
||||
&.status-1 {
|
||||
color: #19be6b;
|
||||
}
|
||||
&.status-2 {
|
||||
color: #fa3534;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,487 @@
|
||||
<!-- 分佣提现 -->
|
||||
<template>
|
||||
<s-layout title="申请提现" class="withdraw-wrap" navbar="inner">
|
||||
<view class="page-bg"></view>
|
||||
<view
|
||||
class="wallet-num-box ss-flex ss-col-center ss-row-between"
|
||||
:style="[
|
||||
{
|
||||
marginTop: '-' + Number(statusBarHeight + 88) + 'rpx',
|
||||
paddingTop: Number(statusBarHeight + 108) + 'rpx',
|
||||
},
|
||||
]"
|
||||
>
|
||||
<view class="">
|
||||
<view class="num-title">可提现金额(元)</view>
|
||||
<view class="wallet-num">{{ fen2yuan(state.brokerageInfo.brokeragePrice) }}</view>
|
||||
</view>
|
||||
<button
|
||||
class="ss-reset-button log-btn"
|
||||
@tap="sheep.$router.go('/pages/commission/wallet', { type: 2 })"
|
||||
>
|
||||
提现记录
|
||||
</button>
|
||||
</view>
|
||||
<!-- 提现输入卡片-->
|
||||
<view class="draw-card">
|
||||
<view class="bank-box ss-flex ss-col-center ss-row-between ss-m-b-30">
|
||||
<view class="name">提现至</view>
|
||||
<view class="bank-list ss-flex ss-col-center" @tap="onAccountSelect(true)">
|
||||
<view v-if="!state.accountInfo.type" class="empty-text">请选择提现方式</view>
|
||||
<view v-if="state.accountInfo.type === '1'" class="empty-text">钱包余额</view>
|
||||
<view v-if="state.accountInfo.type === '2'" class="empty-text">银行卡转账</view>
|
||||
<view v-if="state.accountInfo.type === '3'" class="empty-text">微信账户</view>
|
||||
<view v-if="state.accountInfo.type === '4'" class="empty-text">支付宝账户</view>
|
||||
<view v-if="state.accountInfo.type === '5'" class="empty-text">微信零钱</view>
|
||||
<text class="cicon-forward" />
|
||||
</view>
|
||||
</view>
|
||||
<!-- 提现金额 -->
|
||||
<view class="card-title">提现金额</view>
|
||||
<view class="input-box ss-flex ss-col-center border-bottom">
|
||||
<view class="unit">¥</view>
|
||||
<uni-easyinput
|
||||
:inputBorder="false"
|
||||
class="ss-flex-1 ss-p-l-10"
|
||||
v-model="state.accountInfo.price"
|
||||
type="number"
|
||||
placeholder="请输入提现金额"
|
||||
/>
|
||||
</view>
|
||||
<!-- 提现账号 -->
|
||||
<view class="card-title" v-show="['2', '6'].includes(state.accountInfo.type)">
|
||||
提现账号
|
||||
</view>
|
||||
<view
|
||||
class="input-box ss-flex ss-col-center border-bottom"
|
||||
v-show="['2', '6'].includes(state.accountInfo.type)"
|
||||
>
|
||||
<view class="unit" />
|
||||
<uni-easyinput
|
||||
:inputBorder="false"
|
||||
class="ss-flex-1 ss-p-l-10"
|
||||
v-model="state.accountInfo.userAccount"
|
||||
placeholder="请输入提现账号"
|
||||
/>
|
||||
</view>
|
||||
<!-- 收款码 -->
|
||||
<view class="card-title" v-show="['3', '4'].includes(state.accountInfo.type)">收款码</view>
|
||||
<view
|
||||
class="input-box ss-flex ss-col-center"
|
||||
v-show="['3', '4'].includes(state.accountInfo.type)"
|
||||
>
|
||||
<view class="unit" />
|
||||
<view class="upload-img">
|
||||
<s-uploader
|
||||
v-model:url="state.accountInfo.qrCodeUrl"
|
||||
fileMediatype="image"
|
||||
limit="1"
|
||||
mode="grid"
|
||||
:imageStyles="{ width: '168rpx', height: '168rpx' }"
|
||||
@success="(payload) => (state.accountInfo.qrCodeUrl = payload.tempFilePaths[0])"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 持卡人姓名 -->
|
||||
<view class="card-title" v-show="['2', '5', '6'].includes(state.accountInfo.type)">
|
||||
收款真名
|
||||
</view>
|
||||
<view
|
||||
class="input-box ss-flex ss-col-center border-bottom"
|
||||
v-show="['2', '5', '6'].includes(state.accountInfo.type)"
|
||||
>
|
||||
<view class="unit" />
|
||||
<uni-easyinput
|
||||
:inputBorder="false"
|
||||
class="ss-flex-1 ss-p-l-10"
|
||||
v-model="state.accountInfo.userName"
|
||||
placeholder="请输入收款真名"
|
||||
/>
|
||||
</view>
|
||||
<!-- 提现银行 -->
|
||||
<view class="card-title" v-show="state.accountInfo.type === '2'">提现银行</view>
|
||||
<view
|
||||
class="input-box ss-flex ss-col-center border-bottom"
|
||||
v-show="state.accountInfo.type === '2'"
|
||||
>
|
||||
<view class="unit" />
|
||||
<!--银行改为下拉选择-->
|
||||
<picker
|
||||
@change="bankChange"
|
||||
:value="state.bankListSelectedIndex"
|
||||
:range="state.bankList"
|
||||
range-key="label"
|
||||
style="width: 100%"
|
||||
>
|
||||
<uni-easyinput
|
||||
:inputBorder="false"
|
||||
:value="state.accountInfo.bankName"
|
||||
placeholder="请选择银行"
|
||||
suffixIcon="right"
|
||||
disabled
|
||||
:styles="{ disableColor: '#fff', borderColor: '#fff', color: '#333!important' }"
|
||||
/>
|
||||
</picker>
|
||||
</view>
|
||||
<!-- 开户地址 -->
|
||||
<view class="card-title" v-show="state.accountInfo.type === '2'">开户地址</view>
|
||||
<view
|
||||
class="input-box ss-flex ss-col-center border-bottom"
|
||||
v-show="state.accountInfo.type === '2'"
|
||||
>
|
||||
<view class="unit" />
|
||||
<uni-easyinput
|
||||
:inputBorder="false"
|
||||
class="ss-flex-1 ss-p-l-10"
|
||||
v-model="state.accountInfo.bankAddress"
|
||||
placeholder="请输入开户地址"
|
||||
/>
|
||||
</view>
|
||||
<button class="ss-reset-button save-btn ui-BG-Main-Gradient ui-Shadow-Main" @tap="onConfirm">
|
||||
确认提现
|
||||
</button>
|
||||
</view>
|
||||
|
||||
<!-- 提现说明 -->
|
||||
<view class="draw-notice">
|
||||
<view class="title ss-m-b-30">提现说明</view>
|
||||
<view class="draw-list"> 最低提现金额 {{ fen2yuan(state.minPrice) }} 元 </view>
|
||||
<view class="draw-list">
|
||||
冻结佣金:<text>¥{{ fen2yuan(state.brokerageInfo.frozenPrice) }}</text>
|
||||
(每笔佣金的冻结期为 {{ state.frozenDays }} 天,到期后可提现)
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 选择提现账户 -->
|
||||
<account-type-select
|
||||
:show="state.accountSelect"
|
||||
@close="onAccountSelect(false)"
|
||||
round="10"
|
||||
v-model="state.accountInfo"
|
||||
:methods="state.withdrawTypes"
|
||||
/>
|
||||
</s-layout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onBeforeMount, reactive } from 'vue';
|
||||
import sheep from '@/sheep';
|
||||
import accountTypeSelect from './components/account-type-select.vue';
|
||||
import { fen2yuan } from '@/sheep/hooks/useGoods';
|
||||
import TradeConfigApi from '@/sheep/api/trade/config';
|
||||
import BrokerageApi from '@/sheep/api/trade/brokerage';
|
||||
import DictApi from '@/sheep/api/system/dict';
|
||||
import SLayout from '@/sheep/components/s-layout/s-layout.vue';
|
||||
import { getWeixinPayChannelCode, goBindWeixin } from '@/sheep/platform/pay';
|
||||
|
||||
const headerBg = sheep.$url.css('/static/img/shop/user/withdraw_bg.png');
|
||||
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
|
||||
|
||||
const state = reactive({
|
||||
accountInfo: {
|
||||
// 提现表单
|
||||
type: undefined,
|
||||
userAccount: undefined,
|
||||
userName: undefined,
|
||||
qrCodeUrl: undefined,
|
||||
bankName: undefined,
|
||||
bankAddress: undefined,
|
||||
},
|
||||
|
||||
accountSelect: false,
|
||||
|
||||
brokerageInfo: {}, // 分销信息
|
||||
|
||||
frozenDays: 0, // 冻结天数
|
||||
minPrice: 0, // 最低提现金额
|
||||
withdrawTypes: [], // 提现方式
|
||||
bankList: [], // 银行字典数据
|
||||
bankListSelectedIndex: '', // 选中银行 bankList 的 index
|
||||
});
|
||||
|
||||
// 打开提现方式的弹窗
|
||||
const onAccountSelect = (e) => {
|
||||
state.accountSelect = e;
|
||||
};
|
||||
|
||||
// 提交提现
|
||||
const onConfirm = async () => {
|
||||
// 参数校验
|
||||
if (
|
||||
!state.accountInfo.price ||
|
||||
state.accountInfo.price > state.brokerageInfo.price ||
|
||||
state.accountInfo.price <= 0
|
||||
) {
|
||||
sheep.$helper.toast('请输入正确的提现金额');
|
||||
return;
|
||||
}
|
||||
if (!state.accountInfo.type) {
|
||||
sheep.$helper.toast('请选择提现方式');
|
||||
return;
|
||||
}
|
||||
let openid;
|
||||
if (state.accountInfo.type === '5') {
|
||||
openid = await sheep.$platform.useProvider('wechat').getOpenid();
|
||||
// 如果获取不到 openid,微信无法发起支付,此时需要引导
|
||||
if (!openid) {
|
||||
goBindWeixin();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 提交请求
|
||||
const data = {
|
||||
...state.accountInfo,
|
||||
price: state.accountInfo.price * 100,
|
||||
};
|
||||
if (state.accountInfo.type === '5') {
|
||||
data.userAccount = openid;
|
||||
data.transferChannelCode = getWeixinPayChannelCode();
|
||||
} else if (state.accountInfo.type === '6' || state.accountInfo.type === '2') {
|
||||
delete data.transferChannelCode;
|
||||
} else {
|
||||
delete data.userAccount;
|
||||
delete data.transferChannelCode;
|
||||
}
|
||||
let { code } = await BrokerageApi.createBrokerageWithdraw(data);
|
||||
if (code !== 0) {
|
||||
return;
|
||||
}
|
||||
// 提示
|
||||
uni.showModal({
|
||||
title: '操作成功',
|
||||
content: '您的提现申请已成功提交',
|
||||
cancelText: '继续提现',
|
||||
confirmText: '查看记录',
|
||||
confirmColor: '#FA7E31',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
sheep.$router.go('/pages/commission/wallet', { type: 2 });
|
||||
return;
|
||||
}
|
||||
getBrokerageUser();
|
||||
state.accountInfo = {};
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
// 获得分销配置
|
||||
async function getWithdrawRules() {
|
||||
let { code, data } = await TradeConfigApi.getTradeConfig();
|
||||
if (code !== 0) {
|
||||
return;
|
||||
}
|
||||
if (data) {
|
||||
state.minPrice = data.brokerageWithdrawMinPrice || 0;
|
||||
state.frozenDays = data.brokerageFrozenDays || 0;
|
||||
state.withdrawTypes = data.brokerageWithdrawTypes;
|
||||
}
|
||||
}
|
||||
|
||||
// 获得分销信息
|
||||
async function getBrokerageUser() {
|
||||
const { data, code } = await BrokerageApi.getBrokerageUser();
|
||||
if (code === 0) {
|
||||
state.brokerageInfo = data;
|
||||
}
|
||||
}
|
||||
|
||||
// 获取提现银行配置字典
|
||||
async function getDictDataListByType() {
|
||||
let { code, data } = await DictApi.getDictDataListByType('brokerage_bank_name');
|
||||
if (code !== 0) {
|
||||
return;
|
||||
}
|
||||
if (data && data.length > 0) {
|
||||
state.bankList = data;
|
||||
}
|
||||
}
|
||||
|
||||
// 银行选择
|
||||
function bankChange(e) {
|
||||
const value = e.detail.value;
|
||||
state.bankListSelectedIndex = value;
|
||||
state.accountInfo.bankName = state.bankList[value].label;
|
||||
}
|
||||
|
||||
onBeforeMount(() => {
|
||||
getWithdrawRules();
|
||||
getBrokerageUser();
|
||||
getDictDataListByType(); //获取银行字典数据
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
:deep() {
|
||||
.uni-input-input {
|
||||
font-family: OPPOSANS !important;
|
||||
}
|
||||
}
|
||||
|
||||
.wallet-num-box {
|
||||
padding: 0 40rpx 80rpx;
|
||||
background: var(--ui-BG-Main) v-bind(headerBg) center/750rpx 100% no-repeat;
|
||||
border-radius: 0 0 5% 5%;
|
||||
|
||||
.num-title {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: $white;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.wallet-num {
|
||||
font-size: 60rpx;
|
||||
font-weight: 500;
|
||||
color: $white;
|
||||
font-family: OPPOSANS;
|
||||
}
|
||||
|
||||
.log-btn {
|
||||
width: 170rpx;
|
||||
height: 60rpx;
|
||||
line-height: 60rpx;
|
||||
border: 1rpx solid $white;
|
||||
border-radius: 30rpx;
|
||||
padding: 0;
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: $white;
|
||||
}
|
||||
}
|
||||
|
||||
// 提现输入卡片
|
||||
.draw-card {
|
||||
background-color: $white;
|
||||
border-radius: 20rpx;
|
||||
width: 690rpx;
|
||||
min-height: 560rpx;
|
||||
margin: -60rpx 30rpx 30rpx 30rpx;
|
||||
padding: 30rpx;
|
||||
position: relative;
|
||||
z-index: 3;
|
||||
box-sizing: border-box;
|
||||
|
||||
.card-title {
|
||||
font-size: 30rpx;
|
||||
font-weight: 500;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.bank-box {
|
||||
.name {
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.bank-list {
|
||||
.empty-text {
|
||||
font-size: 28rpx;
|
||||
font-weight: 400;
|
||||
color: $dark-9;
|
||||
}
|
||||
|
||||
.cicon-forward {
|
||||
color: $dark-9;
|
||||
}
|
||||
}
|
||||
|
||||
.input-box {
|
||||
width: 624rpx;
|
||||
height: 100rpx;
|
||||
margin-bottom: 40rpx;
|
||||
|
||||
.unit {
|
||||
font-size: 48rpx;
|
||||
color: #333;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.uni-easyinput__placeholder-class {
|
||||
font-size: 30rpx;
|
||||
height: 36rpx;
|
||||
}
|
||||
|
||||
:deep(.uni-easyinput__content-input) {
|
||||
font-size: 48rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.save-btn {
|
||||
width: 616rpx;
|
||||
height: 86rpx;
|
||||
line-height: 86rpx;
|
||||
border-radius: 40rpx;
|
||||
margin-top: 80rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.bind-box {
|
||||
.placeholder-text {
|
||||
font-size: 26rpx;
|
||||
color: $dark-9;
|
||||
}
|
||||
|
||||
.add-btn {
|
||||
width: 100rpx;
|
||||
height: 50rpx;
|
||||
border-radius: 25rpx;
|
||||
line-height: 50rpx;
|
||||
font-size: 22rpx;
|
||||
color: var(--ui-BG-Main);
|
||||
background-color: var(--ui-BG-Main-light);
|
||||
}
|
||||
}
|
||||
|
||||
.input-box {
|
||||
width: 624rpx;
|
||||
height: 100rpx;
|
||||
margin-bottom: 40rpx;
|
||||
|
||||
.unit {
|
||||
font-size: 48rpx;
|
||||
color: #333;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.uni-easyinput__placeholder-class {
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
:deep(.uni-easyinput__content-input) {
|
||||
font-size: 48rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.save-btn {
|
||||
width: 616rpx;
|
||||
height: 86rpx;
|
||||
line-height: 86rpx;
|
||||
border-radius: 40rpx;
|
||||
margin-top: 80rpx;
|
||||
}
|
||||
}
|
||||
|
||||
// 提现说明
|
||||
.draw-notice {
|
||||
width: 684rpx;
|
||||
background: #ffffff;
|
||||
border: 2rpx solid #fffaee;
|
||||
border-radius: 20rpx;
|
||||
margin: 20rpx 32rpx 0 32rpx;
|
||||
padding: 30rpx;
|
||||
box-sizing: border-box;
|
||||
|
||||
.title {
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
.draw-list {
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
line-height: 46rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,84 @@
|
||||
<template>
|
||||
<view class="content-container">
|
||||
<span
|
||||
v-for="(part, index) in formattedContent"
|
||||
:key="index"
|
||||
@click="handleClick(part)"
|
||||
:class="{ 'highlight-number': part.isNumber, 'phone-number': part.isPhone }"
|
||||
>
|
||||
{{ part.text }}
|
||||
</span>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'HighlightNumber',
|
||||
props: {
|
||||
content: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
formattedContent() {
|
||||
const phoneRegex = /(1[3-9]\d{9})/g;
|
||||
const numberRegex = /(\d+)/g;
|
||||
let text = this.content;
|
||||
let result = [];
|
||||
let match;
|
||||
|
||||
// Step 1: 提取手机号
|
||||
while ((match = phoneRegex.exec(text)) !== null) {
|
||||
if (match.index > 0) {
|
||||
const before = text.slice(0, match.index);
|
||||
result.push(...this.splitAndPush(before, false, false));
|
||||
}
|
||||
result.push({ text: match[0], isNumber: true, isPhone: true });
|
||||
text = text.slice(match.index + match[0].length);
|
||||
}
|
||||
|
||||
// Step 2: 提取普通数字
|
||||
while ((match = numberRegex.exec(text)) !== null) {
|
||||
if (match.index > 0) {
|
||||
const before = text.slice(0, match.index);
|
||||
result.push(...this.splitAndPush(before, false, false));
|
||||
}
|
||||
result.push({ text: match[0], isNumber: true });
|
||||
text = text.slice(match.index + match[0].length);
|
||||
}
|
||||
|
||||
// Step 3: 添加剩余文本
|
||||
if (text.length > 0) {
|
||||
result.push(...this.splitAndPush(text, false, false));
|
||||
}
|
||||
|
||||
return result;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
splitAndPush(str, isNumber = false, isPhone = false) {
|
||||
return str.split('').map((char) => ({ text: char, isNumber, isPhone }));
|
||||
},
|
||||
handleClick(part) {
|
||||
if (part.isPhone) {
|
||||
this.$emit('phone-click', { phoneNumber: part.text });
|
||||
} else if (part.isNumber) {
|
||||
this.$emit('number-click', { number: part.text });
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.highlight-number {
|
||||
color: #ff5722;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.phone-number {
|
||||
color: #007aff;
|
||||
text-decoration: underline;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,390 @@
|
||||
<!-- 优惠券详情 -->
|
||||
<template>
|
||||
<s-layout title="优惠券详情">
|
||||
<view class="bg-white">
|
||||
<!-- 详情卡片 -->
|
||||
<view class="detail-wrap ss-p-20">
|
||||
<view class="detail-box">
|
||||
<view class="tag-box ss-flex ss-col-center ss-row-center">
|
||||
<image
|
||||
class="tag-image"
|
||||
:src="sheep.$url.static('/static/img/shop/app/coupon_icon.png')"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
</view>
|
||||
<view class="top ss-flex-col ss-col-center">
|
||||
<view class="title ss-m-t-50 ss-m-b-20 ss-m-x-20">{{ state.coupon.name }}</view>
|
||||
<view class="subtitle ss-m-b-50">
|
||||
满 {{ fen2yuan(state.coupon.usePrice) }} 元,
|
||||
{{
|
||||
state.coupon.discountType === 1
|
||||
? '减 ' + fen2yuan(state.coupon.discountPrice) + ' 元'
|
||||
: '打 ' + state.coupon.discountPercent / 10.0 + ' 折'
|
||||
}}
|
||||
</view>
|
||||
<button
|
||||
class="ss-reset-button ss-m-b-30"
|
||||
:class="
|
||||
state.coupon.canTake || state.coupon.status === 1
|
||||
? 'use-btn' // 优惠劵模版(可领取)、优惠劵(可使用)
|
||||
: 'disable-btn'
|
||||
"
|
||||
:disabled="!state.coupon.canTake"
|
||||
@click="getCoupon"
|
||||
>
|
||||
<text v-if="state.id > 0">{{ state.coupon.canTake ? '立即领取' : '已领取' }}</text>
|
||||
<text v-else>
|
||||
{{
|
||||
state.coupon.status === 1
|
||||
? '可使用'
|
||||
: state.coupon.status === 2
|
||||
? '已使用'
|
||||
: '已过期'
|
||||
}}
|
||||
</text>
|
||||
</button>
|
||||
<view class="time ss-m-y-30" v-if="state.coupon.validityType === 2">
|
||||
有效期:领取后 {{ state.coupon.fixedEndTerm }} 天内可用
|
||||
</view>
|
||||
<view class="time ss-m-y-30" v-else>
|
||||
有效期: {{ sheep.$helper.timeFormat(state.coupon.validStartTime, 'yyyy-mm-dd') }} 至
|
||||
{{ sheep.$helper.timeFormat(state.coupon.validEndTime, 'yyyy-mm-dd') }}
|
||||
</view>
|
||||
<view class="coupon-line ss-m-t-14"></view>
|
||||
</view>
|
||||
<view class="bottom">
|
||||
<view class="type ss-flex ss-col-center ss-row-between ss-p-x-30">
|
||||
<view>优惠券类型</view>
|
||||
<view>{{ state.coupon.discountType === 1 ? '满减券' : '折扣券' }}</view>
|
||||
</view>
|
||||
<uni-collapse>
|
||||
<uni-collapse-item title="优惠券说明" v-if="state.coupon.description">
|
||||
<view class="content ss-p-b-20">
|
||||
<text class="des ss-p-l-30">{{ state.coupon.description }}</text>
|
||||
</view>
|
||||
</uni-collapse-item>
|
||||
</uni-collapse>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 适用商品 -->
|
||||
<view
|
||||
class="all-user ss-flex ss-row-center ss-col-center"
|
||||
v-if="state.coupon.productScope === 1"
|
||||
>
|
||||
全场通用
|
||||
</view>
|
||||
|
||||
<su-sticky v-else bgColor="#fff">
|
||||
<view class="goods-title ss-p-20">
|
||||
{{ state.coupon.productScope === 2 ? '指定商品可用' : '指定分类可用' }}
|
||||
</view>
|
||||
<su-tabs
|
||||
:scrollable="true"
|
||||
:list="state.tabMaps"
|
||||
@change="onTabsChange"
|
||||
:current="state.currentTab"
|
||||
v-if="state.coupon.productScope === 3"
|
||||
/>
|
||||
</su-sticky>
|
||||
<!-- 指定商品 -->
|
||||
<view v-if="state.coupon.productScope === 2">
|
||||
<view v-for="(item, index) in state.pagination.list" :key="index">
|
||||
<s-goods-column
|
||||
class="ss-m-20"
|
||||
size="lg"
|
||||
:data="item"
|
||||
@click="sheep.$router.go('/pages/goods/index', { id: item.id })"
|
||||
:goodsFields="{
|
||||
title: { show: true },
|
||||
subtitle: { show: true },
|
||||
price: { show: true },
|
||||
original_price: { show: true },
|
||||
sales: { show: true },
|
||||
stock: { show: false },
|
||||
}"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 指定分类 -->
|
||||
<view v-if="state.coupon.productScope === 3">
|
||||
<view v-for="(item, index) in state.pagination.list" :key="index">
|
||||
<s-goods-column
|
||||
class="ss-m-20"
|
||||
size="lg"
|
||||
:data="item"
|
||||
@click="sheep.$router.go('/pages/goods/index', { id: item.id })"
|
||||
:goodsFields="{
|
||||
title: { show: true },
|
||||
subtitle: { show: true },
|
||||
price: { show: true },
|
||||
original_price: { show: true },
|
||||
sales: { show: true },
|
||||
stock: { show: false },
|
||||
}"
|
||||
></s-goods-column>
|
||||
</view>
|
||||
</view>
|
||||
<uni-load-more
|
||||
v-if="state.pagination.total > 0 && state.coupon.productScope === 3"
|
||||
:status="state.loadStatus"
|
||||
:content-text="{
|
||||
contentdown: '上拉加载更多',
|
||||
}"
|
||||
@tap="loadMore"
|
||||
/>
|
||||
<s-empty
|
||||
v-if="state.coupon.productScope === 3 && state.pagination.total === 0"
|
||||
paddingTop="0"
|
||||
icon="/static/soldout-empty.png"
|
||||
text="暂无商品"
|
||||
/>
|
||||
</view>
|
||||
</s-layout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import sheep from '@/sheep';
|
||||
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
||||
import { reactive } from 'vue';
|
||||
import _ from 'lodash-es';
|
||||
import CouponApi from '@/sheep/api/promotion/coupon';
|
||||
import { fen2yuan } from '@/sheep/hooks/useGoods';
|
||||
import SpuApi from '@/sheep/api/product/spu';
|
||||
import CategoryApi from '@/sheep/api/product/category';
|
||||
import { resetPagination } from '@/sheep/helper/utils';
|
||||
|
||||
const state = reactive({
|
||||
id: 0, // 优惠劵模版编号 templateId
|
||||
couponId: 0, // 用户优惠劵编号 couponId
|
||||
coupon: {}, // 优惠劵信息
|
||||
|
||||
pagination: {
|
||||
list: [],
|
||||
total: 0,
|
||||
pageNo: 1,
|
||||
pageSize: 8,
|
||||
},
|
||||
categoryId: 0, // 选中的商品分类编号
|
||||
tabMaps: [], // 指定分类时,每个分类构成一个 tab
|
||||
currentTab: 0, // 选中的 tabMaps 下标
|
||||
loadStatus: '',
|
||||
});
|
||||
|
||||
function onTabsChange(e) {
|
||||
resetPagination(state.pagination);
|
||||
state.currentTab = e.index;
|
||||
state.categoryId = e.value;
|
||||
getGoodsListByCategory();
|
||||
}
|
||||
|
||||
async function getGoodsListByCategory() {
|
||||
state.loadStatus = 'loading';
|
||||
const { code, data } = await SpuApi.getSpuPage({
|
||||
categoryId: state.categoryId,
|
||||
pageNo: state.pagination.pageNo,
|
||||
pageSize: state.pagination.pageSize,
|
||||
});
|
||||
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';
|
||||
}
|
||||
|
||||
// 获得商品列表,指定商品范围
|
||||
async function getGoodsListById() {
|
||||
const { data, code } = await SpuApi.getSpuListByIds(state.coupon.productScopeValues.join(','));
|
||||
if (code !== 0) {
|
||||
return;
|
||||
}
|
||||
state.pagination.list = data;
|
||||
}
|
||||
|
||||
// 获得分类列表
|
||||
async function getCategoryList() {
|
||||
const { data, code } = await CategoryApi.getCategoryListByIds(
|
||||
state.coupon.productScopeValues.join(','),
|
||||
);
|
||||
if (code !== 0) {
|
||||
return;
|
||||
}
|
||||
state.tabMaps = data.map((category) => ({ name: category.name, value: category.id }));
|
||||
// 加载第一个分类的商品列表
|
||||
if (state.tabMaps.length > 0) {
|
||||
state.categoryId = state.tabMaps[0].value;
|
||||
await getGoodsListByCategory();
|
||||
}
|
||||
}
|
||||
|
||||
// 领取优惠劵
|
||||
async function getCoupon() {
|
||||
const { code } = await CouponApi.takeCoupon(state.id);
|
||||
if (code !== 0) {
|
||||
return;
|
||||
}
|
||||
uni.showToast({
|
||||
title: '领取成功',
|
||||
});
|
||||
setTimeout(() => {
|
||||
getCouponContent();
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
// 加载优惠劵信息
|
||||
async function getCouponContent() {
|
||||
const { code, data } =
|
||||
state.id > 0
|
||||
? await CouponApi.getCouponTemplate(state.id)
|
||||
: await CouponApi.getCoupon(state.couponId);
|
||||
if (code !== 0) {
|
||||
return;
|
||||
}
|
||||
state.coupon = data;
|
||||
// 不同指定范围,加载不同数据
|
||||
if (state.coupon.productScope === 2) {
|
||||
await getGoodsListById();
|
||||
} else if (state.coupon.productScope === 3) {
|
||||
await getCategoryList();
|
||||
}
|
||||
}
|
||||
|
||||
// 加载更多
|
||||
function loadMore() {
|
||||
if (state.loadStatus === 'noMore') {
|
||||
return;
|
||||
}
|
||||
state.pagination.pageNo++;
|
||||
getGoodsListByCategory();
|
||||
}
|
||||
|
||||
onLoad((options) => {
|
||||
state.id = options.id;
|
||||
state.couponId = options.couponId;
|
||||
getCouponContent(state.id, state.couponId);
|
||||
});
|
||||
|
||||
// 上拉加载更多
|
||||
onReachBottom(() => {
|
||||
loadMore();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.goods-title {
|
||||
font-size: 34rpx;
|
||||
font-weight: bold;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.detail-wrap {
|
||||
background: linear-gradient(
|
||||
180deg,
|
||||
var(--ui-BG-Main),
|
||||
var(--ui-BG-Main-gradient),
|
||||
var(--ui-BG-Main),
|
||||
#fff
|
||||
);
|
||||
}
|
||||
|
||||
.detail-box {
|
||||
// background-color: var(--ui-BG);
|
||||
border-radius: 6rpx;
|
||||
position: relative;
|
||||
margin-top: 100rpx;
|
||||
.tag-box {
|
||||
width: 140rpx;
|
||||
height: 140rpx;
|
||||
background: var(--ui-BG);
|
||||
border-radius: 50%;
|
||||
position: absolute;
|
||||
top: -70rpx;
|
||||
left: 50%;
|
||||
z-index: 6;
|
||||
transform: translateX(-50%);
|
||||
|
||||
.tag-image {
|
||||
width: 104rpx;
|
||||
height: 104rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
.top {
|
||||
background-color: #fff;
|
||||
border-radius: 20rpx 20rpx 0 0;
|
||||
-webkit-mask: radial-gradient(circle at 16rpx 100%, #0000 16rpx, red 0) -16rpx;
|
||||
padding: 110rpx 0 0 0;
|
||||
position: relative;
|
||||
z-index: 5;
|
||||
|
||||
.title {
|
||||
font-size: 40rpx;
|
||||
color: #333;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.use-btn {
|
||||
width: 386rpx;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
|
||||
border-radius: 40rpx;
|
||||
color: $white;
|
||||
}
|
||||
|
||||
.disable-btn {
|
||||
width: 386rpx;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
background: #e5e5e5;
|
||||
border-radius: 40rpx;
|
||||
color: $white;
|
||||
}
|
||||
|
||||
.time {
|
||||
font-size: 26rpx;
|
||||
font-weight: 400;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.coupon-line {
|
||||
width: 95%;
|
||||
border-bottom: 2rpx solid #eeeeee;
|
||||
}
|
||||
}
|
||||
|
||||
.bottom {
|
||||
background-color: #fff;
|
||||
border-radius: 0 0 20rpx 20rpx;
|
||||
-webkit-mask: radial-gradient(circle at 16rpx 0%, #0000 16rpx, red 0) -16rpx;
|
||||
padding: 40rpx 30rpx;
|
||||
|
||||
.type {
|
||||
height: 96rpx;
|
||||
border-bottom: 2rpx solid #eeeeee;
|
||||
}
|
||||
}
|
||||
|
||||
.des {
|
||||
font-size: 24rpx;
|
||||
font-weight: 400;
|
||||
color: #666666;
|
||||
}
|
||||
}
|
||||
|
||||
.all-user {
|
||||
width: 100%;
|
||||
height: 300rpx;
|
||||
font-size: 34rpx;
|
||||
font-weight: bold;
|
||||
color: #333333;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,222 @@
|
||||
<!-- 优惠券中心 -->
|
||||
<template>
|
||||
<s-layout :bgStyle="{ color: '#f2f2f2' }" title="优惠券">
|
||||
<su-sticky bgColor="#fff">
|
||||
<su-tabs
|
||||
:list="tabMaps"
|
||||
:scrollable="false"
|
||||
@change="onTabsChange"
|
||||
:current="state.currentTab"
|
||||
/>
|
||||
</su-sticky>
|
||||
<s-empty
|
||||
v-if="state.pagination.total === 0"
|
||||
icon="/static/coupon-empty.png"
|
||||
text="暂无优惠券"
|
||||
/>
|
||||
<!-- 情况一:领劵中心 -->
|
||||
<template v-if="state.currentTab === 0">
|
||||
<view v-for="item in state.pagination.list" :key="item.id">
|
||||
<s-coupon-list
|
||||
:data="item"
|
||||
@tap="sheep.$router.go('/pages/coupon/detail', { id: item.id })"
|
||||
>
|
||||
<template #default>
|
||||
<button
|
||||
class="ss-reset-button card-btn ss-flex ss-row-center ss-col-center"
|
||||
:class="!item.canTake ? 'border-btn' : ''"
|
||||
@click.stop="getBuy(item.id)"
|
||||
:disabled="!item.canTake"
|
||||
>
|
||||
{{ item.canTake ? '立即领取' : '已领取' }}
|
||||
</button>
|
||||
</template>
|
||||
</s-coupon-list>
|
||||
</view>
|
||||
</template>
|
||||
<!-- 情况二:我的优惠劵 -->
|
||||
<template v-else>
|
||||
<view v-for="item in state.pagination.list" :key="item.id">
|
||||
<s-coupon-list
|
||||
:data="item"
|
||||
type="user"
|
||||
@tap="sheep.$router.go('/pages/coupon/detail', { couponId: item.id })"
|
||||
>
|
||||
<template #default>
|
||||
<button
|
||||
class="ss-reset-button card-btn ss-flex ss-row-center ss-col-center"
|
||||
:class="item.status !== 1 ? 'disabled-btn' : ''"
|
||||
:disabled="item.status !== 1"
|
||||
@click.stop="sheep.$router.go('/pages/coupon/detail', { couponId: item.id })"
|
||||
>
|
||||
{{ item.status === 1 ? '立即使用' : item.status === 2 ? '已使用' : '已过期' }}
|
||||
</button>
|
||||
</template>
|
||||
</s-coupon-list>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<uni-load-more
|
||||
v-if="state.pagination.total > 0"
|
||||
:status="state.loadStatus"
|
||||
:content-text="{
|
||||
contentdown: '上拉加载更多',
|
||||
}"
|
||||
@tap="loadMore"
|
||||
/>
|
||||
</s-layout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import sheep from '@/sheep';
|
||||
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
||||
import { reactive } from 'vue';
|
||||
import _ from 'lodash-es';
|
||||
import { resetPagination } from '@/sheep/helper/utils';
|
||||
import CouponApi from '@/sheep/api/promotion/coupon';
|
||||
|
||||
// 数据
|
||||
const state = reactive({
|
||||
currentTab: 0, // 当前 tab
|
||||
type: '1',
|
||||
pagination: {
|
||||
list: [],
|
||||
total: 0,
|
||||
pageNo: 1,
|
||||
pageSize: 5,
|
||||
},
|
||||
loadStatus: '',
|
||||
});
|
||||
|
||||
const tabMaps = [
|
||||
{
|
||||
name: '领券中心',
|
||||
value: 'all',
|
||||
},
|
||||
{
|
||||
name: '已领取',
|
||||
value: '1',
|
||||
},
|
||||
{
|
||||
name: '已使用',
|
||||
value: '2',
|
||||
},
|
||||
{
|
||||
name: '已失效',
|
||||
value: '3',
|
||||
},
|
||||
];
|
||||
|
||||
function onTabsChange(e) {
|
||||
state.currentTab = e.index;
|
||||
state.type = e.value;
|
||||
resetPagination(state.pagination);
|
||||
if (state.currentTab === 0) {
|
||||
getData();
|
||||
} else {
|
||||
getCoupon();
|
||||
}
|
||||
}
|
||||
|
||||
// 获得优惠劵模版列表
|
||||
async function getData() {
|
||||
state.loadStatus = 'loading';
|
||||
const { data, code } = await CouponApi.getCouponTemplatePage({
|
||||
pageNo: state.pagination.pageNo,
|
||||
pageSize: state.pagination.pageSize,
|
||||
});
|
||||
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';
|
||||
}
|
||||
|
||||
// 获得我的优惠劵
|
||||
async function getCoupon() {
|
||||
state.loadStatus = 'loading';
|
||||
const { data, code } = await CouponApi.getCouponPage({
|
||||
pageNo: state.pagination.pageNo,
|
||||
pageSize: state.pagination.pageSize,
|
||||
status: state.type,
|
||||
});
|
||||
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';
|
||||
}
|
||||
|
||||
// 领取优惠劵
|
||||
async function getBuy(id) {
|
||||
const { code } = await CouponApi.takeCoupon(id);
|
||||
if (code !== 0) {
|
||||
return;
|
||||
}
|
||||
uni.showToast({
|
||||
title: '领取成功',
|
||||
});
|
||||
setTimeout(() => {
|
||||
resetPagination(state.pagination);
|
||||
getData();
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
// 加载更多
|
||||
function loadMore() {
|
||||
if (state.loadStatus === 'noMore') {
|
||||
return;
|
||||
}
|
||||
state.pagination.pageNo++;
|
||||
if (state.currentTab === 0) {
|
||||
getData();
|
||||
} else {
|
||||
getCoupon();
|
||||
}
|
||||
}
|
||||
|
||||
onLoad((Option) => {
|
||||
// 领劵中心
|
||||
if (Option.type === 'all' || !Option.type) {
|
||||
getData();
|
||||
// 我的优惠劵
|
||||
} else {
|
||||
Option.type === 'geted'
|
||||
? (state.currentTab = 1)
|
||||
: Option.type === 'used'
|
||||
? (state.currentTab = 2)
|
||||
: (state.currentTab = 3);
|
||||
state.type = state.currentTab;
|
||||
getCoupon();
|
||||
}
|
||||
});
|
||||
|
||||
onReachBottom(() => {
|
||||
loadMore();
|
||||
});
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.card-btn {
|
||||
// width: 144rpx;
|
||||
padding: 0 16rpx;
|
||||
height: 50rpx;
|
||||
border-radius: 40rpx;
|
||||
background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
|
||||
color: #ffffff;
|
||||
font-size: 24rpx;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.border-btn {
|
||||
background: linear-gradient(90deg, var(--ui-BG-Main-opacity-4), var(--ui-BG-Main-light));
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
.disabled-btn {
|
||||
background: #cccccc;
|
||||
background-color: #cccccc !important;
|
||||
color: #fff !important;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,190 @@
|
||||
<!-- 评价 -->
|
||||
<template>
|
||||
<s-layout title="评价">
|
||||
<view>
|
||||
<view v-for="(item, index) in state.orderInfo.items" :key="item.id">
|
||||
<view>
|
||||
<view class="commont-from-wrap">
|
||||
<!-- 评价商品 -->
|
||||
<s-goods-item
|
||||
:img="item.picUrl"
|
||||
:title="item.spuName"
|
||||
:skuText="item.properties.map((property) => property.valueName).join(' ')"
|
||||
:price="item.payPrice"
|
||||
:num="item.count"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<view class="form-item">
|
||||
<!-- 评分 -->
|
||||
<view class="star-box ss-flex ss-col-center">
|
||||
<view class="star-title ss-m-r-40">商品质量</view>
|
||||
<uni-rate v-model="state.commentList[index].descriptionScores" />
|
||||
</view>
|
||||
<view class="star-box ss-flex ss-col-center">
|
||||
<view class="star-title ss-m-r-40">服务态度</view>
|
||||
<uni-rate v-model="state.commentList[index].benefitScores" />
|
||||
</view>
|
||||
<!-- 评价 -->
|
||||
<view class="area-box">
|
||||
<uni-easyinput
|
||||
:inputBorder="false"
|
||||
type="textarea"
|
||||
maxlength="120"
|
||||
autoHeight
|
||||
v-model="state.commentList[index].content"
|
||||
placeholder="宝贝满足你的期待吗?说说你的使用心得,分享给想买的他们吧~"
|
||||
/>
|
||||
<view class="img-box">
|
||||
<s-uploader
|
||||
v-model:url="state.commentList[index].images"
|
||||
fileMediatype="image"
|
||||
limit="9"
|
||||
mode="grid"
|
||||
:imageStyles="{ width: '168rpx', height: '168rpx' }"
|
||||
@success="(payload) => uploadSuccess(payload, index)"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<view class="checkbox-container">
|
||||
<checkbox-group @change="(event) => toggleAnonymous(index, event)">
|
||||
<label>
|
||||
<checkbox value="anonymousChecked" />
|
||||
匿名评论
|
||||
</label>
|
||||
</checkbox-group>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<su-fixed bottom placeholder>
|
||||
<view class="foot_box ss-flex ss-row-center ss-col-center">
|
||||
<button class="ss-reset-button post-btn ui-BG-Main-Gradient ui-Shadow-Main" @tap="onSubmit">
|
||||
发布
|
||||
</button>
|
||||
</view>
|
||||
</su-fixed>
|
||||
</s-layout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import sheep from '@/sheep';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import { reactive } from 'vue';
|
||||
import OrderApi from '@/sheep/api/trade/order';
|
||||
|
||||
const state = reactive({
|
||||
orderInfo: {},
|
||||
commentList: [],
|
||||
id: null,
|
||||
});
|
||||
|
||||
/**
|
||||
* 切换是否匿名
|
||||
*
|
||||
* @param commentIndex 当前评论下标
|
||||
* @param event 复选框事件
|
||||
*/
|
||||
function toggleAnonymous(commentIndex, event) {
|
||||
state.commentList[commentIndex].anonymous = event.detail.value[0] === 'anonymousChecked';
|
||||
}
|
||||
|
||||
/**
|
||||
* 发布评论
|
||||
*
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async function onSubmit() {
|
||||
// 顺序提交评论
|
||||
for (const comment of state.commentList) {
|
||||
await OrderApi.createOrderItemComment(comment);
|
||||
}
|
||||
// 都评论好,返回
|
||||
sheep.$router.back();
|
||||
}
|
||||
|
||||
/**
|
||||
* 图片添加到表单
|
||||
*
|
||||
* @param payload 上传成功后的回调数据
|
||||
* @param commentIndex 当前评论的下标
|
||||
*/
|
||||
function uploadSuccess(payload, commentIndex) {
|
||||
state.commentList[commentIndex].picUrls = payload.tempFilePaths;
|
||||
}
|
||||
|
||||
onLoad(async (options) => {
|
||||
if (!options.id) {
|
||||
sheep.$helper.toast(`缺少订单信息,请检查`);
|
||||
return;
|
||||
}
|
||||
state.id = options.id;
|
||||
|
||||
const { code, data } = await OrderApi.getOrderDetail(state.id);
|
||||
if (code !== 0) {
|
||||
sheep.$helper.toast('无待评价订单');
|
||||
return;
|
||||
}
|
||||
// 处理评论
|
||||
data.items.forEach((item) => {
|
||||
state.commentList.push({
|
||||
anonymous: false,
|
||||
orderItemId: item.id,
|
||||
descriptionScores: 5,
|
||||
benefitScores: 5,
|
||||
content: '',
|
||||
picUrls: [],
|
||||
});
|
||||
});
|
||||
state.orderInfo = data;
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// 评价商品
|
||||
.goods-card {
|
||||
margin: 10rpx 0;
|
||||
padding: 20rpx;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
// 评论,选择图片
|
||||
.form-item {
|
||||
background: #fff;
|
||||
|
||||
.star-box {
|
||||
height: 100rpx;
|
||||
padding: 0 25rpx;
|
||||
}
|
||||
|
||||
.star-title {
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
|
||||
.area-box {
|
||||
width: 690rpx;
|
||||
min-height: 306rpx;
|
||||
background: rgba(249, 250, 251, 1);
|
||||
border-radius: 20rpx;
|
||||
padding: 28rpx;
|
||||
margin: auto;
|
||||
|
||||
.img-box {
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.checkbox-container {
|
||||
padding: 10rpx;
|
||||
}
|
||||
|
||||
.post-btn {
|
||||
width: 690rpx;
|
||||
line-height: 80rpx;
|
||||
border-radius: 40rpx;
|
||||
color: rgba(#fff, 0.9);
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,168 @@
|
||||
<!-- 商品评论的分页 -->
|
||||
<template>
|
||||
<s-layout title="全部评论">
|
||||
<su-tabs
|
||||
:list="state.type"
|
||||
:scrollable="false"
|
||||
@change="onTabsChange"
|
||||
:current="state.currentTab"
|
||||
/>
|
||||
<!-- 评论列表 -->
|
||||
<view class="ss-m-t-20">
|
||||
<view class="list-item" v-for="item in state.pagination.list" :key="item">
|
||||
<comment-item :item="item" />
|
||||
</view>
|
||||
</view>
|
||||
<s-empty v-if="state.pagination.total === 0" text="暂无数据" icon="/static/data-empty.png" />
|
||||
<!-- 下拉 -->
|
||||
<uni-load-more
|
||||
icon-type="auto"
|
||||
v-if="state.pagination.total > 0"
|
||||
:status="state.loadStatus"
|
||||
:content-text="{
|
||||
contentdown: '上拉加载更多',
|
||||
}"
|
||||
@tap="loadMore"
|
||||
/>
|
||||
</s-layout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import CommentApi from '@/sheep/api/product/comment';
|
||||
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
||||
import { reactive } from 'vue';
|
||||
import _ from 'lodash-es';
|
||||
import commentItem from '../components/detail/comment-item.vue';
|
||||
|
||||
const state = reactive({
|
||||
id: 0, // 商品 SPU 编号
|
||||
type: [
|
||||
{ type: 0, name: '全部' },
|
||||
{ type: 1, name: '好评' },
|
||||
{ type: 2, name: '中评' },
|
||||
{ type: 3, name: '差评' },
|
||||
],
|
||||
currentTab: 0, // 选中的 TAB
|
||||
loadStatus: '',
|
||||
pagination: {
|
||||
list: [],
|
||||
total: 0,
|
||||
pageNo: 1,
|
||||
pageSize: 8,
|
||||
},
|
||||
});
|
||||
|
||||
// 切换选项卡
|
||||
function onTabsChange(e) {
|
||||
state.currentTab = e.index;
|
||||
// 加载列表
|
||||
state.pagination.pageNo = 1;
|
||||
state.pagination.list = [];
|
||||
state.pagination.total = 0;
|
||||
getList();
|
||||
}
|
||||
|
||||
async function getList() {
|
||||
// 加载列表
|
||||
state.loadStatus = 'loading';
|
||||
let res = await CommentApi.getCommentPage(
|
||||
state.id,
|
||||
state.pagination.pageNo,
|
||||
state.pagination.pageSize,
|
||||
state.type[state.currentTab].type,
|
||||
);
|
||||
if (res.code !== 0) {
|
||||
return;
|
||||
}
|
||||
// 合并列表
|
||||
state.pagination.list = _.concat(state.pagination.list, res.data.list);
|
||||
state.pagination.total = res.data.total;
|
||||
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
||||
}
|
||||
|
||||
// 加载更多
|
||||
function loadMore() {
|
||||
if (state.loadStatus === 'noMore') {
|
||||
return;
|
||||
}
|
||||
state.pagination.pageNo++;
|
||||
getList();
|
||||
}
|
||||
|
||||
onLoad((options) => {
|
||||
state.id = options.id;
|
||||
getList();
|
||||
});
|
||||
|
||||
// 上拉加载更多
|
||||
onReachBottom(() => {
|
||||
loadMore();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.list-item {
|
||||
padding: 32rpx 30rpx 20rpx 20rpx;
|
||||
background: #fff;
|
||||
|
||||
.avatar {
|
||||
width: 52rpx;
|
||||
height: 52rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.nickname {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.create-time {
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: #c4c4c4;
|
||||
}
|
||||
|
||||
.content-title {
|
||||
font-size: 26rpx;
|
||||
font-weight: 400;
|
||||
color: #666666;
|
||||
line-height: 42rpx;
|
||||
}
|
||||
|
||||
.content-img {
|
||||
width: 174rpx;
|
||||
height: 174rpx;
|
||||
}
|
||||
|
||||
.cicon-info-o {
|
||||
font-size: 26rpx;
|
||||
color: #c4c4c4;
|
||||
}
|
||||
|
||||
.foot-title {
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: #999999;
|
||||
}
|
||||
}
|
||||
|
||||
.btn-box {
|
||||
width: 100%;
|
||||
height: 120rpx;
|
||||
background: #fff;
|
||||
border-top: 2rpx solid #eee;
|
||||
}
|
||||
|
||||
.tab-btn {
|
||||
width: 130rpx;
|
||||
height: 62rpx;
|
||||
background: #eeeeee;
|
||||
border-radius: 31rpx;
|
||||
font-size: 28rpx;
|
||||
font-weight: 400;
|
||||
color: #999999;
|
||||
border: 1px solid #e5e5e5;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,94 @@
|
||||
<!-- 商品评论项 -->
|
||||
<template>
|
||||
<view>
|
||||
<!-- 用户评论 -->
|
||||
<view class="user ss-flex ss-m-b-14">
|
||||
<view class="ss-m-r-20 ss-flex">
|
||||
<image class="avatar" :src="item.userAvatar"></image>
|
||||
</view>
|
||||
<view class="nickname ss-m-r-20">{{ item.userNickname }}</view>
|
||||
<view class="">
|
||||
<uni-rate :readonly="true" v-model="item.scores" size="18" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="content"> {{ item.content }} </view>
|
||||
<view class="ss-m-t-24" v-if="item.picUrls?.length">
|
||||
<scroll-view class="scroll-box" scroll-x scroll-anchoring>
|
||||
<view class="ss-flex">
|
||||
<view v-for="(picUrl, index) in item.picUrls" :key="picUrl" class="ss-m-r-10">
|
||||
<su-image
|
||||
class="content-img"
|
||||
isPreview
|
||||
:previewList="item.picUrls"
|
||||
:current="index"
|
||||
:src="picUrl"
|
||||
:height="120"
|
||||
:width="120"
|
||||
mode="aspectFill"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<!-- 商家回复 -->
|
||||
<view class="ss-m-t-20 reply-box" v-if="item.replyTime">
|
||||
<view class="reply-title">商家回复:</view>
|
||||
<view class="reply-content">{{ item.replyContent }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
item: {
|
||||
type: Object,
|
||||
default() {},
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.avatar {
|
||||
width: 52rpx;
|
||||
height: 52rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.nickname {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.content {
|
||||
width: 636rpx;
|
||||
font-size: 26rpx;
|
||||
font-weight: 400;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.reply-box {
|
||||
position: relative;
|
||||
background: #f8f8f8;
|
||||
border-radius: 8rpx;
|
||||
padding: 16rpx;
|
||||
}
|
||||
|
||||
.reply-title {
|
||||
position: absolute;
|
||||
left: 16rpx;
|
||||
top: 16rpx;
|
||||
font-weight: 400;
|
||||
font-size: 26rpx;
|
||||
line-height: 40rpx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.reply-content {
|
||||
text-indent: 128rpx;
|
||||
font-weight: 400;
|
||||
font-size: 26rpx;
|
||||
line-height: 40rpx;
|
||||
color: #333333;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,99 @@
|
||||
<template>
|
||||
<su-fixed bottom placeholder :val="44">
|
||||
<view>
|
||||
<view v-for="activity in props.activityList" :key="activity.id">
|
||||
<view
|
||||
class="activity-box ss-p-x-38 ss-flex ss-row-between ss-col-center"
|
||||
:class="activity.type === 1 ? 'seckill-box' : 'groupon-box'"
|
||||
>
|
||||
<view class="activity-title ss-flex">
|
||||
<view class="ss-m-r-16">
|
||||
<image
|
||||
v-if="activity.type === 1"
|
||||
:src="sheep.$url.static('/static/img/shop/goods/seckill-icon.png')"
|
||||
class="activity-icon"
|
||||
/>
|
||||
<image
|
||||
v-else-if="activity.type === 3"
|
||||
:src="sheep.$url.static('/static/img/shop/goods/groupon-icon.png')"
|
||||
class="activity-icon"
|
||||
/>
|
||||
</view>
|
||||
<view>该商品正在参与{{ activity.name }}活动</view>
|
||||
</view>
|
||||
<button class="ss-reset-button activity-go" @tap="onActivity(activity)"> GO </button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</su-fixed>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import sheep from '@/sheep';
|
||||
|
||||
const seckillBg = sheep.$url.css('/static/img/shop/goods/seckill-tip-bg.png');
|
||||
const grouponBg = sheep.$url.css('/static/img/shop/goods/groupon-tip-bg.png');
|
||||
|
||||
const props = defineProps({
|
||||
activityList: {
|
||||
type: Array,
|
||||
default() {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
function onActivity(activity) {
|
||||
const type = activity.type;
|
||||
const typePath = type === 1 ? 'seckill' : type === 3 ? 'groupon' : undefined;
|
||||
if (!typePath) {
|
||||
return;
|
||||
}
|
||||
sheep.$router.go(`/pages/goods/${typePath}`, {
|
||||
id: activity.id,
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.activity-box {
|
||||
width: 100%;
|
||||
height: 80rpx;
|
||||
box-sizing: border-box;
|
||||
margin-bottom: 10rpx;
|
||||
|
||||
.activity-title {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
line-height: 42rpx;
|
||||
|
||||
.activity-icon {
|
||||
width: 38rpx;
|
||||
height: 38rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.activity-go {
|
||||
width: 70rpx;
|
||||
height: 32rpx;
|
||||
background: #ffffff;
|
||||
border-radius: 16rpx;
|
||||
font-weight: 500;
|
||||
color: #ff6000;
|
||||
font-size: 24rpx;
|
||||
line-height: normal;
|
||||
}
|
||||
}
|
||||
|
||||
//秒杀卡片
|
||||
.seckill-box {
|
||||
background: v-bind(seckillBg) no-repeat;
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
|
||||
.groupon-box {
|
||||
background: v-bind(grouponBg) no-repeat;
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,35 @@
|
||||
<template>
|
||||
<!-- SKU 选择的提示框 -->
|
||||
<detail-cell label="选择" :value="value" :theme="props.theme" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
import detailCell from './detail-cell.vue';
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: Array,
|
||||
default() {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
sku: {
|
||||
type: Object,
|
||||
},
|
||||
theme: {
|
||||
type: String,
|
||||
default: '2',
|
||||
},
|
||||
});
|
||||
const value = computed(() => {
|
||||
if (!props.sku?.id) {
|
||||
return '请选择商品规格';
|
||||
}
|
||||
let str = '';
|
||||
props.sku.properties.forEach((property) => {
|
||||
str += property.propertyName + ':' + property.valueName + ' ';
|
||||
});
|
||||
return str;
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,64 @@
|
||||
<!-- 商品详情:cell 组件 -->
|
||||
<template>
|
||||
<view class="detail-cell-wrap ss-flex ss-col-center ss-row-between theme-ai" @tap="onClick">
|
||||
<view class="label-text" :class="{ c25: theme == '2' }">{{ label }}</view>
|
||||
<view class="cell-content ss-line-1 ss-flex-1">{{ value }}</view>
|
||||
<button class="ss-reset-button" v-if="props.label == '选择'">
|
||||
<text class="_icon-forward right-forwrad-icon"></text>
|
||||
</button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
/**
|
||||
* 详情 cell
|
||||
*
|
||||
*/
|
||||
const props = defineProps({
|
||||
label: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
value: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
theme: {
|
||||
type: String,
|
||||
default: '2',
|
||||
},
|
||||
});
|
||||
|
||||
const emits = defineEmits(['click']);
|
||||
|
||||
// 点击
|
||||
const onClick = () => {
|
||||
emits('click');
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.detail-cell-wrap {
|
||||
height: 90rpx;
|
||||
padding: 0 32rpx;
|
||||
// min-height: 60rpx;
|
||||
|
||||
.label-text {
|
||||
font-size: 28rpx;
|
||||
color: $dark-9;
|
||||
margin-right: 38rpx;
|
||||
}
|
||||
|
||||
.cell-content {
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: $dark-6;
|
||||
}
|
||||
|
||||
.right-forwrad-icon {
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: #383838;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,106 @@
|
||||
<!-- 商品评论的卡片 -->
|
||||
<template>
|
||||
<view class="detail-comment-card bg-white">
|
||||
<view class="card-header ss-flex ss-col-center ss-row-between ss-p-b-30">
|
||||
<view class="ss-flex ss-col-center">
|
||||
<view class="line"></view>
|
||||
<view class="title ss-m-l-20 ss-m-r-10">评价</view>
|
||||
<view class="des">({{ state.total }})</view>
|
||||
</view>
|
||||
<view
|
||||
class="ss-flex ss-col-center"
|
||||
@tap="sheep.$router.go('/pages/goods/comment/list', { id: goodsId })"
|
||||
v-if="state.commentList.length > 0"
|
||||
>
|
||||
<button class="ss-reset-button more-btn">查看全部</button>
|
||||
<text class="cicon-forward" />
|
||||
</view>
|
||||
</view>
|
||||
<!-- 评论列表 -->
|
||||
<view class="card-content">
|
||||
<view class="comment-box ss-p-y-30" v-for="item in state.commentList" :key="item.id">
|
||||
<comment-item :item="item" />
|
||||
</view>
|
||||
<s-empty
|
||||
v-if="state.commentList.length === 0"
|
||||
paddingTop="0"
|
||||
icon="/static/comment-empty.png"
|
||||
text="期待您的第一个评价"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, onBeforeMount } from 'vue';
|
||||
import sheep from '@/sheep';
|
||||
import CommentApi from '@/sheep/api/product/comment';
|
||||
import commentItem from './comment-item.vue';
|
||||
|
||||
const props = defineProps({
|
||||
goodsId: {
|
||||
type: [Number, String],
|
||||
default: 0,
|
||||
},
|
||||
});
|
||||
|
||||
const state = reactive({
|
||||
commentList: [], // 评论列表,只展示最近的 3 条
|
||||
total: 0, // 总评论数
|
||||
});
|
||||
|
||||
async function getComment(id) {
|
||||
const { data } = await CommentApi.getCommentPage(id, 1, 3, 0);
|
||||
state.commentList = data.list;
|
||||
state.total = data.total;
|
||||
}
|
||||
|
||||
onBeforeMount(() => {
|
||||
getComment(props.goodsId);
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.detail-comment-card {
|
||||
margin: 0 20rpx 20rpx 20rpx;
|
||||
padding: 20rpx 20rpx 0 20rpx;
|
||||
.card-header {
|
||||
.line {
|
||||
width: 6rpx;
|
||||
height: 30rpx;
|
||||
background: linear-gradient(180deg, var(--ui-BG-Main) 0%, var(--ui-BG-Main-gradient) 100%);
|
||||
border-radius: 3rpx;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 30rpx;
|
||||
font-weight: bold;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.des {
|
||||
font-size: 24rpx;
|
||||
color: $dark-9;
|
||||
}
|
||||
|
||||
.more-btn {
|
||||
font-size: 24rpx;
|
||||
color: var(--ui-BG-Main);
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.cicon-forward {
|
||||
font-size: 24rpx;
|
||||
line-height: normal;
|
||||
color: var(--ui-BG-Main);
|
||||
margin-top: 4rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
.comment-box {
|
||||
border-bottom: 2rpx solid #eeeeee;
|
||||
&:last-child {
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,50 @@
|
||||
<template>
|
||||
<view class="detail-content-card ss-p-b-20">
|
||||
<view class="card-content">
|
||||
<mp-html :content="content"></mp-html>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
content: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.detail-content-card {
|
||||
.card-header {
|
||||
.line {
|
||||
width: 6rpx;
|
||||
height: 30rpx;
|
||||
background: linear-gradient(180deg, var(--ui-BG-Main) 0%, var(--ui-BG-Main-gradient) 100%);
|
||||
border-radius: 3rpx;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 30rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.des {
|
||||
font-size: 24rpx;
|
||||
color: $dark-9;
|
||||
}
|
||||
|
||||
.more-btn {
|
||||
font-size: 24rpx;
|
||||
color: var(--ui-BG-Main);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
:deep() {
|
||||
image {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,257 @@
|
||||
<!-- 商品详情:商品/评价/详情的 nav -->
|
||||
<template>
|
||||
<su-fixed alway :bgStyles="{ background: '#fff' }" :val="0" noNav opacity :placeholder="false">
|
||||
<su-status-bar />
|
||||
<view
|
||||
class="ui-bar ss-flex ss-col-center ss-row-between ss-p-x-20"
|
||||
:style="[{ height: sys_navBar - sys_statusBar + 'px' }]"
|
||||
>
|
||||
<!-- 左 -->
|
||||
<view class="icon-box ss-flex">
|
||||
<view class="icon-button icon-button-left ss-flex ss-row-center" @tap="onClickLeft">
|
||||
<text class="sicon-back" v-if="hasHistory" />
|
||||
<text class="sicon-home" v-else />
|
||||
</view>
|
||||
<view class="line"></view>
|
||||
<view class="icon-button icon-button-right ss-flex ss-row-center" @tap="onClickRight">
|
||||
<text class="sicon-more" />
|
||||
</view>
|
||||
</view>
|
||||
<!-- 中 -->
|
||||
<view class="detail-tab-card ss-flex-1" :style="[{ opacity: state.tabOpacityVal }]">
|
||||
<view class="tab-box ss-flex ss-col-center ss-row-around">
|
||||
<view
|
||||
class="tab-item ss-flex-1 ss-flex ss-row-center ss-col-center"
|
||||
v-for="item in state.tabList"
|
||||
:key="item.value"
|
||||
@tap="onTab(item)"
|
||||
>
|
||||
<view class="tab-title" :class="state.curTab === item.value ? 'cur-tab-title' : ''">
|
||||
{{ item.label }}
|
||||
</view>
|
||||
<view v-show="state.curTab === item.value" class="tab-line"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- #ifdef MP -->
|
||||
<view :style="[capsuleStyle]"></view>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</su-fixed>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive } from 'vue';
|
||||
import { onPageScroll } from '@dcloudio/uni-app';
|
||||
import sheep from '@/sheep';
|
||||
import throttle from '@/sheep/helper/throttle.js';
|
||||
import { showMenuTools } from '@/sheep/hooks/useModal';
|
||||
|
||||
const sys_statusBar = sheep.$platform.device.statusBarHeight;
|
||||
const sys_navBar = sheep.$platform.navbar;
|
||||
const capsuleStyle = {
|
||||
width: sheep.$platform.capsule.width + 'px',
|
||||
height: sheep.$platform.capsule.height + 'px',
|
||||
};
|
||||
|
||||
const state = reactive({
|
||||
tabOpacityVal: 0,
|
||||
curTab: 'goods',
|
||||
tabList: [
|
||||
{
|
||||
label: '商品',
|
||||
value: 'goods',
|
||||
to: 'detail-swiper-selector',
|
||||
},
|
||||
{
|
||||
label: '评价',
|
||||
value: 'comment',
|
||||
to: 'detail-comment-selector',
|
||||
},
|
||||
{
|
||||
label: '详情',
|
||||
value: 'detail',
|
||||
to: 'detail-content-selector',
|
||||
},
|
||||
],
|
||||
});
|
||||
const emits = defineEmits(['clickLeft']);
|
||||
const hasHistory = sheep.$router.hasHistory();
|
||||
|
||||
function onClickLeft() {
|
||||
if (hasHistory) {
|
||||
sheep.$router.back();
|
||||
} else {
|
||||
sheep.$router.go('/pages/index/index');
|
||||
}
|
||||
emits('clickLeft');
|
||||
}
|
||||
|
||||
function onClickRight() {
|
||||
showMenuTools();
|
||||
}
|
||||
|
||||
let commentCard = {
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
};
|
||||
|
||||
function getCommentCardNode() {
|
||||
return new Promise((res, rej) => {
|
||||
uni
|
||||
.createSelectorQuery()
|
||||
.select('.detail-comment-selector')
|
||||
.boundingClientRect((data) => {
|
||||
if (data) {
|
||||
commentCard.top = data.top;
|
||||
commentCard.bottom = data.top + data.height;
|
||||
res(data);
|
||||
} else {
|
||||
res(null);
|
||||
}
|
||||
})
|
||||
.exec();
|
||||
});
|
||||
}
|
||||
|
||||
function onTab(tab) {
|
||||
let scrollTop = 0;
|
||||
if (tab.value === 'comment') {
|
||||
scrollTop = commentCard.top - sys_navBar + 1;
|
||||
} else if (tab.value === 'detail') {
|
||||
scrollTop = commentCard.bottom - sys_navBar + 1;
|
||||
}
|
||||
uni.pageScrollTo({
|
||||
scrollTop,
|
||||
duration: 200,
|
||||
});
|
||||
}
|
||||
|
||||
onPageScroll((e) => {
|
||||
state.tabOpacityVal = e.scrollTop > sheep.$platform.navbar ? 1 : e.scrollTop * 0.01;
|
||||
if (commentCard.top === 0) {
|
||||
throttle(() => {
|
||||
getCommentCardNode();
|
||||
}, 50);
|
||||
}
|
||||
|
||||
if (e.scrollTop < commentCard.top - sys_navBar) {
|
||||
state.curTab = 'goods';
|
||||
} else if (
|
||||
e.scrollTop >= commentCard.top - sys_navBar &&
|
||||
e.scrollTop <= commentCard.bottom - sys_navBar
|
||||
) {
|
||||
state.curTab = 'comment';
|
||||
} else {
|
||||
state.curTab = 'detail';
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.icon-box {
|
||||
box-shadow: 0px 0px 4rpx rgba(51, 51, 51, 0.08), 0px 4rpx 6rpx 2rpx rgba(102, 102, 102, 0.12);
|
||||
border-radius: 30rpx;
|
||||
width: 134rpx;
|
||||
height: 56rpx;
|
||||
margin-left: 8rpx;
|
||||
border: 1px solid rgba(#fff, 0.4);
|
||||
.line {
|
||||
width: 2rpx;
|
||||
height: 24rpx;
|
||||
background: #e5e5e7;
|
||||
}
|
||||
.sicon-back {
|
||||
font-size: 32rpx;
|
||||
color: #000;
|
||||
}
|
||||
.sicon-home {
|
||||
font-size: 32rpx;
|
||||
color: #000;
|
||||
}
|
||||
.sicon-more {
|
||||
font-size: 32rpx;
|
||||
color: #000;
|
||||
}
|
||||
.icon-button {
|
||||
width: 67rpx;
|
||||
height: 56rpx;
|
||||
&-left:hover {
|
||||
background: rgba(0, 0, 0, 0.16);
|
||||
border-radius: 30rpx 0px 0px 30rpx;
|
||||
}
|
||||
&-right:hover {
|
||||
background: rgba(0, 0, 0, 0.16);
|
||||
border-radius: 0px 30rpx 30rpx 0px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.left-box {
|
||||
position: relative;
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
.circle {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
background: rgba(#fff, 0.6);
|
||||
border: 1rpx solid #ebebeb;
|
||||
border-radius: 50%;
|
||||
box-sizing: border-box;
|
||||
z-index: -1;
|
||||
}
|
||||
}
|
||||
.right {
|
||||
position: relative;
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
.circle {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
background: rgba(#ffffff, 0.6);
|
||||
border: 1rpx solid #ebebeb;
|
||||
box-sizing: border-box;
|
||||
border-radius: 50%;
|
||||
z-index: -1;
|
||||
}
|
||||
}
|
||||
.detail-tab-card {
|
||||
width: 50%;
|
||||
.tab-item {
|
||||
height: 80rpx;
|
||||
position: relative;
|
||||
z-index: 11;
|
||||
|
||||
.tab-title {
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
.cur-tab-title {
|
||||
font-weight: $font-weight-bold;
|
||||
}
|
||||
|
||||
.tab-line {
|
||||
width: 60rpx;
|
||||
height: 6rpx;
|
||||
border-radius: 6rpx;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
bottom: 10rpx;
|
||||
background-color: var(--ui-BG-Main);
|
||||
z-index: 12;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,40 @@
|
||||
<!-- 秒杀商品:抢购进度 -->
|
||||
<template>
|
||||
<view class="ss-flex ss-col-center">
|
||||
<view class="progress-title ss-m-r-10"> 已抢{{ percent }}% </view>
|
||||
<view class="progress-box ss-flex ss-col-center">
|
||||
<view class="progerss-active" :style="{ width: percent < 10 ? '10%' : percent + '%' }">
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
percent: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.progress-title {
|
||||
font-size: 20rpx;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.progress-box {
|
||||
width: 168rpx;
|
||||
height: 18rpx;
|
||||
background: #f6f6f6;
|
||||
border-radius: 9rpx;
|
||||
}
|
||||
|
||||
.progerss-active {
|
||||
height: 24rpx;
|
||||
background: linear-gradient(86deg, #f60600, #d00500);
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,177 @@
|
||||
<template>
|
||||
<view
|
||||
class="skeleton-wrap"
|
||||
:class="['theme-' + sys.mode, 'main-' + sys.theme, 'font-' + sys.fontSize]"
|
||||
>
|
||||
<view class="skeleton-banner"></view>
|
||||
<view class="container-box">
|
||||
<view class="container-box-strip title ss-m-b-58"></view>
|
||||
<view class="container-box-strip ss-m-b-20"></view>
|
||||
<view class="container-box-strip ss-m-b-20"></view>
|
||||
<view class="container-box-strip w-364"></view>
|
||||
</view>
|
||||
<view class="container-box">
|
||||
<view class="ss-flex ss-row-between ss-m-b-34">
|
||||
<view class="container-box-strip w-380"></view>
|
||||
<view class="circle"></view>
|
||||
</view>
|
||||
<view class="ss-flex ss-row-between ss-m-b-34">
|
||||
<view class="container-box-strip w-556"></view>
|
||||
<view class="circle"></view>
|
||||
</view>
|
||||
<view class="ss-flex ss-row-between">
|
||||
<view class="container-box-strip w-556"></view>
|
||||
<view class="circle"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="container-box">
|
||||
<view class="container-box-strip w-198 ss-m-b-42"></view>
|
||||
<view class="ss-flex">
|
||||
<view class="circle ss-m-r-12"></view>
|
||||
<view class="container-box-strip w-252"></view>
|
||||
</view>
|
||||
</view>
|
||||
<su-fixed bottom placeholder bg="bg-white">
|
||||
<view class="ui-tabbar-box">
|
||||
<view class="foot ss-flex ss-col-center">
|
||||
<view class="ss-m-r-54 ss-m-l-32">
|
||||
<view class="rec ss-m-b-8"></view>
|
||||
<view class="oval"></view>
|
||||
</view>
|
||||
<view class="ss-m-r-54">
|
||||
<view class="rec ss-m-b-8"></view>
|
||||
<view class="oval"></view>
|
||||
</view>
|
||||
<view class="ss-m-r-50">
|
||||
<view class="rec ss-m-b-8"></view>
|
||||
<view class="oval"></view>
|
||||
</view>
|
||||
<button class="ss-reset-button add-btn ui-Shadow-Main"></button>
|
||||
<button class="ss-reset-button buy-btn ui-Shadow-Main"></button>
|
||||
</view>
|
||||
</view>
|
||||
</su-fixed>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
import sheep from '@/sheep';
|
||||
|
||||
const sys = computed(() => sheep.$store('sys'));
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@keyframes loading {
|
||||
0% {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
50% {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
.skeleton-wrap {
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
position: relative;
|
||||
|
||||
.skeleton-banner {
|
||||
width: 100%;
|
||||
height: calc(100vh - 882rpx);
|
||||
background: #f4f4f4;
|
||||
}
|
||||
|
||||
.container-box {
|
||||
padding: 24rpx 18rpx;
|
||||
margin: 14rpx 20rpx;
|
||||
background: var(--ui-BG);
|
||||
animation: loading 1.4s ease infinite;
|
||||
|
||||
.container-box-strip {
|
||||
height: 40rpx;
|
||||
background: #f3f3f1;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
|
||||
.title {
|
||||
width: 470rpx;
|
||||
height: 50rpx;
|
||||
border-radius: 25rpx;
|
||||
}
|
||||
|
||||
.w-364 {
|
||||
width: 364rpx;
|
||||
}
|
||||
|
||||
.w-380 {
|
||||
width: 380rpx;
|
||||
}
|
||||
|
||||
.w-556 {
|
||||
width: 556rpx;
|
||||
}
|
||||
|
||||
.w-198 {
|
||||
width: 198rpx;
|
||||
}
|
||||
|
||||
.w-252 {
|
||||
width: 252rpx;
|
||||
}
|
||||
|
||||
.circle {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
background: #f3f3f1;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
.ui-tabbar-box {
|
||||
box-shadow: 0px -6px 10px 0px rgba(51, 51, 51, 0.2);
|
||||
}
|
||||
|
||||
.foot {
|
||||
height: 100rpx;
|
||||
background: var(--ui-BG);
|
||||
.rec {
|
||||
width: 38rpx;
|
||||
height: 38rpx;
|
||||
background: #f3f3f1;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
|
||||
.oval {
|
||||
width: 38rpx;
|
||||
height: 22rpx;
|
||||
background: #f3f3f1;
|
||||
border-radius: 11rpx;
|
||||
}
|
||||
.add-btn {
|
||||
width: 214rpx;
|
||||
height: 72rpx;
|
||||
font-weight: 500;
|
||||
font-size: 28rpx;
|
||||
border-radius: 40rpx 0 0 40rpx;
|
||||
background-color: var(--ui-BG-Main-light);
|
||||
color: var(--ui-BG-Main);
|
||||
}
|
||||
|
||||
.buy-btn {
|
||||
width: 214rpx;
|
||||
height: 72rpx;
|
||||
font-weight: 500;
|
||||
font-size: 28rpx;
|
||||
|
||||
border-radius: 0 40rpx 40rpx 0;
|
||||
background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
|
||||
color: $white;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,166 @@
|
||||
<!-- 商品详情的底部导航 -->
|
||||
<template>
|
||||
<su-fixed bottom placeholder bg="bg0">
|
||||
<view class="ui-tabbar-box flex-center ju-between" style="background: #fff">
|
||||
<view class="ui-tabbar ss-flex ss-col-center">
|
||||
<view
|
||||
class="detail-tabbar-item ss-flex ss-flex-col ss-row-center ss-col-center"
|
||||
@tap="onCart"
|
||||
>
|
||||
<image class="item-icon" :src="$url + 'index/car1.png'" mode="aspectFit" />
|
||||
<view class="item-title">购物车</view>
|
||||
</view>
|
||||
<view
|
||||
v-if="collectIcon"
|
||||
class="detail-tabbar-item ss-flex ss-flex-col ss-row-center ss-col-center"
|
||||
@tap="onFavorite"
|
||||
>
|
||||
<block v-if="modelValue.favorite">
|
||||
<image class="item-icon" :src="$url + 'index/collect_2.png'" mode="aspectFit" />
|
||||
<view class="item-title">已收藏</view>
|
||||
</block>
|
||||
<block v-else>
|
||||
<image class="item-icon" :src="$url + 'index/collect_3.png'" mode="aspectFit" />
|
||||
<view class="item-title">收藏</view>
|
||||
</block>
|
||||
</view>
|
||||
<!-- <view
|
||||
v-if="shareIcon"
|
||||
class="detail-tabbar-item ss-flex ss-flex-col ss-row-center ss-col-center"
|
||||
@tap="showShareModal"
|
||||
>
|
||||
<image
|
||||
class="item-icon"
|
||||
:src="sheep.$url.static('/static/img/shop/goods/share.png')"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
<view class="item-title">分享</view>
|
||||
</view> -->
|
||||
</view>
|
||||
<slot></slot>
|
||||
</view>
|
||||
</su-fixed>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
/**
|
||||
*
|
||||
* 底部导航
|
||||
*
|
||||
* @property {String} bg - 背景颜色Class
|
||||
* @property {String} ui - 自定义样式Class
|
||||
* @property {Boolean} noFixed - 是否定位
|
||||
* @property {Boolean} topRadius - 上圆角
|
||||
*/
|
||||
import { reactive } from 'vue';
|
||||
import sheep from '@/sheep';
|
||||
import { showShareModal } from '@/sheep/hooks/useModal';
|
||||
import FavoriteApi from '@/sheep/api/product/favorite';
|
||||
|
||||
// 数据
|
||||
const state = reactive({});
|
||||
|
||||
// 接收参数
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: Object,
|
||||
default() {},
|
||||
},
|
||||
bg: {
|
||||
type: String,
|
||||
default: 'bg-white',
|
||||
},
|
||||
bgStyles: {
|
||||
type: Object,
|
||||
default() {},
|
||||
},
|
||||
ui: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
|
||||
noFixed: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
topRadius: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
collectIcon: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
serviceIcon: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
shareIcon: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
});
|
||||
|
||||
async function onFavorite() {
|
||||
// 情况一:取消收藏
|
||||
if (props.modelValue.favorite) {
|
||||
const { code } = await FavoriteApi.deleteFavorite(props.modelValue.id);
|
||||
if (code !== 0) {
|
||||
return;
|
||||
}
|
||||
sheep.$helper.toast('取消收藏');
|
||||
props.modelValue.favorite = false;
|
||||
// 情况二:添加收藏
|
||||
} else {
|
||||
const { code } = await FavoriteApi.createFavorite(props.modelValue.id);
|
||||
if (code !== 0) {
|
||||
return;
|
||||
}
|
||||
sheep.$helper.toast('收藏成功');
|
||||
props.modelValue.favorite = true;
|
||||
}
|
||||
}
|
||||
|
||||
const onChat = () => {
|
||||
sheep.$router.go('/pages/chat/index', {
|
||||
id: props.modelValue.id,
|
||||
});
|
||||
};
|
||||
const onCart = () => {
|
||||
uni.switchTab({
|
||||
url: '/pages/cart/cart',
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.ui-tabbar-box {
|
||||
box-shadow: 0px -6px 10px 0px rgba(51, 51, 51, 0.2);
|
||||
}
|
||||
|
||||
.ui-tabbar {
|
||||
display: flex;
|
||||
height: 50px;
|
||||
|
||||
.detail-tabbar-item {
|
||||
width: 100rpx;
|
||||
|
||||
.item-icon {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
}
|
||||
|
||||
.item-title {
|
||||
font-size: 20rpx;
|
||||
font-weight: 500;
|
||||
line-height: 20rpx;
|
||||
margin-top: 12rpx;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.bg0 {
|
||||
background: #ffffff !important;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,140 @@
|
||||
<!-- 拼团活动参团记录卡片 -->
|
||||
<template>
|
||||
<view v-if="state.list.length > 0" class="groupon-list detail-card ss-p-x-20">
|
||||
<view class="join-activity ss-flex ss-row-between ss-m-t-30">
|
||||
<view class="">已有{{ state.list.length }}人参与活动</view>
|
||||
<text class="cicon-forward"></text>
|
||||
</view>
|
||||
<view
|
||||
v-for="(record, index) in state.list"
|
||||
@tap="sheep.$router.go('/pages/activity/groupon/detail', { id: record.id })"
|
||||
:key="index"
|
||||
class="ss-m-t-40 ss-flex ss-row-between border-bottom ss-p-b-30"
|
||||
>
|
||||
<view class="ss-flex ss-col-center">
|
||||
<image :src="sheep.$url.cdn(record.avatar)" class="user-avatar"></image>
|
||||
<view class="user-nickname ss-m-l-20 ss-line-1">{{ record.nickname }}</view>
|
||||
</view>
|
||||
<view class="ss-flex ss-col-center">
|
||||
<view class="ss-flex-col ss-col-bottom ss-m-r-20">
|
||||
<view class="title ss-flex ss-m-b-14">
|
||||
还差
|
||||
<view class="num">{{ record.userSize - record.userCount }}人</view>
|
||||
成团
|
||||
</view>
|
||||
<view class="end-time">{{ endTime(record.expireTime) }}</view>
|
||||
</view>
|
||||
<view class="">
|
||||
<button class="ss-reset-button go-btn" @tap.stop="onJoinGroupon(record)"> 去参团 </button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onMounted, reactive } from 'vue';
|
||||
import sheep from '@/sheep';
|
||||
import { useDurationTime } from '@/sheep/hooks/useGoods';
|
||||
import CombinationApi from '@/sheep/api/promotion/combination';
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: Object,
|
||||
default() {},
|
||||
},
|
||||
});
|
||||
const state = reactive({
|
||||
list: [],
|
||||
});
|
||||
|
||||
// 去参团
|
||||
const emits = defineEmits(['join']);
|
||||
function onJoinGroupon(record) {
|
||||
emits('join', record);
|
||||
}
|
||||
|
||||
// 结束时间或状态
|
||||
function endTime(time) {
|
||||
const durationTime = useDurationTime(time);
|
||||
|
||||
if (durationTime.ms <= 0) {
|
||||
return '该团已解散';
|
||||
}
|
||||
|
||||
let timeText = '剩余 ';
|
||||
timeText += `${durationTime.h}时`;
|
||||
timeText += `${durationTime.m}分`;
|
||||
timeText += `${durationTime.s}秒`;
|
||||
return timeText;
|
||||
}
|
||||
|
||||
// 初始化
|
||||
onMounted(async () => {
|
||||
// 查询参团记录
|
||||
// status = 0 表示未成团
|
||||
const { data } = await CombinationApi.getHeadCombinationRecordList(props.modelValue.id, 0, 10);
|
||||
state.list = data;
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.detail-card {
|
||||
background-color: $white;
|
||||
margin: 14rpx 20rpx;
|
||||
border-radius: 10rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
.groupon-list {
|
||||
.join-activity {
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: #999999;
|
||||
|
||||
.cicon-forward {
|
||||
font-weight: 400;
|
||||
}
|
||||
}
|
||||
|
||||
.user-avatar {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
background: #ececec;
|
||||
border-radius: 60rpx;
|
||||
}
|
||||
|
||||
.user-nickname {
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
width: 160rpx;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: #666666;
|
||||
|
||||
.num {
|
||||
color: #ff6000;
|
||||
}
|
||||
}
|
||||
|
||||
.end-time {
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.go-btn {
|
||||
width: 140rpx;
|
||||
height: 60rpx;
|
||||
background: linear-gradient(90deg, #ff6000 0%, #fe832a 100%);
|
||||
border-radius: 30rpx;
|
||||
color: #fff;
|
||||
font-weight: 500;
|
||||
font-size: 26rpx;
|
||||
line-height: normal;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,103 @@
|
||||
<!-- 页面;暂时没用到 -->
|
||||
<template>
|
||||
<view class="list-goods-card ss-flex-col" @tap="onClick">
|
||||
<view class="md-img-box">
|
||||
<image class="goods-img md-img-box" :src="sheep.$url.cdn(img)" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="md-goods-content ss-flex-col ss-row-around">
|
||||
<view class="md-goods-title ss-line-2 ss-m-x-20 ss-m-t-6 ss-m-b-16">{{ title }}</view>
|
||||
<view class="md-goods-subtitle ss-line-1 ss-p-y-10 ss-p-20">{{ subTitle }}</view>
|
||||
<view class="ss-flex ss-col-center ss-row-between ss-m-b-16 ss-m-x-20">
|
||||
<view class="md-goods-price text-price">{{ price }}</view>
|
||||
<view class="goods-origin-price text-price">{{ originPrice }}</view>
|
||||
<view class="sales-text">已售{{ sales }}件</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import sheep from '@/sheep';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import { computed, reactive } from 'vue';
|
||||
|
||||
const props = defineProps({
|
||||
img: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
subTitle: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
price: {
|
||||
type: [String, Number],
|
||||
default: '',
|
||||
},
|
||||
originPrice: {
|
||||
type: [String, Number],
|
||||
default: '',
|
||||
},
|
||||
sales: {
|
||||
type: [String, Number],
|
||||
default: '',
|
||||
},
|
||||
});
|
||||
const emits = defineEmits(['click']);
|
||||
const onClick = () => {
|
||||
emits('click');
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.goods-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
.sales-text {
|
||||
font-size: 20rpx;
|
||||
color: #c4c4c4;
|
||||
}
|
||||
|
||||
.goods-origin-price {
|
||||
font-size: 20rpx;
|
||||
color: #c4c4c4;
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
.list-goods-card {
|
||||
overflow: hidden;
|
||||
width: 344rpx;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
background-color: $white;
|
||||
box-shadow: 0 0 20rpx 4rpx rgba(199, 199, 199, 0.22);
|
||||
border-radius: 20rpx;
|
||||
|
||||
.md-img-box {
|
||||
width: 344rpx;
|
||||
height: 344rpx;
|
||||
}
|
||||
|
||||
.md-goods-title {
|
||||
font-size: 26rpx;
|
||||
color: #333;
|
||||
}
|
||||
.md-goods-subtitle {
|
||||
background-color: var(--ui-BG-Main-tag);
|
||||
color: var(--ui-BG-Main);
|
||||
font-size: 20rpx;
|
||||
}
|
||||
|
||||
.md-goods-price {
|
||||
font-size: 30rpx;
|
||||
color: $red;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,93 @@
|
||||
<!-- 页面;暂时没用到 -->
|
||||
<template>
|
||||
<su-fixed
|
||||
alway
|
||||
:bgStyles="{ background: '#fff' }"
|
||||
:val="0"
|
||||
noNav
|
||||
:opacity="false"
|
||||
placeholder
|
||||
index="10090"
|
||||
>
|
||||
<su-status-bar />
|
||||
<view
|
||||
class="ui-bar ss-flex ss-col-center ss-row-between ss-p-x-20"
|
||||
:style="[{ height: sys_navBar - sys_statusBar + 'px' }]"
|
||||
>
|
||||
<!-- 左 -->
|
||||
<view class="left-box">
|
||||
<text
|
||||
class="_icon-back back-icon"
|
||||
@tap="toBack"
|
||||
:style="[{ color: state.iconColor }]"
|
||||
></text>
|
||||
</view>
|
||||
<!-- 中 -->
|
||||
<uni-search-bar
|
||||
class="ss-flex-1"
|
||||
radius="33"
|
||||
:placeholder="placeholder"
|
||||
cancelButton="none"
|
||||
:focus="true"
|
||||
v-model="state.searchVal"
|
||||
@confirm="onSearch"
|
||||
/>
|
||||
<!-- 右 -->
|
||||
<view class="right">
|
||||
<text class="sicon-more" :style="[{ color: state.iconColor }]" @tap="showMenuTools" />
|
||||
</view>
|
||||
<!-- #ifdef MP -->
|
||||
<view :style="[capsuleStyle]"></view>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</su-fixed>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive } from 'vue';
|
||||
import sheep from '@/sheep';
|
||||
import { showMenuTools } from '@/sheep/hooks/useModal';
|
||||
|
||||
const sys_statusBar = sheep.$platform.device.statusBarHeight;
|
||||
const sys_navBar = sheep.$platform.navbar;
|
||||
const capsuleStyle = {
|
||||
width: sheep.$platform.capsule.width + 'px',
|
||||
height: sheep.$platform.capsule.height + 'px',
|
||||
margin: '0 ' + (sheep.$platform.device.windowWidth - sheep.$platform.capsule.right) + 'px',
|
||||
};
|
||||
|
||||
const state = reactive({
|
||||
iconColor: '#000',
|
||||
searchVal: '',
|
||||
});
|
||||
|
||||
const props = defineProps({
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: '搜索内容',
|
||||
},
|
||||
});
|
||||
|
||||
const emits = defineEmits(['searchConfirm']);
|
||||
|
||||
// 返回
|
||||
const toBack = () => {
|
||||
sheep.$router.back();
|
||||
};
|
||||
|
||||
// 搜索
|
||||
const onSearch = () => {
|
||||
emits('searchConfirm', state.searchVal);
|
||||
};
|
||||
|
||||
const onTab = (item) => {};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.back-icon {
|
||||
font-size: 40rpx;
|
||||
}
|
||||
.sicon-more {
|
||||
font-size: 48rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,562 @@
|
||||
<!-- 拼团商品详情 -->
|
||||
<template>
|
||||
<s-layout :onShareAppMessage="shareInfo" navbar="goods">
|
||||
<!-- 标题栏 -->
|
||||
<detailNavbar />
|
||||
<!-- 骨架屏 -->
|
||||
<detailSkeleton v-if="state.skeletonLoading" />
|
||||
<!-- 下架/售罄提醒 -->
|
||||
<s-empty
|
||||
v-else-if="
|
||||
state.goodsInfo === null ||
|
||||
state.activity.status !== 0 ||
|
||||
state.activity.endTime < new Date().getTime()
|
||||
"
|
||||
text="活动不存在或已结束"
|
||||
icon="/static/soldout-empty.png"
|
||||
showAction
|
||||
actionText="返回上一页"
|
||||
@clickAction="sheep.$router.back()"
|
||||
/>
|
||||
<block v-else>
|
||||
<view class="detail-swiper-selector">
|
||||
<!-- 商品图轮播 -->
|
||||
<su-swiper
|
||||
class="ss-m-b-14"
|
||||
isPreview
|
||||
:list="state.goodsSwiper"
|
||||
dotStyle="tag"
|
||||
imageMode="widthFix"
|
||||
dotCur="bg-mask-40"
|
||||
:seizeHeight="750"
|
||||
/>
|
||||
|
||||
<!-- 价格+标题 -->
|
||||
<view class="title-card detail-card ss-m-y-14 ss-m-x-20 ss-p-x-20 ss-p-y-34">
|
||||
<view class="ss-flex ss-row-between ss-m-b-60">
|
||||
<view>
|
||||
<view class="price-box ss-flex ss-col-bottom ss-m-b-18">
|
||||
<view class="price-text ss-m-r-16">
|
||||
{{ fen2yuan(state.activity.price || state.goodsInfo.price) }}
|
||||
</view>
|
||||
<view class="tig ss-flex ss-col-center">
|
||||
<view class="tig-icon ss-flex ss-col-center ss-row-center">
|
||||
<view class="groupon-tag">
|
||||
<image
|
||||
:src="sheep.$url.static('/static/img/shop/goods/groupon-tag.png')"
|
||||
></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="tig-title">拼团价</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="ss-flex ss-row-between">
|
||||
<view class="origin-price ss-flex ss-col-center" v-if="state.goodsInfo.price">
|
||||
单买价:
|
||||
<view class="origin-price-text">
|
||||
{{ fen2yuan(state.goodsInfo.marketPrice) }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="countdown-box" v-if="endTime.ms > 0">
|
||||
<view class="countdown-title ss-m-b-20">距结束仅剩</view>
|
||||
<view class="ss-flex countdown-time">
|
||||
<view class="ss-flex countdown-h">{{ endTime.h }}</view>
|
||||
<view class="ss-m-x-4">:</view>
|
||||
<view class="countdown-num ss-flex ss-row-center">{{ endTime.m }}</view>
|
||||
<view class="ss-m-x-4">:</view>
|
||||
<view class="countdown-num ss-flex ss-row-center">{{ endTime.s }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="countdown-title" v-else> 活动已结束 </view>
|
||||
</view>
|
||||
|
||||
<view class="title-text ss-line-2 ss-m-b-6">{{ state.goodsInfo.name }}</view>
|
||||
<view class="subtitle-text ss-line-1">{{ state.goodsInfo.introduction }}</view>
|
||||
</view>
|
||||
|
||||
<!-- 功能卡片 -->
|
||||
<view class="detail-cell-card detail-card ss-flex-col">
|
||||
<!-- 规格 -->
|
||||
<detail-cell-sku :sku="state.selectedSku" @tap="state.showSelectSku = true" />
|
||||
</view>
|
||||
|
||||
<!-- 参团列表 -->
|
||||
<groupon-card-list v-model="state.activity" @join="onJoinGroupon" />
|
||||
|
||||
<!-- 规格与数量弹框 -->
|
||||
<s-select-groupon-sku
|
||||
:show="state.showSelectSku"
|
||||
:goodsInfo="state.goodsInfo"
|
||||
:grouponAction="state.grouponAction"
|
||||
:grouponNum="state.grouponNum"
|
||||
@buy="onBuy"
|
||||
@change="onSkuChange"
|
||||
@close="onSkuClose"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<!-- 评价 -->
|
||||
<detail-comment-card class="detail-comment-selector" :goodsId="state.goodsId" />
|
||||
<!-- 详情 -->
|
||||
<detail-content-card class="detail-content-selector" :content="state.goodsInfo.description" />
|
||||
|
||||
<!-- 商品tabbar -->
|
||||
<detail-tabbar v-model="state.goodsInfo">
|
||||
<view class="buy-box ss-flex ss-col-center ss-p-r-20">
|
||||
<button
|
||||
class="ss-reset-button origin-price-btn ss-flex-col"
|
||||
@tap="sheep.$router.go('/pages/goods/index', { id: state.goodsInfo.id })"
|
||||
>
|
||||
<view class="btn-price">{{ fen2yuan(state.goodsInfo.marketPrice) }}</view>
|
||||
<view>原价购买</view>
|
||||
</button>
|
||||
<button
|
||||
class="ss-reset-button btn-tox ss-flex-col"
|
||||
@tap="onCreateGroupon"
|
||||
:class="
|
||||
state.activity.status === 0 && state.goodsInfo.stock !== 0
|
||||
? 'check-btn-box'
|
||||
: 'disabled-btn-box'
|
||||
"
|
||||
:disabled="state.goodsInfo.stock === 0 || state.activity.status !== 0"
|
||||
>
|
||||
<view class="btn-price">{{
|
||||
fen2yuan(
|
||||
state.selectedSku.price * state.selectedSku.count ||
|
||||
state.activity.price * state.selectedSku.count ||
|
||||
state.goodsInfo.price * state.selectedSku.count ||
|
||||
state.goodsInfo.price,
|
||||
)
|
||||
}}</view>
|
||||
<view v-if="state.activity.startTime > new Date().getTime()">未开始</view>
|
||||
<view v-else-if="state.activity.endTime <= new Date().getTime()">已结束</view>
|
||||
<view v-else>
|
||||
<view v-if="state.goodsInfo.stock === 0">已售罄</view>
|
||||
<view v-else>立即开团</view>
|
||||
</view>
|
||||
</button>
|
||||
</view>
|
||||
</detail-tabbar>
|
||||
</block>
|
||||
</s-layout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, computed } from 'vue';
|
||||
import { onLoad, onPageScroll } from '@dcloudio/uni-app';
|
||||
import sheep from '@/sheep';
|
||||
import { isEmpty } from 'lodash-es';
|
||||
import detailNavbar from './components/detail/detail-navbar.vue';
|
||||
import detailCellSku from './components/detail/detail-cell-sku.vue';
|
||||
import detailTabbar from './components/detail/detail-tabbar.vue';
|
||||
import detailSkeleton from './components/detail/detail-skeleton.vue';
|
||||
import detailCommentCard from './components/detail/detail-comment-card.vue';
|
||||
import detailContentCard from './components/detail/detail-content-card.vue';
|
||||
import grouponCardList from './components/groupon/groupon-card-list.vue';
|
||||
import { useDurationTime, formatGoodsSwiper, fen2yuan } from '@/sheep/hooks/useGoods';
|
||||
import CombinationApi from '@/sheep/api/promotion/combination';
|
||||
import SpuApi from '@/sheep/api/product/spu';
|
||||
import { SharePageEnum } from '@/sheep/helper/const';
|
||||
|
||||
const headerBg = sheep.$url.css('/static/img/shop/goods/groupon-bg.png');
|
||||
const btnBg = sheep.$url.css('/static/img/shop/goods/groupon-btn.png');
|
||||
const disabledBtnBg = sheep.$url.css('/static/img/shop/goods/activity-btn-disabled.png');
|
||||
const grouponBg = sheep.$url.css('/static/img/shop/goods/groupon-tip-bg.png');
|
||||
|
||||
onPageScroll(() => {});
|
||||
const state = reactive({
|
||||
skeletonLoading: true, // 骨架屏
|
||||
goodsId: 0, // 商品ID
|
||||
goodsInfo: {}, // 商品信息
|
||||
goodsSwiper: [], // 商品轮播图
|
||||
showSelectSku: false, // 显示规格弹框
|
||||
selectedSku: {}, // 选中的规格属性
|
||||
activity: {}, // 团购活动
|
||||
grouponId: 0, // 团购ID
|
||||
grouponNum: 0, // 团购人数
|
||||
grouponAction: 'create', // 团购操作
|
||||
combinationHeadId: null, // 拼团团长编号
|
||||
});
|
||||
|
||||
// 倒计时
|
||||
const endTime = computed(() => {
|
||||
return useDurationTime(state.activity.endTime);
|
||||
});
|
||||
|
||||
// 规格变更
|
||||
function onSkuChange(e) {
|
||||
state.selectedSku = e;
|
||||
}
|
||||
|
||||
function onSkuClose() {
|
||||
state.showSelectSku = false;
|
||||
}
|
||||
|
||||
// 发起拼团
|
||||
function onCreateGroupon() {
|
||||
state.grouponAction = 'create';
|
||||
state.grouponId = 0;
|
||||
state.showSelectSku = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 去参团
|
||||
*
|
||||
* @param record 团长的团购记录
|
||||
*/
|
||||
function onJoinGroupon(record) {
|
||||
state.grouponAction = 'join';
|
||||
state.grouponId = record.activityId;
|
||||
state.combinationHeadId = record.id;
|
||||
state.grouponNum = record.userSize;
|
||||
state.showSelectSku = true;
|
||||
}
|
||||
|
||||
// 立即购买
|
||||
function onBuy(sku) {
|
||||
sheep.$router.go('/pages/order/confirm', {
|
||||
data: JSON.stringify({
|
||||
order_type: 'goods',
|
||||
combinationActivityId: state.activity.id,
|
||||
combinationHeadId: state.combinationHeadId,
|
||||
items: [
|
||||
{
|
||||
skuId: sku.id,
|
||||
count: sku.count,
|
||||
},
|
||||
],
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
// 分享信息
|
||||
const shareInfo = computed(() => {
|
||||
if (isEmpty(state.activity)) return {};
|
||||
return sheep.$platform.share.getShareInfo(
|
||||
{
|
||||
title: state.activity.name,
|
||||
image: sheep.$url.cdn(state.goodsInfo.picUrl),
|
||||
params: {
|
||||
page: SharePageEnum.GROUPON.value,
|
||||
query: state.activity.id,
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'goods', // 商品海报
|
||||
title: state.activity.name, // 商品标题
|
||||
image: sheep.$url.cdn(state.goodsInfo.picUrl), // 商品主图
|
||||
price: fen2yuan(state.goodsInfo.price), // 商品价格
|
||||
marketPrice: fen2yuan(state.goodsInfo.marketPrice), // 商品原价
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
onLoad(async (options) => {
|
||||
// 非法参数
|
||||
if (!options.id) {
|
||||
state.goodsInfo = null;
|
||||
state.skeletonLoading = false;
|
||||
return;
|
||||
}
|
||||
state.grouponId = options.id;
|
||||
// 加载活动信息
|
||||
const { code, data: activity } = await CombinationApi.getCombinationActivity(state.grouponId);
|
||||
if (code !== 0) {
|
||||
state.goodsInfo = null;
|
||||
state.skeletonLoading = false;
|
||||
return;
|
||||
}
|
||||
state.activity = activity;
|
||||
// 加载商品信息
|
||||
const { data: spu } = await SpuApi.getSpuDetail(activity.spuId);
|
||||
if (code !== 0) {
|
||||
state.goodsInfo = null;
|
||||
state.skeletonLoading = false;
|
||||
return;
|
||||
}
|
||||
state.goodsId = spu.id;
|
||||
|
||||
// 默认显示最低价
|
||||
spu.price = activity.products.reduce((min, product) => {
|
||||
return Math.min(min, product.combinationPrice || Infinity);
|
||||
}, Infinity);
|
||||
|
||||
// 价格、库存使用活动的
|
||||
spu.skus.forEach((sku) => {
|
||||
const product = activity.products.find((product) => product.skuId === sku.id);
|
||||
if (product) {
|
||||
sku.price = product.combinationPrice;
|
||||
} else {
|
||||
// 找不到可能是没配置,则不能发起秒杀
|
||||
sku.stock = 0;
|
||||
}
|
||||
});
|
||||
|
||||
// 关闭骨架屏
|
||||
state.skeletonLoading = false;
|
||||
if (code === 0) {
|
||||
state.goodsInfo = spu;
|
||||
state.grouponNum = activity.userSize;
|
||||
state.goodsSwiper = formatGoodsSwiper(state.goodsInfo.sliderPicUrls);
|
||||
} else {
|
||||
// 未找到商品
|
||||
state.goodsInfo = null;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.detail-card {
|
||||
background-color: $white;
|
||||
margin: 14rpx 20rpx;
|
||||
border-radius: 10rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
// 价格标题卡片
|
||||
.title-card {
|
||||
width: 710rpx;
|
||||
box-sizing: border-box;
|
||||
// height: 320rpx;
|
||||
background-size: 100% 100%;
|
||||
border-radius: 10rpx;
|
||||
background-image: v-bind(headerBg);
|
||||
background-repeat: no-repeat;
|
||||
|
||||
.price-box {
|
||||
.price-text {
|
||||
font-size: 30rpx;
|
||||
font-weight: 500;
|
||||
color: #fff;
|
||||
line-height: normal;
|
||||
font-family: OPPOSANS;
|
||||
|
||||
&::before {
|
||||
content: '¥';
|
||||
font-size: 30rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
.origin-price {
|
||||
font-size: 24rpx;
|
||||
font-weight: 400;
|
||||
color: #fff;
|
||||
opacity: 0.7;
|
||||
|
||||
.origin-price-text {
|
||||
text-decoration: line-through;
|
||||
|
||||
font-family: OPPOSANS;
|
||||
|
||||
&::before {
|
||||
content: '¥';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.tig {
|
||||
border: 2rpx solid #ffffff;
|
||||
border-radius: 4rpx;
|
||||
width: 126rpx;
|
||||
height: 38rpx;
|
||||
|
||||
.tig-icon {
|
||||
margin-left: -2rpx;
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
background: #ffffff;
|
||||
border-radius: 4rpx 0 0 4rpx;
|
||||
|
||||
.groupon-tag {
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.tig-title {
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
line-height: normal;
|
||||
color: #ffffff;
|
||||
width: 86rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
|
||||
.countdown-title {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.countdown-time {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
.countdown-h {
|
||||
font-size: 24rpx;
|
||||
font-family: OPPOSANS;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
padding: 0 4rpx;
|
||||
height: 40rpx;
|
||||
background: rgba(#000000, 0.1);
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
.countdown-num {
|
||||
font-size: 24rpx;
|
||||
font-family: OPPOSANS;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
background: rgba(#000000, 0.1);
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.title-text {
|
||||
font-size: 30rpx;
|
||||
font-weight: bold;
|
||||
line-height: 42rpx;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.subtitle-text {
|
||||
font-size: 26rpx;
|
||||
font-weight: 400;
|
||||
color: #ffffff;
|
||||
line-height: 42rpx;
|
||||
opacity: 0.9;
|
||||
}
|
||||
}
|
||||
|
||||
// 购买
|
||||
.buy-box {
|
||||
.disabled-btn-box[disabled] {
|
||||
background-color: transparent;
|
||||
}
|
||||
.check-btn-box {
|
||||
width: 248rpx;
|
||||
height: 80rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 600;
|
||||
margin-left: -36rpx;
|
||||
background-image: v-bind(btnBg);
|
||||
background-repeat: no-repeat;
|
||||
background-size: 100% 100%;
|
||||
color: #ffffff;
|
||||
line-height: normal;
|
||||
border-radius: 0px 40rpx 40rpx 0px;
|
||||
}
|
||||
.disabled-btn-box {
|
||||
width: 248rpx;
|
||||
height: 80rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 600;
|
||||
margin-left: -36rpx;
|
||||
background-image: v-bind(disabledBtnBg);
|
||||
background-repeat: no-repeat;
|
||||
background-size: 100% 100%;
|
||||
color: #999999;
|
||||
line-height: normal;
|
||||
border-radius: 0px 40rpx 40rpx 0px;
|
||||
}
|
||||
|
||||
.origin-price-btn {
|
||||
width: 236rpx;
|
||||
height: 80rpx;
|
||||
background: rgba(#ff5651, 0.1);
|
||||
color: #ff6000;
|
||||
border-radius: 40rpx 0px 0px 40rpx;
|
||||
line-height: normal;
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
|
||||
.btn-title {
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
.btn-price {
|
||||
font-family: OPPOSANS;
|
||||
|
||||
&::before {
|
||||
content: '¥';
|
||||
}
|
||||
}
|
||||
.more-item-box {
|
||||
.more-item {
|
||||
width: 156rpx;
|
||||
height: 58rpx;
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #999999;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
.more-item-hover {
|
||||
background: rgba(#ffefe5, 0.32);
|
||||
color: #ff6000;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.groupon-box {
|
||||
background: v-bind(grouponBg) no-repeat;
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
|
||||
//活动卡片
|
||||
.activity-box {
|
||||
width: 100%;
|
||||
height: 80rpx;
|
||||
box-sizing: border-box;
|
||||
margin-bottom: 10rpx;
|
||||
|
||||
.activity-title {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
line-height: 42rpx;
|
||||
|
||||
.activity-icon {
|
||||
width: 38rpx;
|
||||
height: 38rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.activity-go {
|
||||
width: 70rpx;
|
||||
height: 32rpx;
|
||||
background: #ffffff;
|
||||
border-radius: 16rpx;
|
||||
font-weight: 500;
|
||||
color: #ff6000;
|
||||
font-size: 24rpx;
|
||||
line-height: normal;
|
||||
}
|
||||
}
|
||||
|
||||
.model-box {
|
||||
.title {
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,674 @@
|
||||
<template>
|
||||
<view>
|
||||
<s-layout :onShareAppMessage="shareInfo" navbar="goods">
|
||||
<!-- 标题栏 -->
|
||||
<detailNavbar />
|
||||
|
||||
<!-- 骨架屏 -->
|
||||
<detailSkeleton v-if="state.skeletonLoading" />
|
||||
<!-- 下架/售罄提醒 -->
|
||||
<s-empty
|
||||
v-else-if="state.goodsInfo === null"
|
||||
text="商品不存在或已下架"
|
||||
icon="/static/soldout-empty.png"
|
||||
showAction
|
||||
actionText="再逛逛"
|
||||
actionUrl="/pages/goods/list"
|
||||
/>
|
||||
<block v-else>
|
||||
<view class="detail-swiper-selector">
|
||||
<!-- 商品轮播图 -->
|
||||
<su-swiper
|
||||
class="ss-m-b-14"
|
||||
isPreview
|
||||
:list="formatGoodsSwiper(state.goodsInfo.sliderPicUrls)"
|
||||
otStyle="tag"
|
||||
imageMode="widthFix"
|
||||
dotCur="bg-mask-40"
|
||||
:seizeHeight="750"
|
||||
/>
|
||||
<!-- 限时折扣/会员价的优惠信息 -->
|
||||
<view
|
||||
class="discount"
|
||||
v-if="
|
||||
state.settlementSku && state.settlementSku.id && state.settlementSku.promotionPrice
|
||||
"
|
||||
>
|
||||
<image class="disImg" :src="sheep.$url.static('/static/img/shop/goods/dis.png')" />
|
||||
<view class="discountCont">
|
||||
<view class="disContT">
|
||||
<view class="disContT1">
|
||||
<view class="disContT1P">
|
||||
¥{{ fen2yuan(state.settlementSku.promotionPrice) }}
|
||||
</view>
|
||||
<view class="disContT1End">
|
||||
直降¥
|
||||
{{ fen2yuan(state.settlementSku.price - state.settlementSku.promotionPrice) }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="disContT2" v-if="state.settlementSku.promotionType === 4">
|
||||
限时折扣
|
||||
</view>
|
||||
<view class="disContT2" v-else-if="state.settlementSku.promotionType === 6">
|
||||
会员折扣
|
||||
</view>
|
||||
</view>
|
||||
<view class="disContB">
|
||||
<view class="disContB1">
|
||||
价格:¥{{ fen2yuan(state.settlementSku.price) }} 丨 剩余:
|
||||
{{ state.settlementSku.stock }}
|
||||
</view>
|
||||
<view class="disContB2" v-if="state.settlementSku.promotionEndTime > 0">
|
||||
距结束仅剩
|
||||
<s-count-down
|
||||
:tipText="' '"
|
||||
:bgColor="bgColor"
|
||||
:dayText="':'"
|
||||
:hourText="':'"
|
||||
:minuteText="':'"
|
||||
:secondText="' '"
|
||||
:datatime="state.settlementSku.promotionEndTime / 1000"
|
||||
:isDay="false"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 价格+标题 -->
|
||||
<view class="title-card detail-card ss-p-y-30 ss-p-x-20">
|
||||
<!-- 没有限时折扣/会员价的优惠信息时,展示的价格信息 -->
|
||||
<view
|
||||
class="ss-flex ss-row-between ss-col-center ss-m-b-26"
|
||||
v-if="!state.settlementSku.promotionPrice"
|
||||
>
|
||||
<view class="price-box ss-flex ss-col-bottom">
|
||||
<view class="price-text ss-m-r-16">
|
||||
{{ fen2yuan(state.selectedSku.price || state.goodsInfo.price) }}
|
||||
</view>
|
||||
<view
|
||||
class="origin-price-text"
|
||||
v-if="state.goodsInfo.marketPrice > state.goodsInfo.price"
|
||||
>
|
||||
{{ fen2yuan(state.selectedSku.marketPrice || state.goodsInfo.marketPrice) }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="sales-text">
|
||||
{{ formatSales('exact', state.goodsInfo.salesCount) }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="discounts-box ss-flex ss-row-between ss-m-b-28">
|
||||
<!-- 查看优惠劵的描述 -->
|
||||
<view
|
||||
class="tag ss-m-r-10"
|
||||
v-for="coupon in state.couponInfo.slice(0, 1)"
|
||||
:key="coupon.id"
|
||||
@tap="onOpenActivity"
|
||||
>
|
||||
[劵]满{{ fen2yuanSimple(coupon.usePrice) }}元{{
|
||||
coupon.discountType === 1
|
||||
? '减' + fen2yuanSimple(coupon.discountPrice) + '元'
|
||||
: '打' + formatDiscountPercent(coupon.discountPercent) + '折'
|
||||
}}
|
||||
</view>
|
||||
<!-- 查看满减送的描述 -->
|
||||
<div class="tag-content">
|
||||
<view class="tag-box ss-flex">
|
||||
<!-- 最多打印 3 条,所以需要扣除优惠劵已打印的 -->
|
||||
<view
|
||||
v-for="item in getRewardActivityRuleItemDescriptions(
|
||||
state.rewardActivity,
|
||||
).slice(0, 3 - state.couponInfo.slice(0, 1).length)"
|
||||
:key="item"
|
||||
class="tag ss-m-r-10"
|
||||
@tap="onOpenActivity"
|
||||
>
|
||||
<text>{{ item }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</div>
|
||||
<!-- 领取优惠劵的按钮 -->
|
||||
<view
|
||||
class="get-coupon-box ss-flex ss-col-center ss-m-l-20"
|
||||
@tap="onOpenActivity"
|
||||
v-if="state.couponInfo.length"
|
||||
>
|
||||
<view class="discounts-title ss-m-r-8">领券</view>
|
||||
<text class="cicon-forward"></text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="title-text ss-line-2 ss-m-b-6">{{ state.goodsInfo.name }}</view>
|
||||
<view class="subtitle-text ss-line-1">{{ state.goodsInfo.introduction }}</view>
|
||||
</view>
|
||||
|
||||
<!-- 功能卡片 -->
|
||||
<view class="detail-cell-card detail-card ss-flex-col">
|
||||
<detail-cell-sku
|
||||
v-model="state.selectedSku.goods_sku_text"
|
||||
:sku="state.selectedSku"
|
||||
@tap="state.showSelectSku = true"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<!-- 规格与数量弹框 -->
|
||||
<s-select-sku
|
||||
:goodsInfo="state.goodsInfo"
|
||||
:show="state.showSelectSku"
|
||||
@addCart="onAddCart"
|
||||
@buy="onBuy"
|
||||
@change="onSkuChange"
|
||||
@close="state.showSelectSku = false"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<!-- 评价 -->
|
||||
<detail-comment-card class="detail-comment-selector" :goodsId="state.goodsId" />
|
||||
<!-- 详情 -->
|
||||
<detail-content-card
|
||||
class="detail-content-selector"
|
||||
:content="state.goodsInfo.description"
|
||||
/>
|
||||
|
||||
<!-- 活动跳转:拼团/秒杀/砍价活动 -->
|
||||
<detail-activity-tip
|
||||
v-if="state.activityList.length > 0"
|
||||
:activity-list="state.activityList"
|
||||
/>
|
||||
|
||||
<!-- 详情 tabbar -->
|
||||
<detail-tabbar v-model="state.goodsInfo">
|
||||
<view class="buy-box ss-flex ss-col-center ss-p-r-20" v-if="state.goodsInfo.stock > 0">
|
||||
<button
|
||||
class="ss-reset-button add-btn ui-Shadow-Main"
|
||||
@tap="state.showSelectSku = true"
|
||||
>
|
||||
加入购物车
|
||||
</button>
|
||||
<button
|
||||
class="ss-reset-button buy-btn ui-Shadow-Main"
|
||||
@tap="state.showSelectSku = true"
|
||||
>
|
||||
立即购买
|
||||
</button>
|
||||
</view>
|
||||
<view class="buy-box ss-flex ss-col-center ss-p-r-20" v-else>
|
||||
<button class="ss-reset-button disabled-btn" disabled> 已售罄 </button>
|
||||
</view>
|
||||
</detail-tabbar>
|
||||
|
||||
<!-- 满减送/限时折扣活动弹窗 -->
|
||||
<s-activity-pop
|
||||
v-model="state"
|
||||
:show="state.showActivityModel"
|
||||
@close="state.showActivityModel = false"
|
||||
@get="onTakeCoupon"
|
||||
/>
|
||||
</block>
|
||||
</s-layout>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, computed } from 'vue';
|
||||
import { onLoad, onPageScroll } from '@dcloudio/uni-app';
|
||||
import sheep from '@/sheep';
|
||||
import CouponApi from '@/sheep/api/promotion/coupon';
|
||||
import ActivityApi from '@/sheep/api/promotion/activity';
|
||||
import FavoriteApi from '@/sheep/api/product/favorite';
|
||||
import RewardActivityApi from '@/sheep/api/promotion/rewardActivity';
|
||||
import {
|
||||
formatSales,
|
||||
formatGoodsSwiper,
|
||||
fen2yuan,
|
||||
fen2yuanSimple,
|
||||
formatDiscountPercent,
|
||||
getRewardActivityRuleItemDescriptions,
|
||||
} from '@/sheep/hooks/useGoods';
|
||||
import detailNavbar from './components/detail/detail-navbar.vue';
|
||||
import detailCellSku from './components/detail/detail-cell-sku.vue';
|
||||
import detailTabbar from './components/detail/detail-tabbar.vue';
|
||||
import detailSkeleton from './components/detail/detail-skeleton.vue';
|
||||
import detailCommentCard from './components/detail/detail-comment-card.vue';
|
||||
import detailContentCard from './components/detail/detail-content-card.vue';
|
||||
import detailActivityTip from './components/detail/detail-activity-tip.vue';
|
||||
import { isEmpty } from 'lodash-es';
|
||||
import SpuApi from '@/sheep/api/product/spu';
|
||||
|
||||
onPageScroll(() => {});
|
||||
import OrderApi from '@/sheep/api/trade/order';
|
||||
import { SharePageEnum } from '@/sheep/helper/const';
|
||||
|
||||
const bgColor = {
|
||||
bgColor: '#E93323',
|
||||
Color: '#fff',
|
||||
width: '44rpx',
|
||||
timeTxtwidth: '16rpx',
|
||||
isDay: true,
|
||||
};
|
||||
const isLogin = computed(() => sheep.$store('user').isLogin);
|
||||
const state = reactive({
|
||||
goodsId: 0,
|
||||
skeletonLoading: true, // SPU 加载中
|
||||
goodsInfo: {}, // SPU 信息
|
||||
showSelectSku: false, // 是否展示 SKU 选择弹窗
|
||||
selectedSku: {}, // 选中的 SKU
|
||||
settlementSku: {}, // 结算的 SKU:由于 selectedSku 不进行默认选中,所以初始使用结算价格最低的 SKU 作为基础展示
|
||||
showModel: false, // 是否展示 Coupon 优惠劵的弹窗
|
||||
couponInfo: [], // 可领取的 Coupon 优惠劵的列表
|
||||
showActivityModel: false, // 【满减送/限时折扣】是否展示 Activity 营销活动的弹窗
|
||||
rewardActivity: {}, // 【满减送】活动
|
||||
activityList: [], // 【秒杀/拼团/砍价】可参与的 Activity 营销活动的列表
|
||||
});
|
||||
|
||||
// 规格变更
|
||||
function onSkuChange(e) {
|
||||
state.selectedSku = e;
|
||||
state.settlementSku = e;
|
||||
}
|
||||
|
||||
// 添加购物车
|
||||
function onAddCart(e) {
|
||||
if (!e.id) {
|
||||
sheep.$helper.toast('请选择商品规格');
|
||||
return;
|
||||
}
|
||||
sheep.$store('cart').add(e);
|
||||
}
|
||||
|
||||
// 立即购买
|
||||
function onBuy(e) {
|
||||
if (!e.id) {
|
||||
sheep.$helper.toast('请选择商品规格');
|
||||
return;
|
||||
}
|
||||
sheep.$router.go('/pages/order/confirm', {
|
||||
data: JSON.stringify({
|
||||
items: [
|
||||
{
|
||||
skuId: e.id,
|
||||
count: e.goods_num,
|
||||
categoryId: state.goodsInfo.categoryId,
|
||||
},
|
||||
],
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
// 打开营销弹窗
|
||||
function onOpenActivity() {
|
||||
state.showActivityModel = true;
|
||||
}
|
||||
|
||||
// 立即领取优惠劵
|
||||
async function onTakeCoupon(id) {
|
||||
const { code } = await CouponApi.takeCoupon(id);
|
||||
if (code !== 0) {
|
||||
return;
|
||||
}
|
||||
uni.showToast({
|
||||
title: '领取成功',
|
||||
});
|
||||
setTimeout(() => {
|
||||
getCoupon();
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
const shareInfo = computed(() => {
|
||||
if (isEmpty(state.goodsInfo)) return {};
|
||||
return sheep.$platform.share.getShareInfo(
|
||||
{
|
||||
title: state.goodsInfo.name,
|
||||
image: sheep.$url.cdn(state.goodsInfo.picUrl),
|
||||
desc: state.goodsInfo.introduction,
|
||||
params: {
|
||||
page: SharePageEnum.GOODS.value,
|
||||
query: state.goodsInfo.id,
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'goods', // 商品海报
|
||||
title: state.goodsInfo.name, // 商品名称
|
||||
image: sheep.$url.cdn(state.goodsInfo.picUrl), // 商品主图
|
||||
price: fen2yuan(state.goodsInfo.price), // 商品价格
|
||||
original_price: fen2yuan(state.goodsInfo.marketPrice), // 商品原价
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
async function getCoupon() {
|
||||
const { code, data } = await CouponApi.getCouponTemplateList(state.goodsId, 2, 10);
|
||||
if (code === 0) {
|
||||
state.couponInfo = data;
|
||||
}
|
||||
}
|
||||
|
||||
async function getSettlementByIds(ids) {
|
||||
let { data, code } = await OrderApi.getSettlementProduct(ids);
|
||||
if (code !== 0 || data.length !== 1) {
|
||||
return;
|
||||
}
|
||||
data = data[0];
|
||||
|
||||
// 补充 SKU 的价格信息
|
||||
if (state.goodsInfo.skus) {
|
||||
state.goodsInfo.skus.forEach((sku) => {
|
||||
data.skus.forEach((item) => {
|
||||
if (sku.id === item.id) {
|
||||
sku.promotionType = item.promotionType;
|
||||
sku.promotionPrice = item.promotionPrice;
|
||||
sku.promotionId = item.promotionId;
|
||||
sku.promotionEndTime = item.promotionEndTime;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// 选择有 promotionPrice 且最小的
|
||||
state.settlementSku = state.goodsInfo.skus
|
||||
.filter((sku) => sku.stock > 0 && sku.promotionPrice > 0)
|
||||
.reduce((prev, curr) => (prev.promotionPrice < curr.promotionPrice ? prev : curr), []);
|
||||
|
||||
// 设置满减送活动
|
||||
if (data.rewardActivity) {
|
||||
state.rewardActivity = data.rewardActivity;
|
||||
//获取活动时间
|
||||
getActivityTime(state.rewardActivity.id);
|
||||
}
|
||||
}
|
||||
|
||||
//获取活动时间
|
||||
async function getActivityTime(id) {
|
||||
const { code, data } = await RewardActivityApi.getRewardActivity(id);
|
||||
if (code === 0) {
|
||||
// console.log('获取到的活动 数据', data)
|
||||
state.rewardActivity.startTime = data.startTime;
|
||||
state.rewardActivity.endTime = data.endTime;
|
||||
}
|
||||
}
|
||||
|
||||
onLoad((options) => {
|
||||
// 非法参数
|
||||
if (!options.id) {
|
||||
state.goodsInfo = null;
|
||||
state.skeletonLoading = false;
|
||||
return;
|
||||
}
|
||||
state.goodsId = options.id;
|
||||
// 1. 加载商品信息
|
||||
SpuApi.getSpuDetail(state.goodsId).then((res) => {
|
||||
if (res.code !== 0 || !res.data) {
|
||||
state.goodsInfo = null;
|
||||
state.skeletonLoading = false;
|
||||
return;
|
||||
}
|
||||
// 加载到商品
|
||||
state.skeletonLoading = false;
|
||||
state.goodsInfo = res.data;
|
||||
// 获取结算信息
|
||||
getSettlementByIds(state.goodsId);
|
||||
// 加载是否收藏
|
||||
if (isLogin.value) {
|
||||
FavoriteApi.isFavoriteExists(state.goodsId, 'goods').then((res) => {
|
||||
if (res.code !== 0) {
|
||||
return;
|
||||
}
|
||||
state.goodsInfo.favorite = res.data;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// 2. 加载优惠劵信息
|
||||
getCoupon();
|
||||
|
||||
// 3. 加载营销活动信息
|
||||
ActivityApi.getActivityListBySpuId(state.goodsId).then((res) => {
|
||||
if (res.code !== 0) {
|
||||
return;
|
||||
}
|
||||
state.activityList = res.data;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.detail-card {
|
||||
background-color: #ffff;
|
||||
margin: 14rpx 20rpx;
|
||||
border-radius: 10rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
// 价格标题卡片
|
||||
.title-card {
|
||||
.price-box {
|
||||
.price-text {
|
||||
font-size: 42rpx;
|
||||
font-weight: 500;
|
||||
color: #ff3000;
|
||||
line-height: 30rpx;
|
||||
font-family: OPPOSANS;
|
||||
|
||||
&::before {
|
||||
content: '¥';
|
||||
font-size: 30rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.origin-price-text {
|
||||
font-size: 26rpx;
|
||||
font-weight: 400;
|
||||
text-decoration: line-through;
|
||||
color: $gray-c;
|
||||
font-family: OPPOSANS;
|
||||
|
||||
&::before {
|
||||
content: '¥';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.sales-text {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: $gray-c;
|
||||
}
|
||||
|
||||
.discounts-box {
|
||||
.tag-content {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.tag-box {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.tag {
|
||||
flex-shrink: 0;
|
||||
padding: 4rpx 10rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
border-radius: 4rpx;
|
||||
color: var(--ui-BG-Main);
|
||||
background: var(--ui-BG-Main-tag);
|
||||
}
|
||||
|
||||
.discounts-title {
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: var(--ui-BG-Main);
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.cicon-forward {
|
||||
color: var(--ui-BG-Main);
|
||||
font-size: 24rpx;
|
||||
line-height: normal;
|
||||
margin-top: 4rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.title-text {
|
||||
font-size: 30rpx;
|
||||
font-weight: bold;
|
||||
line-height: 42rpx;
|
||||
}
|
||||
|
||||
.subtitle-text {
|
||||
font-size: 26rpx;
|
||||
font-weight: 400;
|
||||
color: $dark-9;
|
||||
line-height: 42rpx;
|
||||
}
|
||||
}
|
||||
|
||||
// 购买
|
||||
.buy-box {
|
||||
.add-btn {
|
||||
width: 214rpx;
|
||||
height: 72rpx;
|
||||
font-weight: 500;
|
||||
font-size: 28rpx;
|
||||
border-radius: 40rpx 0 0 40rpx;
|
||||
background-color: #74aef6;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.buy-btn {
|
||||
width: 214rpx;
|
||||
height: 72rpx;
|
||||
font-weight: 500;
|
||||
font-size: 28rpx;
|
||||
|
||||
border-radius: 0 40rpx 40rpx 0;
|
||||
background: #fa7e31;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.disabled-btn {
|
||||
width: 428rpx;
|
||||
height: 72rpx;
|
||||
border-radius: 40rpx;
|
||||
background: #999999;
|
||||
color: $white;
|
||||
}
|
||||
}
|
||||
|
||||
.model-box {
|
||||
height: 60vh;
|
||||
|
||||
.model-content {
|
||||
height: 56vh;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
|
||||
// 限时折扣
|
||||
.discount {
|
||||
width: 750rpx;
|
||||
height: 100rpx;
|
||||
// background-color: red;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.disImg {
|
||||
width: 750rpx;
|
||||
height: 100rpx;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
.discountCont {
|
||||
width: 680rpx;
|
||||
height: 90rpx;
|
||||
margin: 10rpx auto 0 auto;
|
||||
// background-color: gold;
|
||||
}
|
||||
|
||||
.disContT {
|
||||
width: 680rpx;
|
||||
height: 50rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.disContT1 {
|
||||
width: 400rpx;
|
||||
height: 50rpx;
|
||||
// background-color: green;
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.disContT2 {
|
||||
width: 200rpx;
|
||||
height: 50rpx;
|
||||
line-height: 50rpx;
|
||||
// background-color: gold;
|
||||
font-size: 30rpx;
|
||||
text-align: end;
|
||||
color: white;
|
||||
font-weight: bolder;
|
||||
font-style: oblique 20deg;
|
||||
letter-spacing: 0.1rem;
|
||||
}
|
||||
|
||||
.disContT1P {
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.disContT1End {
|
||||
// width: 180rpx;
|
||||
padding: 0 10rpx;
|
||||
height: 30rpx;
|
||||
line-height: 28rpx;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
background-color: white;
|
||||
color: #ff3000;
|
||||
font-size: 23rpx;
|
||||
border-radius: 20rpx;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
|
||||
.disContB {
|
||||
width: 680rpx;
|
||||
height: 40rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: 20rpx;
|
||||
color: white;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.disContB1 {
|
||||
width: 300rpx;
|
||||
height: 40rpx;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
|
||||
.disContB2 {
|
||||
width: 300rpx;
|
||||
height: 40rpx;
|
||||
line-height: 40rpx;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,632 @@
|
||||
<template>
|
||||
<view>
|
||||
<s-layout title="商品详情">
|
||||
<!-- 标题栏 -->
|
||||
<!-- <detailNavbar /> -->
|
||||
|
||||
<!-- 骨架屏 -->
|
||||
<detailSkeleton v-if="state.skeletonLoading" />
|
||||
<!-- 下架/售罄提醒 -->
|
||||
<s-empty
|
||||
v-else-if="state.goodsInfo === null"
|
||||
text="商品不存在或已下架"
|
||||
icon="/static/soldout-empty.png"
|
||||
showAction
|
||||
actionText="再逛逛"
|
||||
actionUrl="/pages/goods/list"
|
||||
/>
|
||||
<block v-else>
|
||||
<view class="detail-swiper-selector">
|
||||
<!-- 商品轮播图 -->
|
||||
<su-swiper
|
||||
class=""
|
||||
isPreview
|
||||
:list="formatGoodsSwiper(state.goodsInfo.sliderPicUrls)"
|
||||
otStyle="tag"
|
||||
imageMode="widthFix"
|
||||
dotCur="bg-mask-40"
|
||||
:seizeHeight="750"
|
||||
/>
|
||||
<!-- 限时折扣/会员价的优惠信息 -->
|
||||
<view
|
||||
class="discount"
|
||||
v-if="
|
||||
state.settlementSku && state.settlementSku.id && state.settlementSku.promotionPrice
|
||||
"
|
||||
>
|
||||
<image class="disImg" :src="`${$url}goods/icon1.png`" />
|
||||
<view class="discountCont">
|
||||
<view class="disContT">
|
||||
<view class="disContT1">
|
||||
<view class="disContT1P">
|
||||
¥{{ fen2yuan(state.settlementSku.promotionPrice) }}
|
||||
</view>
|
||||
<view class="disContT1End">
|
||||
直降¥
|
||||
{{ fen2yuan(state.settlementSku.price - state.settlementSku.promotionPrice) }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="disContT2" v-if="state.settlementSku.promotionType === 4">
|
||||
限时折扣
|
||||
</view>
|
||||
<view class="disContT2" v-else-if="state.settlementSku.promotionType === 6">
|
||||
会员折扣
|
||||
</view>
|
||||
</view>
|
||||
<view class="disContB">
|
||||
<view class="disContB1"> ¥{{ fen2yuan(state.settlementSku.price) }} </view>
|
||||
<view class="disContB2" v-if="state.settlementSku.promotionEndTime > 0">
|
||||
距结束仅剩
|
||||
<s-count-down
|
||||
:tipText="' '"
|
||||
:bgColor="bgColor"
|
||||
:dayText="':'"
|
||||
:hourText="':'"
|
||||
:minuteText="':'"
|
||||
:secondText="' '"
|
||||
:datatime="state.settlementSku.promotionEndTime / 1000"
|
||||
:isDay="false"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 价格+标题 -->
|
||||
<view class="title-card detail-card ss-p-y-32 ss-p-x-32">
|
||||
<view class="title-text ss-line-2 ss-m-b-6 flex-center ju-flex-start">
|
||||
<view class="label m-r-10 shrink" v-if="state.goodsInfo.tagSaleName">{{
|
||||
state.goodsInfo.tagSaleName
|
||||
}}</view>
|
||||
<view>{{ state.goodsInfo.name }}</view>
|
||||
</view>
|
||||
<view class="subtitle-text ss-line-1">{{ state.goodsInfo.introduction }}</view>
|
||||
</view>
|
||||
|
||||
<!-- 功能卡片 -->
|
||||
<view class="detail-cell-card detail-card ss-flex-col">
|
||||
<detail-cell-sku
|
||||
v-model="state.selectedSku.goods_sku_text"
|
||||
:sku="state.selectedSku"
|
||||
@tap="state.showSelectSku = true"
|
||||
/>
|
||||
<detail-cell
|
||||
v-if="state.goodsInfo.deliverPlace || state.goodsInfo.deliverTime"
|
||||
label="发货"
|
||||
:value="`${state.goodsInfo.deliverPlace || ''} ${
|
||||
state.goodsInfo.deliverPlace || state.goodsInfo.deliverTime ? '|' : ''
|
||||
} ${state.goodsInfo.deliverTime || ''}`"
|
||||
/>
|
||||
<detail-cell label="运费" value="免运费(请以提交订单为准)" />
|
||||
</view>
|
||||
|
||||
<!-- 规格与数量弹框 -->
|
||||
<s-select-sku
|
||||
:goodsInfo="state.goodsInfo"
|
||||
:show="state.showSelectSku"
|
||||
@addCart="onAddCart"
|
||||
@buy="onBuy"
|
||||
@change="onSkuChange"
|
||||
@close="state.showSelectSku = false"
|
||||
/>
|
||||
</view>
|
||||
<!-- 详情 -->
|
||||
<detail-content-card
|
||||
class="detail-content-selector"
|
||||
:content="state.goodsInfo.description"
|
||||
/>
|
||||
|
||||
<!-- 活动跳转:拼团/秒杀/砍价活动 -->
|
||||
<detail-activity-tip
|
||||
v-if="state.activityList.length > 0"
|
||||
:activity-list="state.activityList"
|
||||
/>
|
||||
|
||||
<!-- 详情 tabbar -->
|
||||
<detail-tabbar v-model="state.goodsInfo">
|
||||
<view class="buy-box ss-flex ss-col-center m-r-40" v-if="state.goodsInfo.stock > 0">
|
||||
<view class="add-btn flex-center" @tap="state.showSelectSku = true">加入购物车</view>
|
||||
<view class="buy-btn flex-center" @tap="state.showSelectSku = true">立即购买</view>
|
||||
</view>
|
||||
<view class="buy-box ss-flex ss-col-center ss-p-r-20" v-else>
|
||||
<button class="ss-reset-button disabled-btn" disabled> 已售罄 </button>
|
||||
</view>
|
||||
</detail-tabbar>
|
||||
|
||||
<!-- 满减送/限时折扣活动弹窗 -->
|
||||
<s-activity-pop
|
||||
v-model="state"
|
||||
:show="state.showActivityModel"
|
||||
@close="state.showActivityModel = false"
|
||||
@get="onTakeCoupon"
|
||||
/>
|
||||
</block>
|
||||
</s-layout>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, computed } from 'vue';
|
||||
import { onLoad, onPageScroll } from '@dcloudio/uni-app';
|
||||
import sheep from '@/sheep';
|
||||
import CouponApi from '@/sheep/api/promotion/coupon';
|
||||
import ActivityApi from '@/sheep/api/promotion/activity';
|
||||
import FavoriteApi from '@/sheep/api/product/favorite';
|
||||
import RewardActivityApi from '@/sheep/api/promotion/rewardActivity';
|
||||
import {
|
||||
formatSales,
|
||||
formatGoodsSwiper,
|
||||
fen2yuan,
|
||||
fen2yuanSimple,
|
||||
formatDiscountPercent,
|
||||
getRewardActivityRuleItemDescriptions,
|
||||
} from '@/sheep/hooks/useGoods';
|
||||
import detailNavbar from './components/detail/detail-navbar.vue';
|
||||
import detailCellSku from './components/detail/detail-cell-sku.vue';
|
||||
|
||||
import detailCell from './components/detail/detail-cell.vue';
|
||||
import detailTabbar from './components/detail/detail-tabbar.vue';
|
||||
import detailSkeleton from './components/detail/detail-skeleton.vue';
|
||||
import detailCommentCard from './components/detail/detail-comment-card.vue';
|
||||
import detailContentCard from './components/detail/detail-content-card.vue';
|
||||
import detailActivityTip from './components/detail/detail-activity-tip.vue';
|
||||
import { isEmpty } from 'lodash-es';
|
||||
import SpuApi from '@/sheep/api/product/spu';
|
||||
|
||||
onPageScroll(() => {});
|
||||
import OrderApi from '@/sheep/api/trade/order';
|
||||
import { SharePageEnum } from '@/sheep/helper/const';
|
||||
|
||||
const bgColor = {
|
||||
bgColor: '#E93323',
|
||||
Color: '#fff',
|
||||
width: '44rpx',
|
||||
timeTxtwidth: '16rpx',
|
||||
isDay: true,
|
||||
};
|
||||
const isLogin = computed(() => sheep.$store('user').isLogin);
|
||||
const state = reactive({
|
||||
goodsId: 0,
|
||||
info: {},
|
||||
skeletonLoading: true, // SPU 加载中
|
||||
goodsInfo: {}, // SPU 信息
|
||||
showSelectSku: false, // 是否展示 SKU 选择弹窗
|
||||
selectedSku: {}, // 选中的 SKU
|
||||
settlementSku: {}, // 结算的 SKU:由于 selectedSku 不进行默认选中,所以初始使用结算价格最低的 SKU 作为基础展示
|
||||
showModel: false, // 是否展示 Coupon 优惠劵的弹窗
|
||||
couponInfo: [], // 可领取的 Coupon 优惠劵的列表
|
||||
showActivityModel: false, // 【满减送/限时折扣】是否展示 Activity 营销活动的弹窗
|
||||
rewardActivity: {}, // 【满减送】活动
|
||||
activityList: [], // 【秒杀/拼团/砍价】可参与的 Activity 营销活动的列表
|
||||
});
|
||||
|
||||
// 规格变更
|
||||
function onSkuChange(e) {
|
||||
state.selectedSku = e;
|
||||
state.settlementSku = e;
|
||||
}
|
||||
|
||||
// 添加购物车
|
||||
function onAddCart(e) {
|
||||
if (!e.id) {
|
||||
sheep.$helper.toast('请选择商品规格');
|
||||
return;
|
||||
}
|
||||
sheep.$store('cart').add(e);
|
||||
}
|
||||
|
||||
// 立即购买
|
||||
function onBuy(e) {
|
||||
if (!e.id) {
|
||||
sheep.$helper.toast('请选择商品规格');
|
||||
return;
|
||||
}
|
||||
sheep.$router.go('/pages/order/confirm', {
|
||||
data: JSON.stringify({
|
||||
items: [
|
||||
{
|
||||
skuId: e.id,
|
||||
count: e.goods_num,
|
||||
categoryId: state.goodsInfo.categoryId,
|
||||
},
|
||||
],
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
// 打开营销弹窗
|
||||
function onOpenActivity() {
|
||||
state.showActivityModel = true;
|
||||
}
|
||||
|
||||
// 立即领取优惠劵
|
||||
async function onTakeCoupon(id) {
|
||||
const { code } = await CouponApi.takeCoupon(id);
|
||||
if (code !== 0) {
|
||||
return;
|
||||
}
|
||||
uni.showToast({
|
||||
title: '领取成功',
|
||||
});
|
||||
setTimeout(() => {
|
||||
getCoupon();
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
const shareInfo = computed(() => {
|
||||
if (isEmpty(state.goodsInfo)) return {};
|
||||
return sheep.$platform.share.getShareInfo(
|
||||
{
|
||||
title: state.goodsInfo.name,
|
||||
image: sheep.$url.cdn(state.goodsInfo.picUrl),
|
||||
desc: state.goodsInfo.introduction,
|
||||
params: {
|
||||
page: SharePageEnum.GOODS.value,
|
||||
query: state.goodsInfo.id,
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'goods', // 商品海报
|
||||
title: state.goodsInfo.name, // 商品名称
|
||||
image: sheep.$url.cdn(state.goodsInfo.picUrl), // 商品主图
|
||||
price: fen2yuan(state.goodsInfo.price), // 商品价格
|
||||
original_price: fen2yuan(state.goodsInfo.marketPrice), // 商品原价
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
async function getCoupon() {
|
||||
const { code, data } = await CouponApi.getCouponTemplateList(state.goodsId, 2, 10);
|
||||
if (code === 0) {
|
||||
state.couponInfo = data;
|
||||
}
|
||||
}
|
||||
|
||||
async function getSettlementByIds(ids) {
|
||||
let { data, code } = await OrderApi.getSettlementProduct(ids);
|
||||
if (code !== 0 || data.length !== 1) {
|
||||
return;
|
||||
}
|
||||
data = data[0];
|
||||
|
||||
// 补充 SKU 的价格信息
|
||||
if (state?.goodsInfo?.skus) {
|
||||
state?.goodsInfo?.skus?.forEach((sku) => {
|
||||
data.skus.forEach((item) => {
|
||||
if (sku.id === item.id) {
|
||||
sku.promotionType = item.promotionType;
|
||||
sku.promotionPrice = item.promotionPrice;
|
||||
sku.promotionId = item.promotionId;
|
||||
sku.promotionEndTime = item.promotionEndTime;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// 选择有 promotionPrice 且最小的
|
||||
state.settlementSku = state.goodsInfo.skus
|
||||
.filter((sku) => sku.stock > 0 && sku.promotionPrice > 0)
|
||||
.reduce((prev, curr) => (prev.promotionPrice < curr.promotionPrice ? prev : curr), []);
|
||||
|
||||
// 设置满减送活动
|
||||
if (data.rewardActivity) {
|
||||
state.rewardActivity = data.rewardActivity;
|
||||
//获取活动时间
|
||||
getActivityTime(state.rewardActivity.id);
|
||||
}
|
||||
}
|
||||
|
||||
//获取活动时间
|
||||
async function getActivityTime(id) {
|
||||
const { code, data } = await RewardActivityApi.getRewardActivity(id);
|
||||
if (code === 0) {
|
||||
// console.log('获取到的活动 数据', data)
|
||||
state.rewardActivity.startTime = data.startTime;
|
||||
state.rewardActivity.endTime = data.endTime;
|
||||
}
|
||||
}
|
||||
|
||||
onLoad((options) => {
|
||||
// 滚到顶部
|
||||
uni.pageScrollTo({
|
||||
scrollTop: 0,
|
||||
});
|
||||
// 非法参数
|
||||
if (!options.id) {
|
||||
state.goodsInfo = null;
|
||||
state.skeletonLoading = false;
|
||||
return;
|
||||
}
|
||||
state.goodsId = options.id;
|
||||
// 1. 加载商品信息
|
||||
SpuApi.getSpuDetail(state.goodsId).then((res) => {
|
||||
if (res.code !== 0 || !res.data) {
|
||||
state.goodsInfo = null;
|
||||
state.skeletonLoading = false;
|
||||
return;
|
||||
}
|
||||
// 加载到商品
|
||||
state.skeletonLoading = false;
|
||||
state.goodsInfo = res.data;
|
||||
console.log(state.goodsInfo);
|
||||
// 获取结算信息
|
||||
getSettlementByIds(state.goodsId);
|
||||
// 加载是否收藏
|
||||
if (isLogin.value) {
|
||||
FavoriteApi.isFavoriteExists(state.goodsId, 'goods').then((res) => {
|
||||
if (res.code !== 0) {
|
||||
return;
|
||||
}
|
||||
state.goodsInfo.favorite = res.data;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// 2. 加载优惠劵信息
|
||||
getCoupon();
|
||||
|
||||
// 3. 加载营销活动信息
|
||||
ActivityApi.getActivityListBySpuId(state.goodsId).then((res) => {
|
||||
if (res.code !== 0) {
|
||||
return;
|
||||
}
|
||||
state.activityList = res.data;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.detail-card {
|
||||
background-color: var(--color24);
|
||||
border-radius: 10rpx;
|
||||
overflow: hidden;
|
||||
margin-bottom: 40rpx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
// 价格标题卡片
|
||||
.title-card {
|
||||
.price-box {
|
||||
.price-text {
|
||||
font-size: 42rpx;
|
||||
font-weight: 500;
|
||||
color: #ff3000;
|
||||
line-height: 30rpx;
|
||||
font-family: OPPOSANS;
|
||||
|
||||
&::before {
|
||||
content: '¥';
|
||||
font-size: 30rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.origin-price-text {
|
||||
font-size: 26rpx;
|
||||
font-weight: 400;
|
||||
text-decoration: line-through;
|
||||
color: $gray-c;
|
||||
font-family: OPPOSANS;
|
||||
|
||||
&::before {
|
||||
content: '¥';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.sales-text {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: $gray-c;
|
||||
}
|
||||
|
||||
.discounts-box {
|
||||
.tag-content {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.tag-box {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.tag {
|
||||
flex-shrink: 0;
|
||||
padding: 4rpx 10rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
border-radius: 4rpx;
|
||||
color: var(--ui-BG-Main);
|
||||
background: var(--ui-BG-Main-tag);
|
||||
}
|
||||
|
||||
.discounts-title {
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: var(--ui-BG-Main);
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.cicon-forward {
|
||||
color: var(--ui-BG-Main);
|
||||
font-size: 24rpx;
|
||||
line-height: normal;
|
||||
margin-top: 4rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.title-text {
|
||||
color: #333333;
|
||||
font-size: 32rpx;
|
||||
line-height: 42rpx;
|
||||
}
|
||||
|
||||
.subtitle-text {
|
||||
font-size: 26rpx;
|
||||
font-weight: 400;
|
||||
color: $dark-9;
|
||||
line-height: 42rpx;
|
||||
}
|
||||
}
|
||||
|
||||
// 购买
|
||||
.buy-box {
|
||||
.add-btn {
|
||||
width: 240rpx;
|
||||
height: 72rpx;
|
||||
font-weight: 500;
|
||||
font-size: 30rpx;
|
||||
border-radius: 12rpx 0 0 12rpx;
|
||||
background-color: #fa8735;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.buy-btn {
|
||||
width: 240rpx;
|
||||
height: 72rpx;
|
||||
font-weight: 500;
|
||||
font-size: 30rpx;
|
||||
border-radius: 0 12rpx 12rpx 0;
|
||||
background: #fe3b48;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.disabled-btn {
|
||||
width: 428rpx;
|
||||
height: 72rpx;
|
||||
border-radius: 40rpx;
|
||||
background: #999999;
|
||||
color: $white;
|
||||
}
|
||||
}
|
||||
|
||||
.model-box {
|
||||
height: 60vh;
|
||||
|
||||
.model-content {
|
||||
height: 56vh;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
|
||||
// 限时折扣
|
||||
.discount {
|
||||
width: 750rpx;
|
||||
height: 100rpx;
|
||||
// background-color: red;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.disImg {
|
||||
width: 750rpx;
|
||||
height: 100rpx;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
.discountCont {
|
||||
width: 680rpx;
|
||||
height: 90rpx;
|
||||
margin: 10rpx auto 0 auto;
|
||||
// background-color: gold;
|
||||
}
|
||||
|
||||
.disContT {
|
||||
width: 680rpx;
|
||||
height: 50rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.disContT1 {
|
||||
// width: 400rpx;
|
||||
// height: 50rpx;
|
||||
// background-color: green;
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.disContT2 {
|
||||
width: 200rpx;
|
||||
height: 50rpx;
|
||||
line-height: 50rpx;
|
||||
// background-color: gold;
|
||||
font-size: 30rpx;
|
||||
text-align: end;
|
||||
color: #ff393a;
|
||||
font-weight: bolder;
|
||||
font-style: oblique 20deg;
|
||||
letter-spacing: 0.1rem;
|
||||
}
|
||||
|
||||
.disContT1P {
|
||||
color: white;
|
||||
font-size: 44rpx;
|
||||
}
|
||||
|
||||
.disContT1End {
|
||||
// width: 180rpx;
|
||||
padding: 0 20rpx;
|
||||
height: 36rpx;
|
||||
line-height: 36rpx;
|
||||
text-align: center;
|
||||
background-color: #fee2be;
|
||||
color: #f71b1b;
|
||||
font-size: 23rpx;
|
||||
border-radius: 20rpx;
|
||||
margin-left: 26rpx;
|
||||
}
|
||||
|
||||
.disContB {
|
||||
width: 680rpx;
|
||||
height: 40rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: 20rpx;
|
||||
color: white;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.disContB1 {
|
||||
width: 300rpx;
|
||||
height: 40rpx;
|
||||
line-height: 40rpx;
|
||||
color: #ffcccc;
|
||||
font-size: 24rpx;
|
||||
// 删除线
|
||||
text-decoration: line-through;
|
||||
padding-left: 6rpx;
|
||||
}
|
||||
|
||||
.disContB2 {
|
||||
width: 300rpx;
|
||||
height: 40rpx;
|
||||
line-height: 40rpx;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.label {
|
||||
display: inline-block;
|
||||
font-size: 20rpx;
|
||||
color: #ff5040;
|
||||
border: 1px solid #ff5040;
|
||||
border-radius: 8rpx;
|
||||
padding: 0 8rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,407 @@
|
||||
<template>
|
||||
<s-layout
|
||||
navbar="normal"
|
||||
:leftWidth="0"
|
||||
:rightWidth="0"
|
||||
tools="search"
|
||||
:defaultSearch="state.keyword"
|
||||
@search="onSearch"
|
||||
>
|
||||
<!-- 筛选 -->
|
||||
<su-sticky bgColor="#fff">
|
||||
<view class="ss-flex">
|
||||
<view class="ss-flex-1">
|
||||
<su-tabs
|
||||
:list="state.tabList"
|
||||
:scrollable="false"
|
||||
@change="onTabsChange"
|
||||
:current="state.currentTab"
|
||||
/>
|
||||
</view>
|
||||
<view class="list-icon" @tap="state.iconStatus = !state.iconStatus">
|
||||
<text v-if="state.iconStatus" class="sicon-goods-list" />
|
||||
<text v-else class="sicon-goods-card" />
|
||||
</view>
|
||||
</view>
|
||||
</su-sticky>
|
||||
|
||||
<!-- 弹窗 -->
|
||||
<su-popup
|
||||
:show="state.showFilter"
|
||||
type="top"
|
||||
round="10"
|
||||
:space="sys_navBar + 38"
|
||||
backgroundColor="#F6F6F6"
|
||||
:zIndex="10"
|
||||
@close="state.showFilter = false"
|
||||
>
|
||||
<view class="filter-list-box">
|
||||
<view
|
||||
class="filter-item"
|
||||
v-for="(item, index) in state.tabList[state.currentTab].list"
|
||||
:key="item.value"
|
||||
:class="[{ 'filter-item-active': index === state.curFilter }]"
|
||||
@tap="onFilterItem(index)"
|
||||
>
|
||||
{{ item.label }}
|
||||
</view>
|
||||
</view>
|
||||
</su-popup>
|
||||
|
||||
<!-- 情况一:单列布局 -->
|
||||
<view v-if="state.iconStatus && state.pagination.total > 0" class="goods-list ss-m-t-20">
|
||||
<view
|
||||
class="ss-p-l-20 ss-p-r-20 ss-m-b-20"
|
||||
v-for="item in state.pagination.list"
|
||||
:key="item.id"
|
||||
>
|
||||
<s-goods-column
|
||||
class=""
|
||||
size="lg"
|
||||
:data="item"
|
||||
:topRadius="10"
|
||||
:bottomRadius="10"
|
||||
@click="sheep.$router.go('/pages/goods/index', { id: item.id })"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 情况二:双列布局 -->
|
||||
<view
|
||||
v-if="!state.iconStatus && state.pagination.total > 0"
|
||||
class="ss-flex ss-flex-wrap ss-p-x-20 ss-m-t-20 ss-col-top"
|
||||
>
|
||||
<view class="goods-list-box">
|
||||
<view class="left-list" v-for="item in state.leftGoodsList" :key="item.id">
|
||||
<s-goods-column
|
||||
class="goods-md-box"
|
||||
size="md"
|
||||
:data="item"
|
||||
:topRadius="10"
|
||||
:bottomRadius="10"
|
||||
@click="sheep.$router.go('/pages/goods/index', { id: item.id })"
|
||||
@getHeight="mountMasonry($event, 'left')"
|
||||
>
|
||||
<template v-slot:cart>
|
||||
<button class="ss-reset-button cart-btn" />
|
||||
</template>
|
||||
</s-goods-column>
|
||||
</view>
|
||||
</view>
|
||||
<view class="goods-list-box">
|
||||
<view class="right-list" v-for="item in state.rightGoodsList" :key="item.id">
|
||||
<s-goods-column
|
||||
class="goods-md-box"
|
||||
size="md"
|
||||
:topRadius="10"
|
||||
:bottomRadius="10"
|
||||
:data="item"
|
||||
@click="sheep.$router.go('/pages/goods/index', { id: item.id })"
|
||||
@getHeight="mountMasonry($event, 'right')"
|
||||
>
|
||||
<template v-slot:cart>
|
||||
<button class="ss-reset-button cart-btn" />
|
||||
</template>
|
||||
</s-goods-column>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<uni-load-more
|
||||
v-if="state.pagination.total > 0"
|
||||
:status="state.loadStatus"
|
||||
:content-text="{
|
||||
contentdown: '上拉加载更多',
|
||||
}"
|
||||
@tap="loadMore"
|
||||
/>
|
||||
<s-empty v-if="state.pagination.total === 0" icon="/static/soldout-empty.png" text="暂无商品" />
|
||||
</s-layout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref } from 'vue';
|
||||
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
||||
import sheep from '@/sheep';
|
||||
import _ from 'lodash-es';
|
||||
import { resetPagination } from '@/sheep/helper/utils';
|
||||
import SpuApi from '@/sheep/api/product/spu';
|
||||
import OrderApi from '@/sheep/api/trade/order';
|
||||
import { appendSettlementProduct } from '@/sheep/hooks/useGoods';
|
||||
|
||||
const sys_navBar = sheep.$platform.navbar;
|
||||
const emits = defineEmits(['close', 'change']);
|
||||
|
||||
const state = reactive({
|
||||
pagination: {
|
||||
list: [],
|
||||
total: 0,
|
||||
pageNo: 1,
|
||||
pageSize: 6,
|
||||
},
|
||||
currentSort: undefined,
|
||||
currentOrder: undefined,
|
||||
currentTab: 0, // 当前选中的 tab
|
||||
curFilter: 0, // 当前选中的 list 筛选项
|
||||
showFilter: false,
|
||||
iconStatus: false, // true - 单列布局;false - 双列布局
|
||||
keyword: '',
|
||||
categoryId: 0,
|
||||
tabList: [
|
||||
{
|
||||
name: '综合推荐',
|
||||
list: [
|
||||
{
|
||||
label: '综合推荐',
|
||||
},
|
||||
{
|
||||
label: '价格升序',
|
||||
sort: 'price',
|
||||
order: true,
|
||||
},
|
||||
{
|
||||
label: '价格降序',
|
||||
sort: 'price',
|
||||
order: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: '销量',
|
||||
sort: 'salesCount',
|
||||
order: false,
|
||||
},
|
||||
{
|
||||
name: '新品优先',
|
||||
value: 'createTime',
|
||||
order: false,
|
||||
},
|
||||
],
|
||||
loadStatus: '',
|
||||
leftGoodsList: [], // 双列布局 - 左侧商品
|
||||
rightGoodsList: [], // 双列布局 - 右侧商品
|
||||
});
|
||||
|
||||
// 加载瀑布流
|
||||
let count = 0;
|
||||
let leftHeight = 0;
|
||||
let rightHeight = 0;
|
||||
|
||||
// 处理双列布局 leftGoodsList + rightGoodsList
|
||||
function mountMasonry(height = 0, where = 'left') {
|
||||
if (where === 'left') {
|
||||
leftHeight += height;
|
||||
} else {
|
||||
rightHeight += height;
|
||||
}
|
||||
if (!state.pagination.list[count]) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (leftHeight <= rightHeight) {
|
||||
state.leftGoodsList.push(state.pagination.list[count]);
|
||||
} else {
|
||||
state.rightGoodsList.push(state.pagination.list[count]);
|
||||
}
|
||||
count++;
|
||||
}
|
||||
|
||||
// 清空列表
|
||||
function emptyList() {
|
||||
resetPagination(state.pagination);
|
||||
state.leftGoodsList = [];
|
||||
state.rightGoodsList = [];
|
||||
count = 0;
|
||||
leftHeight = 0;
|
||||
rightHeight = 0;
|
||||
}
|
||||
|
||||
// 搜索
|
||||
function onSearch(e) {
|
||||
state.keyword = e;
|
||||
emptyList();
|
||||
getList(state.currentSort, state.currentOrder);
|
||||
}
|
||||
|
||||
// 点击
|
||||
function onTabsChange(e) {
|
||||
// 如果点击的是【综合推荐】,则直接展开或者收起筛选项
|
||||
if (state.tabList[e.index].list) {
|
||||
state.currentTab = e.index;
|
||||
state.showFilter = !state.showFilter;
|
||||
return;
|
||||
}
|
||||
state.showFilter = false;
|
||||
|
||||
// 如果点击的是【销量】或者【新品优先】,则直接切换 tab
|
||||
if (e.index === state.currentTab) {
|
||||
return;
|
||||
}
|
||||
|
||||
state.currentTab = e.index;
|
||||
state.currentSort = e.sort;
|
||||
state.currentOrder = e.order;
|
||||
emptyList();
|
||||
getList(e.sort, e.order);
|
||||
}
|
||||
|
||||
// 点击 tab 的 list 筛选项
|
||||
const onFilterItem = (val) => {
|
||||
// 如果点击的是当前的筛选项,则直接收起筛选项,不要加载数据
|
||||
// 这里选择 tabList[0] 的原因,是目前只有它有 list
|
||||
if (
|
||||
state.currentSort === state.tabList[0].list[val].sort &&
|
||||
state.currentOrder === state.tabList[0].list[val].order
|
||||
) {
|
||||
state.showFilter = false;
|
||||
return;
|
||||
}
|
||||
state.showFilter = false;
|
||||
|
||||
// 设置筛选条件
|
||||
state.curFilter = val;
|
||||
state.tabList[0].name = state.tabList[0].list[val].label;
|
||||
state.currentSort = state.tabList[0].list[val].sort;
|
||||
state.currentOrder = state.tabList[0].list[val].order;
|
||||
// 清空 + 加载数据
|
||||
emptyList();
|
||||
getList();
|
||||
};
|
||||
|
||||
async function getList() {
|
||||
state.loadStatus = 'loading';
|
||||
const { code, data } = await SpuApi.getSpuPage({
|
||||
pageNo: state.pagination.pageNo,
|
||||
pageSize: state.pagination.pageSize,
|
||||
sortField: state.currentSort,
|
||||
sortAsc: state.currentOrder,
|
||||
categoryId: state.categoryId,
|
||||
keyword: state.keyword,
|
||||
});
|
||||
if (code !== 0) {
|
||||
return;
|
||||
}
|
||||
// 拼接结算信息(营销)
|
||||
await OrderApi.getSettlementProduct(data.list.map((item) => item.id).join(',')).then((res) => {
|
||||
if (res.code !== 0) {
|
||||
return;
|
||||
}
|
||||
appendSettlementProduct(data.list, res.data);
|
||||
});
|
||||
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';
|
||||
mountMasonry();
|
||||
}
|
||||
|
||||
// 加载更多
|
||||
function loadMore() {
|
||||
if (state.loadStatus === 'noMore') {
|
||||
return;
|
||||
}
|
||||
state.pagination.pageNo++;
|
||||
getList(state.currentSort, state.currentOrder);
|
||||
}
|
||||
|
||||
onLoad((options) => {
|
||||
state.categoryId = options.categoryId;
|
||||
state.keyword = options.keyword;
|
||||
getList(state.currentSort, state.currentOrder);
|
||||
});
|
||||
|
||||
// 上拉加载更多
|
||||
onReachBottom(() => {
|
||||
loadMore();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.goods-list-box {
|
||||
width: 50%;
|
||||
box-sizing: border-box;
|
||||
|
||||
.left-list {
|
||||
margin-right: 10rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.right-list {
|
||||
margin-left: 10rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.goods-box {
|
||||
&:nth-last-of-type(1) {
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
|
||||
&:nth-child(2n) {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.list-icon {
|
||||
width: 80rpx;
|
||||
|
||||
.sicon-goods-card {
|
||||
font-size: 40rpx;
|
||||
}
|
||||
|
||||
.sicon-goods-list {
|
||||
font-size: 40rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.goods-card {
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
|
||||
.list-filter-tabs {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.filter-list-box {
|
||||
padding: 28rpx 52rpx;
|
||||
|
||||
.filter-item {
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
line-height: normal;
|
||||
margin-bottom: 24rpx;
|
||||
|
||||
&:nth-last-child(1) {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.filter-item-active {
|
||||
color: var(--ui-BG-Main);
|
||||
}
|
||||
}
|
||||
|
||||
.tab-item {
|
||||
height: 50px;
|
||||
position: relative;
|
||||
z-index: 11;
|
||||
|
||||
.tab-title {
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
.cur-tab-title {
|
||||
font-weight: $font-weight-bold;
|
||||
}
|
||||
|
||||
.tab-line {
|
||||
width: 60rpx;
|
||||
height: 6rpx;
|
||||
border-radius: 6rpx;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
bottom: 10rpx;
|
||||
background-color: var(--ui-BG-Main);
|
||||
z-index: 12;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,109 @@
|
||||
<template>
|
||||
<s-pages class="set-wrap" title="搜索" color="#ffffff">
|
||||
<card_search :modelValue="searchText" class="goods_search" @search="search"></card_search>
|
||||
|
||||
<pages_commodity
|
||||
class="commodity"
|
||||
ref="pageCommodity"
|
||||
:dataList="dataObj.dataList"
|
||||
@getData="getData"
|
||||
:subclassification="subclassification"
|
||||
:height="height"
|
||||
source="search"
|
||||
:type="2"
|
||||
></pages_commodity>
|
||||
</s-pages>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive } from 'vue';
|
||||
import SpuApi from '@/sheep/api/product/spu';
|
||||
import CategoryApi from '@/sheep/api/product/category';
|
||||
import { handleTree } from '@/sheep/helper/utils';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
let pageCommodity = ref(null);
|
||||
let height = ref('100%');
|
||||
let sysInfo = uni.getSystemInfoSync();
|
||||
const windowHeight = sysInfo.windowHeight;
|
||||
height.value =
|
||||
windowHeight -
|
||||
sysInfo.statusBarHeight -
|
||||
uni.upx2px(88) -
|
||||
uni.upx2px(80) -
|
||||
uni.upx2px(96) +
|
||||
'px';
|
||||
const subclassification = ref([]);
|
||||
const dataObj = reactive({
|
||||
categoryList: [], // 商品分类树
|
||||
dataList: [], // 商品列表
|
||||
});
|
||||
const getData = async (mescroll) => {
|
||||
let res = await SpuApi.getSpuPage({
|
||||
pageNo: mescroll?.num || 1,
|
||||
pageSize: mescroll?.size || 10,
|
||||
keyword: searchText.value,
|
||||
...mescroll.params,
|
||||
});
|
||||
if (res.code !== 0) {
|
||||
pageCommodity.value.requestResult(false);
|
||||
return;
|
||||
}
|
||||
|
||||
const curPageData = res.data.list || []; // 当前页数据
|
||||
// if (curPageData.length) {
|
||||
// curPageData.forEach((item) => {
|
||||
// item.categoryText = changeArr(item.categoryId, dataObj.categoryList);
|
||||
// });
|
||||
// }
|
||||
if (mescroll?.num == 1) dataObj.dataList = []; // 第一页需手动制空列表
|
||||
dataObj.dataList = dataObj.dataList.concat(curPageData); //追加新数据
|
||||
// mescroll.endSuccess(curPageData.length); // 请求成功, 结束加载
|
||||
pageCommodity.value.requestResult(true, curPageData.length);
|
||||
};
|
||||
let searchText = ref(null);
|
||||
const search = (text) => {
|
||||
searchText.value = text;
|
||||
pageCommodity.value.changeData();
|
||||
};
|
||||
// 获取分类
|
||||
const getcategoryList = async () => {
|
||||
const { code, data } = await CategoryApi.getCategoryList();
|
||||
if (code !== 0) {
|
||||
return;
|
||||
}
|
||||
// dataObj.categoryList = data;
|
||||
dataObj.categoryList = handleTree(data);
|
||||
console.log(dataObj.categoryList);
|
||||
if (dataObj.categoryList.length) {
|
||||
dataObj.c_id = dataObj.categoryList[0].id;
|
||||
}
|
||||
classifyChange(0);
|
||||
};
|
||||
const classifyChange = (i) => {
|
||||
dataObj.index = i;
|
||||
dataObj.c_id = dataObj.categoryList[i]?.id;
|
||||
subclassification.value = dataObj.categoryList[i]?.children || [];
|
||||
|
||||
// upCallback({
|
||||
// num: 1,
|
||||
// size: 10,
|
||||
// });
|
||||
|
||||
// pageCommodity.value.changeData()
|
||||
if (pageCommodity.value) {
|
||||
pageCommodity.value.clearAll();
|
||||
}
|
||||
};
|
||||
onLoad(async (e) => {
|
||||
searchText.value = e.keyword || '';
|
||||
let res = await getcategoryList();
|
||||
// upCallback();
|
||||
});
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.goods_search {
|
||||
padding: 0 32rpx;
|
||||
box-sizing: border-box;
|
||||
background-color: #fff;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,483 @@
|
||||
<!-- 秒杀商品详情 -->
|
||||
<template>
|
||||
<s-layout :onShareAppMessage="shareInfo" navbar="goods">
|
||||
<!-- 标题栏 -->
|
||||
<detailNavbar />
|
||||
<!-- 骨架屏 -->
|
||||
<detailSkeleton v-if="state.skeletonLoading" />
|
||||
<!-- 下架/售罄提醒 -->
|
||||
<s-empty
|
||||
v-else-if="
|
||||
state.goodsInfo === null ||
|
||||
state.goodsInfo.activity_type !== PromotionActivityTypeEnum.POINT.type
|
||||
"
|
||||
text="活动不存在或已结束"
|
||||
icon="/static/soldout-empty.png"
|
||||
showAction
|
||||
actionText="再逛逛"
|
||||
actionUrl="/pages/goods/list"
|
||||
/>
|
||||
<block v-else>
|
||||
<view class="detail-swiper-selector">
|
||||
<!-- 商品图轮播 -->
|
||||
<su-swiper
|
||||
class="ss-m-b-14"
|
||||
isPreview
|
||||
:list="state.goodsSwiper"
|
||||
dotStyle="tag"
|
||||
imageMode="widthFix"
|
||||
dotCur="bg-mask-40"
|
||||
:seizeHeight="750"
|
||||
/>
|
||||
|
||||
<!-- 价格+标题 -->
|
||||
<view class="title-card detail-card ss-p-y-40 ss-p-x-20">
|
||||
<view class="ss-flex ss-row-between ss-col-center ss-m-b-18">
|
||||
<view class="price-box ss-flex ss-col-bottom">
|
||||
<image
|
||||
:src="sheep.$url.static('/static/img/shop/goods/score1.svg')"
|
||||
class="point-img"
|
||||
></image>
|
||||
<text class="point-text ss-m-r-16">
|
||||
{{ getShowPrice.point }}
|
||||
{{
|
||||
!getShowPrice.price || getShowPrice.price === 0 ? '' : `+¥${getShowPrice.price}`
|
||||
}}
|
||||
</text>
|
||||
</view>
|
||||
<view class="sales-text">
|
||||
{{ formatExchange(state.goodsInfo.sales_show_type, state.goodsInfo.sales) }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="origin-price-text ss-m-b-60" v-if="state.goodsInfo.marketPrice">
|
||||
原价:¥{{ fen2yuan(state.selectedSku.marketPrice || state.goodsInfo.marketPrice) }}
|
||||
</view>
|
||||
<view class="title-text ss-line-2 ss-m-b-6">{{ state.goodsInfo.name || '' }}</view>
|
||||
<view class="subtitle-text ss-line-1">{{ state.goodsInfo.introduction }}</view>
|
||||
</view>
|
||||
|
||||
<!-- 功能卡片 -->
|
||||
<view class="detail-cell-card detail-card ss-flex-col">
|
||||
<detail-cell-sku :sku="state.selectedSku" @tap="state.showSelectSku = true" />
|
||||
</view>
|
||||
<!-- 规格与数量弹框 -->
|
||||
<s-select-seckill-sku
|
||||
v-model="state.goodsInfo"
|
||||
:show="state.showSelectSku"
|
||||
:single-limit-count="activity.singleLimitCount"
|
||||
@buy="onBuy"
|
||||
@change="onSkuChange"
|
||||
@close="state.showSelectSku = false"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<!-- 评价 -->
|
||||
<detail-comment-card class="detail-comment-selector" :goodsId="state.goodsInfo.id" />
|
||||
<!-- 详情 -->
|
||||
<detail-content-card class="detail-content-selector" :content="state.goodsInfo.description" />
|
||||
|
||||
<!-- 详情tabbar -->
|
||||
<detail-tabbar v-model="state.goodsInfo">
|
||||
<view class="buy-box ss-flex ss-col-center ss-p-r-20">
|
||||
<button
|
||||
class="ss-reset-button origin-price-btn ss-flex-col"
|
||||
v-if="state.goodsInfo.marketPrice"
|
||||
@tap="sheep.$router.go('/pages/goods/index', { id: state.goodsInfo.id })"
|
||||
>
|
||||
<view>
|
||||
<view class="btn-price">{{ fen2yuan(state.goodsInfo.marketPrice) }}</view>
|
||||
<view>原价购买</view>
|
||||
</view>
|
||||
</button>
|
||||
<button
|
||||
class="ss-reset-button btn-box ss-flex-col"
|
||||
@tap="state.showSelectSku = true"
|
||||
:class="state.goodsInfo.stock != 0 ? 'check-btn-box' : 'disabled-btn-box'"
|
||||
:disabled="state.goodsInfo.stock === 0"
|
||||
>
|
||||
<view class="price-box ss-flex">
|
||||
<image
|
||||
:src="sheep.$url.static('/static/img/shop/goods/score1.svg')"
|
||||
style="width: 36rpx; height: 36rpx; margin: 0 4rpx"
|
||||
></image>
|
||||
<text class="point-text ss-m-r-16">
|
||||
{{ getShowPrice.point }}
|
||||
{{
|
||||
!getShowPrice.price || getShowPrice.price === 0 ? '' : `+¥${getShowPrice.price}`
|
||||
}}
|
||||
</text>
|
||||
</view>
|
||||
<view v-if="state.goodsInfo.stock === 0">已售罄</view>
|
||||
<view v-else>立即兑换</view>
|
||||
</button>
|
||||
</view>
|
||||
</detail-tabbar>
|
||||
</block>
|
||||
</s-layout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, reactive, ref, unref } from 'vue';
|
||||
import { onLoad, onPageScroll } from '@dcloudio/uni-app';
|
||||
import sheep from '@/sheep';
|
||||
import { isEmpty } from 'lodash-es';
|
||||
import { fen2yuan, formatExchange, formatGoodsSwiper } from '@/sheep/hooks/useGoods';
|
||||
import detailNavbar from './components/detail/detail-navbar.vue';
|
||||
import detailCellSku from './components/detail/detail-cell-sku.vue';
|
||||
import detailTabbar from './components/detail/detail-tabbar.vue';
|
||||
import detailSkeleton from './components/detail/detail-skeleton.vue';
|
||||
import detailCommentCard from './components/detail/detail-comment-card.vue';
|
||||
import detailContentCard from './components/detail/detail-content-card.vue';
|
||||
import SpuApi from '@/sheep/api/product/spu';
|
||||
import { PromotionActivityTypeEnum, SharePageEnum } from '@/sheep/helper/const';
|
||||
import PointApi from '@/sheep/api/promotion/point';
|
||||
|
||||
const headerBg = sheep.$url.css('/static/img/shop/goods/score-bg.png');
|
||||
const btnBg = sheep.$url.css('/static/img/shop/goods/seckill-btn.png');
|
||||
const disabledBtnBg = sheep.$url.css('/static/img/shop/goods/activity-btn-disabled.png');
|
||||
const seckillBg = sheep.$url.css('/static/img/shop/goods/seckill-tip-bg.png');
|
||||
const grouponBg = sheep.$url.css('/static/img/shop/goods/groupon-tip-bg.png');
|
||||
|
||||
onPageScroll(() => {});
|
||||
const state = reactive({
|
||||
skeletonLoading: true,
|
||||
goodsInfo: {},
|
||||
showSelectSku: false,
|
||||
goodsSwiper: [],
|
||||
selectedSku: {},
|
||||
showModel: false,
|
||||
total: 0,
|
||||
price: '',
|
||||
});
|
||||
|
||||
// 规格变更
|
||||
function onSkuChange(e) {
|
||||
state.selectedSku = e;
|
||||
}
|
||||
|
||||
// 立即购买
|
||||
function onBuy(sku) {
|
||||
sheep.$router.go('/pages/order/confirm', {
|
||||
data: JSON.stringify({
|
||||
order_type: 'goods',
|
||||
buy_type: 'point',
|
||||
pointActivityId: activity.value.id,
|
||||
items: [
|
||||
{
|
||||
skuId: sku.id,
|
||||
count: sku.count,
|
||||
},
|
||||
],
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
// 分享信息
|
||||
const shareInfo = computed(() => {
|
||||
if (isEmpty(unref(activity))) return {};
|
||||
return sheep.$platform.share.getShareInfo(
|
||||
{
|
||||
title: activity.value.name,
|
||||
image: sheep.$url.cdn(state.goodsInfo.picUrl),
|
||||
params: {
|
||||
page: SharePageEnum.POINT.value,
|
||||
query: activity.value.id,
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'goods', // 商品海报
|
||||
title: activity.value.name, // 商品标题
|
||||
image: sheep.$url.cdn(state.goodsInfo.picUrl), // 商品主图
|
||||
price: (getShowPrice.value.price || 0) + ` + ${getShowPrice.value.point} 积分`, // 积分价格
|
||||
marketPrice: fen2yuan(state.goodsInfo.marketPrice), // 商品原价
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
const activity = ref();
|
||||
|
||||
const getShowPrice = computed(() => {
|
||||
if (!isEmpty(state.selectedSku)) {
|
||||
const sku = state.selectedSku;
|
||||
return {
|
||||
point: sku.point,
|
||||
price: !sku.pointPrice ? '' : fen2yuan(sku.pointPrice),
|
||||
};
|
||||
}
|
||||
return {
|
||||
point: activity.value.point,
|
||||
price: !activity.value.price ? '' : fen2yuan(activity.value.price),
|
||||
};
|
||||
});
|
||||
|
||||
// 查询活动
|
||||
const getActivity = async (id) => {
|
||||
const { data } = await PointApi.getPointActivity(id);
|
||||
if (!data) {
|
||||
state.goodsInfo = null;
|
||||
state.skeletonLoading = false;
|
||||
return;
|
||||
}
|
||||
activity.value = data;
|
||||
// 查询商品
|
||||
await getSpu(data.spuId);
|
||||
};
|
||||
|
||||
// 查询商品
|
||||
const getSpu = async (id) => {
|
||||
const { data } = await SpuApi.getSpuDetail(id);
|
||||
if (!data) {
|
||||
state.goodsInfo = null;
|
||||
state.skeletonLoading = false;
|
||||
return;
|
||||
}
|
||||
data.activity_type = PromotionActivityTypeEnum.POINT.type;
|
||||
state.goodsInfo = data;
|
||||
state.goodsInfo.stock = Math.min(data.stock, activity.value.stock);
|
||||
// 处理轮播图
|
||||
state.goodsSwiper = formatGoodsSwiper(state.goodsInfo.sliderPicUrls);
|
||||
|
||||
// 价格、库存使用活动的
|
||||
data.skus.forEach((sku) => {
|
||||
const product = activity.value.products.find((product) => product.skuId === sku.id);
|
||||
if (product) {
|
||||
sku.point = product.point;
|
||||
sku.pointPrice = product.price;
|
||||
sku.stock = Math.min(sku.stock, product.stock);
|
||||
// 设置限购数量
|
||||
sku.limitCount = product.count;
|
||||
} else {
|
||||
// 找不到可能是没配置
|
||||
sku.stock = 0;
|
||||
}
|
||||
});
|
||||
|
||||
state.skeletonLoading = false;
|
||||
};
|
||||
|
||||
onLoad((options) => {
|
||||
// 非法参数
|
||||
if (!options.id) {
|
||||
state.goodsInfo = null;
|
||||
state.skeletonLoading = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// 查询活动
|
||||
getActivity(options.id);
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.disabled-btn-box[disabled] {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.detail-card {
|
||||
background-color: $white;
|
||||
margin: 14rpx 20rpx;
|
||||
border-radius: 10rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
// 价格标题卡片
|
||||
.title-card {
|
||||
width: 710rpx;
|
||||
box-sizing: border-box;
|
||||
background-size: 100% 100%;
|
||||
border-radius: 10rpx;
|
||||
background-image: v-bind(headerBg);
|
||||
background-repeat: no-repeat;
|
||||
|
||||
.price-box {
|
||||
.point-img {
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
margin: 0 4rpx;
|
||||
}
|
||||
|
||||
.point-text {
|
||||
font-size: 42rpx;
|
||||
font-weight: 500;
|
||||
color: #ff3000;
|
||||
line-height: 36rpx;
|
||||
font-family: OPPOSANS;
|
||||
}
|
||||
|
||||
.price-text {
|
||||
font-size: 42rpx;
|
||||
font-weight: 500;
|
||||
color: #ff3000;
|
||||
line-height: 36rpx;
|
||||
font-family: OPPOSANS;
|
||||
}
|
||||
}
|
||||
|
||||
.origin-price-text {
|
||||
font-size: 26rpx;
|
||||
font-weight: 400;
|
||||
text-decoration: line-through;
|
||||
color: $gray-c;
|
||||
font-family: OPPOSANS;
|
||||
}
|
||||
|
||||
.sales-text {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: $gray-c;
|
||||
}
|
||||
|
||||
.discounts-box {
|
||||
.discounts-tag {
|
||||
padding: 4rpx 10rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
border-radius: 4rpx;
|
||||
color: var(--ui-BG-Main);
|
||||
// background: rgba(#2aae67, 0.05);
|
||||
background: var(--ui-BG-Main-tag);
|
||||
}
|
||||
|
||||
.discounts-title {
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: var(--ui-BG-Main);
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.cicon-forward {
|
||||
color: var(--ui-BG-Main);
|
||||
font-size: 24rpx;
|
||||
line-height: normal;
|
||||
margin-top: 4rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.title-text {
|
||||
font-size: 30rpx;
|
||||
font-weight: bold;
|
||||
line-height: 42rpx;
|
||||
}
|
||||
|
||||
.subtitle-text {
|
||||
font-size: 26rpx;
|
||||
font-weight: 400;
|
||||
color: $dark-9;
|
||||
line-height: 42rpx;
|
||||
}
|
||||
}
|
||||
|
||||
// 购买
|
||||
.buy-box {
|
||||
.check-btn-box {
|
||||
width: 248rpx;
|
||||
height: 80rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 600;
|
||||
margin-left: -36rpx;
|
||||
background-image: v-bind(btnBg);
|
||||
background-repeat: no-repeat;
|
||||
background-size: 100% 100%;
|
||||
color: #ffffff;
|
||||
line-height: normal;
|
||||
border-radius: 0px 40rpx 40rpx 0px;
|
||||
}
|
||||
|
||||
.disabled-btn-box {
|
||||
width: 248rpx;
|
||||
height: 80rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 600;
|
||||
margin-left: -36rpx;
|
||||
background-image: v-bind(disabledBtnBg);
|
||||
background-repeat: no-repeat;
|
||||
background-size: 100% 100%;
|
||||
color: #999999;
|
||||
line-height: normal;
|
||||
border-radius: 0px 40rpx 40rpx 0px;
|
||||
}
|
||||
|
||||
.btn-price {
|
||||
font-family: OPPOSANS;
|
||||
|
||||
&::before {
|
||||
content: '¥';
|
||||
}
|
||||
}
|
||||
|
||||
.origin-price-btn {
|
||||
width: 236rpx;
|
||||
height: 80rpx;
|
||||
background: rgba(#ff5651, 0.1);
|
||||
color: #ff6000;
|
||||
border-radius: 40rpx 0px 0px 40rpx;
|
||||
line-height: normal;
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
|
||||
.no-original {
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.btn-title {
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//秒杀卡片
|
||||
.seckill-box {
|
||||
background: v-bind(seckillBg) no-repeat;
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
|
||||
.groupon-box {
|
||||
background: v-bind(grouponBg) no-repeat;
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
|
||||
//活动卡片
|
||||
.activity-box {
|
||||
width: 100%;
|
||||
height: 80rpx;
|
||||
box-sizing: border-box;
|
||||
margin-bottom: 10rpx;
|
||||
|
||||
.activity-title {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
line-height: 42rpx;
|
||||
|
||||
.activity-icon {
|
||||
width: 38rpx;
|
||||
height: 38rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.activity-go {
|
||||
width: 70rpx;
|
||||
height: 32rpx;
|
||||
background: #ffffff;
|
||||
border-radius: 16rpx;
|
||||
font-weight: 500;
|
||||
color: #ff6000;
|
||||
font-size: 24rpx;
|
||||
line-height: normal;
|
||||
}
|
||||
}
|
||||
|
||||
.model-box {
|
||||
.title {
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,575 @@
|
||||
<!-- 秒杀商品详情 -->
|
||||
<template>
|
||||
<s-layout :onShareAppMessage="shareInfo" navbar="goods">
|
||||
<!-- 标题栏 -->
|
||||
<detailNavbar />
|
||||
<!-- 骨架屏 -->
|
||||
<detailSkeleton v-if="state.skeletonLoading" />
|
||||
<!-- 下架/售罄提醒 -->
|
||||
<s-empty
|
||||
v-else-if="
|
||||
state.goodsInfo === null || state.goodsInfo.activity_type !== 'seckill' || endTime.ms <= 0
|
||||
"
|
||||
text="活动不存在或已结束"
|
||||
icon="/static/soldout-empty.png"
|
||||
showAction
|
||||
actionText="再逛逛"
|
||||
actionUrl="/pages/goods/list"
|
||||
/>
|
||||
<block v-else>
|
||||
<view class="detail-swiper-selector">
|
||||
<!-- 商品图轮播 -->
|
||||
<su-swiper
|
||||
class="ss-m-b-14"
|
||||
isPreview
|
||||
:list="state.goodsSwiper"
|
||||
dotStyle="tag"
|
||||
imageMode="widthFix"
|
||||
dotCur="bg-mask-40"
|
||||
:seizeHeight="750"
|
||||
/>
|
||||
|
||||
<!-- 价格+标题 -->
|
||||
<view class="title-card ss-m-y-14 ss-m-x-20 ss-p-x-20 ss-p-y-34">
|
||||
<view class="price-box ss-flex ss-row-between ss-m-b-18">
|
||||
<view class="ss-flex">
|
||||
<view class="price-text ss-m-r-16">
|
||||
{{ fen2yuan(state.selectedSku.price || state.goodsInfo.price) }}
|
||||
</view>
|
||||
<view class="tig ss-flex ss-col-center">
|
||||
<view class="tig-icon ss-flex ss-col-center ss-row-center">
|
||||
<text class="cicon-alarm"></text>
|
||||
</view>
|
||||
<view class="tig-title">秒杀价</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="countdown-box" v-if="endTime.ms > 0">
|
||||
<view class="countdown-title ss-m-b-20">距结束仅剩</view>
|
||||
<view class="ss-flex countdown-time">
|
||||
<view class="ss-flex countdown-h">{{ endTime.h }}</view>
|
||||
<view class="ss-m-x-4">:</view>
|
||||
<view class="countdown-num ss-flex ss-row-center">{{ endTime.m }}</view>
|
||||
<view class="ss-m-x-4">:</view>
|
||||
<view class="countdown-num ss-flex ss-row-center">{{ endTime.s }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="countdown-title" v-else> 活动已结束 </view>
|
||||
</view>
|
||||
<view class="ss-flex ss-row-between ss-m-b-60">
|
||||
<view class="origin-price ss-flex ss-col-center" v-if="state.goodsInfo.marketPrice">
|
||||
原价
|
||||
<view class="origin-price-text">
|
||||
{{ fen2yuan(state.selectedSku.marketPrice || state.goodsInfo.marketPrice) }}
|
||||
</view>
|
||||
</view>
|
||||
<detail-progress :percent="state.percent" />
|
||||
</view>
|
||||
|
||||
<view class="title-text ss-line-2 ss-m-b-6">{{ state.goodsInfo.name || '' }}</view>
|
||||
<view class="subtitle-text ss-line-1">{{ state.goodsInfo.introduction }}</view>
|
||||
</view>
|
||||
|
||||
<!-- 功能卡片 -->
|
||||
<view class="detail-cell-card detail-card ss-flex-col">
|
||||
<detail-cell-sku :sku="state.selectedSku" @tap="state.showSelectSku = true" />
|
||||
</view>
|
||||
<!-- 规格与数量弹框 -->
|
||||
<s-select-seckill-sku
|
||||
v-model="state.goodsInfo"
|
||||
:show="state.showSelectSku"
|
||||
:single-limit-count="activity.singleLimitCount"
|
||||
@buy="onBuy"
|
||||
@change="onSkuChange"
|
||||
@close="state.showSelectSku = false"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<!-- 评价 -->
|
||||
<detail-comment-card class="detail-comment-selector" :goodsId="state.goodsInfo.id" />
|
||||
<!-- 详情 -->
|
||||
<detail-content-card class="detail-content-selector" :content="state.goodsInfo.description" />
|
||||
|
||||
<!-- 详情tabbar -->
|
||||
<detail-tabbar v-model="state.goodsInfo">
|
||||
<!-- TODO: 缺货中 已售罄 判断 设计-->
|
||||
<view class="buy-box ss-flex ss-col-center ss-p-r-20">
|
||||
<button
|
||||
class="ss-reset-button origin-price-btn ss-flex-col"
|
||||
v-if="state.goodsInfo.marketPrice"
|
||||
@tap="sheep.$router.go('/pages/goods/index', { id: state.goodsInfo.id })"
|
||||
>
|
||||
<view>
|
||||
<view class="btn-price">{{ fen2yuan(state.goodsInfo.marketPrice) }}</view>
|
||||
<view>原价购买</view>
|
||||
</view>
|
||||
</button>
|
||||
<button v-else class="ss-reset-button origin-price-btn ss-flex-col">
|
||||
<view
|
||||
class="no-original"
|
||||
:class="
|
||||
state.goodsInfo.stock === 0 || timeStatusEnum !== TimeStatusEnum.STARTED ? '' : ''
|
||||
"
|
||||
>
|
||||
秒杀价
|
||||
</view>
|
||||
</button>
|
||||
<button
|
||||
class="ss-reset-button btn-box ss-flex-col"
|
||||
@tap="state.showSelectSku = true"
|
||||
:class="
|
||||
timeStatusEnum === TimeStatusEnum.STARTED && state.goodsInfo.stock != 0
|
||||
? 'check-btn-box'
|
||||
: 'disabled-btn-box'
|
||||
"
|
||||
:disabled="state.goodsInfo.stock === 0 || timeStatusEnum !== TimeStatusEnum.STARTED"
|
||||
>
|
||||
<view class="btn-price">{{ fen2yuan(state.goodsInfo.price) }}</view>
|
||||
<view v-if="timeStatusEnum === TimeStatusEnum.STARTED">
|
||||
<view v-if="state.goodsInfo.stock === 0">已售罄</view>
|
||||
<view v-else>立即秒杀</view>
|
||||
</view>
|
||||
<view v-else>{{ timeStatusEnum }}</view>
|
||||
</button>
|
||||
</view>
|
||||
</detail-tabbar>
|
||||
</block>
|
||||
</s-layout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, reactive, ref, unref } from 'vue';
|
||||
import { onLoad, onPageScroll } from '@dcloudio/uni-app';
|
||||
import sheep from '@/sheep';
|
||||
import { isEmpty, min } from 'lodash-es';
|
||||
import { fen2yuan, formatGoodsSwiper, useDurationTime } from '@/sheep/hooks/useGoods';
|
||||
import detailNavbar from './components/detail/detail-navbar.vue';
|
||||
import detailCellSku from './components/detail/detail-cell-sku.vue';
|
||||
import detailTabbar from './components/detail/detail-tabbar.vue';
|
||||
import detailSkeleton from './components/detail/detail-skeleton.vue';
|
||||
import detailCommentCard from './components/detail/detail-comment-card.vue';
|
||||
import detailContentCard from './components/detail/detail-content-card.vue';
|
||||
import detailProgress from './components/detail/detail-progress.vue';
|
||||
import SeckillApi from '@/sheep/api/promotion/seckill';
|
||||
import SpuApi from '@/sheep/api/product/spu';
|
||||
import { getTimeStatusEnum, SharePageEnum, TimeStatusEnum } from '@/sheep/helper/const';
|
||||
|
||||
const headerBg = sheep.$url.css('/static/img/shop/goods/seckill-bg.png');
|
||||
const btnBg = sheep.$url.css('/static/img/shop/goods/seckill-btn.png');
|
||||
const disabledBtnBg = sheep.$url.css('/static/img/shop/goods/activity-btn-disabled.png');
|
||||
const seckillBg = sheep.$url.css('/static/img/shop/goods/seckill-tip-bg.png');
|
||||
const grouponBg = sheep.$url.css('/static/img/shop/goods/groupon-tip-bg.png');
|
||||
|
||||
onPageScroll(() => {});
|
||||
const state = reactive({
|
||||
skeletonLoading: true,
|
||||
goodsInfo: {},
|
||||
showSelectSku: false,
|
||||
goodsSwiper: [],
|
||||
selectedSku: {},
|
||||
showModel: false,
|
||||
total: 0,
|
||||
percent: 0,
|
||||
price: '',
|
||||
});
|
||||
|
||||
const endTime = computed(() => {
|
||||
return useDurationTime(activity.value.endTime);
|
||||
});
|
||||
|
||||
// 规格变更
|
||||
function onSkuChange(e) {
|
||||
state.selectedSku = e;
|
||||
}
|
||||
|
||||
// 立即购买
|
||||
function onBuy(sku) {
|
||||
sheep.$router.go('/pages/order/confirm', {
|
||||
data: JSON.stringify({
|
||||
order_type: 'goods',
|
||||
buy_type: 'seckill',
|
||||
seckillActivityId: activity.value.id,
|
||||
items: [
|
||||
{
|
||||
skuId: sku.id,
|
||||
count: sku.count,
|
||||
},
|
||||
],
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
// 分享信息
|
||||
const shareInfo = computed(() => {
|
||||
if (isEmpty(unref(activity))) return {};
|
||||
return sheep.$platform.share.getShareInfo(
|
||||
{
|
||||
title: activity.value.name,
|
||||
image: sheep.$url.cdn(state.goodsInfo.picUrl),
|
||||
params: {
|
||||
page: SharePageEnum.SECKILL.value,
|
||||
query: activity.value.id,
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'goods', // 商品海报
|
||||
title: activity.value.name, // 商品标题
|
||||
image: sheep.$url.cdn(state.goodsInfo.picUrl), // 商品主图
|
||||
price: fen2yuan(state.goodsInfo.price), // 商品价格
|
||||
marketPrice: fen2yuan(state.goodsInfo.marketPrice), // 商品原价
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
const activity = ref();
|
||||
const timeStatusEnum = ref('');
|
||||
|
||||
// 查询活动
|
||||
const getActivity = async (id) => {
|
||||
const { data } = await SeckillApi.getSeckillActivity(id);
|
||||
if (!data) {
|
||||
state.goodsInfo = null;
|
||||
state.skeletonLoading = false;
|
||||
return;
|
||||
}
|
||||
activity.value = data;
|
||||
timeStatusEnum.value = getTimeStatusEnum(activity.value.startTime, activity.value.endTime);
|
||||
state.percent = 100 - (data.stock / data.totalStock) * 100;
|
||||
// 查询商品
|
||||
await getSpu(data.spuId);
|
||||
};
|
||||
|
||||
// 查询商品
|
||||
const getSpu = async (id) => {
|
||||
const { data } = await SpuApi.getSpuDetail(id);
|
||||
if (!data) {
|
||||
state.goodsInfo = null;
|
||||
state.skeletonLoading = false;
|
||||
return;
|
||||
}
|
||||
data.activity_type = 'seckill';
|
||||
state.goodsInfo = data;
|
||||
// 处理轮播图
|
||||
state.goodsSwiper = formatGoodsSwiper(state.goodsInfo.sliderPicUrls);
|
||||
|
||||
// 默认显示最低价
|
||||
state.goodsInfo.price = min([
|
||||
state.goodsInfo.price,
|
||||
...activity.value.products.map((spu) => spu.seckillPrice),
|
||||
]);
|
||||
|
||||
// 价格、库存使用活动的
|
||||
data.skus.forEach((sku) => {
|
||||
const product = activity.value.products.find((product) => product.skuId === sku.id);
|
||||
if (product) {
|
||||
sku.price = product.seckillPrice;
|
||||
sku.stock = Math.min(sku.stock, product.stock);
|
||||
} else {
|
||||
// 找不到可能是没配置,则不能发起秒杀
|
||||
sku.stock = 0;
|
||||
}
|
||||
// 设置限购数量
|
||||
if (activity.value.totalLimitCount > 0 && activity.value.singleLimitCount > 0) {
|
||||
sku.limitCount = Math.min(activity.value.totalLimitCount, activity.value.singleLimitCount);
|
||||
} else if (activity.value.totalLimitCount > 0) {
|
||||
sku.limitCount = activity.value.totalLimitCount;
|
||||
} else if (activity.value.singleLimitCount > 0) {
|
||||
sku.limitCount = activity.value.singleLimitCount;
|
||||
}
|
||||
});
|
||||
|
||||
state.skeletonLoading = false;
|
||||
};
|
||||
|
||||
onLoad((options) => {
|
||||
// 非法参数
|
||||
if (!options.id) {
|
||||
state.goodsInfo = null;
|
||||
state.skeletonLoading = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// 查询活动
|
||||
getActivity(options.id);
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.disabled-btn-box[disabled] {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.detail-card {
|
||||
background-color: $white;
|
||||
margin: 14rpx 20rpx;
|
||||
border-radius: 10rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
// 价格标题卡片
|
||||
.title-card {
|
||||
width: 710rpx;
|
||||
box-sizing: border-box;
|
||||
// height: 320rpx;
|
||||
background-size: 100% 100%;
|
||||
border-radius: 10rpx;
|
||||
background-image: v-bind(headerBg);
|
||||
background-repeat: no-repeat;
|
||||
|
||||
.price-box {
|
||||
.price-text {
|
||||
font-size: 30rpx;
|
||||
font-weight: 500;
|
||||
color: #fff;
|
||||
line-height: normal;
|
||||
font-family: OPPOSANS;
|
||||
|
||||
&::before {
|
||||
content: '¥';
|
||||
font-size: 30rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.origin-price {
|
||||
font-size: 24rpx;
|
||||
font-weight: 400;
|
||||
color: #fff;
|
||||
opacity: 0.7;
|
||||
|
||||
.origin-price-text {
|
||||
text-decoration: line-through;
|
||||
|
||||
font-family: OPPOSANS;
|
||||
|
||||
&::before {
|
||||
content: '¥';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.tig {
|
||||
border: 2rpx solid #ffffff;
|
||||
border-radius: 4rpx;
|
||||
width: 126rpx;
|
||||
height: 38rpx;
|
||||
|
||||
.tig-icon {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
margin-left: -2rpx;
|
||||
background: #ffffff;
|
||||
border-radius: 4rpx 0 0 4rpx;
|
||||
|
||||
.cicon-alarm {
|
||||
font-size: 32rpx;
|
||||
color: #fc6e6f;
|
||||
}
|
||||
}
|
||||
|
||||
.tig-title {
|
||||
width: 86rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
line-height: normal;
|
||||
color: #ffffff;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
|
||||
.countdown-title {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.countdown-time {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
|
||||
.countdown-h {
|
||||
font-size: 24rpx;
|
||||
font-family: OPPOSANS;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
padding: 0 4rpx;
|
||||
height: 40rpx;
|
||||
background: rgba(#000000, 0.1);
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
|
||||
.countdown-num {
|
||||
font-size: 24rpx;
|
||||
font-family: OPPOSANS;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
background: rgba(#000000, 0.1);
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.discounts-box {
|
||||
.discounts-tag {
|
||||
padding: 4rpx 10rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
border-radius: 4rpx;
|
||||
color: var(--ui-BG-Main);
|
||||
// background: rgba(#2aae67, 0.05);
|
||||
background: var(--ui-BG-Main-tag);
|
||||
}
|
||||
|
||||
.discounts-title {
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: var(--ui-BG-Main);
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.cicon-forward {
|
||||
color: var(--ui-BG-Main);
|
||||
font-size: 24rpx;
|
||||
line-height: normal;
|
||||
margin-top: 4rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.title-text {
|
||||
font-size: 30rpx;
|
||||
font-weight: bold;
|
||||
line-height: 42rpx;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.subtitle-text {
|
||||
font-size: 26rpx;
|
||||
font-weight: 400;
|
||||
color: #ffffff;
|
||||
line-height: 42rpx;
|
||||
opacity: 0.9;
|
||||
}
|
||||
}
|
||||
|
||||
// 购买
|
||||
.buy-box {
|
||||
.check-btn-box {
|
||||
width: 248rpx;
|
||||
height: 80rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 600;
|
||||
margin-left: -36rpx;
|
||||
background-image: v-bind(btnBg);
|
||||
background-repeat: no-repeat;
|
||||
background-size: 100% 100%;
|
||||
color: #ffffff;
|
||||
line-height: normal;
|
||||
border-radius: 0px 40rpx 40rpx 0px;
|
||||
}
|
||||
|
||||
.disabled-btn-box {
|
||||
width: 248rpx;
|
||||
height: 80rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 600;
|
||||
margin-left: -36rpx;
|
||||
background-image: v-bind(disabledBtnBg);
|
||||
background-repeat: no-repeat;
|
||||
background-size: 100% 100%;
|
||||
color: #999999;
|
||||
line-height: normal;
|
||||
border-radius: 0px 40rpx 40rpx 0px;
|
||||
}
|
||||
|
||||
.btn-price {
|
||||
font-family: OPPOSANS;
|
||||
|
||||
&::before {
|
||||
content: '¥';
|
||||
}
|
||||
}
|
||||
|
||||
.origin-price-btn {
|
||||
width: 236rpx;
|
||||
height: 80rpx;
|
||||
background: rgba(#ff5651, 0.1);
|
||||
color: #ff6000;
|
||||
border-radius: 40rpx 0px 0px 40rpx;
|
||||
line-height: normal;
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
|
||||
.no-original {
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.btn-title {
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//秒杀卡片
|
||||
.seckill-box {
|
||||
background: v-bind(seckillBg) no-repeat;
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
|
||||
.groupon-box {
|
||||
background: v-bind(grouponBg) no-repeat;
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
|
||||
//活动卡片
|
||||
.activity-box {
|
||||
width: 100%;
|
||||
height: 80rpx;
|
||||
box-sizing: border-box;
|
||||
margin-bottom: 10rpx;
|
||||
|
||||
.activity-title {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
line-height: 42rpx;
|
||||
|
||||
.activity-icon {
|
||||
width: 38rpx;
|
||||
height: 38rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.activity-go {
|
||||
width: 70rpx;
|
||||
height: 32rpx;
|
||||
background: #ffffff;
|
||||
border-radius: 16rpx;
|
||||
font-weight: 500;
|
||||
color: #ff6000;
|
||||
font-size: 24rpx;
|
||||
line-height: normal;
|
||||
}
|
||||
}
|
||||
|
||||
.model-box {
|
||||
.title {
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,661 @@
|
||||
<template>
|
||||
<s-pages title="我的收益">
|
||||
|
||||
<view class="pages">
|
||||
<!-- 1 -->
|
||||
<view class="section-1" :style="{ backgroundImage: 'url(' + $url + 'home/agency2.png' + ')' }">
|
||||
<view class="section1-content">
|
||||
<view class="date">{{ currentDate }}</view>
|
||||
<view class="title">今日收益(元)</view>
|
||||
<view class="num">{{ $fen2yuan(trendObj?.earnings || 0) }}</view>
|
||||
<view class="line" />
|
||||
<view class="flex align-center">
|
||||
<view class="title">未行权金额(元)</view>
|
||||
<view class="num2">{{ $fen2yuan(norelease || 0) }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 2 -->
|
||||
<view class="section-2">
|
||||
<view class="title">收益趋势<text>(近7天)</text></view>
|
||||
<view class="wrap">
|
||||
<card_echart :options="chartOption" />
|
||||
</view>
|
||||
</view>
|
||||
<!-- 3 -->
|
||||
<view class="section-3">
|
||||
<view class="item" v-for="(item, i) in navList" :key="i">
|
||||
<view class="title" :class="navCur === i ? 'active' : ''" @click="changeNav(item, i)">{{ item.text
|
||||
}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 4 -->
|
||||
<view class="section-4">
|
||||
<view class="select-bar">
|
||||
<view class="left">
|
||||
<picker mode="date" fields="month" :value="date" @change="bindDateChange">
|
||||
<view class="selected-date">{{ currentMonth }} <text class="size18">▼</text></view>
|
||||
<view class="num">收益 ¥{{monthEarnings}}</view>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view class="bar" @click="select_show = !select_show" v-if="navCur === 2">
|
||||
{{ select_value }}
|
||||
<text class="size18">▼</text>
|
||||
</view>
|
||||
<view class="select-content" v-if="select_show">
|
||||
<view class="select-item" v-for="(item, index) in range" :key="index"
|
||||
@click="changeSelect(item, index)">
|
||||
{{ item.text }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<card_mescroll ref="cardPages" @upCallback="getList" :height="'540rpx'">
|
||||
<view class="item" v-for="(item, i) in infoArr" :key="i">
|
||||
<view class="left">
|
||||
<view class="title">
|
||||
{{ item.title }}
|
||||
</view>
|
||||
<view class="date">{{ item.time }}</view>
|
||||
</view>
|
||||
<view class="right">{{ item.money }}</view>
|
||||
</view>
|
||||
</card_mescroll>
|
||||
</view>
|
||||
</view>
|
||||
</s-pages>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
reactive,
|
||||
onMounted,
|
||||
onUnmounted,
|
||||
getCurrentInstance,
|
||||
watch,
|
||||
nextTick
|
||||
} from 'vue';
|
||||
import card_mescroll from '@/components/card_pages/card_mescroll.vue';
|
||||
import * as echarts from 'echarts';
|
||||
let {
|
||||
proxy
|
||||
} = getCurrentInstance();
|
||||
import * as api from '@/sheep/api/home/index';
|
||||
import * as api2 from '@/sheep/api/home/pay';
|
||||
import {
|
||||
formatDate,
|
||||
sourceTypeObj
|
||||
} from '@/sheep/helper/utils';
|
||||
import card_echart from '@/components/card_echart/card_echart.vue';
|
||||
import {
|
||||
fen2yuan
|
||||
} from '@/sheep/hooks/useGoods';
|
||||
let list = ref([]);
|
||||
let obj = ref({});
|
||||
let infoArr = ref([]);
|
||||
const chartRef = ref(null);
|
||||
const currentDate = ref('');
|
||||
const currentMonth = ref('');
|
||||
const currentMonth2 = ref('');
|
||||
let cardPages = ref(null);
|
||||
let height = ref('20rpx');
|
||||
const norelease = ref(0)
|
||||
const monthEarnings = ref(0)
|
||||
const date = ref()
|
||||
//navbar
|
||||
const navCur = ref(0)
|
||||
const navList = ref([{
|
||||
value: 1,
|
||||
text: "全部",
|
||||
url: api2.getWalletTransactionPage,
|
||||
},
|
||||
{
|
||||
value: 2,
|
||||
text: "佣金",
|
||||
url: api2.commissionDetailPage,
|
||||
},
|
||||
{
|
||||
value: 3,
|
||||
text: "收益",
|
||||
url: api2.agentEarningsDetailPage,
|
||||
},
|
||||
{
|
||||
value: 4,
|
||||
text: "分红",
|
||||
url: api2.dividendDetailPage,
|
||||
},
|
||||
])
|
||||
//
|
||||
const select_show = ref(false);
|
||||
const select_value = ref();
|
||||
const select_cur = ref(0);
|
||||
const range = ref([{
|
||||
value: 0,
|
||||
text: "全部"
|
||||
}, {
|
||||
value: 1,
|
||||
text: "店长收益"
|
||||
},
|
||||
{
|
||||
value: 2,
|
||||
text: "权益收益"
|
||||
},
|
||||
{
|
||||
value: 3,
|
||||
text: "代理收益"
|
||||
},
|
||||
{
|
||||
value: 4,
|
||||
text: "其他"
|
||||
},
|
||||
]);
|
||||
const chartOption = ref({
|
||||
// 添加grid配置,实现间距自适应
|
||||
grid: {
|
||||
left: '3%',
|
||||
right: '4%',
|
||||
bottom: '3%',
|
||||
top: '0',
|
||||
height: 150,
|
||||
},
|
||||
// 简化全局坐标轴指示器配置
|
||||
axisPointer: {
|
||||
type: 'cross',
|
||||
snap: true, // 吸附到最近的数据点
|
||||
crossStyle: {
|
||||
color: '#EE0A24',
|
||||
},
|
||||
// 修正lineStyle缩进
|
||||
lineStyle: {
|
||||
color: '#EE0A24',
|
||||
type: 'dashed',
|
||||
width: 1,
|
||||
},
|
||||
},
|
||||
// 调整tooltip配置,确保点击时显示数据框
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
triggerOn: 'click', // 只在点击时触发
|
||||
backgroundColor: 'rgba(255, 255, 255, 0.9)',
|
||||
borderColor: '#EE0A24',
|
||||
borderWidth: 1,
|
||||
padding: 8,
|
||||
textStyle: {
|
||||
color: '#333',
|
||||
fontSize: 12,
|
||||
},
|
||||
formatter: function(params) {
|
||||
const data = params[0];
|
||||
return `日期: ${data.axisValue}<br/>收益: ${data.value.toFixed(2)}`;
|
||||
},
|
||||
extraCssText: 'border-radius: 4px; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);',
|
||||
// 修改position配置,使用默认位置
|
||||
position: 'top',
|
||||
axisPointer: {
|
||||
type: 'cross',
|
||||
crossStyle: {
|
||||
color: '#EE0A24',
|
||||
},
|
||||
},
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: [],
|
||||
axisLabel: {
|
||||
color: '#BBBBBB',
|
||||
},
|
||||
axisLine: {
|
||||
lineStyle: {
|
||||
color: '#D9D9D9',
|
||||
type: 'dashed',
|
||||
},
|
||||
},
|
||||
// x轴独立的axisPointer配置
|
||||
axisPointer: {
|
||||
type: 'shadow',
|
||||
snap: true,
|
||||
label: {
|
||||
show: true,
|
||||
backgroundColor: 'rgba(238, 10, 36, 0.8)',
|
||||
color: '#fff',
|
||||
padding: [3, 6],
|
||||
fontSize: 12,
|
||||
formatter: function(params) {
|
||||
return ``;
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
splitLine: {
|
||||
lineStyle: {
|
||||
color: '#D9D9D9',
|
||||
type: 'dashed',
|
||||
},
|
||||
},
|
||||
axisLabel: {
|
||||
color: '#BBBBBB',
|
||||
},
|
||||
// y轴独立的axisPointer配置
|
||||
axisPointer: {
|
||||
type: 'line',
|
||||
snap: true,
|
||||
label: {
|
||||
show: true,
|
||||
backgroundColor: 'rgba(238, 10, 36, 0.8)',
|
||||
color: '#fff',
|
||||
padding: [3, 6],
|
||||
fontSize: 12,
|
||||
formatter: function(params) {
|
||||
return `收益: ${params.value.toFixed(2)}`;
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
series: [{
|
||||
data: [],
|
||||
smooth: true,
|
||||
type: 'line',
|
||||
symbol: 'none', // 不显示数据点
|
||||
lineStyle: {
|
||||
color: '#EE0A24',
|
||||
},
|
||||
triggerEvent: true, // 确保事件可以被触发
|
||||
areaStyle: {
|
||||
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
|
||||
offset: 0,
|
||||
color: '#EE0A24'
|
||||
},
|
||||
{
|
||||
offset: 0.1,
|
||||
color: '#C1261F'
|
||||
},
|
||||
{
|
||||
offset: 1,
|
||||
color: 'rgba(235,110,57,0)'
|
||||
},
|
||||
]),
|
||||
},
|
||||
emphasis: {
|
||||
focus: 'series',
|
||||
itemStyle: {
|
||||
color: '#EE0A24',
|
||||
borderColor: '#fff',
|
||||
borderWidth: 2,
|
||||
},
|
||||
showSymbol: true, // 点击时显示数据点
|
||||
symbolSize: 10, // 数据点大小
|
||||
},
|
||||
// 移除重复的showSymbol设置
|
||||
}, ],
|
||||
// 移动端优化配置
|
||||
animation: false, // 禁用动画以提高性能
|
||||
touchMoveThreshold: 10, // 增加触摸移动阈值,避免误触
|
||||
roam: false, // 禁止缩放和平移
|
||||
});
|
||||
let trendObj = ref({});
|
||||
|
||||
|
||||
//navbar选择
|
||||
function changeNav(e, i) {
|
||||
navCur.value = i
|
||||
cardPages.value.mescrollTrigger();
|
||||
}
|
||||
//收益下拉框选择
|
||||
function changeSelect(e, i) {
|
||||
// console.log(e);
|
||||
select_value.value = e.text
|
||||
select_cur.value = e.value
|
||||
select_show.value = !select_show.value
|
||||
if (cardPages.value && cardPages.value.mescrollTrigger) {
|
||||
cardPages.value.mescrollTrigger();
|
||||
}
|
||||
}
|
||||
//获取未行权收益
|
||||
function getRelease() {
|
||||
api2.agentEarningsTrendNew().then((res) => {
|
||||
if (res.code === 0) {
|
||||
// norelease.value = res.data.remainingEarningAll
|
||||
}
|
||||
});
|
||||
}
|
||||
// 七天收益
|
||||
const getData = () => {
|
||||
api2.agentEarningsTrendNew({}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
list.value = res.data.list || [];
|
||||
if (list.value.length) {
|
||||
trendObj.value = list.value[list.value.length - 1];
|
||||
|
||||
chartOption.value.xAxis.data = list.value.map((item) => {
|
||||
// 将日期从2023-09-01变为09/01格式
|
||||
item.date = item.date.split('-').slice(1).join('/');
|
||||
return item.date;
|
||||
});
|
||||
chartOption.value.series[0].data = list.value.map((item) => {
|
||||
return proxy.$fen2yuan(item.earnings);
|
||||
});
|
||||
}
|
||||
|
||||
norelease.value = res.data.remainingEarningAll
|
||||
}
|
||||
});
|
||||
};
|
||||
//列表
|
||||
const getList = (mescroll) => {
|
||||
const cfg = navList.value[navCur.value];
|
||||
if (!cfg || !cfg.url) {
|
||||
cardPages.value.getState(false);
|
||||
return;
|
||||
}
|
||||
const isAgentEarnings = navCur.value === 2;
|
||||
const params = {
|
||||
pageNo: mescroll.num,
|
||||
pageSize: mescroll.size,
|
||||
createMonth: currentMonth2.value,
|
||||
...(navCur.value === 0 ? {
|
||||
type: 1
|
||||
} :
|
||||
isAgentEarnings ? {
|
||||
transactionType: select_cur.value
|
||||
} : {
|
||||
transactionType: 1
|
||||
}),
|
||||
};
|
||||
cfg.url(params).then((res) => {
|
||||
if (res.code === 0) {
|
||||
// console.log(res.data.sum);
|
||||
monthEarnings.value = fen2yuan(res.data.sum)
|
||||
let list = res.data.list || [];
|
||||
if (mescroll.num == 1) infoArr.value = [];
|
||||
const idx = navCur.value;
|
||||
list = list.map((item) => {
|
||||
if (idx === 0) {
|
||||
item.time = formatDate(item.createTime).slice(0, 10);
|
||||
// item.remark = item.title;
|
||||
item.money = fen2yuan(item.price);
|
||||
} else if (idx === 1) {
|
||||
item.title = item.remark
|
||||
item.time = item.createTime;
|
||||
item.money = fen2yuan(item.amount);
|
||||
} else if (idx === 2) {
|
||||
item.title = item.remark
|
||||
item.time = formatDate(item.createTime).slice(0, 10);
|
||||
item.money = fen2yuan(item.totalEarnings);
|
||||
} else if (idx === 3) {
|
||||
item.title = item.remark
|
||||
item.time = formatDate(item.createTime).slice(0, 10);
|
||||
item.money = fen2yuan(item.amount);
|
||||
}
|
||||
return item;
|
||||
});
|
||||
infoArr.value = infoArr.value.concat(list);
|
||||
height.value = infoArr.value.length > 0 ? infoArr.value.length * 150 + 'rpx' : '540rpx';
|
||||
cardPages.value.getState(true, list.length);
|
||||
} else {
|
||||
cardPages.value.getState(false);
|
||||
}
|
||||
});
|
||||
};
|
||||
//选择日期
|
||||
function bindDateChange(e) {
|
||||
date.value = e.detail.value;
|
||||
const arr = e.detail.value.split('-');
|
||||
currentMonth.value = arr[0] + '.' + arr[1];
|
||||
currentMonth2.value = arr[0] + '-' + arr[1];
|
||||
if (cardPages.value && cardPages.value.mescrollTrigger) {
|
||||
cardPages.value.mescrollTrigger();
|
||||
}
|
||||
}
|
||||
//获取当前日期
|
||||
function getCurrentDate() {
|
||||
let date = new Date();
|
||||
let year = date.getFullYear();
|
||||
let month = date.getMonth() + 1;
|
||||
let day = date.getDate();
|
||||
month = month < 10 ? '0' + month : month;
|
||||
day = day < 10 ? '0' + day : day;
|
||||
currentDate.value = year + '-' + month + '-' + day;
|
||||
currentMonth.value = year + '.' + month;
|
||||
currentMonth2.value = year + '-' + month;
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
select_value.value = range.value[0].text
|
||||
select_cur.value = range.value[0].value
|
||||
getData();
|
||||
getCurrentDate()
|
||||
date.value = currentDate.value
|
||||
// getRelease()
|
||||
|
||||
});
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.card {
|
||||
background-color: var(--color24);
|
||||
border-radius: 16rpx;
|
||||
}
|
||||
|
||||
.pages {
|
||||
padding: 32rpx 40rpx 0;
|
||||
|
||||
.section-1 {
|
||||
border-radius: 16rpx;
|
||||
height: 285rpx;
|
||||
max-height: 285rpx;
|
||||
background-size: 100% 100%;
|
||||
background-repeat: no-repeat;
|
||||
margin-bottom: 44rpx;
|
||||
|
||||
.section1-content {
|
||||
padding: 16rpx 28rpx;
|
||||
color: #fff;
|
||||
|
||||
.date {
|
||||
text-align: right;
|
||||
font-size: 24rpx;
|
||||
line-height: 44rpx;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
color: rgba(255, 255, 255, 0.57);
|
||||
}
|
||||
|
||||
.num {
|
||||
font-weight: 700;
|
||||
font-size: 60rpx;
|
||||
line-height: 80rpx;
|
||||
margin: 8rpx 0;
|
||||
}
|
||||
|
||||
.num2 {
|
||||
font-size: 32rpx;
|
||||
margin-left: 40rpx;
|
||||
}
|
||||
|
||||
.line {
|
||||
width: 418rpx;
|
||||
height: 4rpx;
|
||||
background: rgba(255, 255, 255, 0.23);
|
||||
margin-bottom: 27rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.section-2 {
|
||||
@extend .card;
|
||||
padding: 16rpx 28rpx;
|
||||
margin-bottom: 32rpx;
|
||||
|
||||
.title {
|
||||
font-size: 32rpx;
|
||||
|
||||
text {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.wrap {
|
||||
width: 100%;
|
||||
height: 350rpx;
|
||||
margin-top: 32rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.section-3 {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 34rpx;
|
||||
|
||||
.item {
|
||||
width: 146rpx;
|
||||
height: 62rpx;
|
||||
line-height: 62rpx;
|
||||
text-align: center;
|
||||
background: #fff;
|
||||
border-radius: 14rpx;
|
||||
overflow: hidden;
|
||||
font-weight: 400;
|
||||
font-size: 24rpx;
|
||||
// color: #FFFFFF;
|
||||
}
|
||||
|
||||
.active {
|
||||
color: #FB4D32;
|
||||
background: #FFEFE5;
|
||||
}
|
||||
}
|
||||
|
||||
.section-4 {
|
||||
background-color: var(--color24);
|
||||
border-radius: 50rpx 50rpx 0 0;
|
||||
margin: 32rpx -40rpx 0;
|
||||
padding: 28rpx 40rpx;
|
||||
|
||||
.select-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
.left {
|
||||
font-weight: 500;
|
||||
line-height: 44rpx;
|
||||
|
||||
.selected-date {
|
||||
font-size: 32rpx;
|
||||
// color: #FFFFFF;
|
||||
}
|
||||
|
||||
.num {
|
||||
font-size: 28rpx;
|
||||
color: #969696;
|
||||
margin-top: 8rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.right {
|
||||
position: relative;
|
||||
|
||||
.bar {
|
||||
width: 146rpx;
|
||||
height: 50rpx;
|
||||
text-align: center;
|
||||
line-height: 50rpx;
|
||||
background: #F2F4F7;
|
||||
border-radius: 16rpx;
|
||||
font-weight: 400;
|
||||
font-size: 24rpx;
|
||||
// color: #FFFFFF;
|
||||
}
|
||||
|
||||
.select-content {
|
||||
width: 100%;
|
||||
border-radius: 10rpx;
|
||||
position: absolute;
|
||||
background: #F2F4F7;
|
||||
top: 60rpx;
|
||||
z-index: 10;
|
||||
|
||||
.select-item {
|
||||
padding: 0 10rpx;
|
||||
text-align: center;
|
||||
line-height: 70rpx;
|
||||
color: #000;
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.item {
|
||||
// width: 100%;
|
||||
height: 144rpx;
|
||||
background: #F2F4F7;
|
||||
border-radius: 16rpx;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 0 24rpx;
|
||||
margin-top: 24rpx;
|
||||
|
||||
.left {
|
||||
font-weight: 400;
|
||||
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
// color: #FFFFFF;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
|
||||
.date {
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
line-height: 34rpx;
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.right {
|
||||
font-weight: 500;
|
||||
font-size: 32rpx;
|
||||
color: #EE0A24;
|
||||
// line-height: 46rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
.select {
|
||||
width: 200rpx;
|
||||
|
||||
:deep(.uni-scroll-view-content) {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
:deep(.uni-stat-box) {
|
||||
background-color: transparent;
|
||||
|
||||
.uni-select__input-box .padding-top-bottom {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.uni-select {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.uni-icons {
|
||||
color: #fff !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,28 @@
|
||||
<template>
|
||||
<view class="pages">
|
||||
<web-view :src="url"></web-view>
|
||||
</view>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
let url = ref('http://8.136.55.200:1080/#/pages/index/user_agreement');
|
||||
let title = ref('用户协议');
|
||||
// 显示原生导航栏
|
||||
onLoad(async (e) => {
|
||||
if (e.type == 1) {
|
||||
url.value = 'http://8.136.55.200:1080/#/pages/index/user_agreement';
|
||||
title.value = '用户协议';
|
||||
} else {
|
||||
url.value = 'http://8.136.55.200:1080/#/pages/index/privacy_agreement';
|
||||
title.value = '隐私政策';
|
||||
}
|
||||
uni.setNavigationBarTitle({ title: title.value });
|
||||
console.log(url.value);
|
||||
});
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.pages {
|
||||
margin-top: -100rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,47 @@
|
||||
<template>
|
||||
<view class="pages">
|
||||
<view v-html="content"></view>
|
||||
</view>
|
||||
<!-- <s-pages :title="title" class="c0">
|
||||
<view v-html="content"></view>
|
||||
</s-pages> -->
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import * as api from '@/sheep/api/index/index';
|
||||
let title = ref('协议');
|
||||
let apiUrl = ref(api.getuseragreement);
|
||||
let content = ref();
|
||||
let id = ref(0);
|
||||
const getData = async () => {
|
||||
let res = await apiUrl.value({ id: id.value });
|
||||
if (res.code === 0) {
|
||||
content.value = res.data.content;
|
||||
title.value = res.data.title;
|
||||
uni.setNavigationBarTitle({ title: title.value });
|
||||
}
|
||||
};
|
||||
// 显示原生导航栏
|
||||
onLoad(async (e) => {
|
||||
console.log(e.type);
|
||||
id.value = e.type;
|
||||
switch (parseInt(e.type)) {
|
||||
case 1:
|
||||
apiUrl.value = api.getpolicy;
|
||||
break;
|
||||
case 2:
|
||||
apiUrl.value = api.getpolicy;
|
||||
break;
|
||||
case 4:
|
||||
apiUrl.value = api.getpolicy;
|
||||
break;
|
||||
}
|
||||
|
||||
getData();
|
||||
});
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.pages {
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,35 @@
|
||||
<template>
|
||||
<s-pages title="计算">
|
||||
<view class="p-x-32">
|
||||
<view class="flex-center m-b-20">
|
||||
<view class="w_150">利润:</view>
|
||||
<uni-easyinput class="flex1" v-model="num1" type="number" placeholder="利润" />
|
||||
</view>
|
||||
<view class="flex-center m-b-20">
|
||||
<view class="w_150">上架数:</view>
|
||||
<uni-easyinput class="flex1" v-model="num2" type="number" placeholder="上架数" />
|
||||
</view>
|
||||
<view class="m-b-20">25天的利润: {{ num3 }}</view>
|
||||
<view class="m-b-20">每天的利润: {{ num3 / 25 }}</view>
|
||||
<view class="m-b-20">每天的利润20%: {{ (num3 / 25) * 0.2 }}</view>
|
||||
<view class="m-b-20">每天的利润80%: {{ (num3 / 25) * 0.8 }}</view>
|
||||
<view @click="sub" class="ai-button">提交</view></view
|
||||
>
|
||||
</s-pages>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, getCurrentInstance } from 'vue';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
const { proxy } = getCurrentInstance();
|
||||
let num1 = ref(0);
|
||||
let num2 = ref(0);
|
||||
let num3 = ref(0);
|
||||
const sub = () => {
|
||||
// num1 / num2 / 40 天 * (1.125)^40
|
||||
// 这个商品的每天利润总额 / 这个商品的当天AI店铺上架产品数 / 40 天 * (1.125)^40
|
||||
num3.value = (num1.value / num2.value / 40) * Math.pow(1.125, 40);
|
||||
console.log((2.78 / Math.pow(1.125, 40)) * 40 * 200);
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="scss"></style>
|
||||
@@ -0,0 +1,89 @@
|
||||
<template>
|
||||
<view>
|
||||
<image
|
||||
v-if="qrCodeUrl"
|
||||
:src="qrCodeUrl"
|
||||
:style="{ width: size + 'rpx', height: size + 'rpx' }"
|
||||
@longpress="$emit('longpress')"
|
||||
/>
|
||||
<canvas
|
||||
v-else
|
||||
canvas-id="qrcode"
|
||||
:style="{ width: size + 'rpx', height: size + 'rpx' }"
|
||||
@longpress="$emit('longpress')"
|
||||
></canvas>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import UQRCode from 'uqrcodejs';
|
||||
export default {
|
||||
props: {
|
||||
size: {
|
||||
type: Number,
|
||||
default: 100,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
qrCodeUrl: '',
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
createQRcode(url) {
|
||||
var qr = new UQRCode();
|
||||
qr.data = url;
|
||||
const pxSize = uni.upx2px(this.size);
|
||||
qr.size = pxSize;
|
||||
qr.make();
|
||||
var canvasContext = uni.createCanvasContext('qrcode', this);
|
||||
canvasContext.setFillStyle('#FFFFFF');
|
||||
canvasContext.fillRect(0, 0, pxSize, pxSize);
|
||||
qr.canvasContext = canvasContext;
|
||||
qr.drawCanvas();
|
||||
setTimeout(() => {
|
||||
this.toImg(pxSize);
|
||||
}, 200);
|
||||
},
|
||||
toImg(pxSize) {
|
||||
const _this = this;
|
||||
uni.canvasToTempFilePath(
|
||||
{
|
||||
width: pxSize,
|
||||
height: pxSize,
|
||||
canvasId: 'qrcode',
|
||||
destWidth: pxSize,
|
||||
destHeight: pxSize,
|
||||
success: function (res) {
|
||||
_this.qrCodeUrl = res.tempFilePath;
|
||||
_this.$emit('generated', res.tempFilePath);
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log(err);
|
||||
},
|
||||
},
|
||||
this,
|
||||
);
|
||||
},
|
||||
savePhoto() {
|
||||
uni.saveImageToPhotosAlbum({
|
||||
filePath: this.qrCodeUrl,
|
||||
success: (res) => {
|
||||
uni.showToast({
|
||||
title: '保存成功',
|
||||
icon: 'success',
|
||||
});
|
||||
},
|
||||
fail: (err) => {
|
||||
uni.showToast({
|
||||
title: '保存失败',
|
||||
icon: 'none',
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss"></style>
|
||||
@@ -0,0 +1,66 @@
|
||||
<template>
|
||||
<view class="pages">
|
||||
<s-layout :bgStyle="{ color: 'var(--color1)' }" title="意见反馈">
|
||||
<view class="input bg24">
|
||||
<uni-easyinput
|
||||
v-model="text"
|
||||
type="textarea"
|
||||
placeholder="请输入您的意见"
|
||||
@confirm="submit"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<su-fixed bottom placeholder>
|
||||
<view class="ss-p-x-20 ss-p-b-40">
|
||||
<button class="loginout-btn ss-reset-button ui-BG-Main btn_bg" @tap="submit">
|
||||
提交
|
||||
</button>
|
||||
</view>
|
||||
</su-fixed>
|
||||
</s-layout>
|
||||
</view>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted, onUnmounted, getCurrentInstance, watch, nextTick } from 'vue';
|
||||
import * as api from '@/sheep/api/home/index';
|
||||
let { proxy } = getCurrentInstance();
|
||||
let text = ref('');
|
||||
const submit = () => {
|
||||
api
|
||||
.createfeedback({
|
||||
feedbackContent: text.value,
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.code === 0) {
|
||||
text.value = '';
|
||||
setTimeout(() => {
|
||||
uni.navigateBack({ delta: 1 });
|
||||
}, 500);
|
||||
}
|
||||
});
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.pages {
|
||||
.input {
|
||||
background-color: #fff;
|
||||
margin-top: 24rpx;
|
||||
padding-top: 40rpx;
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.is-input-border) {
|
||||
border: none;
|
||||
}
|
||||
|
||||
:deep(.uni-easyinput__content-textarea) {
|
||||
padding-top: 0;
|
||||
// color: #ffffff;
|
||||
}
|
||||
|
||||
.loginout-btn {
|
||||
background: linear-gradient(131deg, #f7772e 0%, #ee0a24 100%), #4d88ff;
|
||||
height: 100rpx;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,386 @@
|
||||
<template>
|
||||
<s-layout :title="dataObj.title" navbar="inner">
|
||||
<view class="pages h100">
|
||||
<image
|
||||
class="w100 bg"
|
||||
:src="$url + 'home/points_1.png'"
|
||||
mode="widthFix"
|
||||
:style="{ top: paddingTop + 'px' }"
|
||||
/>
|
||||
<view class="pages_con">
|
||||
<view class="page_bottom bg24">
|
||||
<view class="bottom_title center c0"> 待释放明细 </view>
|
||||
<view class="bottom_list flex-center al-flex-start ju-between" v-if="type == 5">
|
||||
<view class="flex-row">
|
||||
<view
|
||||
class="navItem"
|
||||
v-for="(v, i) in navList"
|
||||
:key="i"
|
||||
:class="{ activeNav: navIndex === i }"
|
||||
@click="navChange(i)"
|
||||
>
|
||||
<view class="size28">{{ v.name }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="flex-row">
|
||||
<view class="typeItem flex-center size24" v-for="(v, i) in typeArr" :key="i"
|
||||
:class="{ activeType: typeIndex === i }" @click="typeIndex = i">
|
||||
{{ v.name }}
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
<view>
|
||||
<card_mescroll ref="cardPages" @upCallback="getList" :height="height + 'px'">
|
||||
<view
|
||||
v-for="(v, i) in detailList"
|
||||
:key="i"
|
||||
class="flex-center ju-between p-b-34 p-t-32 border-bottom"
|
||||
>
|
||||
<view>
|
||||
<view class="size28 line40 m-b-10 c0">
|
||||
{{ sourceTypeObj[Number(v.sourceType) || 1] }}
|
||||
</view>
|
||||
<view class="size24 c_999 line34">{{ formatDate(v.createTime) }}</view>
|
||||
</view>
|
||||
<view>{{ dataObj.numValue }}</view>
|
||||
<view class="size32 c_EE0A24">
|
||||
{{ $fen2yuan(v.remainingEarning) }}
|
||||
</view>
|
||||
</view>
|
||||
</card_mescroll>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="h_200"> </view>
|
||||
</s-layout>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import sheep from '@/sheep';
|
||||
import { ref, reactive, onMounted, onUnmounted, getCurrentInstance, watch, nextTick } from 'vue';
|
||||
import * as api from '@/sheep/api/home/pay';
|
||||
import * as pointsApi from '@/sheep/api/home/points';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import card_mescroll from '@/components/card_pages/card_mescroll.vue';
|
||||
|
||||
import { formatDate, sourceTypeObj } from '@/sheep/helper/utils';
|
||||
let { proxy } = getCurrentInstance();
|
||||
// 1-商场区域代理订单,2-AI店铺区域代理订单,3-AI店铺代理收益,4:AI店铺团队分红,5-营销活动随机奖励
|
||||
let typeObj = {
|
||||
1: '区域代理收益',
|
||||
2: '区域代理收益',
|
||||
3: '店长收益',
|
||||
4: '店长收益',
|
||||
5: '店长收益',
|
||||
6: '系统导入',
|
||||
};
|
||||
let dataObj = reactive({
|
||||
title: '待释放',
|
||||
name: '我的积分',
|
||||
num: 0,
|
||||
btn: '去提现',
|
||||
list: [],
|
||||
unit: '',
|
||||
url: '',
|
||||
numName: 'changeAmount',
|
||||
sourceName: 'bizType',
|
||||
listApi: pointsApi.integraldetai,
|
||||
titleName: 'remark',
|
||||
});
|
||||
let navList = ref([
|
||||
{
|
||||
name: '全部',
|
||||
url: api.getWalletTransactionPage,
|
||||
title: 'title',
|
||||
numName: 'price',
|
||||
sourceName: '',
|
||||
},
|
||||
{
|
||||
name: '佣金',
|
||||
url: api.commissionDetailPage,
|
||||
title: 'remark',
|
||||
numName: 'amount',
|
||||
sourceName: '',
|
||||
},
|
||||
{
|
||||
name: '代理收益',
|
||||
url: api.agentEarningsDetailPage,
|
||||
title: 'remark',
|
||||
numName: 'totalEarnings',
|
||||
sourceName: '',
|
||||
},
|
||||
{
|
||||
name: '分红',
|
||||
url: api.dividendDetailPage,
|
||||
title: 'remark',
|
||||
numName: 'amount',
|
||||
sourceName: '',
|
||||
},
|
||||
]);
|
||||
let typeArr = ref([
|
||||
{
|
||||
name: '收入',
|
||||
transactionType: 1,
|
||||
},
|
||||
{
|
||||
name: '支出',
|
||||
transactionType: 2,
|
||||
},
|
||||
]);
|
||||
let navIndex = ref(0);
|
||||
let typeIndex = ref(0);
|
||||
let height = ref(0);
|
||||
let sysInfo = uni.getSystemInfoSync();
|
||||
const windowHeight = sysInfo.windowHeight;
|
||||
let urlAPI = ref(api.getWallet);
|
||||
height.value =
|
||||
windowHeight - sysInfo.statusBarHeight - uni.upx2px(88) - uni.upx2px(110) - uni.upx2px(40);
|
||||
let statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
|
||||
let paddingTop = ref();
|
||||
paddingTop.value = -(statusBarHeight + 44);
|
||||
|
||||
const getData = () => {
|
||||
urlAPI.value().then((res) => {
|
||||
console.log(res);
|
||||
if (res.code === 0) {
|
||||
dataObj.num = proxy.$fen2yuan(res.data.balance);
|
||||
}
|
||||
});
|
||||
};
|
||||
let cardPages = ref(null);
|
||||
let detailList = ref([]);
|
||||
const getList = (mescroll) => {
|
||||
let obj = {
|
||||
pageNo: mescroll.num,
|
||||
pageSize: mescroll.size,
|
||||
};
|
||||
api.getReleaseList(obj).then((res) => {
|
||||
console.log(res);
|
||||
if (res.code === 0) {
|
||||
let list = res.data.pageResult.list || [];
|
||||
|
||||
if (mescroll.num == 1) detailList.value = [];
|
||||
detailList.value = detailList.value.concat(list);
|
||||
cardPages.value.getState(true, list.length);
|
||||
} else {
|
||||
cardPages.value.getState(false);
|
||||
}
|
||||
});
|
||||
};
|
||||
let type = ref(1);
|
||||
const dataChange = async () => {
|
||||
let userInfo = await sheep.$store('user').getInfo();
|
||||
if (type.value) {
|
||||
type.value = Number(type.value);
|
||||
switch (Number(type.value)) {
|
||||
case 1:
|
||||
dataObj.title = '绿色积分';
|
||||
dataObj.name = '我的积分';
|
||||
dataObj.btn = '去兑换';
|
||||
dataObj.num = userInfo.point;
|
||||
dataObj.url = '/pages/home/pay/seed';
|
||||
dataObj.listApi = pointsApi.integraldetai;
|
||||
dataObj.numName = 'changeAmount';
|
||||
dataObj.sourceName = '';
|
||||
break;
|
||||
case 2:
|
||||
dataObj.title = '佣金';
|
||||
dataObj.name = '我的佣金';
|
||||
dataObj.num = userInfo.commission;
|
||||
dataObj.unit = '元';
|
||||
dataObj.listApi = pointsApi.commission;
|
||||
dataObj.numName = 'amount';
|
||||
dataObj.sourceName = '';
|
||||
break;
|
||||
case 3:
|
||||
dataObj.title = '代理收益';
|
||||
dataObj.name = '我的代理收益';
|
||||
dataObj.num = userInfo.agentEarning;
|
||||
dataObj.unit = '元';
|
||||
dataObj.listApi = pointsApi.agentearnings;
|
||||
dataObj.numName = 'totalEarnings';
|
||||
dataObj.sourceName = '';
|
||||
break;
|
||||
case 4:
|
||||
dataObj.title = '消费金';
|
||||
dataObj.name = '我的消费金';
|
||||
dataObj.btn = '去消费';
|
||||
dataObj.num = proxy.$fen2yuan(userInfo.consumptionGold);
|
||||
dataObj.unit = '';
|
||||
dataObj.url = '/pages/goods/list';
|
||||
dataObj.listApi = pointsApi.consumptiongold;
|
||||
dataObj.numName = 'amount';
|
||||
dataObj.sourceName = '';
|
||||
break;
|
||||
case 5:
|
||||
navChange(0);
|
||||
dataObj.title = '钱包';
|
||||
dataObj.name = '可提现金额';
|
||||
dataObj.btn = '去提现';
|
||||
dataObj.num = proxy.$fen2yuan(userInfo.wallet);
|
||||
dataObj.unit = '元';
|
||||
dataObj.url = '/pages/home/pay/withdraw';
|
||||
getData();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// getList();
|
||||
}
|
||||
if (cardPages.value) {
|
||||
cardPages.value.mescrollTrigger();
|
||||
}
|
||||
};
|
||||
onLoad(async (e) => {
|
||||
type.value = e.type;
|
||||
});
|
||||
onShow(() => {
|
||||
dataChange();
|
||||
});
|
||||
watch(
|
||||
() => [navIndex.value, typeIndex.value],
|
||||
() => {
|
||||
cardPages.value.mescrollTrigger();
|
||||
},
|
||||
);
|
||||
onShow(() => {
|
||||
if (cardPages.value) {
|
||||
cardPages.value.mescrollTrigger();
|
||||
}
|
||||
if (type.value == 5) {
|
||||
getData();
|
||||
}
|
||||
});
|
||||
const goUrl = () => {
|
||||
// if (type.value == 5) {
|
||||
// uni.showToast({
|
||||
// title: '功能暂未开放',
|
||||
// icon: 'none',
|
||||
// })
|
||||
// return;
|
||||
// }
|
||||
uni.navigateTo({
|
||||
url: dataObj.url,
|
||||
});
|
||||
};
|
||||
const go = () => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/home/noRelease',
|
||||
});
|
||||
};
|
||||
const navChange = (index) => {
|
||||
dataObj.numName = navList.value[index].numName;
|
||||
dataObj.sourceName = navList.value[index].sourceName;
|
||||
dataObj.titleName = navList.value[index].title;
|
||||
navIndex.value = index;
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.money-box {
|
||||
//height: 344rpx;
|
||||
background: linear-gradient(to right, #75aff6 0%, #366dee 99%);
|
||||
border-radius: 12rpx;
|
||||
margin-bottom: 32rpx;
|
||||
padding: 40rpx 32rpx 16rpx;
|
||||
|
||||
.line {
|
||||
width: 100%;
|
||||
height: 1rpx;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.btn {
|
||||
color: #366eee;
|
||||
border-radius: 50rpx;
|
||||
background: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.pages {
|
||||
position: relative;
|
||||
|
||||
.bg {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.pages_con {
|
||||
position: relative;
|
||||
padding: 0 40rpx;
|
||||
box-sizing: border-box;
|
||||
z-index: 1;
|
||||
|
||||
.page_top {
|
||||
height: 204rpx;
|
||||
color: #1a1a1a;
|
||||
|
||||
.name {
|
||||
}
|
||||
|
||||
.num {
|
||||
font-size: 68rpx;
|
||||
}
|
||||
|
||||
.btn {
|
||||
background: linear-gradient(131deg, #f7772e 0%, #ee0a24 100%);
|
||||
height: 52rpx;
|
||||
line-height: 52rpx;
|
||||
width: 112rpx;
|
||||
text-align: center;
|
||||
border-radius: 26rpx;
|
||||
color: #ffffff;
|
||||
margin-bottom: 10rpx;
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.page_bottom {
|
||||
background-color: #fff;
|
||||
border-radius: 24rpx;
|
||||
padding: 0 16rpx;
|
||||
|
||||
.bottom_title {
|
||||
line-height: 110rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.navItem {
|
||||
margin-bottom: 20rpx;
|
||||
margin-right: 32rpx;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.activeNav {
|
||||
position: relative;
|
||||
color: var(--color32);
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
width: 40rpx;
|
||||
height: 6rpx;
|
||||
background: linear-gradient(131deg, var(--color30) 0%, var(--color32) 100%), #fa7e31;
|
||||
border-radius: 4rpx;
|
||||
position: absolute;
|
||||
bottom: -14rpx;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
}
|
||||
|
||||
.typeItem {
|
||||
width: 76rpx;
|
||||
height: 40rpx;
|
||||
background-color: #f2f2f2;
|
||||
border-radius: 8rpx;
|
||||
margin-left: 12rpx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.activeType {
|
||||
color: var(--color30);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,162 @@
|
||||
<template>
|
||||
<s-pages title="修改密码">
|
||||
<view class="pages flex-column ju-between">
|
||||
<card_list class="cardList bg24" :arr="listArr">
|
||||
<template #footer-2>
|
||||
<view class="flex-center">
|
||||
<uni-easyinput
|
||||
style="width: 200rpx"
|
||||
v-if="num > 0 && num < 60"
|
||||
:inputBorder="false"
|
||||
v-model="formData.code"
|
||||
type="number"
|
||||
placeholder="请输入验证码"
|
||||
></uni-easyinput>
|
||||
<view class="c_primary size28" @click="getCode">{{
|
||||
num > 0 && num < 60 ? num + 's后重新获取' : '获取验证码'
|
||||
}}</view>
|
||||
</view>
|
||||
</template>
|
||||
<template #footer-3>
|
||||
<uni-easyinput
|
||||
:inputBorder="false"
|
||||
v-model="formData.password"
|
||||
type="password"
|
||||
placeholder="请输入密码"
|
||||
></uni-easyinput>
|
||||
</template>
|
||||
<template #footer-4>
|
||||
<uni-easyinput
|
||||
:inputBorder="false"
|
||||
v-model="formData.password1"
|
||||
type="password"
|
||||
placeholder="请再次输入密码"
|
||||
></uni-easyinput>
|
||||
</template>
|
||||
</card_list>
|
||||
<view class="submit-btn m-t-20" @click="sub">确定</view>
|
||||
</view>
|
||||
</s-pages>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import sheep from '@/sheep';
|
||||
import { ref, reactive, onMounted, onUnmounted, getCurrentInstance, watch, nextTick } from 'vue';
|
||||
import card_list from '@/components/card_list/card_list.vue';
|
||||
import UserApi from '@/sheep/api/member/user';
|
||||
import AuthUtil from '@/sheep/api/member/auth';
|
||||
let timer = ref(null);
|
||||
let { proxy } = getCurrentInstance();
|
||||
let listArr = ref([
|
||||
{
|
||||
id: '1',
|
||||
title: '手机号',
|
||||
rightText: '',
|
||||
},
|
||||
{
|
||||
id: '2',
|
||||
title: '验证码',
|
||||
rightText: '',
|
||||
type: 'config',
|
||||
},
|
||||
{
|
||||
id: '3',
|
||||
title: '新密码',
|
||||
rightText: '',
|
||||
type: 'input',
|
||||
typeObj: {
|
||||
type: 'password',
|
||||
placeholder: '请输入密码',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: '4',
|
||||
title: '确认密码',
|
||||
rightText: '',
|
||||
type: 'input',
|
||||
typeObj: {
|
||||
type: 'password',
|
||||
placeholder: '请再次输入密码',
|
||||
},
|
||||
},
|
||||
]);
|
||||
let formData = ref({});
|
||||
let num = ref(0);
|
||||
const getCode = () => {
|
||||
if (num.value > 0) {
|
||||
return;
|
||||
}
|
||||
sendCode();
|
||||
};
|
||||
const sendCode = async () => {
|
||||
AuthUtil.sendSmsCode(formData.value.mobile, 3).then((res) => {
|
||||
if (res.code === 0) {
|
||||
num.value = 60;
|
||||
timer.value = setInterval(() => {
|
||||
num.value--;
|
||||
if (num.value <= 0) {
|
||||
clearInterval(timer.value);
|
||||
num.value = 60;
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
};
|
||||
let dataInfo = ref({});
|
||||
const getData = () => {
|
||||
sheep
|
||||
.$store('user')
|
||||
.getInfo()
|
||||
.then((res) => {
|
||||
dataInfo.value = res;
|
||||
formData.value.mobile = res.mobile;
|
||||
listArr.value[0].rightText = res.mobile;
|
||||
});
|
||||
};
|
||||
getData();
|
||||
const sub = () => {
|
||||
if (!formData.value.code) {
|
||||
uni.showToast({
|
||||
title: '请输入验证码',
|
||||
icon: 'none',
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (formData.value.password != formData.value.password1) {
|
||||
uni.showToast({
|
||||
title: '两次密码不一致',
|
||||
icon: 'none',
|
||||
});
|
||||
return;
|
||||
}
|
||||
UserApi.updateUserPassword(formData.value).then((res) => {
|
||||
if (res.code === 0) {
|
||||
setTimeout(() => {
|
||||
uni.reLaunch({ url: '/pages/public/login' });
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
:deep(input) {
|
||||
text-align: right;
|
||||
}
|
||||
.pages {
|
||||
padding: 30rpx 40rpx;
|
||||
padding-bottom: 64rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
:deep(.uni-list-item__content-title) {
|
||||
white-space: nowrap;
|
||||
word-break: keep-all;
|
||||
}
|
||||
.cardList {
|
||||
border-radius: 8rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
:deep(.uni-list-item__container) {
|
||||
align-items: center !important;
|
||||
}
|
||||
.submit-btn {
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,233 @@
|
||||
<template>
|
||||
<s-pages :bgStyle="{ color: 'var(--color1)' }" :title="dataObj.title">
|
||||
<view class="pages p-t-28 p-x-40">
|
||||
<view class="radius12 pagesTop p-y-30 p-x-28 bg24">
|
||||
<view class="c0">{{ dataObj.text0 }}</view>
|
||||
<view class="m-b-28 border-bottom"
|
||||
><uni-easyinput
|
||||
v-model="num"
|
||||
type="number"
|
||||
placeholder=""
|
||||
placeholder-style="font-size: 92rpx;"
|
||||
@confirm="submit"
|
||||
:inputBorder="false"
|
||||
:min="0"
|
||||
@blur="blur"
|
||||
:clearSize="50"
|
||||
/></view>
|
||||
<view class="m-b-12 line48" v-if="dataObj.text">
|
||||
{{ dataObj.text }}<span>{{ point }}</span
|
||||
>{{ dataObj.text1 }},
|
||||
<span class="c32" @click="num = point">全部{{ dataObj.title }}</span>
|
||||
</view>
|
||||
<view class="size24 infotext flex-center ju-flex-start c34">
|
||||
<uni-icons class="m-l-16 m-r-6" type="info" color="" />
|
||||
{{ dataObj.text2 }}
|
||||
</view>
|
||||
<view></view>
|
||||
</view>
|
||||
<view class="submit-btn m-t-66" @click="submit">{{ dataObj.title }}</view>
|
||||
</view>
|
||||
</s-pages>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, getCurrentInstance } from 'vue';
|
||||
import { onShow, onLoad } from '@dcloudio/uni-app';
|
||||
import sheep from '@/sheep';
|
||||
import * as api from '@/sheep/api/home/pay';
|
||||
import * as incrementApi from '@/sheep/api/increment/index';
|
||||
import * as userApi from '@/sheep/api/member/user';
|
||||
const { proxy } = getCurrentInstance();
|
||||
let num = ref(0);
|
||||
let point = ref(0);
|
||||
let type = ref(0);
|
||||
let dataObj = ref({
|
||||
title: '兑换',
|
||||
text0: '金种子数量',
|
||||
text: '',
|
||||
text1: '金种子',
|
||||
text2: '兑换比例:100积分=1金种子',
|
||||
num: 'point',
|
||||
subUrl: api.exchangeGoldSeed,
|
||||
upName: 'goldSeedAmount',
|
||||
});
|
||||
const submit = () => {
|
||||
if (!num.value) {
|
||||
sheep.$helper.toast('请输入兑换数量');
|
||||
return;
|
||||
}
|
||||
let obj = {};
|
||||
let upName = dataObj.value.upName;
|
||||
// obj[upName] = num.value;
|
||||
switch (type.value) {
|
||||
case 0: //绿色积分兑换金种子
|
||||
obj[upName] = num.value;
|
||||
break;
|
||||
case 1: //交易所积分兑换金种子
|
||||
obj[upName] = num.value * 100;
|
||||
break;
|
||||
case 2: //配票 向上取整
|
||||
obj[upName] = Math.ceil(num.value / 0.85);
|
||||
break;
|
||||
case 3: //兑换原始积分
|
||||
obj[upName] = num.value;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
dataObj.value.subUrl(obj).then((res) => {
|
||||
if (res.code === 0) {
|
||||
num.value = 0;
|
||||
getInfo();
|
||||
}
|
||||
console.log(res);
|
||||
});
|
||||
};
|
||||
const blur = () => {
|
||||
if (num.value < 0) {
|
||||
sheep.$helper.toast('兑换数量不能小于0');
|
||||
num.value = 0;
|
||||
return;
|
||||
}
|
||||
if (num.value > point.value) {
|
||||
sheep.$helper.toast('兑换数量不能大于可兑换数量');
|
||||
num.value = point.value;
|
||||
return;
|
||||
}
|
||||
};
|
||||
const getInfo = () => {
|
||||
dataObj.value.info().then((res) => {
|
||||
console.log(res);
|
||||
if (res.code === 0) {
|
||||
let num = res.data[dataObj.value.num];
|
||||
// dataObj.value.text = `当前积分${num}, 可兑换`
|
||||
// point.value = type.value === 0 || type.value === 1 ? Math.floor(num / 100) : num;
|
||||
switch (type.value) {
|
||||
case 0: //绿色积分兑换金种子
|
||||
point.value = Math.floor(num / 100);
|
||||
break;
|
||||
case 1: //交易所积分兑换金种子
|
||||
point.value = Math.floor(num / 100);
|
||||
break;
|
||||
case 2: //配票 向下取整
|
||||
point.value = Math.floor(num * 0.85);
|
||||
break;
|
||||
case 3: //兑换原始积分
|
||||
point.value = num;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
onLoad((e) => {
|
||||
// type: 0 绿色积分 1增量积分
|
||||
type.value = parseInt(e.type) || 0;
|
||||
switch (type.value) {
|
||||
case 0: //绿色积分兑换金种子
|
||||
dataObj.value = {
|
||||
title: '兑换',
|
||||
text0: '金种子数量',
|
||||
text: '当前可兑换',
|
||||
text1: '金种子',
|
||||
text2: '兑换比例:100积分=1金种子',
|
||||
num: 'point',
|
||||
subUrl: api.exchangeGoldSeed,
|
||||
info: userApi.default.getUserInfo,
|
||||
upName: 'goldSeedAmount',
|
||||
};
|
||||
break;
|
||||
case 1: //交易所积分兑换金种子
|
||||
dataObj.value = {
|
||||
title: '兑换',
|
||||
text0: '金种子数量',
|
||||
text: '当前可兑换',
|
||||
text1: '金种子',
|
||||
text2: '兑换比例:100积分=1金种子',
|
||||
num: 'exchangePoint',
|
||||
subUrl: incrementApi.exPointChangeGoldSeed,
|
||||
info: incrementApi.getUserGroupInfo,
|
||||
upName: 'amount',
|
||||
};
|
||||
break;
|
||||
case 2: //配票
|
||||
dataObj.value = {
|
||||
title: '配票',
|
||||
text0: '增量积分',
|
||||
text: '当前可配票',
|
||||
text1: '积分',
|
||||
text2: '需要核销15%的积分',
|
||||
num: 'incrementPoint',
|
||||
subUrl: incrementApi.incrPointChangeIncPoint,
|
||||
info: incrementApi.getUserGroupInfo,
|
||||
upName: 'amount',
|
||||
};
|
||||
break;
|
||||
case 3: //兑换
|
||||
dataObj.value = {
|
||||
title: '兑换积分',
|
||||
text0: '增量积分',
|
||||
text: '当前可兑换',
|
||||
text1: '积分',
|
||||
text2: '兑换比例:1增量积分=1绿色积分',
|
||||
num: 'incrementPoint',
|
||||
subUrl: incrementApi.incrPointChangeExPoint,
|
||||
info: incrementApi.getUserGroupInfo,
|
||||
upName: 'amount',
|
||||
};
|
||||
break;
|
||||
}
|
||||
getInfo();
|
||||
});
|
||||
onShow(() => {
|
||||
// getInfo();
|
||||
});
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
:deep(.uni-icons) {
|
||||
font-size: 24rpx !important;
|
||||
}
|
||||
|
||||
:deep(.uni-easyinput__content) {
|
||||
height: 108rpx;
|
||||
font-size: 92rpx;
|
||||
border-color: #4c505b;
|
||||
}
|
||||
|
||||
:deep(.uni-easyinput__content-input) {
|
||||
height: 108rpx;
|
||||
font-size: 92rpx;
|
||||
}
|
||||
|
||||
:deep(.uni-easyinput__placeholder-class) {
|
||||
font-size: 92rpx;
|
||||
}
|
||||
|
||||
:deep(.uni-input-input) {
|
||||
// color: #ffffff;
|
||||
}
|
||||
|
||||
.pagesTop {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.infotext {
|
||||
height: 62rpx;
|
||||
background: #f2f2f2;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
|
||||
.c_FA7E31 {
|
||||
color: #fa7e31;
|
||||
}
|
||||
|
||||
:deep(.uniui-left) {
|
||||
font-size: 44rpx !important;
|
||||
}
|
||||
|
||||
:deep(.uni-icons) {
|
||||
font-size: 44rpx !important;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,463 @@
|
||||
<template>
|
||||
<s-pages title="提现">
|
||||
<view class="pages p-y-28 p-x-40 c0">
|
||||
<!-- <view class="m-b-20 tab-header">
|
||||
<text class="tab-item" :class="{ active: type === 'yougou' }" @click="changeType('yougou')">优购提现</text>
|
||||
<text class="tab-item m-l-20" :class="{ active: type === 'huamao' }"
|
||||
@click="changeType('huamao')">华贸提现</text>
|
||||
</view> -->
|
||||
<view v-if="type === 'yougou'">
|
||||
<view class="bg24 radius12 m-b-32 p-y-30 p-x-28">
|
||||
<view class="flex-center ju-between">
|
||||
<view class="title c0">收款人</view>
|
||||
<view class="c33 flex-center" @click="select"><span style="color: #333">选择</span>
|
||||
<uni-icons class="m-l-10" type="right" color="#333" size="16" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="flex-center border-bottom" style="height: 100rpx" v-for="(v, i) in list" :key="i">
|
||||
<view class="c0">{{ v.title }}</view>
|
||||
<uni-easyinput style="text-align: right" class="flex1" v-model="dataObj[v.value]"
|
||||
:type="v.type || 'text'" :placeholder="v.placeholder" :inputBorder="false"
|
||||
@input="(e) => inputChange(e, v)" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bg24 radius12 p-y-30 p-x-28 card2 pay">
|
||||
<view class="weight500 c0">提现金额</view>
|
||||
<view class="m-b-26 flex-row border-bottom">
|
||||
<span class="size92 c0 m-r-32">¥</span>
|
||||
<uni-easyinput class="flex1" v-model="dataObj.price" type="number" placeholder=""
|
||||
placeholder-style="font-size: 92rpx;" @confirm="onSubmit" :inputBorder="false" :min="0"
|
||||
:clearSize="50" />
|
||||
<!-- @blur="blur" -->
|
||||
|
||||
</view>
|
||||
<view class="m-b-12 c0">
|
||||
当前可提现<span>{{ point }}</span>元, <span class="c3" @click="dataObj.price = point">全部提现</span>
|
||||
</view>
|
||||
<view></view>
|
||||
</view>
|
||||
<view class="size24 m-t-36 m-b-74 line46">
|
||||
<view class="c0">
|
||||
<view>
|
||||
<span class="c_FF2D2D">*</span>
|
||||
{{
|
||||
`提现费率为${config.brokerageWithdrawFeePercent}%,最低提现金额为${config.brokerageWithdrawMinPrice}元`
|
||||
}}
|
||||
</view>
|
||||
|
||||
<view>
|
||||
<span class="c_FF2D2D">*</span>
|
||||
{{ `提现时间为${config.brokerageWithdrawTime}` }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="submit-btn" @click="onSubmit">提现</view>
|
||||
<view class="c2 record"><span @click="goUrl">提现记录</span></view>
|
||||
|
||||
<uni-popup ref="popupRef" type="center" border-radius="12rpx" background-color="#fff">
|
||||
<view class="pop-bar">
|
||||
<view class="close" @click="popClose()"> × </view>
|
||||
<view class="img-box">
|
||||
<image :src="$ygUrl + 'realname_icon.png'" />
|
||||
</view>
|
||||
<view class="size40 line56"> 请您补全您的实名信息 </view>
|
||||
<view class="txt2 size32 line44 m-t-16">
|
||||
为了保障您的账户安全,请尽快 <br />
|
||||
补全您的实名身份信息
|
||||
</view>
|
||||
<view class="btn m-t-50" @click="goReal()"> 去认证 </view>
|
||||
</view>
|
||||
</uni-popup>
|
||||
</view>
|
||||
</s-pages>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
getCurrentInstance
|
||||
} from 'vue';
|
||||
import {
|
||||
onLoad,
|
||||
onShow
|
||||
} from '@dcloudio/uni-app';
|
||||
import * as api from '@/sheep/api/home/pay';
|
||||
import TradeConfigApi from '@/sheep/api/trade/config';
|
||||
import sheep from '@/sheep';
|
||||
import popup from '@/uni_modules/uni-popup/components/uni-popup/popup';
|
||||
import UserApi from '@/sheep/api/member/user';
|
||||
let realStatus = ref(0); //是否已经实名认证
|
||||
const popupRef = ref();
|
||||
const type = ref('yougou');
|
||||
const goUrl = () => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/home/pay/withdrawRecord',
|
||||
});
|
||||
};
|
||||
const changeType = (t) => {
|
||||
type.value = t;
|
||||
};
|
||||
|
||||
const {
|
||||
proxy
|
||||
} = getCurrentInstance();
|
||||
let list = ref([{
|
||||
title: '姓名',
|
||||
value: 'userName',
|
||||
placeholder: '请输入姓名',
|
||||
},
|
||||
{
|
||||
title: '账号',
|
||||
value: 'userAccount',
|
||||
type: 'number',
|
||||
placeholder: '请输入银行账号',
|
||||
},
|
||||
{
|
||||
title: '银行',
|
||||
value: 'bankName',
|
||||
placeholder: '请输入银行名称',
|
||||
},
|
||||
{
|
||||
title: '支行',
|
||||
value: 'bankAddress',
|
||||
placeholder: '请输入支行名称',
|
||||
},
|
||||
]);
|
||||
let dataObj = ref({
|
||||
type: 1,
|
||||
transferChannelCode: 'wx_lite',
|
||||
price: 0,
|
||||
});
|
||||
|
||||
let point = ref(0);
|
||||
const getData = () => {
|
||||
UserApi.getUserInfo().then((res) => {
|
||||
realStatus.value = res.data.realStatus;
|
||||
// console.log(realStatus.value);
|
||||
});
|
||||
api.getWallet().then((res) => {
|
||||
if (res.code === 0) {
|
||||
point.value = proxy.$fen2yuan(res.data.withdrawAmount);
|
||||
}
|
||||
});
|
||||
};
|
||||
const goReal = () => {
|
||||
uni.redirectTo({
|
||||
url: '/pages/public/realname?status=' + realStatus.value,
|
||||
// query: obj,
|
||||
});
|
||||
popupRef.value.close();
|
||||
};
|
||||
const popClose = () => {
|
||||
popupRef.value.close();
|
||||
};
|
||||
const onSubmit = () => {
|
||||
if (type.value === 'yougou') {
|
||||
submit();
|
||||
} else {
|
||||
submit2();
|
||||
}
|
||||
};
|
||||
// 提现
|
||||
const submit = () => {
|
||||
//未实名不能去提现
|
||||
if (realStatus.value === 0) {
|
||||
popupRef.value.open('center');
|
||||
return;
|
||||
}
|
||||
let monney = Number(dataObj.value.price);//输入框提现金额
|
||||
let minMoney = config.value.brokerageWithdrawMinPrice;// 提现最小金额
|
||||
// console.log(monney,minMoney);
|
||||
if (monney < minMoney) {
|
||||
sheep.$helper.toast(`提现金额不能小于${minMoney}元`);
|
||||
return;
|
||||
}
|
||||
if (monney > Number(point.value)) {
|
||||
sheep.$helper.toast('提现金额不能大于可提现金额');
|
||||
dataObj.value.price = point.value;
|
||||
return;
|
||||
}
|
||||
if (!dataObj.value.userName) {
|
||||
sheep.$helper.toast('请输入姓名');
|
||||
return;
|
||||
}
|
||||
if (!dataObj.value.userAccount) {
|
||||
sheep.$helper.toast('请输入账号账号');
|
||||
return;
|
||||
}
|
||||
if (!dataObj.value.bankName) {
|
||||
sheep.$helper.toast('请输入银行名称');
|
||||
return;
|
||||
}
|
||||
if (!dataObj.value.bankAddress) {
|
||||
sheep.$helper.toast('请输入支行名称');
|
||||
return;
|
||||
}
|
||||
if (!dataObj.value.price) {
|
||||
sheep.$helper.toast('请输入提现金额');
|
||||
return;
|
||||
}
|
||||
let obj = JSON.parse(JSON.stringify(dataObj.value));
|
||||
obj.price = obj.price * 100;
|
||||
api.createBrokerageWithdraw(obj).then((res) => {
|
||||
if (res.code === 0) {
|
||||
dataObj.value = {
|
||||
type: 2,
|
||||
transferChannelCode: 'wx_lite',
|
||||
price: 0,
|
||||
};
|
||||
getData();
|
||||
}
|
||||
// console.log(res);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
//huamao提现
|
||||
function submit2() {
|
||||
let monney = Number(dataObj.value.price);//输入框提现金额
|
||||
let minMoney = config.value.brokerageWithdrawMinPrice;// Huamao提现最小金额
|
||||
// console.log(monney,minMoney);
|
||||
if (monney < minMoney) {
|
||||
sheep.$helper.toast(`提现金额不能小于${minMoney}元`);
|
||||
return;
|
||||
}
|
||||
if (monney > Number(point.value)) {
|
||||
sheep.$helper.toast('提现金额不能大于可提现金额');
|
||||
dataObj.value.price = point.value;
|
||||
return;
|
||||
}
|
||||
api.hmPayExpenditure({
|
||||
price: monney * 100,
|
||||
}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
dataObj.value = {
|
||||
type: 2,
|
||||
transferChannelCode: 'wx_lite',
|
||||
price: 0,
|
||||
};
|
||||
getData();
|
||||
}
|
||||
// console.log(res);
|
||||
});
|
||||
}
|
||||
|
||||
const blur = () => {
|
||||
// console.log(config.value.brokerageWithdrawMinPrice);
|
||||
if (Number(dataObj.value.price) < 0) {
|
||||
sheep.$helper.toast('提现金额不能小于0');
|
||||
dataObj.value.price = 0;
|
||||
return;
|
||||
}
|
||||
if (Number(dataObj.value.price) < proxy.$fen2yuan(config.value.brokerageWithdrawMinPrice)) {
|
||||
sheep.$helper.toast(`提现金额不能小于${proxy.$fen2yuan(config.value.brokerageWithdrawMinPrice)}元`);
|
||||
return;
|
||||
}
|
||||
if (Number(dataObj.value.price) > Number(point.value)) {
|
||||
sheep.$helper.toast('提现金额不能大于可提现金额');
|
||||
dataObj.value.price = point.value;
|
||||
return;
|
||||
}
|
||||
};
|
||||
const inputChange = (e, v) => {
|
||||
let obj = {
|
||||
bankNo: e.detail.value,
|
||||
};
|
||||
if (v.value == 'userAccount') {
|
||||
api.getBank(obj).then((res) => {
|
||||
if (res.code === 0) {
|
||||
console.log(res);
|
||||
dataObj.value.bankName = res.data;
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
let bankList = ref([]);
|
||||
let bankText = ref([]);
|
||||
const getBankList = () => {
|
||||
api.getBankList({}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
res.data.forEach((item) => {
|
||||
// 取银行卡后四位
|
||||
item.text = `${item.bankName}(${item.cardNumber.slice(-4)})`;
|
||||
bankText.value.push(item.text);
|
||||
});
|
||||
bankList.value = res.data;
|
||||
|
||||
if (res?.data?.length) {
|
||||
let obj = res.data[0];
|
||||
dataObj.value = {
|
||||
...dataObj.value,
|
||||
userName: obj.trueName,
|
||||
userAccount: obj.cardNumber,
|
||||
bankName: obj.bankName,
|
||||
bankAddress: obj.bankAddress,
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
const select = () => {
|
||||
uni.showActionSheet({
|
||||
itemList: bankText.value,
|
||||
success: ({
|
||||
tapIndex
|
||||
}) => {
|
||||
let obj = bankList.value[tapIndex];
|
||||
dataObj.value = {
|
||||
...dataObj.value,
|
||||
userName: obj.trueName,
|
||||
userAccount: obj.cardNumber,
|
||||
bankName: obj.bankName,
|
||||
};
|
||||
},
|
||||
fail: (error) => { },
|
||||
});
|
||||
};
|
||||
let config = ref({
|
||||
brokerageWithdrawMinPrice: 0,
|
||||
brokerageWithdrawFeePercent: 0,
|
||||
brokerageWithdrawTime: '',
|
||||
});
|
||||
onLoad(() => {
|
||||
getBankList();
|
||||
});
|
||||
onShow(async () => {
|
||||
getData();
|
||||
getBankList();
|
||||
let {
|
||||
code,
|
||||
data
|
||||
} = await TradeConfigApi.getTradeConfig();
|
||||
if (code === 0) {
|
||||
config.value.brokerageWithdrawMinPrice = Number(proxy.$fen2yuan(data.brokerageWithdrawMinPrice));
|
||||
config.value.brokerageWithdrawFeePercent = data.brokerageWithdrawFeePercent;
|
||||
config.value.brokerageWithdrawTime = data.brokerageWithdrawTime;
|
||||
console.log(config.value);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.pop-bar {
|
||||
padding: 46rpx 28rpx;
|
||||
position: relative;
|
||||
|
||||
.close {
|
||||
width: 56rpx;
|
||||
height: 56rpx;
|
||||
line-height: 56rpx;
|
||||
background: #dddddd;
|
||||
border-radius: 50%;
|
||||
color: #000;
|
||||
position: absolute;
|
||||
right: -24rpx;
|
||||
top: -24rpx;
|
||||
}
|
||||
|
||||
.img-box {
|
||||
width: 372rpx;
|
||||
height: 380rpx;
|
||||
margin: 0 auto;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.txt2 {
|
||||
color: #676767;
|
||||
}
|
||||
|
||||
.btn {
|
||||
width: 608rpx;
|
||||
height: 82rpx;
|
||||
line-height: 82rpx;
|
||||
text-align: center;
|
||||
background: linear-gradient(130deg, #fa8735 0%, #fe3b48 100%);
|
||||
border-radius: 12rpx;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.record {
|
||||
text-align: center;
|
||||
padding: 36rpx 0;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.bc_white {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
:deep(.uni-icons) {
|
||||
font-size: 24rpx !important;
|
||||
}
|
||||
|
||||
.pay {
|
||||
:deep(.uni-easyinput__content) {
|
||||
height: 108rpx;
|
||||
font-size: 92rpx;
|
||||
}
|
||||
|
||||
:deep(.uni-easyinput__content-input) {
|
||||
height: 108rpx;
|
||||
font-size: 92rpx;
|
||||
}
|
||||
|
||||
:deep(.uni-easyinput__placeholder-class) {
|
||||
font-size: 92rpx;
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.uni-input-input) {
|
||||
// color: #ffffff;
|
||||
}
|
||||
|
||||
.infotext {
|
||||
height: 62rpx;
|
||||
background: #f2f2f2;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
|
||||
.c_FA7E31 {
|
||||
color: #fa7e31;
|
||||
}
|
||||
|
||||
.c_FF2D2D {
|
||||
color: #ff2d2d;
|
||||
}
|
||||
|
||||
.c_666 {
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.size92 {
|
||||
font-size: 92rpx;
|
||||
}
|
||||
|
||||
:deep(.uniui-left) {
|
||||
font-size: 44rpx !important;
|
||||
}
|
||||
|
||||
:deep(.uni-icons) {
|
||||
font-size: 44rpx !important;
|
||||
}
|
||||
|
||||
.tab-header {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.tab-item {
|
||||
font-size: 30rpx;
|
||||
padding-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.active {
|
||||
color: #ff5040;
|
||||
border-bottom: 4rpx solid #ff5040;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,193 @@
|
||||
<template>
|
||||
<s-layout :bgStyle="{ color: 'var(--color1)' }" title="提现">
|
||||
<view class="pages p-y-28 p-x-40 c0">
|
||||
<view class="bg24 radius12 m-b-32 p-y-30 p-x-28">
|
||||
<view class="title c0">收款人</view>
|
||||
<view
|
||||
class="flex-center border-bottom"
|
||||
style="height: 100rpx"
|
||||
v-for="(v, i) in list"
|
||||
:key="i"
|
||||
>
|
||||
<view class="c0">{{ v.title }}</view>
|
||||
<uni-easyinput
|
||||
style="text-align: right"
|
||||
class="flex1"
|
||||
v-model="dataObj[v.value]"
|
||||
:type="v.type || 'text'"
|
||||
:placeholder="v.placeholder"
|
||||
:inputBorder="false"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bg24 radius12 p-y-30 p-x-28 card2 pay">
|
||||
<view class="weight500 c0">提现金额</view>
|
||||
<view class="m-b-26 flex-row border-bottom"
|
||||
><span class="size92 m-r-32">¥</span
|
||||
><uni-easyinput
|
||||
class="flex1"
|
||||
v-model="dataObj.price"
|
||||
type="number"
|
||||
placeholder=""
|
||||
placeholder-style="font-size: 92rpx;"
|
||||
@confirm="submit"
|
||||
:inputBorder="false"
|
||||
:min="0"
|
||||
@blur="blur"
|
||||
:clearSize="50"
|
||||
/></view>
|
||||
<view class="m-b-12 c0">
|
||||
当前可提现<span>{{ point }}</span
|
||||
>元, <span class="c3" @click="dataObj.price = point">全部提现</span>
|
||||
</view>
|
||||
<view></view>
|
||||
</view>
|
||||
<view class="size24 m-t-36 m-b-74">
|
||||
<view class="m-b-24"> <span class="c_FF2D2D">*</span>最低提现金额为0元 </view>
|
||||
<view class="c0">
|
||||
<span class="c_FF2D2D">*</span>提现费率为0%,最低收取0元,最高收取0元
|
||||
</view>
|
||||
</view>
|
||||
<view class="submit-btn" @click="submit">提现</view>
|
||||
</view>
|
||||
</s-layout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, getCurrentInstance } from 'vue';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import * as api from '@/sheep/api/home/pay';
|
||||
import sheep from '@/sheep';
|
||||
const { proxy } = getCurrentInstance();
|
||||
let list = ref([
|
||||
{
|
||||
title: '姓名',
|
||||
value: 'userName',
|
||||
placeholder: '请输入姓名',
|
||||
},
|
||||
{
|
||||
title: '账号',
|
||||
value: 'userAccount',
|
||||
type: 'number',
|
||||
placeholder: '请输入银行账号',
|
||||
},
|
||||
{
|
||||
title: '银行',
|
||||
value: 'bankName',
|
||||
placeholder: '请输入银行名称',
|
||||
},
|
||||
]);
|
||||
let dataObj = ref({
|
||||
type: 1,
|
||||
transferChannelCode: 'wx_lite',
|
||||
price: 0,
|
||||
});
|
||||
|
||||
let point = ref(0);
|
||||
const getData = () => {
|
||||
api.getWallet().then((res) => {
|
||||
if (res.code === 0) {
|
||||
point.value = proxy.$fen2yuan(res.data.balance);
|
||||
}
|
||||
});
|
||||
};
|
||||
const submit = () => {
|
||||
if (dataObj.value.price > point.value) {
|
||||
sheep.$helper.toast('提现金额不能大于可提现金额');
|
||||
dataObj.value.price = point.value;
|
||||
return;
|
||||
}
|
||||
if (!dataObj.value.userName) {
|
||||
sheep.$helper.toast('请输入姓名');
|
||||
return;
|
||||
}
|
||||
if (!dataObj.value.userAccount) {
|
||||
sheep.$helper.toast('请输入账号账号');
|
||||
return;
|
||||
}
|
||||
if (!dataObj.value.bankName) {
|
||||
sheep.$helper.toast('请输入银行名称');
|
||||
return;
|
||||
}
|
||||
if (!dataObj.value.price) {
|
||||
sheep.$helper.toast('请输入提现金额');
|
||||
return;
|
||||
}
|
||||
let obj = JSON.parse(JSON.stringify(dataObj.value));
|
||||
obj.price = obj.price * 100;
|
||||
api.createBrokerageWithdraw(obj).then((res) => {
|
||||
if (res.code === 0) {
|
||||
dataObj.value = {
|
||||
type: 2,
|
||||
transferChannelCode: 'wx_lite',
|
||||
price: 0,
|
||||
};
|
||||
getData();
|
||||
}
|
||||
console.log(res);
|
||||
});
|
||||
};
|
||||
const blur = () => {
|
||||
if (dataObj.value.price < 0) {
|
||||
sheep.$helper.toast('提现金额不能小于0');
|
||||
dataObj.value.price = 0;
|
||||
return;
|
||||
}
|
||||
if (dataObj.value.price > point.value) {
|
||||
sheep.$helper.toast('提现金额不能大于可提现金额');
|
||||
dataObj.value.price = point.value;
|
||||
return;
|
||||
}
|
||||
};
|
||||
onShow(() => {
|
||||
getData();
|
||||
});
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.bc_white {
|
||||
background-color: #fff;
|
||||
}
|
||||
:deep(.uni-icons) {
|
||||
font-size: 24rpx !important;
|
||||
}
|
||||
.pay {
|
||||
:deep(.uni-easyinput__content) {
|
||||
height: 108rpx;
|
||||
font-size: 92rpx;
|
||||
}
|
||||
:deep(.uni-easyinput__content-input) {
|
||||
height: 108rpx;
|
||||
font-size: 92rpx;
|
||||
}
|
||||
:deep(.uni-easyinput__placeholder-class) {
|
||||
font-size: 92rpx;
|
||||
}
|
||||
}
|
||||
:deep(.uni-input-input) {
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.infotext {
|
||||
height: 62rpx;
|
||||
background: #f2f2f2;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
.c_FA7E31 {
|
||||
color: #fa7e31;
|
||||
}
|
||||
.c_FF2D2D {
|
||||
color: #ff2d2d;
|
||||
}
|
||||
.c_666 {
|
||||
color: #666;
|
||||
}
|
||||
.size92 {
|
||||
font-size: 92rpx;
|
||||
}
|
||||
:deep(.uniui-left) {
|
||||
font-size: 44rpx !important;
|
||||
}
|
||||
:deep(.uni-icons) {
|
||||
font-size: 44rpx !important;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,79 @@
|
||||
<template>
|
||||
<s-pages title="提现记录">
|
||||
<card_mescroll ref="cardPages" @upCallback="getList" :height="height">
|
||||
<view class="bg24 radius12 m-x-42 p-y-28 p-x-40" v-if="detailList.length">
|
||||
<view
|
||||
class="flex-between border-bottom"
|
||||
style="height: 150rpx"
|
||||
v-for="(v, i) in detailList"
|
||||
:key="i"
|
||||
>
|
||||
<view class="c0">
|
||||
<view class="size28"> {{ v.typeName }}-提现到银行卡 </view>
|
||||
<view class="c_999 size24 m-t-10">
|
||||
{{ sheep.$helper.timeFormat(v.createTime, 'yyyy-mm-dd hh:MM:ss') }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="c0">
|
||||
<view class="size28 price">
|
||||
{{ fen2yuan(v.price) }}
|
||||
</view>
|
||||
<view class="status size24 m-t-10">
|
||||
{{ v.statusName }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</card_mescroll>
|
||||
</s-pages>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import sheep from '@/sheep';
|
||||
import { ref } from 'vue';
|
||||
import * as api from '@/sheep/api/home/pay';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import card_mescroll from '@/components/card_pages/card_mescroll.vue';
|
||||
import { fen2yuan } from '@/sheep/hooks/useGoods';
|
||||
let detailList = ref([]);
|
||||
let height = ref('100%');
|
||||
let sysInfo = uni.getSystemInfoSync();
|
||||
height.value = sysInfo.windowHeight - sysInfo.statusBarHeight - uni.upx2px(88) + 'px';
|
||||
let cardPages = ref(null);
|
||||
const getList = async (mescroll) => {
|
||||
let res = await api.withdrawRecord({
|
||||
pageNo: mescroll.num,
|
||||
pageSize: mescroll.size,
|
||||
});
|
||||
if (res.code === 0) {
|
||||
let data = res.data.list || [];
|
||||
if (mescroll.num == 1) detailList.value = [];
|
||||
detailList.value = detailList.value.concat(data);
|
||||
cardPages.value.getState(true, data.length);
|
||||
} else {
|
||||
cardPages.value.getState(false);
|
||||
}
|
||||
// api.withdrawRecord().then((e) => {
|
||||
// if (e.code === 0) {
|
||||
// detailList.value = e.data.list;
|
||||
// console.log(e.data.list);
|
||||
// list.value = e.data.list;
|
||||
// }
|
||||
// });
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.price {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.status {
|
||||
text-align: right;
|
||||
color: #366eee;
|
||||
}
|
||||
|
||||
.nomore {
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,199 @@
|
||||
<template>
|
||||
<s-layout :bgStyle="{ color: 'var(--color1)' }" title="修改手机号">
|
||||
<view class="pages flex-column ju-between">
|
||||
<card_list class="cardList" :arr="listArr">
|
||||
<template #footer-2>
|
||||
<view class="flex-center">
|
||||
<uni-easyinput
|
||||
v-if="num > 0 && num < 60"
|
||||
:inputBorder="false"
|
||||
v-model="formData.oldCode"
|
||||
type="number"
|
||||
placeholder="请输入验证码"
|
||||
></uni-easyinput>
|
||||
<view class="c_primary size28" @click="getCode">{{
|
||||
num > 0 && num < 60 ? num + 's后重新获取' : '获取验证码'
|
||||
}}</view>
|
||||
</view>
|
||||
</template>
|
||||
<template #footer-3>
|
||||
<uni-easyinput
|
||||
:inputBorder="false"
|
||||
v-model="formData.mobile1"
|
||||
type="number"
|
||||
placeholder="请输入手机号"
|
||||
maxlength="11"
|
||||
minlength="11"
|
||||
></uni-easyinput>
|
||||
</template>
|
||||
<template #footer-4>
|
||||
<view class="flex-center">
|
||||
<uni-easyinput
|
||||
style="width: 200rpx"
|
||||
v-if="num1 > 0 && num1 < 60"
|
||||
:inputBorder="false"
|
||||
v-model="formData.code"
|
||||
type="number"
|
||||
placeholder="请输入验证码"
|
||||
maxlength="4"
|
||||
minlength="4"
|
||||
></uni-easyinput>
|
||||
<view class="c_primary size28" @click="getCode1">{{
|
||||
num1 > 0 && num1 < 60 ? num1 + 's后重新获取' : '获取验证码'
|
||||
}}</view>
|
||||
</view>
|
||||
</template>
|
||||
</card_list>
|
||||
<view class="absolute b130 l0 w100 p-x-40">
|
||||
<view class="submit-btn m-b-20" @click="sub">确定</view>
|
||||
</view>
|
||||
</view>
|
||||
</s-layout>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import sheep from '@/sheep';
|
||||
import { ref, reactive, onMounted, onUnmounted, getCurrentInstance, watch, nextTick } from 'vue';
|
||||
import card_list from '@/components/card_list/card_list.vue';
|
||||
import UserApi from '@/sheep/api/member/user';
|
||||
import AuthUtil from '@/sheep/api/member/auth';
|
||||
let timer = ref(null);
|
||||
let timer1 = ref(null);
|
||||
let { proxy } = getCurrentInstance();
|
||||
let listArr = ref([
|
||||
{
|
||||
id: '1',
|
||||
title: '原手机号',
|
||||
rightText: '',
|
||||
},
|
||||
// {
|
||||
// id: '2',
|
||||
// title: '原手机验证码',
|
||||
// rightText: '',
|
||||
// type: 'config',
|
||||
// },
|
||||
{
|
||||
id: '3',
|
||||
title: '新手机号',
|
||||
rightText: '',
|
||||
type: 'input',
|
||||
typeObj: {
|
||||
type: 'number',
|
||||
placeholder: '请输入手机号',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: '4',
|
||||
title: '新手机验证码',
|
||||
rightText: '',
|
||||
type: 'config',
|
||||
},
|
||||
]);
|
||||
let formData = ref({});
|
||||
let num = ref(0);
|
||||
let num1 = ref(0);
|
||||
const getCode1 = () => {
|
||||
if (num1.value > 0) {
|
||||
return;
|
||||
}
|
||||
if (!formData.value.mobile1) {
|
||||
uni.showToast({
|
||||
title: '请输入手机号',
|
||||
icon: 'none',
|
||||
});
|
||||
return;
|
||||
}
|
||||
sendCode1();
|
||||
};
|
||||
const getCode = () => {
|
||||
if (num.value > 0) {
|
||||
return;
|
||||
}
|
||||
sendCode();
|
||||
};
|
||||
const sendCode = async () => {
|
||||
AuthUtil.sendSmsCode(formData.value.mobile, 3).then((res) => {
|
||||
if (res.code === 0) {
|
||||
num.value = 60;
|
||||
timer.value = setInterval(() => {
|
||||
num.value--;
|
||||
if (num.value <= 0) {
|
||||
clearInterval(timer.value);
|
||||
num.value = 60;
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
};
|
||||
const sendCode1 = async () => {
|
||||
AuthUtil.sendSmsCode(formData.value.mobile1, 3).then((res) => {
|
||||
if (res.code === 0) {
|
||||
num1.value = 60;
|
||||
timer1.value = setInterval(() => {
|
||||
num1.value--;
|
||||
if (num1.value <= 0) {
|
||||
clearInterval(timer1.value);
|
||||
num1.value = 60;
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
};
|
||||
let dataInfo = ref({});
|
||||
const getData = () => {
|
||||
sheep
|
||||
.$store('user')
|
||||
.getInfo()
|
||||
.then((res) => {
|
||||
dataInfo.value = res;
|
||||
formData.value.mobile = res.mobile;
|
||||
listArr.value[0].rightText = res.mobile;
|
||||
});
|
||||
};
|
||||
getData();
|
||||
const sub = () => {
|
||||
if (!formData.value.code || formData.value.oldCode === '') {
|
||||
uni.showToast({
|
||||
title: '请输入验证码',
|
||||
icon: 'none',
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!formData.value.mobile1) {
|
||||
uni.showToast({
|
||||
title: '请输入手机号',
|
||||
icon: 'none',
|
||||
});
|
||||
return;
|
||||
}
|
||||
UserApi.updateUserMobile({
|
||||
oldCode: formData.value.oldCode,
|
||||
mobile: formData.value.mobile1,
|
||||
code: formData.value.code,
|
||||
}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
getData();
|
||||
}
|
||||
});
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
:deep(input) {
|
||||
text-align: right;
|
||||
}
|
||||
.pages {
|
||||
padding: 30rpx 40rpx;
|
||||
padding-bottom: 64rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.cardList {
|
||||
background-color: var(--color24);
|
||||
border-radius: 8rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
:deep(.uni-list-item__container) {
|
||||
align-items: center !important;
|
||||
}
|
||||
:deep(.uni-input-input) {
|
||||
color: #ffffff;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,380 @@
|
||||
<template>
|
||||
<s-layout :title="dataObj.title" navbar="inner">
|
||||
<view class="pages h100">
|
||||
<image
|
||||
class="w100 bg"
|
||||
:src="$url + 'home/points_1.png'"
|
||||
mode="widthFix"
|
||||
:style="{ top: paddingTop + 'px' }"
|
||||
/>
|
||||
<view class="pages_con">
|
||||
<!-- :style="{ marginTop: marginTop + 'px' }" -->
|
||||
<view class="page_top c0">
|
||||
<view class="size28 name">{{ dataObj.name }}</view>
|
||||
<view class="flex-row al-flex-end">
|
||||
<view class="num">{{ dataObj.num }}{{ dataObj.unit }}</view>
|
||||
<view class="btn size24 btn_bg" @click="goUrl">{{ dataObj.btn }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="page_bottom bg24">
|
||||
<view class="bottom_title center c0"> 收支明细 </view>
|
||||
<view class="bottom_list flex-center al-flex-start ju-between" v-if="type == 5">
|
||||
<view class="flex-row">
|
||||
<view
|
||||
class="navItem"
|
||||
v-for="(v, i) in navList"
|
||||
:key="i"
|
||||
:class="{ activeNav: navIndex === i }"
|
||||
@click="navChange(i)"
|
||||
>
|
||||
<view class="size28">{{ v.name }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-row">
|
||||
<view
|
||||
class="typeItem flex-center size24"
|
||||
v-for="(v, i) in typeArr"
|
||||
:key="i"
|
||||
:class="{ activeType: typeIndex === i }"
|
||||
@click="typeIndex = i"
|
||||
>
|
||||
{{ v.name }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<card_mescroll ref="cardPages" @upCallback="getList" :height="height + 'px'">
|
||||
<view
|
||||
v-for="(v, i) in detailList"
|
||||
:key="i"
|
||||
class="flex-center ju-between p-b-34 p-t-32 border-bottom"
|
||||
>
|
||||
<view>
|
||||
<view class="size28 line40 m-b-10 c0">{{ v[dataObj.titleName] }}</view>
|
||||
<view class="size24 c_999 line34">{{ formatDate(v.createTime) }}</view>
|
||||
</view>
|
||||
<view>{{ dataObj.numValue }}</view>
|
||||
<view class="size32 c_EE0A24">{{
|
||||
dataObj.sourceName && v[dataObj?.sourceName] === 1
|
||||
? (dataObj.sourceName ? '+' : '') + v[dataObj.numName]
|
||||
: (dataObj.sourceName ? '-' : '') + v[dataObj.numName]
|
||||
}}</view>
|
||||
</view>
|
||||
</card_mescroll>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</s-layout>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import sheep from '@/sheep';
|
||||
import { ref, reactive, onMounted, onUnmounted, getCurrentInstance, watch, nextTick } from 'vue';
|
||||
import * as api from '@/sheep/api/home/pay';
|
||||
import * as pointsApi from '@/sheep/api/home/points';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import card_mescroll from '@/components/card_pages/card_mescroll.vue';
|
||||
|
||||
import { formatDate } from '@/sheep/helper/utils';
|
||||
let { proxy } = getCurrentInstance();
|
||||
let dataObj = reactive({
|
||||
title: '我的积分',
|
||||
name: '我的积分',
|
||||
num: 0,
|
||||
btn: '去提现',
|
||||
list: [],
|
||||
unit: '',
|
||||
url: '',
|
||||
numName: 'changeAmount',
|
||||
sourceName: 'bizType',
|
||||
listApi: pointsApi.integraldetai,
|
||||
titleName: 'remark',
|
||||
});
|
||||
let navList = ref([
|
||||
{
|
||||
name: '全部',
|
||||
url: api.getWalletTransactionPage,
|
||||
title: 'title',
|
||||
numName: 'price',
|
||||
sourceName: '',
|
||||
},
|
||||
{
|
||||
name: '佣金',
|
||||
url: api.commissionDetailPage,
|
||||
title: 'remark',
|
||||
numName: 'amount',
|
||||
sourceName: '',
|
||||
},
|
||||
{
|
||||
name: '代理收益',
|
||||
url: api.agentEarningsDetailPage,
|
||||
title: 'remark',
|
||||
numName: 'totalEarnings',
|
||||
sourceName: '',
|
||||
},
|
||||
{
|
||||
name: '分红',
|
||||
url: api.dividendDetailPage,
|
||||
title: 'remark',
|
||||
numName: 'amount',
|
||||
sourceName: '',
|
||||
},
|
||||
]);
|
||||
let typeArr = ref([
|
||||
{
|
||||
name: '收入',
|
||||
transactionType: 1,
|
||||
},
|
||||
{
|
||||
name: '支出',
|
||||
transactionType: 2,
|
||||
},
|
||||
]);
|
||||
let navIndex = ref(0);
|
||||
let typeIndex = ref(0);
|
||||
let marginTop = ref();
|
||||
let height = ref(0);
|
||||
let sysInfo = uni.getSystemInfoSync();
|
||||
const windowHeight = sysInfo.windowHeight;
|
||||
marginTop.value = sysInfo.statusBarHeight + uni.upx2px(88) + uni.upx2px(54);
|
||||
let urlAPI = ref(api.getWallet);
|
||||
height.value =
|
||||
windowHeight -
|
||||
sysInfo.statusBarHeight -
|
||||
marginTop.value -
|
||||
uni.upx2px(204) -
|
||||
uni.upx2px(110) -
|
||||
uni.upx2px(48) -
|
||||
uni.upx2px(40);
|
||||
|
||||
const getData = () => {
|
||||
urlAPI.value().then((res) => {
|
||||
if (res.code === 0) {
|
||||
dataObj.num = proxy.$fen2yuan(res.data.balance);
|
||||
}
|
||||
});
|
||||
};
|
||||
let cardPages = ref(null);
|
||||
let detailList = ref([]);
|
||||
const getList = (mescroll) => {
|
||||
let urlApi = navList.value[navIndex.value].url;
|
||||
if (type.value == 5) {
|
||||
urlApi = navList.value[navIndex.value].url;
|
||||
} else {
|
||||
urlApi = dataObj.listApi;
|
||||
}
|
||||
let obj = {
|
||||
pageNo: mescroll.num,
|
||||
pageSize: mescroll.size,
|
||||
transactionType: typeArr.value[typeIndex.value].transactionType,
|
||||
type: typeArr.value[typeIndex.value].transactionType,
|
||||
};
|
||||
if (type.value == 5 && navIndex.value == 0) {
|
||||
delete obj.transactionType;
|
||||
} else {
|
||||
delete obj.type;
|
||||
}
|
||||
urlApi(obj).then((res) => {
|
||||
if (res.code === 0) {
|
||||
let list = res.data.list || [];
|
||||
if (list.length && (type.value == 5 || type.value == 4)) {
|
||||
list.forEach((item) => {
|
||||
item[dataObj.numName || 'price'] = proxy.$fen2yuan(item[dataObj.numName || 'price']);
|
||||
});
|
||||
}
|
||||
if (mescroll.num == 1) detailList.value = [];
|
||||
detailList.value = detailList.value.concat(list);
|
||||
cardPages.value.getState(true, list.length);
|
||||
} else {
|
||||
cardPages.value.getState(false);
|
||||
}
|
||||
});
|
||||
};
|
||||
let type = ref(1);
|
||||
const dataChange = async () => {
|
||||
let userInfo = await sheep.$store('user').getInfo();
|
||||
if (type.value) {
|
||||
type.value = Number(type.value);
|
||||
switch (Number(type.value)) {
|
||||
case 1:
|
||||
dataObj.title = '绿色积分';
|
||||
dataObj.name = '我的积分';
|
||||
dataObj.btn = '去兑换';
|
||||
dataObj.num = userInfo.point;
|
||||
dataObj.url = '/pages/home/pay/seed';
|
||||
dataObj.listApi = pointsApi.integraldetai;
|
||||
dataObj.numName = 'changeAmount';
|
||||
dataObj.sourceName = '';
|
||||
break;
|
||||
case 2:
|
||||
dataObj.title = '佣金';
|
||||
dataObj.name = '我的佣金';
|
||||
dataObj.num = userInfo.commission;
|
||||
dataObj.unit = '元';
|
||||
dataObj.listApi = pointsApi.commission;
|
||||
dataObj.numName = 'amount';
|
||||
dataObj.sourceName = '';
|
||||
break;
|
||||
case 3:
|
||||
dataObj.title = '代理收益';
|
||||
dataObj.name = '我的代理收益';
|
||||
dataObj.num = userInfo.agentEarning;
|
||||
dataObj.unit = '元';
|
||||
dataObj.listApi = pointsApi.agentearnings;
|
||||
dataObj.numName = 'totalEarnings';
|
||||
dataObj.sourceName = '';
|
||||
break;
|
||||
case 4:
|
||||
dataObj.title = '消费金';
|
||||
dataObj.name = '我的消费金';
|
||||
dataObj.btn = '去消费';
|
||||
dataObj.num = proxy.$fen2yuan(userInfo.consumptionGold);
|
||||
dataObj.unit = '';
|
||||
dataObj.url = '/pages/goods/list';
|
||||
dataObj.listApi = pointsApi.consumptiongold;
|
||||
dataObj.numName = 'amount';
|
||||
dataObj.sourceName = '';
|
||||
break;
|
||||
case 5:
|
||||
navChange(0);
|
||||
dataObj.title = '钱包';
|
||||
dataObj.name = '可提现金额';
|
||||
dataObj.btn = '去提现';
|
||||
dataObj.num = proxy.$fen2yuan(userInfo.wallet);
|
||||
dataObj.unit = '元';
|
||||
dataObj.url = '/pages/home/pay/withdraw';
|
||||
getData();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// getList();
|
||||
}
|
||||
if (cardPages.value) {
|
||||
cardPages.value.mescrollTrigger();
|
||||
}
|
||||
};
|
||||
onLoad(async (e) => {
|
||||
type.value = e.type;
|
||||
});
|
||||
onShow(() => {
|
||||
dataChange();
|
||||
});
|
||||
watch(
|
||||
() => [navIndex.value, typeIndex.value],
|
||||
() => {
|
||||
cardPages.value.mescrollTrigger();
|
||||
},
|
||||
);
|
||||
onShow(() => {
|
||||
if (cardPages.value) {
|
||||
cardPages.value.mescrollTrigger();
|
||||
}
|
||||
if (type.value == 5) {
|
||||
getData();
|
||||
}
|
||||
});
|
||||
const goUrl = () => {
|
||||
uni.navigateTo({
|
||||
url: dataObj.url,
|
||||
});
|
||||
};
|
||||
const navChange = (index) => {
|
||||
dataObj.numName = navList.value[index].numName;
|
||||
dataObj.sourceName = navList.value[index].sourceName;
|
||||
dataObj.titleName = navList.value[index].title;
|
||||
navIndex.value = index;
|
||||
};
|
||||
let statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
|
||||
let paddingTop = ref();
|
||||
paddingTop.value = -(statusBarHeight + 44);
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.pages {
|
||||
position: relative;
|
||||
|
||||
.bg {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.pages_con {
|
||||
position: relative;
|
||||
padding: 0 40rpx;
|
||||
box-sizing: border-box;
|
||||
z-index: 1;
|
||||
|
||||
.page_top {
|
||||
height: 204rpx;
|
||||
color: #1a1a1a;
|
||||
|
||||
.name {
|
||||
}
|
||||
|
||||
.num {
|
||||
font-size: 68rpx;
|
||||
}
|
||||
|
||||
.btn {
|
||||
background: linear-gradient(131deg, #f7772e 0%, #ee0a24 100%);
|
||||
height: 52rpx;
|
||||
line-height: 52rpx;
|
||||
width: 112rpx;
|
||||
text-align: center;
|
||||
border-radius: 26rpx;
|
||||
color: #ffffff;
|
||||
margin-bottom: 10rpx;
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.page_bottom {
|
||||
background-color: #fff;
|
||||
border-radius: 24rpx;
|
||||
padding: 0 16rpx;
|
||||
|
||||
.bottom_title {
|
||||
line-height: 110rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.navItem {
|
||||
margin-bottom: 20rpx;
|
||||
margin-right: 32rpx;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.activeNav {
|
||||
position: relative;
|
||||
color: var(--color32);
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
width: 40rpx;
|
||||
height: 6rpx;
|
||||
background: linear-gradient(131deg, var(--color30) 0%, var(--color32) 100%), #fa7e31;
|
||||
border-radius: 4rpx;
|
||||
position: absolute;
|
||||
bottom: -14rpx;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
}
|
||||
|
||||
.typeItem {
|
||||
width: 76rpx;
|
||||
height: 40rpx;
|
||||
background-color: #f2f2f2;
|
||||
border-radius: 8rpx;
|
||||
margin-left: 12rpx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.activeType {
|
||||
color: var(--color30);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,357 @@
|
||||
<template>
|
||||
<s-layout :bgStyle="{ color: 'var(--color1)' }" :title="dataObj.title">
|
||||
<view class="pages">
|
||||
<image class="w100 bg" :src="$url + 'home/points.png'" mode="widthFix" />
|
||||
<view class="pages_con">
|
||||
<view class="page_top c0" :style="{ marginTop: marginTop + 'px' }">
|
||||
<view class="size28 name">{{ dataObj.name }}</view>
|
||||
<view class="flex-row al-flex-end">
|
||||
<view class="num">{{ dataObj.num }}{{ dataObj.unit }}</view>
|
||||
<view class="btn size24 btn_bg" @click="goUrl">{{ dataObj.btn }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="page_bottom bg24">
|
||||
<view class="bottom_title center c0"> 收支明细 </view>
|
||||
<view class="bottom_list flex-center al-flex-start ju-between" v-if="type == 5">
|
||||
<view class="flex-row">
|
||||
<view
|
||||
class="navItem"
|
||||
v-for="(v, i) in navList"
|
||||
:key="i"
|
||||
:class="{ activeNav: navIndex === i }"
|
||||
@click="navChange(i)"
|
||||
>
|
||||
<view class="size28">{{ v.name }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-row">
|
||||
<view
|
||||
class="typeItem flex-center size24"
|
||||
v-for="(v, i) in typeArr"
|
||||
:key="i"
|
||||
:class="{ activeType: typeIndex === i }"
|
||||
@click="typeIndex = i"
|
||||
>
|
||||
{{ v.name }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<card_mescroll ref="cardPages" @upCallback="getList" :height="height + 'px'">
|
||||
<view
|
||||
v-for="(v, i) in detailList"
|
||||
:key="i"
|
||||
class="flex-center ju-between p-b-34 p-t-32 border-bottom"
|
||||
>
|
||||
<view>
|
||||
<view class="size28 line40 m-b-10 c0">{{ v.remark }}</view>
|
||||
<view class="size24 c_999 line34">{{ formatDate(v.createTime) }}</view>
|
||||
</view>
|
||||
<view>{{ dataObj.numValue }}</view>
|
||||
<view class="size32 c_EE0A24">{{
|
||||
dataObj.sourceName && v[dataObj?.sourceName] === 1
|
||||
? (dataObj.sourceName ? '+' : '') + v[dataObj.numName]
|
||||
: (dataObj.sourceName ? '-' : '') + v[dataObj.numName]
|
||||
}}</view>
|
||||
</view>
|
||||
</card_mescroll>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</s-layout>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import sheep from '@/sheep';
|
||||
import { ref, reactive, onMounted, onUnmounted, getCurrentInstance, watch, nextTick } from 'vue';
|
||||
import * as api from '@/sheep/api/home/pay';
|
||||
import * as pointsApi from '@/sheep/api/home/points';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import card_mescroll from '@/components/card_pages/card_mescroll.vue';
|
||||
|
||||
import { formatDate } from '@/sheep/helper/utils';
|
||||
let { proxy } = getCurrentInstance();
|
||||
let dataObj = reactive({
|
||||
title: '我的积分',
|
||||
name: '我的积分',
|
||||
num: 0,
|
||||
btn: '去提现',
|
||||
list: [],
|
||||
unit: '',
|
||||
url: '',
|
||||
numName: 'changeAmount',
|
||||
sourceName: 'bizType',
|
||||
listApi: pointsApi.integraldetai,
|
||||
});
|
||||
let navList = ref([
|
||||
{
|
||||
name: '全部',
|
||||
url: api.getWalletTransactionPage,
|
||||
numName: 'price',
|
||||
sourceName: '',
|
||||
},
|
||||
{
|
||||
name: '佣金',
|
||||
url: api.commissionDetailPage,
|
||||
numName: 'amount',
|
||||
sourceName: '',
|
||||
},
|
||||
{
|
||||
name: '代理收益',
|
||||
url: api.agentEarningsDetailPage,
|
||||
numName: 'totalEarnings',
|
||||
sourceName: '',
|
||||
},
|
||||
{
|
||||
name: '分红',
|
||||
url: api.dividendDetailPage,
|
||||
numName: 'amount',
|
||||
sourceName: '',
|
||||
},
|
||||
]);
|
||||
let typeArr = ref([
|
||||
{
|
||||
name: '收入',
|
||||
transactionType: 1,
|
||||
},
|
||||
{
|
||||
name: '支出',
|
||||
transactionType: 2,
|
||||
},
|
||||
]);
|
||||
let navIndex = ref(0);
|
||||
let typeIndex = ref(0);
|
||||
let marginTop = ref();
|
||||
let height = ref(0);
|
||||
let sysInfo = uni.getSystemInfoSync();
|
||||
const windowHeight = sysInfo.windowHeight;
|
||||
marginTop.value = sysInfo.statusBarHeight + uni.upx2px(88) + uni.upx2px(54);
|
||||
let urlAPI = ref(api.getWallet);
|
||||
height.value =
|
||||
windowHeight -
|
||||
sysInfo.statusBarHeight -
|
||||
marginTop.value -
|
||||
uni.upx2px(204) -
|
||||
uni.upx2px(110) -
|
||||
uni.upx2px(48) -
|
||||
uni.upx2px(40);
|
||||
|
||||
const getData = () => {
|
||||
urlAPI.value().then((res) => {
|
||||
if (res.code === 0) {
|
||||
dataObj.num = proxy.$fen2yuan(res.data.balance);
|
||||
}
|
||||
});
|
||||
};
|
||||
let cardPages = ref(null);
|
||||
let detailList = ref([]);
|
||||
const getList = (mescroll) => {
|
||||
let urlApi = navList.value[navIndex.value].url;
|
||||
if (type.value == 5) {
|
||||
urlApi = navList.value[navIndex.value].url;
|
||||
} else {
|
||||
urlApi = dataObj.listApi;
|
||||
}
|
||||
let obj = {
|
||||
pageNo: mescroll.num,
|
||||
pageSize: mescroll.size,
|
||||
transactionType: typeArr.value[typeIndex.value].transactionType,
|
||||
type: typeArr.value[typeIndex.value].transactionType,
|
||||
};
|
||||
if (type.value == 5 && navIndex.value == 0) {
|
||||
delete obj.transactionType;
|
||||
} else {
|
||||
delete obj.type;
|
||||
}
|
||||
urlApi(obj).then((res) => {
|
||||
if (res.code === 0) {
|
||||
let list = res.data.list || [];
|
||||
if (list.length && (type.value == 5 || type.value == 4)) {
|
||||
list.forEach((item) => {
|
||||
item[dataObj.numName || 'price'] = proxy.$fen2yuan(item[dataObj.numName || 'price']);
|
||||
});
|
||||
}
|
||||
if (mescroll.num == 1) detailList.value = [];
|
||||
detailList.value = detailList.value.concat(list);
|
||||
cardPages.value.getState(true, list.length);
|
||||
} else {
|
||||
cardPages.value.getState(false);
|
||||
}
|
||||
});
|
||||
};
|
||||
let type = ref(1);
|
||||
const dataChange = async () => {
|
||||
let userInfo = await sheep.$store('user').getInfo();
|
||||
if (type.value) {
|
||||
type.value = Number(type.value);
|
||||
switch (Number(type.value)) {
|
||||
case 1:
|
||||
dataObj.title = '绿色积分';
|
||||
dataObj.name = '我的积分';
|
||||
dataObj.btn = '去兑换';
|
||||
dataObj.num = userInfo.point;
|
||||
dataObj.url = '/pages/home/pay/seed';
|
||||
dataObj.listApi = pointsApi.integraldetai;
|
||||
dataObj.numName = 'changeAmount';
|
||||
dataObj.sourceName = '';
|
||||
break;
|
||||
case 2:
|
||||
dataObj.title = '佣金';
|
||||
dataObj.name = '我的佣金';
|
||||
dataObj.num = userInfo.commission;
|
||||
dataObj.unit = '元';
|
||||
dataObj.listApi = pointsApi.commission;
|
||||
dataObj.numName = 'amount';
|
||||
dataObj.sourceName = '';
|
||||
break;
|
||||
case 3:
|
||||
dataObj.title = '代理收益';
|
||||
dataObj.name = '我的代理收益';
|
||||
dataObj.num = userInfo.agentEarning;
|
||||
dataObj.unit = '元';
|
||||
dataObj.listApi = pointsApi.agentearnings;
|
||||
dataObj.numName = 'totalEarnings';
|
||||
dataObj.sourceName = '';
|
||||
break;
|
||||
case 4:
|
||||
dataObj.title = '消费金';
|
||||
dataObj.name = '我的消费金';
|
||||
dataObj.btn = '去消费';
|
||||
dataObj.num = proxy.$fen2yuan(userInfo.consumptionGold);
|
||||
dataObj.unit = '元';
|
||||
dataObj.url = '/pages/goods/list';
|
||||
dataObj.listApi = pointsApi.consumptiongold;
|
||||
dataObj.numName = 'amount';
|
||||
dataObj.sourceName = '';
|
||||
break;
|
||||
case 5:
|
||||
navChange(0);
|
||||
dataObj.title = '钱包';
|
||||
dataObj.name = '可提现金额';
|
||||
dataObj.btn = '去提现';
|
||||
dataObj.num = proxy.$fen2yuan(userInfo.wallet);
|
||||
dataObj.unit = '元';
|
||||
dataObj.url = '/pages/home/pay/withdraw';
|
||||
getData();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// getList();
|
||||
}
|
||||
if (cardPages.value) {
|
||||
cardPages.value.mescrollTrigger();
|
||||
}
|
||||
};
|
||||
onLoad(async (e) => {
|
||||
type.value = e.type;
|
||||
});
|
||||
onShow(() => {
|
||||
dataChange();
|
||||
});
|
||||
watch(
|
||||
() => [navIndex.value, typeIndex.value],
|
||||
() => {
|
||||
cardPages.value.mescrollTrigger();
|
||||
},
|
||||
);
|
||||
onShow(() => {
|
||||
if (cardPages.value) {
|
||||
cardPages.value.mescrollTrigger();
|
||||
}
|
||||
if (type.value == 5) {
|
||||
getData();
|
||||
}
|
||||
});
|
||||
const goUrl = () => {
|
||||
uni.navigateTo({
|
||||
url: dataObj.url,
|
||||
});
|
||||
};
|
||||
const navChange = (index) => {
|
||||
dataObj.numName = navList.value[index].numName;
|
||||
dataObj.sourceName = navList.value[index].sourceName;
|
||||
navIndex.value = index;
|
||||
console.log(dataObj.numName);
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.pages {
|
||||
position: relative;
|
||||
.bg {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: -1;
|
||||
}
|
||||
}
|
||||
.pages_con {
|
||||
padding: 0 40rpx;
|
||||
box-sizing: border-box;
|
||||
|
||||
.page_top {
|
||||
height: 204rpx;
|
||||
color: #1a1a1a;
|
||||
|
||||
.name {
|
||||
}
|
||||
|
||||
.num {
|
||||
font-size: 68rpx;
|
||||
}
|
||||
|
||||
.btn {
|
||||
background: linear-gradient(131deg, #f7772e 0%, #ee0a24 100%);
|
||||
height: 52rpx;
|
||||
line-height: 52rpx;
|
||||
width: 112rpx;
|
||||
text-align: center;
|
||||
border-radius: 26rpx;
|
||||
color: #ffffff;
|
||||
margin-bottom: 10rpx;
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.page_bottom {
|
||||
background-color: #fff;
|
||||
border-radius: 24rpx;
|
||||
padding: 0 16rpx;
|
||||
|
||||
.bottom_title {
|
||||
line-height: 110rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
.navItem {
|
||||
margin-bottom: 20rpx;
|
||||
margin-right: 32rpx;
|
||||
color: #ffffff;
|
||||
}
|
||||
.activeNav {
|
||||
position: relative;
|
||||
color: var(--color32);
|
||||
&::before {
|
||||
content: '';
|
||||
width: 40rpx;
|
||||
height: 6rpx;
|
||||
background: linear-gradient(131deg, var(--color30) 0%, var(--color32) 100%), #fa7e31;
|
||||
border-radius: 4rpx;
|
||||
position: absolute;
|
||||
bottom: -14rpx;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
}
|
||||
.typeItem {
|
||||
width: 76rpx;
|
||||
height: 40rpx;
|
||||
background-color: #f2f2f2;
|
||||
border-radius: 8rpx;
|
||||
margin-left: 12rpx;
|
||||
color: #333333;
|
||||
}
|
||||
.activeType {
|
||||
color: var(--color30);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,487 @@
|
||||
<template>
|
||||
<s-layout :title="dataObj.title" navbar="inner">
|
||||
<view class="pages h100">
|
||||
<image
|
||||
class="w100 bg"
|
||||
:src="$url + 'home/points_1.png'"
|
||||
mode="widthFix"
|
||||
:style="{ top: paddingTop + 'px' }"
|
||||
/>
|
||||
<view class="pages_con">
|
||||
<!-- :style="{ marginTop: marginTop + 'px' }" -->
|
||||
<view class="page_top c0" v-if="type != 5">
|
||||
<view class="size28 name">{{ dataObj.name }}</view>
|
||||
<view class="flex-row al-flex-end">
|
||||
<view class="num">{{ dataObj.num }}{{ dataObj.unit }}</view>
|
||||
<view class="btn size24 btn_bg" @click="goUrl">{{ dataObj.btn }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="money-box" v-if="type == 5">
|
||||
<view @click="go('/pages/home/rechargeRecord')">
|
||||
余额 <uni-icons type="right" color="#fff" />
|
||||
</view>
|
||||
<view class="size40 line92 m-t-2 flex-between">
|
||||
<text @click="goToast('充值', '/pages/home/recharge')">{{
|
||||
$fen2yuan(moneyObj.balance)
|
||||
}}</text>
|
||||
|
||||
<!-- <text class="btn size24 line52 p-x-20" @click="go('/pages/home/recharge')">去充值</text> -->
|
||||
</view>
|
||||
<view class="line m-t-30 m-b-26" />
|
||||
<view class="bottom flex ju-between">
|
||||
<view @click="goToast('提现', dataObj.url)">
|
||||
提现
|
||||
<view class="line54 m-t-12 size40 flex align-center">
|
||||
<text>{{ $fen2yuan(moneyObj.withdraw) }}</text>
|
||||
<!-- <text class="btn size20 line36 m-l-20 p-x-16" @click="goUrl">去提现</text> -->
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="m-r-60" @click="go('/pages/home/noRelease')">
|
||||
未行权收益 <uni-icons type="right" color="#fff" />
|
||||
<view class="line54 m-t-12 size40">
|
||||
{{ $fen2yuan(moneyObj.norelease) }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="page_bottom bg24">
|
||||
<view class="bottom_title center c0"> 收支明细 </view>
|
||||
<view class="bottom_list flex-center al-flex-start ju-between" v-if="type == 5">
|
||||
<view class="flex-row">
|
||||
<view
|
||||
class="navItem"
|
||||
v-for="(v, i) in navList"
|
||||
:key="i"
|
||||
:class="{ activeNav: navIndex === i }"
|
||||
@click="navChange(i)"
|
||||
>
|
||||
<view class="size28">{{ v.name }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-row">
|
||||
<view
|
||||
class="typeItem flex-center size24"
|
||||
v-for="(v, i) in typeArr"
|
||||
:key="i"
|
||||
:class="{ activeType: typeIndex === i }"
|
||||
@click="typeIndex = i"
|
||||
>
|
||||
{{ v.name }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<card_mescroll ref="cardPages" @upCallback="getList" :height="height + 'px'">
|
||||
<view
|
||||
v-for="(v, i) in detailList"
|
||||
:key="i"
|
||||
class="flex-center ju-between p-b-34 p-t-32 border-bottom"
|
||||
>
|
||||
<view>
|
||||
<!-- <view v-if="navIndex === 2" class="size28 line40 m-b-10 c0">
|
||||
{{ sourceTypeObj[Number(v.sourceType) || 1] }}
|
||||
</view> -->
|
||||
<view class="size28 line40 m-b-10 c0">
|
||||
<!-- <text v-if="type === 4">{{ sourceTypeObj[Number(v.sourceType) || 1] }}</text>
|
||||
<text v-else>{{ v[dataObj.titleName] }}</text> -->
|
||||
<text>{{ v[dataObj.titleName] }}</text>
|
||||
</view>
|
||||
<view class="size24 c_999 line34">{{
|
||||
(formatDate(v.createTime) || '').slice(0, 10)
|
||||
}}</view>
|
||||
</view>
|
||||
<view>{{ dataObj.numValue }}</view>
|
||||
<view class="size32 c_EE0A24">
|
||||
{{
|
||||
dataObj.sourceName && v[dataObj?.sourceName] === 1
|
||||
? (dataObj.sourceName ? '+' : '') + v[dataObj.numName]
|
||||
: (dataObj.sourceName ? '-' : '') + v[dataObj.numName]
|
||||
}}
|
||||
</view>
|
||||
</view>
|
||||
</card_mescroll>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</s-layout>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import sheep from '@/sheep';
|
||||
import { ref, reactive, onMounted, onUnmounted, getCurrentInstance, watch, nextTick } from 'vue';
|
||||
import * as api from '@/sheep/api/home/pay';
|
||||
import * as pointsApi from '@/sheep/api/home/points';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import card_mescroll from '@/components/card_pages/card_mescroll.vue';
|
||||
import { formatDate, sourceTypeObj } from '@/sheep/helper/utils';
|
||||
let { proxy } = getCurrentInstance();
|
||||
let moneyObj = ref({
|
||||
balance: 0,
|
||||
withdraw: 0,
|
||||
norelease: 0,
|
||||
});
|
||||
let dataObj = reactive({
|
||||
title: '钱包',
|
||||
name: '我的积分',
|
||||
num: 0,
|
||||
btn: '去提现',
|
||||
list: [],
|
||||
unit: '',
|
||||
url: '',
|
||||
numName: 'changeAmount',
|
||||
sourceName: 'bizType',
|
||||
listApi: pointsApi.integraldetai,
|
||||
titleName: 'remark',
|
||||
});
|
||||
|
||||
let navList = ref([
|
||||
{
|
||||
name: '全部',
|
||||
url: api.getWalletTransactionPage,
|
||||
title: 'title',
|
||||
numName: 'price',
|
||||
sourceName: '',
|
||||
},
|
||||
{
|
||||
name: '佣金',
|
||||
url: api.commissionDetailPage,
|
||||
title: 'remark',
|
||||
numName: 'amount',
|
||||
sourceName: '',
|
||||
},
|
||||
{
|
||||
name: '收益',
|
||||
url: api.agentEarningsDetailPage,
|
||||
title: 'remark',
|
||||
numName: 'totalEarnings',
|
||||
sourceName: '',
|
||||
},
|
||||
{
|
||||
name: '分红',
|
||||
url: api.dividendDetailPage,
|
||||
title: 'remark',
|
||||
numName: 'amount',
|
||||
sourceName: '',
|
||||
},
|
||||
]);
|
||||
let typeArr = ref([
|
||||
{
|
||||
name: '收入',
|
||||
transactionType: 1,
|
||||
},
|
||||
{
|
||||
name: '支出',
|
||||
transactionType: 2,
|
||||
},
|
||||
]);
|
||||
let navIndex = ref(0);
|
||||
let typeIndex = ref(0);
|
||||
let marginTop = ref();
|
||||
let height = ref(0);
|
||||
let sysInfo = uni.getSystemInfoSync();
|
||||
const windowHeight = sysInfo.windowHeight;
|
||||
marginTop.value = sysInfo.statusBarHeight + uni.upx2px(88) + uni.upx2px(54);
|
||||
let urlAPI = ref(api.getWallet);
|
||||
let urlAPI2 = ref(api.getReleaseList);
|
||||
height.value =
|
||||
windowHeight -
|
||||
sysInfo.statusBarHeight -
|
||||
marginTop.value -
|
||||
uni.upx2px(204) -
|
||||
uni.upx2px(110) -
|
||||
uni.upx2px(48) -
|
||||
uni.upx2px(40);
|
||||
|
||||
const getData = () => {
|
||||
urlAPI.value().then((res) => {
|
||||
if (res.code === 0) {
|
||||
// dataObj.num = proxy.$fen2yuan(res.data.balance);
|
||||
dataObj = {
|
||||
...dataObj,
|
||||
...res.data,
|
||||
};
|
||||
moneyObj.value.balance = res.data.balance;
|
||||
moneyObj.value.withdraw = res.data.withdrawAmount;
|
||||
}
|
||||
});
|
||||
urlAPI2.value().then((res) => {
|
||||
if (res.code === 0) {
|
||||
moneyObj.value.norelease = res.data.remainingEarningAll;
|
||||
}
|
||||
});
|
||||
};
|
||||
let cardPages = ref(null);
|
||||
let detailList = ref([]);
|
||||
const getList = (mescroll) => {
|
||||
let urlApi = navList.value[navIndex.value].url;
|
||||
if (type.value == 5) {
|
||||
urlApi = navList.value[navIndex.value].url;
|
||||
} else {
|
||||
urlApi = dataObj.listApi;
|
||||
}
|
||||
let obj = {
|
||||
pageNo: mescroll.num,
|
||||
pageSize: mescroll.size,
|
||||
transactionType: typeArr.value[typeIndex.value].transactionType,
|
||||
type: typeArr.value[typeIndex.value].transactionType,
|
||||
};
|
||||
if (type.value == 5 && navIndex.value == 0) {
|
||||
delete obj.transactionType;
|
||||
} else {
|
||||
delete obj.type;
|
||||
}
|
||||
urlApi(obj).then((res) => {
|
||||
if (res.code === 0) {
|
||||
let list = res.data.list || [];
|
||||
if (list.length && (type.value == 5 || type.value == 4)) {
|
||||
list.forEach((item) => {
|
||||
item[dataObj.numName || 'price'] = proxy.$fen2yuan(item[dataObj.numName || 'price']);
|
||||
});
|
||||
}
|
||||
if (mescroll.num == 1) detailList.value = [];
|
||||
detailList.value = detailList.value.concat(list);
|
||||
cardPages.value.getState(true, list.length);
|
||||
} else {
|
||||
cardPages.value.getState(false);
|
||||
}
|
||||
});
|
||||
};
|
||||
let type = ref(1);
|
||||
const dataChange = async () => {
|
||||
let userInfo = await sheep.$store('user').getInfo();
|
||||
if (type.value) {
|
||||
type.value = Number(type.value);
|
||||
switch (Number(type.value)) {
|
||||
case 1:
|
||||
dataObj.title = '绿色积分';
|
||||
dataObj.name = '我的积分';
|
||||
dataObj.btn = '去兑换';
|
||||
dataObj.num = userInfo.point;
|
||||
dataObj.url = '/pages/home/pay/seed';
|
||||
dataObj.listApi = pointsApi.integraldetai;
|
||||
dataObj.numName = 'changeAmount';
|
||||
dataObj.sourceName = '';
|
||||
break;
|
||||
case 2:
|
||||
dataObj.title = '佣金';
|
||||
dataObj.name = '我的佣金';
|
||||
dataObj.num = userInfo.commission;
|
||||
dataObj.unit = '元';
|
||||
dataObj.listApi = pointsApi.commission;
|
||||
dataObj.numName = 'amount';
|
||||
dataObj.sourceName = '';
|
||||
break;
|
||||
case 3:
|
||||
dataObj.title = '代理收益';
|
||||
dataObj.name = '我的代理收益';
|
||||
dataObj.num = userInfo.agentEarning;
|
||||
dataObj.unit = '元';
|
||||
dataObj.listApi = pointsApi.agentearnings;
|
||||
dataObj.numName = 'totalEarnings';
|
||||
dataObj.sourceName = '';
|
||||
break;
|
||||
case 4:
|
||||
dataObj.title = '消费金';
|
||||
dataObj.name = '我的消费金';
|
||||
dataObj.btn = '去消费';
|
||||
dataObj.num = proxy.$fen2yuan(userInfo.consumptionGold);
|
||||
dataObj.unit = '';
|
||||
dataObj.url = '/pages/goods/list';
|
||||
dataObj.listApi = pointsApi.consumptiongold;
|
||||
dataObj.numName = 'amount';
|
||||
dataObj.sourceName = '';
|
||||
break;
|
||||
case 5:
|
||||
navChange(0);
|
||||
dataObj.title = '钱包';
|
||||
dataObj.name = '可提现金额';
|
||||
dataObj.btn = '去提现';
|
||||
dataObj.num = proxy.$fen2yuan(userInfo.wallet);
|
||||
dataObj.unit = '元';
|
||||
dataObj.url = '/pages/home/pay/withdraw';
|
||||
getData();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// getList();
|
||||
}
|
||||
if (cardPages.value) {
|
||||
cardPages.value.mescrollTrigger();
|
||||
}
|
||||
};
|
||||
onLoad(async (e) => {
|
||||
type.value = e.type;
|
||||
});
|
||||
onShow(() => {
|
||||
dataChange();
|
||||
});
|
||||
watch(
|
||||
() => [navIndex.value, typeIndex.value],
|
||||
() => {
|
||||
cardPages.value.mescrollTrigger();
|
||||
},
|
||||
);
|
||||
onShow(() => {
|
||||
if (cardPages.value) {
|
||||
cardPages.value.mescrollTrigger();
|
||||
}
|
||||
if (type.value == 5) {
|
||||
getData();
|
||||
}
|
||||
});
|
||||
const goUrl = () => {
|
||||
// if (type.value == 5) {
|
||||
// uni.showToast({
|
||||
// title: '功能暂未开放',
|
||||
// icon: 'none',
|
||||
// })
|
||||
// return;
|
||||
// }
|
||||
uni.navigateTo({
|
||||
url: dataObj.url,
|
||||
});
|
||||
};
|
||||
const go = (url) => {
|
||||
uni.navigateTo({
|
||||
url: url,
|
||||
});
|
||||
};
|
||||
//充值体现弹框提示去跳转
|
||||
function goToast(typeTxt, url) {
|
||||
uni.showModal({
|
||||
// title: '',
|
||||
content: '是否去' + typeTxt,
|
||||
showCancel: true,
|
||||
success: (res) => {
|
||||
//用户点击确定
|
||||
if (res.confirm) {
|
||||
uni.navigateTo({
|
||||
url: url,
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
const navChange = (index) => {
|
||||
detailList.value = [];
|
||||
dataObj.numName = navList.value[index].numName;
|
||||
dataObj.sourceName = navList.value[index].sourceName;
|
||||
dataObj.titleName = navList.value[index].title;
|
||||
navIndex.value = index;
|
||||
};
|
||||
let statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
|
||||
let paddingTop = ref();
|
||||
paddingTop.value = -(statusBarHeight + 44);
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.money-box {
|
||||
//height: 344rpx;
|
||||
background: linear-gradient(to right, #fa8735 0%, #fe3b48 100%);
|
||||
border-radius: 12rpx;
|
||||
margin-bottom: 32rpx;
|
||||
padding: 40rpx 32rpx 16rpx;
|
||||
color: #fff;
|
||||
|
||||
.line {
|
||||
width: 100%;
|
||||
height: 1rpx;
|
||||
background: rgba(216, 216, 216, 0.5);
|
||||
}
|
||||
|
||||
.btn {
|
||||
color: #366eee;
|
||||
border-radius: 50rpx;
|
||||
background: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.pages {
|
||||
position: relative;
|
||||
|
||||
.bg {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.pages_con {
|
||||
position: relative;
|
||||
padding: 0 40rpx;
|
||||
box-sizing: border-box;
|
||||
z-index: 1;
|
||||
|
||||
.page_top {
|
||||
height: 204rpx;
|
||||
color: #1a1a1a;
|
||||
|
||||
.name {
|
||||
}
|
||||
|
||||
.num {
|
||||
font-size: 68rpx;
|
||||
}
|
||||
|
||||
.btn {
|
||||
background: linear-gradient(131deg, #f7772e 0%, #ee0a24 100%);
|
||||
height: 52rpx;
|
||||
line-height: 52rpx;
|
||||
width: 112rpx;
|
||||
text-align: center;
|
||||
border-radius: 26rpx;
|
||||
color: #ffffff;
|
||||
margin-bottom: 10rpx;
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.page_bottom {
|
||||
background-color: #fff;
|
||||
border-radius: 24rpx;
|
||||
padding: 0 16rpx;
|
||||
|
||||
.bottom_title {
|
||||
line-height: 110rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.navItem {
|
||||
margin-bottom: 20rpx;
|
||||
margin-right: 32rpx;
|
||||
// color: #ffffff;
|
||||
}
|
||||
|
||||
.activeNav {
|
||||
position: relative;
|
||||
color: var(--color32);
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
width: 40rpx;
|
||||
height: 6rpx;
|
||||
background: linear-gradient(131deg, var(--color30) 0%, var(--color32) 100%), #fa7e31;
|
||||
border-radius: 4rpx;
|
||||
position: absolute;
|
||||
bottom: -14rpx;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
}
|
||||
|
||||
.typeItem {
|
||||
width: 76rpx;
|
||||
height: 40rpx;
|
||||
background-color: #f2f2f2;
|
||||
border-radius: 8rpx;
|
||||
margin-left: 12rpx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.activeType {
|
||||
color: var(--color30);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,242 @@
|
||||
<template>
|
||||
<s-layout title="充值" navbar="inner">
|
||||
<view class="pages">
|
||||
<image
|
||||
class="w100 bg_img"
|
||||
:src="$url + 'home/points_1.png'"
|
||||
mode="widthFix"
|
||||
:style="{ top: paddingTop + 'px' }"
|
||||
/>
|
||||
</view>
|
||||
<view class="relative m-t-28">
|
||||
<view class="head" :style="{ backgroundImage: `url(${$url + 'home/recharge_bg2.png'})` }">
|
||||
<view class="size28 line40 m-b-2"> 余额 </view>
|
||||
<view class="size68 line92">
|
||||
{{ $fen2yuan(balance) }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="recharge-main">
|
||||
<view class="head-line"> 余额充值 </view>
|
||||
<view class="money-bar flex-wrap flex-between">
|
||||
<view
|
||||
class="item"
|
||||
:class="i === money_cur ? 'active' : 'item'"
|
||||
v-for="(v, i) in money_list"
|
||||
@click="changeMoney(v, i)"
|
||||
>
|
||||
¥{{ Number($fen2yuan(v.payPrice)) }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="ipt-bar flex-between m-y-40 p-x-32">
|
||||
<text class="icon m-r-20">¥</text>
|
||||
<uni-easyinput
|
||||
v-model="money_value"
|
||||
type="number"
|
||||
:inputBorder="false"
|
||||
placeholder="请输入金额"
|
||||
@blur="iptBlur"
|
||||
/>
|
||||
</view>
|
||||
<view>
|
||||
<view class="size28 line38 m-b-20">充值说明</view>
|
||||
<view class="size24 line32 m-b-12"> 1、本次充值仅作为充值,无法提现。 </view>
|
||||
<view class="size24 line32"> 2、若遇到充值未到账,请联系客服。 </view>
|
||||
</view>
|
||||
<view class="btn m-t-248" @click="submit()"> 充值 </view>
|
||||
<view class="record size34 t-c m-y-36 line48"> </view>
|
||||
<!-- <view class="record size34 t-c m-y-36 line48" @click="go()">
|
||||
充值记录
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
</s-layout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import sheep from '@/sheep';
|
||||
import * as api from '@/sheep/api/home/pay';
|
||||
import { fen2yuan } from '../../sheep/hooks/useGoods';
|
||||
import { SYSCONST } from '@/sheep/helper/const';
|
||||
import { toast } from '@/utils';
|
||||
const money_value = ref();
|
||||
const money_id = ref();
|
||||
const money_cur = ref(-1);
|
||||
const money_list = ref();
|
||||
let balance = ref(0);
|
||||
|
||||
let marginTop = ref();
|
||||
let height = ref(0);
|
||||
let sysInfo = uni.getSystemInfoSync();
|
||||
const windowHeight = sysInfo.windowHeight;
|
||||
marginTop.value = sysInfo.statusBarHeight + uni.upx2px(88) + uni.upx2px(54);
|
||||
height.value =
|
||||
windowHeight -
|
||||
sysInfo.statusBarHeight -
|
||||
marginTop.value -
|
||||
uni.upx2px(204) -
|
||||
uni.upx2px(110) -
|
||||
uni.upx2px(48) -
|
||||
uni.upx2px(40);
|
||||
let statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
|
||||
let paddingTop = ref();
|
||||
paddingTop.value = -(statusBarHeight + 44);
|
||||
|
||||
onShow(async () => {
|
||||
getList();
|
||||
getBalance();
|
||||
});
|
||||
let iptBlur = () => {
|
||||
money_id.value = '';
|
||||
};
|
||||
let getBalance = () => {
|
||||
api.getWallet().then((res) => {
|
||||
if (res.code === 0) {
|
||||
balance.value = res.data.balance;
|
||||
}
|
||||
});
|
||||
};
|
||||
let getList = () => {
|
||||
api.getWalletRechargeMoneyList({}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
money_list.value = res.data;
|
||||
}
|
||||
});
|
||||
};
|
||||
const changeMoney = (e, i) => {
|
||||
// console.log(e.id);
|
||||
money_cur.value = i;
|
||||
money_value.value = Number(fen2yuan(e.payPrice));
|
||||
money_id.value = e.id;
|
||||
};
|
||||
const submit = () => {
|
||||
if (!money_value.value) {
|
||||
uni.showToast({
|
||||
title: '请选择充值金额',
|
||||
icon: 'none',
|
||||
});
|
||||
return;
|
||||
} else if (Number(money_value.value) < fen2yuan(money_list.value[0].payPrice)) {
|
||||
uni.showToast({
|
||||
title: '充值金额不能少于' + fen2yuan(money_list.value[0].payPrice),
|
||||
icon: 'none',
|
||||
});
|
||||
return;
|
||||
} else {
|
||||
// console.log(Number(money_value.value));
|
||||
// console.log(money_id.value);
|
||||
let data = {};
|
||||
|
||||
if (money_id.value) {
|
||||
data.payPrice = Number(money_value.value);
|
||||
data.packageId = money_id.value;
|
||||
} else {
|
||||
data.payPrice = Number(money_value.value);
|
||||
}
|
||||
if (
|
||||
Number(money_value.value) > SYSCONST.MAX_PRICE / 100 ||
|
||||
Number(money_value.value) === SYSCONST.MAX_PRICE / 100
|
||||
) {
|
||||
toast('充值金额要小于' + SYSCONST.MAX_PRICE / 100);
|
||||
return;
|
||||
}
|
||||
|
||||
api.walletRechargeCreate(data).then((res) => {
|
||||
if (res.code === 0) {
|
||||
sheep.$router.redirect('/pages/pay/index', {
|
||||
id: res.data.payOrderId,
|
||||
type: 'recharge', // 充值
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
const go = () => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/home/rechargeRecord',
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.pages {
|
||||
position: relative;
|
||||
|
||||
.bg_img {
|
||||
position: absolute;
|
||||
}
|
||||
}
|
||||
|
||||
.head {
|
||||
min-height: 282rpx;
|
||||
// background: #366DEE url('/static/home/recharge_bg.png');
|
||||
background-size: 100% 282rpx;
|
||||
margin: 0 32rpx;
|
||||
border-radius: 12rpx;
|
||||
padding: 40rpx 32rpx;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.recharge-main {
|
||||
background: #fff;
|
||||
border-radius: 20rpx 20rpx 0 0;
|
||||
padding: 46rpx 32rpx;
|
||||
margin-top: -120rpx;
|
||||
|
||||
.head-line {
|
||||
font-size: 28rpx;
|
||||
// color: #FFFFFF;
|
||||
line-height: 38rpx;
|
||||
border-left: 6rpx solid #fe3b48;
|
||||
padding-left: 18rpx;
|
||||
}
|
||||
|
||||
.money-bar {
|
||||
.item {
|
||||
width: 214rpx;
|
||||
height: 92rpx;
|
||||
line-height: 92rpx;
|
||||
text-align: center;
|
||||
background: #ffefe5;
|
||||
border-radius: 12rpx;
|
||||
margin-top: 40rpx;
|
||||
color: #fb4d32;
|
||||
}
|
||||
|
||||
.active {
|
||||
background: #fb4d32;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.ipt-bar {
|
||||
height: 134rpx;
|
||||
background: #ffefe5;
|
||||
border-radius: 12rpx;
|
||||
|
||||
.icon {
|
||||
color: #fe3b48;
|
||||
}
|
||||
|
||||
// ::v-deep .uni-input-input {
|
||||
// color: #fff;
|
||||
// }
|
||||
}
|
||||
|
||||
.btn {
|
||||
height: 100rpx;
|
||||
background: linear-gradient(to right, #fa8735 0%, #fe3b48 100%);
|
||||
border-radius: 20rpx;
|
||||
font-size: 32rpx;
|
||||
color: #ffffff;
|
||||
line-height: 100rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.record {
|
||||
text-align: center;
|
||||
color: #366dee;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,412 @@
|
||||
<template>
|
||||
<s-layout title="充值消费记录" navbar="inner">
|
||||
<view class="pages h100">
|
||||
<!-- <image class="w100 bg" :src="$url + 'home/points.png'" mode="widthFix" :style="{top: paddingTop + 'px'}" /> -->
|
||||
<view class="pages_con">
|
||||
<view class="h_28" />
|
||||
<view class="page_bottom bg24">
|
||||
<!-- <view class="bottom_title center c0"> 待释放明细 </view> -->
|
||||
<view class="bottom_list flex-center al-flex-start ju-between">
|
||||
<view class="flex-row">
|
||||
<view
|
||||
class="navItem"
|
||||
v-for="(v, i) in navList"
|
||||
:key="i"
|
||||
:class="{ activeNav: navIndex === i }"
|
||||
@click="navChange(i)"
|
||||
>
|
||||
<view class="size28">{{ v.name }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="flex-row">
|
||||
<view class="typeItem flex-center size24" v-for="(v, i) in typeArr" :key="i"
|
||||
:class="{ activeType: typeIndex === i }" @click="typeIndex = i">
|
||||
{{ v.name }}
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
<view>
|
||||
<card_mescroll ref="cardPages" @upCallback="getList" :height="height + 'px'">
|
||||
<view
|
||||
v-for="(v, i) in detailList"
|
||||
:key="i"
|
||||
class="flex-center ju-between p-b-34 p-t-32 border-bottom"
|
||||
>
|
||||
<view>
|
||||
<view class="size28 line40 m-b-10 c0">{{ v.name }}</view>
|
||||
<view class="size24 c_999 line34">{{ formatDate(v.time) }}</view>
|
||||
</view>
|
||||
<view>{{ dataObj.numValue }}</view>
|
||||
<view class="size32 c_EE0A24">
|
||||
{{ $fen2yuan(v.price) }}
|
||||
</view>
|
||||
</view>
|
||||
</card_mescroll>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</s-layout>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import sheep from '@/sheep';
|
||||
import { ref, reactive, onMounted, onUnmounted, getCurrentInstance, watch, nextTick } from 'vue';
|
||||
import * as api from '@/sheep/api/home/pay';
|
||||
import * as pointsApi from '@/sheep/api/home/points';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import card_mescroll from '@/components/card_pages/card_mescroll.vue';
|
||||
|
||||
import { formatDate } from '@/sheep/helper/utils';
|
||||
let { proxy } = getCurrentInstance();
|
||||
// 1-商场区域代理订单,2-AI店铺区域代理订单,3-AI店铺代理收益,4:AI店铺团队分红,5-营销活动随机奖励
|
||||
let typeObj = {
|
||||
1: '商场区域代理订单',
|
||||
2: 'AI店铺区域代理订单',
|
||||
3: 'AI店铺代理收益',
|
||||
4: 'AI店铺团队分红',
|
||||
5: '营销活动随机奖励',
|
||||
};
|
||||
let dataObj = reactive({
|
||||
title: '充值记录',
|
||||
name: '我的积分',
|
||||
num: 0,
|
||||
btn: '去提现',
|
||||
list: [],
|
||||
unit: '',
|
||||
url: '',
|
||||
numName: 'changeAmount',
|
||||
sourceName: 'bizType',
|
||||
listApi: pointsApi.integraldetai,
|
||||
titleName: 'remark',
|
||||
});
|
||||
let navList = ref([
|
||||
{
|
||||
name: '充值',
|
||||
url: api.getWalletTransactionPage,
|
||||
title: 'title',
|
||||
numName: 'price',
|
||||
sourceName: '',
|
||||
},
|
||||
{
|
||||
name: '消费',
|
||||
url: api.walletRransactionExpense,
|
||||
title: 'remark',
|
||||
numName: 'amount',
|
||||
sourceName: '',
|
||||
},
|
||||
// {
|
||||
// name: '代理收益',
|
||||
// url: api.agentEarningsDetailPage,
|
||||
// title: 'remark',
|
||||
// numName: 'totalEarnings',
|
||||
// sourceName: '',
|
||||
// },
|
||||
// {
|
||||
// name: '分红',
|
||||
// url: api.dividendDetailPage,
|
||||
// title: 'remark',
|
||||
// numName: 'amount',
|
||||
// sourceName: '',
|
||||
// },
|
||||
]);
|
||||
let typeArr = ref([
|
||||
{
|
||||
name: '收入',
|
||||
transactionType: 1,
|
||||
},
|
||||
{
|
||||
name: '支出',
|
||||
transactionType: 2,
|
||||
},
|
||||
]);
|
||||
let navIndex = ref(0);
|
||||
let typeIndex = ref(0);
|
||||
let marginTop = ref();
|
||||
let height = ref(0);
|
||||
let sysInfo = uni.getSystemInfoSync();
|
||||
const windowHeight = sysInfo.windowHeight;
|
||||
marginTop.value = sysInfo.statusBarHeight + uni.upx2px(88) + uni.upx2px(54);
|
||||
let urlAPI = ref(api.getWallet);
|
||||
height.value =
|
||||
windowHeight -
|
||||
sysInfo.statusBarHeight -
|
||||
marginTop.value -
|
||||
uni.upx2px(204) -
|
||||
uni.upx2px(110) -
|
||||
uni.upx2px(48) -
|
||||
uni.upx2px(40);
|
||||
|
||||
const getData = () => {
|
||||
urlAPI.value().then((res) => {
|
||||
if (res.code === 0) {
|
||||
dataObj.num = proxy.$fen2yuan(res.data.balance);
|
||||
}
|
||||
});
|
||||
};
|
||||
let cardPages = ref(null);
|
||||
let detailList = ref([]);
|
||||
const getList = (mescroll) => {
|
||||
console.log(navIndex.value);
|
||||
let obj = {
|
||||
pageNo: mescroll.num,
|
||||
pageSize: mescroll.size,
|
||||
};
|
||||
|
||||
if (navIndex.value === 0) {
|
||||
api.walletRechargePage(obj).then((res) => {
|
||||
console.log(res);
|
||||
if (res.code === 0) {
|
||||
let list = res.data.list || [];
|
||||
|
||||
if (mescroll.num == 1) detailList.value = [];
|
||||
detailList.value = detailList.value.concat(list);
|
||||
detailList.value.forEach((e) => {
|
||||
e.name = e.payChannelName;
|
||||
e.time = e.payTime;
|
||||
e.price = e.payPrice;
|
||||
});
|
||||
cardPages.value.getState(true, list.length);
|
||||
} else {
|
||||
cardPages.value.getState(false);
|
||||
}
|
||||
});
|
||||
} else if (navIndex.value === 1) {
|
||||
api.walletRransactionExpense(obj).then((res) => {
|
||||
console.log(res);
|
||||
if (res.code === 0) {
|
||||
let list = res.data.list || [];
|
||||
|
||||
if (mescroll.num == 1) detailList.value = [];
|
||||
detailList.value = detailList.value.concat(list);
|
||||
detailList.value.forEach((e) => {
|
||||
e.name = e.title;
|
||||
e.time = e.createTime;
|
||||
e.price = e.price;
|
||||
});
|
||||
cardPages.value.getState(true, list.length);
|
||||
} else {
|
||||
cardPages.value.getState(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
let type = ref(1);
|
||||
const dataChange = async () => {
|
||||
let userInfo = await sheep.$store('user').getInfo();
|
||||
if (type.value) {
|
||||
type.value = Number(type.value);
|
||||
switch (Number(type.value)) {
|
||||
case 1:
|
||||
dataObj.title = '绿色积分';
|
||||
dataObj.name = '我的积分';
|
||||
dataObj.btn = '去兑换';
|
||||
dataObj.num = userInfo.point;
|
||||
dataObj.url = '/pages/home/pay/seed';
|
||||
dataObj.listApi = pointsApi.integraldetai;
|
||||
dataObj.numName = 'changeAmount';
|
||||
dataObj.sourceName = '';
|
||||
break;
|
||||
case 2:
|
||||
dataObj.title = '佣金';
|
||||
dataObj.name = '我的佣金';
|
||||
dataObj.num = userInfo.commission;
|
||||
dataObj.unit = '元';
|
||||
dataObj.listApi = pointsApi.commission;
|
||||
dataObj.numName = 'amount';
|
||||
dataObj.sourceName = '';
|
||||
break;
|
||||
case 3:
|
||||
dataObj.title = '代理收益';
|
||||
dataObj.name = '我的代理收益';
|
||||
dataObj.num = userInfo.agentEarning;
|
||||
dataObj.unit = '元';
|
||||
dataObj.listApi = pointsApi.agentearnings;
|
||||
dataObj.numName = 'totalEarnings';
|
||||
dataObj.sourceName = '';
|
||||
break;
|
||||
case 4:
|
||||
dataObj.title = '消费金';
|
||||
dataObj.name = '我的消费金';
|
||||
dataObj.btn = '去消费';
|
||||
dataObj.num = proxy.$fen2yuan(userInfo.consumptionGold);
|
||||
dataObj.unit = '';
|
||||
dataObj.url = '/pages/goods/list';
|
||||
dataObj.listApi = pointsApi.consumptiongold;
|
||||
dataObj.numName = 'amount';
|
||||
dataObj.sourceName = '';
|
||||
break;
|
||||
case 5:
|
||||
navChange(0);
|
||||
dataObj.title = '钱包';
|
||||
dataObj.name = '可提现金额';
|
||||
dataObj.btn = '去提现';
|
||||
dataObj.num = proxy.$fen2yuan(userInfo.wallet);
|
||||
dataObj.unit = '元';
|
||||
dataObj.url = '/pages/home/pay/withdraw';
|
||||
getData();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// getList();
|
||||
}
|
||||
if (cardPages.value) {
|
||||
cardPages.value.mescrollTrigger();
|
||||
}
|
||||
};
|
||||
onLoad(async (e) => {
|
||||
type.value = e.type;
|
||||
});
|
||||
onShow(() => {
|
||||
dataChange();
|
||||
});
|
||||
watch(
|
||||
() => [navIndex.value, typeIndex.value],
|
||||
() => {
|
||||
cardPages.value.mescrollTrigger();
|
||||
},
|
||||
);
|
||||
onShow(() => {
|
||||
if (cardPages.value) {
|
||||
cardPages.value.mescrollTrigger();
|
||||
}
|
||||
if (type.value == 5) {
|
||||
getData();
|
||||
}
|
||||
});
|
||||
const goUrl = () => {
|
||||
// if (type.value == 5) {
|
||||
// uni.showToast({
|
||||
// title: '功能暂未开放',
|
||||
// icon: 'none',
|
||||
// })
|
||||
// return;
|
||||
// }
|
||||
uni.navigateTo({
|
||||
url: dataObj.url,
|
||||
});
|
||||
};
|
||||
const go = () => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/home/noRelease',
|
||||
});
|
||||
};
|
||||
const navChange = (index) => {
|
||||
dataObj.numName = navList.value[index].numName;
|
||||
dataObj.sourceName = navList.value[index].sourceName;
|
||||
dataObj.titleName = navList.value[index].title;
|
||||
navIndex.value = index;
|
||||
};
|
||||
let statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
|
||||
let paddingTop = ref();
|
||||
paddingTop.value = -(statusBarHeight + 44);
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.money-box {
|
||||
//height: 344rpx;
|
||||
background: linear-gradient(to right, #75aff6 0%, #366dee 99%);
|
||||
border-radius: 12rpx;
|
||||
margin-bottom: 32rpx;
|
||||
padding: 40rpx 32rpx 16rpx;
|
||||
|
||||
.line {
|
||||
width: 100%;
|
||||
height: 1rpx;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.btn {
|
||||
color: #366eee;
|
||||
border-radius: 50rpx;
|
||||
background: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.pages {
|
||||
position: relative;
|
||||
|
||||
.bg {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.pages_con {
|
||||
position: relative;
|
||||
padding: 0 40rpx;
|
||||
box-sizing: border-box;
|
||||
z-index: 1;
|
||||
|
||||
.page_top {
|
||||
height: 204rpx;
|
||||
color: #1a1a1a;
|
||||
|
||||
.name {
|
||||
}
|
||||
|
||||
.num {
|
||||
font-size: 68rpx;
|
||||
}
|
||||
|
||||
.btn {
|
||||
background: linear-gradient(131deg, #f7772e 0%, #ee0a24 100%);
|
||||
height: 52rpx;
|
||||
line-height: 52rpx;
|
||||
width: 112rpx;
|
||||
text-align: center;
|
||||
border-radius: 26rpx;
|
||||
color: #ffffff;
|
||||
margin-bottom: 10rpx;
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.page_bottom {
|
||||
background-color: #fff;
|
||||
border-radius: 24rpx;
|
||||
padding: 16rpx;
|
||||
|
||||
.bottom_title {
|
||||
line-height: 110rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.navItem {
|
||||
margin-bottom: 20rpx;
|
||||
margin-right: 32rpx;
|
||||
// color: #ffffff;
|
||||
}
|
||||
|
||||
.activeNav {
|
||||
position: relative;
|
||||
color: var(--color32);
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
width: 40rpx;
|
||||
height: 6rpx;
|
||||
background: linear-gradient(131deg, var(--color30) 0%, var(--color32) 100%), #fa7e31;
|
||||
border-radius: 4rpx;
|
||||
position: absolute;
|
||||
bottom: -14rpx;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
}
|
||||
|
||||
.typeItem {
|
||||
width: 76rpx;
|
||||
height: 40rpx;
|
||||
background-color: #f2f2f2;
|
||||
border-radius: 8rpx;
|
||||
margin-left: 12rpx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.activeType {
|
||||
color: var(--color30);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,322 @@
|
||||
<template>
|
||||
<s-layout :navbar="navBar" title="金种子">
|
||||
<view class="pages w100" :style="{ marginTop: -height + 'px' }">
|
||||
<view class="w100">
|
||||
<image class="w100" :src="$url + 'home/seed_1.png'" mode="widthFix" />
|
||||
</view>
|
||||
<view class="content" :style="{ marginTop: -top + 'px' }">
|
||||
<view class="con">
|
||||
<view class="conBox" v-if="load">
|
||||
<view class="conBg"> </view>
|
||||
<view class="p-x-20 p-y-40">
|
||||
<view class="size32"> 我的金种子 </view>
|
||||
<view class="flex ju-between al-flex-end m-b-44">
|
||||
<view class="c_primary size80 weight_900">{{ dataObj.myCount || 0 }}</view>
|
||||
<view class="flex-center">
|
||||
<view class="fang"></view>
|
||||
<view class="size28"
|
||||
><span class="m-r-4">当日价格</span>{{ dataObj.todayPrice || 0 }}</view
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-row m-b-30" style="flex-wrap: wrap">
|
||||
<view
|
||||
class="m-b-34 flex-row al-flex-end"
|
||||
style="width: 50%"
|
||||
v-for="(v, i) in arr"
|
||||
:key="i"
|
||||
>
|
||||
<view class="flex-center ju-flex-start">
|
||||
<view class="icon m-r-8">
|
||||
<image class="w100" :src="$url + v.icon" mode="widthFix" />
|
||||
</view>
|
||||
<view>
|
||||
<view class="size24 c32">{{ v.title }}</view>
|
||||
<view class="size36">{{ dataObj[v.value] || 0 }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="w_96 h_44 c32 size24 flex-center radius22"
|
||||
v-if="v.url"
|
||||
@click="utils.go(v.url)"
|
||||
style="background-color: #ffe8e5"
|
||||
>去兑换</view
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
<view class="m-b-50" v-if="dataObj?.premiumList?.length">
|
||||
<view class="title c32 f500 m-b-40 size32">金种子溢价表</view>
|
||||
<view class="wrap">
|
||||
<card_echart :options="chartOption" />
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="dataObj?.dividendPool?.length">
|
||||
<view class="title c32 f500 m-b-40 size32">生态分红池</view>
|
||||
<view class="wrap">
|
||||
<card_echart :options="chartOption1" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</s-layout>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted, onUnmounted, getCurrentInstance, watch, nextTick } from 'vue';
|
||||
import card_echart from '@/components/card_echart/card_echart.vue';
|
||||
import { onShow } from '@dcloudio/uni-app';
|
||||
import * as echarts from 'echarts';
|
||||
import * as api from '@/sheep/api/home/index.js';
|
||||
import { onPageScroll } from '@dcloudio/uni-app';
|
||||
let navBar = ref('inner');
|
||||
let scrollTop = ref(0);
|
||||
onPageScroll((e) => {
|
||||
//console.log(e)
|
||||
scrollTop.value = e.scrollTop;
|
||||
if (e.scrollTop > 20) {
|
||||
navBar.value = 'normal';
|
||||
} else {
|
||||
navBar.value = 'inner';
|
||||
}
|
||||
});
|
||||
let { proxy } = getCurrentInstance();
|
||||
let dataObj = reactive({});
|
||||
let sysInfo = uni.getSystemInfoSync();
|
||||
let top = ref(0);
|
||||
top.value = `${sysInfo.statusBarHeight + 44 + uni.upx2px(295)}`;
|
||||
// sysInfo.statusBarHeight
|
||||
let arr = ref([
|
||||
{
|
||||
icon: 'home/seed1_1.png',
|
||||
title: '核销数量',
|
||||
value: 'writeOffCount',
|
||||
},
|
||||
{
|
||||
icon: 'home/seed2_1.png',
|
||||
title: '绿色积分',
|
||||
value: 'exchangeCount',
|
||||
url: '/pages/home/pay/seed',
|
||||
},
|
||||
{
|
||||
icon: 'home/seed3_1.png',
|
||||
title: '分红',
|
||||
value: 'dividendCount',
|
||||
},
|
||||
{
|
||||
icon: 'home/seed5_1.png',
|
||||
title: '增量积分',
|
||||
value: 'incrementPoint',
|
||||
url: '/pages/home/pay/seed?type=1',
|
||||
},
|
||||
]);
|
||||
const chartOption = reactive({
|
||||
// 添加grid配置,实现间距自适应
|
||||
grid: {
|
||||
left: '3%',
|
||||
right: '4%',
|
||||
bottom: '3%',
|
||||
top: '0',
|
||||
height: 150,
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
|
||||
axisLabel: {
|
||||
color: '#BBBBBB',
|
||||
interval: 0,
|
||||
fontSize: 10,
|
||||
},
|
||||
axisLine: {
|
||||
lineStyle: {
|
||||
color: '#D9D9D9',
|
||||
type: 'dashed',
|
||||
},
|
||||
},
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
splitLine: {
|
||||
lineStyle: {
|
||||
color: '#D9D9D9',
|
||||
type: 'dashed',
|
||||
},
|
||||
},
|
||||
axisLabel: {
|
||||
color: '#BBBBBB',
|
||||
show: false,
|
||||
},
|
||||
},
|
||||
series: [
|
||||
{
|
||||
data: [820, 932, 901, 934, 1290, 1330, 1320],
|
||||
smooth: true,
|
||||
type: 'line',
|
||||
symbol: 'none', // 不显示数据点
|
||||
lineStyle: {
|
||||
color: '#FA7E31',
|
||||
},
|
||||
triggerEvent: true, // 确保事件可以被触发
|
||||
areaStyle: {
|
||||
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
||||
{ offset: 0, color: '#FF2B2B' },
|
||||
{ offset: 1, color: '#FFFFFF' },
|
||||
]),
|
||||
},
|
||||
},
|
||||
],
|
||||
// 移动端优化配置
|
||||
animation: false, // 禁用动画以提高性能
|
||||
touchMoveThreshold: 10, // 增加触摸移动阈值,避免误触
|
||||
roam: false, // 禁止缩放和平移
|
||||
});
|
||||
|
||||
const chartOption1 = reactive({
|
||||
// 添加grid配置,实现间距自适应
|
||||
grid: {
|
||||
left: '3%',
|
||||
right: '4%',
|
||||
bottom: '6%',
|
||||
top: '0',
|
||||
height: 150,
|
||||
},
|
||||
xAxis: {
|
||||
data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
|
||||
axisTick: { show: false },
|
||||
axisLine: { show: false },
|
||||
axisLabel: {
|
||||
color: '#BBBBBB',
|
||||
interval: 0,
|
||||
fontSize: 10,
|
||||
},
|
||||
},
|
||||
yAxis: {
|
||||
splitLine: {
|
||||
lineStyle: {
|
||||
color: '#D9D9D9',
|
||||
type: 'dashed',
|
||||
},
|
||||
},
|
||||
axisTick: { show: false },
|
||||
axisLine: { show: false },
|
||||
axisLabel: { show: false },
|
||||
},
|
||||
color: ['#e54035'],
|
||||
series: [
|
||||
{
|
||||
name: 'hill',
|
||||
type: 'pictorialBar',
|
||||
barCategoryGap: '0%',
|
||||
// symbol: 'path://M0,10 L10,10 L5,0 L0,10 z',
|
||||
symbol: 'path://M0,10 L10,10 C5.5,10 5.5,5 5,0 C4.5,5 4.5,10 0,10 z',
|
||||
itemStyle: {
|
||||
color: new echarts.graphic.LinearGradient(0, 0, 1, 1, [
|
||||
{ offset: 0, color: '#F7772E' },
|
||||
{ offset: 1, color: '#EE0A24' },
|
||||
]),
|
||||
},
|
||||
emphasis: {
|
||||
itemStyle: {
|
||||
opacity: 1,
|
||||
},
|
||||
},
|
||||
data: [123, 60, 25, 18, 12, 123, 60, 25],
|
||||
z: 10,
|
||||
},
|
||||
],
|
||||
});
|
||||
let load = ref(false);
|
||||
const getData = () => {
|
||||
api.goldSeedIndex().then((res) => {
|
||||
load.value = true;
|
||||
if (res.code === 0) {
|
||||
dataObj = res.data;
|
||||
let arr = dataObj.premiumList.map((item) => item.month);
|
||||
let arr1 = dataObj.premiumList.map((item) => item.data);
|
||||
let arr2 = dataObj.dividendPool.map((item) => item.month);
|
||||
let arr3 = dataObj.dividendPool.map((item) => item.data);
|
||||
chartOption.xAxis.data = arr;
|
||||
chartOption.series[0].data = arr1;
|
||||
chartOption1.xAxis.data = arr2;
|
||||
chartOption1.series[0].data = arr3;
|
||||
}
|
||||
});
|
||||
};
|
||||
onShow(() => {
|
||||
getData();
|
||||
});
|
||||
let height = ref(0);
|
||||
height.value = sysInfo.statusBarHeight + uni.upx2px(88);
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.pages {
|
||||
// position: relative;
|
||||
|
||||
.content {
|
||||
// position: absolute;
|
||||
width: 100%;
|
||||
}
|
||||
.con {
|
||||
padding: 0 40rpx;
|
||||
padding-bottom: 100rpx;
|
||||
box-sizing: border-box;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.conBox {
|
||||
background: #ffffff;
|
||||
backdrop-filter: blur(32px);
|
||||
border-radius: 8rpx;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
// height: 100%;
|
||||
.conBg {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: -1;
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.icon {
|
||||
width: 68rpx;
|
||||
height: 68rpx;
|
||||
}
|
||||
.wrap {
|
||||
height: 350rpx;
|
||||
width: 100%;
|
||||
}
|
||||
.color_585654 {
|
||||
color: #585654;
|
||||
}
|
||||
.weight_900 {
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.fang {
|
||||
width: 24rpx;
|
||||
height: 24rpx;
|
||||
background: linear-gradient(127deg, #f7772e 18%, #ee0a24 122%);
|
||||
margin-right: 4rpx;
|
||||
}
|
||||
.title {
|
||||
position: relative;
|
||||
padding-left: 16rpx;
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 15%;
|
||||
left: 0;
|
||||
width: 4rpx;
|
||||
height: 70%;
|
||||
background: linear-gradient(270deg, #f7772e 0%, #ee0a24 99%);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,161 @@
|
||||
<template>
|
||||
<s-layout title="邀请好友">
|
||||
<view class="pages c34">
|
||||
<view class="con w100" id="conId">
|
||||
<view class="w100 conBg radius-8 hidden">
|
||||
<image
|
||||
class="w100"
|
||||
:src="$url + 'home/invite1.png'"
|
||||
mode="widthFix"
|
||||
@longpress="saveImg"
|
||||
/>
|
||||
</view>
|
||||
<view class="con_center w100 radius-8">
|
||||
<view class="flex-center ju-flex-start">
|
||||
<view class="head">
|
||||
<image v-if="dataInfo?.avatar" :src="dataInfo?.avatar" mode="scaleToFill" />
|
||||
<image v-else :src="`${$url}home/head.png`" mode="scaleToFill" />
|
||||
</view>
|
||||
<view>
|
||||
<view class="con_name size32 f700 c0"
|
||||
>{{ dataInfo?.nickname || '昵称' }},邀请您加入优购商城</view
|
||||
>
|
||||
<view class="size28 c0">财富未来 全新出发</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-center f700 size48 m-t-68 m-b-28 c0">
|
||||
<view>邀请码</view>
|
||||
<view>|</view>
|
||||
<view>{{ inviteinfo?.inviteCode }}</view>
|
||||
</view>
|
||||
<view class="flex-center">
|
||||
<view class="img m-b-22">
|
||||
<Qrcode
|
||||
ref="qrcodeRef"
|
||||
:size="300"
|
||||
@generated="onQrGenerated"
|
||||
@longpress="saveServiceQrcode"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<view class="center size20 c_999">扫描二维码, 注册并登录APP</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="submit-btn m-t-68" @click="saveImg">保存到相册</view>
|
||||
</view>
|
||||
</s-layout>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import Qrcode from './components/Qrcode';
|
||||
import sheep from '@/sheep';
|
||||
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
||||
import { ref, reactive, onMounted, onUnmounted, getCurrentInstance, watch, nextTick } from 'vue';
|
||||
import * as api from '@/sheep/api/home/index';
|
||||
let { proxy } = getCurrentInstance();
|
||||
let dataInfo = ref({});
|
||||
let inviteinfo = ref({});
|
||||
let qrCodeUrl = ref(); //二维码地址
|
||||
let qrcodeRef = ref();
|
||||
|
||||
onLoad(() => {});
|
||||
//获取二维码
|
||||
function generateQRCode(text) {
|
||||
nextTick(() => {
|
||||
qrcodeRef.value.createQRcode(text);
|
||||
});
|
||||
}
|
||||
const getData = () => {
|
||||
sheep
|
||||
.$store('user')
|
||||
.getInfo()
|
||||
.then((res) => {
|
||||
dataInfo.value = res;
|
||||
});
|
||||
};
|
||||
const getinviteinfo = () => {
|
||||
api.inviteinfo().then((res) => {
|
||||
inviteinfo.value = res.data;
|
||||
generateQRCode(res.data.inviteUrl);
|
||||
// generateQRCode('http://mall.suwizihe.org.cn:5010/h5/#/?code=' + inviteinfo.value.inviteCode);
|
||||
});
|
||||
};
|
||||
getinviteinfo();
|
||||
getData();
|
||||
let conRef = ref();
|
||||
const saveServiceQrcode = () => {
|
||||
qrcodeRef.value.savePhoto();
|
||||
};
|
||||
const saveImg = async () => {
|
||||
// uni.saveImageToPhotosAlbum({
|
||||
// filePath: 'http://mall.suwizihe.org.cn:5010/h5/#/?code=' + inviteinfo.value.inviteCode,//qrcodeUrl.value
|
||||
// success: () => {
|
||||
// uni.showToast({
|
||||
// title: '保存成功!',
|
||||
// });
|
||||
// },
|
||||
// fail: (err) => {
|
||||
// console.log(err);
|
||||
// uni.showToast({ title: '保存失败', icon: 'none' });
|
||||
// },
|
||||
// });
|
||||
qrcodeRef.value.savePhoto();
|
||||
// if (qrcodeUrl.value) {
|
||||
|
||||
// return;
|
||||
// }
|
||||
// if (qrcodeRef.value?.savePhoto) {
|
||||
// qrcodeRef.value.savePhoto();
|
||||
// } else {
|
||||
// uni.showToast({ title: '二维码未生成', icon: 'none' });
|
||||
// }
|
||||
};
|
||||
const onQrGenerated = (path) => {
|
||||
qrCodeUrl.value = path;
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.pages {
|
||||
height: 100vh;
|
||||
padding: 32rpx 40rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.con {
|
||||
position: relative;
|
||||
|
||||
.conBg {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.con_center {
|
||||
// position: absolute;
|
||||
// top: 0;
|
||||
position: relative;
|
||||
padding: 56rpx 28rpx;
|
||||
box-sizing: border-box;
|
||||
z-index: 10;
|
||||
}
|
||||
}
|
||||
|
||||
.head {
|
||||
width: 96rpx;
|
||||
height: 96rpx;
|
||||
border-radius: 50%;
|
||||
overflow: hidden;
|
||||
margin-right: 20rpx;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.img {
|
||||
padding: 20rpx;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.con_name {
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,344 @@
|
||||
<template>
|
||||
<s-pages title="我的社员">
|
||||
<!-- 头部 -->
|
||||
<view class="header" :style="{ backgroundImage: 'url(' + $url + 'home/staff2.png' + ')' }">
|
||||
<view class="header-content">
|
||||
<view class="title"> 我的社员 </view>
|
||||
<view class="sum">
|
||||
<template v-for="(item, i) in sum_list" :key="i">
|
||||
<view class="sum-item">
|
||||
<view class="num">
|
||||
{{ item.value }}
|
||||
</view>
|
||||
<view class="text">
|
||||
{{ item.text }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="sum-divider" v-if="i < sum_list.length - 1" />
|
||||
</template>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 列表 -->
|
||||
<view class="m-t-16 m-x-40">
|
||||
<card_mescroll ref="cardPages" @upCallback="getList" :height="height">
|
||||
<view class="list-item" v-for="(item, i) in list" :key="i">
|
||||
<view class="avatar">
|
||||
<image v-if="item.memberAvatar" :src="item.memberAvatar" />
|
||||
<image v-else :src="`${$url}home/avatar.png`" />
|
||||
<!-- v-if="item.type !== 0" -->
|
||||
</view>
|
||||
<view class="info">
|
||||
<view class="section-1 flex-between">
|
||||
<view class="left flex-center">
|
||||
<view class="name">
|
||||
<text v-if="item.realStatus === 0">{{ item.memberPhone }}</text>
|
||||
<text v-if="item.realStatus === 1">{{ item.memberNickname }}</text>
|
||||
<text>(ID:{{ item.memberUserId }})</text>
|
||||
</view>
|
||||
<view class="tag flex-center" v-if="item.levelId > 0">
|
||||
<image :src="`${$url}home/${item.levelType}.svg`" class="w_24 h_22 m-r-6" />
|
||||
<text :style="{ color: item.levelColor }">{{ item.levelText }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="right"> 创收 </view>
|
||||
</view>
|
||||
<view class="section-2 flex-between">
|
||||
<view class="time">
|
||||
{{ item.joinTime.join('-') }}
|
||||
</view>
|
||||
<view class="money">
|
||||
{{ $fen2yuan(item.totalRevenue) }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="line" />
|
||||
</view>
|
||||
</view>
|
||||
</card_mescroll>
|
||||
</view>
|
||||
</s-pages>
|
||||
</template>
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
reactive,
|
||||
onMounted,
|
||||
onUnmounted,
|
||||
getCurrentInstance,
|
||||
watch,
|
||||
nextTick
|
||||
} from 'vue';
|
||||
import {
|
||||
onLoad,
|
||||
onShow
|
||||
} from '@dcloudio/uni-app';
|
||||
import card_mescroll from '@/components/card_pages/card_mescroll.vue';
|
||||
import * as api from '@/sheep/api/home/index';
|
||||
import {
|
||||
type
|
||||
} from '@/uni_modules/uni-forms/components/uni-forms/utils';
|
||||
import {
|
||||
color
|
||||
} from 'echarts';
|
||||
let {
|
||||
proxy
|
||||
} = getCurrentInstance();
|
||||
let list = ref([]);
|
||||
let cardPages = ref(null);
|
||||
let height = ref('100%');
|
||||
let sysInfo = uni.getSystemInfoSync();
|
||||
height.value = sysInfo.windowHeight - sysInfo.statusBarHeight - uni.upx2px(88) + 'px';
|
||||
const sum_list = ref([{
|
||||
text: '总人数',
|
||||
value: 0,
|
||||
},
|
||||
{
|
||||
text: '推荐人数',
|
||||
value: 0,
|
||||
},
|
||||
{
|
||||
text: '新增人数',
|
||||
value: 0,
|
||||
},
|
||||
]);
|
||||
|
||||
const leave_obj = ref([{
|
||||
type: 1,
|
||||
text: '达人店长',
|
||||
color: '#E1C37A',
|
||||
},
|
||||
{
|
||||
type: 2,
|
||||
text: '明星店长',
|
||||
color: '#B49DF4',
|
||||
},
|
||||
{
|
||||
type: 3,
|
||||
text: '超级店长',
|
||||
color: '#43D787',
|
||||
},
|
||||
{
|
||||
type: 4,
|
||||
text: '店长',
|
||||
color: '#FB8ED5',
|
||||
},
|
||||
// {
|
||||
// type: 5,
|
||||
// text: '',
|
||||
// color: '#3EA4F9',
|
||||
// }
|
||||
]);
|
||||
// 等级配置安全获取
|
||||
const getLevelCfg = (id) => {
|
||||
const num = Number(id);
|
||||
const byType = leave_obj.value.find((e) => e.type === num);
|
||||
const byIndex = leave_obj.value[(num || 1) - 1];
|
||||
return (
|
||||
byType ||
|
||||
byIndex ||
|
||||
leave_obj.value[0] || {
|
||||
type: 1,
|
||||
text: '店长',
|
||||
color: '#FFFFFF',
|
||||
}
|
||||
);
|
||||
};
|
||||
onLoad(() => {
|
||||
getTeamStats();
|
||||
});
|
||||
//获取人数统计
|
||||
function getTeamStats() {
|
||||
api.getTeamStats({}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
let data = res.data;
|
||||
if (!data) return;
|
||||
sum_list.value[0].value = data.totalCount || 0;
|
||||
sum_list.value[1].value = data.recommendCount || 0;
|
||||
sum_list.value[2].value = data.newCount || 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
const getList = async (mescroll) => {
|
||||
let res = await api.teamPage({
|
||||
pageNo: mescroll.num,
|
||||
pageSize: mescroll.size,
|
||||
});
|
||||
// console.log(res);
|
||||
if (res.code === 0) {
|
||||
let data = res.data.list || [];
|
||||
if (mescroll.num == 1) list.value = [];
|
||||
data.forEach((item) => {
|
||||
const cfg = getLevelCfg(item.levelId)
|
||||
Object.assign(item, {
|
||||
levelType: cfg.type,
|
||||
levelText: cfg.text,
|
||||
levelColor: cfg.color,
|
||||
memberNickname: maskName(item.memberNickname),
|
||||
registerTime: item.joinTime.join('-')
|
||||
})
|
||||
const phone = typeof item.memberPhone === 'string' ? item.memberPhone : ''
|
||||
item.memberPhone = judjeRegisteTime(item) ? phone : (phone ? phone.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2') : '')
|
||||
});
|
||||
// console.log(data);
|
||||
list.value = list.value.concat(data);
|
||||
|
||||
cardPages.value.getState(true, data.length);
|
||||
} else {
|
||||
cardPages.value.getState(false);
|
||||
}
|
||||
};
|
||||
//判断注册时间是否小于三天
|
||||
function judjeRegisteTime(item) {
|
||||
const jt = item.joinTime;
|
||||
let d = null;
|
||||
if (Array.isArray(jt) && jt.length) {
|
||||
const y = Number(jt[0]) || 0;
|
||||
const m = (Number(jt[1]) || 1) - 1;
|
||||
const day = Number(jt[2]) || 1;
|
||||
const h = Number(jt[3]) || 0;
|
||||
const min = Number(jt[4]) || 0;
|
||||
const s = Number(jt[5]) || 0;
|
||||
d = new Date(y, m, day, h, min, s);
|
||||
} else {
|
||||
d = new Date(item.registerTime);
|
||||
}
|
||||
const threeDaysMs = 3 * 24 * 60 * 60 * 1000;
|
||||
return d instanceof Date && !isNaN(d.getTime()) && (Date.now() - d.getTime() < threeDaysMs);
|
||||
}
|
||||
//名字带*
|
||||
const maskName = (s) => {
|
||||
if (!s) return s
|
||||
const len = s.length
|
||||
if (len <= 1) return s
|
||||
if (len === 2) return s[0] + '*'
|
||||
return s[0] + '*'.repeat(Math.min(3, len - 2)) + s[len - 1]
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.header {
|
||||
height: 248rpx;
|
||||
// background: linear-gradient(270deg, #75AFF6 0%, #366DEE 98.57%);
|
||||
border-radius: 12rpx;
|
||||
margin: 32rpx;
|
||||
background-size: 100% 100%;
|
||||
background-repeat: no-repeat;
|
||||
color: #ffffff;
|
||||
font-weight: 500;
|
||||
font-family: AlibabaPuHuiTi, AlibabaPuHuiTi;
|
||||
|
||||
.header-content {
|
||||
padding: 28rpx 36rpx;
|
||||
|
||||
.title {
|
||||
font-size: 36rpx;
|
||||
color: #ffffff;
|
||||
line-height: 48rpx;
|
||||
}
|
||||
|
||||
.sum {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-top: 38rpx;
|
||||
|
||||
.sum-item {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
|
||||
.num {
|
||||
font-size: 36rpx;
|
||||
line-height: 48rpx;
|
||||
}
|
||||
|
||||
.text {
|
||||
font-size: 28rpx;
|
||||
line-height: 48rpx;
|
||||
margin-top: 6rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.sum-divider {
|
||||
width: 2rpx;
|
||||
height: 60rpx;
|
||||
background: rgba(255, 255, 255, 0.4);
|
||||
margin: 0 24rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.list-item {
|
||||
display: flex;
|
||||
margin-bottom: 28rpx;
|
||||
|
||||
.avatar {
|
||||
width: 76rpx;
|
||||
min-width: 76rpx;
|
||||
height: 76rpx;
|
||||
border-radius: 8rpx;
|
||||
overflow: hidden;
|
||||
background: #edf3fe;
|
||||
position: relative;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.info {
|
||||
width: 100%;
|
||||
margin-left: 20rpx;
|
||||
font-family: HarmonyOS Sans SC, HarmonyOS Sans SC;
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
|
||||
.section-1 {
|
||||
margin-bottom: 10rpx;
|
||||
color: #000;
|
||||
|
||||
.left {
|
||||
.name {
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.tag {
|
||||
line-height: 24rpx;
|
||||
background: linear-gradient(90deg, #50504e 0%, #292b28 100%);
|
||||
border-radius: 40rpx;
|
||||
font-size: 20rpx;
|
||||
line-height: 36rpx;
|
||||
padding: 0 10rpx;
|
||||
margin-left: 10rpx;
|
||||
// position: absolute;
|
||||
// top: -10rpx;
|
||||
// left: 0;
|
||||
// white-space: nowrap;
|
||||
}
|
||||
}
|
||||
|
||||
.right {}
|
||||
}
|
||||
|
||||
.section-2 {
|
||||
.time {
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.money {
|
||||
color: #ee0a24;
|
||||
}
|
||||
}
|
||||
|
||||
.line {
|
||||
width: 100%;
|
||||
height: 2rpx;
|
||||
background: #d6d1d1;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,147 @@
|
||||
<template>
|
||||
<s-pages title="钱包">
|
||||
<!-- 头部 -->
|
||||
<view class="header" :style="{ backgroundImage: 'url(' + $url + 'home/wallet2.png' + ')' }">
|
||||
<view class="header-content">
|
||||
<view class="title" @click="jumpPage('充值', '/pages/home/recharge')">
|
||||
钱包余额 <uni-icons type="right" color="#fff" size="28rpx" />
|
||||
</view>
|
||||
<view class="num size68 m-y-8" @click="jumpPage('充值', '/pages/home/recharge')">
|
||||
{{ $fen2yuan(money_obj?.balance || 0) }}
|
||||
</view>
|
||||
<view class="line" />
|
||||
<view class="flex m-t-22">
|
||||
<view class="title"> 可提现金额 </view>
|
||||
<view class="num m-l-34" @click="jumpPage('提现', '/pages/home/pay/withdraw')">
|
||||
{{ $fen2yuan(money_obj?.withdrawAmount || 0) }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 标题 -->
|
||||
<view class="list-content">
|
||||
<view class="title-left" />
|
||||
<view class="title"> 好物推荐 </view>
|
||||
<view class="title-right" />
|
||||
</view>
|
||||
<!-- 商品 -->
|
||||
<su-sticky top="100rpx">
|
||||
<view class="goodsIndex">
|
||||
<goods :list="tagList" v-if="tagList?.length"></goods>
|
||||
</view>
|
||||
</su-sticky>
|
||||
</s-pages>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import * as api from '@/sheep/api/home/pay';
|
||||
import * as apiIndex from '@/sheep/api/index/index';
|
||||
import goods from '@/components/goods/goods.vue';
|
||||
|
||||
const money_obj = ref();
|
||||
const tagList = ref([]);
|
||||
|
||||
//获取钱包
|
||||
function getData() {
|
||||
api.getWallet().then((res) => {
|
||||
if (res.code === 0) {
|
||||
money_obj.value = res.data;
|
||||
}
|
||||
});
|
||||
// 标签列表
|
||||
apiIndex
|
||||
.getproducttaglist({
|
||||
categoryId: 1,
|
||||
})
|
||||
.then((res) => {
|
||||
tagList.value = res.data || [];
|
||||
});
|
||||
}
|
||||
onLoad(() => {
|
||||
getData();
|
||||
});
|
||||
//充值提现弹框提示去跳转
|
||||
function jumpPage(typeTxt, url) {
|
||||
uni.showModal({
|
||||
// title: '',
|
||||
content: '是否去' + typeTxt,
|
||||
showCancel: true,
|
||||
success: (res) => {
|
||||
//用户点击确定
|
||||
if (res.confirm) {
|
||||
uni.navigateTo({
|
||||
url: url,
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.header {
|
||||
height: 318rpx;
|
||||
// background: linear-gradient(270deg, #75AFF6 0%, #366DEE 98.57%);
|
||||
margin: 32rpx;
|
||||
background-size: 100% 100%;
|
||||
background-repeat: no-repeat;
|
||||
overflow: hidden;
|
||||
|
||||
.header-content {
|
||||
padding: 80rpx 32rpx 24rpx;
|
||||
|
||||
.title {
|
||||
font-family: HarmonyOS Sans SC, HarmonyOS Sans SC;
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
color: #ffffff;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
|
||||
.num {
|
||||
font-family: Avenir, Avenir;
|
||||
font-weight: 900;
|
||||
font-size: 32rpx;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.line {
|
||||
width: 394rpx;
|
||||
height: 4rpx;
|
||||
background: linear-gradient(
|
||||
117deg,
|
||||
rgba(255, 255, 255, 0.41) 0%,
|
||||
rgba(255, 255, 255, 0) 100%
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.list-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.title {
|
||||
font-family: HarmonyOS Sans SC, HarmonyOS Sans SC;
|
||||
font-weight: 500;
|
||||
font-size: 32rpx;
|
||||
color: #000;
|
||||
margin: 0 16rpx;
|
||||
}
|
||||
|
||||
.title-left {
|
||||
width: 42rpx;
|
||||
height: 6rpx;
|
||||
background: linear-gradient(90deg, rgba(255, 255, 255, 0) 7.14%, #f25353 100%);
|
||||
}
|
||||
|
||||
.title-right {
|
||||
width: 42rpx;
|
||||
height: 6rpx;
|
||||
background: linear-gradient(-90deg, rgba(255, 255, 255, 0) 7.14%, #f25353 100%);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,50 @@
|
||||
<template>
|
||||
<view class="detail-content-card ss-p-b-20">
|
||||
<view class="card-content">
|
||||
<mp-html :content="content"></mp-html>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
content: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.detail-content-card {
|
||||
.card-header {
|
||||
.line {
|
||||
width: 6rpx;
|
||||
height: 30rpx;
|
||||
background: linear-gradient(180deg, var(--ui-BG-Main) 0%, var(--ui-BG-Main-gradient) 100%);
|
||||
border-radius: 3rpx;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 30rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.des {
|
||||
font-size: 24rpx;
|
||||
color: $dark-9;
|
||||
}
|
||||
|
||||
.more-btn {
|
||||
font-size: 24rpx;
|
||||
color: var(--ui-BG-Main);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
:deep() {
|
||||
image {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,177 @@
|
||||
<template>
|
||||
<view
|
||||
class="skeleton-wrap"
|
||||
:class="['theme-' + sys.mode, 'main-' + sys.theme, 'font-' + sys.fontSize]"
|
||||
>
|
||||
<view class="skeleton-banner"></view>
|
||||
<view class="container-box">
|
||||
<view class="container-box-strip title ss-m-b-58"></view>
|
||||
<view class="container-box-strip ss-m-b-20"></view>
|
||||
<view class="container-box-strip ss-m-b-20"></view>
|
||||
<view class="container-box-strip w-364"></view>
|
||||
</view>
|
||||
<view class="container-box">
|
||||
<view class="ss-flex ss-row-between ss-m-b-34">
|
||||
<view class="container-box-strip w-380"></view>
|
||||
<view class="circle"></view>
|
||||
</view>
|
||||
<view class="ss-flex ss-row-between ss-m-b-34">
|
||||
<view class="container-box-strip w-556"></view>
|
||||
<view class="circle"></view>
|
||||
</view>
|
||||
<view class="ss-flex ss-row-between">
|
||||
<view class="container-box-strip w-556"></view>
|
||||
<view class="circle"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="container-box">
|
||||
<view class="container-box-strip w-198 ss-m-b-42"></view>
|
||||
<view class="ss-flex">
|
||||
<view class="circle ss-m-r-12"></view>
|
||||
<view class="container-box-strip w-252"></view>
|
||||
</view>
|
||||
</view>
|
||||
<su-fixed bottom placeholder bg="bg-white">
|
||||
<view class="ui-tabbar-box">
|
||||
<view class="foot ss-flex ss-col-center">
|
||||
<view class="ss-m-r-54 ss-m-l-32">
|
||||
<view class="rec ss-m-b-8"></view>
|
||||
<view class="oval"></view>
|
||||
</view>
|
||||
<view class="ss-m-r-54">
|
||||
<view class="rec ss-m-b-8"></view>
|
||||
<view class="oval"></view>
|
||||
</view>
|
||||
<view class="ss-m-r-50">
|
||||
<view class="rec ss-m-b-8"></view>
|
||||
<view class="oval"></view>
|
||||
</view>
|
||||
<button class="ss-reset-button add-btn ui-Shadow-Main"></button>
|
||||
<button class="ss-reset-button buy-btn ui-Shadow-Main"></button>
|
||||
</view>
|
||||
</view>
|
||||
</su-fixed>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
import sheep from '@/sheep';
|
||||
|
||||
const sys = computed(() => sheep.$store('sys'));
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@keyframes loading {
|
||||
0% {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
50% {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
.skeleton-wrap {
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
position: relative;
|
||||
|
||||
.skeleton-banner {
|
||||
width: 100%;
|
||||
height: calc(100vh - 882rpx);
|
||||
background: #f4f4f4;
|
||||
}
|
||||
|
||||
.container-box {
|
||||
padding: 24rpx 18rpx;
|
||||
margin: 14rpx 20rpx;
|
||||
background: var(--ui-BG);
|
||||
animation: loading 1.4s ease infinite;
|
||||
|
||||
.container-box-strip {
|
||||
height: 40rpx;
|
||||
background: #f3f3f1;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
|
||||
.title {
|
||||
width: 470rpx;
|
||||
height: 50rpx;
|
||||
border-radius: 25rpx;
|
||||
}
|
||||
|
||||
.w-364 {
|
||||
width: 364rpx;
|
||||
}
|
||||
|
||||
.w-380 {
|
||||
width: 380rpx;
|
||||
}
|
||||
|
||||
.w-556 {
|
||||
width: 556rpx;
|
||||
}
|
||||
|
||||
.w-198 {
|
||||
width: 198rpx;
|
||||
}
|
||||
|
||||
.w-252 {
|
||||
width: 252rpx;
|
||||
}
|
||||
|
||||
.circle {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
background: #f3f3f1;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
.ui-tabbar-box {
|
||||
box-shadow: 0px -6px 10px 0px rgba(51, 51, 51, 0.2);
|
||||
}
|
||||
|
||||
.foot {
|
||||
height: 100rpx;
|
||||
background: var(--ui-BG);
|
||||
.rec {
|
||||
width: 38rpx;
|
||||
height: 38rpx;
|
||||
background: #f3f3f1;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
|
||||
.oval {
|
||||
width: 38rpx;
|
||||
height: 22rpx;
|
||||
background: #f3f3f1;
|
||||
border-radius: 11rpx;
|
||||
}
|
||||
.add-btn {
|
||||
width: 214rpx;
|
||||
height: 72rpx;
|
||||
font-weight: 500;
|
||||
font-size: 28rpx;
|
||||
border-radius: 40rpx 0 0 40rpx;
|
||||
background-color: var(--ui-BG-Main-light);
|
||||
color: var(--ui-BG-Main);
|
||||
}
|
||||
|
||||
.buy-btn {
|
||||
width: 214rpx;
|
||||
height: 72rpx;
|
||||
font-weight: 500;
|
||||
font-size: 28rpx;
|
||||
|
||||
border-radius: 0 40rpx 40rpx 0;
|
||||
background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
|
||||
color: $white;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,97 @@
|
||||
<template>
|
||||
<view class="flex-row" @click="go">
|
||||
<view class="w_176 h_176 radius12 bg0">
|
||||
<image
|
||||
class="w100 h100"
|
||||
v-if="props.data?.picUrl"
|
||||
:src="props.data.picUrl"
|
||||
mode="scaleToFill"
|
||||
/>
|
||||
<image class="w100 h100" v-else src="/static/product_null.png" mode="scaleToFill" />
|
||||
</view>
|
||||
<view class="flex1 flex-column ju-between m-l-18">
|
||||
<view>
|
||||
<view class="size28 c0 lineTwo m-b-12">{{ props.data.productName }}</view>
|
||||
<view class="size24 c19">{{ props.data.title }}</view>
|
||||
</view>
|
||||
<view class="flex-row ju-between">
|
||||
<view class="c35 line56 size32"
|
||||
>{{ props.data.price }}<span class="size24">积分</span>
|
||||
</view>
|
||||
<view
|
||||
class="w_170 line56 bg35 radius12 center size28"
|
||||
style="color: #ffffff"
|
||||
@click.stop="sub"
|
||||
>
|
||||
{{
|
||||
statusObj(parseInt(props?.data?.joinStatus) || 0, parseInt(props?.data?.status) || 0)
|
||||
}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, getCurrentInstance, defineProps } from 'vue';
|
||||
import * as api from '@/sheep/api/increment';
|
||||
const { proxy } = getCurrentInstance() as any;
|
||||
let props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {};
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
// status:1:已参加,0:未参加
|
||||
// joinStatus:0:未开团,1:已开团,2:开团成功,3:开团失败
|
||||
|
||||
const statusObj = (joinStatus, status) => {
|
||||
console.log(joinStatus, status);
|
||||
let text = '未开团';
|
||||
switch (status) {
|
||||
case 0:
|
||||
text = '未开团';
|
||||
if (joinStatus === 1) {
|
||||
text = '已参团';
|
||||
} else {
|
||||
text = '立即参团';
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
text = '已开团';
|
||||
if (joinStatus === 1) {
|
||||
text = '已参团';
|
||||
} else {
|
||||
text = '立即参团';
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
text = '开团成功';
|
||||
break;
|
||||
case 3:
|
||||
text = '开团失败';
|
||||
break;
|
||||
}
|
||||
return text;
|
||||
};
|
||||
const go = () => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/increment/info?id=' + props.data.productId,
|
||||
});
|
||||
};
|
||||
const sub = () => {
|
||||
api
|
||||
.joinGroup({
|
||||
groupBuyId: props.data.groupBuyId,
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.code === 0) {
|
||||
proxy.$emit('upDate');
|
||||
}
|
||||
});
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="scss"></style>
|
||||
@@ -0,0 +1,62 @@
|
||||
<template>
|
||||
<view class="tabBar bg16 h_100 flex-center ju-around">
|
||||
<view class="" v-for="(v, i) in nav" :key="i" @click="go(v)">
|
||||
<view class="flex-center">
|
||||
<image
|
||||
class="w_50 h_50"
|
||||
:src="`/static/increment/${v.icon == props.index ? v.icon1 : v.icon}.svg`"
|
||||
mode="scaleToFill"
|
||||
/>
|
||||
</view>
|
||||
<view class="size24 name" :class="{ c32: v.icon == props.index }">{{ v.name }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, getCurrentInstance } from 'vue';
|
||||
const { proxy } = getCurrentInstance() as any;
|
||||
let props = defineProps({
|
||||
index: {
|
||||
type: Number,
|
||||
default: 1,
|
||||
},
|
||||
});
|
||||
let nav = ref([
|
||||
{
|
||||
name: '拼分',
|
||||
icon: '1',
|
||||
icon1: '1_1',
|
||||
path: '/pages/increment/index',
|
||||
},
|
||||
// {
|
||||
// name: '报单',
|
||||
// icon: '2',
|
||||
// icon1: '2_1',
|
||||
// path: '/pages/increment/index'
|
||||
// },
|
||||
{
|
||||
name: '我的',
|
||||
icon: '3',
|
||||
icon1: '3_1',
|
||||
path: '/pages/increment/user',
|
||||
},
|
||||
]);
|
||||
const go = (v) => {
|
||||
if (v.icon == props.index) return;
|
||||
uni.redirectTo({ url: v.path });
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.tabBar {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 10;
|
||||
width: 100vw;
|
||||
}
|
||||
.name {
|
||||
color: #979797;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,283 @@
|
||||
<template>
|
||||
<s-layout :title="dataObj.title" navbar="inner">
|
||||
<view class="pages h100">
|
||||
<image
|
||||
class="w100 bg"
|
||||
:src="$url + 'home/points.png'"
|
||||
mode="widthFix"
|
||||
:style="{ top: paddingTop + 'px' }"
|
||||
/>
|
||||
<view class="pages_con">
|
||||
<!-- :style="{ marginTop: marginTop + 'px' }" -->
|
||||
<view class="page_top c0">
|
||||
<view class="size28 name">{{ dataObj.name }}</view>
|
||||
<view class="flex-row al-flex-end">
|
||||
<view class="num">{{ detailObj[dataObj.num] }}{{ dataObj.unit }}</view>
|
||||
<view class="btn size24 btn_bg" @click="goUrl(dataObj.url)" v-if="dataObj.btn">
|
||||
{{ dataObj.btn }}
|
||||
</view>
|
||||
<view class="btn size24 btn_bg" @click="goUrl(dataObj.url1)" v-if="dataObj.btn1">
|
||||
{{ dataObj.btn1 }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="page_bottom bg24">
|
||||
<view class="bottom_title center c0"> 收支明细 </view>
|
||||
<view>
|
||||
<card_mescroll ref="cardPages" @upCallback="getList" :height="height + 'px'">
|
||||
<view
|
||||
v-for="(v, i) in detailList"
|
||||
:key="i"
|
||||
class="flex-center ju-between p-b-34 p-t-32 border-bottom"
|
||||
>
|
||||
<view>
|
||||
<view class="size28 line40 m-b-10 c0">{{ v.remark }}</view>
|
||||
<view class="size24 c_999 line34">{{ formatDate(v.createTime) }}</view>
|
||||
</view>
|
||||
<view>{{ dataObj.numValue }}</view>
|
||||
<view class="size32 c_EE0A24">
|
||||
{{
|
||||
dataObj.sourceName && v[dataObj?.sourceName] === 1
|
||||
? (dataObj.sourceName ? '+' : '') + v[dataObj.numName]
|
||||
: (dataObj.sourceName ? '-' : '') + v[dataObj.numName]
|
||||
}}
|
||||
</view>
|
||||
</view>
|
||||
</card_mescroll>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</s-layout>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import sheep from '@/sheep';
|
||||
import { ref, reactive, onMounted, onUnmounted, getCurrentInstance, watch, nextTick } from 'vue';
|
||||
import * as api from '@/sheep/api/increment';
|
||||
import * as pointsApi from '@/sheep/api/home/points';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import card_mescroll from '@/components/card_pages/card_mescroll.vue';
|
||||
|
||||
import { formatDate } from '@/sheep/helper/utils';
|
||||
let { proxy } = getCurrentInstance();
|
||||
let dataObj = reactive({
|
||||
title: '我的积分',
|
||||
name: '我的积分',
|
||||
num: 0,
|
||||
btn: '',
|
||||
btn1: '',
|
||||
list: [],
|
||||
unit: '',
|
||||
url: '',
|
||||
url1: '',
|
||||
numName: 'changeAmount',
|
||||
sourceName: 'bizType',
|
||||
listApi: pointsApi.integraldetai,
|
||||
});
|
||||
let typeArr = ref([
|
||||
{
|
||||
name: '收入',
|
||||
transactionType: 1,
|
||||
},
|
||||
{
|
||||
name: '支出',
|
||||
transactionType: 2,
|
||||
},
|
||||
]);
|
||||
let navIndex = ref(0);
|
||||
let typeIndex = ref(0);
|
||||
let marginTop = ref();
|
||||
let height = ref(0);
|
||||
let sysInfo = uni.getSystemInfoSync();
|
||||
const windowHeight = sysInfo.windowHeight;
|
||||
marginTop.value = sysInfo.statusBarHeight + uni.upx2px(88) + uni.upx2px(54);
|
||||
let urlAPI = ref(api.getWallet);
|
||||
height.value =
|
||||
windowHeight -
|
||||
sysInfo.statusBarHeight -
|
||||
marginTop.value -
|
||||
uni.upx2px(204) -
|
||||
uni.upx2px(110) -
|
||||
uni.upx2px(48) -
|
||||
uni.upx2px(40);
|
||||
|
||||
const getData = () => {
|
||||
urlAPI.value().then((res) => {
|
||||
if (res.code === 0) {
|
||||
dataObj.num = proxy.$fen2yuan(res.data.balance);
|
||||
}
|
||||
});
|
||||
};
|
||||
let cardPages = ref(null);
|
||||
let detailList = ref([]);
|
||||
let detailObj = ref({});
|
||||
const getList = (mescroll) => {
|
||||
let urlApi = dataObj.listApi;
|
||||
let obj = {
|
||||
pageNo: mescroll.num,
|
||||
pageSize: mescroll.size,
|
||||
};
|
||||
urlApi(obj).then((res) => {
|
||||
if (res.code === 0) {
|
||||
detailObj.value = res.data;
|
||||
let list = res.data.detailList.list || [];
|
||||
if (mescroll.num == 1) detailList.value = [];
|
||||
detailList.value = detailList.value.concat(list);
|
||||
cardPages.value.getState(true, list.length);
|
||||
} else {
|
||||
cardPages.value.getState(false);
|
||||
}
|
||||
});
|
||||
};
|
||||
let type = ref(1);
|
||||
const dataChange = async () => {
|
||||
if (type.value) {
|
||||
type.value = Number(type.value);
|
||||
switch (Number(type.value)) {
|
||||
case 1:
|
||||
dataObj.title = '积分账户';
|
||||
dataObj.name = '积分账户';
|
||||
dataObj.btn = '去兑换';
|
||||
dataObj.url = '/pages/home/pay/seed?type=1';
|
||||
dataObj.num = 'currentBalance';
|
||||
dataObj.listApi = api.exAndBesPointList;
|
||||
dataObj.numName = 'amount';
|
||||
dataObj.sourceName = '';
|
||||
break;
|
||||
case 2:
|
||||
dataObj.title = '增量账户';
|
||||
dataObj.name = '增量账户';
|
||||
dataObj.num = 'currentBalance';
|
||||
dataObj.unit = '元';
|
||||
dataObj.btn = '去配票';
|
||||
dataObj.btn1 = '去充值';
|
||||
dataObj.url = '/pages/home/pay/seed?type=2';
|
||||
dataObj.url1 = '/pages/home/pay/seed?type=3';
|
||||
dataObj.listApi = api.getAccountDetail;
|
||||
dataObj.numName = 'amount';
|
||||
dataObj.sourceName = '';
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// getList();
|
||||
}
|
||||
if (cardPages.value) {
|
||||
cardPages.value.mescrollTrigger();
|
||||
}
|
||||
};
|
||||
onLoad(async (e) => {
|
||||
type.value = e.type;
|
||||
});
|
||||
onShow(() => {
|
||||
dataChange();
|
||||
});
|
||||
watch(
|
||||
() => [navIndex.value, typeIndex.value],
|
||||
() => {
|
||||
cardPages.value.mescrollTrigger();
|
||||
},
|
||||
);
|
||||
onShow(() => {
|
||||
if (cardPages.value) {
|
||||
cardPages.value.mescrollTrigger();
|
||||
}
|
||||
});
|
||||
const goUrl = (url) => {
|
||||
uni.navigateTo({
|
||||
url: url,
|
||||
});
|
||||
};
|
||||
let statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
|
||||
let paddingTop = ref();
|
||||
paddingTop.value = -(statusBarHeight + 44);
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.pages {
|
||||
position: relative;
|
||||
|
||||
.bg {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.pages_con {
|
||||
position: relative;
|
||||
padding: 0 40rpx;
|
||||
box-sizing: border-box;
|
||||
z-index: 1;
|
||||
|
||||
.page_top {
|
||||
height: 204rpx;
|
||||
color: #1a1a1a;
|
||||
|
||||
.name {
|
||||
}
|
||||
|
||||
.num {
|
||||
font-size: 68rpx;
|
||||
}
|
||||
|
||||
.btn {
|
||||
background: linear-gradient(131deg, #f7772e 0%, #ee0a24 100%);
|
||||
height: 52rpx;
|
||||
line-height: 52rpx;
|
||||
width: 112rpx;
|
||||
text-align: center;
|
||||
border-radius: 26rpx;
|
||||
color: #ffffff;
|
||||
margin-bottom: 10rpx;
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.page_bottom {
|
||||
background-color: #fff;
|
||||
border-radius: 24rpx;
|
||||
padding: 0 16rpx;
|
||||
|
||||
.bottom_title {
|
||||
line-height: 110rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.navItem {
|
||||
margin-bottom: 20rpx;
|
||||
margin-right: 32rpx;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.activeNav {
|
||||
position: relative;
|
||||
color: var(--color32);
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
width: 40rpx;
|
||||
height: 6rpx;
|
||||
background: linear-gradient(131deg, var(--color30) 0%, var(--color32) 100%), #fa7e31;
|
||||
border-radius: 4rpx;
|
||||
position: absolute;
|
||||
bottom: -14rpx;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
}
|
||||
|
||||
.typeItem {
|
||||
width: 76rpx;
|
||||
height: 40rpx;
|
||||
background-color: #f2f2f2;
|
||||
border-radius: 8rpx;
|
||||
margin-left: 12rpx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.activeType {
|
||||
color: var(--color30);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,53 @@
|
||||
<template>
|
||||
<s-layout title="绿色积分增量系统" leftUrl="/pages/index/index" :goLeft="false">
|
||||
<view class="p-x-32">
|
||||
<card_mescroll ref="mescrollRef" @upCallback="getList" :height="height">
|
||||
<view class="p-y-32 p-x-16 bg24 radius20 m-t-40" v-if="list.length">
|
||||
<view class="m-b-16" v-for="(v, i) in list" :key="i">
|
||||
<card_list :data="v" @upDate="upDate"></card_list>
|
||||
</view>
|
||||
</view>
|
||||
</card_mescroll>
|
||||
</view>
|
||||
<card_tabBar></card_tabBar>
|
||||
</s-layout>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, getCurrentInstance } from 'vue';
|
||||
import card_mescroll from '@/components/card_pages/card_mescroll.vue';
|
||||
import card_list from './components/increment/card_list.vue';
|
||||
import card_tabBar from './components/increment/card_tabBar.vue';
|
||||
import * as api from '@/sheep/api/increment';
|
||||
const { proxy } = getCurrentInstance() as any;
|
||||
let height = ref('100%');
|
||||
let list = ref([]);
|
||||
let mescrollRef = ref(null);
|
||||
const getList = async (mescroll) => {
|
||||
let res: any = await api.getOrderPage({
|
||||
pageNo: mescroll?.num || 1,
|
||||
pageSize: mescroll?.size || 10,
|
||||
});
|
||||
let dataList = [];
|
||||
if (res.code === 0) {
|
||||
dataList = res.data.list;
|
||||
if (mescroll?.num == 1) {
|
||||
list.value = [];
|
||||
}
|
||||
list.value = list.value.concat(dataList);
|
||||
mescrollRef.value.getState(true, dataList.length);
|
||||
} else {
|
||||
mescrollRef.value.getState(false);
|
||||
}
|
||||
};
|
||||
const upDate = () => {
|
||||
if (mescrollRef.value) {
|
||||
mescrollRef.value.mescrollTrigger();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
page{
|
||||
background: #F2F4F7;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,538 @@
|
||||
<template>
|
||||
<view>
|
||||
<s-layout title="商品详情">
|
||||
<!-- 标题栏 -->
|
||||
|
||||
<!-- 骨架屏 -->
|
||||
<detailSkeleton v-if="state.skeletonLoading" />
|
||||
<!-- 下架/售罄提醒 -->
|
||||
<s-empty
|
||||
v-else-if="state.goodsInfo === null"
|
||||
text="商品不存在或已下架"
|
||||
icon="/static/soldout-empty.png"
|
||||
showAction
|
||||
actionText="再逛逛"
|
||||
actionUrl="/pages/goods/list"
|
||||
/>
|
||||
<block v-else>
|
||||
<view class="detail-swiper-selector">
|
||||
<!-- 商品轮播图 -->
|
||||
<su-swiper
|
||||
v-if="state.goodsInfo.sliderPicUrls"
|
||||
class=""
|
||||
isPreview
|
||||
:list="formatGoodsSwiper(state.goodsInfo.sliderPicUrls)"
|
||||
otStyle="tag"
|
||||
imageMode="widthFix"
|
||||
dotCur="bg-mask-40"
|
||||
:seizeHeight="750"
|
||||
/>
|
||||
<!-- 价格+标题 -->
|
||||
<view class="title-card detail-card ss-p-y-32 ss-p-x-32">
|
||||
<view class="title-text ss-line-2 ss-m-b-6 c0"> {{ state.goodsInfo.name }}</view>
|
||||
<view class="subtitle-text ss-line-1 c0">{{ state.goodsInfo.introduction }}</view>
|
||||
<view class="c35 size32 m-t-10"
|
||||
>{{ state.goodsInfo.price }}<span class="size24">积分</span></view
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
<view class="m-t-30 m-b-40 bg24 p-l-40 p-r-32 p-y-8">
|
||||
<view v-if="mesArr.length">
|
||||
<maoScroll
|
||||
:data="mesArr"
|
||||
:lineHeight="72"
|
||||
:animation="1000"
|
||||
:animationScroll="5000"
|
||||
:showNum="2"
|
||||
>
|
||||
<template #default="{ line }">
|
||||
<view class="flex-center ju-between">
|
||||
<view class="flex-row al-flex-end">
|
||||
<view v-for="(item, index) in line.participantAvatars" :key="index">
|
||||
<view
|
||||
class="userImg bg0 flex-center"
|
||||
v-if="index < 3"
|
||||
:style="{ 'margin-left': index ? '-28rpx' : 0, 'z-index': index + 10 }"
|
||||
>
|
||||
<image
|
||||
class="w_56 h_56"
|
||||
:src="item"
|
||||
mode="scaleToFill"
|
||||
v-if="item"
|
||||
style="border-radius: 50%"
|
||||
/>
|
||||
<image
|
||||
v-else
|
||||
class="w_56 h_56"
|
||||
:src="`${$url}home/head.png`"
|
||||
mode="scaleToFill"
|
||||
style="border-radius: 50%"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="w_28 h_26"
|
||||
v-if="line.participantAvatars.length > 3"
|
||||
style="margin-left: -14rpx; margin-bottom: 5rpx"
|
||||
>
|
||||
<image
|
||||
class="w100 h100"
|
||||
src="/static/increment/more.png"
|
||||
mode="scaleToFill"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-center ju-flex-end">
|
||||
<view style="text-align: right">
|
||||
<view class="c13 size28">还剩{{ line.remainingCount }}</view>
|
||||
<view class="c19 size24">倒计时{{ getTime(line.expireTime) }}</view>
|
||||
</view>
|
||||
<view
|
||||
class="w_170 line56 bg35 radius12 center size28 m-l-10"
|
||||
@click.stop="sub(line)"
|
||||
style="color: #fff"
|
||||
>{{
|
||||
statusObj(parseInt(line.joinStatus) || 0, parseInt(line.status) || 0)
|
||||
}}</view
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
</maoScroll>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 详情 -->
|
||||
<detail-content-card
|
||||
class="detail-content-selector"
|
||||
:content="state.goodsInfo.description"
|
||||
/>
|
||||
</block>
|
||||
</s-layout>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, computed, ref, onMounted, onUnmounted } from 'vue';
|
||||
import { onLoad, onPageScroll } from '@dcloudio/uni-app';
|
||||
import maoScroll from '@/components/mao-scroll/mao-scroll.vue';
|
||||
import sheep from '@/sheep';
|
||||
import {
|
||||
formatSales,
|
||||
formatGoodsSwiper,
|
||||
fen2yuan,
|
||||
fen2yuanSimple,
|
||||
formatDiscountPercent,
|
||||
getRewardActivityRuleItemDescriptions,
|
||||
} from '@/sheep/hooks/useGoods';
|
||||
import detailSkeleton from './components/detail/detail-skeleton.vue';
|
||||
import detailContentCard from './components/detail/detail-content-card.vue';
|
||||
import * as SpuApi from '@/sheep/api/increment';
|
||||
|
||||
onPageScroll(() => {});
|
||||
import OrderApi from '@/sheep/api/trade/order';
|
||||
import { SharePageEnum } from '@/sheep/helper/const';
|
||||
import { emojiList } from '../chat/util/emoji';
|
||||
|
||||
const statusObj = (joinStatus, status) => {
|
||||
let text = '未开团';
|
||||
switch (status) {
|
||||
case 0:
|
||||
text = '未开团';
|
||||
if (joinStatus === 1) {
|
||||
text = '已参团';
|
||||
} else {
|
||||
text = '立即参团';
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
text = '已开团';
|
||||
if (joinStatus === 1) {
|
||||
text = '已参团';
|
||||
} else {
|
||||
text = '立即参团';
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
text = '开团成功';
|
||||
break;
|
||||
case 3:
|
||||
text = '开团失败';
|
||||
break;
|
||||
}
|
||||
return text;
|
||||
};
|
||||
const bgColor = {
|
||||
bgColor: '#E93323',
|
||||
Color: '#fff',
|
||||
width: '44rpx',
|
||||
timeTxtwidth: '16rpx',
|
||||
isDay: true,
|
||||
};
|
||||
const isLogin = computed(() => sheep.$store('user').isLogin);
|
||||
const state = reactive({
|
||||
goodsId: 0,
|
||||
info: {},
|
||||
skeletonLoading: true, // SPU 加载中
|
||||
goodsInfo: {}, // SPU 信息
|
||||
showSelectSku: false, // 是否展示 SKU 选择弹窗
|
||||
selectedSku: {}, // 选中的 SKU
|
||||
settlementSku: {}, // 结算的 SKU:由于 selectedSku 不进行默认选中,所以初始使用结算价格最低的 SKU 作为基础展示
|
||||
showModel: false, // 是否展示 Coupon 优惠劵的弹窗
|
||||
updateKey: Date.now(), // 用于更新倒计时的触发键
|
||||
couponInfo: [], // 可领取的 Coupon 优惠劵的列表
|
||||
showActivityModel: false, // 【满减送/限时折扣】是否展示 Activity 营销活动的弹窗
|
||||
rewardActivity: {}, // 【满减送】活动
|
||||
activityList: [], // 【秒杀/拼团/砍价】可参与的 Activity 营销活动的列表
|
||||
});
|
||||
let mesArr = ref([]);
|
||||
|
||||
const getDetail = () => {
|
||||
SpuApi.getGroupDetail({
|
||||
id: state.goodsId,
|
||||
}).then((res) => {
|
||||
if (res.code !== 0 || !res.data) {
|
||||
state.goodsInfo = null;
|
||||
state.skeletonLoading = false;
|
||||
return;
|
||||
}
|
||||
state.skeletonLoading = false;
|
||||
state.goodsInfo = res.data;
|
||||
});
|
||||
};
|
||||
const getList = () => {
|
||||
SpuApi.getGroupBuys({
|
||||
productId: state.goodsId,
|
||||
}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
mesArr.value = res.data;
|
||||
console.log(mesArr.value);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
onLoad((options) => {
|
||||
// 滚到顶部
|
||||
uni.pageScrollTo({
|
||||
scrollTop: 0,
|
||||
});
|
||||
// 非法参数
|
||||
if (!options.id) {
|
||||
state.goodsInfo = null;
|
||||
state.skeletonLoading = false;
|
||||
return;
|
||||
}
|
||||
state.goodsId = options.id;
|
||||
getDetail();
|
||||
getList();
|
||||
});
|
||||
|
||||
const sub = (e) => {
|
||||
SpuApi.joinGroup({
|
||||
groupBuyId: e.groupBuyId,
|
||||
}).then((res) => {
|
||||
getList();
|
||||
});
|
||||
};
|
||||
// 时间戳倒计时
|
||||
const getTime = (t) => {
|
||||
// 计算剩余时间(毫秒)
|
||||
let time = t - Date.now();
|
||||
|
||||
// 确保时间不为负数
|
||||
if (time <= 0) {
|
||||
return '00:00:00';
|
||||
}
|
||||
|
||||
// 转换为时分秒
|
||||
let hour = Math.floor(time / (60 * 60 * 1000));
|
||||
let minute = Math.floor((time % (60 * 60 * 1000)) / (60 * 1000));
|
||||
let second = Math.floor((time % (60 * 1000)) / 1000);
|
||||
|
||||
// 格式化为两位数显示
|
||||
hour = hour.toString().padStart(2, '0');
|
||||
minute = minute.toString().padStart(2, '0');
|
||||
second = second.toString().padStart(2, '0');
|
||||
|
||||
return `${hour}:${minute}:${second}`;
|
||||
};
|
||||
|
||||
// 如果需要让倒计时动态更新,可以添加定时器
|
||||
onMounted(() => {
|
||||
// 每秒更新一次倒计时
|
||||
const timer = setInterval(() => {
|
||||
// 触发页面重新渲染
|
||||
state.updateKey = Date.now();
|
||||
}, 1000);
|
||||
|
||||
// 组件卸载时清除定时器
|
||||
onUnmounted(() => {
|
||||
clearInterval(timer);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.userImg {
|
||||
border-radius: 50%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.detail-card {
|
||||
background-color: var(--color24);
|
||||
border-radius: 10rpx;
|
||||
overflow: hidden;
|
||||
margin-bottom: 40rpx;
|
||||
// color: #fff;
|
||||
}
|
||||
|
||||
// 价格标题卡片
|
||||
.title-card {
|
||||
.price-box {
|
||||
.price-text {
|
||||
font-size: 42rpx;
|
||||
font-weight: 500;
|
||||
color: #ff3000;
|
||||
line-height: 30rpx;
|
||||
font-family: OPPOSANS;
|
||||
|
||||
&::before {
|
||||
content: '¥';
|
||||
font-size: 30rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.origin-price-text {
|
||||
font-size: 26rpx;
|
||||
font-weight: 400;
|
||||
text-decoration: line-through;
|
||||
color: $gray-c;
|
||||
font-family: OPPOSANS;
|
||||
|
||||
&::before {
|
||||
content: '¥';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.sales-text {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: $gray-c;
|
||||
}
|
||||
|
||||
.discounts-box {
|
||||
.tag-content {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.tag-box {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.tag {
|
||||
flex-shrink: 0;
|
||||
padding: 4rpx 10rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
border-radius: 4rpx;
|
||||
color: var(--ui-BG-Main);
|
||||
background: var(--ui-BG-Main-tag);
|
||||
}
|
||||
|
||||
.discounts-title {
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: var(--ui-BG-Main);
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.cicon-forward {
|
||||
color: var(--ui-BG-Main);
|
||||
font-size: 24rpx;
|
||||
line-height: normal;
|
||||
margin-top: 4rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.title-text {
|
||||
color: #333333;
|
||||
font-size: 32rpx;
|
||||
line-height: 42rpx;
|
||||
}
|
||||
|
||||
.subtitle-text {
|
||||
font-size: 26rpx;
|
||||
font-weight: 400;
|
||||
color: $dark-9;
|
||||
line-height: 42rpx;
|
||||
}
|
||||
}
|
||||
|
||||
// 购买
|
||||
.buy-box {
|
||||
.add-btn {
|
||||
width: 240rpx;
|
||||
height: 72rpx;
|
||||
font-weight: 500;
|
||||
font-size: 30rpx;
|
||||
border-radius: 12rpx 0 0 12rpx;
|
||||
background-color: #74aef6;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.buy-btn {
|
||||
width: 240rpx;
|
||||
height: 72rpx;
|
||||
font-weight: 500;
|
||||
font-size: 30rpx;
|
||||
border-radius: 0 12rpx 12rpx 0;
|
||||
background: #366eee;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.disabled-btn {
|
||||
width: 428rpx;
|
||||
height: 72rpx;
|
||||
border-radius: 40rpx;
|
||||
background: #999999;
|
||||
color: $white;
|
||||
}
|
||||
}
|
||||
|
||||
.model-box {
|
||||
height: 60vh;
|
||||
|
||||
.model-content {
|
||||
height: 56vh;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
|
||||
// 限时折扣
|
||||
.discount {
|
||||
width: 750rpx;
|
||||
height: 100rpx;
|
||||
// background-color: red;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.disImg {
|
||||
width: 750rpx;
|
||||
height: 100rpx;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
.discountCont {
|
||||
width: 680rpx;
|
||||
height: 90rpx;
|
||||
margin: 10rpx auto 0 auto;
|
||||
// background-color: gold;
|
||||
}
|
||||
|
||||
.disContT {
|
||||
width: 680rpx;
|
||||
height: 50rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.disContT1 {
|
||||
// width: 400rpx;
|
||||
// height: 50rpx;
|
||||
// background-color: green;
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.disContT2 {
|
||||
width: 200rpx;
|
||||
height: 50rpx;
|
||||
line-height: 50rpx;
|
||||
// background-color: gold;
|
||||
font-size: 30rpx;
|
||||
text-align: end;
|
||||
color: #ff393a;
|
||||
font-weight: bolder;
|
||||
font-style: oblique 20deg;
|
||||
letter-spacing: 0.1rem;
|
||||
}
|
||||
|
||||
.disContT1P {
|
||||
color: white;
|
||||
font-size: 44rpx;
|
||||
}
|
||||
|
||||
.disContT1End {
|
||||
// width: 180rpx;
|
||||
padding: 0 20rpx;
|
||||
height: 36rpx;
|
||||
line-height: 36rpx;
|
||||
text-align: center;
|
||||
background-color: #fee2be;
|
||||
color: #f71b1b;
|
||||
font-size: 23rpx;
|
||||
border-radius: 20rpx;
|
||||
margin-left: 26rpx;
|
||||
}
|
||||
|
||||
.disContB {
|
||||
width: 680rpx;
|
||||
height: 40rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: 20rpx;
|
||||
color: white;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.disContB1 {
|
||||
width: 300rpx;
|
||||
height: 40rpx;
|
||||
line-height: 40rpx;
|
||||
color: #ffcccc;
|
||||
font-size: 24rpx;
|
||||
// 删除线
|
||||
text-decoration: line-through;
|
||||
padding-left: 6rpx;
|
||||
}
|
||||
|
||||
.disContB2 {
|
||||
width: 300rpx;
|
||||
height: 40rpx;
|
||||
line-height: 40rpx;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.label {
|
||||
display: inline-block;
|
||||
font-size: 20rpx;
|
||||
color: #ff5040;
|
||||
border: 1px solid #ff5040;
|
||||
border-radius: 8rpx;
|
||||
height: 34rpx;
|
||||
line-height: 34rpx;
|
||||
padding: 0 8rpx;
|
||||
box-sizing: border-box;
|
||||
margin-top: 10rpx;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,193 @@
|
||||
<template>
|
||||
<s-pages title="我的" leftUrl="/pages/index/index" :goLeft="false">
|
||||
<view class="p-x-32 w100 h_364 relative m-t-42 color0">
|
||||
<view class="p-x-32 w100 h100 absolute t0 l0">
|
||||
<image class="w100 h100" src="/static/increment/bg.png" mode="scaleToFill" />
|
||||
</view>
|
||||
<view class="w100 h100 relative p-x-32 p-t-30 p-b-4">
|
||||
<view class="flex-center ju-between m-b-62">
|
||||
<view class="w_150 h_150 absolute t-42 l20 img">
|
||||
<image
|
||||
class="w100 h100"
|
||||
v-if="dataObj.avatar"
|
||||
:src="dataObj.avatar"
|
||||
mode="scaleToFill"
|
||||
/>
|
||||
<image class="w100 h100" v-else src="/static/head_null.png" mode="scaleToFill" />
|
||||
</view>
|
||||
|
||||
<view class="lineOne m-l-164">{{ dataObj.nickname }}</view>
|
||||
<view>
|
||||
<span class="size28">自动拼团</span>
|
||||
<switch
|
||||
:checked="dataObj.automaticGroupBuy ? true : false"
|
||||
@change="autoChange"
|
||||
color="#F7492E"
|
||||
style="transform: scale(0.7)"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-row wrap" v-if="arr && arr.length">
|
||||
<view class="m-b-24" style="width: 50%" v-for="(v, i) in arr" :key="i">
|
||||
<view class="color4A size24 flex-center ju-flex-start" @click="go(v.path)">
|
||||
<span>{{ v.name }}</span>
|
||||
<uni-icons v-if="v.path" type="right" color="#4A4A4A" size="12" />
|
||||
</view>
|
||||
<view class="size32">{{ dataObj[v.num] || 0 }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="box m-x-32 m-t-52 bg24" v-if="mesArr.length">
|
||||
<view class="relative h_60 w100">
|
||||
<view class="absolute h_60 w100">
|
||||
<image class="w100 h100" src="/static/increment/1.png" mode="scaleToFill" />
|
||||
</view>
|
||||
<view class="relative line60 w100 p-r-28" style="text-align: right; color: #fff">
|
||||
已参团
|
||||
</view>
|
||||
</view>
|
||||
<view class="card4">
|
||||
<maoScroll
|
||||
:data="mesArr"
|
||||
:lineHeight="72"
|
||||
:animation="1000"
|
||||
:animationScroll="1000"
|
||||
:showNum="3"
|
||||
>
|
||||
<template #default="{ line }">
|
||||
<view class="radius8 p-x-16 flex-center ju-flex-start h100" style="display: line-block">
|
||||
<view class="m-r-18 userImg flex-center">
|
||||
<image
|
||||
class="w_56 h_56"
|
||||
:src="line?.avatar"
|
||||
mode="scaleToFill"
|
||||
v-if="line?.avatar"
|
||||
style="border-radius: 50%"
|
||||
/>
|
||||
<image
|
||||
v-else
|
||||
class="w_56 h_56"
|
||||
:src="`${$url}home/head.png`"
|
||||
mode="scaleToFill"
|
||||
style="border-radius: 50%"
|
||||
/>
|
||||
</view>
|
||||
<view class="size28 c0 line54 lineOne">{{ line?.nickname }}已参团</view>
|
||||
</view>
|
||||
</template>
|
||||
</maoScroll>
|
||||
</view>
|
||||
</view>
|
||||
<card_tabBar :index="3"></card_tabBar>
|
||||
</s-pages>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, getCurrentInstance, onMounted } from 'vue';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import card_tabBar from './components/increment/card_tabBar.vue';
|
||||
import maoScroll from '@/components/mao-scroll/mao-scroll.vue';
|
||||
import * as api from '@/sheep/api/increment';
|
||||
const { proxy } = getCurrentInstance();
|
||||
let currentBalance = ref();
|
||||
let dataObj = ref({});
|
||||
let arr = ref([
|
||||
{
|
||||
name: '积分账户',
|
||||
num: 'currentBalance',
|
||||
path: '/pages/increment/detail?type=1',
|
||||
},
|
||||
{
|
||||
name: '增量账户',
|
||||
num: 'incrementPoint',
|
||||
path: '/pages/increment/detail?type=2',
|
||||
},
|
||||
{
|
||||
name: '拼团数',
|
||||
num: 'totalGroupBuyCount',
|
||||
},
|
||||
{
|
||||
name: '今日拼团',
|
||||
num: 'todayGroupBuyCount',
|
||||
},
|
||||
]);
|
||||
let mesArr = ref([]);
|
||||
const autoChange = (e) => {
|
||||
// 0关闭自动拼团1自动拼团
|
||||
console.log(e.detail.value);
|
||||
let b = e.detail.value ? 1 : 0;
|
||||
api
|
||||
.automaticGroupBuy({
|
||||
automaticGroupBuy: b,
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.code === 0) {
|
||||
uni.showToast({
|
||||
title: '设置成功',
|
||||
});
|
||||
getData();
|
||||
}
|
||||
});
|
||||
// api.automaticGroupBuy
|
||||
};
|
||||
const go = (path) => {
|
||||
if (!path) return;
|
||||
uni.navigateTo({
|
||||
url: path,
|
||||
});
|
||||
};
|
||||
const getData = () => {
|
||||
api.getUserGroupInfo({}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
dataObj.value = res.data;
|
||||
|
||||
api
|
||||
.exAndBesPointList({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.code === 0) {
|
||||
dataObj.value.currentBalance = res.data.currentBalance;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
const getList = () => {
|
||||
api
|
||||
.getParticipants({
|
||||
pageNo: 1,
|
||||
pageSize: 20,
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.code === 0) {
|
||||
mesArr.value = res.data.list;
|
||||
}
|
||||
});
|
||||
};
|
||||
onMounted(() => {
|
||||
getData();
|
||||
getList();
|
||||
});
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.box {
|
||||
border-radius: 30rpx 30rpx 0 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.color0 {
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.color4A {
|
||||
color: #4a4a4a;
|
||||
}
|
||||
|
||||
.img {
|
||||
border-radius: 50%;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,353 @@
|
||||
<template>
|
||||
<s-pages tabbar="/pages/cart/cart" title="购物车" :showLeftButton="false">
|
||||
<s-empty
|
||||
v-if="state.list.length === 0"
|
||||
icon="/static/cart-empty.png"
|
||||
text="购物车空空如也,快去逛逛吧~"
|
||||
/>
|
||||
|
||||
<!-- 头部 -->
|
||||
<view v-if="state.list.length" class="cart-box ss-flex ss-flex-col ss-row-between">
|
||||
<view class="cart-header ss-flex ss-col-center ss-row-between ss-p-x-30">
|
||||
<view></view>
|
||||
<view class="header-right">
|
||||
<view v-if="state.editMode" class="c0" @tap="onChangeEditMode(false)"> 取消 </view>
|
||||
<view v-else class="f500" @tap="onChangeEditMode(true)"> 管理 </view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 内容 -->
|
||||
<view class="cart-content ss-flex-1 ss-p-x-30 ss-m-b-40 m-b-100">
|
||||
<view
|
||||
v-for="item in state.list"
|
||||
:key="item.id"
|
||||
class="goods-box ss-r-10"
|
||||
@click="goInfo(item.spu.id)"
|
||||
>
|
||||
<view class="ss-flex ss-col-center">
|
||||
<label
|
||||
class="check-box ss-flex ss-col-center ss-p-l-10"
|
||||
@tap.stop="onSelectSingle(item.id)"
|
||||
>
|
||||
<radio
|
||||
:checked="state.selectedIds.includes(item.id)"
|
||||
color="var(--color32)"
|
||||
style="transform: scale(0.8)"
|
||||
backgroundColor="var(--color31)"
|
||||
@tap.stop="onSelectSingle(item.id)"
|
||||
/>
|
||||
</label>
|
||||
<view v-if="item.spu?.status !== 1 && !state.editMode" class="down-box">
|
||||
该商品已下架
|
||||
</view>
|
||||
<view v-else-if="item.spu?.stock <= 0 && !state.editMode" class="down-box">
|
||||
该商品无库存
|
||||
</view>
|
||||
<s-goods-item
|
||||
:img="item.spu.picUrl || item.goods.image"
|
||||
:price="item.sku?.price || 0"
|
||||
:skuText="
|
||||
item.sku?.properties.length > 1
|
||||
? item.sku?.properties.reduce(
|
||||
(items2, items) => items2.valueName + ' ' + items.valueName,
|
||||
)
|
||||
: item.sku?.properties[0].valueName
|
||||
"
|
||||
:title="item.spu.name"
|
||||
:titleWidth="400"
|
||||
priceColor="#FF3000"
|
||||
>
|
||||
<template v-if="!state.editMode" v-slot:tool>
|
||||
<su-number-box
|
||||
v-model="item.count"
|
||||
:max="item.sku?.stock"
|
||||
:min="0"
|
||||
:step="1"
|
||||
@change="onNumberChange($event, item)"
|
||||
background="var(--color18)"
|
||||
color="var(--color34)"
|
||||
/>
|
||||
</template>
|
||||
</s-goods-item>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 底部 -->
|
||||
<su-fixed v-if="state.list.length > 0" :isInset="false" :val="valNum" bottom placeholder>
|
||||
<view class="cart-footer ss-flex ss-col-center ss-row-between ss-p-x-30 border-bottom">
|
||||
<view class="ss-flex ss-col-center flex1">
|
||||
<label class="check-box ss-flex ss-col-center ss-p-r-30 flex1" @tap="onSelectAll">
|
||||
<radio
|
||||
:checked="state.isAllSelected"
|
||||
color="var(--color32)"
|
||||
style="transform: scale(0.8)"
|
||||
backgroundColor="var(--color31)"
|
||||
@tap.stop="onSelectAll"
|
||||
/>
|
||||
<view class="ss-m-l-8 c0"> 全选</view>
|
||||
</label>
|
||||
<view class="flex-center" style="margin-right: 14rpx">
|
||||
<text class="size26 c0">总计:</text>
|
||||
|
||||
<view class="price-text c13">
|
||||
<span class="f500">¥</span>
|
||||
<span class="priceNum">
|
||||
{{ fen2yuan(state.totalPriceSelected) }}
|
||||
</span>
|
||||
</view>
|
||||
<!-- <view class="text-price price-text size34" style="color: #ee0a24">
|
||||
{{ fen2yuan(state.totalPriceSelected) }}
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
<view class="footer-right">
|
||||
<button
|
||||
v-if="state.editMode"
|
||||
class="ss-reset-button pay-btn ui-Shadow-Main"
|
||||
@tap="onDelete"
|
||||
>
|
||||
删除
|
||||
</button>
|
||||
<button v-else class="ss-reset-button pay-btn ui-Shadow-Main" @tap="onConfirm">
|
||||
去结算
|
||||
{{ state.selectedIds?.length ? `(${state.selectedIds.length})` : '' }}
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</su-fixed>
|
||||
</view>
|
||||
</s-pages>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import sheep from '@/sheep';
|
||||
import { onShow, onLoad } from '@dcloudio/uni-app';
|
||||
import SpuApi from '@/sheep/api/product/spu';
|
||||
import { computed, reactive } from 'vue';
|
||||
import { fen2yuan } from '@/sheep/hooks/useGoods';
|
||||
import { isEmpty } from '@/sheep/helper/utils';
|
||||
onLoad(() => {
|
||||
uni.hideNavigationBarLoading();
|
||||
});
|
||||
// 隐藏原生tabBar
|
||||
// uni.hideTabBar({
|
||||
// fail: () => {},
|
||||
// });
|
||||
|
||||
const sys_navBar = sheep.$platform.navbar;
|
||||
const cart = sheep.$store('cart');
|
||||
|
||||
const state = reactive({
|
||||
editMode: computed(() => cart.editMode),
|
||||
list: computed(() => cart.list),
|
||||
selectedList: [],
|
||||
selectedIds: computed(() => cart.selectedIds),
|
||||
isAllSelected: computed(() => cart.isAllSelected),
|
||||
totalPriceSelected: computed(() => cart.totalPriceSelected),
|
||||
});
|
||||
|
||||
// 单选选中
|
||||
function onSelectSingle(id) {
|
||||
cart.selectSingle(id);
|
||||
}
|
||||
|
||||
// 编辑、取消
|
||||
function onChangeEditMode(flag) {
|
||||
cart.onChangeEditMode(flag);
|
||||
}
|
||||
|
||||
// 全选
|
||||
function onSelectAll() {
|
||||
cart.selectAll(!state.isAllSelected);
|
||||
}
|
||||
|
||||
// 结算
|
||||
async function onConfirm() {
|
||||
const items = [];
|
||||
state.selectedList = state.list.filter((item) => state.selectedIds.includes(item.id));
|
||||
state.selectedList.map((item) => {
|
||||
// 此处前端做出修改
|
||||
items.push({
|
||||
skuId: item.sku?.id,
|
||||
count: item.count,
|
||||
cartId: item.id,
|
||||
categoryId: item.spu.categoryId,
|
||||
});
|
||||
});
|
||||
if (isEmpty(items)) {
|
||||
sheep.$helper.toast('请先选择商品');
|
||||
return;
|
||||
}
|
||||
await validateDeliveryType(state.selectedList.map((item) => item.spu).map((spu) => spu.id));
|
||||
sheep.$router.go('/pages/order/confirm', {
|
||||
data: JSON.stringify({
|
||||
items,
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验配送方式冲突
|
||||
*
|
||||
* @param {string[]} spuIds - 商品ID数组
|
||||
* @returns {Promise<void>}
|
||||
* @throws {Error} 当配送方式冲突或获取商品信息失败时抛出错误
|
||||
*/
|
||||
async function validateDeliveryType(spuIds) {
|
||||
// 获取商品信息
|
||||
const { data: spuList } = await SpuApi.getSpuListByIds(spuIds.join(','));
|
||||
if (isEmpty(spuList)) {
|
||||
sheep.$helper.toast('未找到商品信息');
|
||||
throw new Error('未找到商品信息');
|
||||
}
|
||||
// 获取所有商品的配送方式列表
|
||||
const deliveryTypesList = spuList.map((item) => item.deliveryTypes);
|
||||
// 检查配送方式冲突
|
||||
const hasConflict = checkDeliveryConflicts(deliveryTypesList);
|
||||
if (hasConflict) {
|
||||
sheep.$helper.toast('选中商品支持的配送方式冲突,不允许提交');
|
||||
throw new Error('选中商品支持的配送方式冲突,不允许提交');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查配送方式列表中是否存在冲突
|
||||
* @description
|
||||
* 示例场景:
|
||||
* A 商品支持:[快递, 自提]
|
||||
* B 商品支持:[快递]
|
||||
* C 商品支持:[自提]
|
||||
*
|
||||
* 对比结果:
|
||||
* A 和 B:不冲突 (有交集:快递)
|
||||
* A 和 C:不冲突 (有交集:自提)
|
||||
* B 和 C:冲突 (无交集)
|
||||
* @param {Array<Array<number>>} deliveryTypesList - 配送方式列表的数组
|
||||
* @returns {boolean} 是否存在冲突
|
||||
*/
|
||||
function checkDeliveryConflicts(deliveryTypesList) {
|
||||
for (let i = 0; i < deliveryTypesList.length - 1; i++) {
|
||||
const currentTypes = deliveryTypesList[i];
|
||||
for (let j = i + 1; j < deliveryTypesList.length; j++) {
|
||||
const nextTypes = deliveryTypesList[j];
|
||||
// 检查是否没有交集(即冲突)
|
||||
const hasNoIntersection = !currentTypes.some((type) => nextTypes.includes(type));
|
||||
if (hasNoIntersection) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function onNumberChange(e, cartItem) {
|
||||
//console.log(e);
|
||||
if (e === 0) {
|
||||
cart.delete(cartItem.id);
|
||||
return;
|
||||
}
|
||||
if (cartItem.goods_num === e) return;
|
||||
cartItem.goods_num = e;
|
||||
cart.update({
|
||||
goods_id: cartItem.id,
|
||||
goods_num: e,
|
||||
goods_sku_price_id: cartItem.goods_sku_price_id,
|
||||
});
|
||||
}
|
||||
|
||||
async function onDelete() {
|
||||
cart.delete(state.selectedIds);
|
||||
}
|
||||
|
||||
function getCartList() {
|
||||
cart.getList();
|
||||
}
|
||||
|
||||
onShow(() => {
|
||||
getCartList();
|
||||
});
|
||||
const goInfo = (id) => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/goods/info?id=' + id,
|
||||
});
|
||||
};
|
||||
let valNum = ref(0);
|
||||
// #ifdef APP-PLUS
|
||||
valNum.value = 0;
|
||||
// #endif
|
||||
|
||||
// #ifndef APP-PLUS
|
||||
valNum.value = 50;
|
||||
// #endif
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
:deep(.ui-fixed) {
|
||||
height: 72rpx;
|
||||
}
|
||||
|
||||
.cart-box {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
border-radius: 0 0 16rpx 16rpx;
|
||||
overflow: hidden;
|
||||
|
||||
.cart-header {
|
||||
height: 70rpx;
|
||||
width: 100%;
|
||||
// position: fixed;
|
||||
// left: 0;
|
||||
// top: v-bind('sys_navBar') rpx;
|
||||
z-index: 1000;
|
||||
box-sizing: border-box;
|
||||
border-radius: 16rpx 16rpx 0 0;
|
||||
}
|
||||
|
||||
.cart-footer {
|
||||
height: 100rpx;
|
||||
background-color: var(--color16);
|
||||
box-shadow: 0px 0px 18px 0px rgba(0, 0, 0, 0.04);
|
||||
|
||||
.pay-btn {
|
||||
width: 180rpx;
|
||||
height: 70rpx;
|
||||
font-size: 28rpx;
|
||||
line-height: 28rpx;
|
||||
font-weight: 500;
|
||||
border-radius: 40rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.cart-content {
|
||||
.goods-box {
|
||||
position: relative;
|
||||
margin-bottom: 22rpx;
|
||||
}
|
||||
// 下架商品
|
||||
.down-box {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgba(var(--ui-BG-1), 0.8);
|
||||
z-index: 2;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
color: #999;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
.price-text {
|
||||
.priceNum {
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
.ss-reset-button {
|
||||
background: linear-gradient(270deg, #f7772e 0%, #ee0a24 99%);
|
||||
color: #ffffff;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,183 @@
|
||||
<template>
|
||||
<s-pages tabbar="/pages/index/category" title="分类" :showLeftButton="false" color="#ffffff">
|
||||
<card_search class="search" style="padding-bottom: 32rpx" @search="search"></card_search>
|
||||
<view class="page_bottom flex-row">
|
||||
<view class="classify shrink">
|
||||
<view
|
||||
class="c_name size26"
|
||||
:class="{ activeName: i == dataObj.index }"
|
||||
v-for="(v, i) in dataObj.categoryList"
|
||||
:key="v.id"
|
||||
@click="classifyChange(i)"
|
||||
>
|
||||
{{ v.name }}
|
||||
</view>
|
||||
</view>
|
||||
<pages_commodity
|
||||
class="commodity flex1"
|
||||
ref="pageCommodity"
|
||||
:dataList="dataObj.dataList"
|
||||
@getData="getData"
|
||||
:subclassification="subclassification"
|
||||
:height="height"
|
||||
></pages_commodity>
|
||||
</view>
|
||||
</s-pages>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive } from 'vue';
|
||||
import sheep from '@/sheep';
|
||||
import SpuApi from '@/sheep/api/product/spu';
|
||||
import CategoryApi from '@/sheep/api/product/category';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import { handleTree } from '@/sheep/helper/utils';
|
||||
import useMescroll from '@/uni_modules/mescroll-uni/hooks/useMescroll.js';
|
||||
import goodsItem2 from '@/components/goodsItem/goodsItem2.vue';
|
||||
import pages_commodity from '@/components/pages_commodity/pages_commodity.vue';
|
||||
let sysInfo = uni.getSystemInfoSync();
|
||||
const windowHeight = sysInfo.windowHeight;
|
||||
let height = ref('100%');
|
||||
height.value =
|
||||
windowHeight -
|
||||
sysInfo.statusBarHeight -
|
||||
uni.upx2px(88) -
|
||||
uni.upx2px(80) -
|
||||
uni.upx2px(96) -
|
||||
uni.upx2px(16) +
|
||||
'px';
|
||||
const dataObj = reactive({
|
||||
categoryList: [], // 商品分类树
|
||||
index: 0, // 选中的一级菜单,在 categoryList 的下标
|
||||
c_id: null, // 选中的一级菜单 id
|
||||
dataList: [], // 商品列表
|
||||
});
|
||||
let pageCommodity = ref(null);
|
||||
// 获取分类
|
||||
const getcategoryList = async () => {
|
||||
const { code, data } = await CategoryApi.getCategoryList();
|
||||
if (code !== 0) {
|
||||
return;
|
||||
}
|
||||
// dataObj.categoryList = data;
|
||||
dataObj.categoryList = handleTree(data);
|
||||
if (dataObj.categoryList.length) {
|
||||
dataObj.c_id = dataObj.categoryList[0].id;
|
||||
}
|
||||
classifyChange(0);
|
||||
};
|
||||
const subclassification = ref([]);
|
||||
const classifyChange = (i) => {
|
||||
dataObj.index = i;
|
||||
dataObj.c_id = dataObj.categoryList[i]?.id;
|
||||
subclassification.value = dataObj.categoryList[i]?.children || [];
|
||||
|
||||
// upCallback({
|
||||
// num: 1,
|
||||
// size: 10,
|
||||
// });
|
||||
|
||||
// pageCommodity.value.changeData()
|
||||
if (pageCommodity.value) {
|
||||
pageCommodity.value.clearAll();
|
||||
}
|
||||
};
|
||||
|
||||
const changeArr = (id, arr, names = []) => {
|
||||
if (!arr || !arr.length) return '';
|
||||
for (const item of arr) {
|
||||
const pathNames = [...names, item.name];
|
||||
if (item.id == id) {
|
||||
return pathNames.join(' | ');
|
||||
}
|
||||
if (item.children && item.children.length > 0) {
|
||||
const found = changeArr(id, item.children, pathNames);
|
||||
if (found) return found;
|
||||
}
|
||||
}
|
||||
return '';
|
||||
};
|
||||
onLoad(async () => {
|
||||
let res = await getcategoryList();
|
||||
pageCommodity.value.changeData();
|
||||
// upCallback();
|
||||
});
|
||||
const getData = async (mescroll) => {
|
||||
let res = await SpuApi.getSpuPage({
|
||||
categoryId: dataObj.c_id,
|
||||
pageNo: mescroll?.num || 1,
|
||||
pageSize: mescroll?.size || 10,
|
||||
keyword: searchText.value,
|
||||
...mescroll.params,
|
||||
});
|
||||
if (res.code !== 0) {
|
||||
pageCommodity.value.requestResult(false);
|
||||
return;
|
||||
}
|
||||
|
||||
const curPageData = res.data.list || []; // 当前页数据
|
||||
if (curPageData.length) {
|
||||
curPageData.forEach((item) => {
|
||||
item.categoryText = changeArr(item.categoryId, dataObj.categoryList);
|
||||
});
|
||||
}
|
||||
if (mescroll?.num == 1) dataObj.dataList = []; // 第一页需手动制空列表
|
||||
dataObj.dataList = dataObj.dataList.concat(curPageData); //追加新数据
|
||||
// mescroll.endSuccess(curPageData.length); // 请求成功, 结束加载
|
||||
pageCommodity.value.requestResult(true, curPageData.length);
|
||||
};
|
||||
let searchText = ref(null);
|
||||
const search = (text) => {
|
||||
searchText.value = text;
|
||||
pageCommodity.value.changeData();
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.page_bottom {
|
||||
width: 100%;
|
||||
height: calc(100vh - 88rpx - 72rpx - 32rpx - 100rpx - 8rpx);
|
||||
|
||||
.classify {
|
||||
width: 160rpx;
|
||||
overflow-y: auto;
|
||||
background-color: #f2f4f7;
|
||||
|
||||
.c_name {
|
||||
text-align: center;
|
||||
line-height: 120rpx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.activeName {
|
||||
background: rgba($color: #ffffff, $alpha: 1);
|
||||
position: relative;
|
||||
color: var(--color32);
|
||||
font-weight: 600;
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
width: 6rpx;
|
||||
height: 76rpx;
|
||||
background-color: var(--color32);
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
border-radius: 0 4rpx 4rpx 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.commodity {
|
||||
width: calc(100% - 160rpx);
|
||||
}
|
||||
|
||||
.search {
|
||||
padding: 0 30rpx;
|
||||
box-sizing: border-box;
|
||||
background-color: #fff;
|
||||
}
|
||||
</style>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user