Merge branch 'master' of http://git.luyuan.tk/luyuan/deming into zmr

This commit is contained in:
zmr900709
2020-07-18 19:53:16 +08:00
13 changed files with 334 additions and 162 deletions

View File

@@ -223,7 +223,7 @@ export default {
article_id: this.item.article_id,
member_id: this.item.member_id,
}).then(res => {
console.log(res)
// console.log(res)
if(res.errCode == 0) {
this.$emit("getArticlelist");
}

View File

@@ -25,14 +25,14 @@
</view>
</view>
<view class="edit-btn" @click="confirmBtn">保存地址</view>
<!-- <u-select v-model="show"
<u-select v-model="show"
mode="mutil-column-auto"
:list="areaList"
value-name="area_id"
label-name="area_name"
child-name="_child"
@confirm="setArea">
</u-select> -->
</u-select>
<u-toast ref="uToast" />
</view>
</template>
@@ -58,7 +58,7 @@ export default {
this.getAreaData();
},
created() {
console.log(typeof this.info);
// console.log(this.info);
this.initAddressInfo();
},
methods: {

View File

@@ -1,7 +1,7 @@
<template>
<view class="c-coupon">
<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' }">
<view class="coupon-usable">
<view class="info-type" :style="{ backgroundImage: 'url(' + '/static/image/mine/30.png' + ')', backgroundSize:'contain', backgroundRepeat: 'no-repeat' }">
<div class="wrap_left_top"></div>
{{ couponInfo.type == 2 ? '店铺优惠券' : '平台优惠券' }}
</view>
@@ -10,15 +10,12 @@
<view class="price"><span>{{ couponInfo.vouchertemplate_price }}</span></view>
<view class="condition">{{ couponInfo.vouchertemplate_limit }}使用</view>
</view>
<view class="info-store u-line-1">仅限{{ couponInfo.vouchertemplate_storename }}鞋子商品使用</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="exchangeCoupon">立即兑换</text>
<text v-if="type == 1 && status == 0" @click="use">立即使用</text>
<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>
<text @click="exchangeCoupon">立即兑换</text>
</view>
</view>
</view>
@@ -27,10 +24,8 @@
/**
* coupon 优惠券
* @description 优惠券组件
* @property {Number} type 优惠券操作方式(可兑换的优惠券: 0 / 自己的优惠券: 1)
* @property {Object} coupon-info 优惠券信息
* @event {Function} exchange 兑换优惠券
* @event {Function} use 使用优惠券
*/
export default {
data() {
@@ -38,11 +33,10 @@ export default {
},
props: {
status: Number,
type: Number,
couponInfo: Object,
},
created() {
console.log(this.couponInfo);
// console.log(this.couponInfo);
},
methods: {
exchange() {
@@ -54,9 +48,6 @@ export default {
if(res.errCode == 0) {}
})
},
use() {
this.$emit('use', this.couponInfo.vouchertemplate_id);
},
},
};
</script>
@@ -123,6 +114,16 @@ export default {
font-size: 32rpx;
font-weight: 500;
color: rgba(255,255,255,1);
position: relative;
// 增大按钮点击范围
&::after {
content:"";
position: absolute;
top: -30rpx;
left: -40rpx;
width: 200rpx;
height: 100rpx;
}
}
> image {
width: 122rpx;

View File

@@ -0,0 +1,153 @@
<template>
<view class="c-coupon" v-if="goodsClass.length">
<view :class="couponInfo.voucher_state != 1 ? 'coupon-unable' : 'coupon-usable'">
<view class="info-type" :style="{ backgroundImage: 'url(' + (couponInfo.voucher_state == 1 ? '/static/image/mine/30.png' : '/static/image/mine/31.png') + ')', backgroundSize:'contain', backgroundRepeat: 'no-repeat' }">
<div class="wrap_left_top"></div>
{{ couponInfo.type == 2 ? '店铺优惠券' : '平台优惠券' }}
</view>
<view class="coupon-info">
<view class="info-usable">
<view class="price"><span>{{ couponInfo.voucher_price }}</span></view>
<view class="condition">{{ couponInfo.voucher_limit }}使用</view>
</view>
<view class="info-store u-line-1">仅限{{ couponInfo.type == 1 ? '平台' : couponInfo.store_name }}{{ couponInfo.gc_id | showClass(goodsClass) }}商品使用</view>
<view class="info-integral">兑换积分{{ couponInfo.voucher_points }}积分</view>
<view class="info-date">有效期{{ couponInfo.voucher_startdate }}-{{ couponInfo.voucher_enddate }}</view>
</view>
<view class="coupon-btn">
<text v-if="couponInfo.voucher_state == 1" @click="use">立即使用</text>
<image v-if="couponInfo.voucher_state == 2" src="/static/image/mine/28.png"></image>
<image v-if="couponInfo.voucher_state == 3" src="/static/image/mine/29.png"></image>
</view>
</view>
</view>
</template>
<script>
/**
* coupon 领取的优惠券 自己的优惠券
* @description 优惠券组件
* @property {Number} type 优惠券操作方式(可兑换的优惠券: 0 / 自己的优惠券: 1)
* @property {Object} coupon-info 优惠券信息
* @event {Function} use 使用优惠券
*/
export default {
data() {
return {}
},
props: {
status: Number,
type: Number,
couponInfo: Object,
goodsClass: Array,
},
created() {
// console.log(this.couponInfo);
// this.getGoodsClass();
},
filters: {
showClass(value, classList) {
const ids = classList.filter(element => {
return element.gc_id == value;
});
console.log(ids);
return ids.length ? ids[0].gc_name : '';
}
},
methods: {
exchange() {
this.$emit('exchange', this.couponInfo.vouchertemplate_id);
},
use() {
this.$emit('use', this.couponInfo);
},
},
};
</script>
<style lang="scss" scoped>
.c-coupon {
position: relative;
z-index: 9;
@mixin coupon-image($url) {
width: 690rpx;
height: 194rpx;
background: url($url) no-repeat left top / contain;
color: #FFFFFF;
.info-type {
width: 150rpx;
height: 30rpx;
line-height: 30rpx;
font-size: 20rpx;
border-radius: 10rpx 0rpx 10rpx 0rpx;
padding-left: 25rpx;
margin-bottom: 6rpx;
}
.coupon-info {
z-index: 10;
position: absolute;
top: 36rpx;
left: 0;
font-weight: 500;
padding-left: 20rpx;
width: 360rpx;
.info-usable{
margin-bottom: 6rpx;
display: flex;
align-items: center;
.price {
margin-right: 16rpx;
font-size: 40rpx;
> span {
font-size: 50rpx;
}
}
.condition {
font-size: 24rpx;
}
}
.info-store{
margin-bottom: 10rpx;
font-size: 22rpx;
}
.info-integral{
margin-bottom: 10rpx;
font-size: 22rpx;
}
.info-date{
font-size: 20rpx;
}
}
.coupon-btn {
z-index: 10;
position: absolute;
right: 60rpx;
top: 50%;
transform: translate(0, -50%);
> text {
font-size: 32rpx;
font-weight: 500;
color: rgba(255,255,255,1);
position: relative;
// 增大按钮点击范围
&::after {
content:"";
position: absolute;
top: -30rpx;
left: -40rpx;
width: 200rpx;
height: 100rpx;
}
}
> image {
width: 122rpx;
height: 122rpx;
}
}
}
.coupon-usable {
@include coupon-image('/static/image/mine/26.png');
}
.coupon-unable {
@include coupon-image('/static/image/mine/27.png');
}
}
</style>

View File

@@ -6,14 +6,13 @@
</view>
<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 :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%;"> -->
<view v-for="(coupon, index) in couponList.slice(0, 4)" :key="index" class="coupon-item">
<Coupon :couponInfo="coupon" :status='0' :type="0"></Coupon>
</view>
<u-empty text="暂无优惠券" mode="coupon" color="#000" v-if="!couponList.length"></u-empty>
<!-- </scroll-view> -->
<!-- 最多显示四个 -->
<view v-for="(coupon, index) in couponList.slice(0, 4)" :key="index" class="coupon-item">
<Coupon :couponInfo="coupon" :status='0' :type="0"></Coupon>
</view>
<u-empty text="暂无优惠券" mode="coupon" color="#000" v-if="!couponList.length"></u-empty>
</swiper-item>
</swiper>
</view>
@@ -40,7 +39,6 @@ export default {
}
},
created() {
this.setViewHeight();
this.getGoodsClass();
},
methods: {
@@ -62,6 +60,8 @@ export default {
} else {
this.couponList = [];
}
// 设置 swiper 高度
this.setViewHeight();
})
},
couponTabsChange(index) {
@@ -73,9 +73,9 @@ export default {
this.couponCurrent = current;
},
setViewHeight() {
const res = uni.getSystemInfoSync();
// this.swiperHeight = res.windowHeight - ((88 + 10 + 88) / 2) + 'px';
this.swiperHeight = '450px';
// 一个优惠券的高度 97px, 下距离 10px
const num = this.couponList.length;
this.swiperHeight = (97 + 10) * num - 10 + 'px';
},
toCouponPage() {
this.$u.route({