feat:优惠券
This commit is contained in:
+178
-101
@@ -1,29 +1,39 @@
|
||||
<template>
|
||||
<view class="content">
|
||||
<TopSafe></TopSafe>
|
||||
<Header title="兑换券专区" >
|
||||
<Header :isBack="false">
|
||||
<!-- #ifndef MP-WEIXIN -->
|
||||
<template v-slot:right>
|
||||
<u-icon name="share-fill" @click="onShare" color="#333" size="24"></u-icon>
|
||||
</template>
|
||||
<template v-slot:left>
|
||||
<u-icon size="36rpx" name="arrow-left" color="#000" @click="goback"></u-icon>
|
||||
抵扣券专区: {{ balanceData.curAmount || 0 }}
|
||||
</template>
|
||||
<!-- #endif -->
|
||||
</Header>
|
||||
<view class="swiper-view">
|
||||
<up-swiper
|
||||
:list="swiperList"
|
||||
style="width:100%"
|
||||
circular
|
||||
></up-swiper>
|
||||
<view :class="['swiper-item', { 'active': currentItem === item.key }]" v-for="(item, index) in swiperList"
|
||||
:key="index" @click="onClickItem(item)">
|
||||
<view class="swiper-item-content">{{ item.label }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="mid-panel">
|
||||
<up-image src="/static/common/jingxuan_left.png" width="24" height="8" bgColor="#f1f6ff00"></up-image>
|
||||
<view style="margin:0 12rpx">信任桥兑换</view>
|
||||
<up-image src="/static/common/jingxuan_right.png" width="24" height="8" bgColor="#f1f6ff00"></up-image>
|
||||
</view>
|
||||
<view class="setting-view">
|
||||
<FenItem @ok="onJumpShop" style="margin-top:24rpx" :obj="item" v-for="(item,index) in dataList" :key="index"></FenItem>
|
||||
<view class="name-box">
|
||||
<mescroll-uni ref="mescrollRef" @down="downCallback" @up="upCallback" :up="upOption" :down="downOption"
|
||||
@init="mescrollInit" :fixed="false">
|
||||
|
||||
<!-- 原来单个 v-for 替换成两列 -->
|
||||
<view class="mescrollUniView">
|
||||
<view class="fall-col">
|
||||
<PingItem v-for="(item, i) in leftList" :key="item.id" :obj="item" @ok="onJumpShop"
|
||||
style="margin-top: 24rpx" />
|
||||
</view>
|
||||
<view class="fall-col">
|
||||
<PingItem v-for="(item, i) in rightList" :key="item.id" :obj="item" @ok="onJumpShop"
|
||||
style="margin-top: 24rpx" />
|
||||
</view>
|
||||
</view>
|
||||
</mescroll-uni>
|
||||
</view>
|
||||
|
||||
<up-toast ref="uToastRef"></up-toast>
|
||||
</view>
|
||||
</template>
|
||||
@@ -32,139 +42,206 @@
|
||||
import Header from '@/components/common/header.vue';
|
||||
import TopSafe from '@/components/common/top-safe.nvue'
|
||||
import MyBtn from '@/components/common/my-btn.vue'
|
||||
import FenItem from '@/components/shop/fen-item.vue'
|
||||
import { searchList } from '@/api/product.js';
|
||||
import { getCarouselImage } from '@/api/common.js';
|
||||
import { getAcctBalance } from "@/api/finance.js";
|
||||
|
||||
import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
|
||||
import MescrollUni from "@/components/mescroll-uni/mescroll-uni.vue";
|
||||
import PingItem from "@/components/shop/ping-item.vue";
|
||||
|
||||
export default {
|
||||
components: { Header, TopSafe,MyBtn,FenItem },
|
||||
mixins: [MescrollMixin],
|
||||
components: { Header, TopSafe, MyBtn, PingItem, MescrollUni, },
|
||||
data() {
|
||||
return {
|
||||
dataList:[],
|
||||
swiperList: ['https://cdn.uviewui.com/uview/swiper/swiper1.png'],
|
||||
dataList: [],
|
||||
swiperList: [
|
||||
{ key: 0, label: '全部', minDeduction: 0, maxDeduction: 999999 },
|
||||
{ key: 1, label: '<300积分', minDeduction: 0, maxDeduction: 299.99 },
|
||||
{ key: 2, label: '300-500积分', minDeduction: 300, maxDeduction: 499.99 },
|
||||
{ key: 3, label: '500-1000积分', minDeduction: 500, maxDeduction: 999.99 },
|
||||
{ key: 4, label: '>1000积分', minDeduction: 1000, maxDeduction: 999999 },
|
||||
],
|
||||
currentItem: 0,
|
||||
downOption: {
|
||||
auto: false,
|
||||
textColor: "#333",
|
||||
bgColor: "rgba(0,0,0,0)",
|
||||
},
|
||||
upOption: {
|
||||
auto: false,
|
||||
page: {
|
||||
size: 10,
|
||||
},
|
||||
noMoreSize: 10,
|
||||
empty: {
|
||||
tip: `空空如也`,
|
||||
},
|
||||
textColor: "#333",
|
||||
bgColor: "rgba(0,0,0,0)",
|
||||
},
|
||||
leftList: [],
|
||||
rightList: [],
|
||||
mescroll: null,
|
||||
balanceData: {},
|
||||
};
|
||||
},
|
||||
onShow() {
|
||||
},
|
||||
onLoad() {
|
||||
this.init();
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
this.getSearchList();
|
||||
this.getCarouselImage();
|
||||
this.getAcctBalance();
|
||||
},
|
||||
async getCarouselImage(){
|
||||
const params={
|
||||
pageUi:6,
|
||||
}
|
||||
const resp = await getCarouselImage(params);
|
||||
if(resp && resp.bizcode === 100){
|
||||
const data = resp.data || [];
|
||||
this.swiperList = data.length !== 0 ? data.map(obj=>obj.carouselImage) : [];
|
||||
async getAcctBalance() {
|
||||
const resp = await getAcctBalance();
|
||||
let data = [];
|
||||
if (resp && resp.bizcode === 100) {
|
||||
data = resp.data || [];
|
||||
}
|
||||
this.balanceData = data.filter(item => item.categoty === 'vcoin')[0] || {};
|
||||
},
|
||||
async getSearchList(){
|
||||
|
||||
onClickItem(item) {
|
||||
this.currentItem = item.key;
|
||||
this.getSearchList(item);
|
||||
},
|
||||
|
||||
mescrollInit(mescroll) {
|
||||
this.mescroll = mescroll;
|
||||
},
|
||||
upCallback(page) {
|
||||
let currentSwiperItem = this.swiperList.find(item => item.key === this.currentItem) || {};
|
||||
|
||||
let params = {
|
||||
type: -1,
|
||||
page: page.num,
|
||||
pageSize: page.size,
|
||||
minDeduction: currentSwiperItem.minDeduction || 0,
|
||||
maxDeduction: currentSwiperItem.maxDeduction || 999999,
|
||||
};
|
||||
searchList(params).then((res) => {
|
||||
let curPageLen = res.data.length;
|
||||
if (page.num === 1) this.dataList = [];
|
||||
this.dataList = this.dataList.concat(res.data);
|
||||
|
||||
this.waterfall();
|
||||
this.mescroll.endBySize(curPageLen, res.total);
|
||||
});
|
||||
},
|
||||
downCallback() {
|
||||
this.$nextTick(() => {
|
||||
this.mescroll && this.mescroll.resetUpScroll();
|
||||
});
|
||||
},
|
||||
|
||||
async getSearchList(item = {}) {
|
||||
const params = {
|
||||
type:3,
|
||||
page:1,
|
||||
pageSize:99,
|
||||
type: -1,
|
||||
page: 1,
|
||||
pageSize: 99,
|
||||
minDeduction: item.minDeduction || 0,
|
||||
maxDeduction: item.maxDeduction || 999999,
|
||||
}
|
||||
const resp = await searchList(params);
|
||||
if(resp && resp.bizcode === 100){
|
||||
if (resp && resp.bizcode === 100) {
|
||||
this.dataList = resp.data || [];
|
||||
this.waterfall();
|
||||
}
|
||||
},
|
||||
onJumpShop(id){
|
||||
|
||||
waterfall() {
|
||||
this.leftList = this.dataList
|
||||
.map((item, index) => {
|
||||
if (index % 2 == 0) return item;
|
||||
return null;
|
||||
})
|
||||
.filter(Boolean);
|
||||
this.rightList = this.dataList
|
||||
.map((item, index) => {
|
||||
if (index % 2 != 0) return item;
|
||||
return null;
|
||||
})
|
||||
.filter(Boolean);
|
||||
console.log(this.leftList, this.rightList);
|
||||
},
|
||||
onJumpShop(id) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/other_package/productInfo/productInfo?id='+id,
|
||||
url: '/pages/other_package/productInfo/productInfo?id=' + id + '&isPar=true&curAmount=' + this.balanceData.curAmount || 0,
|
||||
})
|
||||
},
|
||||
onShare(){
|
||||
onShare() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/other_package/invite_friends/invite_friends',
|
||||
url: '/pages/other_package/invite_friends/invite_friends',
|
||||
})
|
||||
},
|
||||
goback() {
|
||||
uni.navigateBack()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.bottom-btn{
|
||||
.bottom-btn {
|
||||
width: 100%;
|
||||
margin-bottom:92rpx;
|
||||
margin-bottom: 92rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 0 32rpx;
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
|
||||
|
||||
}
|
||||
.mid-panel{
|
||||
width:100%;
|
||||
|
||||
.swiper-view {
|
||||
width: 100%;
|
||||
height: 80rpx;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height:120rpx;
|
||||
min-height:120rpx;
|
||||
background: #FFFFFF;
|
||||
overflow-x: auto;
|
||||
white-space: nowrap;
|
||||
padding: 0 16rpx;
|
||||
box-sizing: border-box;
|
||||
|
||||
.swiper-item {
|
||||
padding: 0 16rpx;
|
||||
height: 100%;
|
||||
color: #666;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
box-sizing: border-box;
|
||||
|
||||
&.active {
|
||||
color: #7A35F6;
|
||||
border-bottom: 4rpx solid #7A35F6;
|
||||
}
|
||||
}
|
||||
}
|
||||
.swiper-view{
|
||||
width:100%;
|
||||
height:268rpx;
|
||||
min-height:268rpx;
|
||||
display: flex;
|
||||
}
|
||||
.setting-view {
|
||||
|
||||
.name-box {
|
||||
width: 100%;
|
||||
height: calc(100% - 88rpx - 268rpx - 156rpx - var(--status-bar-height));
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
overflow-y: auto;
|
||||
padding: 0 32rpx;
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
.name-box{
|
||||
width:100%;
|
||||
border-radius: 16rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: #fff;
|
||||
padding: 64rpx 32rpx;
|
||||
box-sizing: border-box;
|
||||
margin-top:24rpx;
|
||||
.mid-view{
|
||||
width:100%;
|
||||
padding: 40rpx 32rpx;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border:2rpx solid #eaeaea;
|
||||
border-radius: 16rpx;
|
||||
margin-top:48rpx;
|
||||
}
|
||||
.top-view{
|
||||
width:100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
.input-view{
|
||||
border-radius: 20rpx;
|
||||
margin-top:52rpx;
|
||||
width:100%;
|
||||
padding: 0 32rpx;
|
||||
min-height:104rpx;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
background-color: #f5f5f5;
|
||||
box-sizing: border-box;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.mescrollUniView {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
gap: 24rpx;
|
||||
|
||||
.fall-col {
|
||||
width: 332rpx;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user