第一次提交

This commit is contained in:
gxwebsoft
2023-08-04 13:14:48 +08:00
commit 1b923e5cff
1030 changed files with 128016 additions and 0 deletions

1008
sub_pages/dealer/dealer.vue Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,620 @@
<template>
<view class="dealer-grade">
<view class="page-bg"></view>
<view class="header" :style="'margin-top: ' + statusBarHeight + 'px'"></view>
<view class="main-header">
<image class="bg-image" :src="bgImage" mode="scaleToFill"></image>
<!-- 用户信息 -->
</view>
<view class="main">
<!-- 表单信息 -->
<u--form :model="form" ref="uForm">
<view class="buy-user">
<view class="sub-name">{{ plan.subName }}</view>
<u-grid :border="false" col="3">
<u-grid-item v-for="(item,index) in plan.icons" :key="index">
<view class="demo-layout bg-purple-light">
<view class="icon">
<image :src="item.icon"></image>
</view>
<text class="name">{{ item.name }}</text>
</view>
</u-grid-item>
</u-grid>
</view>
<u-gap height="3"></u-gap>
<!-- 会员套餐 -->
<view class="buy-user" v-if="plan.price">
<view class="buy">
<view class="title">开通{{ plan.name }}</view>
<view class="total-price">{{ plan.price[0].name}}</view>
</view>
</view>
<view class="xieyi">
<u-icon name="checkbox-mark"></u-icon>
购买代表同意爱尚客网
<text @click="$push('pages/article/detail/detail?id=117')">品牌合作协议</text>
</view>
</u--form>
</view>
<view class="cart">
<view class="cart-info">
<view class="btn-wrapper">
<u-button text="立即开通" color="linear-gradient(to bottom, #010002, #681752)" :disabled="disabled"
shape="circle" @click="onBuy()"></u-button>
</view>
</view>
</view>
<!-- 地址选择器 -->
<liu-customize-sel ref="area" @change="chooseSuccess"></liu-customize-sel>
<!-- 选择店铺 -->
<u-picker :show="showMerchant" :columns="merchantList" @confirm="confirmMerchant"
@cancel="showMerchant = false"></u-picker>
</view>
</template>
<script>
import store from '@/store/index.js'
import storage from '@/utils/storage'
import * as UserPlanApi from '@/api/love-user-plan.js'
import * as UserPlanLogApi from '@/api/love-user-plan-log.js'
import * as UserPlanEquityApi from '@/api/love-user-plan-equity.js'
import * as MerchantApi from '@/api/merchant.js'
import {
getUser,
updateUser
} from '@/api/user.js'
import {
username
} from '@/config.js';
import {
getMobile
} from '@/utils/util.js'
import http from '@/api'
const userId = uni.getStorageSync('userId')
export default {
data() {
return {
storeVn: 0, // 当前待升级等级
planId: 0,
plan: {},
subPayPrice: 0, // 升级只需补差价
loading: true,
merchantList: [],
bgImage: 'data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20version%3D%221.1%22%3E%3Cdefs%3E%3ClinearGradient%20id%3D%221%22%20x1%3D%220%22%20x2%3D%221%22%20y1%3D%220%22%20y2%3D%220%22%20gradientTransform%3D%22matrix(6.123233995736766e-17%2C%201%2C%20-0.36308349769888226%2C%206.123233995736766e-17%2C%200.5%2C%200)%22%3E%3Cstop%20stop-color%3D%22%23101010%22%20stop-opacity%3D%221%22%20offset%3D%220.24%22%3E%3C%2Fstop%3E%3Cstop%20stop-color%3D%22%23160028%22%20stop-opacity%3D%221%22%20offset%3D%221%22%3E%3C%2Fstop%3E%3C%2FlinearGradient%3E%3C%2Fdefs%3E%3Crect%20width%3D%22100%25%22%20height%3D%22100%25%22%20fill%3D%22url(%231)%22%3E%3C%2Frect%3E%3C%2Fsvg%3E',
statusBarHeight: 25,
// 是否已登录
isLogin: false,
disabled: false,
showMerchant: false,
// 系统设置
form: {
userId,
priceId: 0,
planId: 0,
area: '',
merchantName: ''
},
totalPrice: 0.00
}
},
onLoad(options) {
this.planId = options.id
this.getUserInfo()
this.getMerchant()
this.getStroeVn()
// 设置navbar标题、颜色options
uni.setNavigationBarColor({
frontColor: '#ffffff',
backgroundColor: '#101010'
})
},
onShow() {},
methods: {
// 跳转页面
navTo(url) {
this.$navTo(url)
},
getUserInfo() {
const {
form
} = this
const app = this
uni.getSystemInfo({
success(data) {
if (data) {
app.statusBarHeight = data.statusBarHeight + 50
}
}
})
getUser().then(res => {
if (res.code == 0 && res.data.username != 'www') {
if (res.data) {
console.log("res.data.phone: ", res.data.phone);
app.form.realName = res.data.realName
app.form.phone = res.data.phone
}
app.isLogin = true
} else {
app.isLogin = false
app.$push('pages/login/index')
}
})
},
getMerchant() {
const app = this
MerchantApi.listMerchant().then(result => {
let arr = []
result.data.map(d => {
console.log("d.merchantName: ", d.merchantName);
arr.push(d.merchantName)
})
app.merchantList.push(arr)
})
},
getStroeVn() {
const app = this
const {
userId
} = app.form
UserPlanEquityApi.listUserPlanEquity({
userId
}).then(result => {
const list = result.data
// 线上门店
const storeV1 = list.filter(d => d.planId == 19)
if(storeV1.length > 0){
// 升级差价
app.subPayPrice = 4999
}
if (storeV1.length == 0) {
app.storeVn = 19
storage.set('storeVn', 19)
app.getUserPlan()
return false
}
// 门店合伙人
const storeV2 = list.filter(d => d.planId == 20)
if (storeV2.length == 0) {
app.storeVn = 20
storage.set('storeVn', 20)
app.getUserPlan()
return false
}
// 门店运营总监
const storeV3 = list.filter(d => d.planId == 21)
if (storeV3.length == 0) {
app.storeVn = 21
storage.set('storeVn', 21)
app.getUserPlan()
return false
}
// 实体店
const storeV4 = list.filter(d => d.planId == 22)
if (storeV4.length == 0) {
app.storeVn = 22
storage.set('storeVn', 22)
app.getUserPlan()
return false
}
// 旗舰店
const storeV5 = list.filter(d => d.planId == 23)
if (storeV5.length == 0) {
app.storeVn = 23
storage.set('storeVn', 23)
app.getUserPlan()
return false
}
// 区县级运营中心
const storeV6 = list.filter(d => d.planId == 24)
if (storeV6.length == 0) {
app.storeVn = 24
storage.set('storeVn', 24)
app.getUserPlan()
return false
}
// 市级运营中心
const storeV7 = list.filter(d => d.planId == 25)
if (storeV7.length == 0) {
app.storeVn = 25
storage.set('storeVn', 25)
app.getUserPlan()
return false
}
// 省级运营中心
const storeV8 = list.filter(d => d.planId == 26)
if (storeV8.length == 0) {
app.storeVn = 26
storage.set('storeVn', 26)
app.getUserPlan()
return false
}
})
// app.loading = false
},
getUserPlan() {
const app = this
const {
storeVn,
planId
} = this
UserPlanApi.getUserPlan(planId > 0 ? planId : storeVn).then(res => {
app.plan = res.data
app.form.priceId = res.data.price[0].id
uni.setNavigationBarTitle({
title: res.data.name
})
})
},
onArea() {
this.$refs.area.open()
},
onMerchant() {
this.showMerchant = true
},
confirmMerchant(e) {
this.form.merchantName = e.value[0]
this.showMerchant = false
},
//地址选择成功
chooseSuccess(e) {
const app = this
const data = e.value
if (data) {
app.form.area = `${data[0].label} ${data[1].label} ${data[2].label}`
app.form.province = data[0].label
app.form.city = data[1].label
app.form.region = data[2].label
}
},
// 跳转到服务页面
handleService({
url
}) {
if (url.slice(0, 4) == 'http') {
wx.openCustomerServiceChat({
extInfo: {
url: 'https://work.weixin.qq.com/kfid/kfc1693a8d29b84bc5e'
},
corpId: 'ww1c3f872ba0a39228',
success(res) {}
})
return;
}
if (!this.isLogin) {
return false;
}
console.log("url: ", url);
this.$navTo(url)
},
// 显示toast信息
showToast(title, duration = 2000) {
this.$refs.uToast.show({
title,
duration
})
},
handleLogout() {
// http.setConfig((config) => {
// config.header = {};
// config.header = {
// AppId: appId,
// tenantId: tenantId
// };
// return config
// })
// uni.clearStorage()
// uni.clearStorageSync()
uni.redirectTo({
url: '/pages/login/index'
})
},
onBuy() {
const app = this
const {
form,
subPayPrice
} = this
console.log("this.plan: ",this.plan);
const planId = this.plan.planId
const priceId = this.plan.price[0].id
// app.disabled = true
return this.$push('sub_pages/checkout/checkout',{planId,subPayPrice})
// UserPlanLogApi.addUserPlanLog(form).then(res => {
// const orderInfo = res.data
// // 调起微信支付
// uni.requestPayment({
// provider: orderInfo.provider, // 服务提供商
// timeStamp: orderInfo.timeStamp, // 时间戳
// nonceStr: orderInfo.nonceStr, // 随机字符串
// package: orderInfo.package,
// signType: orderInfo.signType, // 签名算法
// paySign: orderInfo.paySign, // 签名
// success: function(res) {
// // 业务逻辑。。。
// app.$success('支付成功')
// setTimeout(function() {
// app.showEdit = false
// app.disabled = false
// uni.navigateBack()
// }, 1500);
// },
// fail: function(err) {
// console.log('支付失败', err);
// app.disabled = false
// }
// });
// })
},
onApply() {
if (!this.isLogin) {
return false;
}
this.$navTo('pages/wallet/balance/log')
}
}
}
</script>
<style lang="scss" scoped>
.dealer-grade {
background-color: #f3f3f3;
height: 100vh;
}
.page-bg {
width: 750rpx;
height: calc(100rpx + var(--status-bar-height));
display: block;
background-color: #101010;
position: absolute;
left: 0;
top: 0;
z-index: -100;
}
// 页面头部
.main-header {
// background-color: #FBF7EF;
position: fixed;
top: 0;
width: 100%;
height: 360rpx;
background-size: 100% 100%;
overflow: hidden;
display: flex;
align-items: center;
display: flex;
justify-content: space-between;
.bg-image {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 0;
}
}
.main {
position: fixed;
top: 80rpx;
left: 25rpx;
z-index: 999;
// 开通会员
.buy-user {
display: flex;
flex-direction: column;
margin: 20rpx auto 20rpx auto;
padding: 20rpx 0;
width: 700rpx;
box-shadow: 0 1rpx 5rpx 0px #eaebec;
border-radius: 24rpx;
background: #fff;
.sub-name {
text-align: center;
line-height: 3rem;
}
.item-equity {}
.buy {
padding: 0 30rpx;
display: flex;
justify-content: space-between;
}
.demo-layout {
background-color: #ffffff;
margin: auto;
width: 200rpx;
color: #4c4c4c;
padding: 24rpx;
border-radius: 15rpx;
text-align: center;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
font-size: 25rpx;
.icon {
// background-color: gold;
width: 80rpx;
height: 80rpx;
border-radius: 80rpx;
display: flex;
justify-content: center;
align-items: center;
image {
width: 80rpx;
height: 80rpx;
}
}
.name {
line-height: 2rem;
}
}
}
}
// 退出登录
.my-logout {
display: flex;
justify-content: center;
margin-top: 50rpx;
.logout-btn {
width: 400rpx;
margin: 0 auto;
font-size: 28rpx;
color: #616161;
border-radius: 20rpx;
border: 1px solid #dcdcdc;
padding: 16rpx 0;
text-align: center;
}
}
.price-box {
padding: 30rpx;
display: flex;
justify-content: space-between;
.info {
display: flex;
image {
width: 120rpx;
height: 120rpx;
border-radius: 20rpx;
}
.content {
width: 280rpx;
padding-left: 30rpx;
font-size: 34rpx;
color: #ff0000;
}
}
.price {
display: flex;
flex-direction: column;
align-items: flex-end;
padding: 0 20rpx;
.reb {
color: #ff0000;
}
.num {
color: #999999;
}
}
}
.xieyi {
width: 600rpx;
font-size: 26rpx;
text-align: center;
display: flex;
justify-content: center;
margin: 50rpx auto;
color: #999999;
text {
text-decoration: underline;
color: #681752;
}
}
.cart {
position: fixed;
bottom: 25rpx;
z-index: 888;
width: 750rpx;
height: 80rpx;
line-height: 80rpx;
.cart-info {
// background: linear-gradient(to bottom, $main-bg, $main-bg2);
// width: 700rpx;
margin: auto;
display: flex;
border-radius: 100rpx;
justify-content: space-between;
position: relative;
.cart-logo {
position: absolute;
width: 90rpx;
height: 90rpx;
margin-left: 20rpx;
bottom: 10rpx;
}
.clear-cart {
color: #ff0000;
}
.buy {
margin-right: 8rpx;
display: flex;
flex-direction: column;
justify-content: center;
.custom-style {
padding: 0 50rpx;
color: #ffffff;
background-color: #ff0000;
background: linear-gradient(to bottom, $main-bg, $main-bg2);
// background-color: #681752;
border: none;
width: 330rpx;
height: 66rpx;
font-size: 28rpx;
}
}
}
}
.w-input {
text-align: right;
font-size: 25rpx;
color: #606266;
}
.btn-wrapper {
width: 360rpx;
margin: auto;
// display: flex;
// align-items: center;
padding: 0 20rpx;
}
.total-price {
font-size: 30rpx;
font-weight: bold;
color: #ff0000;
}
</style>

