Merge pull request 'coupon' (#67) from zhy into master

Reviewed-on: http://git.luyuan.tk/luyuan/deming/pulls/67
This commit is contained in:
hansu 2020-07-17 17:35:26 +08:00
commit 5c419e6710
10 changed files with 308 additions and 291 deletions

View File

@ -78,9 +78,10 @@ export default {
return vm.$u.post('Goods/getGoodsClassifyList');
},
// 商品推荐
getGoodsRecommend({page}){
getGoodsRecommend({page, gc_id}){
return vm.$u.post('Goods/getGoodsRecommend', {
page: page
page: page,
gc_id: gc_id,
});
},
// 购物车商品列表
@ -188,14 +189,25 @@ export default {
});
},
// 拼团列表
getPinTuanList() {
return vm.$u.post('Specialci/pintuanList');
getPinTuanList({ page, gc_id }) {
return vm.$u.post('Specialci/pintuanList', {
page: page,
gc_id: gc_id,
});
},
// 拼团商品详情
getPinTuanDetails({ pintuan_id }) {
return vm.$u.post('Specialci/pintuanInfo', { pintuan_id: pintuan_id });
},
// 优惠券列表
// pintuanPush
getPinTuanPush() {
return vm.$u.post('Specialci/pintuanPush');
},
// 商品分类(拼团分类)
getGoodsClass() {
return vm.$u.post('Specialci/goodsClass');
},
// 优惠券列表(要兑换的)
getCouponList({ page, store_id, type, gc_id }) {
return vm.$u.post('Coupon/CouponList', {
page: page,
@ -205,9 +217,18 @@ export default {
});
},
// 领取优惠券
getCoupon({ vouchertemplate_id }) {
getCoupon({ id }) {
return vm.$u.post('Coupon/getCoupon', {
vouchertemplate_id: vouchertemplate_id,
vouchertemplate_id: id,
});
},
// 我的优惠券(已有的)
getMemberCouponList({ store_id, gc_id, type, status }) {
return vm.$u.post('Coupon/getMemberCouponList', {
store_id: store_id,
gc_id: gc_id,
type: type,
status: status,
});
}
}

View File

@ -1,24 +1,24 @@
<template>
<view class="c-coupon">
<view :class="status == 0 ? 'coupon-usable' : 'coupon-unable'">
<view :class="type == 1 && status != 0 ? 'coupon-unable' : 'coupon-usable'">
<view class="info-type" :style="{ backgroundImage: 'url(' + (status == 0 ? '/static/image/mine/30.png' : '/static/image/mine/31.png') + ')', backgroundSize:'contain', backgroundRepeat: 'no-repeat' }">
<div class="wrap_left_top"></div>
{{ couponInfo.index&1 ? '店铺优惠券' : '平台优惠券' }}
{{ couponInfo.type == 2 ? '店铺优惠券' : '平台优惠券' }}
</view>
<view class="coupon-info">
<view class="info-usable">
<view class="price"><span>10</span></view>
<view class="condition">100使用</view>
<view class="price"><span>{{ couponInfo.vouchertemplate_price }}</span></view>
<view class="condition">{{ couponInfo.vouchertemplate_limit }}使用</view>
</view>
<view class="info-store u-line-1">仅限 nike官方旗舰店 鞋子商品使用</view>
<view class="info-integral">兑换积分200积分</view>
<view class="info-date">有效期2018.09.06-2018.10.06</view>
<view class="info-store u-line-1">仅限{{ couponInfo.vouchertemplate_storename }}鞋子商品使用</view>
<view class="info-integral">兑换积分{{ couponInfo.vouchertemplate_points }}积分</view>
<view class="info-date">有效期{{ couponInfo.vouchertemplate_startdate }}-{{ couponInfo.vouchertemplate_enddate }}</view>
</view>
<view class="coupon-btn">
<text v-if="type == 0 && status == 0" @click="exchange">立即兑换</text>
<text v-if="type == 0 && status == 0" @click="exchangeCoupon">立即兑换</text>
<text v-if="type == 1 && status == 0" @click="use">立即使用</text>
<image v-if="status == 1" src="/static/image/mine/28.png"></image>
<image v-if="status == 2" src="/static/image/mine/29.png"></image>
<image v-if="type == 1 && status == 1" src="/static/image/mine/28.png"></image>
<image v-if="type == 1 && status == 2" src="/static/image/mine/29.png"></image>
</view>
</view>
</view>
@ -27,7 +27,7 @@
/**
* coupon 优惠券
* @description 优惠券组件
* @property {Number} type 优惠券操作方式(兑换优惠券: 0 / 使用优惠券: 1)
* @property {Number} type 优惠券操作方式(可兑换的优惠券: 0 / 自己的优惠券: 1)
* @property {Object} coupon-info 优惠券信息
* @event {Function} exchange 兑换优惠券
* @event {Function} use 使用优惠券
@ -41,12 +41,21 @@ export default {
type: Number,
couponInfo: Object,
},
created() {
console.log(this.couponInfo);
},
methods: {
exchange() {
this.$emit('exchange', this.couponInfo.index);
this.$emit('exchange', this.couponInfo.vouchertemplate_id);
},
exchangeCoupon() {
this.$u.api.getCoupon({ id: this.couponInfo.vouchertemplate_id }).then(res => {
this.$u.toast(res.message);
if(res.errCode == 0) {}
})
},
use() {
this.$emit('use', this.couponInfo.index);
this.$emit('use', this.couponInfo.vouchertemplate_id);
},
},
};

View File

@ -3,25 +3,25 @@
<view class="top">
商品推荐
</view>
<view class="label">
<!-- <view class="label">
<text v-for="item in classifyList" :key="item.gc_id">{{ item.gc_name }}</text>
</view>
<view class="item">
<item v-for="item in goodsList" :key="item.goods_id" :info="item"></item>
</view>
<!-- <view>
<u-tabs-swiper ref="uTabs" :list="tabList" :current="current" @change="tabsChange" :is-scroll="false"
swiperWidth="750" height="60"></u-tabs-swiper>
</view> -->
<view>
<u-tabs-swiper ref="uTabs" :list="classifyList" name="gc_name" :is-scroll="true" active-color="#FF780F" :current="current" font-size="24" :show-bar="false" @change="tabsChange" height="60" ></u-tabs-swiper>
</view>
<swiper :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish" >
<swiper-item class="swiper-item" v-for="(_, index) in tabList" :key="index">
<scroll-view scroll-y style="height: 800rpx;width: 100%;">
<swiper-item class="swiper-item" v-for="(_, index) in classifyList" :key="index">
<!-- <scroll-view scroll-y style="height: 800rpx;width: 100%;"> -->
<view class="item">
<item v-for="item in goodsList" :key="item.goods_id" :info="item"></item>
</view>
</scroll-view>
<u-empty text="暂无商品" mode="list" color="#000" v-if="!goodsList.length"></u-empty>
<!-- </scroll-view> -->
</swiper-item>
</swiper> -->
</swiper>
</view>
</template>
<script>
@ -30,21 +30,39 @@ export default {
name:"list",
data() {
return {
tabList: [{name: '推荐'}, {name: '推荐'}, {name: '推荐'}],
tabList: [],
current: 0,
current: Number,
swiperCurrent: 0,
goodsList: [],
}
},
components:{
item
},
props: {
classifyList: Array,
goodsList: Array,
classifyList: Array
},
watch: {
current(index) {
const id = this.classifyList[index].gc_id;
this.getGoodsRecommend(id);
}
},
created() {
this.current = 0;
console.log(this.classifyList);
},
methods: {
getGoodsRecommend(gc_id) {
this.$u.api.getGoodsRecommend({
page: 1,
gc_id: gc_id,
}).then((res)=>{
if (res.errCode == 0) {
this.goodsList = res.data.goodsList;
console.log(this.goodsList);
}
})
},
// tabsswiper
tabsChange(index) {
this.swiperCurrent = index;
@ -74,21 +92,21 @@ export default {
text-align: center;
color: #333;
}
.label{
display: flex;
color: #999;
flex-wrap: wrap;
>text{
margin-right: 34rpx;
margin-bottom: 10rpx;
}
}
.item{
display: flex;
flex-wrap: wrap;
justify-content: space-between;
margin-top: 20rpx;
// .label{
// display: flex;
// color: #999;
// flex-wrap: wrap;
// >text{
// margin-right: 34rpx;
// margin-bottom: 10rpx;
// }
// }
// .item{
// display: flex;
// flex-wrap: wrap;
// justify-content: space-between;
// margin-top: 20rpx;
}
// }
}
</style>

View File

@ -1,7 +1,7 @@
<template>
<view class="recommend">
<view class="top">
<text>今日秒杀推荐</text>
<text>{{ type == 'spike' ? '今日秒杀推荐' : '今日拼团推荐' }}</text>
<text>点击查看更多></text>
</view>
<view class="connect">
@ -10,7 +10,7 @@
<text>{{ info.groupbuy_starttime_histime }}</text>
</view>
<view class="info">
<text class="u-line-1">{{ info.groupbuy_name }}</text>
<text class="u-line-1">{{ type == 'spike' ? info.groupbuy_name : '' }}</text>
<text class="u-line-2">{{ info.goods_name }}</text>
<view>
<text>{{ info.groupbuy_price }}</text>

View File

@ -1,72 +1,119 @@
<template>
<view class="youhq">
<view class="coupon-swiper">
<view class="top">
<text>全部优惠券</text>
<text>查看更多></text>
<view class="title">全部优惠券</view>
<view class="view-more" @click="toCouponPage">查看更多></view>
</view>
<view class="label">
<text>sda</text>
<text>asda</text>
<text>dsad</text>
<text>asdas</text>
<u-tabs-swiper ref="coupon" :list="couponGroupList" name="gc_name" :is-scroll="true" active-color="#FF780F" :current="couponCurrent" font-size="24" :show-bar="false" @change="couponTabsChange" height="88" ></u-tabs-swiper>
<!-- :style="{ height: swiperHeight }" -->
<swiper :current="swiperCouponCurrent" @animationfinish="couponAnimationFinish">
<swiper-item class="swiper-coupon-item" v-for="(_, i) in couponGroupList" :key="i">
<!-- <scroll-view scroll-y style="height: 100%;"> -->
<view v-for="(coupon, index) in couponList.slice(0, 4)" :key="index" class="coupon-item">
<Coupon :couponInfo="coupon" :status='0' :type="0"></Coupon>
</view>
<scroll-view style="width:100%;margin-top: 21rpx;" scroll-x="true">
<view class="list">
<sitem></sitem>
<sitem></sitem>
<sitem></sitem>
<sitem></sitem>
<sitem></sitem>
</view>
</scroll-view>
<u-empty text="暂无优惠券" mode="coupon" color="#000" v-if="!couponList.length"></u-empty>
<!-- </scroll-view> -->
</swiper-item>
</swiper>
</view>
</template>
<script>
import sitem from "./item"
import Coupon from "@/components/mine/coupon/index";
export default {
name:"youhq",
components:{
sitem
},
data() {
return {
swiperHeight: '',
couponCurrent: 0,
swiperCouponCurrent: 0,
couponGroupList: [],
couponList: [],
}
},
components: {
Coupon
},
watch: {
couponCurrent(index) {
const id = this.couponGroupList[index].gc_id;
this.getCouponList(id);
}
},
created() {
this.setViewHeight();
this.getGoodsClass();
},
methods: {
getGoodsClass() {
this.$u.api.getGoodsClass().then(res => {
if(res.errCode == 0) {
this.couponGroupList = res.data;
this.getCouponList(this.couponGroupList[0].gc_id);
}
})
},
getCouponList(gc_id) {
this.$u.api.getCouponList({
page: 0,
gc_id: gc_id,
}).then(res => {
if(res.errCode == 0) {
this.couponList = res.data;
} else {
this.couponList = [];
}
})
},
couponTabsChange(index) {
this.couponCurrent = index;
},
couponAnimationFinish(e) {
const current = e.detail.current;
this.swiperCouponCurrent = current;
this.couponCurrent = current;
},
setViewHeight() {
const res = uni.getSystemInfoSync();
// this.swiperHeight = res.windowHeight - ((88 + 10 + 88) / 2) + 'px';
this.swiperHeight = '450px';
},
toCouponPage() {
this.$u.route({
url: '/pageE/mine/MemberServe',
params: {
current: 1
}
})
},
},
};
</script>
<style lang="scss" scoped>
.youhq{
.coupon-swiper {
.top {
height: 90rpx;
width: 100%;
padding-top: 30rpx;
display: flex;
align-items: center;
justify-content: space-between;
>text:first-child{
.title {
font-size: 30rpx;
color: #333;
font-weight: 500;
color: rgba(51,51,51,1);
}
>text:last-child{
.view-more {
font-size: 18rpx;
color: #999;
color: rgba(153,153,153,1);
}
}
.label{
display: flex;
font-size: 24rpx;
color: #999;
>text{
margin-right: 34rpx;
.swiper-coupon-item {
box-sizing: border-box;
background-color: #ffffff;
// padding: 30rpx {
// top: 0;
// };
.coupon-item {
margin-bottom: 20rpx;
}
}
.list{
display: flex;
// justify-content: space-between;
width: auto;
}
}
</style>

View File

@ -1,83 +0,0 @@
<template>
<view class="item">
<view class="top">
<view class="pic">
<text></text>
<text>12</text>
</view>
<view class="man">
<text></text>
<text></text>
</view>
<text class="button">
立即<br />领取
</text>
</view>
<view class="time">
使用时间2020.01.24-2020.05.08
</view>
</view>
</template>
<script>
export default {
name:"item"
}
</script>
<style lang="scss" scoped>
.item{
padding: 10rpx;
width: 254rpx;
height: 94rpx;
border: 2rpx solid #FDD360;
border-radius: 20rpx;
flex-shrink: 0;
margin-right: 16rpx;
.top{
display: flex;
align-items: center;
justify-content: space-between;
.pic{
display: flex;
align-items: flex-end;
color:#FDD360;
>text:first-child{
font-size: 24rpx;
}
>text:last-child{
font-size: 48rpx;
}
}
.man{
display: flex;
flex-direction: column;
align-items: center;
color: #FDD360;
>text:first-child{
font-size: 14rpx;
}
>text:last-child{
font-size: 18rpx;
font-weight: bold;
}
}
.button{
width: 61rpx;
height: 61rpx;
border-radius: 50%;
font-size: 18rpx;
background-color: #FDD360;
color: #fff;
display: flex;
align-items: center;
justify-content: center;
}
}
.time{
font-size: 12rpx;
color: #FDD360;
font-weight: bold;
}
}
</style>

View File

@ -37,11 +37,11 @@
<scroll-view scroll-y class="details">
<view v-for="(item, index) in pointslogList" :key="index" class="details-item">
<view class="item-left">
<view class="item-title">{{ item.pl_desc }}</view>
<view class="item-title u-line-1">{{ item.pl_desc }}</view>
<view class="item-date">{{ item.pl_addtime }}</view>
</view>
<view class="item-right" :class="[item.pl_addtime < 0 ? 'negative' : 'positive']">
{{ item.pl_addtime > 0 ? item.pl_addtime : '+' + 10.00 }}
<view class="item-right" :class="[item.pl_points < 0 ? 'negative' : 'positive']">
{{ Number(item.pl_points) > 0 ? '+' + item.pl_points : item.pl_points }}
</view>
</view>
<u-empty text="暂无明细" mode="data" color="#000" v-if="!pointslogList.length"></u-empty>
@ -75,6 +75,14 @@ export default {
components: {
CouponView
},
onLoad(option) {
if(option.current) this.current = option.current;
},
watch: {
current(value) {
this.swiperCurrent = value;
}
},
onShow() {
this.getMemberPointsStat();
this.getPointslogList();
@ -186,6 +194,7 @@ export default {
justify-content: space-between;
.item-left {
.item-title {
width: 450rpx;
font-size: 32rpx;
color: rgba(51,51,51,1);
margin-bottom: 23rpx;

View File

@ -1,6 +1,6 @@
<template>
<view class="coupon-swiper">
<u-tabs-swiper ref="coupon" :list="couponGroupList" :is-scroll="true" active-color="#FF780F" :current="couponCurrent" font-size="24" :show-bar="false" @change="couponTabsChange" height="88" ></u-tabs-swiper>
<u-tabs-swiper ref="coupon" :list="couponGroupList" name="gc_name" :is-scroll="true" active-color="#FF780F" :current="couponCurrent" font-size="24" :show-bar="false" @change="couponTabsChange" height="88" ></u-tabs-swiper>
<swiper :current="swiperCouponCurrent" @animationfinish="couponAnimationFinish" :style="{ height: swiperHeight }">
<swiper-item class="swiper-coupon-item" v-for="(_, i) in couponGroupList" :key="i">
<scroll-view scroll-y style="height: 100%;">
@ -31,43 +31,9 @@ export default {
swiperHeight: '',
couponCurrent: 0,
swiperCouponCurrent: 0,
couponGroupList: [
{
name: '平台'
}, {
name: '分类名称'
}, {
name: '分类名称'
}, {
name: '分类名称'
}, {
name: '分类名称'
}, {
name: '分类名称'
}, {
name: '分类名称'
}, {
name: '分类名称'
}, {
name: '分类名称'
}, {
name: '分类名称'
}, {
name: '分类名称'
}, {
name: '分类名称'
}, {
name: '分类名称'
}
],
couponList: [
{
index: 0
},
{
index: 1
},
],
couponGroupList: [],
couponList: [],
page: 0,
}
},
components: {
@ -75,8 +41,35 @@ export default {
},
created() {
this.setViewHeight();
this.getGoodsClass();
},
watch: {
couponCurrent(index) {
const id = this.couponGroupList[index].gc_id;
this.getCouponList({ gc_id: id });
}
},
methods: {
getGoodsClass() {
this.$u.api.getGoodsClass().then(res => {
if(res.errCode == 0) {
this.couponGroupList = res.data;
this.getCouponList(this.couponGroupList[0].gc_id);
}
})
},
getCouponList({ gc_id }) {
this.$u.api.getCouponList({
page: this.page,
gc_id: gc_id,
}).then(res => {
if(res.errCode == 0) {
this.couponList = res.data;
} else {
this.couponList = [];
}
})
},
exchangeCoupon(id) {
console.log(id);

View File

@ -4,7 +4,7 @@
<swiper :current="swiperCurrent" @animationfinish="animationfinish" :style="{ height: swiperHeight }">
<swiper-item class="swiper-item" v-for="(_, index) in list" :key="index">
<scroll-view scroll-y class="scroll-coupon">
<view class="coupon-item" v-for="(coupon, c_index) in test" :key="c_index">
<view class="coupon-item" v-for="(coupon, c_index) in couponList" :key="c_index">
<Coupon :couponInfo="coupon" :status='index' :type="1" @use="useCoupon($event)"></Coupon>
</view>
</scroll-view>
@ -24,35 +24,10 @@ export default {
}, {
name: '已过期'
}],
current: 0,
current: Number,
swiperCurrent: 0,
swiperHeight: '',
test: [
{
index: 0
},
{
index: 1
},
{
index: 2
},
{
index: 3
},
{
index: 4
},
{
index: 5
},
{
index: 6
},
{
index: 7
}
]
couponList: []
}
},
components: {
@ -61,7 +36,25 @@ export default {
onLoad() {
this.setViewHeight();
},
onShow() {
this.current = 0;
},
watch: {
current(value) {
let status = value + 1;
this.getMemberCouponList(status);
}
},
methods: {
getMemberCouponList(current) {
this.$u.api.getMemberCouponList({
status: current
}).then(res => {
if(res.errCode == 0) {
this.couponList = res.data;
}
})
},
useCoupon(id) {
console.log(id);
},

View File

@ -41,13 +41,13 @@
<view v-if="JSON.stringify(recommendedSpike) != '{}'" class="hr" style="margin-top:40rpx"></view>
<seckill v-if="spikeList.length" :list="spikeList" :time="seckillTime"></seckill>
<view v-if="spikeList.length" class="hr" style="margin-top:40rpx"></view>
<recommend v-if="0"></recommend>
<view class="hr" style="margin-top:40rpx" v-if="0"></view>
<recommend v-if="JSON.stringify(pinTuanPush) != '{}'" :recommendData="pinTuanPush" type='group'></recommend>
<view class="hr" style="margin-top:40rpx" v-if="JSON.stringify(pinTuanPush) != '{}'"></view>
<group></group>
<image class="lingquan"></image>
<youhq></youhq>
<view class="hr" style="margin-top:40rpx"></view>
<list :classifyList="classifyList" :goodsList="goodsList"></list>
<list v-if="couponGroupList.length" :classifyList="couponGroupList"></list>
<view class="cart" @click="toCartPage">
<image src="/static/image/common/3.png"></image>
</view>
@ -85,20 +85,22 @@ export default {
list:[],
goodsClassify: [], //
classifyList: [],
goodsList: [],
recommendedSpike: {}, //
spikeList: [], //
seckillTime: {}, //
couponGroupList: [], //
pinTuanList: [], //
pinTuanPush: {}, //
}
},
onLoad() {
this.getShopTopList();
this.getGoodsRecommend();
},
onShow() {
this.getRecommendedSpike();
this.getSpikeList();
this.getPinTuanList();
this.getGoodsClass();
this.getPinTuanPush();
},
methods: {
sousuo(){
@ -129,6 +131,23 @@ export default {
// console.log(this.recommendedSpike);
})
},
//
getPinTuanPush() {
this.$u.api.getPinTuanPush().then(res => {
if(res.errCode == 0) {
this.pinTuanPush = res.data;
}
})
},
//
getGoodsClass() {
this.$u.api.getGoodsClass().then(res => {
if(res.errCode == 0) {
this.couponGroupList = res.data;
this.getPinTuanList(this.couponGroupList[0].gc_id);
}
})
},
//
getSpikeList() {
this.$u.api.getSpikeList({ page: 0 }).then(res => {
@ -142,21 +161,12 @@ export default {
})
},
//
getPinTuanList() {
this.$u.api.getPinTuanList().then(res => {
})
},
getGoodsRecommend() {
this.$u.api.getGoodsRecommend({
page: 1,
}).then((res)=>{
if (res.errCode == 0) {
this.classifyList = res.data.classifyList;
this.goodsList = res.data.goodsList;
// console.log(this.classifyList);
}
getPinTuanList(id) {
this.$u.api.getPinTuanList({
page: 0,
gc_id: id,
}).then(res => {
this.pinTuanList = res.data;
})
},
clickImage(index) {