chore: 暂时保存

This commit is contained in:
2026-01-05 11:22:38 +08:00
parent b24f77be1a
commit be51b30fb4
48 changed files with 381 additions and 355 deletions

View File

@@ -0,0 +1,924 @@
<template>
<view class="content" :style="themeColor">
<view class="head-wrap">
<!-- 搜索区域 -->
<view class="search-wrap uni-flex uni-row">
<view class="flex-item input-wrap" @click.stop="search()" @tap.stop="search()">
<input class="uni-input" maxlength="50" v-model="keyword" confirm-type="search" @confirm="search()"
@click.stop="search()" @tap.stop="search()"
:placeholder="isEnEnv ? 'Please enter product keywords' : '请输入商品关键词'" />
<text class="iconfont icon-sousuo3" @click.stop="search()" @tap.stop="search()"></text>
</view>
</view>
<!-- 排序 -->
<view class="sort-wrap">
<view class="comprehensive-wrap" :class="{ 'color-base-text': order === '' }" @click="sortTabClick('')">
<text :class="{ 'color-base-text': order === '' }">{{ isEnEnv ? 'Comprehensive' : '综合' }}</text>
</view>
<view class="price-wrap" @click="sortTabClick('point')">
<text :class="{ 'color-base-text': order === 'point' }">{{ isEnEnv ? 'Points' : '积分' }}</text>
<view class="iconfont-wrap">
<view class="iconfont icon-shangsanjiao-copy"
:class="{ 'color-base-text': priceOrder === 'asc' && order === 'point' }"></view>
<view class="iconfont icon-sanjiao"
:class="{ 'color-base-text': priceOrder === 'desc' && order === 'point' }"></view>
</view>
</view>
<view class="price-wrap" @click="sortTabClick('create_time')">
<text :class="{ 'color-base-text': order === 'create_time' }">{{ isEnEnv ? 'New Arrival' : '上新时间'
}}</text>
<view class="iconfont-wrap">
<view class="iconfont icon-shangsanjiao-copy"
:class="{ 'color-base-text': priceOrder === 'asc' && order === 'create_time' }"></view>
<view class="iconfont icon-sanjiao"
:class="{ 'color-base-text': priceOrder === 'desc' && order === 'create_time' }"></view>
</view>
</view>
<view :class="{ 'color-base-text': order === 'screen' }" class="screen-wrap">
<text @click="sortTabClick('screen')">{{ isEnEnv ? 'Filter' : '筛选' }}</text>
<view @click="sortTabClick('screen')" class="iconfont-wrap">
<view class="iconfont icon-shaixuan color-tip"></view>
</view>
</view>
</view>
</view>
<mescroll-uni top="180" @getData="getData" ref="mescroll" :size="10">
<block slot="list">
<view class="list-wrap">
<view class="goods-list double-column" v-if="goodsList.length">
<view class="goods-item margin-bottom" v-for="(item, index) in goodsList" :key="index">
<view class="goods-img" @click="toDetail(item)">
<image :src="goodsImg(item.image)" mode="widthFix" @error="imgError(index)"></image>
</view>
<view class="info-wrap">
<view class="name-wrap">
<view class="goods-name" @click="toDetail(item)">{{ isEnEnv ? item.en_goods_name :
item.goods_name }}</view>
</view>
<view class="lineheight-clear">
<view class="discount-price">
<text class="unit ">{{ item.point }}</text>
<text class="unit font-size-tag">{{ isEnEnv ? 'Points' : '积分' }}</text>
<block v-if="item.price > 0 && item.pay_type > 0">
<text class="unit font-size-tag">+</text>
<text class="unit font-size-tag">{{ $lang('common.currencySymbol')
}}</text>
<text class="price font-size-toolbar">{{
parseFloat(item.price).toFixed(2).split(".")[0] }}</text>
<text class="unit font-size-tag">.{{
parseFloat(item.price).toFixed(2).split(".")[1] }}</text>
</block>
</view>
</view>
<view class="pro-info" v-if="item.stock_show">
<view class="font-size-activity-tag color-tip">{{ isEnEnv ? 'Stock ' : '库存' }}{{
item.stock }}</view>
<view class="sale font-size-activity-tag color-tip" @click="toDetail(item)">
<!-- <button type="primary" size="mini">立即兑换</button> -->
</view>
</view>
</view>
</view>
</view>
<view class="empty" v-if="goodsList.length == 0">
<ns-empty :isIndex="false"
:text="isEnEnv ? 'No point products available' : '暂无积分商品'"></ns-empty>
</view>
</view>
</block>
</mescroll-uni>
<!-- 筛选弹出框 -->
<uni-drawer :visible="showScreen" mode="right" @close="showScreen = false" class="screen-wrap">
<view class="title color-tip">{{ isEnEnv ? 'Filter' : '筛选' }}</view>
<scroll-view scroll-y>
<!-- 价格筛选项 -->
<view class="item-wrap">
<view class="label"><text>{{ isEnEnv ? 'Point Range' : '积分区间' }}</text></view>
<view class="price-wrap">
<input class="uni-input" type="digit" v-model="minPoint"
:placeholder="isEnEnv ? 'Min' : '最低'" />
<view class="h-line"></view>
<input class="uni-input" type="digit" v-model="maxPoint"
:placeholder="isEnEnv ? 'Max' : '最高'" />
</view>
</view>
<!-- 分类筛选项 -->
<view class="category-list-wrap">
<text class="first">{{ isEnEnv ? 'All Categories' : '全部分类' }}</text>
<view class="class-box">
<view @click="selectedCategory('')" class="list-wrap"><text
:class="{ selected: !categoryId, 'color-base-text': !categoryId }">{{ isEnEnv ? 'All' :
'全部' }}</text></view>
<view @click="selectedCategory(item.category_id)" v-for="(item, index) in categoryList"
:key="index" class="list-wrap">
<text
:class="{ selected: item.category_id == categoryId, 'color-base-text': item.category_id == categoryId }">{{
item.category_name }}</text>
</view>
</view>
</view>
</scroll-view>
<view class="footer" :class="{ 'safe-area': isIphoneX }">
<button type="default" class="footer-box" @click="resetData">{{ isEnEnv ? 'Reset' : '重置' }}</button>
<button type="primary" class="footer-box1" @click="screenData">{{ isEnEnv ? 'Confirm' : '确定' }}</button>
</view>
</uni-drawer>
<!-- #ifdef MP-WEIXIN -->
<!-- 小程序隐私协议 -->
<privacy-popup ref="privacyPopup"></privacy-popup>
<!-- #endif -->
</view>
</template>
<script>
export default {
components: {
uniDrawer: () => import('@/components/uni-drawer/uni-drawer.vue'),
uniPopup: () => import('@/components/uni-popup/uni-popup.vue'),
nsSelectTime: () => import('@/components/ns-select-time/ns-select-time.vue'),
nsLogin: () => import('@/components/ns-login/ns-login.vue'),
MescrollUni: () => import('@/components/mescroll/my-list-mescroll.vue'),
loadingCover: () => import('@/components/loading-cover/loading-cover.vue'),
nsEmpty: () => import('@/components/ns-empty/ns-empty.vue'),
nsPayment: () => import('@/components/payment/payment.vue'),
// #ifdef MP-WEIXIN
privacyPopup: () => import('@/components/wx-privacy-popup/privacy-popup.vue'),
// #endif
},
data() {
return {
listStyle: '',
priceOrder: 'desc',
categoryList: [], //排序类型
goodsList: [],
order: '',
sort: 'desc',
showScreen: false,
keyword: '',
categoryId: 0,
minPoint: '',
maxPoint: '',
isFreeShipping: false, //是否免邮
isIphoneX: false,
coupon: 0,
emptyShow: false,
isList: true, //列表样式
mescroll: null,
isLogin: false,
couponList: [],
hongbaoList: [],
point: 0,
};
},
onLoad(options) {
this.categoryId = options.category_id || 0;
this.keyword = options.keyword || '';
this.isIphoneX = this.$util.uniappIsIPhoneX();
this.coupon = options.coupon || 0;
this.loadCategoryList(this.categoryId);
},
methods: {
//获取积分商品详情
getData(mescroll) {
this.$api.sendRequest({
url: '/pointexchange/api/goods/page',
data: {
page_size: mescroll.size,
page: mescroll.num,
type: 1,
keyword: this.keyword,
category_id: this.categoryId,
min_point: this.minPoint,
max_point: this.maxPoint,
is_free_shipping: (this.isFreeShipping ? 1 : 0),
order: this.order,
sort: this.sort,
coupon: this.coupon
},
success: res => {
let newArr = [];
let msg = res.message;
if (res.code == 0 && res.data) {
newArr = res.data.list;
} else {
this.$util.showToast({
title: msg
});
}
mescroll.endSuccess(newArr.length);
//设置列表数据
if (mescroll.num == 1) this.goodsList = []; //如果是第一页需手动制空列表
this.goodsList = this.goodsList.concat(newArr); //追加新数据
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
},
fail() {
//联网失败的回调
mescroll.endErr();
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
}
});
},
//加载分类
loadCategoryList(fid, sid) {
this.$api.sendRequest({
url: '/api/goodscategory/tree',
data: {},
success: res => {
if (res.data != null) this.categoryList = res.data;
}
});
},
goodsImg(imgStr) {
let imgs = imgStr.split(',');
return imgs[0] ? this.$util.img(imgs[0], {
size: 'mid'
}) : this.$util.getDefaultImage().goods;
},
imgError(index) {
this.goodsList[index].goods_image = this.$util.getDefaultImage().goods;
},
//跳转至详情页面
toDetail(item) {
this.$util.redirectTo('/pages_promotion/point/detail', {
id: item.id
});
},
search() {
this.emptyShow = false;
this.goodsList = [];
this.$refs.mescroll.refresh();
},
//筛选点击
sortTabClick(tag) {
if (tag == 'point') {
this.order = 'point';
this.sort = 'desc';
} else if (tag == 'create_time') {
this.order = 'create_time';
this.sort = 'desc';
} else if (tag == 'screen') {
//筛选
this.showScreen = true;
return;
} else {
this.order = '';
this.sort = '';
}
this.order = tag;
if (tag === 'create_time') {
this.priceOrder = this.priceOrder === 'asc' ? 'desc' : 'asc';
this.sort = this.priceOrder;
} else if (tag === 'point') {
this.priceOrder = this.priceOrder === 'asc' ? 'desc' : 'asc';
this.sort = this.priceOrder;
}
this.emptyShow = false;
this.goodsList = [];
this.$refs.mescroll.refresh();
},
selectedCategory(categoryId) {
this.categoryId = categoryId;
},
screenData() {
if (this.minPoint != '' || this.maxPoint != '') {
// if (!Number(this.minPoint) && this.minPoint) {
// this.$util.showToast({
// title: '请输入最低价'
// });
// return;
// }
if (!Number(this.maxPoint) && this.maxPoint) {
this.$util.showToast({
title: this.isEnEnv ? 'Please enter the maximum price' : '请输入最高价'
});
return;
}
if (Number(this.minPoint) < 0 || Number(this.maxPoint) < 0) {
this.$util.showToast({
title: this.isEnEnv ? 'Filter price cannot be less than 0' : '筛选价格不能小于0'
});
return;
}
if (this.minPoint != '' && Number(this.minPoint) > Number(this.maxPoint) && this.maxPoint) {
this.$util.showToast({
title: this.isEnEnv ? 'Minimum price cannot be greater than maximum price' : '最低价不能大于最高价'
});
return;
}
if (this.maxPoint != '' && Number(this.maxPoint) < Number(this.minPoint)) {
this.$util.showToast({
title: this.isEnEnv ? 'Maximum price cannot be less than minimum price' : '最高价不能小于最低价'
});
return;
}
}
this.emptyShow = false;
this.goodsList = [];
this.$refs.mescroll.refresh();
this.showScreen = false;
},
//重置数据
resetData() {
this.showScreen = false;
this.categoryId = 0
this.minPoint = ''
this.maxPoint = ''
},
},
};
</script>
<style lang="scss">
.head-wrap {
background: #fff;
position: fixed;
width: 100%;
left: 0;
z-index: 1;
.search-wrap {
flex: 0.5;
padding: 30rpx 30rpx 0;
font-size: $font-size-tag;
display: flex;
align-items: center;
.input-wrap {
flex: 1;
display: flex;
justify-content: space-between;
align-items: center;
background: $color-bg;
height: 70rpx;
padding-left: 10rpx;
border-radius: 70rpx;
input {
width: 90%;
background: $color-bg;
font-size: $font-size-tag;
height: 50rpx;
padding: 10rpx 25rpx 10rpx 40rpx;
line-height: 50rpx;
border-radius: 40rpx;
}
text {
font-size: $font-size-toolbar;
color: $color-tip;
width: 80rpx;
text-align: center;
margin-right: 20rpx;
}
}
.category-wrap,
.list-style {
display: flex;
justify-content: center;
align-items: center;
.iconfont {
font-size: 50rpx;
color: $color-tip;
}
text {
display: block;
margin-top: 60rpx;
}
}
}
.sort-wrap {
display: flex;
padding: 10rpx 20rpx 10rpx 0;
>view {
flex: 1;
text-align: center;
font-size: $font-size-base;
height: 60rpx;
line-height: 60rpx;
}
.comprehensive-wrap {
display: flex;
justify-content: center;
align-items: center;
.iconfont-wrap {
display: inline-block;
margin-left: 10rpx;
width: 40rpx;
.iconfont {
font-size: $font-size-toolbar;
line-height: 1;
margin-bottom: 5rpx;
}
}
}
.price-wrap {
display: flex;
justify-content: center;
align-items: center;
.iconfont-wrap {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
width: 40rpx;
.iconfont {
float: left;
font-size: 24rpx;
line-height: 1;
height: 20rpx;
color: #909399;
}
}
}
.screen-wrap {
display: flex;
justify-content: center;
align-items: center;
.iconfont-wrap {
display: inline-block;
margin-left: 10rpx;
width: 40rpx;
.iconfont {
font-size: $font-size-toolbar;
line-height: 1;
}
}
}
}
}
.category-list-wrap {
height: 100%;
.class-box {
display: flex;
flex-wrap: wrap;
padding: 0 $padding;
view {
width: calc((100% - 60rpx) / 3);
font-size: $font-size-goods-tag;
margin-right: 20rpx;
height: 60rpx;
line-height: 60rpx;
text-align: center;
margin-bottom: 12rpx;
flex-shrink: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
background: rgba(245, 245, 245, 1);
border-radius: 5rpx;
&:nth-of-type(3n) {
margin-right: 0;
}
}
}
.first {
font-size: $font-size-tag;
display: block;
// background: $page-color-base;
padding: 20rpx;
}
.second {
border-bottom: 2rpx solid $color-line;
padding: 20rpx;
display: block;
font-size: $font-size-tag;
}
.third {
padding: 0 20rpx 20rpx;
overflow: hidden;
font-size: $font-size-tag;
>view {
display: inline-block;
margin-right: 20rpx;
margin-top: 20rpx;
}
.uni-tag {
padding: 0 20rpx;
}
}
}
.screen-wrap {
.title {
font-size: $font-size-tag;
padding: $padding;
background: #f6f4f5;
}
scroll-view {
height: 85%;
.item-wrap {
border-bottom: 1px solid #f0f0f0;
.label {
font-size: $font-size-tag;
padding: $padding;
view {
display: inline-block;
font-size: 60rpx;
height: 40rpx;
vertical-align: middle;
line-height: 40rpx;
}
}
.list {
margin: $margin-updown $margin-both;
overflow: hidden;
>view {
display: inline-block;
margin-right: 25rpx;
margin-bottom: 25rpx;
}
.uni-tag {
padding: 0 $padding;
font-size: $font-size-goods-tag;
background: #f5f5f5;
height: 52rpx;
line-height: 52rpx;
border: 0;
}
}
.price-wrap {
display: flex;
justify-content: center;
align-items: center;
padding: $padding;
input {
flex: 1;
background: #f5f5f5;
height: 52rpx;
width: 182rpx;
line-height: 50rpx;
font-size: $font-size-goods-tag;
border-radius: 50rpx;
text-align: center;
&:first-child {
margin-right: 10rpx;
}
&:last-child {
margin-left: 10rpx;
}
}
}
}
}
.footer {
height: 90rpx;
display: flex;
justify-content: center;
align-items: flex-start;
//position: absolute;
bottom: 0;
width: 100%;
.footer-box {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
margin: 0;
width: 40%;
}
.footer-box1 {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
margin: 0;
width: 40%;
}
}
}
.safe-area {
bottom: 68rpx !important;
}
.empty {
margin-top: 100rpx;
}
.buy-num {
font-size: $font-size-activity-tag;
}
.icon {
width: 34rpx;
height: 30rpx;
}
.list-style-new {
display: flex;
align-items: center;
.line {
width: 4rpx;
height: 28rpx;
background-color: rgba(227, 227, 227, 1);
margin-right: 60rpx;
}
}
.h-line {
width: 37rpx;
height: 2rpx;
background-color: $color-tip;
}
.lineheight-clear {
line-height: 1 !important;
}
// 商品列表单列样式
.goods-list.single-column {
.goods-item {
padding: 26rpx;
background: #fff;
margin: $margin-updown $margin-both;
border-radius: $border-radius;
display: flex;
position: relative;
.goods-img {
width: 200rpx;
height: 200rpx;
overflow: hidden;
border-radius: $border-radius;
margin-right: 20rpx;
image {
width: 100%;
height: 100%;
}
}
.goods-tag {
color: #fff;
line-height: 1;
padding: 8rpx 12rpx;
position: absolute;
border-top-left-radius: $border-radius;
border-bottom-right-radius: $border-radius;
top: 26rpx;
left: 26rpx;
font-size: $font-size-goods-tag;
}
.goods-tag-img {
position: absolute;
border-top-left-radius: $border-radius;
width: 80rpx;
height: 80rpx;
top: 26rpx;
left: 26rpx;
z-index: 5;
overflow: hidden;
image {
width: 100%;
height: 100%;
}
}
.info-wrap {
flex: 1;
display: flex;
flex-direction: column;
}
.name-wrap {
flex: 1;
}
.goods-name {
font-size: $font-size-base;
line-height: 1.3;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
height: 68rpx;
}
.introduction {
line-height: 1;
margin-top: 10rpx;
}
.discount-price {
display: inline-block;
font-weight: bold;
line-height: 1;
margin-top: 16rpx;
color: var(--price-color);
.unit {
margin-right: 6rpx;
}
}
.pro-info {
display: flex;
margin-top: 16rpx;
.delete-price {
text-decoration: line-through;
flex: 1;
.unit {
margin-right: 6rpx;
}
}
&>view {
line-height: 1;
&:nth-child(2) {
text-align: right;
}
}
}
.member-price-tag {
display: inline-block;
width: 60rpx;
line-height: 1;
margin-left: 6rpx;
image {
width: 100%;
}
}
}
}
// 商品列表双列样式
.goods-list.double-column {
display: flex;
flex-wrap: wrap;
margin: 0 $margin-both;
padding-top: $margin-updown;
.goods-item {
flex: 1;
position: relative;
background-color: #fff;
flex-basis: 48%;
max-width: calc((100% - 30rpx) / 2);
margin: 0 $margin-both $margin-updown 0;
border-radius: $border-radius;
&:nth-child(2n) {
margin-right: 0;
}
.goods-img {
position: relative;
overflow: hidden;
padding-top: 100%;
border-top-left-radius: $border-radius;
border-top-right-radius: $border-radius;
image {
width: 100%;
position: absolute;
top: 50%;
left: 0;
transform: translateY(-50%);
}
}
.goods-tag {
color: #fff;
line-height: 1;
padding: 8rpx 16rpx;
position: absolute;
border-bottom-right-radius: $border-radius;
top: 0;
left: 0;
font-size: $font-size-goods-tag;
}
.goods-tag-img {
position: absolute;
border-top-left-radius: $border-radius;
width: 80rpx;
height: 80rpx;
top: 0;
left: 0;
z-index: 5;
overflow: hidden;
image {
width: 100%;
height: 100%;
}
}
.info-wrap {
padding: 0 26rpx 26rpx 26rpx;
}
.goods-name {
font-size: $font-size-base;
line-height: 1.3;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
margin-top: 20rpx;
height: 68rpx;
}
.discount-price {
display: inline-block;
font-weight: bold;
line-height: 1;
margin-top: 16rpx;
color: var(--price-color);
.unit {
margin-right: 6rpx;
}
}
.pro-info {
display: flex;
margin-top: 16rpx;
.delete-price {
text-decoration: line-through;
flex: 1;
.unit {
margin-right: 6rpx;
}
}
&>view {
line-height: 1;
&:nth-child(2) {
text-align: right;
}
}
}
.member-price-tag {
display: inline-block;
width: 60rpx;
line-height: 1;
margin-left: 6rpx;
image {
width: 100%;
}
}
}
}
</style>
<style lang="scss" scoped>
/deep/ .uni-tag--primary.uni-tag--inverted {
background-color: #f5f5f5 !important;
}
</style>

