[本时生活h5端]

This commit is contained in:
2023-06-21 17:19:58 +08:00
commit ebb9575bd0
284 changed files with 39689 additions and 0 deletions

515
pages/draw/choose.vue Normal file
View File

@@ -0,0 +1,515 @@
<template>
<view class="content">
<view class="borderBottom">
<view class="title">
<image class="title-img" src="/static/img/draw_choose.png"></image>
<view class="title-top">
选择商品兑换
</view>
</view>
<view class="choose">
<view class="choose-radio-group">
<radio-group class="choose-label" :class="{active : current == 1}" @change="(e) => radioChange(e,index,item)" v-for="(item, index) in goodsArr" :key="index">
<view class="choose-label-name">
<image class="choose-label-img" :src="item.cover"></image>
<view class="choose-label-text">
<view class="choose-label-title">
{{item.title}}
<text>基于能监测健康的手环</text>
</view>
<view class="choose-label-price">
<text></text>{{item.price}}
</view>
</view>
</view>
<radio class="radio" :value="String(item.exchagne_item_goods_id)" :checked="index == current"></radio>
</radio-group>
</view>
<view class="chooseForm">
<view class="site-input">
<label>收货人姓名</label>
<input class="campus-form-input" maxlength="4" type="text" placeholder="请输入收货人姓名" @input="getNameValue" name="name" placeholder-style="color:#c9c9c9;"></input>
</view>
<view class="site-input">
<label>收货人手机</label>
<input class="campus-form-input" maxlength="11" type="number" placeholder="请输入收货人手机号" @input="getTelValue" name="mobile" placeholder-style="color:#c9c9c9;"></input>
</view>
<!-- <view class="site-input">
<label>所在省份</label>
<picker @change="areasChange" :value="area.areaIndex" :range="area.areas" :range-key="'name'" name="province_id">
<view class="picker" v-if="area.areas[area.areaIndex]">
{{ area.areas[area.areaIndex].name }}
</view>
<image src="/static/icon/rightsArrow.png"></image>
</picker>
</view>
<view class="site-input">
<label>所在城市</label>
<picker @change="cityDrop" :value="city.cityIndex" :range="city.cityList" :range-key="'name'" class="conneColor" name="city_id">
<view class="picker" v-if="city.cityList[city.cityIndex]">
{{ city.cityList[city.cityIndex].name }}
</view>
<image src="/static/icon/rightsArrow.png"></image>
</picker>
</view>
<view class="site-input">
<label>所在区域</label>
<picker @change="regiDrop" :value="regi.regiIndex" :range="regi.regiList" :range-key="'name'" class="conneColor" name="district_id">
<view class="picker" v-if="regi.regiList[regi.regiIndex]">
{{ regi.regiList[regi.regiIndex].name }}
</view>
<image src="/static/icon/rightsArrow.png"></image>
</picker>
</view> -->
<view class="site-input">
<label>收货地址</label>
<input placeholder="请输入收货详细地址" name="address" @input="getAddressValue" placeholder-style="color:#c9c9c9;"></input>
</view>
</view>
</view>
</view>
<view class="chooseBuy">
<view class="chooseBuy-price">
{{goodTitle}}<text>{{goodPay == 0 ? '免费兑换' : '支付金额: ¥' + goodPrice}}</text>
</view>
<button type="default" class="chooseBuy-btn" @click="siteform">
兑换
</button>
</view>
</view>
</template>
<script>
import { exchanges, exchangesBuy } from '@/apis/interfaces/draw'
import { create, children } from '@/apis/interfaces/address'
import { getAuthUrl, wpayH5Info, h5Pay } from '@/apis/interfaces/rights'
const jweixin = require('jweixin-module'); //获取微信支付
export default {
data() {
return {
logId : '', //抽奖记录
tradeNo : '', //产品支付订单号
goodsArr : [], //产品列表
goodId : '', //产品id
goodTitle : '', //产品名称
goodPrice : '', //产品金额
goodPay : '', //产品是否支付
current : 0 , //支付下标
address : '', // 地址内容
name : '', // 姓名
mobile : '', // 手机号
// 省份选择
area: {
areas : [],
areaSn : '',
areaIndex : 0,
},
// 市级选择
city: {
cityList : [],
cityId : 0,
cityIndex : 0,
},
// 区域选择
regi: {
regiList : [],
regiId : 0,
regiIndex : 0,
}
}
},
// 生命周期函数--监听页面加载
onLoad(options) {
// 判断是否微信授权登录过 只有外部游览器才用到(支付需要授权微信环境)
let status = navigator.userAgent.toLowerCase();
if (status.match(/MicroMessenger/i) == "micromessenger" && !options.code) {
let locationUrl = window.location.pathname.substr(1) + window.location.search
getAuthUrl(locationUrl).then(res=> {
window.location.href = res
})
}
this.openid = options.openid || ''
this.code = options.code || '' //用code换取oppid
// 获取商品选择
this.exchangesShow(options.id)
},
onShow() {
// 存储环境-用户抽奖活动
getApp().globalData.envType = 'drawEnv'
// 获取省信息
// this.getProvince()
},
methods: {
// 微信支付数据
wechatPayment() {
let status = navigator.userAgent.toLowerCase();
if (status.match(/MicroMessenger/i) == "micromessenger") {
// 微信浏览器-获取
this.wxBrowser();
}else {
// 普通浏览器(网址游览器)
this.outBrowser();
}
},
// 商品选择
exchangesShow(id){
exchanges(id).then(res=>{
this.logId = res.exchage_log_id
this.goodsArr = res.exchange_item.goods
this.goodId = res.exchange_item.goods[0].exchagne_item_goods_id
this.goodTitle = res.exchange_item.goods[0].title
this.goodPrice = res.exchange_item.goods[0].price
this.goodPay = res.exchange_item.goods[0].is_buy
})
},
// 支付方式选择
radioChange(evt, index, item) {
this.goodTitle = item.title
this.goodPay = item.is_buy
this.goodPrice = item.amount
this.current = index
this.goodId = evt.detail.value
},
// 省信息
getProvince() {
create().then(res=>{
let areaArr = res.provinces,
areaIndex = this.area.areaIndex
this.area.areaSn = areaArr[areaIndex].code
this.area.areas = areaArr
this.citylist(areaArr[areaIndex].code)
})
},
// 所在省份
areasChange(e) {
let area = this.area.areas,
index = e.detail.value,
atcode = area[index].code
if (index != this.area.areaIndex) {
this.area.areaIndex = index
this.area.areaSn = atcode
// 获取市级列表
this.citylist(atcode)
}
},
// 市级列表
citylist(code) {
children(code).then(res=>{
let cityArr = res
this.city.cityId = cityArr[0].code
this.city.cityList = cityArr
this.city.cityIndex = 0
this.regilist(cityArr[0].code)
})
},
// 市级下拉筛选
cityDrop(e) {
let city = this.city.cityList,
index = e.detail.value,
citycode = city[index].code
if (index != this.area.areaIndex) {
this.city.cityIndex = index
this.city.cityId = citycode
// 获取市级列表
this.regilist(citycode)
}
},
// 区列表
regilist(areaCode) {
children(areaCode).then(res=>{
this.regi.regiList = res
this.regi.regiId = res[0].code
this.regi.regiIndex = 0
})
},
// 区下拉筛选
regiDrop(e) {
let newIndex = e.detail.value
this.regi.regiIndex = newIndex
this.regi.regiId = this.regi.regiList[newIndex].code
},
// 获取用户名
getNameValue(e) {
this.name = e.detail.value
},
// 获取手机号
getTelValue(e) {
this.mobile = e.detail.value
},
// 获取详细地址
getAddressValue(e) {
this.address = e.detail.value
},
// 提交表单
siteform() {
exchangesBuy({
name : this.name,
mobile : this.mobile,
address : this.address,
activity_exchange_log_id: this.logId,
activity_exchange_item_goods_id: this.goodId,
qty : 1
}).then(res=>{
if(res.need_buy) {
this.tradeNo = res.trade_no
this.wxBrowser()
return
}
// 跳转兑换成功页
uni.redirectTo({
url: 'success'
})
}).catch(err => {
uni.showToast({
title: err.message,
icon: 'none'
})
})
},
// 当支付环境为微信游览器情况下
wxBrowser() {
wpayH5Info({
url: location.href.split('#')[0],
list:'chooseWXPay'
}).then(wechatConfig => {
let wxConfig = JSON.parse(wechatConfig)
jweixin.config({
appId: wxConfig.appId,
debug: false,
jsApiList: wxConfig.jsApiList,
signature: wxConfig.signature,
nonceStr: wxConfig.nonceStr,
timestamp: wxConfig.timestamp
})
jweixin.ready(() => {
let wechaUrl = 'payments/wechat'
h5Pay(wechaUrl, {
channel: 'h5',
trade_no: this.tradeNo,
code: this.code
}).then(wechatRes => {
let wechatPay = JSON.parse(wechatRes)
console.log("wechatPay")
jweixin.chooseWXPay({
timestamp: wechatPay.timeStamp,
nonceStr: wechatPay.nonceStr,
package: wechatPay.package,
signType: wechatPay.signType,
paySign: wechatPay.paySign,
success: payRes => {
console.log(payRes)
},
cancel: () =>{
}
})
})
})
}).catch(err => {
uni.showToast({
title: err.message,
icon: 'none'
})
if (!err.login) {
uni.reLaunch({
url: '/pages/draw/signin'
});
}
})
},
}
}
</script>
<style lang="scss">
.content {
padding: 30rpx 20rpx;
box-sizing: border-box;
}
.borderBottom {
border-bottom: 110rpx solid transparent;
}
.title {
position: relative;
width: 100%;
background-color: #2564ff;
height: 100rpx;
border-radius: 10rpx;
.title-img {
width: 100%;
height: 100%;
position: absolute;
height: 100rpx;
left: 0;
top: 0;
}
.title-top {
width: 100%;
height: 100%;
line-height: 100rpx;
position: absolute;
left: 0;
top: 0;
z-index: 9;
text-align: center;
font-size: 32rpx;
font-weight: 600;
color: #FFFFFF;
}
}
.choose {
margin: 30rpx -10rpx 0;
overflow: hidden;
.choose-radio-group {
overflow: hidden;
}
.choose-label {
width: calc(50% - 20rpx);
float: left;
margin: 0 10rpx;
border-radius: 10rpx;
background-color: #FFFFFF;
margin-bottom: 30rpx;
padding: 30rpx 20rpx;
box-sizing: border-box;
position: relative;
.choose-label-name {
.choose-label-img {
width: 100rpx;
height: 100rpx;
}
}
.radio {
position: absolute;
top: 20rpx;
right: 10rpx;
}
.choose-label-text {
margin-top: 20rpx;
font-weight: 600;
.choose-label-title {
margin-bottom: 30rpx;
font-size: 30rpx;
text {
font-weight: normal;
color: #bac0d7;
display: block;
font-size: 26rpx;
line-height: 54rpx;
}
}
.choose-label-price {
color: #fd7164;
font-size: 34rpx;
text {
font-size: 26rpx;
}
}
}
}
}
.chooseBuy {
position: fixed;
width: 100%;
height: 110rpx;
left: 0;
bottom: 0;
display: flex;
background-color: #FFFFFF;
padding: 30rpx;
box-sizing: border-box;
.chooseBuy-btn {
position: absolute;
right: 20rpx;
top: 26rpx;
background-color: #f24b44;
color: #FFFFFF;
height: 62rpx;
line-height: 60rpx;
margin: 0;
font-size: 28rpx;
padding: 0 35rpx;
}
.chooseBuy-name {
font-size: 32rpx;
line-height: 48rpx;
}
.chooseBuy-price {
font-size: 28rpx;
line-height: 50rpx;
color: #777b85;
text {
color: #f14646;
padding-left: 20rpx;
}
}
}
.chooseForm {
background-color: #FFFFFF;
margin: 0 15rpx;
border-radius: 10rpx;
.site-input {
font-size: 30rpx;
padding: 0 30rpx 0 220rpx;
box-sizing: border-box;
position: relative;
line-height: 100rpx;
min-height: 100rpx;
&::before {
position: absolute;
bottom: 0;
width: 100%;
left: 0rpx;
right: 0;
height: 1rpx;
content: "";
background: #e4e6f2;
}
&:last-child::before {
display: none;
}
label {
position: absolute;
left: 30rpx;
top: 0;
}
input {
font-size: 30rpx;
height: 110rpx;
}
image {
width: 38rpx;
height: 38rpx;
position: absolute;
right: 20rpx;
top: 32rpx;
}
}
}
</style>

