632 lines
15 KiB
Vue
632 lines
15 KiB
Vue
<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> |