View File

@@ -0,0 +1,321 @@
<template>
<view class="container">
<view class="tabs">
<u-tabs :list="tabs" @click="onChangeTab" :current="1" lineColor="#7f006f"></u-tabs>
</view>
<!-- 推广权益 -->
<block v-if="currTab == 10">
<view class="card">
<view class="title">推广权益</view>
<view class="content">
<u-parse :content="plan.comments"></u-parse>
</view>
</view>
</block>
<!-- 推广列表 -->
<block v-if="currTab == 20">
<view class="search-wrapper">
<uni-data-select v-model="where.gradeId" :localdata="grade" @change="onSearch"></uni-data-select>
</view>
<view class="user-list">
<u-list :height="700" @scrolltolower="scrolltolower">
<view class="list">
<u-list-item v-for="(item, index) in list" :key="index">
<u-cell :title="`${item.nickname}`" :label="`ID${userIdPrefix}${item.userId} 粉丝:${item.id}`" isLink>
<u-avatar slot="icon" size="50" :src="item.avatar"
customStyle="margin: -3px 5px -3px 0"></u-avatar>
<!-- <view solt="label">
<text class="desc-text">{{ `ID${item.userId}` }}</text>
<text class="desc-text">{{ `粉丝:${item.id}` }}</text>
</view> -->
<view slot="right-icon" class="follow-btn" @click.stop="onFollow">
<text>{{ item.gradeName }}</text>
</view>
</u-cell>
</u-list-item>
<u-empty v-if="list.length == 0" mode="search"
icon="http://cdn.uviewui.com/uview/empty/search.png">
</u-empty>
</view>
</u-list>
</view>
</block>
<!-- 我的团队 -->
<block v-if="currTab == 30">
<view class="user-list">
<u-list :height="700" @scrolltolower="scrolltolower">
<view class="list">
<u-list-item v-for="(item, index) in list" :key="index">
<u-cell :title="`${item.nickname}`" :label="`ID${userIdPrefix}${item.userId} 粉丝:${item.id}`" isLink>
<u-avatar slot="icon" size="50" :src="item.avatar"
customStyle="margin: -3px 5px -3px 0"></u-avatar>
<!-- <view solt="label">
<text class="desc-text">{{ `ID${item.userId}` }}</text>
<text class="desc-text">{{ `粉丝:${item.id}` }}</text>
</view> -->
<view slot="right-icon" class="follow-btn" @click.stop="onFollow">
<text>{{ item.gradeName }}</text>
</view>
</u-cell>
</u-list-item>
<u-empty v-if="list.length == 0" mode="search"
icon="http://cdn.uviewui.com/uview/empty/search.png">
</u-empty>
</view>
</u-list>
</view>
</block>
</view>
</template>
<script>
import * as UserRefereeApi from '@/api/user-referee.js'
import * as UserPlanApi from '@/api/love-user-plan.js'
import * as MerchantApi from '@/api/merchant.js'
import {
username,
userIdPrefix
} from '@/config.js';
const userId = uni.getStorageSync('userId')
// tab栏数据
const tabs = [{
name: `推广权益`,
value: 10
}, {
name: `推广列表`,
value: 20
}, {
name: `我的团队`,
value: 30
}]
export default {
data() {
return {
userIdPrefix,
tabs,
currTab: 20,
planId: 0,
plan: null,
// 会员类型
grade: [{
value: 2,
text: '注册用户'
},
{
value: 3,
text: '普通会员'
},
{
value: 4,
text: '尊享会员'
},
{
value: 7,
text: '线上门店'
},
{
value: 8,
text: '门店合伙人'
},
{
value: 9,
text: '门店运营总监'
},
{
value: 10,
text: '实体门店'
},
{
value: 11,
text: '旗舰店'
},
{
value: 12,
text: '区县级运营中心'
},
{
value: 13,
text: '市级运营中心'
},
{
value: 14,
text: '省级运营中心'
}
],
// 会员列表
list: [],
where: {},
page: 0,
// 控制onShow事件是否刷新订单列表
canReset: false,
disabled: false
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.planId = options.id
this.getPlan()
this.list = []
this.onRefreshList()
},
methods: {
getPlan() {
const app = this
const {
planId
} = this
UserPlanApi.getUserPlan(planId).then(res => {
app.plan = res.data
})
},
getMerchant() {
const app = this
MerchantApi.listMerchant({
userId
}).then(result => {
let arr = []
app.merchantList = []
result.data.map(d => {
arr.push({
label: d.merchantName,
id: d.merchantId,
code: d.merchantCode
})
})
app.merchantList.push(arr)
})
},
// 刷新会员列表
onRefreshList() {
const app = this
app.where.page = app.page
app.where.dealerId = userId
return new Promise((resolve, reject) => {
UserRefereeApi.pageUserReferee(app.where)
.then(result => {
const list = result.data.list
// 合并新数据
app.list = app.list.concat(list)
if (result.data.count > app.list.length) {
app.canReset = true
} else {
app.canReset = false
}
resolve(list)
})
})
},
scrolltolower(e) {
console.log("e: ", e);
},
navTo(url, userId) {
this.$push(url, userId)
},
onFollow(e) {
console.log("e11: ", e);
},
onSearch() {
this.list = []
this.where.page = 1
this.onRefreshList()
},
onChangeTab(e) {
const app = this
app.currTab = e.value
if (e.value == 10) {
}
if (e.value == 20) {
app.list = []
app.where.gradeStart = undefined
app.where.gradeEnd = undefined
app.onRefreshList()
}
if (e.value == 30) {
app.list = []
app.where.gradeStart = 7
app.where.gradeEnd = 14
app.onRefreshList()
}
}
}
}
</script>
<style lang="scss" scoped>
.container {
padding: 0rpx;
background-color: #f3f3f3;
height: 90vh;
}
.user-list {
width: 700rpx;
margin: 20rpx auto;
padding: 10rpx 0;
border-radius: 20rpx;
background-color: #ffffff;
.desc-text {
margin-right: 50rpx;
}
}
.follow-btn {
padding: 4rpx 20rpx;
color: #ffffff;
font-size: 26rpx;
border-radius: 50rpx;
margin-right: 10rpx;
background: linear-gradient(#47076b, #8d1a50);
image {
width: 24rpx;
height: 66rpx;
margin-right: 6rpx;
}
}
.search-wrapper{
width: 250rpx;
padding: 0 20rpx;
}
.tabs {
width: 700rpx;
margin: auto;
display: flex;
justify-content: center;
}
.card {
width: 700rpx;
min-height: 500rpx;
margin: 20rpx auto;
padding: 10rpx 0;
background-color: #ffffff;
border-radius: 20rpx;
.title {
width: 640rpx;
margin: 10rpx auto;
line-height: 3rem;
border-bottom: 2rpx solid #f3f3f3;
}
.content {
width: 640rpx;
margin: 10rpx auto;
line-height: 2rem;
color: #666666;
}
}
</style>

View File

@@ -0,0 +1,183 @@
<template>
<view class="container">
<view class="search-wrapper">
<u-cell :title="userTypeText" isLink :border="false" arrowDirection="down" @click="showUserType = true"></u-cell>
<u-cell :title="userSexText" isLink :border="false" arrowDirection="down" @click="showUserSex = true"></u-cell>
</view>
<view class="user-list">
<u-list @scrolltolower="scrolltolower">
<view class="list">
<u-list-item v-for="(item, index) in list" :key="index">
<u-cell :title="`${item.nickname}`" :label="`ID${item.userId} 粉丝:${item.id}`" isLink>
<u-avatar slot="icon" size="50" :src="item.avatar"
customStyle="margin: -3px 5px -3px 0"></u-avatar>
<!-- <view solt="label">
<text class="desc-text">{{ `ID${item.userId}` }}</text>
<text class="desc-text">{{ `粉丝:${item.id}` }}</text>
</view> -->
<view slot="right-icon" class="follow-btn" @click.stop="onFollow">
<text v-if="item.gradeId == 3">线下普通会员</text>
<text v-if="item.gradeId == 4">线下尊享会员</text>
</view>
</u-cell>
</u-list-item>
<u-empty v-if="list.length == 0" mode="search" icon="http://cdn.uviewui.com/uview/empty/search.png">
</u-empty>
</view>
</u-list>
</view>
<u-action-sheet :actions="userType" @select="onUserType"
:show="showUserType"></u-action-sheet>
<u-action-sheet :actions="userSex" @select="onUserSex"
:show="showUserSex"></u-action-sheet>
</view>
</template>
<script>
import * as UserRefereeApi from '@/api/user-referee.js'
const userId = uni.getStorageSync('userId')
export default {
data() {
return {
// 会员类型
userType: [{
name: '不限'
},{
name: '线下普通会员'
},
{
name: '线下尊享会员'
}
],
showUserType: false,
// 会员性别
userSex: [{
name: '不限'
},{
name: '男'
},
{
name: '女'
}
],
showUserSex: false,
// 会员列表
list: [],
where: {},
page: 0,
userTypeText: '全部单身会员',
userSexText: '性别',
// 控制onShow事件是否刷新订单列表
canReset: false,
disabled: false
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.where = options
this.onRefreshList()
},
methods: {
// 刷新会员列表
onRefreshList() {
const app = this
app.where.page = app.page
app.where.dealerId = userId
app.where.offline = 1
return new Promise((resolve, reject) => {
UserRefereeApi.pageUserReferee(app.where)
.then(result => {
const list = result.data.list
// 合并新数据
app.list = app.list.concat(list)
if (result.data.count > app.list.length) {
app.canReset = true
} else {
app.canReset = false
}
resolve(list)
})
})
},
scrolltolower(e) {
console.log("e: ", e);
},
navTo(url, userId) {
this.$push(url, userId)
},
onFollow(e) {
console.log("e11: ", e);
},
onSearch() {
this.list = []
this.where.page = 1
this.onRefreshList()
},
onUserType(e){
console.log("e: ",e);
this.userTypeText = e.name
this.showUserType = false
if(e.name == '线下普通会员'){
this.where.gradeId = 3
}
if(e.name == '线下尊享会员'){
this.where.gradeId = 4
}
this.onSearch()
},
onUserSex(e){
console.log("e: ",e);
this.userSexText = e.name
this.showUserSex = false
if(e.name == '男'){
this.where.sex = 1
}
if(e.name == '女'){
this.where.sex = 2
}
this.onSearch()
}
}
}
</script>
<style lang="scss" scoped>
.container {
padding: 0rpx;
background-color: #ffffff;
}
.search-wrapper {
padding: 30rpx;
display: flex;
height: 64rpx;
}
.user-list {
margin: 20rpx auto;
.desc-text{
margin-right:50rpx;
}
}
.follow-btn {
padding: 4rpx 20rpx;
color: #ffffff;
font-size: 26rpx;
border-radius: 50rpx;
margin-right: 10rpx;
background: linear-gradient(#47076b, #8d1a50);
image {
width: 24rpx;
height: 66rpx;
margin-right: 6rpx;
}
}
</style>

View File

@@ -0,0 +1,366 @@
<template>
<view class="container">
<u-navbar autoBack leftIconColor="#FFFFFF" title="分享海报" bg-color="transparent" safeAreaInsetTop
:titleStyle="{color: '#FFFFFF'}" :fixed="true"></u-navbar>
<view class="poster-main">
<image class="poster-main-img" src="https://oss.jimeigroup.cn/static/hunjie-bg.png"
mode="widthFix"></image>
<view class="user-info">
<image class="avatar" :src="userInfo.avatar" mode="widthFix"></image>
<view class="info">
<view class="nickname">
{{userInfo.nickname}}
</view>
<view class="phone">
{{userInfo.phone}}
</view>
</view>
</view>
<image class="qrcode" :src="QrcodeUrl">
</view>
<view class="poster-footer">
<!-- <view class="poster-footer-title">
立即分享
</view> -->
<view class="poster-footer-btns">
<button open-type="share" class="poster-footer-btn u-reset-button">
<image class="poster-footer-btn-icon" src="https://file-jimei.oss-cn-shenzhen.aliyuncs.com/static/poster-share.png" mode="aspectFill">
</image>
<view class="poster-footer-btn-text">分享微信好友</view>
</button>
<view @click="drawPoster" class="poster-footer-btn">
<image class="poster-footer-btn-icon" src="https://file-jimei.oss-cn-shenzhen.aliyuncs.com/static/poster-save.png" mode="aspectFill"></image>
<view class="poster-footer-btn-text">保存相册分享</view>
</view>
</view>
</view>
<!-- 海报绘制 -->
<l-painter custom-style="position: fixed;left: 200%;" ref="painter" @success="drawSuccess"
css="height: 1067px; width: 750px;" file-type="jpg">
<template>
<l-painter-view
css="background-image: url(https://oss.jimeigroup.cn/static/post-bg3.jpg); width: 750px;height: 1067px;">
<l-painter-view
css="background-image: url(https://file-jimei.oss-cn-shenzhen.aliyuncs.com/static/hunjie-bg.png); width: 750px;height: 1067px;position:relative;">
<!-- 用户头像昵称 -->
<l-painter-view style="display: flex;" css="display: flex;align-items: center;position: absolute;left: 150px; bottom: 150px;">
<l-painter-image
css="width: 75px;height: 75px;border-radius: 50%"
:src="userInfo.avatar"></l-painter-image>
<l-painter-view css="margin-left: 20px;">
<l-painter-view css="height: 40px;line-height: 40px;"><l-painter-text :text="userInfo.nickname" css="font-size: 28px" style=";"></l-painter-text></l-painter-view>
<l-painter-view css="height: 40px;line-height: 40px;"> <l-painter-text :text="userInfo.phone" css="font-size: 24px"></l-painter-text></l-painter-view>
</l-painter-view>
</l-painter-view>
<!-- 二维码 -->
<l-painter-image
css="position: absolute;right: 150px;bottom: 150px;width: 160px;height: 160px;"
:src="QrcodeUrl"></l-painter-image>
</l-painter-view>
</l-painter-view>
</template>
</l-painter>
</view>
</template>
<script>
import * as WxLoginApi from '@/api/wx-login.js'
import store from '@/store/index.js'
import storage from '@/utils/storage'
const userId = uni.getStorageSync('userId')
const userInfo = uni.getStorageSync('userInfo')
export default {
data() {
return {
userId,
userInfo,
form: {},
showQrcode: false,
QrcodeUrl: '',
ranking: [{
avatar: '',
nickname: '别来无恙',
value: '共奖励5012.00元'
}],
posterUrl: ''
}
},
onLoad() {
this.getQrCode()
},
onShareTimeline(res) {
if (res.from === 'button') { // 来自页面内分享按钮
console.log(res.target)
}
return {
title: '爱尚客',
path: 'pages/index/index?user_id=' + uni.getStorageSync('userId')
}
},
onShareAppMessage() {
return {
title: '高端婚恋交友平台',
path: 'pages/index/index?user_id=' + uni.getStorageSync('userId'),
imageUrl: 'https://file-jimei.oss-cn-shenzhen.aliyuncs.com/static/mp-share.png'
}
},
methods: {
drawPoster() {
this.$refs.painter.canvasToTempFilePath({
// x: 0,
// y: 170,
// with: 750,
// height: 1067,
fileType: "jpg",
// 如果返回的是base64是无法使用 saveImageToPhotosAlbum需要设置 pathType为url
pathType: 'url',
quality: 1,
success: (res) => {
// console.log(res.tempFilePath);
// uni.previewImage({
// urls: [res.tempFilePath]
// })
// 非H5 保存到相册
uni.saveImageToPhotosAlbum({
filePath: res.tempFilePath,
success: function () {
uni.showToast({
title: '已保存相册'
})
}
});
},
});
},
drawSuccess(e) {
this.posterUrl = e
// uni.previewImage({
// urls: [e]
// })
},
onShowQrcode() {
this.showQrcode = true
this.getQrCode()
},
// 获取微信小程序码
getQrCode() {
const app = this
WxLoginApi.getWxQrCodeFile().then(res => {
app.QrcodeUrl = "https://file.jimeigroup.cn" + res.message
// app.showQrcode = true
storage.set('QrcodeUrl', res.message)
}).catch(err => {
app.$error(err.message)
})
},
onShareQuan() {
uni.share({
provider: "weixin",
scene: "WXSceneTimeline",
type: 2,
imageUrl: "https://file.wsdns.cn/qrcode/M4WhwQv2.png",
success: function(res) {
console.log("success:" + JSON.stringify(res));
},
fail: function(err) {
console.log("fail:" + JSON.stringify(err));
}
});
},
onShareWeixin() {
uni.share({
provider: "weixin",
scene: "WXSceneSession",
type: 5,
imageUrl: "https://file.wsdns.cn/qrcode/M4WhwQv2.png",
title: '爱尚客',
miniProgram: {
id: 'gh_39f1f8019c3f',
path: 'pages/index/index',
type: 0,
webUrl: 'http://uniapp.dcloud.io'
},
success: function(res) {
console.log("success:" + JSON.stringify(res));
},
fail: function(err) {
console.log("fail:" + JSON.stringify(err));
}
});
},
onShareAlbum() {
// uni.saveImageToPhotosAlbum({
// filePath: res.tempFilePaths[0],
// success: function () {
// console.log('save success');
// }
// });
uni.getSetting({ //获取用户的当前设置
success: (res) => {
if (res.authSetting['scope.writePhotosAlbum']) { //验证用户是否授权可以访问相册
this.saveImageToPhotosAlbum();
} else {
uni.authorize({ //如果没有授权,向用户发起请求
scope: 'scope.writePhotosAlbum',
success: () => {
this.saveImageToPhotosAlbum();
},
fail: () => {
uni.showToast({
title: "请打开保存相册权限,再点击保存相册分享",
icon: "none",
duration: 3000
});
setTimeout(() => {
uni.openSetting({ //调起客户端小程序设置界面,让用户开启访问相册
success: (res2) => {
// console.log(res2.authSetting)
}
});
}, 3000);
}
})
}
}
})
},
saveImageToPhotosAlbum() {
let base64 = this.posterUrl.replace(/^data:image\/\w+;base64,/, ""); //去掉data:image/png;base64,
let filePath = wx.env.USER_DATA_PATH + '/ph_fit_qrcode.png';
uni.showLoading({
title: '加载中',
mask: true
})
uni.getFileSystemManager().writeFile({
filePath: filePath, //创建一个临时文件名
data: base64, //写入的文本或二进制数据
encoding: 'base64', //写入当前文件的字符编码
success: res => {
uni.saveImageToPhotosAlbum({
filePath: filePath,
success: function(res2) {
uni.hideLoading();
uni.showToast({
title: '保存成功,请从相册选择再分享',
icon: "none",
duration: 5000
})
},
fail: function(err) {
uni.hideLoading();
// console.log(err.errMsg);
}
})
},
fail: err => {
uni.hideLoading();
//console.log(err)
}
})
}
}
}
</script>
<style>
page {
background-color: #730070;
}
</style>
<style lang="scss" scoped>
.container {
background-image: url(https://oss.jimeigroup.cn/static/login-bg01.png);
background-repeat: no-repeat;
min-height: 100vh;
width: 750rpx;
background-size: 100%;
}
.poster-main {
margin: 170rpx auto 0;
display: flex;
justify-content: center;
position: relative;
.qrcode {
position: absolute;
right: 150rpx;
bottom: 150rpx;
width: 160rpx;
height: 160rpx;
}
.poster-main-img {
width: 750rpx;
}
}
.poster-footer {
color: #FFFFFF;
}
.poster-footer-title {
// height: 80rpx;
font-size: 32rpx;
// font-weight: bold;
text-align: center;
margin-bottom: 20rpx;
// line-height: 80rpx;
}
.poster-footer-btns {
display: flex;
justify-content: space-between;
width: 600rpx;
margin: 0 auto;
}
.poster-footer-btn {
flex: 1;
text-align: center;
&-icon {
width: 80rpx;
height: 80rpx;
}
&-text {
font-size: 28rpx;
}
}
.user-info{
position: absolute;
left: 150rpx;
bottom: 160rpx;
display: flex;
align-items: center;
.avatar{
width: 75rpx;
height: 75rpx;
border-radius: 50%;
}
.info {
margin-left: 20rpx;
}
.nickname{
font-size: 28rpx;
height: 40rpx;
line-height: 40rpx;
}
.phone {
font-size: 24rpx;
height: 40rpx;
line-height: 40rpx;
}
}
</style>

View File

@@ -0,0 +1,41 @@
<template>
<view>
</view>
</template>
<script>
import * as UserRefereeApi from '@/api/user-referee.js'
export default {
data() {
return {
options: {},
dealerId: null
}
},
onLoad(options) {
const refereeId = options.user_id
uni.setStorageSync('refereeId',refereeId)
this.$navTo('pages/login/index')
},
methods: {
// addUserReferee(dealerId){
// const app = this
// const userId = uni.getStorageSync('userId')
// if(dealerId > 0){
// UserRefereeApi.addUserReferee({
// dealerId,
// userId
// }).then(() => {
// app.$push('pages/index/index')
// })
// }
// }
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,180 @@
<template>
<view class="container">
<view class="search-wrapper">
<u-cell :title="userTypeText" isLink :border="false" arrowDirection="down" @click="showUserType = true"></u-cell>
<u-cell :title="userSexText" isLink :border="false" arrowDirection="down" @click="showUserSex = true"></u-cell>
</view>
<view class="user-list">
<u-list @scrolltolower="scrolltolower">
<view class="list">
<u-list-item v-for="(item, index) in list" :key="index">
<u-cell :title="`${item.nickname}`" :label="`ID${item.userId} 粉丝:${item.id}`" isLink>
<u-avatar slot="icon" size="50" :src="item.avatar"
customStyle="margin: -3px 5px -3px 0"></u-avatar>
<!-- <view solt="label">
<text class="desc-text">{{ `ID${item.userId}` }}</text>
<text class="desc-text">{{ `粉丝:${item.id}` }}</text>
</view> -->
<view slot="right-icon" class="follow-btn" @click.stop="onFollow">
<text>线下普通会员</text>
</view>
</u-cell>
</u-list-item>
<u-empty v-if="list.length == 0" mode="search" icon="http://cdn.uviewui.com/uview/empty/search.png">
</u-empty>
</view>
</u-list>
</view>
<u-action-sheet :actions="userType" @select="onUserType"
:show="showUserType"></u-action-sheet>
<u-action-sheet :actions="userSex" @select="onUserSex"
:show="showUserSex"></u-action-sheet>
</view>
</template>
<script>
import * as UserRefereeApi from '@/api/user-referee.js'
const userId = uni.getStorageSync('userId')
export default {
data() {
return {
// 会员类型
userType: [{
name: '不限'
},{
name: '线下普通会员'
},
{
name: '线下尊享会员'
}
],
showUserType: false,
// 会员性别
userSex: [{
name: '不限'
},{
name: '男'
},
{
name: '女'
}
],
showUserSex: false,
// 会员列表
list: [],
page: 0,
userTypeText: '全部单身会员',
userSexText: '性别',
// 控制onShow事件是否刷新订单列表
canReset: false,
disabled: false
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.where = options
this.onRefreshList()
},
methods: {
// 刷新会员列表
onRefreshList() {
const app = this
app.where.page = app.page
app.where.dealerId = userId
return new Promise((resolve, reject) => {
UserRefereeApi.pageUserReferee(app.where)
.then(result => {
const list = result.data.list
// 合并新数据
app.list = app.list.concat(list)
if (result.data.count > app.list.length) {
app.canReset = true
} else {
app.canReset = false
}
resolve(list)
})
})
},
scrolltolower(e) {
console.log("e: ", e);
},
navTo(url, userId) {
this.$push(url, userId)
},
onFollow(e) {
console.log("e11: ", e);
},
onSearch() {
this.list = []
this.where.page = 1
this.onRefreshList()
},
onUserType(e){
console.log("e: ",e);
this.userTypeText = e.name
this.showUserType = false
if(e.name == '线下普通会员'){
this.where.gradeId = 3
}
if(e.name == '线下尊享会员'){
this.where.gradeId = 4
}
this.onSearch()
},
onUserSex(e){
console.log("e: ",e);
this.userSexText = e.name
this.showUserSex = false
if(e.name == '男'){
this.where.sex = 1
}
if(e.name == '女'){
this.where.sex = 2
}
this.onSearch()
}
}
}
</script>
<style lang="scss" scoped>
.container {
padding: 0rpx;
background-color: #ffffff;
}
.search-wrapper {
padding: 30rpx;
display: flex;
height: 64rpx;
}
.user-list {
margin: 20rpx auto;
.desc-text{
margin-right:50rpx;
}
}
.follow-btn {
padding: 4rpx 20rpx;
color: #ffffff;
font-size: 26rpx;
border-radius: 50rpx;
margin-right: 10rpx;
background: linear-gradient(#47076b, #8d1a50);
image {
width: 24rpx;
height: 66rpx;
margin-right: 6rpx;
}
}
</style>