View File

@@ -0,0 +1,546 @@
<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"></image>
<view class="detailsCode-text">
<text>请出示以上券码给网点工作人员</text>
</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 } 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 () {
// 存储环境-用户抽奖活动
getApp().globalData.envType = 'drawEnv'
// 查看定位信息
this.getCity();
},
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/unicom/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/unicom/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'
})
},
// 获取位置
getCity(){
uni.getLocation({
success: res => {
this.latitude   = res.latitude,
this.longitude  = res.longitude
},
complete: (err) => {
// 获取详情信息
this.detailsInfo();
}
})
}
}
}
</script>
<style>
page {
background-color: #e83241;
padding: 20rpx;
box-sizing: border-box;
}
/* 卡券详情 */
.details {
background: #ffffff;
margin: 20rpx 20rpx 0;
overflow: hidden;
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;
}
.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;
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;
margin: 40rpx 0 30rpx;
}
.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;
}
</style>

603
pages/draw/index.vue Normal file
View File

@@ -0,0 +1,603 @@
<template>
<view class="content">
<!-- 抽奖 -->
<image class="luckBack" src="https://card.ysd-bs.com/storage/materials/2022/05/12/luck_back.png"></image>
<view class="luck">
<image class="luckTitle" src="https://card.ysd-bs.com/storage/materials/2022/09/23/drawTitle.png" mode="widthFix"></image>
<view class="drawContent">
<image class="drawContent-back" src="https://card.ysd-bs.com/storage/materials/2022/05/16/ly-plate-c.png" mode="widthFix"></image>
<view class="drawContent-number" v-if="isUser">抽奖数<text>{{number >= 0 ? number : '0'}}</text></view>
<image class="drawContent-award" :animation="animationData" bindtransitionend='animationend' :src="picture" mode="widthFix"></image>
<image class="drawContent-arrow" @click="onExtracting" src="https://card.ysd-bs.com/storage/materials/2022/05/12/playbtn.png" mode="widthFix"></image>
<image class="drawFooter drawFooter-right" src="https://card.ysd-bs.com/storage/materials/2022/05/12/dial_rigntImg.png" mode="widthFix"></image>
<image class="drawFooter drawFooter-left" src="https://card.ysd-bs.com/storage/materials/2022/05/12/dial_leftImg.png" mode="widthFix"></image>
</view>
<view class="roll">
<view class="roll-title">
- 参与抽奖用户 -
</view>
<swiper class="roll-list" interval="3000" autoplay circular vertical bindchange="swiperChange">
<swiper-item class="roll-item" catchtouchmove="stopTouchMove" v-for="(item, index) in logsArr" :key="index">
<view class="roll-name" v-if="item.user">
{{item.user.nickname}}
</view>
<view class="roll-tel" v-if="item.user">
{{item.user.username}}
</view>
<view class="roll-time">
{{item.created_at}}
</view>
</swiper-item>
</swiper>
</view>
<navigator v-if="isUser" hover-class="none" :url="'logs?id=' + exchageId" class="dial-record">抽奖记录</navigator>
<view class="dial-btns">
<view @click="userNav('order?type=paid')" class="dial-btns-go">
我的订单
</view>
<view @click="userNav('myCoupon')" class="dial-btns-go dial-btns-order">
我的优惠券
</view>
</view>
<view class="setupLabel" @click="delStorage" v-if="isUser">
<view class="setupLabel-name">
切换用户
</view>
</view>
</view>
<!-- 弹出 -->
<view class="popBack" v-if="pointShow"></view>
<view class="popCont" v-if="pointShow">
<view class="popTips">
<image class="luckTips" src="https://card.ysd-bs.com/storage/materials/2022/05/12/luckTips.png" mode="widthFix"></image>
<view class="Tips-title">
恭喜中奖
</view>
<view class="Tips-text">
获得{{prize}}
</view>
<view class="Tips-btn">
<image class="Tips-btn-image" src="https://card.ysd-bs.com/storage/materials/2022/05/12/luckBtn.png"></image>
<view v-if="value == 2" class="Tips-btn-text" @click="exchange(luckId)">去兑换</view>
<view v-else class="Tips-btn-text" @click="useGp(luckId)">去使用</view>
</view>
<view class="Tips-out">~温馨提示请您尽快使用哦~</view>
</view>
<view class="luckClose">
<image src="/static/img/luckClose.png" mode="widthFix" @click="luckClosePop"></image>
</view>
</view>
</view>
</template>
<script>
import { index, result } from '@/apis/interfaces/draw'
export default {
data() {
return {
isUser : false, // 用户是否登录
number : '', //抽奖次数
logsArr : '', //获奖列表
luckId : '', //抽奖列表id
pointShow : false, //抽奖弹出
prize : '', //获得奖项标题
value : '', //获得奖项类型
animationData : {}, //旋转动画
picture : '', //抽奖转盘图片
isState : false, //抽奖状态
exchageId : '', //抽奖id
backGround : '',
itemArr : []
}
},
// 生命周期函数--监听页面加载
onLoad(options) {
// 初始化动画信息
const animation = uni.createAnimation({
duration : 2000,
timingFunction : 'ease-in-out'
})
this.animation = animation
},
// 生命周期函数--监听页面显示
onShow() {
// 存储环境-用户抽奖活动
getApp().globalData.envType = 'drawEnv'
if(uni.getStorageSync("token")) {
this.isUser = true
// 获取抽奖默认信息(抽奖次数)
}
this.drawShow();
},
methods: {
// 抽奖默认信息(抽奖次数)
drawShow(){
index().then(res=>{
this.countLengtht= res.lottery.items_count
this.number = res.lottery.number
this.background = res.lottery.background
this.picture = res.lottery.picture
this.exchageId = res.lottery.exchage_id
this.itemArr = res.lottery.items
this.logsArr = res.logs
})
},
// 抽奖
onExtracting(){
if(uni.getStorageSync("token")) {
result(this.exchageId).then(res=>{
let runNum = 3 // 旋转圈数
// 检查抽奖状态
if(this.isState) return
if(this.number <= 0){
uni.showToast({
title: '今日抽奖次数已用完,请明天再来吧~',
icon : 'none'
})
return
}
// 更新抽奖状态
this.isState = true
this.prize = res.log.exchange_item.title
this.value = res.log.exchange_item.type.value
this.luckId = res.log.exchage_log_id
//旋转角度
this.runDeg = this.runDeg || 0;
this.runDeg = this.runDeg + (360 - this.runDeg % 360) + (360 * runNum - (res.log.exchange_item.order - 1) * Math.round(360 / this.countLengtht))
// 动画
this.animation.rotate(this.runDeg).step()
this.animationData = this.animation.export()
// 提示用户中奖信息
setTimeout(()=>{
this.isState = false
this.pointShow = true
},3000)
}).catch(err => {
uni.showToast({
title: err.message,
icon: 'none'
})
})
return
}
// 去登录
uni.navigateTo({
url: '/pages/draw/signin'
})
},
// 动画结束弹出
animationend(){
setTimeout(()=>{
this.pointShow = true
},1000)
},
// 关闭弹出
luckClosePop() {
uni.showModal({
title : '提示',
content : '是否放弃此权益',
success : res=> {
if (res.confirm) {
this.pointShow = false
}
// 获取抽奖默认信息(抽奖次数)
this.drawShow();
}
})
},
// 兑换乐心三件套
exchange(id) {
uni.navigateTo({
url: "choose?id=" + id
})
this.pointShow = false
},
// 使用权益券
useGp(id){
uni.navigateTo({
url: "right?luck_id=" + id
})
this.pointShow = false
},
// 处理未登录时的转跳
userNav(url){
let pageUrl = url
if(uni.getStorageSync("token")) {
uni.navigateTo({
url: pageUrl
})
return
}
// 去登录
uni.navigateTo({
url: '/pages/draw/signin'
})
},
// 退出登录
delStorage() {
uni.clearStorage()
uni.navigateTo({
url:'/pages/draw/signin'
})
},
// 禁止滚动
stopTouchMove() {
return false
}
}
}
</script>
<style lang="scss" scoped>
page {
background-color: #e4353a;
}
.luckBack {
position: fixed;
width: 100vw;
height: 100%;
left: 0;
top: 0;
}
.luck {
position: fixed;
width: 100%;
overflow: hidden;
height: 100%;
z-index: 9;
left: 0;
top: 0;
padding: 80rpx 40rpx 20rpx;
box-sizing: border-box;
overflow-y: scroll;
text-align: center;
}
.luckTitle {
width: 90%;
}
.drawFooter{
position: absolute;
z-index: 9;
}
.drawFooter-right {
width: 48%;
bottom: -70rpx;
right: -16%;
}
.drawFooter-left {
width: 60%;
bottom: -30rpx;
left: -18%;
}
/* 转盘 */
.drawContent{
margin: 60rpx auto 40rpx;
width: 100%;
padding-top: 100%;
position: relative;
}
.drawContent-arrow,
.drawContent-back,
.drawContent-award{
position: absolute;
}
.drawContent-back{
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.drawContent-award{
width: 76%;
height: 76%;
top: 5.5%;
left: 13.5%;
}
.drawContent-arrow{
width: 26%;
height: 26%;
top: 28%;
left: 39%;
}
.drawContent-number {
bottom: 38rpx;
color: #ffffff;
left: 0;
width: 100%;
position: absolute;
text-align: center;
padding-left: 20rpx;
box-sizing: border-box;
font-size: 28rpx;
}
.drawContent-number text {
font-weight: 600;
padding: 0 5rpx;
}
.dial-btns {
padding-bottom: 40rpx;
display: flex;
.dial-btns-go {
flex: 2;
text-align: center;
box-sizing: border-box;
background-color: #ffeace;
border: 2rpx solid transparent;
color: #5a0000;
margin-top: 40rpx;
border-radius: 50rpx;
height: 80rpx;
line-height: 80rpx;
margin: 50rpx 15rpx 0;
}
.dial-btns-order {
background-color: #f3524a;
color: #ffeace;
border-color: #ffeace;
}
}
/* 弹出 */
.popBack {
background-color: rgba(0, 0, 0, .7);
position: fixed;
width: 100%;
height: 100%;
left: 0;
top: 0;
z-index: 99;
}
.popCont {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-box-pack: center;
left: 0;
right: 0;
top: 0;
bottom: 0;
position: fixed;
width: 100%;
height: 100%;
z-index: 100;
padding: 140rpx 100rpx 0;
box-sizing: border-box;
}
.popTips{
color: #ffffff;
width: 100%;
padding: 140rpx 30rpx 30rpx;
box-sizing: border-box;
background-color: #de3935;
border-radius: 20rpx;
text-align: center;
color: #ffe3ba;
position: relative;
}
.luckTips {
position: absolute;
top: -120rpx;
z-index: 101;
width: 60%;
left: 25%;
}
.Tips-title {
font-size: 60rpx;
margin-bottom: 60rpx;
}
.Tips-text {
font-size: 34rpx;
}
.Tips-btn {
margin: 100rpx 0 20rpx;
position: relative;
padding-top: 14%;
}
.Tips-btn-image {
position: absolute;
width: 70%;
height: 100%;
left: 15%;
top: 0;
}
.Tips-btn-text {
font-size: 30rpx;
text-align: center;
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
color: #c35b34;
display: -webkit-box;
-webkit-box-orient: vertical;
font-weight: 600;
-webkit-box-pack: center;
}
.Tips-out {
font-size: 28rpx;
line-height: 90rpx;
}
.luckClose {
width: 100%;
text-align: center;
margin-top: 40rpx;
}
.luckClose image {
width: 64rpx;
opacity: .5;
}
/* 抽奖规则 */
.rulesBack {
background-color: rgba(0, 0, 0, .7);
position: fixed;
width: 100%;
height: 100%;
left: 0;
top: 0;
z-index: 99;
display: none;
}
.rulesCont {
-webkit-box-orient: vertical;
-webkit-box-pack: center;
left: 0;
right: 0;
top: 25vh;
bottom: 0;
position: fixed;
width: 100%;
height: 50vh;
z-index: 100;
display: none;
}
.rulesBack.active {
display: block;
}
.rulesCont.active {
display: -webkit-box;
}
.luckRules {
position: absolute;
left: 10%;
top: 0;
width: 80%;
box-sizing: border-box;
z-index: 100;
}
.textRules {
position: absolute;
left: 10%;
top: 0;
width: 80%;
z-index: 101;
height: 100%;
padding: 60rpx 80rpx;
color: #ffffff;
line-height: 58rpx;
box-sizing: border-box;
}
.rulesClose-title {
width: 60%;
display: block;
margin: 20rpx auto 40rpx;
}
.textRules-text {
height: 70%;
overflow: hidden;
overflow-y: scroll;
}
.rulesClose {
position: absolute;
z-index: 102;
right: 50rpx;
top: 60rpx;
width: 54rpx;
opacity: .8;
}
.roll {
height: 160rpx;
overflow: hidden;
background-color: #f5675a;
border: 4rpx solid #ffeace;
border-radius: 20rpx;
padding: 20rpx;
box-sizing: border-box;
margin: 60rpx 15rpx 0;
width: calc(100% - 30rpx);
.roll-title {
color: #ffeace;
font-size: 34rpx;
}
.roll-list {
height: 90rpx;
}
.roll-item {
height: 90rpx;
display: flex;
line-height: 90rpx;
color: #fff0dd;
font-size: 28rpx;
view {
flex: 3;
}
.roll-name {
text-align: left;
}
.roll-time {
text-align: right;
}
}
}
// 中间记录
.dial-record {
position: absolute;
top: 20%;
right: 0;
background-color: rgba($color: #ffdba2, $alpha: .9);
border-radius: 30rpx 0 0 30rpx;
line-height: 58rpx;
font-size: 30rpx;
color: #b80501;
padding: 0 15rpx 0 20rpx;
}
.setupLabel {
width: 100%;
text-align: center;
line-height: 90rpx;
color: #FFFFFF;
opacity: .8;
}
</style>

175
pages/draw/logs.vue Normal file
View File

@@ -0,0 +1,175 @@
<template>
<view class="content">
<!-- 抽奖tab -->
<view class="recordTab">
<view class="recordTab-label" :class="{active : stateType == item.type}" @tap="orderTab" v-for="(item, index) in couponLabel" :key="index" :data-index="(index)" :data-state="(item.type)">
{{ item.title }}
</view>
</view>
<view class="record" v-if="awardsArr.length > 0">
<view class="top">
<text>抽奖结果</text>
<text>抽奖状态</text>
<text>抽奖时间</text>
<text>操作</text>
</view>
<view class="list">
<view class="item" v-for="(item, index) in awardsArr" :key="index">
<text class="itemText" v-if="item.exchange_item">{{item.exchange_item.title}}</text>
<text class="itemText" v-if="item.status" :class="{red : item.status.value == 1}">{{item.status.text}}</text>
<text class="itemText">{{item.created_at}}</text>
<text class="itemText" v-if="stateType == 'right'">
<view v-if="item.status.value == 1" class="itemText-go itemText-active">已使用</view>
<navigator v-else class="itemText-go" hover-class="none" :url="'right?luck_id=' + item.exchage_log_id">去使用</navigator>
</text>
<text class="itemText" v-else>
<view v-if="item.status.value == 1" class="itemText-go itemText-active">已领取</view>
<navigator v-else class="itemText-go" hover-class="none" :url="'choose?id=' + item.exchage_log_id">去领取</navigator>
</text>
</view>
</view>
</view>
<view class="pack-center pages-hint" wx:else>
<image src="/static/img/staff_null.png"></image>
<view>暂无抽奖记录</view>
</view>
</view>
</template>
<script>
import { awards } from '@/apis/interfaces/draw'
export default {
data() {
return {
//抽奖Tab列表
couponLabel : [
{ title : "权益", type: 'right' },
{ title : "商品", type: 'goods' }
],
stateType : 'right', //订单状态
awardsArr : [] //记录列表
}
},
// 生命周期函数--监听页面加载
onLoad(options) {
this.couponId = options.id
},
// 生命周期函数--监听页面显示
onShow() {
// 存储环境-用户抽奖活动
getApp().globalData.envType = 'drawEnv'
// 获取记录列表
this.awardInfo();
},
methods: {
// 记录列表
awardInfo(id){
awards(this.couponId, {
type: this.stateType
}).then(res=>{
this.awardsArr = res
})
},
// tab选择
orderTab(e){
this.stateType = e.currentTarget.dataset.state
// 获取记录列表
this.awardInfo();
}
}
}
</script>
<style lang="scss" scoped>
.recordTab {
position: fixed;
width: 100%;
height: 100rpx;
border-bottom: 2rpx solid #ebebeb;
z-index: 99;
left: 0;
top: 0;
display: flex;
padding: 20rpx 0;
box-sizing: border-box;
background-color: #FFFFFF;
.recordTab-label {
flex: 2;
text-align: center;
position: relative;
&::after {
position: absolute;
content: '';
left: calc(50% - 20rpx);
bottom: 0;
background-color: #FFFFFF;
width: 40rpx;
height: 6rpx;
border-radius: 50rpx;
}
&.active {
color: #eb4747;
}
&.active::after {
background-color: #eb4747;
}
}
}
.record {
width: 100%;
margin-top: 100rpx;
.top {
color: #999999;
background-color: #FFFFFF;
line-height: 90rpx;
font-size: 28rpx;
overflow: hidden;
text {
display: inline-block;
width: 25%;
text-align: center;
}
}
.list {
.item {
background-color: #FFFFFF;
line-height: 90rpx;
overflow: hidden;
border-top: 2rpx solid #ebebeb;
font-size: 26rpx;
.itemText {
display: inline-block;
width: 25%;
text-align: center;
&:nth-child(2) {
color: green;
}
&:nth-child(2).active {
color: #eb4747;
}
&.red {
color: red;
}
.itemText-go {
margin: 0 auto;
background-color: #eb4747;
height: 44rpx;
line-height: 44rpx;
width: 60%;
text-align: center;
color: #FFFFFF;
border-radius: 10rpx;
font-size: 24rpx;
&.itemText-active {
background-color: #d3d3d3;
}
}
}
}
}

226
pages/draw/myCoupon.vue Normal file
View File

@@ -0,0 +1,226 @@
<template>
<view class="content">
<!-- 卡券tab -->
<view class="couponTab">
<view class="couponTab-label" :class="{active : stateType == item.used}" @tap="orderTab" v-for="(item, index) in couponLabel" :key="index" :data-state="(item.used)">
{{ item.title }}
<!-- <text v-if="item.used == 0">({{couponLabel.length}})</text>
<text v-else-if="item.used == 1">({{couponLabel.length}})</text>
<text v-else>({{couponLabel.length}})</text> -->
</view>
</view>
<!-- 卡券列表 -->
<view class="coupon" v-if="couponsArr.length > 0">
<view hover-class="none" class="couponList" v-for="(item, index) in couponsArr" :key="index">
<!-- 优惠券 -->
<image class="couponList-left" v-if="item.status == 0" src="/static/img/draw_coupon.png" mode="widthFix"></image>
<image class="couponList-left" v-else src="/static/img/draw_coupon_active.png" mode="widthFix"></image>
<view class="couponList-center">
<view class="nowrap couponList-title">{{item.name}}</view>
<view class="nowrap couponList-used">活动来源 {{item.activity_name}}</view>
<view class="couponList-time">{{item.startTime}} {{item.endTime}}</view>
</view>
<navigator hover-class="none" :url="'couponDetails?id=' + item.id" class="couponList-right" v-if="item.status == 0">
去使用
</navigator>
<view class="couponList-right couponList-right-active" v-else>
{{item.status == 1 ? '已使用' : '已过期'}}
</view>
<!-- v-if="item.status == 1" -->
<!-- <image 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="pagesLoding" v-if="lodingStats">
<block v-if="page.has_more">
<image class="pagesLodingIcon" src="/static/icons/refresh_loding.gif" mode="widthFix"></image>加载中...
</block>
<block v-else>
没有更多了~
</block>
</view>
</view>
<!-- 优惠券为空 -->
<view class="pack-center pages-hint" v-else>
<image src="/static/img/null_icon.png"></image>
<view>暂无优惠券</view>
</view>
</view>
</template>
<script>
import { coupons } from '@/apis/interfaces/draw'
export default {
data() {
return {
couponsArr : [], //优惠券列表
count : '', //优惠券-张数
//优惠券Tab列表
couponLabel : [
{ title : "未使用", used: 0 },
{ title : "已使用", used: 1 },
{ title : "已过期", used: 2 }
],
stateType : '0', //卡券状态
type : '', //卡券来源
}
},
// 生命周期函数--监听页面加载
onLoad(options) {
},
// 生命周期函数--监听页面显示
onShow() {
// 存储环境-抽奖活动
getApp().globalData.envType = 'drawEnv'
// 获取优惠券列表
this.couponInfo();
},
methods: {
// 订单列表
couponInfo(page){
coupons({
status: this.stateType,
page : page || ''
}).then(res=>{
let listArr = this.couponsArr,
newData = []
if(page == 1 || page == undefined) listArr = []
newData = listArr.concat(res.data)
this.couponsArr = 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/draw/signin'
});
}
}
});
}
})
},
// tab选择
orderTab(e){
this.stateType = e.currentTarget.dataset.state
// 获取优惠券列表
this.couponInfo();
},
// 页面相关事件处理函数--监听用户下拉动作
onPullDownRefresh() {
// 获取优惠券列表
this.couponInfo();
},
// 上拉加载
onReachBottom(){
this.lodingStats = true
let pageNumber = this.page.current
if(this.page.has_more){
pageNumber++
this.couponInfo(pageNumber)
}
}
}
}
</script>
<style lang="scss" scoped>
.couponTab{
position: fixed;
width: 100%;
height: 90rpx;
line-height: 90rpx;
z-index: 99;
left: 0;
top: 0;
display: flex;
box-sizing: border-box;
background-color: #FFFFFF;
.couponTab-label {
flex: 3;
text-align: center;
text {
display: block;
font-size: 28rpx;
color: #999999;
line-height: 54rpx;
}
&.active {
color: #eb4747;
}
&.active text {
color: #ff8b8b;
}
}
}
.coupon {
width: 100%;
margin-top: 90rpx;
padding: 30rpx;
box-sizing: border-box;
.couponList {
background-color: #FFFFFF;
height: 190rpx;
border-radius: 20rpx;
margin-bottom: 30rpx;
padding: 30rpx;
box-sizing: border-box;
position: relative;
.couponList-left {
width: 80rpx;
}
.couponList-center {
position: absolute;
width: 100%;
left: 0;
top: 0;
padding: 30rpx 100rpx 0 140rpx;
box-sizing: border-box;
color: #999999;
font-size: 28rpx;
.couponList-title {
color: #000000;
font-size: 30rpx;
font-weight: 600;
width: 70%;
}
.couponList-used {
line-height: 54rpx;
}
}
.couponList-right {
position: absolute;
width: 120rpx;
line-height: 50rpx;
text-align: center;
right: 25rpx;
font-size: 28rpx;
top: 25rpx;
color: #eb4747;
border: 2rpx solid #eb4747;
border-radius: 50rpx;
&.couponList-right-active {
border-color: #ddd;
color: #a9a9a9;
}
}
}
}
</style>

