oil-station/gasStation-uni/pagesMy/invite/invite.vue

749 lines
15 KiB
Vue
Raw Normal View History

2024-08-16 18:26:19 +08:00
<template>
<view class="content">
<view class="container">
2024-09-24 15:47:31 +08:00
2024-08-16 18:26:19 +08:00
<view class="faimg">
<view class="box-img">
2024-09-24 15:47:31 +08:00
<image src="../../static/new/top_.png" mode="aspectFit"></image>
2024-08-16 18:26:19 +08:00
</view>
2024-09-24 15:47:31 +08:00
</view>
<view class="hbbox">
<view class="h-box">
2024-10-16 18:01:22 +08:00
<view class="or-box" @click="show=!show">
2024-09-24 15:47:31 +08:00
<image src="../../static/new/fxrwm.png" mode=""></image>
<view class="min-size">分享二维码</view>
</view>
2024-09-25 10:38:08 +08:00
<view class="or-box" @click="goList()">
2024-09-24 15:47:31 +08:00
<image src="../../static/new/jljl.png" mode=""></image>
<view class="min-size">奖励记录</view>
</view>
</view>
2024-10-17 11:27:25 +08:00
<button class="or-aniu" open-type="share">
2024-09-24 15:47:31 +08:00
立即分享
2024-10-17 11:27:25 +08:00
</button>
2024-09-24 16:47:34 +08:00
</view>
<view class="h_bs">
<view class="title_">推荐会员消费有礼</view>
2024-10-16 18:01:22 +08:00
<view class="d-s1" @click="goDetails()">
2024-09-24 16:47:34 +08:00
<view class="hui-size">详情</view>
<u-icon name="arrow-right" color="#999999" size="12"></u-icon>
2024-08-16 18:26:19 +08:00
</view>
</view>
2024-10-16 18:01:22 +08:00
<view v-if="activeInfo.couponList">
<view class="si_" v-for="(item,index) in activeInfo.couponList" :key="index">
<view class="">赠送优惠券</view>
2024-10-17 11:27:25 +08:00
<view class="">{{item.giftCardName || "--"}}</view>
2024-10-16 18:01:22 +08:00
</view>
2024-09-24 16:47:34 +08:00
</view>
2024-10-16 18:01:22 +08:00
2024-09-24 16:47:34 +08:00
<view class="h_bs">
<view class="title_">会员卡详情</view>
2024-08-16 18:26:19 +08:00
2024-09-24 16:47:34 +08:00
</view>
<view class="backf">
<view class="n_hang">
<view class="">特权说明</view>
2024-10-17 11:27:25 +08:00
<view class="">加油立享优惠</view>
2024-08-16 18:26:19 +08:00
</view>
2024-09-24 16:47:34 +08:00
<view class="n_hang">
<view class="">有效期</view>
<view class="">长期有效</view>
</view>
<view class="n_hang">
<view class="">使用须知</view>
<view class="">仅限个人使用</view>
</view>
</view>
<view class="si_t">
<view style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; ">
<view class="title_">适用门店</view>
2024-10-09 17:48:51 +08:00
<view class="d-s" style=" color: #FF2828; margin: 0px; " @click="goGoGo()">
2024-09-24 16:47:34 +08:00
<image src="../../static/icon/reddh.png" style="width: 14px; height: 14px; "></image> 导航
2024-08-16 18:26:19 +08:00
</view>
</view>
2024-10-09 17:48:51 +08:00
<view class="">{{store.name}}</view>
<view class="">{{store.address}} | {{distance}}km</view>
2024-08-16 18:26:19 +08:00
</view>
2024-09-24 16:47:34 +08:00
<!-- 顶部区域 -->
2024-10-09 17:48:51 +08:00
<u-overlay :show="show" @click="show = !show">
2024-09-25 10:38:08 +08:00
<view class="warp">
<view class="warp-cent" @tap.stop>
<view class="title_or">扫码领会员</view>
<view class="d-s">
<view class="touxiang">
2024-10-17 11:27:25 +08:00
<image v-if="!store.logo" src="../../static/logo.png" mode=""></image>
<image v-else :src="baseUrl+store.logo" mode=""></image>
2024-09-25 10:38:08 +08:00
</view>
<view class="">
2024-10-17 11:27:25 +08:00
<view class="tiitle_">{{store.name}}</view>
2024-09-25 10:38:08 +08:00
<view class="size_">油站会员卡</view>
</view>
</view>
<view style="width: 100%;display: flex;justify-content: center; ">
<w-qrcode :options="options"></w-qrcode>
</view>
</view>
<view class="warp-bottom" @tap.stop>
<view class="bott_box">
<view class=""></view>
<view class="">选择方式</view>
<view class="" @click="show = false">
<u-icon name="close" size="16"></u-icon>
</view>
</view>
<view class="bott-box">
2024-10-16 18:01:22 +08:00
<view class="" @click="savePicture()">
2024-09-25 10:38:08 +08:00
<view class="">
<image src="../../static/my/fztp.png" style="width: 40px; height: 40px; "></image>
</view>
<view class="">
保存图片
</view>
</view>
2024-10-16 18:01:22 +08:00
<view class="" @click="copyLink()">
2024-09-25 10:38:08 +08:00
<view class="">
<image src="../../static/my/fzlj.png" style="width: 40px; height: 40px; "></image>
</view>
<view class="">
复制链接
</view>
</view>
</view>
</view>
2024-08-16 18:26:19 +08:00
</view>
2024-09-25 10:38:08 +08:00
</u-overlay>
2024-09-24 15:47:31 +08:00
2024-08-16 18:26:19 +08:00
</view>
</view>
</template>
<script>
import wx from 'weixin-js-sdk' // 引入微信js-sdk
import request from "../../utils/request";
export default {
data() {
return {
2024-10-17 11:27:25 +08:00
titles:"",
2024-08-16 18:26:19 +08:00
query: {
storeId: ''
},
allAmount: 0.0,
2024-10-16 18:01:22 +08:00
activeInfo: {},
2024-08-16 18:26:19 +08:00
activeRecommendRecordsList: [],
title: '',
userId: '',
storeId: '',
2024-10-09 17:48:51 +08:00
show: false,
2024-08-16 18:26:19 +08:00
options: {
code: 'https://oilapi.youkerr.com/oily?storeId=' + uni.getStorageSync('storeId') + '&userId=' + uni
.getStorageSync('userId') + '&type=yaoqingyouli',
// code: 'https://www.tuofeng.cc/oily?storeId=' + uni.getStorageSync('storeId') + ' &userId=' + uni
// .getStorageSync('userId'), // 生成二维码的值
2024-09-25 10:38:08 +08:00
size: 400, // 460代表生成的二维码的宽高均为460rpx
2024-08-16 18:26:19 +08:00
},
2024-10-09 17:48:51 +08:00
// 当前经度信息
longitude: "",
// 当前纬度信息
latitude: "",
// 店铺经度信息
lon: "",
// 店铺纬度信息
lat: "",
2024-10-17 11:27:25 +08:00
// url信息
baseUrl: this.$baseUrl,
2024-10-09 17:48:51 +08:00
// 店铺信息
store: {
name: "测试油站",
description: "济南分店",
address: "济南槐荫区"
},
distance: 0,
2024-08-16 18:26:19 +08:00
}
},
onLoad() {
2024-09-24 15:47:31 +08:00
// let codes = 'https://oilapi.youkerr.com/oily?storeId=' + uni.getStorageSync('storeId') +
// '&userId=' + uni.getStorageSync('userId') + '&type=yaoqingyouli'
// console.log(codes);
// this.query.storeId = uni.getStorageSync("storeId");
2024-10-17 11:27:25 +08:00
// #ifdef MP-WEIXIN
wx.showShareMenu({
withShareTicket: true,
//设置下方的Menus菜单才能够让发送给朋友与分享到朋友圈两个按钮可以点击
menus: ["shareAppMessage", "shareTimeline"]
})
// #endif
2024-08-16 18:26:19 +08:00
},
2024-10-16 18:01:22 +08:00
onShow() {
this.getAllAmount();
this.getActiveRecommendRecords();
this.getAddress(uni.getStorageSync("storeId"))
},
2024-08-16 18:26:19 +08:00
onShareAppMessage(res) {
if (res.from === 'button') { // 来自页面内分享按钮
console.log(res.target)
}
return {
title: this.titles,
path: '/pages/index/index'
}
},
onShareTimeline(res) {
return {
title: this.titles,
path: '/pages/index/index'
}
},
components: {
},
onShare() {
wx.showShareMenu({
withShareTicket: true,
success: function() {
console.log('成功开启分享菜单')
},
fail: function(res) {
console.log('开启分享菜单失败', res)
}
})
wx.onShareAppMessage(function() {
return {
2024-10-17 11:27:25 +08:00
title: '矩油惠 百业兴',
2024-08-16 18:26:19 +08:00
path: '/pages/index/index',
imageUrl: 'https://example.com/share.jpg',
success: function(res) {
console.log('分享成功', res)
},
fail: function(res) {
console.log('分享失败', res)
}
}
})
},
onShareAppMessage(res) {
if (res.from === 'button') { // 来自页面内分享按钮
2024-10-17 11:27:25 +08:00
console.log(res.target,233)
2024-08-16 18:26:19 +08:00
}
return {
2024-10-17 11:27:25 +08:00
title: '矩油惠 百业兴',
2024-08-16 18:26:19 +08:00
path: '/pages/index/index?storeId=' + uni.getStorageSync('storeId') + '&userId=' + uni
2024-09-24 15:47:31 +08:00
.getStorageSync('userId') + '&type=yaoqingyouli'
2024-08-16 18:26:19 +08:00
}
},
methods: {
2024-10-16 18:01:22 +08:00
// 复制链接
copyLink() {
const link = this.options.code;
uni.setClipboardData({
data: link,
success: () => {
uni.showToast({
title: '链接已复制',
icon: 'success',
duration: 2000
});
},
fail: () => {
uni.showToast({
title: '复制失败',
icon: 'none'
});
}
});
},
// 下载图片
savePicture() {
console.log(230);
2024-10-17 11:27:25 +08:00
let url = this.options.code;
2024-10-16 18:01:22 +08:00
// 下载图片
uni.downloadFile({
2024-10-17 11:27:25 +08:00
url: url,
2024-10-16 18:01:22 +08:00
success: (res) => {
if (res.statusCode === 200) {
console.log('下载成功');
}
},
fail: (err) => {
console.log(err, 240);
}
});
},
// 去导航
2024-10-09 17:48:51 +08:00
goGoGo() {
let lat = Number(this.lat)
let lon = Number(this.lon)
uni.openLocation({
latitude: lat,
longitude: lon,
name: this.store.name,
address: this.store.address,
success: function() {
console.log('success');
},
complete: function(res) {
console.log(res);
}
});
},
// 获取当前位置
getAddress(storeId) {
let _this = this;
uni.getLocation({
// 谷歌使用wgs84 其他使用gcj02
type: 'gcj02', // 使用国测局坐标系
success: function(res) {
if (_this.longitude == "" && _this.latitude == "") {
_this.longitude = res.longitude;
_this.latitude = res.latitude
}
console.log('经度: ' + _this.longitude);
console.log('纬度: ' + _this.latitude);
request({
url: 'business/storeInformation/store/recentlyStore',
method: 'post',
data: {
"lon": _this.longitude,
"lat": _this.latitude,
"storeId": storeId,
"isLogin": _this.AppToken ? "0" : "1", // 0为登录
},
}).then((response) => {
if (response.data.store) {
_this.distance = (Math.ceil(response.data.distance))
.toFixed(1)
_this.store = response.data.store
_this.lon = _this.store.longitude
_this.lat = _this.store.latitude
console.log(_this.store, 129);
} else {
uni.showToast({
title: "当前店铺已关闭!!!",
icon: "none"
})
}
}).catch(err => {})
},
fail: function(err) {
console.log('获取位置信息失败: ' + err.errMsg);
}
});
},
2024-09-25 10:38:08 +08:00
goList() {
uni.navigateTo({
url: '/pagesMy/invite/list'
})
},
goDetails() {
uni.navigateTo({
url: '/pagesMy/invite/details'
})
},
2024-08-16 18:26:19 +08:00
// https://www.tuofeng.cc/oilStation?storeId=19&staffId=45
close() {
this.show = false
},
open() {
this.show = true
// uni.navigateTo({
// url: '/pagesMy/invite/inviteCode' ,
// })
},
getAllAmount() {
request({
2024-10-16 18:01:22 +08:00
url: '/business/marketingActivity/activeApplet/getRecommendedByStoreId',
2024-08-16 18:26:19 +08:00
method: 'get',
2024-10-16 18:01:22 +08:00
params: {
storeId: uni.getStorageSync("storeId")
}
2024-08-16 18:26:19 +08:00
}).then(res => {
2024-10-16 18:01:22 +08:00
console.log(res, 319)
2024-08-16 18:26:19 +08:00
if (res.code == 200) {
2024-10-16 18:01:22 +08:00
this.activeInfo = res.data
2024-08-16 18:26:19 +08:00
}
})
},
getActiveRecommendRecords() {
request({
url: 'business/marketingActivity/activeRecommendRecords',
method: 'get',
params: this.query
}).then(res => {
console.log(res)
if (res.code == 200) {
this.activeRecommendRecordsList = res.data.records
}
})
},
goback() {
uni.navigateBack()
}
}
}
</script>
<style scoped lang="scss">
.content {
2024-09-24 15:47:31 +08:00
background: #F9F9F9;
2024-08-16 18:26:19 +08:00
}
.container {
width: 100%;
height: 100vh;
box-sizing: border-box;
}
2024-09-24 15:47:31 +08:00
2024-08-16 18:26:19 +08:00
.box-img {
width: 100%;
2024-09-24 15:47:31 +08:00
height: 200px;
2024-08-16 18:26:19 +08:00
image {
width: 100%;
height: 100%;
}
}
.hbbox {
2024-09-24 15:47:31 +08:00
width: 95%;
2024-08-16 18:26:19 +08:00
margin: 0px auto;
}
.faimg {
position: relative;
}
.or-box {
2024-09-24 15:47:31 +08:00
width: 49%;
height: 55px;
background: #fff;
2024-08-16 18:26:19 +08:00
border-radius: 8px;
margin: 5px;
text-align: center;
box-sizing: border-box;
2024-09-24 15:47:31 +08:00
display: flex;
align-items: center;
justify-content: center;
image {
width: 35px;
height: 35px;
margin-right: 15px;
}
2024-08-16 18:26:19 +08:00
}
.h-box {
width: 100%;
2024-09-24 15:47:31 +08:00
2024-08-16 18:26:19 +08:00
box-sizing: border-box;
display: flex;
align-items: center;
2024-09-24 15:47:31 +08:00
justify-content: space-between;
2024-08-16 18:26:19 +08:00
padding-top: 5px;
}
.max-size {
font-size: 18px;
font-weight: bold;
color: #D23735;
}
.min-size {
font-size: 14px;
color: #333333;
}
.x-box {
display: flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
padding-top: 30px;
}
.l-naniu {
width: 147px;
height: 32px;
border-radius: 23px 23px 23px 23px;
opacity: 1;
border: 1px solid #FCDB5A;
display: flex;
align-items: center;
justify-content: center;
color: #FCDB5A;
margin: 10px;
}
.r-naniu {
width: 147px;
height: 32px;
border-radius: 23px 23px 23px 23px;
opacity: 1;
border: 1px solid #FCDB5A;
background: #FCDB5A;
display: flex;
align-items: center;
justify-content: center;
color: #E9312F;
margin: 10px;
}
.bai-box {
width: 90%;
background: #ffffff;
border-radius: 8px;
margin: 0px auto;
box-sizing: border-box;
// padding: 15px;
margin-top: 90px;
overflow: hidden;
}
.bai-top {
width: 144px;
height: 32px;
background: linear-gradient(90deg, #F1DAB2 0%, #FBE5C5 50%, #F5DBB4 100%);
border-radius: 0px 0px 12px 12px;
display: flex;
align-items: center;
justify-content: center;
font-size: 16px;
font-weight: bold;
color: #552304;
margin: 0px auto;
}
.t-box {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 5px 15px;
margin: 5px auto;
}
.touxiang {
width: 40px;
height: 40px;
border-radius: 50%;
overflow: hidden;
margin-right: 10px;
image {
width: 100%;
height: 100%;
}
}
.hong-size {
font-size: 16px;
font-weight: bold;
color: #D23735;
}
.name-t {
font-size: 16px;
font-weight: bold;
color: #333333;
}
.diss {
display: flex;
align-items: center;
}
.h-size {
font-size: 14px;
font-weight: 400;
color: #999999;
}
.qiangzhi {
background: transparent;
border: none;
box-shadow: 0px
}
.popup_box {
box-sizing: border-box;
padding: 15px;
}
2024-09-24 15:47:31 +08:00
.or-aniu {
width: 95%;
height: 40px;
border-radius: 50px;
display: flex;
align-items: center;
justify-content: center;
background: #FF9655;
color: #fff;
2024-09-24 16:47:34 +08:00
margin: 10px auto;
}
.h_bs {
width: 95%;
display: flex;
align-items: center;
justify-content: space-between;
margin: 10px auto;
}
.si_ {
background: #fff;
width: 95%;
margin: 10px auto;
display: flex;
align-items: center;
justify-content: space-between;
padding: 10px;
font-size: 14px;
color: #333333;
box-sizing: border-box;
}
.si_t {
background: #fff;
width: 95%;
margin: 10px auto;
padding: 10px;
font-size: 14px;
color: #333333;
box-sizing: border-box;
}
.title_ {
font-weight: 600;
font-size: 14px;
color: #333333;
2024-09-24 15:47:31 +08:00
}
2024-08-16 18:26:19 +08:00
button {
/* 清除默认边框 */
border: 0;
outline: none;
/*清除默认背景 */
margin: 0px;
padding: 0px !important;
background-color: transparent;
}
2024-09-24 16:47:34 +08:00
.hui-size {
font-size: 12px;
color: #999999;
}
.d-s {
display: flex;
align-items: center;
2024-09-25 10:38:08 +08:00
justify-content: center;
margin: 15px auto;
2024-09-24 16:47:34 +08:00
}
2024-10-16 18:01:22 +08:00
.d-s1 {
display: flex;
align-items: center;
justify-content: center;
}
2024-09-24 16:47:34 +08:00
.backf {
background: #fff;
width: 95%;
margin: 10px auto;
}
.n_hang {
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
color: #333333;
box-sizing: border-box;
padding: 10px;
border-bottom: 1px solid #EEEEEE;
width: 100%;
}
2024-09-25 10:38:08 +08:00
.warp {
width: 100%;
height: 100vh;
position: relative;
}
.warp-bottom {
position: absolute;
left: 0px;
bottom: 0px;
background: #fff;
width: 100%;
box-sizing: border-box;
padding: 10px;
border-radius: 10px 10px 10px 10px;
text-align: center;
}
.bott-box {
display: flex;
align-items: center;
justify-content: space-around;
box-sizing: border-box;
padding-bottom: 15px;
border-top: 1px solid #eee;
padding-top: 10px;
}
.bott_box {
box-sizing: border-box;
padding: 5px;
padding-bottom: 15px;
display: flex;
align-items: center;
justify-content: space-between;
}
.warp-cent {
width: 85%;
background: #333;
position: absolute;
color: #fff;
left: 50%;
transform: translate(-50%, -50%);
bottom: -5%;
box-sizing: border-box;
padding: 10px;
padding-bottom: 60px;
}
.tiitle_ {
font-weight: 600;
font-size: 16px;
color: #FFFFFF;
}
.title_or {
color: #eeb668;
text-align: center;
font-size: 28px;
}
</style>