[本时生活h5端]
This commit is contained in:
668
pages/oil/buy.vue
Normal file
668
pages/oil/buy.vue
Normal file
@@ -0,0 +1,668 @@
|
||||
<template>
|
||||
<view>
|
||||
<!-- 按钮 -->
|
||||
<view class="newrightsBtn" @tap="payment">
|
||||
<view class="rightsBtn-text">
|
||||
<view class="rightsBtn-text-num">共:{{ rightData.num }}件商品 </view>
|
||||
<view>实付:<text>¥{{ rightData.total }}</text></view>
|
||||
</view>
|
||||
<button :disabled="disabled">立即购买</button>
|
||||
</view>
|
||||
|
||||
<!-- 卡券 -->
|
||||
<view style="padding-bottom: 90px">
|
||||
<view class="cont">
|
||||
<view class="contBack">
|
||||
<image class="classBack" src="https://lifetest.ysd-bs.com/storage/materials/2021/08/09/class_back_02.png" mode="scaleToFill"></image>
|
||||
<view class="classCircle"></view>
|
||||
<view class="rightsCont">
|
||||
<scroll-view scroll-x class="welfareCont-top" scroll-with-animation>
|
||||
<view class="welfareCont-list-img" v-for="(item, index) in rightData.detail.logos" :key="index">
|
||||
<image :src="item" mode="aspectFill"></image>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="nowrap rightsCont-btn">
|
||||
{{ rightData.detail.four_title }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 数量 -->
|
||||
<view class="rightsNumber">
|
||||
<image class="rightsGoods-img" :src="rightData.detail.goods_cover" mode="aspectFill"></image>
|
||||
<view class="rightsGoods">
|
||||
<view class="nowrap rightsGoods-text">
|
||||
{{ rightData.detail.five_title }}
|
||||
</view>
|
||||
<view class="rightsGoods-price">
|
||||
<view class="rightsGoods-number"><text>¥</text>{{ rightData.detail.price }}</view>
|
||||
<view class="rightsAdd">
|
||||
<view class="rightsAdd-btn rightsAdd-remove" :class="{active : rightData.num != 1}" @click="goodsNumber('remove')">-</view>
|
||||
<input class="rightsAdd-input" :data-num="rightData.num" :value="rightData.num" type="number" disabled=""></input>
|
||||
<view class="rightsAdd-btn rightsAdd-plus" @click="goodsNumber('plus')">+</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 收货地址 -->
|
||||
<block v-if="buyWay.platformCp[buyWay.platIndex]">
|
||||
<view class="rightsList" v-if="buyWay.platformCp[buyWay.platIndex].name == '快递'">
|
||||
<block v-if="rightData.detail.type == 'physical'">
|
||||
<view class="rightsLabel">
|
||||
<view class="rightsLabel-left">提交方式</view>
|
||||
<view class="rightsLabel-right rightsLabel-range">
|
||||
<picker :value="buyWay.platIndex" :range-key="'name'" :range="buyWay.platformCp" range-key="name" @change="platBind">
|
||||
<view class="tabs-text">
|
||||
{{ buyWay.platformCp[buyWay.platIndex].name }}
|
||||
</view>
|
||||
</picker>
|
||||
<image class="rightsLabel-row" src="/static/icon/rightsArrow.png"></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="rightsLabel rightsLabel-address" v-if="buyWay.platformCp[buyWay.platIndex].name == '快递'">
|
||||
<image class="rightsLabel-icon" src="/static/img/new_rightsAddress.png"></image>
|
||||
<block v-if="rightData.addressSee != ''">
|
||||
<view class="rightsLabel-right" @tap="addressTap">
|
||||
<view class="rightsLabel-address-text">
|
||||
<view class="rightsLabel-address-name">{{ rightData.addressSee.name }}<view class="rightsLabel-address-tel">{{ rightData.addressSee.mobile }}</view></view>
|
||||
<text class="nowrap">{{ rightData.addressSee.all_address }}</text>
|
||||
</view>
|
||||
<image class="rightsLabel-row" src="/static/icon/rightsArrow.png"></image>
|
||||
</view>
|
||||
</block>
|
||||
<block v-else>
|
||||
<navigator class="rightsLabel-right" hover-class="none" url="/pages/address_form/address_form?type=Add">
|
||||
<view class="rightsLabel-address-text" style="line-height: 90rpx;">
|
||||
添加收货地址
|
||||
</view>
|
||||
<image class="rightsLabel-row" src="/static/icon/rightsArrow.png"></image>
|
||||
</navigator>
|
||||
</block>
|
||||
</view>
|
||||
<view class="rightsLabel" v-if="buyWay.platformCp[buyWay.platIndex].name == '快递'">
|
||||
<view class="rightsLabel-left">快递运费</view>
|
||||
<view class="rightsLabel-right rightsLabel-freight">¥{{ rightData.freight }}</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!-- 购买须知 -->
|
||||
<view class="notice">
|
||||
<view class="noticeTitle" @click="noticeTap">
|
||||
<view class="noticeTitle-flex">
|
||||
<image class="noticeTitle-img" src="/static/icon/notice_icon.png"></image>
|
||||
购买前请仔细阅读使用须知、内容介绍
|
||||
</view>
|
||||
<image class="noticeTitle-row" :class="{active : notice.noticeShow}" src="/static/icon/rightsArrow.png"></image>
|
||||
</view>
|
||||
<view class="noticeText" :class="{active : notice.noticeShow}">
|
||||
<view class="noticeText-top">购买须知</view>
|
||||
<view class="noticeText-cont" v-if="notice.remark">
|
||||
<rich-text :nodes="notice.remark"></rich-text>
|
||||
</view>
|
||||
|
||||
<view class="noticeText-top">内容介绍</view>
|
||||
<view class="noticeText-cont" v-if="notice.content">
|
||||
<rich-text :nodes="notice.content"></rich-text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { buy, buySubmit } from '@/apis/interfaces/oil'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
rightData: {
|
||||
detail : '', // 权益内容
|
||||
rightId : '', // 权益id
|
||||
addressSee : '', // 收货地址
|
||||
num : 1, // 购买数量
|
||||
moreAmount : '', // 产品总金额
|
||||
freight : '', // 运费
|
||||
total : '' // 总金额
|
||||
},
|
||||
notice : {
|
||||
remark : '', // 购买须知
|
||||
content : '', // 内容介绍
|
||||
noticeShow : true // 购买须知状态
|
||||
},
|
||||
buyWay : {
|
||||
platformCp : [], // 选择提交数组
|
||||
platIndex : 0, // 选择提交方式下标
|
||||
isdeliver : -1 // 选择提交方式
|
||||
},
|
||||
address : {
|
||||
allAddress : [], // 收货地址列表
|
||||
addressShow : false // 地址显示状态
|
||||
},
|
||||
disabled : false, //购买按钮状态
|
||||
}
|
||||
},
|
||||
|
||||
// 生命周期函数--监听页面加载
|
||||
onLoad(options) {
|
||||
this.rightData.rightId = options.id
|
||||
// this.code = options.code || ''
|
||||
},
|
||||
|
||||
// 生命周期函数--监听页面显示
|
||||
onShow() {
|
||||
// 存储环境-中石油活动
|
||||
getApp().globalData.envType = 'oilEnv'
|
||||
|
||||
// 获取详情
|
||||
this.rightsInfo();
|
||||
},
|
||||
methods: {
|
||||
// 详情
|
||||
rightsInfo() {
|
||||
buy({activity_petro_id: this.rightData.rightId, qty: this.rightData.num}).then(res => {
|
||||
let obj = res.detail.express
|
||||
let arr = new Array
|
||||
arr = Object.keys(obj).map(val=>{
|
||||
return { ...obj[val], ...{key: val} }
|
||||
})
|
||||
if(this.buyWay.isdeliver == -1){
|
||||
if(res.detail.type == 'physical') {
|
||||
this.buyWay.isdeliver = res.detail.def_get
|
||||
}
|
||||
if(res.detail.type == 'virtual') this.buyWay.isdeliver = 1
|
||||
}
|
||||
|
||||
this.rightData.detail = res.detail
|
||||
this.rightData.moreAmount = res.amount
|
||||
this.rightData.total = res.total
|
||||
this.buyWay.platformCp = arr
|
||||
this.rightData.freight = res.freight
|
||||
this.rightData.addressSee = res.address
|
||||
this.address.allAddress = res.all_address
|
||||
this.notice.remark = res.detail.remark.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block;"')
|
||||
this.notice.content = res.detail.content.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block;"')
|
||||
}).catch(err => {
|
||||
if (!err.login) {
|
||||
uni.showModal({
|
||||
title: '用户登录已过期',
|
||||
content: '请重新登录',
|
||||
showCancel: false,
|
||||
success: res => {
|
||||
if (res.confirm) {
|
||||
uni.redirectTo({
|
||||
url: '/pages/oil/signin'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 商品数量加减
|
||||
goodsNumber(e){
|
||||
let num = this.rightData.num
|
||||
if (e == 'plus'){
|
||||
num ++;
|
||||
}else{
|
||||
if (num > 1){
|
||||
num --;
|
||||
}else{
|
||||
uni.showToast({
|
||||
title : '商品数量不能小于1',
|
||||
icon : 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
this.rightData.num = num
|
||||
|
||||
// 获取详情
|
||||
this.rightsInfo()
|
||||
},
|
||||
|
||||
// 须知展开收起状态
|
||||
noticeTap() {
|
||||
this.notice.noticeShow = !this.notice.noticeShow
|
||||
},
|
||||
|
||||
// 收银台跳转
|
||||
payment() {
|
||||
if(this.buyWay.isdeliver.length == 0) this.buyWay.isdeliver = this.rightData.detail.def_get
|
||||
|
||||
buySubmit({activity_petro_id: this.rightData.rightId, qty: this.rightData.num, is_deliver: this.buyWay.isdeliver}).then(res => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/cashier/index?tradeNo=' + res.trade_no + '&type=oil' + "&activity_type=right" + '&price=' + this.rightData.moreAmount
|
||||
})
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title : err.message,
|
||||
icon : 'none'
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
page {
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
|
||||
/* 权益内容 */
|
||||
.cont {
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
.contBack {
|
||||
position: relative;
|
||||
width: 200%;
|
||||
height: 340rpx;
|
||||
left: -50%;
|
||||
text-align: center;
|
||||
background: #000000;
|
||||
border-radius: 0 0 100% 100%;
|
||||
overflow: hidden;
|
||||
.classBack {
|
||||
position: absolute;
|
||||
left: 28%;
|
||||
right: 30%;
|
||||
width: 44%;
|
||||
top: 40rpx;
|
||||
}
|
||||
}
|
||||
.classCircle::after,
|
||||
.contBack::before {
|
||||
position: absolute;
|
||||
border-radius: 50%;
|
||||
content: '';
|
||||
z-index: 1;
|
||||
background-color: rgba(255,255,255,.1);
|
||||
}
|
||||
.classCircle::after {
|
||||
left: 20%;
|
||||
top: -20rpx;
|
||||
width: 260rpx;
|
||||
height: 260rpx;
|
||||
}
|
||||
.contBack::before {
|
||||
right: 20%;
|
||||
top: 55%;
|
||||
width: 300rpx;
|
||||
height: 300rpx;
|
||||
}
|
||||
.rightsCont {
|
||||
position: absolute;
|
||||
z-index: 3;
|
||||
left: calc(28% - 2rpx);
|
||||
right: calc(30% - 2rpx);
|
||||
width: calc(44% + 4rpx);
|
||||
top: 50rpx;
|
||||
.welfareCont-top{
|
||||
white-space: nowrap;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-around;
|
||||
width: 100%;
|
||||
padding: 0 10rpx;
|
||||
box-sizing: border-box;
|
||||
margin: 50rpx 0 20rpx;
|
||||
height: 120rpx;
|
||||
.welfareCont-list-img {
|
||||
border-radius: 50%;
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
display: inline-block;
|
||||
margin: 0 15rpx;
|
||||
overflow: hidden;
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
.rightsCont-btn {
|
||||
background: rgba(255, 255, 0255, .4);
|
||||
width: 100%;
|
||||
line-height: 70rpx;
|
||||
font-size: 40rpx;
|
||||
font-weight: 600;
|
||||
color: #000000;
|
||||
padding: 0 20rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 数量
|
||||
.rightsNumber {
|
||||
background-color: #ffffff;
|
||||
position: relative;
|
||||
padding: 30rpx 40rpx;
|
||||
box-sizing: border-box;
|
||||
.rightsGoods-img {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
.rightsGoods {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
padding: 80rpx 40rpx 0 270rpx;
|
||||
box-sizing: border-box;
|
||||
.rightsGoods-text {
|
||||
margin-bottom: 40rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
.rightsGoods-price {
|
||||
display: flex;
|
||||
.rightsGoods-number {
|
||||
flex: 1;
|
||||
font-size: 34rpx;
|
||||
text {
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
.rightsAdd {
|
||||
display: flex;
|
||||
.rightsAdd-btn {
|
||||
border-radius: 4rpx;
|
||||
text-align: center;
|
||||
width: 50rpx;
|
||||
height: 50rpx;
|
||||
line-height: 45rpx;
|
||||
font-size: 40rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
.rightsAdd-remove {
|
||||
background: #f8f8f8;
|
||||
color: #d9d9d9;
|
||||
}
|
||||
.rightsAdd-remove.active,
|
||||
.rightsAdd-plus {
|
||||
background: #e8e4e5;
|
||||
color: #6b6768;
|
||||
}
|
||||
.rightsAdd-input {
|
||||
width: 100rpx;
|
||||
text-align: center;
|
||||
font-size: 28rpx;
|
||||
line-height: 50rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 地址
|
||||
.rightsList,
|
||||
.notice,
|
||||
.detailsStore {
|
||||
background: white;
|
||||
padding: 10rpx 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.rightsLabel,
|
||||
.rightsLabel-pay {
|
||||
display: flex;
|
||||
padding: 20rpx 40rpx;
|
||||
color: #6c6c6c;
|
||||
font-weight: 600;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
.rightsLabel-left {
|
||||
flex: 1;
|
||||
color: #747d86;
|
||||
.rightsLabel-row {
|
||||
width: 42rpx;
|
||||
height: 42rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.rightsLabel-range {
|
||||
display: flex;
|
||||
color: #000;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.rightsLabel-address {
|
||||
display: flex;
|
||||
position: relative;
|
||||
margin: 10rpx 0;
|
||||
padding: 25rpx 40rpx;
|
||||
&::after,
|
||||
&::before {
|
||||
position: absolute;
|
||||
content: '';
|
||||
left: 30rpx;
|
||||
width: calc(100% - 60rpx);
|
||||
height: 2rpx;
|
||||
background-color: #bfbfbf;
|
||||
}
|
||||
&::after {
|
||||
top: 0;
|
||||
}
|
||||
&::before {
|
||||
bottom: 0;
|
||||
}
|
||||
.rightsLabel-row {
|
||||
margin-top: 30rpx;
|
||||
}
|
||||
|
||||
.rightsLabel-icon {
|
||||
width: 70rpx;
|
||||
height: 70rpx;
|
||||
margin-top: 14rpx;
|
||||
}
|
||||
.rightsLabel-right {
|
||||
width: calc(100% - 80rpx);
|
||||
margin-left: 10rpx;
|
||||
display: flex;
|
||||
font-size: 28rpx;
|
||||
.rightsLabel-address-text {
|
||||
flex: 1;
|
||||
color: #000000;
|
||||
.rightsLabel-address-name {
|
||||
display: flex;
|
||||
font-size: 32rpx;
|
||||
margin-bottom: 10rpx;
|
||||
.rightsLabel-address-tel {
|
||||
padding-left: 30rpx;
|
||||
color: #959595;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.rightsLabel-row {
|
||||
width: 42rpx;
|
||||
height: 42rpx;
|
||||
margin: 0 0 0 6rpx;
|
||||
}
|
||||
|
||||
// 购买须知
|
||||
.notice {
|
||||
background: white;
|
||||
padding: 20rpx;
|
||||
box-sizing: border-box;
|
||||
border-top: 20rpx #eeeeee solid;
|
||||
.noticeTitle {
|
||||
display: flex;
|
||||
.noticeTitle-flex {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
font-size: 30rpx;
|
||||
line-height: 46rpx;
|
||||
.noticeTitle-img {
|
||||
width: 46rpx;
|
||||
height: 46rpx;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
}
|
||||
.noticeTitle-row {
|
||||
width: 46rpx;
|
||||
height: 46rpx;
|
||||
&.active {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
}
|
||||
}
|
||||
.noticeText {
|
||||
font-size: 26rpx;
|
||||
height: 0;
|
||||
overflow: hidden;
|
||||
&.active {
|
||||
height: auto;
|
||||
}
|
||||
.noticeText-top {
|
||||
margin: 30rpx 0 10rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
.noticeText-cont {
|
||||
line-height: 60rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.newrightsBtn {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 160rpx;
|
||||
z-index: 9;
|
||||
background: #fff;
|
||||
padding: 30rpx;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
.rightsBtn-text {
|
||||
flex: 1;
|
||||
font-weight: 600;
|
||||
font-size: 30rpx;
|
||||
.rightsBtn-text-num {
|
||||
font-size: 30rpx;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
text {
|
||||
font-size: 38rpx;
|
||||
color: #fe2d55;
|
||||
}
|
||||
}
|
||||
button {
|
||||
width: 280rpx !important;
|
||||
background-color: #000000;
|
||||
color: #ffffff;
|
||||
border-radius: 80rpx;
|
||||
height: 100rpx;
|
||||
line-height: 100rpx;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
// 选择收货地址
|
||||
.addressBack {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
background: rgba(0, 0, 0, .4);
|
||||
z-index: 10;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: none;
|
||||
&.active {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
.addressCont {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
bottom: -1000%;
|
||||
transition: .2s;
|
||||
background: #fff;
|
||||
z-index: 11;
|
||||
width: 100%;
|
||||
&.active {
|
||||
bottom: 0;
|
||||
}
|
||||
.addressCont-title {
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
display: flex;
|
||||
padding: 0 30rpx;
|
||||
box-sizing: border-box;
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
position: relative;
|
||||
&::after {
|
||||
position: absolute;
|
||||
content: '';
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 2rpx;
|
||||
background: #f3f3f3;
|
||||
}
|
||||
.addressCont-left {
|
||||
flex: 1;
|
||||
}
|
||||
.addressCont-right {
|
||||
color: #309ded;
|
||||
}
|
||||
}
|
||||
.header-classify {
|
||||
white-space: nowrap;
|
||||
box-sizing: border-box;
|
||||
height: 600rpx;
|
||||
.addressCont-list {
|
||||
padding: 30rpx 20rpx;
|
||||
box-sizing: border-box;
|
||||
font-size: 30rpx;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
&::after {
|
||||
position: absolute;
|
||||
content: '';
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
height: 2rpx;
|
||||
background: #f3f3f3;
|
||||
}
|
||||
.addressCont-top {
|
||||
display: flex;
|
||||
margin-bottom: 10rpx;
|
||||
.addressCont-name {
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
.addressCont-text {
|
||||
color: #666;
|
||||
width: calc(100% - 160rpx);
|
||||
}
|
||||
.address-tool-icon {
|
||||
width: 120rpx;
|
||||
height: 54rpx;
|
||||
line-height: 54rpx;
|
||||
border-radius: 4rpx;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
position: absolute;
|
||||
top: 45rpx;
|
||||
right: 10rpx;
|
||||
background: #dfae2e;
|
||||
transform: scale(.9, .9);
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
598
pages/oil/details.vue
Normal file
598
pages/oil/details.vue
Normal file
@@ -0,0 +1,598 @@
|
||||
<template>
|
||||
<view>
|
||||
<!-- 卡券详情 -->
|
||||
<view class="details">
|
||||
<view class="detailsTop">
|
||||
<view class="detailsTop-name">
|
||||
{{ details.name }}
|
||||
</view>
|
||||
<view class="detailsTop-time">
|
||||
有效期: {{ details.startTime }} - {{ details.endTime }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="detailsCotent">
|
||||
<view class="source">活动来源 : {{ details.activity_name }}</view>
|
||||
<view class="detailsBar">
|
||||
<view class="detailsCode-text">劵码</view>
|
||||
<image :src="barcode" mode="widthFix"></image>
|
||||
</view>
|
||||
<view class="detailsCode-text">
|
||||
{{ details.code }}
|
||||
</view>
|
||||
<view class="detailsCode">
|
||||
<image :src="qrcode" @click="refreshCode"></image>
|
||||
<view class="detailsCode-text">
|
||||
<text>请出示以上券码给网点工作人员</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="petroNew" v-if="details.right">
|
||||
<view class="petroNew-btn" v-if="details.right.from == 'petroNew'" @click="urlFrom">
|
||||
去使用
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 门店定位 -->
|
||||
<view class="detailsStore">
|
||||
<view class="detailsStore-top">
|
||||
<view class="detailsStore-title">
|
||||
适用门店
|
||||
</view>
|
||||
<navigator class="detailsStore-row" hover-class="none" :url="'/pages/store/index?id=' + details.id + '&type=campus'" v-if="longitude != 0 && latitude != 0">
|
||||
查看所有
|
||||
<image src="/static/icon/arrow_left.png"></image>
|
||||
</navigator>
|
||||
</view>
|
||||
<view class="location" v-if="longitude == 0 && latitude == 0">
|
||||
<image class="location-img" src="/static/img/location_img.jpg"></image>
|
||||
<text>您尚未授权本时生活开启定位服务</text>
|
||||
<text>不能看到附近的商家哦,点击下方按钮开启</text>
|
||||
<button class="location-btn" size="mini" open-type="openSetting">
|
||||
开启定位服务
|
||||
</button>
|
||||
</view>
|
||||
<view v-else>
|
||||
<block v-if="stores.length > 0">
|
||||
<view class="detailsStore-list" :data-id="(item.store_id)" v-for="(item, index) in stores" :key="index"
|
||||
@tap="detailsTap">
|
||||
<image :src="item.cover" class="detailsStore-logo"></image>
|
||||
<view class="detailsStore-cont">
|
||||
<view class="detailsStore-left">
|
||||
<view class="nowrap detailsStore-name">
|
||||
{{ item.title }}
|
||||
</view>
|
||||
<view class="detailsStore-place">
|
||||
<text class="nowrap">{{ item.address }}</text>
|
||||
{{ item.km }}
|
||||
</view>
|
||||
</view>
|
||||
<image class="detailsStore-tel" src="/static/icon/tel.png" @tap.stop="tel"
|
||||
:data-tel="(item.mobile)"></image>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
<block v-else>
|
||||
<view class="pages-hint">
|
||||
<image src="/static/img/null_icon.png"></image>
|
||||
<view>暂无门店</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 使用须知 -->
|
||||
<view class="detailsText">
|
||||
<view class="detailsText-title">
|
||||
使用须知
|
||||
</view>
|
||||
<view class="detailsText-tips">
|
||||
<rich-text :nodes="remark"></rich-text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 内容介绍 -->
|
||||
<view class="detailsText">
|
||||
<view class="detailsText-title">
|
||||
内容介绍
|
||||
</view>
|
||||
<view class="detailsText-tips" v-if="content != null">
|
||||
<rich-text :nodes="content"></rich-text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 底部 -->
|
||||
<view class="detailsBottom">
|
||||
<image src="/static/img/campus_details_back.png" mode="aspectFill"></image>
|
||||
<view class="detailsBottom-cont">
|
||||
<view class="detailsBottom-title">
|
||||
中石油活动
|
||||
</view>
|
||||
亿时代 - 本时生活
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { qrcode, barcode, couponinfo, merchantCard, breakCode } from '@/apis/interfaces/campus'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
id : 0, //优惠券id
|
||||
longitude : 0, //经度
|
||||
latitude : 0, //纬度
|
||||
details : '', //优惠券信息
|
||||
stores : [], //商家列表
|
||||
content : '', //内容介绍
|
||||
remark : '', //使用须知
|
||||
qrcode : '', //二维码
|
||||
barcode : '', //条形码
|
||||
merchantcardinfo:'' //商家券信息
|
||||
}
|
||||
},
|
||||
|
||||
// 生命周期函数--监听页面加载
|
||||
onLoad(options) {
|
||||
// 优惠券id
|
||||
this.id = options.id
|
||||
|
||||
// 获取二维码
|
||||
qrcode(options.id).then(res=>{
|
||||
this.qrcode = res.qrcode
|
||||
})
|
||||
|
||||
// 获取条形码
|
||||
barcode(options.id).then(res=>{
|
||||
this.barcode = res.barcode
|
||||
})
|
||||
},
|
||||
|
||||
// 生命周期函数--监听页面显示
|
||||
onShow() {
|
||||
// 获取详情信息
|
||||
this.detailsInfo();
|
||||
// 存储环境-中石油活动
|
||||
getApp().globalData.envType = 'oilEnv'
|
||||
|
||||
// 获取定位信息
|
||||
uni.getLocation({
|
||||
success: res => {
|
||||
this.latitude = res.latitude
|
||||
this.longitude = res.longitude
|
||||
},
|
||||
complete: () => {
|
||||
// 获取详情信息
|
||||
this.detailsInfo();
|
||||
}
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// 详情信息
|
||||
detailsInfo() {
|
||||
couponinfo({
|
||||
coupon_id: this.id,
|
||||
user_lng: this.longitude,
|
||||
user_lat: this.latitude
|
||||
}).then(res=>{
|
||||
console.log(res)
|
||||
let stores = res.stores
|
||||
stores.map(res=>{
|
||||
let distance = res.distance
|
||||
if(res.distance > 1000){
|
||||
distance = (distance / 1000) + "km"
|
||||
}else{
|
||||
distance = distance + "m"
|
||||
}
|
||||
res.km = distance
|
||||
})
|
||||
this.details = res.info
|
||||
this.stores = stores
|
||||
this.remark = res.info.right.remark.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block;"')
|
||||
this.content = res.info.right.content.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block;"')
|
||||
//获取商家券信息
|
||||
if(res.info.card_type=='merchant_card'){
|
||||
this.getMerchantCardInfo()
|
||||
}
|
||||
}).catch(err => {
|
||||
if (!err.login) {
|
||||
uni.showModal({
|
||||
title: '用户登录已过期',
|
||||
content: '请重新登录',
|
||||
showCancel: false,
|
||||
success: res => {
|
||||
if (res.confirm) {
|
||||
uni.redirectTo({
|
||||
url: '/pages/oil/signin'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 商家券信息
|
||||
getMerchantCardInfo(){
|
||||
merchantCard(this.id).then(res=>{
|
||||
this.merchantcardinfo = res
|
||||
}).catch(err => {
|
||||
if (!err.login) {
|
||||
uni.showModal({
|
||||
title: '用户登录已过期',
|
||||
content: '请重新登录',
|
||||
showCancel: false,
|
||||
success: res => {
|
||||
if (res.confirm) {
|
||||
uni.redirectTo({
|
||||
url: '/pages/oil/signin'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 拨打电话
|
||||
tel(e) {
|
||||
let tel = e.currentTarget.dataset.tel
|
||||
uni.showActionSheet({
|
||||
itemList : ['呼叫商家电话'],
|
||||
success : res =>{
|
||||
if(res.tapIndex==0){
|
||||
uni.makePhoneCall({
|
||||
phoneNumber: tel
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 查看门店详情页
|
||||
detailsTap(e) {
|
||||
let store_id = e.currentTarget.dataset.id,
|
||||
user_lng = this.longitude,
|
||||
user_lat = this.latitude
|
||||
uni.navigateTo({
|
||||
url: '/pages/store/details?store_id=' + store_id + '&user_lng=' + user_lng + '&user_lat=' + user_lat + '&type=campus'
|
||||
})
|
||||
},
|
||||
|
||||
// 刷新二维码
|
||||
refreshCode() {
|
||||
breakCode(this.id).then(res=>{
|
||||
uni.showToast({
|
||||
title: '刷新中',
|
||||
duration: 1000,
|
||||
icon:'loading'
|
||||
});
|
||||
this.qrcode = res.qrcode
|
||||
}).catch(err => {
|
||||
if (!err.login) {
|
||||
uni.showModal({
|
||||
title: '用户登录已过期',
|
||||
content: '请重新登录',
|
||||
showCancel: false,
|
||||
success: res => {
|
||||
if (res.confirm) {
|
||||
uni.redirectTo({
|
||||
url: '/pages/oil/signin'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
urlFrom () {
|
||||
// #ifdef H5
|
||||
window.location.href = "https://cloud1-0g37c0kwb91b41c8-1305411715.tcloudbaseapp.com/"
|
||||
// #endif
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
page {
|
||||
background-color: #e83241;
|
||||
padding: 20rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* 卡券详情 */
|
||||
.details {
|
||||
background: #ffffff;
|
||||
margin: 20rpx 20rpx 0;
|
||||
width: calc(100% - 40rpx);
|
||||
box-shadow: 0 0 20rpx rgba(0, 0,0, .1);
|
||||
position: relative;
|
||||
border-radius: 0 0 20rpx 20rpx;
|
||||
border-bottom: 240rpx solid transparent;
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.details::after,
|
||||
.details::before {
|
||||
position: absolute;
|
||||
background: #e83241;
|
||||
content: '';
|
||||
top: -50rpx;
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.details::after {
|
||||
left: -50rpx;
|
||||
}
|
||||
|
||||
.details::before {
|
||||
right: -50rpx;
|
||||
}
|
||||
|
||||
.detailsCotent {
|
||||
padding: 40rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.detailsTop {
|
||||
border-bottom: 2rpx dashed #c8c8c8;
|
||||
padding: 40rpx 0;
|
||||
text-align: center;
|
||||
box-sizing: border-box;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
.detailsTop-name {
|
||||
font-size: 38rpx;
|
||||
font-weight: 600;
|
||||
margin-bottom: 20rpx;
|
||||
padding: 0 60rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.detailsTop-time {
|
||||
color: #7e7e7e;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.detailsCode {
|
||||
text-align: center;
|
||||
padding: 0 0 20rpx;
|
||||
box-sizing: border-box;
|
||||
margin: 40rpx 0 20rpx;
|
||||
}
|
||||
|
||||
.detailsCode image {
|
||||
width: 300rpx;
|
||||
height: 300rpx;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.detailsCode-text, .detailsStore-row {
|
||||
color: #949494;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.detailsCode-text {
|
||||
text-align: center;
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.detailsCode-text text {
|
||||
color: #999;
|
||||
font-weight: normal;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.detailsStore {
|
||||
border-top: 2rpx #c8c8c8 solid;
|
||||
padding-top: 40rpx;
|
||||
}
|
||||
|
||||
.detailsStore-top, .detailsStore-row {
|
||||
display: flex;
|
||||
line-height: 30rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.detailsStore-title {
|
||||
flex: 1;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.detailsStore-row image {
|
||||
width: 26rpx;
|
||||
height: 26rpx;
|
||||
margin: 3rpx 0 0 6rpx;
|
||||
}
|
||||
|
||||
.detailsStore-list {
|
||||
position: relative;
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
|
||||
.detailsStore-list:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.detailsStore-logo {
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
|
||||
.detailsStore-cont {
|
||||
position: absolute;
|
||||
left: 130rpx;
|
||||
top: 0;
|
||||
width: calc(100% - 130rpx);
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.detailsStore-left {
|
||||
width: calc(100% - 90rpx);
|
||||
margin-right: 30rpx;
|
||||
}
|
||||
|
||||
.detailsStore-tel {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
margin-top: 25rpx;
|
||||
}
|
||||
|
||||
.detailsStore-place {
|
||||
font-size: 24rpx;
|
||||
line-height: 40rpx;
|
||||
color: #5a5a5a;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.detailsStore-place text {
|
||||
flex: 1;
|
||||
display: inline-block;
|
||||
font-size: 28rpx;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.detailsStore-name {
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.detailsText {
|
||||
padding: 30rpx 30rpx 0;
|
||||
box-sizing: border-box;
|
||||
border-top: 2rpx solid #ececec;
|
||||
}
|
||||
|
||||
.detailsText-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.detailsText-tips {
|
||||
font-size: 26rpx;
|
||||
line-height: 50rpx;
|
||||
color: #555557;
|
||||
padding-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.detailsCode-join {
|
||||
color: #ee8e44;
|
||||
font-size: 24rpx;
|
||||
border-radius: 50rpx;
|
||||
border: 2rpx solid #ee8e44;
|
||||
padding: 10rpx 20rpx;
|
||||
display: inline-block;
|
||||
margin-top: 30rpx;
|
||||
}
|
||||
|
||||
.detailsCode-join.active {
|
||||
border: 2rpx solid #999;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.source{
|
||||
margin: 30rpx 0;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.location {
|
||||
background: white;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
margin: 60rpx 0 0;
|
||||
}
|
||||
|
||||
.location text {
|
||||
font-size: 28rpx;
|
||||
display: block;
|
||||
line-height: 46rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.location-btn[size="mini"] {
|
||||
background-color: #ee8e44;
|
||||
color: #fff;
|
||||
font-size: 26rpx;
|
||||
line-height: 66rpx;
|
||||
margin-top: 30rpx;
|
||||
}
|
||||
|
||||
.location-img {
|
||||
width: 150rpx;
|
||||
height: 120rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.detailsBar {
|
||||
text-align: center;
|
||||
padding: 0 50rpx;
|
||||
box-sizing: border-box;
|
||||
margin-top: 60rpx;
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
|
||||
|
||||
.detailsBar image {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.detailsBar .detailsCode-text {
|
||||
margin-bottom: 10px;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.detailsBottom {
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
height: 220rpx;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
z-index: 9;
|
||||
}
|
||||
.detailsBottom image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.detailsBottom-cont {
|
||||
z-index: 10;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 70rpx;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
color: #9a9a9a;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.detailsBottom-title {
|
||||
font-weight: 600;
|
||||
margin-bottom: 20rpx;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
.petroNew {
|
||||
text-align: center;
|
||||
}
|
||||
.petroNew-btn {
|
||||
background-color: #ee8e44;
|
||||
color: #fff;
|
||||
font-size: 26rpx;
|
||||
line-height: 72rpx;
|
||||
border-radius: 6rpx;
|
||||
margin: 0 auto 50rpx;
|
||||
text-align: center;
|
||||
width: 50%;
|
||||
}
|
||||
</style>
|
||||
266
pages/oil/index.vue
Normal file
266
pages/oil/index.vue
Normal file
@@ -0,0 +1,266 @@
|
||||
<template>
|
||||
<view>
|
||||
<navigator v-for="(item, idx) in adverts" :key="item.cover" :url="item.url">
|
||||
<image class="campusBanner" :src="item.cover" mode="widthFix"></image>
|
||||
</navigator>
|
||||
<view class="recommend"></view>
|
||||
<view class="film" v-for="(item, index) in oilCategories" :key="index">
|
||||
<block v-if="item.petros.length > 0">
|
||||
<view class="filmTitle">
|
||||
{{item.title}}
|
||||
</view>
|
||||
<navigator hover-class="none" :url="'/pages/oil/buy?id=' + items.activity_petro_id" class="filmList" v-for="(items, indexItem) in item.petros" :key="indexItem">
|
||||
<view class="filmList-top">
|
||||
<view class="filmList-top-name">
|
||||
{{ items.three_title || '-' }}<text>{{ items.two_title || '-'}}</text>
|
||||
</view>
|
||||
<view class="filmList-top-price">
|
||||
<view v-if="items.button_text != null">
|
||||
<view v-for="(btnItem, btnIndex) in items.button_text" :key="btnIndex">{{btnItem}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="filmList-text" v-for="(itemsDes, indexDes) in items.description" :key="indexDes">
|
||||
<text>{{ itemsDes }}</text>
|
||||
</view>
|
||||
<view class="filmList-tag" v-if="items.label != null"> <view class="filmList-tag-text">{{items.label || '-'}}</view></view>
|
||||
</navigator>
|
||||
</block>
|
||||
</view>
|
||||
|
||||
<!-- 按钮 -->
|
||||
<view @click="userNav('/pages/oil/myCoupon')" class="campusBtn">我的优惠券<text>立即查看</text></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { index } from '@/apis/interfaces/oil'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
oilCategories: '',
|
||||
topData : '', // 头部推荐
|
||||
oilMarket : [], // 中石油优惠券
|
||||
oilPetro : [], // 超市购物券
|
||||
adverts : ''
|
||||
}
|
||||
},
|
||||
|
||||
// 生命周期函数--监听页面加载
|
||||
onLoad(options) {},
|
||||
|
||||
// 生命周期函数--监听页面显示
|
||||
onShow() {
|
||||
// 存储环境-中石油新活动
|
||||
getApp().globalData.envType = 'oilEnv'
|
||||
|
||||
// 获取首页数据
|
||||
this.indexInfo();
|
||||
},
|
||||
methods: {
|
||||
// 首页数据
|
||||
indexInfo() {
|
||||
index().then(res=>{
|
||||
this.oilCategories = res.categories
|
||||
this.adverts = res.adverts
|
||||
}).catch(err=>{
|
||||
// if (!err.login) {
|
||||
// uni.showModal({
|
||||
// title: '用户登录已过期',
|
||||
// content: '请重新登录',
|
||||
// showCancel: false,
|
||||
// success: res => {
|
||||
// if (res.confirm) {
|
||||
// uni.redirectTo({
|
||||
// url: '/pages/oil/signin'
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
})
|
||||
},
|
||||
|
||||
// 处理未登录时的转跳
|
||||
userNav(url){
|
||||
let pageUrl = url
|
||||
if(uni.getStorageSync("token")) {
|
||||
uni.navigateTo({
|
||||
url: pageUrl
|
||||
})
|
||||
return
|
||||
}
|
||||
// 去登录
|
||||
uni.navigateTo({
|
||||
url: '/pages/oil/signin'
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
page {
|
||||
background: linear-gradient(to bottom, #fdf5cc, #cbaf7f);
|
||||
padding-bottom: 100rpx;
|
||||
}
|
||||
|
||||
// banner
|
||||
.campusBanner {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
// 推荐
|
||||
.recommend {
|
||||
overflow: hidden;
|
||||
margin-top: -60rpx;
|
||||
padding: 0 30rpx;
|
||||
box-sizing: border-box;
|
||||
.recommend-label {
|
||||
text-align: center;
|
||||
width: calc(50% - 20rpx);
|
||||
float: left;
|
||||
margin: 0 10rpx 30rpx;
|
||||
.recommend-label-img {
|
||||
width: 150rpx;
|
||||
height: 150rpx;
|
||||
margin: 0 auto 10rpx;
|
||||
background: linear-gradient(to bottom, #293350, #484e74);
|
||||
box-shadow: 0px 8px 6px rgba(249,228,129,.5);
|
||||
border-radius: 50%;
|
||||
box-sizing: border-box;
|
||||
image {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
margin: 35rpx;
|
||||
}
|
||||
}
|
||||
.recommend-label-text {
|
||||
font-weight: 600;
|
||||
text {
|
||||
display: block;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 列表
|
||||
.film {
|
||||
width: 100%;
|
||||
padding: 10rpx 30rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.filmTitle {
|
||||
background: linear-gradient(to right, #feefce, #fbe9c0, #e8d19b);
|
||||
line-height: 80rpx;
|
||||
box-shadow: -4px 0 10px rgba(134,97,33,.2);
|
||||
text-align: center;
|
||||
border-radius: 10rpx 10rpx 0 0;
|
||||
color: #a47d53;
|
||||
font-weight: 600;
|
||||
margin: 0 20rpx;
|
||||
}
|
||||
.filmList {
|
||||
position: relative;
|
||||
background: linear-gradient(to right, #494e75, #27314d);
|
||||
box-shadow: 0px 6px 10px rgba(134,97,33,.5);
|
||||
border-radius: 10rpx;
|
||||
padding: 50rpx 30rpx 30rpx;
|
||||
box-sizing: border-box;
|
||||
margin-bottom: 20rpx;
|
||||
overflow: hidden;
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.filmList-tag {
|
||||
transform: rotate(45deg);
|
||||
position: absolute;
|
||||
padding: 10px 0;
|
||||
right: -33px;
|
||||
top: -10px;
|
||||
width: 150px;
|
||||
background: red;
|
||||
.filmList-tag-text {
|
||||
position: absolute;
|
||||
color: #FFFFFF;
|
||||
right: 20px;
|
||||
text-align: center;
|
||||
top: 2px;
|
||||
font-size: 12px;;
|
||||
transform:rotate(-360deg);
|
||||
}
|
||||
}
|
||||
.filmList-top {
|
||||
display: flex;
|
||||
margin-bottom: 10rpx;
|
||||
.filmList-top-name {
|
||||
width: calc(100% - 160rpx);
|
||||
margin-right: 20rpx;
|
||||
color: #fce2ae;
|
||||
font-size: 34rpx;
|
||||
font-weight: bold;
|
||||
text {
|
||||
display: block;
|
||||
font-size: 25rpx;
|
||||
margin-top: 10rpx;
|
||||
font-weight: normal;
|
||||
}
|
||||
}
|
||||
.filmList-top-price {
|
||||
position: relative;
|
||||
background: linear-gradient(to right, #d3ad68, #cda65f);
|
||||
box-shadow: 0px 2px 10px rgba(249,228,129,.5);
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
border-radius: 50%;
|
||||
color: #FFFFFF;
|
||||
text-align: center;
|
||||
padding-top: 20rpx;
|
||||
font-size: 30rpx;
|
||||
box-sizing: border-box;
|
||||
text {
|
||||
display: block;
|
||||
text-shadow: 0px 6px 10px rgba(134,97,33,.5);
|
||||
}
|
||||
.filmList-tag{
|
||||
position: absolute;
|
||||
background: #ff0000;
|
||||
color: white;
|
||||
font-size: 20rpx;
|
||||
top: -10%;
|
||||
left: 20%;
|
||||
width: 120rpx;
|
||||
padding: 0 10rpx;
|
||||
line-height: 40rpx;
|
||||
border-radius: 15rpx;
|
||||
transform: scale(0.58)
|
||||
}
|
||||
}
|
||||
}
|
||||
.filmList-text {
|
||||
font-size: 20rpx;
|
||||
color: #c1c1c1;
|
||||
// margin-left: -70rpx;
|
||||
text {
|
||||
display: block;
|
||||
// transform: scale(0.8)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 按钮
|
||||
.campusBtn {
|
||||
background: linear-gradient(to right, #474d73, #28314e);
|
||||
box-shadow: 0px 6px 10px rgba(188,152,90,.5);
|
||||
border-radius: 60rpx;
|
||||
line-height: 90rpx;
|
||||
height: 90rpx;
|
||||
margin: 30rpx 60rpx 0;
|
||||
text-align: center;
|
||||
color: #FFFFFF;
|
||||
text {
|
||||
color: #bd9045;
|
||||
padding-left: 20rpx;
|
||||
}
|
||||
}
|
||||
653
pages/oil/myCoupon.vue
Normal file
653
pages/oil/myCoupon.vue
Normal file
@@ -0,0 +1,653 @@
|
||||
<template>
|
||||
<view>
|
||||
<image class="campusCoupon" src="/static/img/oilCoupon_img.png" mode="widthFix"></image>
|
||||
<view class="user">
|
||||
<image src="/static/img/campusCoupon_user.png" mode=""></image> 尊敬的<text>{{ userTel }}</text>, 欢迎参加联通优惠活动
|
||||
</view>
|
||||
<!-- 我的卡券 -->
|
||||
<view class="borderContent">
|
||||
<view class="campusCont">
|
||||
<!-- 卡券tab -->
|
||||
<view class="couponTab">
|
||||
<view class="couponTab-label" :class="{active : stateType == item.used}" @tap="orderTab" v-for="(item, index) in couponLabel" :key="index" :data-index="(index)" :data-state="(item.used)">
|
||||
{{ item.title }}
|
||||
<view v-if="item.used == 0">({{count.init}}张)</view>
|
||||
<view v-else-if="item.used == 1">({{count.used}}张)</view>
|
||||
<view v-else>({{ count.pass }}张)</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 卡券列表 -->
|
||||
<view class="coupon" v-if="coupons.length > 0" :class="{active : coupons.length < 1}">
|
||||
<view class="couponCont" :class="{active : item.status != 0}" v-for="(item, index) in coupons" :key="index">
|
||||
<view hover-class="none" class="couponList" @tap="couponUrl" :data-id="(item.coupon_id)">
|
||||
<view class="couponList-left">
|
||||
<image class="couponList-img" src="/static/img/coupon_coupon_img.png"></image>
|
||||
<!-- 优惠券 -->
|
||||
<view class="couponList-icon" v-if="item.type == 'physical'">
|
||||
<image src="/static/img/coupon_icon_01.png"></image>
|
||||
</view>
|
||||
|
||||
<!-- 实物 -->
|
||||
<view class="couponList-icon" v-else>
|
||||
<image src="/static/img/coupon_icon_00.png"></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="couponList-center" :class="{active : item.used_at != '' || item.status == 0}">
|
||||
<view class="nowrap couponList-title">{{ item.name }}</view>
|
||||
<view class="nowrap couponList-used" v-if="item.status == 0">活动来源: {{item.activity_name}}</view>
|
||||
<view class="couponList-time">{{ item.startTime }} 至 {{ item.endTime }}</view>
|
||||
<view class="couponList-used" v-if="item.used_at != ''">使用时间:{{item.used_at}}</view>
|
||||
</view>
|
||||
<block v-if="item.status == 0">
|
||||
<view class="couponList-right">
|
||||
去使用
|
||||
</view>
|
||||
</block>
|
||||
<image v-if="item.status == 1" src="/static/img/coupon_tips_00.png" class="coupoTips"></image>
|
||||
<image v-if="item.status == 2" src="/static/img/coupon_tips_01.png" class="coupoTips"></image>
|
||||
</view>
|
||||
<view class="couponMore" v-if="item.count > 1" >
|
||||
<view class="couponMore-text" @tap="couponTap" :data-id="(item.activityId)" :data-status="(item.status)">
|
||||
<view class="couponMore-title">查看全部{{ item.count }}张卡券</view>
|
||||
<image class="couponMore-arrow" src="/static/icon/arrow_left.png"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 优惠券为空 -->
|
||||
<view class="campus_tips" v-else>
|
||||
<image src="/static/img/coupon_tips.png"></image>
|
||||
<view>暂无优惠券</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 底部快捷导航 -->
|
||||
<view class="navFooter">
|
||||
<navigator hover-class="none" url="/pages/oil/index" class="navFooter-label">
|
||||
<image src="/static/icon/navFooter_icon_00.png" mode=""></image>
|
||||
活动中心
|
||||
</navigator>
|
||||
<view class="navFooter-label active">
|
||||
<image src="/static/icon/navFooter_icon_01_active.png" mode=""></image>
|
||||
我的优惠券
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 漂浮窗 -->
|
||||
<view class="indexFloat" @click="followBtn">
|
||||
<image src="/static/img/subscribe.jpg" mode="aspectFill" class="indexFloat-animation"></image>
|
||||
<view class="indexFloat-text">
|
||||
<!-- <text>可查看大图</text> -->
|
||||
<text>关注小程序</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 关注公众号弹出 -->
|
||||
<view class="followBack" :class="{active : followState}"></view>
|
||||
<view class="followPop" :class="{active : followState}">
|
||||
<image class="followPop-img" src="/static/img/subscribe.jpg" mode="widthFix"></image>
|
||||
<view class="followPop-text">
|
||||
<text>长按识别图中二维码</text>
|
||||
<image src="/static/img/follow_tips.png" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="followPop-tips">
|
||||
本时生活平台优惠活动
|
||||
</view>
|
||||
</view>
|
||||
<image class="followPop-clos" :class="{active : followState}" src="/static/icon/add.png" mode="aspectFill" @click="followBtn"></image>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { index } from '@/apis/interfaces/user'
|
||||
import { coupon } from '@/apis/interfaces/campus'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
userTel : '', //用户者手机号
|
||||
coupons : [], //优惠券列表
|
||||
count : '', //优惠券-张数
|
||||
//优惠券Tab列表
|
||||
couponLabel : [
|
||||
{ title : "未使用", used: 0 },
|
||||
{ title : "已使用", used: 1 },
|
||||
{ title : "已过期", used: 2 }
|
||||
],
|
||||
stateType : '0', //卡券状态
|
||||
type : '', //卡券来源
|
||||
followState : false //二维码弹出状态
|
||||
}
|
||||
},
|
||||
|
||||
// 生命周期函数--监听页面加载
|
||||
onLoad(options) {
|
||||
// 获取用户信息
|
||||
index().then(res => {
|
||||
this.userTel = res.info.username
|
||||
}).catch(err => {
|
||||
if (!err.login) {
|
||||
uni.showModal({
|
||||
title: '用户登录已过期',
|
||||
content: '请重新登录',
|
||||
showCancel: false,
|
||||
success: res => {
|
||||
if (res.confirm) {
|
||||
uni.redirectTo({
|
||||
url: '/pages/oil/signin'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 生命周期函数--监听页面显示
|
||||
onShow() {
|
||||
// 存储环境-中石油活动
|
||||
getApp().globalData.envType = 'oilEnv'
|
||||
|
||||
// 获取列表
|
||||
this.couponInfo();
|
||||
},
|
||||
methods: {
|
||||
// 卡券列表
|
||||
couponInfo() {
|
||||
coupon({
|
||||
status: this.stateType,
|
||||
type: 'school'
|
||||
}).then(res=>{
|
||||
this.count = res.count
|
||||
this.coupons = res.list
|
||||
}).catch(err => {
|
||||
if (!err.login) {
|
||||
uni.showModal({
|
||||
title: '用户登录已过期',
|
||||
content: '请重新登录',
|
||||
showCancel: false,
|
||||
success: res => {
|
||||
if (res.confirm) {
|
||||
wx.redirectTo({
|
||||
url: '/pages/oil/signin'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// tabs 选项卡
|
||||
orderTab(e){
|
||||
if(this.stateType != e.currentTarget.dataset.state){
|
||||
this.stateType = e.currentTarget.dataset.state
|
||||
// 获取卡权益
|
||||
this.couponInfo()
|
||||
}
|
||||
},
|
||||
|
||||
// 查看优惠券分组
|
||||
couponTap(e) {
|
||||
let id = e.currentTarget.dataset.id,
|
||||
status = e.currentTarget.dataset.status
|
||||
uni.navigateTo({
|
||||
url: '/pages/oil/myList?id=' + id + '&status=' + status
|
||||
})
|
||||
},
|
||||
|
||||
// 优惠券跳转详情
|
||||
couponUrl(e) {
|
||||
let newId = e.currentTarget.dataset.id
|
||||
uni.navigateTo({
|
||||
url: '/pages/oil/details?id=' + newId
|
||||
})
|
||||
},
|
||||
|
||||
// 公众号展示
|
||||
followBtn() {
|
||||
this.followState = !this.followState
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.campusCoupon {
|
||||
width: 100vw;
|
||||
}
|
||||
|
||||
page {
|
||||
background-color: #c32631;
|
||||
}
|
||||
|
||||
/* 用户信息 */
|
||||
.user {
|
||||
width: 100%;
|
||||
background: linear-gradient(to right, #f9ecb7, #eed276);
|
||||
font-size: 28rpx;
|
||||
padding: 20rpx;
|
||||
box-sizing: border-box;
|
||||
color: #da2025;
|
||||
display: flex;
|
||||
line-height: 48rpx;
|
||||
}
|
||||
|
||||
.user text {
|
||||
font-weight: 600;
|
||||
padding: 0 10rpx;
|
||||
}
|
||||
|
||||
.user image {
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
/* 优惠券 */
|
||||
.borderContent {
|
||||
border-bottom: 140rpx solid transparent;
|
||||
}
|
||||
|
||||
.campusCont {
|
||||
background-color: #e83241;
|
||||
margin: 30rpx 20rpx;
|
||||
border-radius: 20rpx;
|
||||
padding: 20rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.campusCont.active {
|
||||
border-bottom: 140rpx solid transparent;
|
||||
}
|
||||
|
||||
.couponTab{
|
||||
background-color: #d32838;
|
||||
color: #ffffff;
|
||||
display: flex;
|
||||
padding: 20rpx 40rpx 0;
|
||||
box-sizing: border-box;
|
||||
border-radius: 20rpx 20rpx 0 0;
|
||||
}
|
||||
|
||||
.couponTab-label {
|
||||
flex: 3;
|
||||
text-align: center;
|
||||
position: relative;
|
||||
padding: 10rpx 20rpx;
|
||||
box-sizing: border-box;
|
||||
font-size: 30rpx;
|
||||
border-radius: 20rpx 20rpx 0 0;
|
||||
}
|
||||
|
||||
.couponTab-label.active {
|
||||
background-color: #fdf4ed;
|
||||
color: #b9505f;
|
||||
}
|
||||
|
||||
.couponTab-label view {
|
||||
font-size: 24rpx;
|
||||
margin-top: 6rpx;
|
||||
}
|
||||
|
||||
.coupon {
|
||||
padding-bottom: 10rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.couponCont {
|
||||
margin: 0 0 30rpx;
|
||||
width: 100%;
|
||||
border-radius: 10rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.couponCont:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.couponList {
|
||||
background: #fdf4ed;
|
||||
width: 100%;
|
||||
height: 160rpx;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.couponList-left {
|
||||
position: relative;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
}
|
||||
|
||||
.couponList-img {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.couponList-icon {
|
||||
position: absolute;
|
||||
left: calc(50% - 56rpx);
|
||||
top: calc(50% - 50rpx);
|
||||
z-index: 2;
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
background: #fff;
|
||||
border-radius: 50%;
|
||||
padding: 20rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.couponList-icon image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.couponList-center {
|
||||
position: absolute;
|
||||
left: 180rpx;
|
||||
top: 35rpx;
|
||||
width: calc(100% - 330rpx);
|
||||
}
|
||||
|
||||
.couponList-center.active {
|
||||
top: 15rpx;
|
||||
}
|
||||
|
||||
.couponList-title {
|
||||
margin-bottom: 10rpx;
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
color: #743e3e;
|
||||
}
|
||||
|
||||
.couponList-time,
|
||||
.couponList-used {
|
||||
font-size: 24rpx;
|
||||
color: grey;
|
||||
}
|
||||
|
||||
.couponList-used {
|
||||
margin-bottom: 14rpx;
|
||||
color: #855757;
|
||||
}
|
||||
|
||||
.couponList-right {
|
||||
background: transparent;
|
||||
border: 2rpx solid #fc9f36;
|
||||
color: #f39124;
|
||||
border-radius: 30rpx;
|
||||
width: 110rpx;
|
||||
text-align: center;
|
||||
height: 50rpx;
|
||||
line-height: 50rpx;
|
||||
position: absolute;
|
||||
right: 20rpx;
|
||||
top: 55rpx;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.couponList-right.active {
|
||||
background: #dddddd;
|
||||
}
|
||||
|
||||
.couponMore {
|
||||
font-size: 28rpx;
|
||||
color: #686868;
|
||||
position: relative;
|
||||
height: 120rpx;
|
||||
}
|
||||
|
||||
.couponMore::after,
|
||||
.couponMore::before {
|
||||
position: absolute;
|
||||
content: '';
|
||||
height: 20rpx;
|
||||
border-radius: 10rpx;
|
||||
background: #fff;
|
||||
box-shadow: 0 0 20rpx rgba(0, 0, 0, .1);
|
||||
z-index: 1;
|
||||
height: 30rpx;
|
||||
}
|
||||
|
||||
.couponMore::after {
|
||||
width: calc(100% - 40rpx);
|
||||
top: 70rpx;
|
||||
left: 20rpx;
|
||||
}
|
||||
|
||||
.couponMore::before {
|
||||
width: calc(100% - 80rpx);
|
||||
top: 90rpx;
|
||||
left: 40rpx;
|
||||
}
|
||||
|
||||
.couponMore-text {
|
||||
display: flex;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
z-index: 99;
|
||||
height: 80rpx;
|
||||
border-radius: 0 0 10rpx 10rpx;
|
||||
line-height: 80rpx;
|
||||
padding: 0 30rpx;
|
||||
box-sizing: border-box;
|
||||
background: #fff;
|
||||
box-shadow: 0 0 10rpx rgba(0, 0, 0, .1);
|
||||
}
|
||||
|
||||
.couponMore-title {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.couponMore-arrow {
|
||||
width: 28rpx;
|
||||
height: 28rpx;
|
||||
margin-top: 26rpx;
|
||||
}
|
||||
|
||||
.couponCont.active .couponList-img,
|
||||
.couponCont.active .couponList-icon {
|
||||
-webkit-filter: grayscale(100%);
|
||||
-moz-filter: grayscale(100%);
|
||||
-ms-filter: grayscale(100%);
|
||||
-o-filter: grayscale(100%);
|
||||
filter: grayscale(100%);
|
||||
filter: gray;
|
||||
}
|
||||
|
||||
.coupoTips {
|
||||
position: absolute;
|
||||
top: 22rpx;
|
||||
right: 20rpx;
|
||||
z-index: 99;
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
}
|
||||
|
||||
.campus_tips {
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
background-color: #ffffff;
|
||||
border-radius: 0 0 20rpx 20rpx;
|
||||
padding: 80rpx 0;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.campus_tips image {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
/* 底部快捷导航 */
|
||||
.navFooter {
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
height: 110rpx;
|
||||
background-color: #FFFFFF;
|
||||
z-index: 1000;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
font-size: 26rpx;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.navFooter-label {
|
||||
flex: 2;
|
||||
text-align: center;
|
||||
width: 50%;
|
||||
color: #a2a2a2;
|
||||
}
|
||||
|
||||
.navFooter-label.active {
|
||||
color: #c32631;
|
||||
}
|
||||
|
||||
.navFooter-label image {
|
||||
width: 54rpx;
|
||||
height: 54rpx;
|
||||
display: block;
|
||||
margin: 8rpx auto 0;
|
||||
}
|
||||
|
||||
|
||||
/* 漂浮弹出层 */
|
||||
.indexFloat {
|
||||
position: fixed;
|
||||
right: 20rpx;
|
||||
bottom: 180rpx;
|
||||
z-index: 99;
|
||||
}
|
||||
|
||||
.indexFloat-text {
|
||||
height: 40rpx;
|
||||
overflow: hidden;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.indexFloat-text text {
|
||||
line-height: 40rpx;
|
||||
display: block;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.indexFloat-animation {
|
||||
width: 130rpx;
|
||||
height: 130rpx;
|
||||
animation: shake 3s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes shake {
|
||||
70%, 80% {
|
||||
transform: rotate(7deg);
|
||||
}
|
||||
75% {
|
||||
transform: rotate(-7deg);
|
||||
}
|
||||
|
||||
65%,
|
||||
85% {
|
||||
transform: rotate(0);
|
||||
}
|
||||
}
|
||||
|
||||
/* 关注公众号弹出 */
|
||||
.followBack {
|
||||
position: fixed;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
background: rgba(0,0,0,.7);
|
||||
left: 0;
|
||||
top: 0;
|
||||
z-index: 1000;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.followBack.active {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.followPop {
|
||||
position: fixed;
|
||||
z-index: 1001;
|
||||
height: 760rpx;
|
||||
left: 15%;
|
||||
right: 15%;
|
||||
top: 300rpx;
|
||||
background-color: #ffffff;
|
||||
border-radius: 20rpx;
|
||||
text-align: center;
|
||||
overflow: hidden;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.followPop.active {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.followPop-img {
|
||||
width: 70%;
|
||||
margin: 60rpx 0 50rpx;
|
||||
}
|
||||
|
||||
.followPop-text {
|
||||
color: #7d7d7d;
|
||||
font-size: 32rpx;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.followPop-text::after,
|
||||
.followPop-text::before {
|
||||
position: absolute;
|
||||
content: '';
|
||||
top: 25rpx;
|
||||
width: 60rpx;
|
||||
height: 2rpx;
|
||||
background-color: #cfcfcf;
|
||||
}
|
||||
|
||||
.followPop-text::after {
|
||||
left: 30rpx;
|
||||
}
|
||||
|
||||
.followPop-text::before {
|
||||
right: 30rpx;
|
||||
}
|
||||
|
||||
.followPop-text image {
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
margin: 10rpx auto 20rpx;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.followPop-tips {
|
||||
background-color: #e1e5ec;
|
||||
line-height: 90rpx;
|
||||
color: #7f8487;
|
||||
}
|
||||
|
||||
.followPop-clos {
|
||||
position: fixed;
|
||||
top: 1100rpx;
|
||||
left: calc(50% - 25rpx);
|
||||
width: 50rpx;
|
||||
height: 50rpx;
|
||||
z-index: 1001;
|
||||
display: none;
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
|
||||
.followPop-clos.active {
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
315
pages/oil/myList.vue
Normal file
315
pages/oil/myList.vue
Normal file
@@ -0,0 +1,315 @@
|
||||
<template>
|
||||
<view>
|
||||
<!-- 我的卡券列表 -->
|
||||
<view class="coupon" v-if="couponArr.length > 0">
|
||||
<view class="couponCont" :class="{active : item.status != 0}" v-for="(item, index) in couponArr" :key="index">
|
||||
<view hover-class="none" class="couponList" @tap="couponUrl" :data-id="(item.id)">
|
||||
<view class="couponList-left">
|
||||
<image class="couponList-img" src="/static/img/coupon_coupon_img.png"></image>
|
||||
<!-- 优惠券 -->
|
||||
<view class="couponList-icon" v-if="item.type == 'physical'">
|
||||
<image src="/static/img/coupon_icon_01.png"></image>
|
||||
</view>
|
||||
|
||||
<!-- 实物 -->
|
||||
<view class="couponList-icon" v-else>
|
||||
<image src="/static/img/coupon_icon_00.png"></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="couponList-center" :class="{active : item.used_at != '' || item.status == 0}">
|
||||
<view class="nowrap couponList-title">{{ item.name }}</view>
|
||||
<view class="nowrap couponList-used" v-if="item.status == 0">活动来源: {{item.activity_name}}</view>
|
||||
<view class="couponList-time">{{ item.startTime }} 至 {{ item.endTime }}</view>
|
||||
<view class="couponList-used" v-if="item.used_at != ''">使用时间:{{item.used_at}}</view>
|
||||
</view>
|
||||
<block v-if="item.status == 0">
|
||||
<view class="couponList-right">
|
||||
去使用
|
||||
</view>
|
||||
</block>
|
||||
<image v-if="item.status == 1" src="/static/img/coupon_tips_00.png" class="coupoTips"></image>
|
||||
<image v-if="item.status == 2" src="/static/img/coupon_tips_01.png" class="coupoTips"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 优惠券为空 -->
|
||||
<view class="pack-center pages-hint" v-else>
|
||||
<image src="/static/img/coupon_tips.png"></image>
|
||||
<view>暂无优惠券</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { couponArr } from '@/apis/interfaces/user'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
couponArr : '', //卡券组列表
|
||||
id : '', //优惠券携带id
|
||||
status : '', //优惠券携带状态
|
||||
page : 1, //分页
|
||||
lodingStats : false //加载状态
|
||||
}
|
||||
},
|
||||
|
||||
// 生命周期函数--监听页面加载
|
||||
onLoad(options) {
|
||||
this.id = options.id
|
||||
this.status = options.status
|
||||
},
|
||||
|
||||
// 生命周期函数--监听页面显示
|
||||
onShow() {
|
||||
// 存储环境-中石油活动
|
||||
getApp().globalData.envType = 'oilEnv'
|
||||
|
||||
// 获取卡券组列表
|
||||
this.couponInfo();
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 卡券列表
|
||||
couponInfo(page) {
|
||||
couponArr({
|
||||
activityId: this.id,
|
||||
status: this.status,
|
||||
page: page || ''
|
||||
}).then(res=>{
|
||||
let listArr = this.couponArr,
|
||||
newData = []
|
||||
if(page == 1 || page == undefined) listArr = []
|
||||
|
||||
newData = listArr.concat(res.data)
|
||||
this.couponArr = newData
|
||||
this.page = res.page
|
||||
this.lodingStats = false
|
||||
uni.stopPullDownRefresh()
|
||||
}).catch(err => {
|
||||
if (!err.login) {
|
||||
uni.showModal({
|
||||
title: '用户登录已过期',
|
||||
content: '请重新登录',
|
||||
showCancel: false,
|
||||
success: res => {
|
||||
if (res.confirm) {
|
||||
uni.redirectTo({
|
||||
url: '/pages/oil/signin'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 优惠券跳转
|
||||
couponUrl(e) {
|
||||
let newId = e.currentTarget.dataset.id
|
||||
uni.navigateTo({
|
||||
url: '/pages/oil/details?id=' + newId
|
||||
})
|
||||
},
|
||||
|
||||
// 页面相关事件处理函数--监听用户下拉动作
|
||||
onPullDownRefresh() {
|
||||
// 获取团购列表
|
||||
this.couponInfo();
|
||||
},
|
||||
|
||||
// 上拉加载
|
||||
onReachBottom(){
|
||||
this.lodingStats = true
|
||||
let pageNumber = this.page.current
|
||||
if(this.page.has_more){
|
||||
pageNumber++
|
||||
this.couponInfo(pageNumber)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
page {
|
||||
background-color: #e83241;
|
||||
}
|
||||
|
||||
.coupon {
|
||||
margin-top: 30rpx;
|
||||
}
|
||||
|
||||
.couponCont {
|
||||
margin: 20rpx;
|
||||
width: calc(100% - 40rpx);
|
||||
border-radius: 10rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.couponList {
|
||||
background: #fdf4ed;
|
||||
width: 100%;
|
||||
height: 160rpx;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.couponList-left {
|
||||
position: relative;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
}
|
||||
|
||||
.couponList-img {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.couponList-icon {
|
||||
position: absolute;
|
||||
left: calc(50% - 56rpx);
|
||||
top: calc(50% - 50rpx);
|
||||
z-index: 2;
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
background: #fff;
|
||||
border-radius: 50%;
|
||||
padding: 20rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.couponList-icon image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.couponList-center {
|
||||
position: absolute;
|
||||
left: 180rpx;
|
||||
top: 35rpx;
|
||||
width: calc(100% - 330rpx);
|
||||
}
|
||||
|
||||
.couponList-center.active {
|
||||
top: 15rpx;
|
||||
}
|
||||
|
||||
.couponList-title {
|
||||
margin-bottom: 10rpx;
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
color: #743e3e;
|
||||
}
|
||||
|
||||
.couponList-time,
|
||||
.couponList-used {
|
||||
font-size: 24rpx;
|
||||
color: grey;
|
||||
}
|
||||
|
||||
.couponList-used {
|
||||
margin-bottom: 14rpx;
|
||||
color: #855757;
|
||||
}
|
||||
|
||||
.couponList-right {
|
||||
background: transparent;
|
||||
border: 2rpx solid #fc9f36;
|
||||
color: #f39124;
|
||||
border-radius: 30rpx;
|
||||
width: 110rpx;
|
||||
text-align: center;
|
||||
height: 50rpx;
|
||||
line-height: 50rpx;
|
||||
position: absolute;
|
||||
right: 20rpx;
|
||||
top: 55rpx;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.couponList-right.active {
|
||||
background: #dddddd;
|
||||
}
|
||||
|
||||
.couponMore {
|
||||
font-size: 28rpx;
|
||||
color: #686868;
|
||||
position: relative;
|
||||
height: 120rpx;
|
||||
}
|
||||
|
||||
.couponMore::after,
|
||||
.couponMore::before {
|
||||
position: absolute;
|
||||
content: '';
|
||||
height: 20rpx;
|
||||
border-radius: 10rpx;
|
||||
background: #fff;
|
||||
box-shadow: 0 0 20rpx rgba(0, 0, 0, .1);
|
||||
z-index: 1;
|
||||
height: 30rpx;
|
||||
}
|
||||
|
||||
.couponMore::after {
|
||||
width: calc(100% - 40rpx);
|
||||
top: 70rpx;
|
||||
left: 20rpx;
|
||||
}
|
||||
|
||||
.couponMore::before {
|
||||
width: calc(100% - 80rpx);
|
||||
top: 90rpx;
|
||||
left: 40rpx;
|
||||
}
|
||||
|
||||
.couponMore-text {
|
||||
display: flex;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
z-index: 99;
|
||||
height: 80rpx;
|
||||
border-radius: 0 0 10rpx 10rpx;
|
||||
line-height: 80rpx;
|
||||
padding: 0 30rpx;
|
||||
box-sizing: border-box;
|
||||
background: #fff;
|
||||
box-shadow: 0 0 10rpx rgba(0, 0, 0, .1);
|
||||
}
|
||||
|
||||
.couponMore-title {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.couponMore-arrow {
|
||||
width: 28rpx;
|
||||
height: 28rpx;
|
||||
margin-top: 26rpx;
|
||||
}
|
||||
|
||||
.couponCont.active .couponList-img,
|
||||
.couponCont.active .couponList-icon {
|
||||
-webkit-filter: grayscale(100%);
|
||||
-moz-filter: grayscale(100%);
|
||||
-ms-filter: grayscale(100%);
|
||||
-o-filter: grayscale(100%);
|
||||
filter: grayscale(100%);
|
||||
filter: gray;
|
||||
}
|
||||
|
||||
.coupoTips {
|
||||
position: absolute;
|
||||
top: 22rpx;
|
||||
right: 20rpx;
|
||||
z-index: 99;
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
}
|
||||
</style>
|
||||
231
pages/oil/password.vue
Normal file
231
pages/oil/password.vue
Normal file
@@ -0,0 +1,231 @@
|
||||
<template>
|
||||
<view class="content">
|
||||
<view class="campus-header">
|
||||
<view class="logo">
|
||||
<image src="/static/img/campusLogin_logo.png" mode="aspectFill"></image>
|
||||
<view class="title">身份验证</view>
|
||||
</view>
|
||||
<image class="cover" src="/static/img/campusLogin_back_01.png" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="campus-cont">
|
||||
<form @submit="forgetlogin">
|
||||
<view class="campus-inputs">
|
||||
<input class="campus-form-input" type="number" placeholder="请输入手机号" @input="getNameValue" name="mobile"></input>
|
||||
</view>
|
||||
<view class="campus-inputs inputs-code">
|
||||
<input class="campus-form-input" type="number" placeholder="请输入验证码" @input="getCodeValue" maxlength="4"></input>
|
||||
<button class="campus-form-code" @tap="getCode" :disabled="disabled" hover-class="none">{{ codename }}</button>
|
||||
</view>
|
||||
<button class="campus-form-btn" form-type="submit">设置新密码</button>
|
||||
</form>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { send, auth } from '@/apis/interfaces/auth'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
codename : '获取验证码',
|
||||
mobileNo : '', // 手机号
|
||||
code : '', // 验证码
|
||||
disabled : false,
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 切换登录方式
|
||||
onCutLogin(){
|
||||
this.passwordLogin = !this.passwordLogin
|
||||
},
|
||||
// mobileNo
|
||||
getNameValue(e) {
|
||||
this.mobileNo = e.detail.value
|
||||
},
|
||||
|
||||
// 获取code
|
||||
getCode(){
|
||||
let mobileNo = this.mobileNo,
|
||||
myreg = /^(14[0-9]|13[0-9]|15[0-9]|17[0-9]|18[0-9]||16[0-9])\d{8}$$/
|
||||
|
||||
var _this = this
|
||||
if (mobileNo == "") {
|
||||
uni.showToast({
|
||||
title : '手机号不能为空',
|
||||
icon : 'none',
|
||||
duration : 1000
|
||||
})
|
||||
return false;
|
||||
}else if (!myreg.test(mobileNo)) {
|
||||
uni.showToast({
|
||||
title : '请输入正确的手机号',
|
||||
icon : 'none',
|
||||
duration : 1000
|
||||
})
|
||||
return false;
|
||||
}else{
|
||||
send({mobile: mobileNo, channel: 'LOGIN'}).then(res=>{
|
||||
uni.showToast({
|
||||
title : '发送成功',
|
||||
icon : 'success',
|
||||
duration: 2000
|
||||
})
|
||||
var num = 61;
|
||||
var timer = setInterval(function () {
|
||||
num--;
|
||||
if (num <= 0) {
|
||||
clearInterval(timer);
|
||||
_this.codename = '重新发送'
|
||||
_this.disabled = false
|
||||
|
||||
} else {
|
||||
_this.codename = num + "s后重新获取"
|
||||
_this.disabled = true
|
||||
}
|
||||
}, 1000)
|
||||
}).catch(err=>{})
|
||||
}
|
||||
},
|
||||
|
||||
// 获取后输入code
|
||||
getCodeValue (e) {
|
||||
this.code = e.detail.value
|
||||
},
|
||||
|
||||
// 立即登录
|
||||
forgetlogin(e){
|
||||
let mobileNo = e.detail.value.mobile || '',
|
||||
code = this.code || ''
|
||||
|
||||
auth({
|
||||
mobile: mobileNo,
|
||||
code: code,
|
||||
type: 'reset_password'
|
||||
}).then(res => {
|
||||
this.$store.commit('setToken', res.token)
|
||||
uni.redirectTo({
|
||||
url: '/pages/oil/setPassword'
|
||||
})
|
||||
}).catch(err =>{
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon : 'none'
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.content{
|
||||
min-height: 100vh;
|
||||
background-image: linear-gradient(to top right, #cbaf7f, #fcf4cb);
|
||||
}
|
||||
.campus-cont{
|
||||
padding: 40rpx 60rpx;
|
||||
.campus-inputs{
|
||||
position: relative;
|
||||
padding-left: 30rpx;
|
||||
padding-right: 30rpx;
|
||||
background-image: linear-gradient(to right, #575a85, #252f4b);
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
border-radius: 45rpx;
|
||||
margin-bottom: 30rpx;
|
||||
&.inputs-code{
|
||||
padding-right: 280rpx;
|
||||
.campus-form-code{
|
||||
width: 260rpx;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
background-color: transparent;
|
||||
font-size: 30rpx;
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
color: white;
|
||||
&::after{
|
||||
border: none;
|
||||
}
|
||||
&[disabled]{
|
||||
color: rgba($color: white, $alpha: .5);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.campus-form-icon{
|
||||
position: absolute;
|
||||
left: 26rpx;
|
||||
top: 26rpx;
|
||||
width: 38rpx;
|
||||
height: 38rpx;
|
||||
}
|
||||
.campus-form-input{
|
||||
height: 90rpx;
|
||||
color: white;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
.resPassword{
|
||||
text-align: right;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.campus-form-btn{
|
||||
margin-top: 100rpx;
|
||||
width: 100%;
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
padding: 0;
|
||||
border-radius: 45rpx;
|
||||
background-image: linear-gradient(to right, #575a85, #252f4b);
|
||||
font-size: 32rpx;
|
||||
color: white;
|
||||
}
|
||||
.login-box{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: 30rpx;
|
||||
margin-top: 100rpx;
|
||||
view{
|
||||
color: #28314e;
|
||||
}
|
||||
}
|
||||
}
|
||||
.campus-header{
|
||||
width: 100%;
|
||||
padding-top: 70%;
|
||||
position: relative;
|
||||
.cover{
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 1;
|
||||
}
|
||||
.logo{
|
||||
position: absolute;
|
||||
bottom: 80rpx;
|
||||
width: 100%;
|
||||
z-index: 2;
|
||||
text-align: center;
|
||||
image{
|
||||
margin-top: 20%;
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
vertical-align: top;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
.title{
|
||||
font-weight: bold;
|
||||
color: white;
|
||||
font-size: 40rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
238
pages/oil/register.vue
Normal file
238
pages/oil/register.vue
Normal file
@@ -0,0 +1,238 @@
|
||||
<template>
|
||||
<view class="content">
|
||||
<view class="campus-header">
|
||||
<view class="logo">
|
||||
<image src="@/static/img/campusLogin_logo.png" mode="aspectFill"></image>
|
||||
<view class="title">用户注册</view>
|
||||
</view>
|
||||
<image class="cover" src="@/static/img/campusLogin_back_01.png" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="campus-cont">
|
||||
<form @submit="submitRegister">
|
||||
<view class="campus-inputs">
|
||||
<input class="campus-form-input" type="number" placeholder="请输入手机号" @input="getNameValue"
|
||||
name="mobile"></input>
|
||||
</view>
|
||||
<view class="campus-inputs inputs-code">
|
||||
<input class="campus-form-input" type="number" placeholder="请输入验证码" @input="getCodeValue" maxlength="4"></input>
|
||||
<button class="campus-form-code" @tap="getCode" :disabled="disabled" hover-class="none">{{ codename }}</button>
|
||||
</view>
|
||||
<view class="campus-inputs">
|
||||
<input class="campus-form-input" type="password" placeholder="请输入密码" name="password"></input>
|
||||
</view>
|
||||
<view class="campus-inputs">
|
||||
<input class="campus-form-input" type="password" placeholder="请确认密码" name="password_confirmation"></input>
|
||||
</view>
|
||||
<button class="campus-form-btn" form-type="submit">注册</button>
|
||||
</form>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { send, register } from '@/apis/interfaces/auth'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
codename : '获取验证码',
|
||||
mobileNo : '', // 手机号
|
||||
code : '', // 验证码
|
||||
disabled : false,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// mobileNo
|
||||
getNameValue(e) {
|
||||
this.mobileNo = e.detail.value
|
||||
},
|
||||
|
||||
// 获取code
|
||||
getCode(){
|
||||
let mobileNo = this.mobileNo
|
||||
|
||||
var _this = this
|
||||
if (mobileNo == "") {
|
||||
uni.showToast({
|
||||
title : '手机号不能为空',
|
||||
icon : 'none',
|
||||
duration : 1000
|
||||
})
|
||||
return false;
|
||||
}else{
|
||||
send({mobile: mobileNo, channel: 'LOGIN'}).then(res=>{
|
||||
uni.showToast({
|
||||
title : '发送成功',
|
||||
icon : 'success',
|
||||
duration: 2000
|
||||
})
|
||||
var num = 61;
|
||||
var timer = setInterval(function () {
|
||||
num--;
|
||||
if (num <= 0) {
|
||||
clearInterval(timer);
|
||||
_this.codename = '重新发送'
|
||||
_this.disabled = false
|
||||
|
||||
} else {
|
||||
_this.codename = num + "s后重新获取"
|
||||
_this.disabled = true
|
||||
}
|
||||
}, 1000)
|
||||
}).catch(err=>{
|
||||
uni.showToast({
|
||||
title : err.message,
|
||||
icon :'none',
|
||||
duration: 2000
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
// 获取后输入code
|
||||
getCodeValue (e) {
|
||||
this.code = e.detail.value
|
||||
},
|
||||
|
||||
// 立即登录
|
||||
submitRegister(e){
|
||||
let formValue = e.detail.value
|
||||
|
||||
register({
|
||||
mobile : formValue.mobile,
|
||||
password : formValue.password,
|
||||
password_confirmation : formValue.password_confirmation,
|
||||
code : this.code,
|
||||
parent_id : 0
|
||||
}).then(res => {
|
||||
this.$store.commit('setToken', res.token)
|
||||
uni.showModal({
|
||||
title : "提示",
|
||||
content : "注册成功",
|
||||
showCancel : false,
|
||||
confirmText : "确定",
|
||||
success : modalRes => {
|
||||
if(modalRes.confirm){
|
||||
uni.reLaunch({
|
||||
url: '/pages/oil/index'
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon : 'none'
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.content{
|
||||
min-height: 100vh;
|
||||
background-image: linear-gradient(to top right, #cbaf7f, #fcf4cb);
|
||||
}
|
||||
.campus-cont{
|
||||
padding: 40rpx 60rpx;
|
||||
|
||||
.campus-inputs{
|
||||
position: relative;
|
||||
padding-left: 30rpx;
|
||||
padding-right: 30rpx;
|
||||
background-image: linear-gradient(to right, #575a85, #252f4b);
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
border-radius: 45rpx;
|
||||
margin-bottom: 30rpx;
|
||||
&.inputs-code{
|
||||
padding-right: 280rpx;
|
||||
.campus-form-code{
|
||||
width: 260rpx;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
background-color: transparent;
|
||||
font-size: 30rpx;
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
color: white;
|
||||
&::after{
|
||||
border: none;
|
||||
}
|
||||
&[disabled]{
|
||||
color: rgba($color: white, $alpha: .5);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.campus-form-icon{
|
||||
position: absolute;
|
||||
left: 26rpx;
|
||||
top: 26rpx;
|
||||
width: 38rpx;
|
||||
height: 38rpx;
|
||||
}
|
||||
.campus-form-input{
|
||||
height: 90rpx;
|
||||
color: white;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
.campus-form-btn{
|
||||
margin-top: 100rpx;
|
||||
width: 100%;
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
padding: 0;
|
||||
border-radius: 45rpx;
|
||||
background-image: linear-gradient(to right, #575a85, #252f4b);
|
||||
font-size: 32rpx;
|
||||
color: white;
|
||||
}
|
||||
.login-box{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: 30rpx;
|
||||
margin-top: 100rpx;
|
||||
view{
|
||||
color: #28314e;
|
||||
}
|
||||
}
|
||||
}
|
||||
.campus-header{
|
||||
width: 100%;
|
||||
padding-top: 70%;
|
||||
position: relative;
|
||||
.cover{
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 1;
|
||||
}
|
||||
.logo{
|
||||
position: absolute;
|
||||
bottom: 80rpx;
|
||||
width: 100%;
|
||||
z-index: 2;
|
||||
text-align: center;
|
||||
image{
|
||||
margin-top: 20%;
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
vertical-align: top;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
.title{
|
||||
font-weight: bold;
|
||||
color: white;
|
||||
font-size: 40rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
169
pages/oil/setPassword.vue
Normal file
169
pages/oil/setPassword.vue
Normal file
@@ -0,0 +1,169 @@
|
||||
<template>
|
||||
<view class="content">
|
||||
<view class="campus-header">
|
||||
<view class="logo">
|
||||
<image src="@/static/img/campusLogin_logo.png" mode="aspectFill"></image>
|
||||
<view class="title">设置新密码</view>
|
||||
</view>
|
||||
<image class="cover" src="@/static/img/campusLogin_back_01.png" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="campus-cont">
|
||||
<form @submit="forgetlogin">
|
||||
<view class="campus-inputs">
|
||||
<input class="campus-form-input" type="password" placeholder="设置新的登录密码" name="password"></input>
|
||||
</view>
|
||||
<view class="campus-inputs">
|
||||
<input class="campus-form-input" type="password" placeholder="确认新的登录密码" name="newpassword"></input>
|
||||
</view>
|
||||
<button class="campus-form-btn" form-type="submit">找回</button>
|
||||
</form>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { passSetup } from '@/apis/interfaces/auth'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 立即登录
|
||||
forgetlogin(e){
|
||||
let newPass = e.detail.value.newpassword || '',
|
||||
password = e.detail.value.password || ''
|
||||
|
||||
passSetup({
|
||||
password: password,
|
||||
password_confirmation: newPass
|
||||
}).then(res => {
|
||||
uni.showToast({
|
||||
title: "密码重置成功",
|
||||
icon : 'none'
|
||||
})
|
||||
uni.reLaunch({
|
||||
url: '/pages/oil/index'
|
||||
})
|
||||
}).catch(err =>{
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon : 'none'
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.content{
|
||||
min-height: 100vh;
|
||||
background-image: linear-gradient(to top right, #cbaf7f, #fcf4cb);
|
||||
}
|
||||
.campus-cont{
|
||||
padding: 40rpx 60rpx;
|
||||
.campus-inputs{
|
||||
position: relative;
|
||||
padding-left: 30rpx;
|
||||
padding-right: 30rpx;
|
||||
background-image: linear-gradient(to right, #575a85, #252f4b);
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
border-radius: 45rpx;
|
||||
margin-bottom: 30rpx;
|
||||
&.inputs-code{
|
||||
padding-right: 280rpx;
|
||||
.campus-form-code{
|
||||
width: 260rpx;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
background-color: transparent;
|
||||
font-size: 30rpx;
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
color: white;
|
||||
&::after{
|
||||
border: none;
|
||||
}
|
||||
&[disabled]{
|
||||
color: rgba($color: white, $alpha: .5);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.campus-form-icon{
|
||||
position: absolute;
|
||||
left: 26rpx;
|
||||
top: 26rpx;
|
||||
width: 38rpx;
|
||||
height: 38rpx;
|
||||
}
|
||||
.campus-form-input{
|
||||
height: 90rpx;
|
||||
color: white;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
.resPassword{
|
||||
text-align: right;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.campus-form-btn{
|
||||
margin-top: 100rpx;
|
||||
width: 100%;
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
padding: 0;
|
||||
border-radius: 45rpx;
|
||||
background-image: linear-gradient(to right, #575a85, #252f4b);
|
||||
font-size: 32rpx;
|
||||
color: white;
|
||||
}
|
||||
.login-box{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: 30rpx;
|
||||
margin-top: 100rpx;
|
||||
view{
|
||||
color: #28314e;
|
||||
}
|
||||
}
|
||||
}
|
||||
.campus-header{
|
||||
width: 100%;
|
||||
padding-top: 70%;
|
||||
position: relative;
|
||||
.cover{
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 1;
|
||||
}
|
||||
.logo{
|
||||
position: absolute;
|
||||
bottom: 80rpx;
|
||||
width: 100%;
|
||||
z-index: 2;
|
||||
text-align: center;
|
||||
image{
|
||||
margin-top: 20%;
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
vertical-align: top;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
.title{
|
||||
font-weight: bold;
|
||||
color: white;
|
||||
font-size: 40rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
260
pages/oil/signin.vue
Normal file
260
pages/oil/signin.vue
Normal file
@@ -0,0 +1,260 @@
|
||||
<template>
|
||||
<view class="content">
|
||||
<view class="campus-header">
|
||||
<view class="logo">
|
||||
<image src="@/static/img/campusLogin_logo.png" mode="aspectFill"></image>
|
||||
<view class="title">联通优惠活动登录</view>
|
||||
</view>
|
||||
<image class="cover" src="@/static/img/campusLogin_back_01.png" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="campus-cont">
|
||||
<form @submit="forgetlogin">
|
||||
<view class="campus-inputs">
|
||||
<image class="campus-form-icon" src="/static/img/campus_login_02.png" mode="aspectFill"></image>
|
||||
<input class="campus-form-input" type="number" placeholder="请输入手机号" @input="getNameValue" name="mobile"></input>
|
||||
</view>
|
||||
<view class="campus-inputs inputs-code" v-if="!passwordLogin">
|
||||
<image class="campus-form-icon" src="/static/img/campus_login_03.png" mode="aspectFill"></image>
|
||||
<input class="campus-form-input" type="number" placeholder="请输入验证码" @input="getCodeValue" maxlength="4"></input>
|
||||
<button class="campus-form-code" @tap="getCode" :disabled="disabled" hover-class="none">{{ codename }}</button>
|
||||
</view>
|
||||
<view class="campus-inputs" v-else>
|
||||
<image class="campus-form-icon" src="/static/img/campus_login_03.png" mode="aspectFill"></image>
|
||||
<input class="campus-form-input" type="password" placeholder="请输入登录密码" name="password"></input>
|
||||
</view>
|
||||
<view class="resPassword">
|
||||
<navigator url="password">忘记密码</navigator>
|
||||
</view>
|
||||
<button class="campus-form-btn" form-type="submit">登录</button>
|
||||
</form>
|
||||
<view class="login-box">
|
||||
<view @click="onCutLogin">{{passwordLogin ? '验证码登录': '密码登录'}}</view>
|
||||
<navigator url="register">快速注册</navigator>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { send, auth, passlogin } from '@/apis/interfaces/auth'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
codename : '获取验证码',
|
||||
mobileNo : '', // 手机号
|
||||
code : '', // 验证码
|
||||
passwordLogin: true, // 登录方式
|
||||
disabled : false,
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 切换登录方式
|
||||
onCutLogin(){
|
||||
this.passwordLogin = !this.passwordLogin
|
||||
},
|
||||
// mobileNo
|
||||
getNameValue(e) {
|
||||
this.mobileNo = e.detail.value
|
||||
},
|
||||
|
||||
// 获取code
|
||||
getCode(){
|
||||
console.log('sss')
|
||||
let mobileNo = this.mobileNo,
|
||||
myreg = /^(14[0-9]|13[0-9]|15[0-9]|17[0-9]|18[0-9]|16[0-9])\d{8}$$/
|
||||
|
||||
var _this = this
|
||||
if (mobileNo == "") {
|
||||
uni.showToast({
|
||||
title : '手机号不能为空',
|
||||
icon : 'none',
|
||||
duration : 1000
|
||||
})
|
||||
return false;
|
||||
}else if (!myreg.test(mobileNo)) {
|
||||
uni.showToast({
|
||||
title : '请输入正确的手机号',
|
||||
icon : 'none',
|
||||
duration : 1000
|
||||
})
|
||||
return false;
|
||||
}else{
|
||||
send({mobile: mobileNo, channel: 'LOGIN'}).then(res=>{
|
||||
uni.showToast({
|
||||
title : '发送成功',
|
||||
icon : 'success',
|
||||
duration: 2000
|
||||
})
|
||||
var num = 61;
|
||||
var timer = setInterval(function () {
|
||||
num--;
|
||||
if (num <= 0) {
|
||||
clearInterval(timer);
|
||||
_this.codename = '重新发送'
|
||||
_this.disabled = false
|
||||
|
||||
} else {
|
||||
_this.codename = num + "s后重新获取"
|
||||
_this.disabled = true
|
||||
}
|
||||
}, 1000)
|
||||
}).catch(err=>{})
|
||||
}
|
||||
},
|
||||
|
||||
// 获取后输入code
|
||||
getCodeValue (e) {
|
||||
this.code = e.detail.value
|
||||
},
|
||||
|
||||
// 立即登录
|
||||
forgetlogin(e){
|
||||
let mobileNo = e.detail.value.mobile || '',
|
||||
code = this.code || '',
|
||||
password = e.detail.value.password || '',
|
||||
loginFunction
|
||||
|
||||
if(this.passwordLogin){
|
||||
loginFunction = passlogin({
|
||||
mobile : mobileNo,
|
||||
password: password
|
||||
})
|
||||
}else{
|
||||
loginFunction = auth({
|
||||
mobile: mobileNo,
|
||||
code: code,
|
||||
type: ''
|
||||
})
|
||||
}
|
||||
|
||||
loginFunction.then(res => {
|
||||
this.$store.commit('setToken', res.token)
|
||||
uni.reLaunch({
|
||||
url: '/pages/oil/index'
|
||||
})
|
||||
}).catch(err =>{
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon : 'none'
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.content{
|
||||
min-height: 100vh;
|
||||
background-image: linear-gradient(to top right, #cbaf7f, #fcf4cb);
|
||||
}
|
||||
.campus-cont{
|
||||
padding: 40rpx 60rpx;
|
||||
.campus-inputs{
|
||||
position: relative;
|
||||
padding-left: 90rpx;
|
||||
padding-right: 30rpx;
|
||||
background-image: linear-gradient(to right, #575a85, #252f4b);
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
border-radius: 45rpx;
|
||||
margin-bottom: 30rpx;
|
||||
&.inputs-code{
|
||||
padding-right: 280rpx;
|
||||
.campus-form-code{
|
||||
width: 260rpx;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
background-color: transparent;
|
||||
font-size: 30rpx;
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
color: white;
|
||||
&::after{
|
||||
border: none;
|
||||
}
|
||||
&[disabled]{
|
||||
color: rgba($color: white, $alpha: .5);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.campus-form-icon{
|
||||
position: absolute;
|
||||
left: 26rpx;
|
||||
top: 26rpx;
|
||||
width: 38rpx;
|
||||
height: 38rpx;
|
||||
}
|
||||
.campus-form-input{
|
||||
height: 90rpx;
|
||||
color: white;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
.resPassword{
|
||||
text-align: right;
|
||||
font-size: 28rpx;
|
||||
navigator{
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
|
||||
.campus-form-btn{
|
||||
margin-top: 100rpx;
|
||||
width: 100%;
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
padding: 0;
|
||||
border-radius: 45rpx;
|
||||
background-image: linear-gradient(to right, #575a85, #252f4b);
|
||||
font-size: 32rpx;
|
||||
color: white;
|
||||
}
|
||||
.login-box{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: 30rpx;
|
||||
margin-top: 100rpx;
|
||||
view{
|
||||
color: #28314e;
|
||||
}
|
||||
}
|
||||
}
|
||||
.campus-header{
|
||||
width: 100%;
|
||||
padding-top: 70%;
|
||||
position: relative;
|
||||
.cover{
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 1;
|
||||
}
|
||||
.logo{
|
||||
position: absolute;
|
||||
bottom: 80rpx;
|
||||
width: 100%;
|
||||
z-index: 2;
|
||||
text-align: center;
|
||||
image{
|
||||
margin-top: 20%;
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
vertical-align: top;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
.title{
|
||||
font-weight: bold;
|
||||
color: white;
|
||||
font-size: 40rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user