239
pages/draw/order.vue Normal file
View File

@@ -0,0 +1,239 @@
<template>
<view class="content">
<!-- 订单tab -->
<view class="couponTab">
<view class="couponTab-label" :class="{active : stateType == item.type}" @tap="orderTab" v-for="(item, index) in couponLabel" :key="index" :data-state="(item.type)">
{{ item.title }}
</view>
</view>
<!-- 订单列表 -->
<view class="order" v-if="ordersArr.length > 0">
<view class="orderList" v-for="(item, index) in ordersArr" :key="index">
<view class="orderList-title">
<image class="orderList-icon" src="/static/img/draw_order.png" mode="widthFix"></image>订单号{{item.orderid}}
</view>
<view class="orderList-label">
<view class="orderList-item">
<text>产品名称</text>{{item.award.title}}
</view>
<view class="orderList-item">
<text>产品价格</text>
{{item.amount != 0 ? '¥' + item.amount : '免费兑换'}}
</view>
</view>
<view class="orderList-tool">
<view class="orderList-time">
{{item.created_at}}
</view>
<!-- <navigator hover-class="none" url="orderDetails" class="orderList-btn">
</navigator> -->
</view>
</view>
<view class="pagesLoding" v-if="lodingStats">
<block v-if="page.has_more">
<image class="pagesLodingIcon" src="/static/icons/refresh_loding.gif" mode="widthFix"></image>加载中...
</block>
<block v-else>
没有更多了~
</block>
</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 { orders } from '@/apis/interfaces/draw'
export default {
data() {
return {
ordersArr : [], //订单列表
//订单Tab列表
couponLabel : [
{ title : "已支付", type: 'paid' },
{ title : "未支付", type: 'unpay' }
],
stateType : 'paid', //订单状态
page : 1, //分页
lodingStats : false //加载状态
}
},
// 生命周期函数--监听页面加载
onLoad(options) {
console.log(options)
this.stateType = options.type
},
onShow() {
// 存储环境-用户抽奖活动
getApp().globalData.envType = 'drawEnv'
// 获取订单列表
this.orderInfo();
},
methods: {
// 订单列表
orderInfo(page){
orders({
type: this.stateType,
page: page || ''
}).then(res=>{
console.log(res.data)
let listArr = this.ordersArr,
newData = []
if(page == 1 || page == undefined) listArr = []
newData = listArr.concat(res.data)
this.ordersArr = 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/draw/signin'
});
}
}
});
}
})
},
// tab选择
orderTab(e){
this.stateType = e.currentTarget.dataset.state
// 获取订单列表
this.orderInfo();
},
// 页面相关事件处理函数--监听用户下拉动作
onPullDownRefresh() {
// 获取订单列表
this.orderInfo();
},
// 上拉加载
onReachBottom(){
this.lodingStats = true
let pageNumber = this.page.current
if(this.page.has_more){
pageNumber++
this.orderInfo(pageNumber)
}
}
}
}
</script>
<style lang="scss">
.couponTab{
position: fixed;
width: 100%;
height: 100rpx;
z-index: 99;
left: 0;
top: 0;
display: flex;
padding: 20rpx 0;
box-sizing: border-box;
background-color: #FFFFFF;
.couponTab-label {
flex: 4;
text-align: center;
position: relative;
&::after {
position: absolute;
content: '';
left: calc(50% - 20rpx);
bottom: 0;
background-color: #FFFFFF;
width: 40rpx;
height: 6rpx;
border-radius: 50rpx;
}
&.active {
color: #eb4747;
}
&.active::after {
background-color: #eb4747;
}
}
}
.order {
width: 100%;
margin-top: 100rpx;
padding: 30rpx;
box-sizing: border-box;
.orderList {
background-color: #FFFFFF;
border-radius: 20rpx;
margin-bottom: 30rpx;
.orderList-title {
padding: 0 30rpx;
box-sizing: border-box;
line-height: 90rpx;
display: flex;
font-size: 30rpx;
border-bottom: 2rpx solid #eeeeee;
.orderList-icon {
width: 40rpx;
height: 40rpx;
margin: 25rpx 20rpx 0 0;
}
}
.orderList-label {
padding: 10rpx 30rpx;
border-bottom: 2rpx solid #eeeeee;
box-sizing: border-box;
font-size: 28rpx;
.orderList-item {
display: flex;
line-height: 60rpx;
text {
display: block;
flex: 1;
color: #666666;
}
}
}
.orderList-tool {
padding: 0 30rpx;
line-height: 90rpx;
box-sizing: border-box;
display: flex;
font-size: 28rpx;
color: #999999;
.orderList-time {
flex: 1;
}
.orderList-btn {
font-size: 28rpx;
color: #e31828;
border: 2rpx solid #e31828;
display: inline-block;
height: 54rpx;
line-height: 54rpx;
margin-top: 16rpx;
border-radius: 40rpx;
padding: 0 25rpx;
}
}
}
}
</style>