View File

@@ -0,0 +1,617 @@
<template>
<view class="conteiner" :style="themeColor">
<!-- #ifdef MP-WEIXIN -->
<view class="point-navbar"
:style="{ 'padding-top': menuButtonBounding.top + 'px', height: menuButtonBounding.height + 'px' }">
<view class="nav-wrap" :style="{ width: menuButtonBounding.left + 'px' }">
<view class="back" @click="back"
:style="{ width: menuButtonBounding.height + 'px', height: menuButtonBounding.height + 'px' }">
<text class="iconfont icon-back_light"></text>
</view>
<view class="search" @click="$util.redirectTo('/pages_tool/goods/search')">
<text class="iconfont icon-sousuo3"></text>
<text class="tips">搜索商品</text>
</view>
<view class="sign"
:style="{ width: menuButtonBounding.height + 'px', height: menuButtonBounding.height + 'px' }"
@click="redirect('/pages_tool/member/signin')">
<image :src="$util.img('public/uniapp/point/navbar-sing-icon.png')" mode="widthFix"></image>
</view>
</view>
</view>
<view class="point-navbar-block" :style="{ height: menuButtonBounding.bottom + 'px' }"></view>
<!-- #endif -->
<scroll-view scroll-y="true" class="point-scroll-view" @scrolltolower="getData">
<view class="point-wrap" :style="{ 'background-position-y': -menuButtonBounding.bottom + 'px' }">
<view class="head-box">
<view class="account-content">
<view class="left">
<image :src="$util.img('public/uniapp/point/point-icon.png')" mode="widthFix"></image>
<view>我的积分</view>
</view>
<view class="right">
<text class="point price-font">{{ point }}</text>
<text class="text">积分</text>
<!-- <text class="iconfont icon-right"></text> -->
</view>
</view>
<view class="remark">
<view class="label">提醒</view>
<view class="text">积分兑好礼每日上新换不停</view>
</view>
</view>
<!-- <view class="menu-wrap">
<view class="menu-list">
<view class="menu-item" @click="openPointPopup()">
<image :src="$util.img('/public/uniapp/point/point-rule.png')" class="menu-img"></image>
<image :src="$util.img('/public/uniapp/point/must-see.png')" class="menu-tag"></image>
<view class="title">活动规则</view>
</view>
<view class="menu-item" @click="redirect('/pages_tool/recharge/list')">
<image :src="$util.img('/public/uniapp/point/recharge.png')" class="menu-img"></image>
<image :src="$util.img('/public/uniapp/point/high.png')" class="menu-tag"></image>
<view class="title">储值赚积分</view>
</view>
<view class="menu-item" @click="redirect('/pages_promotion/point/order_list')">
<image :src="$util.img('/public/uniapp/point/exchange-record.png')" class="menu-img"></image>
<view class="title">兑换记录</view>
</view>
<view class="menu-item" @click="luckdraw">
<image :src="$util.img('/public/uniapp/point/luck-draw.png')" class="menu-img"></image>
<view class="title">积分抽奖</view>
</view>
<view class="menu-item" @click="redirect('/pages_tool/member/point_detail')">
<image :src="$util.img('/public/uniapp/point/point-detail.png')" class="menu-img"></image>
<view class="title">积分明细</view>
</view>
</view>
</view> -->
<!--
<view class="poster-wrap">
<view class="poster-item" @click="redirect('/pages_tool/recharge/list')">
<image :src="$util.img('/public/uniapp/point/recharge-poster.png')" mode="widthFix"></image>
</view>
<view class="poster-item" @click="luckdraw">
<image :src="$util.img('/public/uniapp/point/luck-draw-poster.png')" mode="widthFix"></image>
</view>
</view> -->
<view class="recharge-list-wrap" @click="redirect('/pages_tool/recharge/list')"
v-if="rechargeList.length">
<view class="item-wrap" v-for="(item, index) in rechargeList.slice(0, 4)" :key="index">
<view class="recharge">储值{{ parseFloat(item.buy_price) }}</view>
<view class="point">可得{{ item.point }}积分</view>
<view class="btn">去储值</view>
</view>
</view>
<view class="body-wrap" :class="{ 'no-login': !storeToken }">
<view class="point-exchange-wrap exchange-coupon" v-if="couponList.length > 0">
<view class="card-category-title">
<text class="before-line"></text>
<text>积分换券</text>
<text class="after-line"></text>
</view>
<view class="list-wrap">
<view class="list-wrap-scroll" :class="{ 'single-row': couponList.length < 3 }">
<view class="list-wrap-item coupon-list-wrap-item"
v-for="(couponItem, couponIndex) in couponList" :key="couponIndex"
@click="toDetail(couponItem)">
<view class="img-box">
<image
:src="$util.img('public/uniapp/point/coupon_' + themeStyle.name + '_bg1.png')" />
</view>
<view class="content">
<view class="coupon"
:style="{ backgroundImage: 'url(' + $util.img('public/uniapp/point/coupon_theme-blue_bg1.jpg') + ')' }">
<view class="coupon_left color-line-border">
<view class="price price-font">
<block v-if="couponItem.coupon_type == 'reward'">
<text></text>
{{ parseFloat(couponItem.money) }}
</block>
<block v-if="couponItem.coupon_type == 'discount'">
<block v-if="couponItem.coupon_type == 'discount'">
{{ parseFloat(couponItem.discount) }}<text></text>
</block>
</block>
</view>
<view class="coupon-info">
<view class="coupon_condition font-size-activity-tag">
{{ couponItem.at_least == 0 ? '无门槛优惠券' : '满' +
parseFloat(couponItem.at_least).toFixed(0) + '可用' }}
</view>
<view class="coupon_type font-size-activity-tag"
v-if="couponItem.goods_type == 1">全场券</view>
<view class="coupon_type font-size-activity-tag"
v-else-if="couponItem.goods_type == 2 || couponItem.goods_type == 3">
指定券</view>
</view>
</view>
<view class="coupon_right">
<view class="coupon_num font-size-tag">{{ couponItem.point }}积分</view>
<view class="coupon_btn">兑换</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="point-exchange-wrap exchange-hongbao" v-if="hongbaoList.length > 0">
<view class="card-category-title">
<text class="before-line"></text>
<text>积分换红包</text>
<text class="after-line"></text>
</view>
<view class="list-wrap">
<view class="list-wrap-item hongbao-list-wrap-item"
v-for="(hongbaoItem, hongbaoIndex) in hongbaoList" :key="hongbaoIndex"
@click="toDetail(hongbaoItem)">
<view class="img-box">
<image :src="$util.img('public/uniapp/point/hongbao_bg.png')"></image>
</view>
<view class="content">
<view class="coupon hongbao">
<view class="coupon_left">
<view class="price price-font">
<text></text>
{{ parseFloat(hongbaoItem.balance).toFixed(0) }}
</view>
<!-- <view class="coupon_condition font-size-activity-tag">{{ hongbaoItem.name }}</view> -->
</view>
<view class="coupon_right">
<view class="coupon_num font-size-tag">{{ hongbaoItem.point }}积分</view>
<view class="coupon_btn">兑换</view>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="point-exchange-wrap" v-if="goodsList.length > 0">
<view class="card-category-title">
<text class="before-line"></text>
<text>积分换礼品</text>
<text class="after-line"></text>
</view>
<view class="list-wrap">
<view class="goods-list double-column" v-if="goodsList.length">
<view class="goods-item " v-for="(item, index) in goodsList" :key="index">
<view class="goods-img" @click="toDetail(item)">
<image :src="goodsImg(item)" mode="widthFix" @error="imgError(index)"></image>
</view>
<view class="info-wrap">
<view class="name-wrap">
<view class="goods-name" @click="toDetail(item)">{{ item.name }}</view>
</view>
<view class="lineheight-clear">
<view class="discount-price">
<view>
<text class="unit price-font point">{{ item.point }}</text>
<text class="unit font-size-tag ">积分</text>
</view>
<block v-if="item.price > 0 && item.pay_type > 0">
<text class="unit font-size-tag">+</text>
<view>
<text class="font-size-tag">{{
parseFloat(item.price).toFixed(2).split(".")[0] }}</text>
<text class="unit font-size-tag">.{{
parseFloat(item.price).toFixed(2).split(".")[1] }}</text>
</view>
</block>
</view>
<view class="btn" @click="toDetail(item)">兑换</view>
</view>
<view class="pro-info" v-if="item.stock_show || item.sale_show">
<view class="font-size-activity-tag color-tip" v-if="item.stock_show">
库存:{{ isNaN(parseInt(item.stock)) ? 0 : parseInt(item.stock) }}</view>
<view class="font-size-activity-tag color-tip sale" v-if="item.sale_show">
已兑:{{ isNaN(parseInt(item.sale_num)) ? 0 : parseInt(item.sale_num) }}
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</scroll-view>
<!-- 弹出规则 -->
<view @touchmove.prevent.stop>
<uni-popup ref="pointPopup" type="bottom">
<view class="tips-layer">
<view class="head" @click="closePointPopup()">
<view class="title">{{ isEnEnv ? 'Integral Description' : '积分说明' }}</view>
<text class="iconfont icon-close"></text>
</view>
<view class="body">
<view class="detail margin-bottom">
<view class="tip">{{ isEnEnv ? 'Integral Acquisition' : '积分的获取' }}</view>
<view class="font-size-base">1积分可在注册签到分享消费充值时获得</view>
<view class="font-size-base">2在购买部分商品时可获得积分</view>
<view class="tip">{{ isEnEnv ? 'Integral Use' : '积分的使用' }}</view>
<view class="font-size-base">1积分可用于兑换积分中心的商品</view>
<view class="font-size-base">2积分可在参与某些活动时使用</view>
<view class="font-size-base">3积分不得转让出售不设有效期</view>
<view class="tip">{{ isEnEnv ? 'Integral Query' : '积分的查询' }}</view>
<view class="font-size-base">1积分可在会员中心中查询具体数额以及明细</view>
</view>
</view>
</view>
</uni-popup>
</view>
<loading-cover ref="loadingCover"></loading-cover>
<ns-login ref="login"></ns-login>
<!-- #ifdef MP-WEIXIN -->
<!-- 小程序隐私协议 -->
<privacy-popup ref="privacyPopup"></privacy-popup>
<!-- #endif -->
</view>
</template>
<script>
export default {
components: {
uniPopup: () => import('@/components/uni-popup/uni-popup.vue'),
nsSelectTime: () => import('@/components/ns-select-time/ns-select-time.vue'),
nsLogin: () => import('@/components/ns-login/ns-login.vue'),
MescrollUni: () => import('@/components/mescroll/my-list-mescroll.vue'),
loadingCover: () => import('@/components/loading-cover/loading-cover.vue'),
nsEmpty: () => import('@/components/ns-empty/ns-empty.vue'),
nsPayment: () => import('@/components/payment/payment.vue'),
// #ifdef MP-WEIXIN
privacyPopup: () => import('@/components/wx-privacy-popup/privacy-popup.vue'),
// #endif
},
data() {
return {
mescroll: {
num: 0,
total: 1,
loading: false
},
categoryList: [{
id: 1,
name: '积分换好物'
},
{
id: 2,
name: '积分换券'
},
{
id: 3,
name: '积分换红包'
}
],
isLogin: false,
goodsList: [],
couponList: [],
hongbaoList: [],
point: 0,
signState: 1, // 签到是否开启
mpShareData: null, //小程序分享数据
menuButtonBounding: {
bottom: 0
},
rechargeList: [], //充值套餐
newestGame: null
};
},
onLoad(option) {
setTimeout(() => {
if (!this.addonIsExist.pointexchange) {
this.$util.showToast({
title: '商家未开启积分商城',
mask: true,
duration: 2000
});
setTimeout(() => {
this.$util.redirectTo('/pages/index/index');
}, 2000);
}
}, 1000);
// #ifdef MP-WEIXIN
this.menuButtonBounding = uni.getMenuButtonBoundingClientRect();
// #endif
//小程序分享接收source_member
if (option.source_member) {
uni.setStorageSync('source_member', option.source_member);
}
// 小程序扫码进入接收source_member
if (option.scene) {
var sceneParams = decodeURIComponent(option.scene);
sceneParams = sceneParams.split('&');
if (sceneParams.length) {
sceneParams.forEach(item => {
if (item.indexOf('sku_id') != -1) this.skuId = item.split('-')[1];
if (item.indexOf('m') != -1) uni.setStorageSync('source_member', item.split('-')[1]);
if (item.indexOf('is_test') != -1) uni.setStorageSync('is_test', 1);
});
}
}
this.getData();
this.getRechargeList();
this.getNewestGame();
},
onShow() {
//记录分享关系
if (this.storeToken && uni.getStorageSync('source_member')) {
this.$util.onSourceMember(uni.getStorageSync('source_member'));
}
//小程序分享
// #ifdef MP-WEIXIN
this.$util.getMpShare().then(res => {
this.mpShareData = res;
});
// #endif
if (this.storeToken) this.getAccountInfo();
this.getCouponList();
this.getHongbaoList();
// this.getSignState();
},
methods: {
// 签到是否开启
getSignState() {
this.$api.sendRequest({
url: '/api/membersignin/getSignStatus',
success: res => {
if (res.code == 0) {
this.signState = res.data.is_use;
}
}
});
},
jumpPage(url) {
this.$util.redirectTo(url);
},
// 打开积分说明弹出层
openPointPopup() {
this.$refs.pointPopup.open();
},
// 打开积分说明弹出层
closePointPopup() {
this.$refs.pointPopup.close();
},
// 优惠券
getCouponList() {
this.$api.sendRequest({
url: '/pointexchange/api/goods/page',
data: {
page_size: 0,
type: 2
},
success: res => {
if (res.code == 0 && res.data) {
this.couponList = res.data.list;
} else {
this.$util.showToast({
title: res.message
});
}
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
},
fail() {
//联网失败的回调
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
}
});
},
// 红包
getHongbaoList() {
this.$api.sendRequest({
url: '/pointexchange/api/goods/page',
data: {
page_size: 0,
type: 3
},
success: res => {
if (res.code == 0 && res.data) {
this.hongbaoList = res.data.list;
} else {
this.$util.showToast({
title: res.message
});
}
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
},
fail() {
//联网失败的回调
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
}
});
},
//获取积分商品详情
getData() {
if (this.mescroll.loading || this.mescroll.num >= this.mescroll.total) return;
this.mescroll.loading = true;
this.$api.sendRequest({
url: '/pointexchange/api/goods/page',
data: {
page: this.mescroll.num + 1,
page_size: 10,
type: 1
},
success: res => {
let newArr = [];
let msg = res.message;
if (res.code == 0 && res.data) {
newArr = res.data.list;
} else {
this.$util.showToast({
title: msg
});
}
//设置列表数据
this.mescroll.loading = false;
this.mescroll.total = res.data.page_count;
this.mescroll.num += 1;
if (this.mescroll.num == 1) this.goodsList = []; //如果是第一页需手动制空列表
this.goodsList = this.goodsList.concat(newArr); //追加新数据
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
},
fail() {
this.mescroll.loading = false;
//联网失败的回调
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
}
});
},
//跳转至详情页面
toDetail(item) {
this.$util.redirectTo('/pages_promotion/point/detail', {
id: item.id
});
},
goGoodsList() {
this.$util.redirectTo('/pages_promotion/point/goods_list');
},
//获取个人
getAccountInfo() {
this.$api.sendRequest({
url: '/api/memberaccount/info',
data: {
account_type: 'point'
},
success: res => {
if (res.code == 0 && res.data) {
if (!isNaN(parseFloat(res.data.point))) {
this.point = parseFloat(res.data.point).toFixed(0);
}
} else {
this.$util.showToast({
title: res.message
});
}
}
});
},
//跳转至登录页面
login() {
this.$refs.login.open('/pages_promotion/point/list');
},
imgError(index) {
this.goodsList[index].image = this.$util.getDefaultImage().goods;
this.$forceUpdate();
},
goodsImg(data) {
let img = '';
switch (data.type) {
case 1:
img = this.$util.img(data.image.split(',')[0], {
size: 'mid'
});
break;
case 2:
img = data.image ? this.$util.img(data.image) : this.$util.img(
'public/uniapp/point/coupon.png');
break;
case 3:
img = data.image ? this.$util.img(data.image) : this.$util.img(
'public/uniapp/point/hongbao.png');
break;
}
return img;
},
/**
* 跳转
* @param {Object} url
*/
redirect(url) {
if (!this.storeToken) {
this.$refs.login.open(url);
} else {
this.$util.redirectTo(url);
}
},
getRechargeList() {
this.$api.sendRequest({
url: '/memberrecharge/api/memberrecharge/page',
data: {
page_size: 100,
page: 1
},
success: res => {
if (res.code == 0 && res.data) {
let rechargeList = [];
res.data.list.forEach(item => {
if (item.point > 0) rechargeList.push(item)
});
this.rechargeList = rechargeList;
}
}
})
},
back() {
if (getCurrentPages().length > 1) uni.navigateBack({
delta: 1
});
else this.$util.redirectTo('/pages/index/index');
},
getNewestGame() {
this.$api.sendRequest({
url: '/api/game/newestgame',
success: res => {
if (res.code == 0 && res.data) this.newestGame = res.data;
}
})
},
luckdraw() {
if (this.newestGame) {
switch (this.newestGame.game_type) {
case 'cards':
this.$util.redirectTo('/pages_promotion/game/cards', {
id: this.newestGame.game_id
});
break;
case 'egg':
this.$util.redirectTo('/pages_promotion/game/smash_eggs', {
id: this.newestGame.game_id
});
break;
case 'turntable':
this.$util.redirectTo('/pages_promotion/game/turntable', {
id: this.newestGame.game_id
});
break;
}
} else {
this.$util.showToast({
title: '暂无相关活动'
});
}
}
},
//分享给好友
onShareAppMessage() {
return this.mpShareData.appMessage;
},
//分享到朋友圈
onShareTimeline() {
return this.mpShareData.timeLine;
}
};
</script>
<style lang="scss">
@import '@/pages_promotion/point/public/css/list.scss';
</style>
<style>
.ns-adv>>>image {
width: 100%;
border-radius: 0;
}
</style>