移动端自动发券前端展示
parent
f84f9ab696
commit
0843e457b0
10
api/login.js
10
api/login.js
|
@ -14,6 +14,16 @@ export function resetByMobile(params) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//获取自动发券
|
||||||
|
export function getAutoCoup(){
|
||||||
|
return http.request({
|
||||||
|
url:`/promotion/coupon/activity`,
|
||||||
|
method:"GET",
|
||||||
|
needToken: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 账号密码登陆
|
* 账号密码登陆
|
||||||
* @params password
|
* @params password
|
||||||
|
|
|
@ -564,6 +564,7 @@
|
||||||
*/
|
*/
|
||||||
storage.setUserInfo(user.data.result);
|
storage.setUserInfo(user.data.result);
|
||||||
storage.setHasLogin(true);
|
storage.setHasLogin(true);
|
||||||
|
storage.setAutoCp(0)
|
||||||
// 登录成功
|
// 登录成功
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "登录成功!",
|
title: "登录成功!",
|
||||||
|
|
|
@ -14,6 +14,14 @@ export default {
|
||||||
backgroundColor: "#fff",
|
backgroundColor: "#fff",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
},
|
||||||
|
onShow(){
|
||||||
|
setTimeout(()=>{
|
||||||
|
this.$refs.tpl.firstGetAuto();
|
||||||
|
},1000)
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
|
||||||
},
|
},
|
||||||
onReachBottom(){
|
onReachBottom(){
|
||||||
// 给子级监听触底加载
|
// 给子级监听触底加载
|
||||||
|
|
|
@ -1,5 +1,37 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
|
<u-popup v-model="showCp" mode="center" width="550rpx" height="400px">
|
||||||
|
<view style="height:130rpx;">
|
||||||
|
<view style="width:200rpx;height:120rpx;float:left;line-height:120rpx;font-size:35rpx;color:#28A4F2;font-weight:600;margin-left:20rpx;">优惠券活动</view>
|
||||||
|
<view style="width:120rpx;height:120rpx;float:right;">
|
||||||
|
<image @click="showCp = false" src="/static/cpauto1.png" style="width:100%;height:100%;"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<scroll-view scroll-y="true" style="height: 620rpx;">
|
||||||
|
<!-- {{coupList}} -->
|
||||||
|
<view v-for="(item,index) in coupList" :key="index" >
|
||||||
|
<view class="grad1">
|
||||||
|
<view style="float:right;">
|
||||||
|
<view v-if="item.couponType == 'DISCOUNT'">{{ item.couponDiscount }}折</view>
|
||||||
|
<view v-else>优惠金额:<span style="color:red;font-size:32rpx;">{{ item.price | unitPrice}}</span>元</view>
|
||||||
|
<view>满<span style="color:red;font-size:32rpx;">{{ item.consumeThreshold | unitPrice }}元</span>可用</view>
|
||||||
|
<view v-if="item.scopeType == 'ALL' && item.storeId == '0'">全平台</view>
|
||||||
|
<view v-if="item.scopeType == 'PORTION_GOODS_CATEGORY'">仅限品类</view>
|
||||||
|
<view v-else>{{ item.storeName == 'platform' ? '全平台' :item.storeName+'店铺' }}使用
|
||||||
|
</view>
|
||||||
|
<view v-if="item.endTime">有效期至:{{ item.endTime.split(" ")[0] }}</view>
|
||||||
|
</view>
|
||||||
|
<view style="color:white;font-size:28rpx;font-weight:500;float:left;writing-mode:vertical-rl;flex: auto;height:100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;" @click="showCp = false">
|
||||||
|
立即使用
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
</u-popup>
|
||||||
<!-- uni 中不能使用 vue component 所以用if判断每个组件 -->
|
<!-- uni 中不能使用 vue component 所以用if判断每个组件 -->
|
||||||
<div v-for="(item, index) in pageData.list" :key="index">
|
<div v-for="(item, index) in pageData.list" :key="index">
|
||||||
<!-- 搜索栏,如果在楼层装修顶部则会自动浮动,否则不浮动 -->
|
<!-- 搜索栏,如果在楼层装修顶部则会自动浮动,否则不浮动 -->
|
||||||
|
@ -76,13 +108,19 @@ import tpl_goods from "@/pages/tabbar/home/template/tpl_goods"; //商品分类
|
||||||
import { getFloorData } from "@/api/home"; //获取楼层装修接口
|
import { getFloorData } from "@/api/home"; //获取楼层装修接口
|
||||||
import permision from "@/js_sdk/wa-permission/permission.js"; //权限工具类
|
import permision from "@/js_sdk/wa-permission/permission.js"; //权限工具类
|
||||||
import config from "@/config/config";
|
import config from "@/config/config";
|
||||||
|
import {getAutoCoup} from "@/api/login"
|
||||||
import tpl_notice from "@/pages/tabbar/home/template/tpl_notice"; //标题栏模块
|
import tpl_notice from "@/pages/tabbar/home/template/tpl_notice"; //标题栏模块
|
||||||
import tpl_promotions from "@/pages/tabbar/home/template/tpl_promotions_detail"; //标题栏模块
|
import tpl_promotions from "@/pages/tabbar/home/template/tpl_promotions_detail"; //标题栏模块
|
||||||
|
import storage from "@/utils/storage.js";
|
||||||
|
// import {receiveCoupons} from "@/api/members"
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
config,
|
config,
|
||||||
|
storage,
|
||||||
|
coupList:[],
|
||||||
|
showCp:false,
|
||||||
pageData: "", //楼层页面数据
|
pageData: "", //楼层页面数据
|
||||||
isIos: "",
|
isIos: "",
|
||||||
enableLoad:false, //触底加载 针对于商品模块
|
enableLoad:false, //触底加载 针对于商品模块
|
||||||
|
@ -115,9 +153,58 @@ export default {
|
||||||
// 小程序默认分享
|
// 小程序默认分享
|
||||||
uni.showShareMenu({ withShareTicket: true });
|
uni.showShareMenu({ withShareTicket: true });
|
||||||
// #endif
|
// #endif
|
||||||
|
this.firstGetAuto()
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
firstGetAuto(){
|
||||||
|
// console.log(123123213)
|
||||||
|
let data = new Date()
|
||||||
|
let datas = data.getDate()
|
||||||
|
let huors = data.getHours()
|
||||||
|
let flagCoup = storage.getAutoCp()
|
||||||
|
console.log(flagCoup)
|
||||||
|
console.log(datas)
|
||||||
|
if(storage.getAutoCp() && storage.getAutoCp() != '' && storage.getAutoCp() != undefined && storage.getAutoCp() != null){
|
||||||
|
if(Number(datas) > Number(flagCoup)){
|
||||||
|
if(Number(huors) >= 6){
|
||||||
|
storage.setAutoCp(datas)
|
||||||
|
this.getAutoCp()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
this.getAutoCp()
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
getAutoCp(){
|
||||||
|
let data = new Date()
|
||||||
|
let datas = data.getDate()
|
||||||
|
getAutoCoup().then(res=>{
|
||||||
|
console.log(res)
|
||||||
|
if(res.data.success){
|
||||||
|
this.coupList.push(...res.data.result)
|
||||||
|
if(this.coupList != ''){
|
||||||
|
this.showCp = true
|
||||||
|
}else{
|
||||||
|
this.showCp = false
|
||||||
|
}
|
||||||
|
storage.setAutoCp(datas)
|
||||||
|
let objs = {};
|
||||||
|
this.coupList = this.coupList.reduce((cur, next) => {
|
||||||
|
//对象去重
|
||||||
|
if (next.id != undefined) {
|
||||||
|
objs[next.id]
|
||||||
|
? ""
|
||||||
|
: (objs[next.id] = true && cur.push(next));
|
||||||
|
}
|
||||||
|
return cur;
|
||||||
|
}, []);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// receiveCoupons(v){
|
||||||
|
|
||||||
|
// },
|
||||||
/**
|
/**
|
||||||
* 实例化首页数据楼层
|
* 实例化首页数据楼层
|
||||||
*/
|
*/
|
||||||
|
@ -251,4 +338,30 @@ export default {
|
||||||
.navbar-right {
|
.navbar-right {
|
||||||
padding: 0 16rpx 0 0;
|
padding: 0 16rpx 0 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.grad1 {
|
||||||
|
width: 500rpx;
|
||||||
|
height: 200rpx;
|
||||||
|
background: radial-gradient(circle at right top, transparent 20rpx, #ff6b35 0) top left / 120rpx 51% no-repeat,
|
||||||
|
radial-gradient(circle at right bottom, transparent 20rpx, #ff6b35 0) bottom left /120rpx 51% no-repeat,
|
||||||
|
radial-gradient(circle at left top, transparent 20rpx, #ffffff 0) top right /380rpx 51% no-repeat,
|
||||||
|
radial-gradient(circle at left bottom, transparent 20rpx, #ffffff 0) bottom right /380rpx 51% no-repeat;
|
||||||
|
filter: drop-shadow(6rpx 6rpx 6rpx rgba(0,0,0,.3));
|
||||||
|
margin: 30rpx auto;
|
||||||
|
padding-top: 2rpx;
|
||||||
|
padding-bottom: 10rpx;
|
||||||
|
padding-left: 38rpx;
|
||||||
|
padding-right: 30rpx;
|
||||||
|
}
|
||||||
|
// .grad2 {
|
||||||
|
// width: 100px;
|
||||||
|
// height: 120px;
|
||||||
|
// background:
|
||||||
|
// radial-gradient(circle at left bottom, transparent 10px, #28A4F2 0) top left /60px 30px no-repeat,
|
||||||
|
// radial-gradient(circle at right bottom, transparent 10px, #28A4F2 0) top right /60px 30px no-repeat,
|
||||||
|
// radial-gradient(circle at left top, transparent 10px, #EFEFF4 0) bottom left /60px 90px no-repeat,
|
||||||
|
// radial-gradient(circle at right top, transparent 10px, #EFEFF4 0) bottom right /60px 90px no-repeat;
|
||||||
|
// filter: drop-shadow(3rpx 3rpx 3rpx rgba(0,0,0,.3));
|
||||||
|
// }
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 129 KiB |
|
@ -10,6 +10,14 @@ const FINGER_LOGIN = isDev ? "finger_login_dev" : "finger_login";
|
||||||
const CART_BACKBTN = isDev ? "cart_backbtn_dev" : "cart_backbtn";
|
const CART_BACKBTN = isDev ? "cart_backbtn_dev" : "cart_backbtn";
|
||||||
const AFTERSALE_DATA = isDev ? "aftersale_data_dev" : "aftersale_data";
|
const AFTERSALE_DATA = isDev ? "aftersale_data_dev" : "aftersale_data";
|
||||||
export default {
|
export default {
|
||||||
|
//写入自动发券
|
||||||
|
setAutoCp(val){
|
||||||
|
uni.setStorageSync('autoCp', val)
|
||||||
|
},
|
||||||
|
//获取自动发券时间
|
||||||
|
getAutoCp(){
|
||||||
|
return uni.getStorageSync('autoCp');
|
||||||
|
},
|
||||||
// 写入热门搜索时间戳
|
// 写入热门搜索时间戳
|
||||||
setHotWords(val) {
|
setHotWords(val) {
|
||||||
uni.setStorageSync("hotWords", val);
|
uni.setStorageSync("hotWords", val);
|
||||||
|
|
Loading…
Reference in New Issue