229
pages/draw/orderDetails.vue Normal file
View File

@@ -0,0 +1,229 @@
<template>
<view class="content">
<view class="orderData">
<view class="While">
<view class="orderData-cont-label">
<image class="orderData-cont-img" src="/static/icon/orderIcon_01.png" mode="aspectFill"></image>
<view class="orderData-cont-text">
<view class="orderData-cont-name">订单编号</view>
<view class="orderData-cont-copy">
<text class="nowrap">57843657846357834</text>
<view bindtap="copyUrl">复制</view>
</view>
</view>
</view>
<view class="orderData-cont-label">
<image class="orderData-cont-img" src="/static/icon/orderIcon_00.png" mode="aspectFill"></image>
<view class="orderData-cont-text">
<view class="orderData-cont-name">慢慢悠 <text>1800000000</text></view>
<view class="orderData-cont-copy">
汗水里156高
</view>
</view>
</view>
</view>
<view class="While reserveCont">
<view class="reserveCont-title">订单信息</view>
<view class="reserve-label">
<view class="reserve-name">商品</view>
<view class="reserve-text">乐心血压仪</view>
</view>
<view class="reserve-label">
<view class="reserve-name">金额</view>
<view class="reserve-text reserve-red">399</view>
</view>
<view class="reserve-label">
<view class="reserve-name">交易时间</view>
<view class="reserve-text">2022-09-23 15:00</view>
</view>
<view class="reserve-label">
<view class="reserve-name">运费金额</view>
<view class="reserve-text">免邮</view>
</view>
<view class="reserve-label">
<view class="reserve-name">交易状态</view>
<view class="reserve-text green">待发货</view>
</view>
</view>
<view class="While reserveCont">
<view class="reserveCont-title">物流信息</view>
<view class="reserve-label">
<view class="reserve-name">物流公司</view>
<view class="reserve-text">顺丰速递</view>
</view>
<view class="reserve-label">
<view class="reserve-name">收货姓名</view>
<view class="reserve-text green">慢悠悠</view>
</view>
<view class="reserve-label">
<view class="reserve-name">收货电话</view>
<view class="reserve-text green">15000000000</view>
</view>
<view class="reserve-label">
<view class="reserve-name">物流单号</view>
<view class="reserve-text">6546546546546<view class="reserve-copy" bindtap="copyUrl">复制</view>
</view>
</view>
</view>
</view>
<view class="order-data-footer">
<navigator hover-class="none" class="order-btn" open-type="navigateBack">返回订单</navigator>
<view class="order-btn" bindtap="signClick">签收订单</view>
</view>
</view>
</template>
<script>
import { } from '@/apis/interfaces/draw'
export default {
data() {
return {
}
},
onShow() {
// 存储环境-用户抽奖活动
getApp().globalData.envType = 'drawEnv'
},
methods: {
}
}
</script>
<style lang="scss">
page {
padding: 30rpx;
box-sizing: border-box;
}
.orderData {
border-bottom: 70rpx transparent solid;
}
.While {
border-radius: 10rpx;
margin-bottom: 30rpx;
background-color: #FFFFFF;
box-shadow: 0 0 10rpx rgba(0, 0, 0, .05);
}
/* 订单 */
.orderData-cont-label {
padding: 40rpx 30rpx;
display: flex;
box-sizing: border-box;
border-bottom: #f2f2f2 2rpx solid;
.orderData-cont-img {
width: 48rpx;
height: 48rpx;
vertical-align: middle;
}
.orderData-cont-text {
width: calc(100% - 68rpx);
margin-left: 20rpx;
box-sizing: border-box;
}
.orderData-cont-name {
margin-bottom: 10rpx;
}
.orderData-cont-name text {
color: #999;
padding-left: 20rpx;
}
.orderData-cont-copy {
display: flex;
font-size: 28rpx;
color: #999;
}
.orderData-cont-copy text {
flex: 1;
display: inline-block;
margin-right: 20rpx;
}
.orderData-cont-copy view {
color: #e31828;
}
}
/* 规格 */
.reserveCont-title {
font-weight: 600;
padding: 30rpx;
}
.reserve-label {
display: flex;
padding: 0 30rpx 30rpx;
box-sizing: border-box;
font-size: 28rpx;
}
.reserve-name {
flex: 1;
width: 200rpx;
margin-right: 20rpx;
color: #7e7e7e;
}
.reserve-text {
width: calc(100% - 240rpx);
text-align: right;
line-height: 50rpx;
}
.reserve-copy {
color: #fa8524;
border: #fa8524 2rpx solid;
display: inline-block;
height: 34rpx;
line-height: 34rpx;
font-size: 26rpx;
padding: 0 10rpx;
border-radius: 4rpx;
margin-left: 10rpx;
}
.reserve-red {
font-weight: 600;
color: #e31828;
}
/* 底部菜单 */
.order-data-footer {
position: fixed;
bottom: 0;
left: 0;
right: 0;
border-top: solid 1rpx #f2f2f2;
padding-top: 17rpx;
padding-right: 30rpx;
padding-left: 30rpx;
height: 83rpx;
background: white;
display: flex;
flex-wrap: wrap;
flex-direction: row-reverse;
z-index: 9;
}
.order-btn {
margin-left: 20rpx;
height: 58rpx;
line-height: 58rpx;
box-sizing: border-box;
border: solid 1rpx #747788;
padding: 0 20rpx;
font-size: 26rpx;
border-radius: 10rpx;
margin-top: 5rpx;
}
</style>

