shop-applet/pages/activeCode/activeCode.vue

224 lines
5.7 KiB
Vue
Raw Normal View History

2024-05-14 17:25:13 +08:00
<template>
<view class="" style="position: relative;">
<view class="bg">
<image mode="widthFix" style="width: 100%;"
src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/home_img/shop_new_qr_code.webp"></image>
<view class="qr">
<image mode="widthFix" style="width: 500rpx;height: 500rpx;" :src="qrcodeURL"></image>
<view class="btn" @click="saveImageToLocal"><uni-icons type="download" size="30rpx" color="#fff"></uni-icons></view>
</view>
</view>
<image @click="back" class="bg_back"
src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/new_activity/back.png"></image>
<view class="bg_title">推广二维码</view>
<view class="title_box">
<image mode="widthFix" style="width: 750rpx;" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/5cd59202402041637007576.png"></image>
<view class="a_title">邀请记录</view>
</view>
<view class="tables">
<view class="tab_head">
<view class="tab_item1">用户名称</view>
<view class="tab_item2">ID</view>
<view class="tab_item3">消费金额</view>
<view class="tab_item4">推广劳务费</view>
</view>
<block v-if="list.length>0">
<view class="tab_td" v-for="(item, index) in list" :key="index">
<view class="tab_item1">{{item.nickname}}</view>
<view class="tab_item2">{{item.uid}}</view>
<view class="tab_item3">{{item.order_amount}}</view>
<view class="tab_item4">{{item.commission}}</view>
</view>
</block>
<view class="tab_td" v-else>
<view style="text-align: center;width: 100%;">还没有邀请到人呢~</view>
</view>
</view>
</view>
</template>
<script>
import {
getMerNewQRcode,
pullNewUserRecord
} from "@/api/admin.js"
export default {
data() {
return {
userInfoData: {
service: {
mer_id: ''
}
},
qrcodeURL: '',
list: [],
where: {
page: 1,
limit: 20
},
isLoad: false
}
},
onLoad() {
if (typeof this.$store.state.app.userInfo == 'string') this.userInfoData = JSON.parse(this.$store.state.app
.userInfo);
else this.userInfoData = this.$store.state.app.userInfo;
this.getMerNewQRcode();
this.pullNewUserRecord();
},
onShow() {},
onReachBottom() {
if(!this.isLoad){
this.where.page++;
this.pullNewUserRecord();
}
},
methods: {
back() {
uni.navigateBack();
},
getMerNewQRcode() {
getMerNewQRcode({}, this.userInfoData.service.mer_id).then(res => {
this.qrcodeURL = res.data.url;
})
},
pullNewUserRecord(){
pullNewUserRecord(this.where, this.userInfoData.service.mer_id).then(res=>{
if(res.data.list<this.where.limit) this.isLoad = true;
this.list = [...this.list, ...res.data.list];
})
},
// 保存图片
saveImageToLocal() {
uni.saveImageToPhotosAlbum({
filePath: this.qrcodeURL,
success: ()=> {
uni.showToast({
title: '图片保存成功'
});
this.closeQRcode()
},
fail: ()=> {
console.log(err);
uni.showToast({
title: '保存失败',
icon: 'none'
});
}
});
},
}
}
</script>
<style lang="scss">
.bg {
width: 750rpx;
height: 952rpx;
position: relative;
.qr {
width: 500rpx;
padding-top: 230rpx;
// background-color: #eee;
position: absolute;
top: 0;
left: 50%;
transform: translate(-50%);
.btn {
width: 415rpx;
height: 83rpx;
background: #F75335;
box-shadow: 0rpx 4rpx 20rpx 0rpx #FF5435;
color: #fff;
font-size: 30rpx;
border-radius: 83rpx;
display: flex;
align-items: center;
justify-content: center;
margin: 30rpx auto;
}
}
}
.bg_back {
height: 34rpx;
width: 20rpx;
position: absolute;
top: calc(var(--status-bar-height) + 30rpx);
left: 30rpx;
}
.bg_title{
font-size: 32rpx;
color: #fff;
font-weight: 500;
position: absolute;
top: calc(var(--status-bar-height) + 30rpx);
left: 50%;
transform: translate(-50%);
}
.title_box{
position: relative;
margin-top: 30rpx;
.a_title{
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-60%);
color: #4D0C00;
font-size: 28rpx;
}
}
.tables{
width: 694rpx;
margin: 0 auto;
.tab_item1{
width: 150rpx;
}
.tab_item2{
width: 150rpx;
}
.tab_item3{
width: 190rpx;
}
.tab_item4{
width: 190rpx;
}
.tab_head{
display: flex;
justify-content: space-between;
background-color: #FFD8D1;
text-align: center;
padding: 15rpx 0;
border-radius: 10rpx;
color: #4D0C00;
font-size: 28rpx;
margin-bottom: 12rpx;
margin-top: 16rpx;
}
.tab_td{
display: flex;
justify-content: space-between;
background-color: #FFEEEB;
text-align: center;
padding: 15rpx 0;
border-radius: 10rpx;
color: #4D0C00;
font-size: 26rpx;
margin-bottom: 12rpx;
view{
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.tab_item3{
color: #FA4B29;
}
.tab_item4{
color: #18CE61;
}
}
}
</style>