分享优惠券更新
This commit is contained in:
@@ -1,31 +1,31 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<view class="me" v-if="status == 'me'">
|
||||
<image class="topImg" mode="widthFix" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/InviteFriends/index_bg.png"></image>
|
||||
<view class="me" v-if="is_type == 'me'">
|
||||
<image class="topImg" mode="widthFix" :src="InviteFriendsData.invitedImg"></image>
|
||||
<view class="contentBox">
|
||||
<view class="content">
|
||||
<view class="title">邀请1人可得,双方各得10元优惠券</view>
|
||||
<view class="btn">邀请好友</view>
|
||||
<view class="title">{{InviteFriendsData.title}}</view>
|
||||
<button class="btn" open-type="share" @click="onShareAppMessage">邀请好友</button>
|
||||
<view class="label o">新用户获得</view>
|
||||
<view class="card">
|
||||
<view class="card" v-for="(item,index) in InviteFriendsData.newCoupons">
|
||||
<view class="left">
|
||||
<view class="num"><text>¥</text>10.00</view>
|
||||
<view class="mnum">满¥100.00可用</view>
|
||||
<view class="num"><text>¥</text>{{item.discountAmount}}</view>
|
||||
<view class="mnum">满¥{{item.fullAmount}}可用</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view class="rtitle">邀新10元优惠券×1张</view>
|
||||
<view class="time">领取后30天内有效</view>
|
||||
<view class="rtitle">{{item.couponName}}</view>
|
||||
<view class="time">{{item.useDetail}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="label t">每邀请1个用户可获得</view>
|
||||
<view class="card">
|
||||
<view class="label t">每邀请{{InviteFriendsData.invitedNum}}个用户可获得</view>
|
||||
<view class="card" v-for="(item,index) in InviteFriendsData.rewardCoupons">
|
||||
<view class="left">
|
||||
<view class="num"><text>¥</text>10.00</view>
|
||||
<view class="mnum">满¥100.00可用</view>
|
||||
<view class="num"><text>¥</text>{{item.discountAmount}}</view>
|
||||
<view class="mnum">满¥{{item.fullAmount}}可用</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view class="rtitle">邀新10元优惠券×1张</view>
|
||||
<view class="time">领取后30天内有效</view>
|
||||
<view class="rtitle">{{item.couponName}}</view>
|
||||
<view class="time">{{item.useDetail}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -38,34 +38,37 @@
|
||||
>{{item.label}}{{item.num||0}}人</view>
|
||||
</view>
|
||||
<view class="tabContent">
|
||||
<viwe class="tabContent_item">
|
||||
<viwe class="tabContent_item" v-for="(item,index) in shareRecordData.list" :key="index">
|
||||
<view class="top">
|
||||
<view class="name">草莓大福</view>
|
||||
<view class="status">草莓大福</view>
|
||||
<view class="name">{{item.invitedName}}</view>
|
||||
<view class="status" :style="{color: isSuccess ? '#333' : '#FF534B'}">{{
|
||||
isSuccess ? '邀请成功' : '未邀请成功'
|
||||
}}</view>
|
||||
</view>
|
||||
<view class="time">2023-22-33 17:33:99</view>
|
||||
<view class="time">{{item.createTime}}</view>
|
||||
</viwe>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="he" v-else>
|
||||
<image class="topImg" mode="widthFix" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/InviteFriends/draw_bg.png"></image>
|
||||
<image class="topImg" mode="widthFix" :src="InviteFriendsData.beInvitedImg"></image>
|
||||
<view class="contentBox">
|
||||
<view class="content">
|
||||
<view class="title">此用户已死,勿Call</view>
|
||||
<view class="title">{{userInfo.nickName}}</view>
|
||||
<view class="label">[邀请你领取新人专享优惠券!]</view>
|
||||
<view class="card">
|
||||
<view class="card" v-for="(item,index) in shareOpenData.newCoupons">
|
||||
<view class="left">
|
||||
<view class="num"><text>¥</text>10.00</view>
|
||||
<view class="mnum">满¥100.00可用</view>
|
||||
<view class="num"><text>¥</text>{{item.discountAmount}}</view>
|
||||
<view class="mnum">满¥{{item.fullAmount}}可用</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view class="rtitle">邀新10元优惠券×1张</view>
|
||||
<view class="time">领取后30天内有效</view>
|
||||
<view class="rtitle">{{item.couponName}}</view>
|
||||
<view class="time">{{item.useDetail}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="btn">领券</view>
|
||||
<view class="btn" v-if="shareOpenData.status == 1" @click="shareReceive">领券</view>
|
||||
<view class="btn" v-else style="background-color: #999;">领券</view>
|
||||
|
||||
|
||||
</view>
|
||||
@@ -82,39 +85,129 @@
|
||||
data() {
|
||||
return {
|
||||
show: false,
|
||||
status: "he",
|
||||
is_type: "",
|
||||
tabList: [
|
||||
{label: '已邀请', type: 1, num: 0},
|
||||
{label: '无效' ,type: 2, num: 0}
|
||||
],
|
||||
tabAcitve: 1,
|
||||
userInfo: uni.cache.get('userInfo'),
|
||||
shopId: null,
|
||||
shareId: null,
|
||||
invitedId: null,
|
||||
InviteFriendsData: null,
|
||||
shareRecordData: null,
|
||||
shareOpenData: null,
|
||||
isSuccess: true,
|
||||
share: {
|
||||
title: "",
|
||||
path: "",
|
||||
imageUrl: ""
|
||||
}
|
||||
};
|
||||
},
|
||||
onLoad(options) {
|
||||
|
||||
console.log(options)
|
||||
if ( options.shopId ) { this.shopId = options.shopId; }
|
||||
if ( options.is_type ) { this.is_type = options.is_type; }
|
||||
if ( options.shareId ) { this.shareId = options.shareId; }
|
||||
if ( options.invitedId ) { this.invitedId = options.invitedId; }
|
||||
this.is_type = 'he'
|
||||
this.invitedId = "113"
|
||||
this.shareId = "1"
|
||||
this.shopId = "11"
|
||||
if ( this.is_type == 'he') {
|
||||
this.shareHeOpen()
|
||||
}
|
||||
this.getByShopId();
|
||||
},
|
||||
onShow() {
|
||||
},
|
||||
|
||||
|
||||
methods: {
|
||||
onShareAppMessage(res) {
|
||||
if (res.from === 'button') {// 来自页面内分享按钮
|
||||
console.log(res.target)
|
||||
}
|
||||
return this.share
|
||||
},
|
||||
async getByShopId() {
|
||||
let params = {
|
||||
shopId : this.shopId
|
||||
}
|
||||
let res = await this.api.getByShopId(params)
|
||||
if ( res.code == 0 ) {
|
||||
this.InviteFriendsData = res.data;
|
||||
this.share.title = res.data.title
|
||||
this.share.path = `/pagesInviteFriends/index/index?shopId=${this.shopId}&is_type=he&shareId=${this.InviteFriendsData.id}&invitedId=${uni.cache.get('userInfo').id}`
|
||||
this.share.imageUrl = res.data.shareImg
|
||||
this.shareRecord();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 邀请记录
|
||||
*/
|
||||
async shareRecord() {
|
||||
let params = {
|
||||
shareId : this.InviteFriendsData.id,
|
||||
invitedId : uni.cache.get('userInfo').id,
|
||||
shopId : this.shopId,
|
||||
isSuccess : this.isSuccess,
|
||||
}
|
||||
let res = await this.api.shareRecord(params)
|
||||
if ( res.code == 0 ) {
|
||||
this.shareRecordData = res.data;
|
||||
this.tabList[0].num = res.data.isSuccess;
|
||||
this.tabList[1].num = res.data.isFail;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 被邀请人进入页面调用接口
|
||||
*/
|
||||
async shareHeOpen() {
|
||||
let params = {
|
||||
shareId : this.shareId,
|
||||
invitedId : this.invitedId,
|
||||
// beInvitedId : uni.cache.get('userInfo').id,
|
||||
beInvitedId : 119,
|
||||
shopId : this.shopId,
|
||||
}
|
||||
let res = await this.api.shareHeOpen(params)
|
||||
if ( res.code == 0 ) {
|
||||
this.shareOpenData = res.data;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 领取优惠券
|
||||
*/
|
||||
async shareReceive() {
|
||||
let params = {
|
||||
shareId : this.shareId,
|
||||
invitedId : this.invitedId,
|
||||
beInvitedId : uni.cache.get('userInfo').id,
|
||||
shopId : this.shopId,
|
||||
}
|
||||
let res = await this.api.shareReceive(params)
|
||||
if ( res.code == 0 ) {
|
||||
uni.showToast({
|
||||
title: "领取成功",
|
||||
icon: "none",
|
||||
})
|
||||
setTimeout(()=>{
|
||||
uni.pro.redirectTo('/pages/user/coupon', {
|
||||
type: 1
|
||||
})
|
||||
},1000)
|
||||
}
|
||||
},
|
||||
tabClick(item) {
|
||||
this.tabAcitve = item.type;
|
||||
},
|
||||
/**
|
||||
* 解码
|
||||
* @param {Object} url
|
||||
* @param {Object} name
|
||||
*/
|
||||
getQueryString(url, name) {
|
||||
var reg = new RegExp('(^|&|/?)' + name + '=([^&|/?]*)(&|/?|$)', 'i')
|
||||
var r = url.substr(1).match(reg)
|
||||
if (r != null) {
|
||||
return r[2]
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -174,10 +267,12 @@
|
||||
background: #FCF9F4;
|
||||
border-radius: 18rpx 18rpx 18rpx 18rpx;
|
||||
border: 2rpx solid #333333;
|
||||
margin-bottom: 32rpx;
|
||||
.left{
|
||||
border-right: 1rpx dashed #333;
|
||||
padding-right: 34rpx;
|
||||
margin-right: 46rpx;
|
||||
flex-shrink: 0;
|
||||
.num{
|
||||
font-weight: 500;
|
||||
font-size: 56rpx;
|
||||
@@ -216,6 +311,7 @@
|
||||
background: #FFFFFF;
|
||||
border-radius: 18rpx 18rpx 18rpx 18rpx;
|
||||
padding: 32rpx 24rpx 32rpx 24rpx;
|
||||
margin-top: 32rpx;
|
||||
.tab{
|
||||
background: #333333;
|
||||
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
||||
|
||||
Reference in New Issue
Block a user