190
pages/draw/password.vue Normal file
View File

@@ -0,0 +1,190 @@
<template>
<view class="content">
<image class="drawTitle" src="@/static/img/draw-title.png" mode="widthFix"></image>
<view class="campus-cont">
<form @submit="forgetlogin">
<view class="campus-inputs">
<image class="campus-form-icon" src="/static/img/draw_login_02.png" mode="aspectFill"></image>
<input class="campus-form-input" maxlength="11" type="number" placeholder="请输入手机号" @input="getNameValue" name="mobile" placeholder-style="color:#c9c9c9;"></input>
</view>
<view class="inputs-code">
<view class="campus-inputs">
<image class="campus-form-icon" src="/static/img/draw_login_04.png" mode="aspectFill"></image>
<input class="campus-form-input" type="number" placeholder="请输入验证码" @input="getCodeValue" maxlength="4" placeholder-style="color:#c9c9c9;"></input>
</view>
<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,
}
},
// 生命周期函数--监听页面显示
onShow() {
// 存储环境-用户抽奖活动
getApp().globalData.envType = 'drawEnv'
},
methods: {
// 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/draw/setPassword'
})
}).catch(err =>{
uni.showToast({
title: err.message,
icon : 'none'
})
})
}
}
}
</script>
<style lang="scss">
page {
background-color: #f67b5a;
}
.drawTitle {
width: 100%;
}
.campus-cont {
padding: 10rpx 50rpx 60rpx;
box-sizing: border-box;
.campus-inputs {
background-color: #FFFFFF;
border-radius: 10rpx;
margin-bottom: 30rpx;
height: 100rpx;
line-height: 100rpx;
display: flex;
padding: 0 30rpx;
box-sizing: border-box;
.campus-form-icon {
width: 50rpx;
height: 50rpx;
margin: 25rpx 20rpx 0 0;
}
.campus-form-input {
width: calc(100% - 70rpx);
height: 100%;
line-height: 100rpx;
font-size: 32rpx;
}
}
.campus-form-btn {
background-color: #ffe455;
border-radius: 10rpx;
line-height: 100rpx;
font-size: 36rpx;
color: #6a4902;
margin-top: 20rpx;
box-shadow: 4rpx 4rpx 6rpx #c62024;
}
.login-box {
display: flex;
line-height: 90rpx;
padding: 0 10rpx;
box-sizing: border-box;
color: #FFFFFF;
font-size: 32rpx;
.login-box-flex {
flex: 1;
}
}
}
.inputs-code {
display: flex;
.campus-inputs {
flex: 1;
}
.campus-form-code {
background-color: #ffe455;
color: #735b1f;
font-size: 32rpx;
height: 100rpx;
line-height: 100rpx;
margin-left: 20rpx;
}
}
</style>

