Commit 96280bca by 侯体倬

生日有礼弹窗及领取流程

parent 59239a74
......@@ -1514,6 +1514,15 @@
"unset-value": "^1.0.0"
}
},
"call-bind": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz",
"integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==",
"requires": {
"function-bind": "^1.1.1",
"get-intrinsic": "^1.0.2"
}
},
"caller-callsite": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/caller-callsite/-/caller-callsite-2.0.0.tgz",
......@@ -4313,8 +4322,7 @@
"function-bind": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
"dev": true
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
},
"gauge": {
"version": "2.7.4",
......@@ -4369,6 +4377,16 @@
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
"dev": true
},
"get-intrinsic": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz",
"integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==",
"requires": {
"function-bind": "^1.1.1",
"has": "^1.0.3",
"has-symbols": "^1.0.1"
}
},
"get-stdin": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz",
......@@ -4487,7 +4505,6 @@
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
"integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
"dev": true,
"requires": {
"function-bind": "^1.1.1"
}
......@@ -4510,8 +4527,7 @@
"has-symbols": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz",
"integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==",
"dev": true
"integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg=="
},
"has-unicode": {
"version": "2.0.1",
......@@ -5570,9 +5586,9 @@
"dev": true
},
"mayi-analytics": {
"version": "1.1.14",
"resolved": "https://registry.npmjs.org/mayi-analytics/-/mayi-analytics-1.1.14.tgz",
"integrity": "sha512-hyKJv4lbEUPLJoR0DmO4Fi1/zYeOvHc1zQaEFXE0ebk18LOOFb9qPiVbEsQ6eDqGzyyMOWoklKWlZxqYmlhoNA==",
"version": "1.1.24",
"resolved": "https://registry.npmjs.org/mayi-analytics/-/mayi-analytics-1.1.24.tgz",
"integrity": "sha512-pbJspryp05UuiodXfCFbeZkyM1BdPGC83XRJDo+LJhvfdyaiTXLykCfORRCDgTR0hIuINb8UjOc8/B6bkjWp8g==",
"requires": {
"js-cookie": "^2.2.0",
"qs": "^6.7.0",
......@@ -5580,9 +5596,12 @@
},
"dependencies": {
"qs": {
"version": "6.9.4",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.9.4.tgz",
"integrity": "sha512-A1kFqHekCTM7cz0udomYUoYNWjBebHm/5wzU/XqrBRBNWectVH0QIiN+NEcZ0Dte5hvzHwbr8+XQmguPhJ6WdQ=="
"version": "6.10.1",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.10.1.tgz",
"integrity": "sha512-M528Hph6wsSVOBiYUnGf+K/7w0hNshs/duGsNXPUCLH5XAqjEtiPGwNONLV0tBH8NoGb0mvD5JubnUTrujKDTg==",
"requires": {
"side-channel": "^1.0.4"
}
}
}
},
......@@ -8650,6 +8669,23 @@
"rechoir": "^0.6.2"
}
},
"side-channel": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
"integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==",
"requires": {
"call-bind": "^1.0.0",
"get-intrinsic": "^1.0.2",
"object-inspect": "^1.9.0"
},
"dependencies": {
"object-inspect": {
"version": "1.11.0",
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.11.0.tgz",
"integrity": "sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg=="
}
}
},
"sigmund": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz",
......
......@@ -17,6 +17,7 @@
"checkInvalidKey": true,
"checkSiteMap": true,
"uploadWithSourceMap": true,
"compileHotReLoad": false,
"useMultiFrameRuntime": true,
"useApiHook": true,
"useApiHostProcess": true,
......@@ -25,6 +26,7 @@
"disablePlugins": [],
"outputPath": ""
},
"enableEngineNative": false,
"useIsolateContext": true,
"useCompilerModule": true,
"userConfirmedUseCompilerModuleSwitch": false,
......@@ -35,11 +37,11 @@
},
"miniprogramRoot": "dist/wx/",
"compileType": "miniprogram",
"appid": "wxae95a07ffdf11548",
"appid": "wx8a509d2f2ac15903",
"projectname": "mayi-mp-shop",
"simulatorType": "wechat",
"simulatorPluginLibVersion": {},
"libVersion": "2.15.0",
"libVersion": "2.19.1",
"condition": {
"plugin": {
"list": []
......
......@@ -4,5 +4,9 @@ export default {
ordercustomerinfo(options){
return requestPOST(`${process.env.OLSHOP_URL}/order/place_order_customer_info`,options)
},
// 生日有礼确认订单
addOrderNowBuy(data) {
return requestPOST(`${process.env.OLSHOP_URL}/order/add_order`, data)
},
}
\ No newline at end of file
import { requestPOST, requestGET } from "@/utils/request.js"
export default {
// 查询是否显示生日礼包
getQueryGift() {
return requestPOST(`${process.env.OLSHOP_URL}/grantRecordInfo/getQueryGift`);
}
};
<template>
<!-- catchtouchmove="ture" 防止触摸穿透 -->
<div v-show="isShow">
<div class="container" v-if="!showIcon && !state">
<div class="background" @click="showIcon = true"></div>
<div class="info">
<div class="info-item">
<p style="white-space: nowrap;">
尊敬的<span style="color: #000">
{{ nickName }} </span
>先生,
</p>
<div class="detail">
{{
month
}}月是您的生日月,现在为您送上专属生日大礼包一份,祝您生日快乐!
</div>
<img class="tleft" :src="imgList.tleft" alt="" />
<img class="bright" :src="imgList.bright" alt="" />
<div class="button" @click="receive()"><span>领取生日礼包</span></div>
</div>
</div>
<img class="bg" :src="imgList.background" alt="" />
<img class="crown" :src="imgList.crown" alt="" />
<img class="close" :src="imgList.close" @click.stop="closePopup()" alt="" />
<img class="head" :src="avatar" alt="" />
</div>
<div v-else class="present" @click="iconClick()">
<img :src="imgList.present" alt="" />
<span>生日有礼</span>
</div>
<birthInfo v-if="productArr" ref="giftpackage" :giftData="productArr" @suregiftopencard="suregiftopencard"></birthInfo>
</div>
</template>
<script>
import { DFSImg } from "@/utils/index";
import birthInfo from './index.vue';
import orderDown from "@/api/order";
export default {
name: 'birthPopup',
created() {
this.getBirth()
this.getUserInfo()
},
deactivated() {
this.state = true;
},
data() {
return {
showIcon: false,
imgList: {
// 左上角
tleft:
"http://mayi-newshop.oss-cn-shanghai.aliyuncs.com/public/png/b0161af3-ba7e-4792-9f19-3dc3feb4ba84.png",
// 右下角
bright:
"http://mayi-newshop.oss-cn-shanghai.aliyuncs.com/public/png/aa55219c-51e6-4d3d-a4f3-4388511f1e66.png",
// 皇冠
crown:
"http://mayi-newshop.oss-cn-shanghai.aliyuncs.com/public/png/970f0df4-be82-463c-b984-15650a358c15.png",
// 背景
background:
"http://mayi-newshop.oss-cn-shanghai.aliyuncs.com/public/png/0976526d-0e99-4620-9847-fa54ed23b6a8.png",
// 关闭
close:
"http://mayi-newshop.oss-cn-shanghai.aliyuncs.com/public/png/97d375b0-b434-4615-9048-51f4aaee5142.png",
// 小礼物
present:
"http://mayi-newshop.oss-cn-shanghai.aliyuncs.com/public/png/15e91d69-dd21-4ff2-8281-510fac2fb75a.png"
},
state: false,
nickName: '',
avatar: '',
productArr: [],
month: '',
isShow: false
};
},
props: {
birthGifts: {
type: Object,
default: {}
},
isShowBirth: {
type: Boolean,
default: false
}
},
watch: {
birthGifts() {
// 图片处理
for (let i = 0; i < this.birthGifts.gifts.length; i++) {
this.birthGifts.gifts[i].goodsSpecificationsUrl
= DFSImg(this.birthGifts.gifts[i].goodsSpecificationsUrl)
}
this.productArr = this.birthGifts.gifts
this.getBirth()
this.getUserInfo()
},
isShowBirth() {
this.isShow = this.isShowBirth
console.log('tztzt', this.isShowBirth);
}
},
methods: {
// 领取生日礼物,跳转订单页
receive() {
this.$refs.giftpackage.yhjCheck = true;
},
// icon 点击事件
iconClick() {
this.state = false;
this.showIcon = false;
},
// 关闭弹窗
closePopup() {
this.state = true;
this.showIcon = true;
},
// 获取用户信息
getUserInfo() {
if (this.$store.state.userInfo.nickName) { this.nickName = this.$store.state.userInfo.nickName }
if (this.$store.state.userInfo.avatarUrl) { this.avatar = this.$store.state.userInfo.avatarUrl }
else {
this.avatar = "http://mayi-newshop.oss-cn-shanghai.aliyuncs.com/public/jpg/02c0c235-daae-412d-bced-5fb315ad570e.jpg"
}
},
// 对生日月份的处理
getBirth() {
if (this.birthGifts.gifts) {
let birth = this.birthGifts.gifts[0].createDatetime.slice(5, 7)
if (birth.slice(0, 1) === '0') { this.month = birth.slice(1, 2) }
else { this.month = birth }
}
},
// 领取成功回调
suregiftopencard(val) {
this.isShow = false
wx.showLoading({
title: '领取中...',
mask: false
})
let orderItems = []
for (let i = 0; i< this.birthGifts.gifts.length; i++) {
orderItems.push({qty: 1, terminalProductGoodsId: this.birthGifts.gifts[i].grantGift, giftFlag: true})
}
const submitParam = {
orderItems
};
if(this.$refs.giftpackage) {
if(val) {
submitParam.consignee = val.consignee;
submitParam.telephone = val.mobilephone;
submitParam.address = val.address;
submitParam.provinceCode = val.provinceCode;
submitParam.provinceName = val.provinceName;
submitParam.cityCode = val.cityCode;
submitParam.cityName = val.cityName;
submitParam.regionCode = val.districtCode;
submitParam.regionName = val.districtName;
submitParam.marketingMode = 8;
submitParam.orderType = 21;
submitParam.marketingModeSourceId = this.birthGifts.id;
}
}
orderDown.addOrderNowBuy(submitParam).then(res => {
res = res.data
if (res.code == 200) {
wx.hideLoading()
wx.showModal({
title:'领取成功!',
content: '请在个人中心‘我的订单’中查看详情!',
showCancel: false
})
} else {
wx.hideLoading()
wx.showModal({
title: '错误',
content: `${res.msg}`,
showCancel: false
})
}
});
}
},
components: {
birthInfo
}
};
</script>
<style lang="scss" scoped>
.background {
position: absolute;
top: 0;
left: 0;
width: 750rpx;
height: 100vh;
z-index: 6;
background: rgba(0, 0, 0, 0.4);
opacity: 0.8;
}
.container {
z-index: 111;
position: fixed;
width: 100%;
height: 100%;
top: 0;
left: 0;
margin: 0 auto;
padding: 0;
.bg {
position: absolute;
left: 0;
right: 0;
margin: 114px auto;
width: 263px;
height: 349px;
z-index: 6;
}
.crown {
position: absolute;
left: 0;
right: 0;
margin: 153px auto;
width: 40px;
height: 24px;
z-index: 11;
}
.close {
position: absolute;
left: 0;
right: 0;
margin: 477px auto 72px;
width: 32px;
height: 32px;
z-index: 6;
}
.head {
position: absolute;
left: 0;
right: 0;
margin: 172px auto 348px;
z-index: 11;
width: 60px;
height: 60px;
border-radius: 50%;
}
.info {
position: absolute;
left: 0;
right: 0;
margin: 287px auto;
width: 263px;
height: 176px;
background: #ffffff;
border-radius: 0px 0px 4px 4px;
z-index: 11;
.info-item {
margin: 20px 123px 135px 10px;
width: 130px;
height: 21px;
font-size: 15px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #a55223;
line-height: 21px;
.bright {
position: absolute;
left: 214px;
bottom: 54px;
width: 67px;
height: 84px;
z-index: 11;
}
.tleft {
position: absolute;
right: 217px;
bottom: 305px;
width: 71px;
height: 81px;
z-index: 11;
}
.detail {
position: relative;
z-index: 12;
margin-top: 14px;
text-align: left;
width: 243px;
height: 33px;
font-size: 12px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #666666;
line-height: 17px;
}
.button {
position: absolute;
left: 0;
right: 0;
margin: 32px auto;
text-align: center;
width: 204px;
height: 40px;
background: linear-gradient(135deg, #dbb292 0%, #f8dfc4 100%);
border-radius: 21px;
span {
width: 90px;
height: 21px;
font-size: 15px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #643a23;
line-height: 40px;
}
}
}
}
}
.present {
position: fixed;
top: 474px;
right: 10px;
img {
display: block;
margin: 0 auto;
width: 49px;
height: 49px;
border-radius: 50%;
margin-bottom: -5px;
}
span {
width: 59px;
height: 20px;
background: #fd8f50;
border-radius: 10px;
border: 1px solid #611014;
}
}
</style>
<template>
<div class="sendPoints" v-if="yhjCheck">
<div @click="yhjCheck = false" class="testBackground"></div>
<div class="test" v-if="yhjCheck" position="bottom" custom-style="height: 40%">
<p class="couponTit">确认{{showAddr?'地址':''}}</p>
<div v-if="showAddr">
<div class="address_list-d flex" v-if="addressCur" @click="toChooseAddr()">
<div class="top">
<div class="name">{{addressCur.consignee}}</div>
<div class="default flex" v-if="addressCur.isDefaultShipping == 1">默认</div>
</div>
<div class="mid">
<div class="tel">
<span v-if="addressCur.mobilephone">{{addressCur.mobilephone}}</span>
<span v-else>{{addressCur.telephone}}</span>
</div>
<div
class="address"
>{{addressCur.provinceName}}{{addressCur.cityName}}{{addressCur.districtName}}{{addressCur.address}}</div>
<i class="iconfont icon-tubiao_jiyao-xiangyou"></i>
</div>
</div>
<div class="adr1" v-else @click="toAddAddr()">
<img class="adr1_img" src="https://cdn.mayi888.com/_nuxt/client/img/e547fe3.png?mixid=" alt="">
<p>请选择收货地址</p>
</div>
</div>
<div class="check_box" :style="{height: newdata.length > 1 ? '200px' : '100%'}">
<div class="gift_detail" v-for="(item,index) in newdata" :key="index">
<van-card
num="1"
price="0.00"
:title="item.grantName"
:thumb="item.goodsSpecificationsUrl"
/>
<div class="gift_list" v-for="(sitem,sindex) in item.giftGoodsRels" :key="sindex">
<span>{{sitem.productName}} </span>
<span>X{{Number(sitem.qty)}}</span>
</div>
</div>
</div>
<div class="sure_box">
<div class="sure_item" @click="suregift()">确定</div>
</div>
</div>
</div>
</template>
<script type="text/ecmascript-6">
import addres from "@/api/userAddress";
export default {
name: 'birthInfo',
data() {
return {
newdata:[],
yhjCheck:false,
addressList:[],
addressCur:null,
checked:true,
selectgift:[],
showAddr:true,//是否展示选择地址
};
},
props:{
giftData: {
type: Array,
default() {
return []
}
},
maxReceiveGift:{
type:String,
default() {
return ''
}
},
title:{
type:String,
default() {
return ''
}
}
},
watch:{
yhjCheck(val){
console.log('tztztz', val);
this.getUserAddr();
if(val) {
if(this.newdata.length == 1) {
this.$set(this.newdata[0],'ischange',true);
}
}
},
giftData() {
this.newdata = this.giftData;
}
},
async created(){
this.newdata = this.giftData;
this.getUserAddr();
},
methods: {
getData(val){
this.newdata = val;
},
getUserAddr(){
//获取地址
addres.getUserAddressList().then(res => {
if (res.data.code == 200) {
if (res.data.data.list.length > 0) {
this.addressList = res.data.data.list;
this.addressList.forEach(v => {
if (v.isDefaultShipping == "1"||v) {
return this.addressCur = v
}
});
return this.addressCur = this.addressList[0]
} else {
this.addressCur = null
}
}
});
},
// 去修改地址
toChooseAddr(){
wx.navigateTo({url: '/pages/index/main?from=home&backpath=%2Faddress%2FaddressList'});
this.yhjCheck = false
},
// 确定
suregift(){
if(this.showAddr && !this.addressCur) {
wx.showToast({
title:'请选择收货地址!',
icon: "error"
})
return false
}
this.yhjCheck = false;
this.$emit('suregiftopencard',this.addressCur,this.showAddr,this.selectgift)
},
// 新增地址
toAddAddr(){
wx.navigateTo({url: '/pages/index/main?from=home&backpath=%2Faddress%2FaddressList'});
this.yhjCheck = false
},
}
};
</script>
<style lang="scss" scoped>
.sendPoints {
position: fixed;
bottom: 0;
z-index: 99999;
width: 100%;
height: 100%;
margin-top: 14px;
.testBackground {
height: 100%;
width: 100%;
background-color: rgba(0,0,0,0.4);
opacity: .8;
z-index: 1;
}
.test {
position: fixed;
bottom: 0;
width: 100%;
z-index: 2;
}
.tit {
font-size: 16px;
color: #333;
align-items: center;
font-weight: bold;
}
.gift_wrap{
padding-top: 10px;
.gift_item{
display: flex;
margin-bottom: 10px;
.gift_index{
background-size: cover;
height: 61px;
width: 43.5px;
flex: none;
margin-right: 10px;
.num{
position: relative;
right: -7px;
top: -4px;
font-size: 29px;
font-weight: bold;
color: rgba(255,255,255,1);
}
}
.gift_product{
overflow: hidden;
.product_img{
display: flex;
overflow: auto;
padding-left: 10px;
img{
width: 47px;
height: 48px;
margin-right: 15px;
}
}
.product_text{
font-size: 12px;
font-family: Source Han Sans CN;
font-weight: 400;
color: rgba(46,46,46,1);
line-height: 18px;
margin-top: 5px;
}
}
}
.tips{
color: #666666;
font-weight:bold;
padding-bottom: 10px;
}
}
.couponTit{
text-align: center;
font-size: 16px;
padding: 10px 0 0 0;
border-bottom: 1px solid #e5e5e5;
width: 100%;
height: 100%;
background-color: #fff;
padding-bottom: 10px;
}
.adr1 {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
margin:0 auto;
padding:10px 0;
text-align:center;
width: 100%;
background-color: #fff;
border-bottom: 1px solid #e5e5e5;
.adr1_img{
width:36px;
height:33px;
margin: 0 auto;
}
p{
margin-top:10px;
font-size:14px;
color:#828282;
text-align:center;
}
}
.address_list-d {
position: relative;
width: 100%;
height: 100px;
background: rgba(255, 255, 255, 1);
border-bottom: 1px solid #e5e5e5;
.top{
text-align: center;
padding-left: 20px;
.name {
height: 15px;
font-size: 15px;
font-family: MicrosoftYaHei;
font-weight: 400;
color: rgba(39, 39, 39, 1);
margin-top: 25px;
}
.default {
width: 40px;
border: 1px solid var(--main-color);
border-radius: 3px;
font-size: 12px;
font-family: MicrosoftYaHei;
font-weight: 400;
color: var(--main-color);
justify-content: center;
align-items: center;
margin-top: 10px;
display: inline-block;
}
}
.mid {
width: 240px;
// margin-top: 6px;
margin-left: 20px;
span{
margin-top: 25px;
}
.tel {
// width: 100px;
height: 20px;
font-size: 15px;
font-family: MicrosoftYaHei;
font-weight: 400;
color: rgba(39, 39, 39, 1);
margin-top: 25px;
}
.address {
width: 240px;
height: 37px;
font-size: 13px;
font-family: MicrosoftYaHei;
font-weight: 400;
color: rgba(39, 39, 39, 1);
margin-top: 3px;
}
.iconfont {
position: absolute;
right: 15px;
top: 34px;
font-size: 18px;
// margin-left: 13px;
}
}
.top {
width: 20%;
}
}
.check_box{
/* height: 200px; */
overflow: auto;
font-size:16px;
.van-checkbox{
padding-top: 10px;
padding-left: 30px;
margin-bottom: 5px;
}
.gift_detail{
border-bottom: 1px solid #e5e5e5;
padding-bottom: 10px;
width: 100%;
background-color: #fff;
.gift_list{
font-size: 12px;
padding-left: 58px;
color: #999;
margin-bottom: 5px;
}
}
}
.sure_box{
display: flex;
justify-content: center;
background-color: #fff;
height: 100%;
width: 100%;
.sure_item{
width: 80%;
text-align: center;
border-radius: 20px;
height: 35px;
line-height: 35px;
margin-top: 10px;
margin-bottom: 10px;
font-size: 16px;
background: #c6b088;
color: #fff;
}
}
}
</style>
{
"usingComponents": {
"van-card": "/static/vant/card/index",
"van-popup": "/static/vant/popup/index",
"van-toast": "/static/vant/toast/index"
}
}
......@@ -109,6 +109,11 @@
<!-- 底部栏 -->
<custom-tab-bar class="custom-tab-bar" :selected="active"></custom-tab-bar>
<!-- 生日弹窗 -->
<keep-alive>
<birth-popup :birthGifts="birthGifts" :isShowBirth="isShowBirth" v-show="true"></birth-popup>
</keep-alive>
<couponPopup></couponPopup>
</div>
</template>
......@@ -131,7 +136,8 @@ import imgText from '@/components/content/imgText'
import coupon from '@/components/activity/coupon'
import integralTurntable from '@/components/activity/integralTurntable'
import spellGroup from '@/components/activity/spellGroup'
import birthPopup from '@/components/birthPopup/birthPopup.vue'
import birth from '@/api/popup'
import couponPopup from '@/components/couponPopup.vue'
import NewUser from "../../components/newCustomer/newUser";
import NewPolite from "../../components/newCustomer/newPolite";
......@@ -165,6 +171,9 @@ export default {
showNewUser: false, //新客有礼入口
showgiftBag: false, //新客礼包弹框
timer: null,
isShowBirth: false, // 是否展示生日礼品
birthGifts: ""
};
},
components:{
......@@ -183,7 +192,8 @@ export default {
spellGroup,
couponPopup,
NewUser,
NewPolite
NewPolite,
birthPopup
},
onShareAppMessage(res) {
let {shopCode} = app.globalData.shopInfo;
......@@ -229,6 +239,21 @@ export default {
})
observer.observe({ entryTypes: ['render', 'script'] })
}
// 查询是否展示生日礼品
// this.isShowBirth = true // 测试
wx.getStorage({
key: 'sessionid',
success: res => {
console.log('tz登录', res);
this.getBirthGift(this)
},
fail: err => {
this.isShowBirth = false
console.log('tz未登录', err, this.isShowBirth);
console.log('未登录状态=====================', err)
}
})
},
onLoad(options) {
//进页面存储需要绑定的信息
......@@ -267,7 +292,7 @@ export default {
}
}).catch((err)=>{
})
})
});
}
Object.assign(this.$data, this.$options.data());
......@@ -284,7 +309,7 @@ export default {
this.changeLocation = options.changeLocation || ''
if(this.changeLocation == 1){
console.log('this.$store.state.extConfig',this.$store.state.extConfig)
console.log('this.$store.state.extConfig',this.$store.state.extConfig)
app.getShopInfo(this.$store.state.extConfig);
app.getThemePage(this.$store.state.extConfig);
}
......@@ -309,7 +334,6 @@ export default {
}
// 获取页面数据
if (this.mpApp.globalData.pageList) {
that.init(this.mpApp.globalData.pageList);
} else {
......@@ -323,12 +347,10 @@ export default {
}else {
this.mpApp.themeColorCallBack=(res)=>{
this.themeColor = res
}
}
// 新人有礼弹窗
this.newUserFun();
},
onShow() {
//分销隔流
......@@ -350,7 +372,6 @@ export default {
};
},
methods: {
init(pageList) {
this.getCartNum();
this.active=checkTabbarPage('/');
......@@ -453,7 +474,7 @@ export default {
}
if(
res&&
res.parentSpokesmanDistributionModel == '1'&&
res.parentSpokesmanDistributionModel == '1'&&
res.distributorHomepage.id) {
this.showSpokesManHome = true;
}else {
......@@ -503,7 +524,7 @@ export default {
if(
Math.abs(delta) < 10 ||
afterScrollTop < 0 ||
this.beforeScrollTop < 0 ||
this.beforeScrollTop < 0 ||
(delta>0 && showFlag=='down') ||
(delta<0 && showFlag=='up')
){
......@@ -647,6 +668,34 @@ export default {
this.showgiftBag = false;
}
},
getBirthGift(that) {
birth.getQueryGift().then(res => {
let result = res.data
console.log(JSON.stringify(result), that, 'tztztz初始化')
if (result.data.gifts !== null && result.data.gifts.length > 0) {
// 判断礼物是否领取完成
let showPopup = false;
let arr = [];
for (let i = 0; i < result.data.gifts.length; i++) {
// 未领取的礼物添加到数组中
if (result.data.gifts[i].executeStatus !== "1") {
showPopup = true;
arr.push(result.data.gifts[i]);
}
}
if (showPopup) {
// 替换原有数组
result.data.gifts = arr;
that.toggleData(result.data)
}
}
});
},
toggleData(res) {
this.isShowBirth = true;
console.log(this.isShowBirth, JSON.stringify(res) + 'tzToggleData')
this.birthGifts = res;
}
},
async onShareAppMessage(res){
console.log(res)
......@@ -712,7 +761,7 @@ export default {
app.getShopInfo(this.$store.state.extConfig);
app.getThemePage(this.$store.state.extConfig);
}
};
</script>
......
......@@ -2,6 +2,7 @@
"usingComponents": {
"van-tabs": "/static/vant/tabs/index",
"van-tab": "/static/vant/tab/index",
"van-card": "/static/vant/card/index",
"banner": "/static/nativeComponents/Banner/index",
"goods-list": "/static/nativeComponents/GoodsList/index",
"custom-tab-bar": "/static/nativeComponents/custom-tab-bar/index",
......@@ -29,4 +30,4 @@
},
"enablePullDownRefresh":true,
"backgroundColor":"#f5f5f5"
}
\ No newline at end of file
}
<!--miniprogram/custom-tab-bar/index.wxml-->
<!-- miniprogram/custom-tab-bar/index.wxml -->
<view class="tab-bar {{show?'':'hide'}} {{(componentData.scrollHide) && showFlag=='down'?'down':'up'}}" style="--main-color : {{mainColor}}">
<!-- <view class="antt ant-daipinglun"></view> -->
<!-- <view class="iconfont icon-fenzhi">3</view> -->
<view class="tab-bar-border"></view>
<view
wx:for="{{list}}"
wx:if="{{item.show}}"
wx:key="index"
class="tab-bar-item {{(mid==index&&componentData['styleSelectionNum']==1)?'isItem':''}}"
data-path="{{item.link}}"
data-index="{{index}}"
bindtap="switchTab"
>
<!-- 图标 -->
<view class="item {{index == selected ? 'current' : ''}}">
<view wx:if="{{componentData['contentFormNum']!=2}}" >
<view wx:if="{{item.iconType==0||!item.iconType}}">
<view class="{{item.isAntt ? 'antt' : 'iconfont'}} {{item.icon}}" style="font-size:{{componentData.defaultIcon==1 ? '36rpx' : (componentData.defaultIconSize*2 + 'rpx')}};color:{{index==selected?componentData.selectIconColor:componentData.defaultIconColor}}"></view>
</view>
<view
wx:elif="{{item.iconType==1}}"
class="img-view "
>
<image
style="width:{{(index==selected?componentData.selectionIconSize*2:componentData.defaultIconSize*2)+'rpx'}};height:{{(index==selected?componentData.selectionIconSize*2:componentData.defaultIconSize*2)+'rpx'}}"
mode="aspectFit" src="{{selected === index ? item.selectImgUrl : item.imgUrl}}">
</image>
</view>
</view>
<!-- 名称 -->
<view wx:if="{{componentData['contentFormNum']!=3}}" class="text" style="color: {{selected === index ? componentData.selectTextColor : componentData.defaultTextColor}};font-size:{{selected === index ? (componentData.selectText==1?10:componentData.selectionTextNum)*2 : (componentData.defaultText==1?10:componentData.defaultTextNum)*2}}rpx">
{{item.title}}</view>
<!-- 购物车商品数量 -->
<view class="isCart" wx:if="{{item.link&&item.link.link&&item.link.link=='/shopCart/shoppingCart'&&cartNum>0}}">
{{cartNum}}
</view>
</view>
</view>
<!-- <view class="antt ant-daipinglun"></view> -->
<!-- <view class="iconfont icon-fenzhi">3</view> -->
<view class="tab-bar-border"></view>
<view wx:for="{{list}}" wx:if="{{item.show}}" wx:key="index" class="tab-bar-item {{(mid==index&&componentData['styleSelectionNum']==1)?'isItem':''}}" data-path="{{item.link}}" data-index="{{index}}" bindtap="switchTab">
<!-- 图标 -->
<view class="item {{index == selected ? 'current' : ''}}">
<view wx:if="{{componentData['contentFormNum']!=2}}">
<view wx:if="{{item.iconType==0||!item.iconType}}">
<view class="{{item.isAntt ? 'antt' : 'iconfont'}} {{item.icon}}" style="font-size:{{componentData.defaultIcon==1 ? '36rpx' : (componentData.defaultIconSize*2 + 'rpx')}};color:{{index==selected?componentData.selectIconColor:componentData.defaultIconColor}}"></view>
</view>
<view wx:elif="{{item.iconType==1}}" class="img-view ">
<image style="width:{{(index==selected?componentData.selectionIconSize*2:componentData.defaultIconSize*2)+'rpx'}};height:{{(index==selected?componentData.selectionIconSize*2:componentData.defaultIconSize*2)+'rpx'}}" mode="aspectFit" src="{{selected === index ? item.selectImgUrl : item.imgUrl}}"></image>
</view>
</view>
<!-- 名称 -->
<view wx:if="{{componentData['contentFormNum']!=3}}" class="text" style="color: {{selected === index ? componentData.selectTextColor : componentData.defaultTextColor}};font-size:{{selected === index ? (componentData.selectText==1?10:componentData.selectionTextNum)*2 : (componentData.defaultText==1?10:componentData.defaultTextNum)*2}}rpx">
{{item.title}}
</view>
<!-- 购物车商品数量 -->
<view class="isCart" wx:if="{{item.link&&item.link.link&&item.link.link=='/shopCart/shoppingCart'&&cartNum>0}}">
{{cartNum}}
</view>
</view>
</view>
</view>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment