From 7b9479d56cc48801f6703cd4d4d95f3167c1a8fe Mon Sep 17 00:00:00 2001
From: ghusermoon <2673031505@qq.com>
Date: Fri, 17 Jul 2020 17:34:42 +0800
Subject: [PATCH] coupon
---
common/api/shop.js | 35 ++++--
components/mine/coupon/index.vue | 35 +++---
components/shop/list/index.vue | 78 ++++++++-----
components/shop/recommend/index.vue | 6 +-
components/shop/youhq/index.vue | 175 ++++++++++++++++++----------
components/shop/youhq/item.vue | 83 -------------
pageE/mine/MemberServe.vue | 15 ++-
pageE/mine/MemberServeCoupon.vue | 69 +++++------
pageE/tool/MineCoupon.vue | 49 ++++----
pages/shop/index.vue | 54 +++++----
10 files changed, 308 insertions(+), 291 deletions(-)
delete mode 100644 components/shop/youhq/item.vue
diff --git a/common/api/shop.js b/common/api/shop.js
index 98611b8..34f4a3a 100644
--- a/common/api/shop.js
+++ b/common/api/shop.js
@@ -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,
});
}
}
diff --git a/components/mine/coupon/index.vue b/components/mine/coupon/index.vue
index 3448072..01f2aa5 100644
--- a/components/mine/coupon/index.vue
+++ b/components/mine/coupon/index.vue
@@ -1,24 +1,24 @@
-
+
- {{ couponInfo.index&1 ? '店铺优惠券' : '平台优惠券' }}
+ {{ couponInfo.type == 2 ? '店铺优惠券' : '平台优惠券' }}
- ¥10
- 满100使用
+ ¥{{ couponInfo.vouchertemplate_price }}
+ 满{{ couponInfo.vouchertemplate_limit }}使用
- 仅限 nike官方旗舰店 鞋子商品使用
- 兑换积分:200积分
- 有效期2018.09.06-2018.10.06
+ 仅限{{ couponInfo.vouchertemplate_storename }}鞋子商品使用
+ 兑换积分:{{ couponInfo.vouchertemplate_points }}积分
+ 有效期{{ couponInfo.vouchertemplate_startdate }}-{{ couponInfo.vouchertemplate_enddate }}
- 立即兑换
+ 立即兑换
立即使用
-
-
+
+
@@ -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);
},
},
};
diff --git a/components/shop/list/index.vue b/components/shop/list/index.vue
index 2e76629..843ba8c 100644
--- a/components/shop/list/index.vue
+++ b/components/shop/list/index.vue
@@ -3,25 +3,25 @@
商品推荐
-
+
+
+
-
-
+
+
-
+
+
- -->
+
\ No newline at end of file
diff --git a/components/shop/youhq/item.vue b/components/shop/youhq/item.vue
deleted file mode 100644
index f9a6923..0000000
--- a/components/shop/youhq/item.vue
+++ /dev/null
@@ -1,83 +0,0 @@
-
-
-
-
- ¥
- 12
-
-
-
-
-
-
- 立即
领取
-
-
-
- 使用时间:2020.01.24-2020.05.08
-
-
-
-
-
\ No newline at end of file
diff --git a/pageE/mine/MemberServe.vue b/pageE/mine/MemberServe.vue
index af082c6..39a3303 100644
--- a/pageE/mine/MemberServe.vue
+++ b/pageE/mine/MemberServe.vue
@@ -37,11 +37,11 @@
- {{ item.pl_desc }}
+ {{ item.pl_desc }}
{{ item.pl_addtime }}
-
- {{ item.pl_addtime > 0 ? item.pl_addtime : '+' + 10.00 }}
+
+ {{ Number(item.pl_points) > 0 ? '+' + item.pl_points : item.pl_points }}
@@ -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;
diff --git a/pageE/mine/MemberServeCoupon.vue b/pageE/mine/MemberServeCoupon.vue
index 796aad4..4ca97f4 100644
--- a/pageE/mine/MemberServeCoupon.vue
+++ b/pageE/mine/MemberServeCoupon.vue
@@ -1,6 +1,6 @@
-
+
@@ -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);
diff --git a/pageE/tool/MineCoupon.vue b/pageE/tool/MineCoupon.vue
index 724cd48..b98d078 100644
--- a/pageE/tool/MineCoupon.vue
+++ b/pageE/tool/MineCoupon.vue
@@ -4,7 +4,7 @@
-
+
@@ -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);
},
diff --git a/pages/shop/index.vue b/pages/shop/index.vue
index 2194c5b..e9e6e06 100644
--- a/pages/shop/index.vue
+++ b/pages/shop/index.vue
@@ -38,16 +38,16 @@
-
+
-
-
+
+
-
+
@@ -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) {