195
pages/draw/register.vue Normal file
View File

@@ -0,0 +1,195 @@
<template>
<view class="content">
<image class="drawTitle" src="@/static/img/draw-title.png" mode="widthFix"></image>
<view class="campus-cont">
<form @submit="submitRegister">
<view class="campus-inputs">
<image class="campus-form-icon" src="/static/img/draw_login_02.png" mode="aspectFill"></image>
<input class="campus-form-input" maxlength="11" type="number" placeholder="请输入手机号" @input="getNameValue" name="mobile" placeholder-style="color:#c9c9c9;"></input>
</view>
<view class="inputs-code">
<view class="campus-inputs">
<image class="campus-form-icon" src="/static/img/draw_login_04.png" mode="aspectFill"></image>
<input class="campus-form-input" type="number" placeholder="请输入验证码" @input="getCodeValue" maxlength="4" placeholder-style="color:#c9c9c9;"></input>
</view>
<button class="campus-form-code" @tap="getCode" :disabled="disabled" hover-class="none">{{ codename }}</button>
</view>
<view class="campus-inputs">
<image class="campus-form-icon" src="/static/img/draw_login_03.png" mode="aspectFill"></image>
<input class="campus-form-input" maxlength="6" type="password" placeholder="请设置登录密码" name="password" placeholder-style="color:#c9c9c9;"></input>
</view>
<view class="campus-inputs">
<image class="campus-form-icon" src="/static/img/draw_login_03.png" mode="aspectFill"></image>
<input class="campus-form-input" maxlength="6" type="password" placeholder="请确认登录密码" name="password_confirmation" placeholder-style="color:#c9c9c9;"></input>
</view>
<button class="campus-form-btn" form-type="submit">立即注册</button>
</form>
<view class="login-box">
<navigator class="login-box-flex" hover-class="none" url="signin">已有账号立即登录</navigator>
</view>
</view>
</view>
</template>
<script>
import { register, send, auth } from '@/apis/interfaces/auth'
export default {
data() {
return {
codename : '获取验证码',
mobileNo : '', // 手机号
code : '', // 验证码
disabled : false,
}
},
// 生命周期函数--监听页面显示
onShow() {
// 存储环境-用户抽奖活动
getApp().globalData.envType = 'drawEnv'
},
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,
code = this.code || ''
register({
mobile : formValue.mobile,
password : formValue.password,
password_confirmation : formValue.password_confirmation,
code : code
}).then(res => {
this.$store.commit('setToken', res.token)
uni.reLaunch({
url: '/pages/draw/index'
})
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
})
}
}
}
</script>
<style lang="scss">
page {
background-color: #f67b5a;
}
.drawTitle {
width: 100%;
}
.campus-cont {
padding: 10rpx 50rpx 20rpx;
box-sizing: border-box;
.campus-inputs {
background-color: #FFFFFF;
border-radius: 10rpx;
margin-bottom: 30rpx;
height: 100rpx;
line-height: 100rpx;
display: flex;
padding: 0 30rpx;
box-sizing: border-box;
.campus-form-icon {
width: 50rpx;
height: 50rpx;
margin: 25rpx 20rpx 0 0;
}
.campus-form-input {
width: calc(100% - 70rpx);
height: 100%;
line-height: 100rpx;
font-size: 32rpx;
}
}
.campus-form-btn {
background-color: #ffe455;
border-radius: 10rpx;
line-height: 100rpx;
font-size: 36rpx;
color: #6a4902;
margin-top: 40rpx;
box-shadow: 4rpx 4rpx 6rpx #c62024;
}
.login-box {
line-height: 90rpx;
padding: 0 10rpx;
box-sizing: border-box;
color: #FFFFFF;
font-size: 32rpx;
text-align: center;
}
}
.inputs-code {
display: flex;
.campus-inputs {
flex: 1;
}
.campus-form-code {
background-color: #ffe455;
color: #735b1f;
font-size: 32rpx;
height: 100rpx;
line-height: 100rpx;
margin-left: 20rpx;
}
}
</style>

797
pages/draw/right.vue Normal file
View File

@@ -0,0 +1,797 @@
<template>
<view>
<!-- 按钮 -->
<view class="newrightsBtn" @click="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 class="rightsPoint">
<view class="rightsPoint-cont">
<view class="rightsPoint-top">
<image src="/static/icon/Point_icon.png"></image>
<text>重要提示</text>
</view>
<view class="rightsPoint-text" :class="{active : pointMoreShow}">
<rich-text :nodes="notice.notification"></rich-text>
</view>
<view class="pointMore" bindtap="pointMoreTap">
<text>{{pointMoreShow == true ? '收起' : '展开'}}</text>
<image :src="pointMoreShow == true ? '/static/img/pointMore-up.png' : '/static/img/pointMore.png'">
</image>
</view>
</view>
</view>
<!-- 卡券 -->
<view style="padding-bottom: 220px">
<view class="cont">
<view class="contBack">
<image class="classBack" src="https://card.ysd-bs.com/storage/materials/2022/05/13/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.title}}
</view>
</view>
</view>
</view>
<!-- 数量 -->
<view class="rightsNumber">
<image class="rightsGoods-img" :src="rightData.detail.goods_cover" mode="widthFix"></image>
<view class="rightsGoods">
<view class="nowrap rightsGoods-text">
{{ rightData.detail.title }}
</view>
<view class="rightsGoods-price">
<view class="rightsGoods-number">{{ rightData.detail.amount }}</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" :class="{active : rightData.num != 1}">+</view>
</view> -->
</view>
</view>
</view>
<!-- 购买须知 -->
<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 { exchangesBuy } from '@/apis/interfaces/draw'
import { activityBuy } from '@/apis/interfaces/draw'
import { getAuthUrl, wpayH5Info, h5Pay } from '@/apis/interfaces/rights'
const jweixin = require('jweixin-module'); //获取微信支付
export default {
data() {
return {
tradeNo : '' , //订单
rightData: {
detail : '', // 权益内容
logId : '', // 权益id
addressSee : '', // 收货地址
num : 1, // 购买数量
moreAmount : '', // 产品总金额
freight : '', // 运费
total : '' // 总金额
},
notice : {
remark : '', // 购买须知
content : '', // 内容介绍
noticeShow : true ,// 购买须知状态
notification: ''
},
buyWay : {
platformCp : [], // 选择提交数组
platIndex : 0, // 选择提交方式下标
isdeliver : -1 // 选择提交方式
},
address : {
allAddress : [], // 收货地址列表
addressShow : false // 地址显示状态
},
disabled : false, //购买按钮状态
pointMoreShow : false,
}
},
// 生命周期函数--监听页面加载
onLoad(options) {
this.rightData.logId = options.luck_id
// 判断是否微信授权登录过 只有外部游览器才用到(支付需要授权微信环境)
let status = navigator.userAgent.toLowerCase();
if (status.match(/MicroMessenger/i) == "micromessenger" && !options.code) {
let locationUrl = window.location.pathname.substr(1) + window.location.search
getAuthUrl(locationUrl).then(res=> {
window.location.href = res
})
}
this.openid = options.openid || ''
this.code = options.code || '' //用code换取oppid
},
// 生命周期函数--监听页面显示
onShow() {
// 存储环境-抽奖活动
getApp().globalData.envType = 'drawEnv'
// 获取详情
this.rightsInfo();
},
methods: {
// 详情
rightsInfo() {
activityBuy({activity_exchange_log_id: this.rightData.logId, qty: 1}).then(res => {
this.rightData.detail = res.detail
this.rightData.moreAmount = res.amount
this.rightData.total = res.total
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;"')
this.notice.notification = res.detail.notification.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block;"')
}).catch(err => {})
},
// 须知展开收起状态
noticeTap() {
this.notice.noticeShow = !this.notice.noticeShow
},
// 收银台跳转
payment() {
exchangesBuy({
name : '',
mobile : '',
address : '',
activity_exchange_item_goods_id: '',
activity_exchange_log_id: this.rightData.logId,
qty : 1
}).then(res=>{
this.tradeNo = res.trade_no
this.wxBrowser()
}).catch(err => {
uni.showToast({
title: err.message,
icon: 'none'
})
});
},
// 当支付环境为微信游览器情况下
wxBrowser() {
wpayH5Info({
url: location.href.split('#')[0],
list:'chooseWXPay'
}).then(wechatConfig => {
let wxConfig = JSON.parse(wechatConfig)
jweixin.config({
appId: wxConfig.appId,
debug: false,
jsApiList: wxConfig.jsApiList,
signature: wxConfig.signature,
nonceStr: wxConfig.nonceStr,
timestamp: wxConfig.timestamp
})
jweixin.ready(() => {
let wechaUrl = 'payments/wechat'
h5Pay(wechaUrl, {
channel: 'h5',
trade_no: this.tradeNo,
code: this.code
}).then(wechatRes => {
let wechatPay = JSON.parse(wechatRes)
jweixin.chooseWXPay({
timestamp: wechatPay.timeStamp,
nonceStr: wechatPay.nonceStr,
package: wechatPay.package,
signType: wechatPay.signType,
paySign: wechatPay.paySign,
success: payRes => {
// 支付成功
uni.redirectTo({
url: 'order?type=paid'
})
},
cancel: () =>{
// 取消支付
uni.redirectTo({
url: 'order?type=unpay'
})
}
})
})
})
}).catch(err => {
uni.showToast({
title: err.message,
icon: 'none'
})
if (!err.login) {
uni.reLaunch({
url: '/pages/draw/signin'
});
}
})
},
/**
* 重要提示显示
*/
pointMoreTap() {
this.pointMoreShow = !this.pointMoreShow
}
}
}
</script>
<style lang="scss" scoped>
page {
background-color: #eeeeee;
}
/* 权益内容 */
.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: 40rpx;
box-sizing: border-box;
.rightsGoods-img {
width: 160rpx;
height: 160rpx;
border-radius: 10rpx;
}
.rightsGoods {
position: absolute;
left: 0;
top: 0;
width: 100%;
padding: 60rpx 40rpx 0 230rpx;
box-sizing: border-box;
.rightsGoods-text {
font-size: 36rpx;
margin-bottom: 35rpx;
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: 30rpx 20rpx;
box-sizing: border-box;
.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;
}
}
}
}
.rightsPoint {
position: fixed;
left: 0;
bottom: 160rpx;
background: #eeeeee;
z-index: 9;
width: 100%;
padding: 20rpx 20rpx 10rpx;
box-sizing: border-box;
}
.rightsPoint-cont {
width: 100%;
background: #eeeeee;
border-radius: 10rpx;
position: relative;
max-height: 50vh;
overflow-y: scroll;
}
.rightsPoint-top {
font-size: 28rpx;
display: flex;
padding: 0 20rpx 20rpx;
box-sizing: border-box;
font-weight: 600;
}
.rightsPoint-top image {
width: 36rpx;
height: 36rpx;
margin-right: 10rpx;
}
.rightsPoint-text {
padding: 0 20rpx;
box-sizing: border-box;
font-size: 24rpx;
line-height: 44rpx;
height: 90rpx;
transition: height 25s;
overflow: hidden;
}
.rightsPoint-text.active {
height: auto;
transition: 2s;
}
.rightsPoint-text view {
position: relative;
padding-left: 40rpx;
}
.rightsPoint-text view::after {
position: absolute;
content: '';
left: 10rpx;
top: 20rpx;
background: #000;
width: 10rpx;
height: 10rpx;
border-radius: 50%;
}
.rightsPoint-bolck {
position: absolute;
top: 0;
left: 0;
height: calc(100% - 40rpx);
}
.pointMore {
text-align: center;
width: 100%;
background: #eeeeee;
height: 80rpx;
line-height: 82rpx;
position: relative;
margin-top: 10rpx;
}
.pointMore::after {
position: absolute;
content: '';
left: 0;
top: 0;
width: 100%;
height: 2rpx;
background: #f2ecde;
}
.pointMore text {
font-size: 28rpx;
color: #c38e00;
animation: dong 1.8s infinite;
display: inline-block;
}
.pointMore image {
width: 30rpx;
height: 30rpx;
margin-left: 4rpx;
vertical-align: -4rpx;
animation: dong 1.8s infinite;
}
@keyframes dong {
0% {
transform: translate(0px, 0px);
}
50% {
transform: translate(0px, -6rpx);
}
100% {
transform: translate(0px, 0px);
}
}
</style>

111
pages/draw/setPassword.vue Normal file
View File

@@ -0,0 +1,111 @@
<template>
<view class="content">
<image class="drawTitle" src="@/static/img/draw-title.png" mode="widthFix"></image>
<view class="campus-cont">
<form @submit="forgetlogin">
<view class="campus-inputs">
<image class="campus-form-icon" src="/static/img/draw_login_03.png" mode="aspectFill"></image>
<input class="campus-form-input" maxlength="6" type="password" placeholder="请设置登录密码" name="password" placeholder-style="color:#c9c9c9;"></input>
</view>
<view class="campus-inputs">
<image class="campus-form-icon" src="/static/img/draw_login_03.png" mode="aspectFill"></image>
<input class="campus-form-input" maxlength="6" type="password" placeholder="请确认登录密码" name="newpassword" placeholder-style="color:#c9c9c9;"></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 {
}
},
// 生命周期函数--监听页面显示
onShow() {
// 存储环境-用户抽奖活动
getApp().globalData.envType = 'drawEnv'
},
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/draw/index'
})
}).catch(err =>{
uni.showToast({
title: err.message,
icon : 'none'
})
})
}
}
}
</script>
<style lang="scss">
page {
background-color: #f67b5a;
}
.drawTitle {
width: 100%;
}
.campus-cont {
padding: 10rpx 50rpx 0;
box-sizing: border-box;
.campus-inputs {
background-color: #FFFFFF;
border-radius: 10rpx;
margin-bottom: 30rpx;
height: 100rpx;
line-height: 100rpx;
display: flex;
padding: 0 30rpx;
box-sizing: border-box;
.campus-form-icon {
width: 50rpx;
height: 50rpx;
margin: 25rpx 20rpx 0 0;
}
.campus-form-input {
width: calc(100% - 70rpx);
height: 100%;
line-height: 100rpx;
font-size: 32rpx;
}
}
.campus-form-btn {
background-color: #ffe455;
border-radius: 10rpx;
line-height: 100rpx;
font-size: 36rpx;
color: #6a4902;
margin-top: 40rpx;
box-shadow: 4rpx 4rpx 6rpx #c62024;
}
.login-box {
line-height: 90rpx;
padding: 0 10rpx;
box-sizing: border-box;
color: #FFFFFF;
font-size: 32rpx;
text-align: center;
}
}
</style>

125
pages/draw/signin.vue Normal file
View File

@@ -0,0 +1,125 @@
<template>
<view class="content">
<image class="drawTitle" src="@/static/img/draw-title.png" mode="widthFix"></image>
<view class="campus-cont">
<form @submit="forgetlogin">
<view class="campus-inputs">
<image class="campus-form-icon" src="/static/img/draw_login_02.png" mode="aspectFill"></image>
<input class="campus-form-input" maxlength="11" type="number" placeholder="请输入手机号" @input="getNameValue" name="mobile" placeholder-style="color:#c9c9c9;"></input>
</view>
<view class="campus-inputs">
<image class="campus-form-icon" src="/static/img/draw_login_03.png" mode="aspectFill"></image>
<input class="campus-form-input" maxlength="6" type="password" placeholder="请输入登录密码" name="password" placeholder-style="color:#c9c9c9;"></input>
</view>
<view class="resPassword">
</view>
<button class="campus-form-btn" form-type="submit">立即登录</button>
</form>
<view class="login-box">
<navigator class="login-box-flex" hover-class="none" url="register">快速注册</navigator>
<navigator hover-class="none" url="password">忘记密码</navigator>
</view>
</view>
</view>
</template>
<script>
import { passlogin } from '@/apis/interfaces/auth'
export default {
data() {
return {
mobileNo : '', // 手机号
disabled : false,
}
},
// 生命周期函数--监听页面显示
onShow() {
// 存储环境-用户抽奖活动
getApp().globalData.envType = 'drawEnv'
},
methods: {
// mobileNo
getNameValue(e) {
this.mobileNo = e.detail.value
},
// 立即登录
forgetlogin(e){
let mobileNo = e.detail.value.mobile || '',
password = e.detail.value.password || ''
passlogin({
mobile : mobileNo,
password: password
}).then(res => {
this.$store.commit('setToken', res.token)
uni.reLaunch({
url: '/pages/draw/index'
})
}).catch(err =>{
uni.showToast({
title: err.message,
icon : 'none'
})
})
}
}
}
</script>
<style lang="scss" scoped>
page {
background-color: #f67b5a;
}
.drawTitle {
width: 100%;
}
.campus-cont {
padding: 10rpx 50rpx 20rpx;
box-sizing: border-box;
.campus-inputs {
background-color: #FFFFFF;
border-radius: 10rpx;
margin-bottom: 30rpx;
height: 100rpx;
line-height: 100rpx;
display: flex;
padding: 0 30rpx;
box-sizing: border-box;
.campus-form-icon {
width: 50rpx;
height: 50rpx;
margin: 25rpx 20rpx 0 0;
}
.campus-form-input {
width: calc(100% - 70rpx);
height: 100%;
line-height: 100rpx;
font-size: 32rpx;
}
}
.campus-form-btn {
background-color: #ffe455;
border-radius: 10rpx;
line-height: 100rpx;
font-size: 36rpx;
color: #6a4902;
margin-top: 40rpx;
box-shadow: 4rpx 4rpx 6rpx #c62024;
}
.login-box {
display: flex;
line-height: 90rpx;
padding: 0 10rpx;
box-sizing: border-box;
color: #FFFFFF;
font-size: 32rpx;
.login-box-flex {
flex: 1;
}
}
}
</style>

74
pages/draw/success.vue Normal file
View File

@@ -0,0 +1,74 @@
<template>
<view class="content">
<view class="examine">
<image src="https://lifetest.ysd-bs.com/storage/materials/2022/09/26/pxdn3_03.png" mode="widthFix"></image>
<view class="text">
<view class="title">兑换成功</view>
<view class="time">管理员审核后,尽快给你发货,请您耐心等待</view>
</view>
<view @click="orderClick" class="return">我的订单</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {}
},
// 生命周期函数--监听页面显示
onShow() {
// 存储环境-用户抽奖活动
getApp().globalData.envType = 'drawEnv'
},
methods: {
orderClick() {
uni.redirectTo({
url: 'order?type=paid'
})
}
}
}
</script>
<style lang="scss">
page {
background-color: #ffffff;
}
.examine {
padding: 240rpx 0 30rpx;
box-sizing: border-box;
text-align: center;
}
.examine image {
width: 80%;
margin: 0 auto 30rpx;
}
.title {
font-weight: 600;
font-size: 42rpx;
margin-bottom: 30rpx;
color: #f33111;
}
.time {
color: #999999;
line-height: 50rpx;
}
.return {
font-size: 34rpx;
display: inline-block;
margin-top: 80rpx;
background-color: #f33111;
padding: 0 180rpx;
height: 90rpx;
line-height: 90rpx;
border-radius: 10rpx;
box-shadow: 0 3rpx 6rpx 4rpx rgba(214, 6, 6, .6);
color: #FFFFFF;
}
</style>