feat(uniapp_v2): 二开功能迁移与小程序主包优化

- 从 uniapp 迁移 HJF 页面、API、组件及用户/订单相关改动
- queue、assets 使用独立分包以降低主包体积
- 修复首页单根节点与支付结果页 v-if 链
- 关闭 HjfDemoPanel 全局注册;uniNoticeBar 注释 $getAppWebview 避免 __webviewId__ 报错
- 配置域名与 manifest 应用名称;cache/store 防御性处理

Made-with: Cursor
This commit is contained in:
apple
2026-03-26 12:16:01 +08:00
parent c84aeda062
commit 8e17762510
742 changed files with 184117 additions and 0 deletions

View File

@@ -0,0 +1,251 @@
<template>
<base-drawer mode="bottom" :visible="visible" background-color="transparent" mask maskClosable @close="closeDrawer">
<view class="coupon rd-t-40rpx">
<view class="title">优惠券
<view class="close acea-row row-center-wrapper" @tap="closeDrawer">
<text class="iconfont icon-ic_close"></text>
</view>
</view>
<view class="search acea-row row-middle" v-if="num !=2">
<text class="iconfont icon-ic_search"></text>
<input class="inputs" placeholder='请输入优惠券名称' placeholder-class='placeholder' confirm-type='search' name="search"
v-model="keyword" @confirm="searchSubmit"></input>
</view>
<view class="list" v-if="couponList.length">
<scroll-view scroll-y="true" style="max-height: 800rpx;min-height: 500rpx;">
<view class="item acea-row row-middle" v-for="(item,index) in couponList" :key="index">
<view class="bg">
<view class="price" v-if="item.coupon_type==1">¥<text class="num">{{item.coupon_price}}</text></view>
<view class="price" v-else><text class="num">{{parseFloat(item.coupon_price)/10}}</text></view>
<view class="reduction">{{item.use_min_price}}可用</view>
</view>
<view class="text">
<view class="name line1">{{item.coupon_title}}</view>
<view class="type" v-if="item.type === 0 || item.applicable_type == 0">通用优惠券</view>
<view class="type" v-if="item.type === 1 || item.applicable_type == 1">品类优惠券</view>
<view class="type" v-if="item.type === 2 || item.applicable_type == 2">商品优惠券</view>
<view class="type" v-if="item.type === 3 || item.applicable_type == 3">品牌优惠券</view>
<view class="time" v-if="item.coupon_time">有效期{{item.coupon_time}}</view>
<view class="time" v-else>有效期{{ item.start_time ? item.start_time + '-' : '' }}{{ item.end_time }}</view>
</view>
<view v-if="num !=2" class="bnt acea-row row-center-wrapper" @click="send(item)">发送</view>
</view>
<view class="tips">没有更多了</view>
</scroll-view>
</view>
<view class="empty-box" v-else>
<emptyPage title="暂无优惠券~" src="/statics/images/noCoupon.png"></emptyPage>
</view>
</view>
</base-drawer>
</template>
<script>
import emptyPage from '@/components/emptyPage.vue';
import {
getUserCoupon,
postUserUpdate
} from "@/api/admin";
export default {
components: {
emptyPage
},
props:{
visible: {
type: Boolean,
default: false,
},
uid: {
type: Number,
default: 0
}
},
data(){
return{
keyword:'',
couponList:[],
num:0, //1用户批量0单独用户前两个是发送优惠券点击获取优惠券时 2是查看当前用户优惠券否则获取优惠券
ids:[]
}
},
mounted: function() {},
methods:{
send(item){
postUserUpdate({
type:3,
uid:this.num?this.ids:this.uid,
coupon_id:item.id
}).then(res=>{
this.$util.Tips({
title: res.msg
});
this.$emit('closeDrawer',1);
}).catch(err=>{
this.$util.Tips({
title: err
});
})
},
searchSubmit(){
this.userCoupon();
},
userCoupon(num,ids){
this.num = num;
this.ids = ids;
getUserCoupon({
coupon_title:this.keyword,
uid:this.num==2?this.uid:0
}).then(res=>{
this.couponList = res.data.list
}).catch(err=>{
this.$util.Tips({
title: err
});
})
},
closeDrawer() {
this.keyword = '';
this.$emit('closeDrawer');
}
}
}
</script>
<style lang="scss" scoped>
.empty-box{
padding: 0 20rpx;
margin-bottom: 20rpx;
}
.coupon{
background-color:#F5F5F5;
padding-bottom: 1rpx;
.title{
text-align: center;
height: 108rpx;
line-height: 108rpx;
font-size: 32rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 600;
color: #333333;
position: relative;
padding: 0 30rpx;
.close{
width: 36rpx;
height: 36rpx;
line-height: 36rpx;
background: #EEEEEE;
border-radius: 50%;
position: absolute;
right: 30rpx;
top:38rpx;
.iconfont {
font-weight: 300;
font-size: 20rpx;
}
}
}
.search{
width: 710rpx;
height: 72rpx;
background: #FFFFFF;
border-radius: 50rpx;
padding: 0 34rpx;
margin: 24rpx auto;
&.on{
width: 618rpx;
}
.iconfont{
color: #999;
font-size: 32rpx;
margin-right: 16rpx;
}
.inputs{
font-size: 28rpx;
width: 100%;
height: 100%;
flex: 1;
}
.placeholder{
color: #ccc;
}
}
.list{
padding: 0 20rpx;
.item{
background-color: #fff;
border-radius: 30rpx;
margin-bottom: 20rpx;
.bg{
background-image: url('../../../static/coupon.png');
background-repeat: no-repeat;
background-size: 100% 100%;
width: 188rpx;
height: 170rpx;
font-size: 22rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #FFFFFF;
text-align: center;
padding: 32rpx 0;
.price{
font-size: 28rpx;
font-weight: 600;
.num{
font-size: 52rpx;
font-family:'Regular';
}
}
.reduction{
margin-top: 14rpx;
color: rgba(255, 255, 255, 0.7);
}
}
.text{
margin-left: 20rpx;
font-family: PingFang SC, PingFang SC;
.name{
font-size: 28rpx;
font-weight: 600;
color: #333333;
width: 336rpx;
}
.type{
font-size: 20rpx;
font-weight: 400;
color: #666666;
margin-top: 8rpx;
}
.time{
font-size: 20rpx;
font-weight: 400;
color: #999999;
margin-top: 20rpx;
}
}
.bnt{
width: 112rpx;
height: 52rpx;
background: #E9F2FE;
border-radius: 26rpx;
font-size: 22rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
color: #2A7EFB;
margin-left: 34rpx;
}
}
.tips{
font-size: 26rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #CCCCCC;
text-align: center;
margin: 32rpx 0;
margin-bottom: calc(32rpx + constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
margin-bottom: calc(32rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
}
}
}
</style>

View File

@@ -0,0 +1,207 @@
<template>
<base-drawer mode="bottom" :visible="visible" background-color="transparent" mask maskClosable @close="closeDrawer">
<view class="edit-balance rd-t-40rpx">
<view class="title">修改{{type?'余额':'积分'}}
<view class="close acea-row row-center-wrapper" @tap="closeDrawer">
<text class="iconfont icon-ic_close"></text>
</view>
</view>
<view class="list">
<view class="item acea-row row-between-wrapper">
<view>修改{{type?'余额':'积分'}}</view>
<view class="acea-row row-middle">
<view class="itemn acea-row row-middle" :class="current == index?'on':''" v-for="(item, index) in navList" :key="index" @click="navTap(index)">
<text class="iconfont" :class="current == index?'icon-ic_Selected':'icon-ic_unselect'"></text>
<text>{{item}}</text>
</view>
</view>
</view>
<view class="item acea-row row-between-wrapper">
<view>{{type?'余额':'积分'}}</view>
<view class="acea-row row-middle">
<input type="number" v-model="numeral" :placeholder="type?'请填写余额':'请填写积分'" placeholder-class="placeholder"/>
<text class="iconfont icon-ic_edit"></text>
</view>
</view>
</view>
<view class="footer acea-row row-between-wrapper">
<view class="bnt acea-row row-center-wrapper" @click="closeDrawer">取消</view>
<view class="bnt on acea-row row-center-wrapper" @click="define">确定</view>
</view>
</view>
</base-drawer>
</template>
<script>
import {
postUserUpdateOther
} from "@/api/admin";
export default {
props:{
visible: {
type: Boolean,
default: false,
},
type: {
type: Number,
default: 0,
},
uid: {
type: Number,
default: 0
}
},
watch: {
type: {
handler(newValue, oldValue) {
if(newValue){
this.navList = ['增加余额','减少余额']
}else{
this.navList = ['增加积分','减少积分']
}
},
immediate: true
}
},
data(){
return{
navList:[],
current:0,
numeral:0
}
},
mounted: function() {},
methods:{
navTap(index){
this.current = index
},
define(){
if(this.numeral<=0){
let title = '';
if(this.type){
title = '请填写你要增加或减少的余额'
}else{
title = '请填写你要增加或减少的积分'
}
this.$util.Tips({
title: title
});
return
}
postUserUpdateOther(this.uid,{
status:this.current + 1,
number:this.numeral,
type:this.type
}).then(res=>{
this.$util.Tips({
title: res.msg
});
this.numeral = 0;
this.$emit('successChange');
}).catch(err=>{
this.$util.Tips({
title: err
});
})
},
closeDrawer() {
this.numeral = 0;
this.$emit('closeDrawer');
}
}
}
</script>
<style lang="scss" scoped>
.edit-balance{
background-color: #fff;
padding-bottom: 60rpx;
.title{
text-align: center;
height: 108rpx;
line-height: 108rpx;
font-size: 32rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 600;
color: #333333;
position: relative;
padding: 0 30rpx;
.close{
width: 36rpx;
height: 36rpx;
line-height: 36rpx;
background: #EEEEEE;
border-radius: 50%;
position: absolute;
right: 30rpx;
top:38rpx;
.iconfont {
font-weight: 300;
font-size: 20rpx;
}
}
}
.list{
padding: 0 30rpx;
.item{
font-size: 28rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #333333;
height: 72rpx;
margin-bottom: 32rpx;
box-sizing: border-box;
.icon-ic_edit{
color: #999999;
}
.itemn{
margin-left: 50rpx;
color: #999999;
.iconfont {
margin-top: 4rpx;
color: #CCCCCC;
margin-right: 14rpx;
}
&.on {
color: #333333;
.iconfont {
color: #2A7EFB;
}
}
}
input {
text-align: right;
font-size: 36rpx;
font-family: Regular;
color: #FF7E00;
}
/deep/.uni-input-input{
padding-right: 10rpx;
}
.placeholder{
font-size: 28rpx;
padding-right: 10rpx;
padding: 6rpx 10rpx 0 0;
}
}
}
.footer{
padding: 0 20rpx;
margin-top: 166rpx;
.bnt{
width: 346rpx;
height: 72rpx;
border: 2rpx solid #2A7EFB;
border-radius: 100rpx;
font-size: 26rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
color: #2A7EFB;
&.on{
background: #2A7EFB;
color: #fff;
}
}
}
}
</style>

View File

@@ -0,0 +1,246 @@
<template>
<base-drawer mode="right" :visible="visible" background-color="transparent" mask maskClosable @close="closeDrawer">
<view class="edit-lable">
<!-- #ifdef MP -->
<view class="accountTitle">
<view :style="{height:getHeight.barTop+'px'}"></view>
<view class="sysTitle acea-row row-center-wrapper" :style="{height:getHeight.barHeight+'px'}">
<view>筛选</view>
</view>
</view>
<view :style="{height:(getHeight.barTop+getHeight.barHeight)+'px'}"></view>
<view class="list"
:style="'height: calc(100% - '+(getHeight.barTop+getHeight.barHeight*2+150)+'rpx - constant(safe-area-inset-bottom));height: calc(100% - '+(getHeight.barTop+getHeight.barHeight*2+150)+'rpx - env(safe-area-inset-bottom))'">
<!-- #endif -->
<!-- #ifndef MP -->
<view class="header">筛选</view>
<view class="list">
<!-- #endif -->
<scroll-view scroll-y="true" style="height: 100%">
<view class="item">
<view class="title">分组</view>
<view class="listn acea-row row-middle">
<view class="name acea-row row-center-wrapper" :class="{on:groupIds == item.id}" v-for="(item,groupIndex) in groupArray" :key="groupIndex" @click="selectGroup(item)">
<text class="line1">{{item.group_name}}</text>
</view>
</view>
</view>
<view class="item">
<view class="title">等级</view>
<view class="listn acea-row row-middle">
<view class="name acea-row row-center-wrapper" :class="{on:levelIds == item.id}" v-for="(item,levelIndex) in levelArray" :key="levelIndex" @click="selectLevel(item)">
<text class="line1">{{item.name}}</text>
</view>
</view>
</view>
<view class="item">
<view class="title">标签</view>
<view v-for="(item, index) in labelList" :key="index">
<view class="titlen" v-if="item.label && item.label.length">{{item.name}}</view>
<view class="listn acea-row row-middle" v-if="item.label && item.label.length">
<view class="name acea-row row-center-wrapper" :class="{on:labelIds.includes(j.id)}" v-for="(j, indexn) in item.label" :key="indexn" @click="selectLabel(j)">
<text class="line1">{{j.label_name}}</text>
</view>
</view>
</view>
</view>
</scroll-view>
</view>
<view class="footer acea-row row-between-wrapper">
<view class="bnt acea-row row-center-wrapper" @tap="reset">重置</view>
<view class="bnt on acea-row row-center-wrapper" @tap="define">确定</view>
</view>
</view>
</base-drawer>
</template>
<script>
import {
getUserLabel
} from "@/api/admin";
export default {
props:{
visible: {
type: Boolean,
default: false,
},
groupArray: {
type: Array,
default: [],
},
levelArray: {
type: Array,
default: [],
},
},
data: function() {
return {
// #ifdef MP
getHeight: this.$util.getWXStatusHeight(),
// #endif
labelList:[],
labelIds:[],
groupIds:0,
levelIds:0
}
},
mounted() {
},
methods:{
reset(){
this.labelIds=[];
this.groupIds=0;
this.levelIds=0;
},
define(){
let data = {
labelIds: this.labelIds.join(','),
groupIds: this.groupIds,
levelIds: this.levelIds
};
this.$emit('successChange',data);
},
selectGroup(item){
this.groupIds = item.id;
},
selectLevel(item){
this.levelIds = item.id;
},
selectLabel(item){
if(this.labelIds.includes(item.id)){
this.labelIds = this.labelIds.filter(function (ele){return ele != item.id;});
}else{
this.labelIds.push(item.id);
}
},
productLabel(){
getUserLabel().then(res=>{
this.labelList = res.data
}).catch(err=>{
this.$util.Tips({
title: err
});
})
},
closeDrawer() {
this.$emit('closeDrawer');
}
}
}
</script>
<style lang="scss" scoped>
.accountTitle{
position: fixed;
left:0;
top:0;
width: 100%;
z-index: 99;
padding-bottom: 6rpx;
.sysTitle{
width: 100%;
position: relative;
font-weight: 600;
color: #333333;
font-size: 34rpx;
font-family: PingFang SC, PingFang SC;
}
}
.edit-lable{
background-color: #fff;
width: 670rpx;
border-radius: 40rpx 0 0 40rpx;
height: 100%;
padding: 20rpx 34rpx 0 32rpx;
.header{
text-align: center;
height: 96rpx;
line-height: 96rpx;
font-size: 34rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 600;
color: #333333;
position: relative;
}
.list{
overflow: auto;
height: calc(100% - 208rpx );
height: calc(100% - (208rpx + constant(safe-area-inset-bottom)));
height: calc(100% - (208rpx + env(safe-area-inset-bottom)));
.item{
margin-top: 48rpx;
&~.item{
.titlen{
margin-top: 48rpx;
}
}
.title{
font-size: 28rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 600;
color: #333333;
}
.titlen{
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #666666;
margin-top: 24rpx;
}
.listn{
.name{
width: 184rpx;
height: 56rpx;
background-color: #F5F5F5;
border-radius: 50rpx;
border:1rpx solid #F5F5F5;
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #333333;
margin-right: 26rpx;
margin-top: 24rpx;
padding: 0 8rpx;
&.on {
background-color:#E9F2FE;
border-color:#2A7EFB;
color: #2A7EFB;
}
&:nth-of-type(3n){
margin-right: 0;
}
}
}
}
}
.footer{
width: 100%;
height: 112rpx;
position: fixed;
bottom: 0;
left:0;
padding: 0 32rpx;
background-color: #fff;
border-radius: 0 0 0 40rpx;
height: calc(112rpx + constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
height: calc(112rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
padding-bottom: constant(safe-area-inset-bottom); ///兼容 IOS<11.2/
padding-bottom: env(safe-area-inset-bottom); ///兼容 IOS>11.2/
.bnt{
width: 296rpx;
height: 72rpx;
border: 1px solid #2A7EFB;
border-radius: 200rpx;
font-size: 26rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 600;
color: #2A7EFB;
&.on{
background: #2A7EFB;
border-color: #2A7EFB;
color: #fff;
}
}
}
}
</style>

View File

@@ -0,0 +1,197 @@
<template>
<base-drawer mode="bottom" :visible="visible" background-color="transparent" mask maskClosable @close="closeDrawer">
<view class="edit-balance rd-t-40rpx">
<view class="title">赠送会员
<view class="close acea-row row-center-wrapper" @tap="closeDrawer">
<text class="iconfont icon-ic_close"></text>
</view>
</view>
<view class="list">
<view class="item acea-row row-between-wrapper">
<view>会员到期日</view>
<view class="time">{{userInfo.svip_overdue_time || '已过期/暂未开通'}}</view>
</view>
<view class="item acea-row row-between-wrapper">
<view>剩余天数</view>
<view class="time">{{userInfo.svip_over_day}}</view>
</view>
<view class="item acea-row row-between-wrapper">
<view>修改付费会员</view>
<view class="acea-row row-middle">
<view class="itemn acea-row row-middle" :class="current == index?'on':''" v-for="(item, index) in navList" :key="index" @click="navTap(index)">
<text class="iconfont" :class="current == index?'icon-ic_Selected':'icon-ic_unselect'"></text>
<text>{{item}}</text>
</view>
</view>
</view>
<view class="item acea-row row-between-wrapper">
<view>调整时长()</view>
<view class="acea-row row-middle">
<input type="numeric" v-model="numeral" placeholder="请输入时长" placeholder-class="placeholder"/>
<text class="iconfont icon-ic_edit"></text>
</view>
</view>
</view>
<view class="footer acea-row row-between-wrapper">
<view class="bnt acea-row row-center-wrapper" @click="closeDrawer">取消</view>
<view class="bnt on acea-row row-center-wrapper" @click="define">确定</view>
</view>
</view>
</base-drawer>
</template>
<script>
import {
postUserUpdate
} from "@/api/admin";
export default {
props:{
visible: {
type: Boolean,
default: false,
},
userInfo: {
type: Object,
default: () => {}
}
},
data(){
return{
navList:['增加','减少'],
current:0,
numeral:0
}
},
mounted: function() {},
methods:{
navTap(index){
this.current = index
},
define(){
if(this.numeral <=0){
this.$util.Tips({
title: '请填写有效时长'
});
return
}
postUserUpdate({
type:2,
uid:this.userInfo.uid,
days_status:this.current+1,
days:this.numeral
}).then(res=>{
this.$util.Tips({
title: res.msg
});
this.numeral = 0
this.$emit('successChange');
}).catch(err=>{
this.$util.Tips({
title: err
});
})
},
closeDrawer() {
this.numeral = 0
this.$emit('closeDrawer');
}
}
}
</script>
<style lang="scss" scoped>
.edit-balance{
background-color: #fff;
padding-bottom: 60rpx;
.title{
text-align: center;
height: 108rpx;
line-height: 108rpx;
font-size: 32rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 600;
color: #333333;
position: relative;
padding: 0 30rpx;
.close{
width: 36rpx;
height: 36rpx;
line-height: 36rpx;
background: #EEEEEE;
border-radius: 50%;
position: absolute;
right: 30rpx;
top:38rpx;
.iconfont {
font-weight: 300;
font-size: 20rpx;
}
}
}
.list{
padding: 0 30rpx;
.item{
font-size: 28rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #333333;
height: 72rpx;
margin-bottom: 32rpx;
box-sizing: border-box;
.icon-ic_edit{
color: #999999;
}
.time{
color: #999999;
}
.itemn{
margin-left: 50rpx;
color: #999999;
.iconfont {
margin-top: 4rpx;
color: #CCCCCC;
margin-right: 14rpx;
}
&.on {
color: #333333;
.iconfont {
color: #2A7EFB;
}
}
}
input {
text-align: right;
font-size: 36rpx;
font-family: Regular;
color: #FF7E00;
}
/deep/.uni-input-input{
padding-right: 10rpx;
}
.placeholder{
font-size: 28rpx;
padding-right: 10rpx;
padding: 6rpx 10rpx 0 0;
}
}
}
.footer{
padding: 0 20rpx;
margin-top: 90rpx;
.bnt{
width: 346rpx;
height: 72rpx;
border: 2rpx solid #2A7EFB;
border-radius: 100rpx;
font-size: 26rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
color: #2A7EFB;
&.on{
background: #2A7EFB;
color: #fff;
}
}
}
}
</style>

View File

@@ -0,0 +1,252 @@
<template>
<base-drawer mode="right" :visible="visible" background-color="transparent" mask maskClosable @close="closeDrawer">
<view class="edit-lable">
<!-- #ifdef MP -->
<view class="accountTitle">
<view :style="{height:getHeight.barTop+'px'}"></view>
<view class="sysTitle acea-row row-center-wrapper" :style="{height:getHeight.barHeight+'px'}">
<view>添加标签</view>
</view>
</view>
<view :style="{height:(getHeight.barTop+getHeight.barHeight)+'px'}"></view>
<view class="list" v-if="isStore"
:style="'height: calc(100% - '+(getHeight.barTop+getHeight.barHeight*2+150)+'rpx - constant(safe-area-inset-bottom));height: calc(100% - '+(getHeight.barTop+getHeight.barHeight*2+150)+'rpx - env(safe-area-inset-bottom))'">
<!-- #endif -->
<!-- #ifndef MP -->
<view class="header">添加标签</view>
<view class="list" v-if="isStore">
<!-- #endif -->
<scroll-view scroll-y="true" style="height: 100%">
<view class="item" v-for="(item, index) in labelList" :key="index">
<view class="title" v-if="item.label && item.label.length">{{item.name}}</view>
<view class="listn acea-row row-middle" v-if="item.label && item.label.length">
<view class="name acea-row row-center-wrapper" :class="{on:j.disabled}" v-for="(j, indexn) in item.label" :key="indexn" @click="selectLabel(j)">
<text class="line1">{{j.label_name}}</text>
</view>
</view>
</view>
</scroll-view>
</view>
<view class="empty-box" v-else>
<emptyPage title="暂无标签~" src="/statics/images/empty-box.png"></emptyPage>
</view>
<view class="footer acea-row row-between-wrapper">
<view class="bnt acea-row row-center-wrapper" @tap="reset">重置</view>
<view class="bnt on acea-row row-center-wrapper" @tap="define">确定</view>
</view>
</view>
</base-drawer>
</template>
<script>
import emptyPage from '@/components/emptyPage.vue';
import {
getUserLabel,
postUserUpdate
} from "@/api/admin";
import { handleError } from "vue";
export default {
components: {
emptyPage
},
props:{
visible: {
type: Boolean,
default: false,
},
},
data: function() {
return {
// #ifdef MP
getHeight: this.$util.getWXStatusHeight(),
// #endif
labelList:[],
goodsInfo:{}, //列表中已存在id固定不变
dataLabel: [], //已存在选中id(随着选中可以变化)
isStore:false, //判断是否存在标签
num:0, // 判断是否为批量
ids:[] //批量时的id集合
};
},
mounted() {
},
methods:{
define(){
let labelIds = []
this.dataLabel.forEach(item=>{
labelIds.push(item.id)
})
postUserUpdate({
type:5,
uid:this.num?this.ids:this.goodsInfo.uid,
label_id:labelIds
}).then(res=>{
this.$util.Tips({
title: res.msg
});
this.$emit('closeDrawer',1);
}).catch(err=>{
this.$util.Tips({
title: err
});
})
},
reset(){
this.productLabel(this.goodsInfo,this.num,this.ids);
},
inArray: function (search, array) {
for (let i in array) {
if (array[i].id == search) {
return true;
}
}
return false;
},
productLabel(data,num,ids){
this.dataLabel = data.label_id || [];
this.goodsInfo = JSON.parse(JSON.stringify(data));
this.num = num;
this.ids = ids;
getUserLabel().then(res=>{
res.data.map(el => {
if (el.label && el.label.length) {
this.isStore = true;
el.label.map(label => {
if (this.inArray(label.id, this.dataLabel)) {
label.disabled = true;
} else {
label.disabled = false;
}
})
}
})
this.labelList = res.data
}).catch(err=>{
this.$util.Tips({
title: err
});
})
},
selectLabel(label) {
if (label.disabled) {
let index = this.dataLabel.indexOf(this.dataLabel.filter(d => d.id == label.id)[0]);
this.dataLabel.splice(index, 1);
label.disabled = false
} else {
this.dataLabel.push({
id:label.id,
label_name:label.label_name
});
label.disabled = true
}
},
closeDrawer() {
this.$emit('closeDrawer');
}
}
}
</script>
<style lang="scss" scoped>
.accountTitle{
position: fixed;
left:0;
top:0;
width: 100%;
z-index: 99;
padding-bottom: 6rpx;
.sysTitle{
width: 100%;
position: relative;
font-weight: 600;
color: #333333;
font-size: 34rpx;
font-family: PingFang SC, PingFang SC;
}
}
.edit-lable{
background-color: #fff;
width: 670rpx;
border-radius: 40rpx 0 0 40rpx;
height: 100%;
padding: 20rpx 34rpx 0 32rpx;
.header{
text-align: center;
height: 96rpx;
line-height: 96rpx;
font-size: 34rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 600;
color: #333333;
position: relative;
}
.list{
overflow: auto;
height: calc(100% - 208rpx );
height: calc(100% - (208rpx + constant(safe-area-inset-bottom)));
height: calc(100% - (208rpx + env(safe-area-inset-bottom)));
.item{
margin-top: 48rpx;
.title{
font-size: 28rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 600;
color: #333333;
}
.listn{
.name{
width: 184rpx;
height: 56rpx;
background-color: #F5F5F5;
border-radius: 50rpx;
border:1rpx solid #F5F5F5;
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #333333;
margin-right: 26rpx;
margin-top: 24rpx;
padding: 0 8rpx;
&.on {
background-color:#E9F2FE;
border-color:#2A7EFB;
color: #2A7EFB;
}
&:nth-of-type(3n){
margin-right: 0;
}
}
}
}
}
.footer{
width: 100%;
height: 112rpx;
position: fixed;
bottom: 0;
left:0;
padding: 0 32rpx;
background-color: #fff;
border-radius: 0 0 0 40rpx;
height: calc(112rpx + constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
height: calc(112rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
padding-bottom: constant(safe-area-inset-bottom); ///兼容 IOS<11.2/
padding-bottom: env(safe-area-inset-bottom); ///兼容 IOS>11.2/
.bnt{
width: 296rpx;
height: 72rpx;
border: 1px solid #2A7EFB;
border-radius: 200rpx;
font-size: 26rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 600;
color: #2A7EFB;
&.on{
background: #2A7EFB;
border-color: #2A7EFB;
color: #fff;
}
}
}
}
</style>

View File

@@ -0,0 +1,559 @@
<template>
<view class="user-details">
<!-- #ifdef MP || APP-PLUS -->
<view class="accountTitle">
<view :style="{height:getHeight.barTop+'px'}"></view>
<view class="sysTitle acea-row row-center-wrapper" :style="{height:getHeight.barHeight+'px'}">
<view>用户详情</view>
<text class="iconfont icon-ic_leftarrow" @click="goarrow"></text>
</view>
</view>
<view :style="{height:(getHeight.barTop+getHeight.barHeight)+'px'}"></view>
<!-- #endif -->
<view class="header">
<view class="picTxt acea-row row-middle">
<view class="pictrue">
<image :src="infoData.avatar"></image>
</view>
<view class="text">
<view class="name acea-row row-middle">
<view class="nameCon line1">{{infoData.nickname}}</view>
<view class="svip acea-row row-center-wrapper" v-if="infoData.isMember == 1">SVIP</view>
<view class="vip acea-row row-center-wrapper" v-if="infoData.level_status == 1">
<text class="iconfont icon-huiyuandengji"></text>
V{{infoData.level_grade}}
</view>
</view>
<view v-if="infoData.phone">{{infoData.phone}}ID{{uid}}</view>
<view v-else>ID{{uid}}</view>
</view>
</view>
<view class="bottom acea-row row-middle">
<view class="item">消费金额<text class="num">{{infoData.order_total_price}}</text></view>
<view class="item">消费笔数<text class="num">{{infoData.order_total_count}}</text></view>
</view>
</view>
<view class="list">
<view class="title acea-row row-between-wrapper">
<view class="name">用户信息</view>
<view class="tip" @click="openTap">{{isShow?'展开':'收起'}}<text class="iconfont" :class="isShow?'icon-ic_downarrow':'icon-ic_uparrow'"></text></view>
</view>
<view class="item acea-row row-between-wrapper">
<view>分组</view>
<view>
<picker @change="bindPickerChange" :value="groupIndex" :range="groupArray" range-key="group_name">
<view class="acea-row row-middle">
<view v-if="groupArray.length">
<text class="not" v-if="groupIndex == -1"></text>
<text v-else>{{groupArray[groupIndex].group_name}}</text>
</view>
<text class="iconfont icon-ic_rightarrow"></text>
</view>
</picker>
</view>
</view>
<view class="item acea-row row-between-wrapper">
<view>等级</view>
<view>
<picker @change="bindLevelChange" :value="levelIndex" :range="levelArray" range-key="name">
<view class="acea-row row-middle">
<view v-if="levelArray.length">
<text class="not" v-if="levelIndex == -1"></text>
<text v-else>{{levelArray[levelIndex].name}}</text>
</view>
<text class="iconfont icon-ic_rightarrow"></text>
</view>
</picker>
</view>
</view>
<view class="item">
<view class="acea-row row-between-wrapper">
<view>标签</view>
<view class="add" @click="editLabels"><text class="iconfont icon-ic_increase"></text>添加标签</view>
</view>
<view class="labelList acea-row row-middle" v-if="infoData.label_id && infoData.label_id.length">
<view class="label" v-for="(item,index) in infoData.label_id" :key="index">{{item.label_name}}</view>
</view>
</view>
<view class="listn" v-if="!isShow">
<view class="item acea-row row-between-wrapper" v-if="infoData.real_name">
<view>姓名</view>
<view class="info">{{infoData.real_name}}</view>
</view>
<view class="item acea-row row-between-wrapper" v-if="infoData.birthday">
<view>出生年月</view>
<view class="info">{{infoData.birthday}}</view>
</view>
<view class="item acea-row row-between-wrapper" v-if="infoData.card_id">
<view>身份证号</view>
<view class="info">{{infoData.card_id}}</view>
</view>
<view class="item acea-row row-between" v-if="infoData.addres">
<view>地址</view>
<view class="info">{{infoData.addres}}</view>
</view>
<view class="item acea-row row-between-wrapper" v-if="infoData._add_time">
<view>注册时间</view>
<view class="info">{{infoData._add_time}}</view>
</view>
</view>
</view>
<view class="property">
<view class="title">资产信息</view>
<view class="info acea-row">
<view class="item" @click="integralTap">
<view>积分</view>
<view class="bottom acea-row row-between-wrapper">
<view class="num">{{infoData.integral}}</view>
<view class="iconfont icon-ic_edit"></view>
</view>
</view>
<view class="item" @click="balanceTap">
<view>余额</view>
<view class="bottom acea-row row-between-wrapper">
<view class="num">{{infoData.now_money}}</view>
<view class="iconfont icon-ic_edit"></view>
</view>
</view>
</view>
<view class="info acea-row">
<view class="item">
<view class="acea-row row-between-wrapper">
<view>优惠券</view>
<view class="iconfont icon-ic_rightarrow" @click="couponSeeTap"></view>
</view>
<view class="bottom acea-row row-between-wrapper">
<view class="num">{{infoData.coupon_num}}</view>
<view class="give" @click="couponTap">赠送</view>
</view>
</view>
<view class="item" @click="memberTap">
<view>会员</view>
<view class="bottom acea-row row-between-wrapper">
<view class="num" v-if="infoData.svip_over_day">{{ '剩余'+infoData.svip_over_day+'' }}</view>
<view class="num" v-else>已过期/暂未开通</view>
<view class="iconfont icon-ic_edit"></view>
</view>
</view>
</view>
</view>
<edit-lable ref="lable" :visible='visibleLable' @closeDrawer='lableCloseDrawer'></edit-lable>
<edit-balance ref="balance" :visible='visibleBalance' :type = 'type' :uid='parseInt(uid)' @closeDrawer='balanceCloseDrawer' @successChange='successChange'></edit-balance>
<member ref="member" :visible='visibleMember' :userInfo='infoData' @closeDrawer='memberCloseDrawer' @successChange='successChange'></member>
<coupon ref="coupon" :visible='visibleCoupon' :uid='parseInt(uid)' @closeDrawer='couponCloseDrawer'></coupon>
</view>
</template>
<script>
import editLable from './components/userLable/index.vue';
import editBalance from './components/editBalance/index.vue';
import member from './components/member/index.vue';
import coupon from './components/coupon/index.vue';
import {
getUserInfo,
getGroupList,
getLevelList,
postUserUpdate
} from "@/api/admin";
export default {
components: {
editLable,
editBalance,
member,
coupon
},
data() {
return {
getHeight: this.$util.getWXStatusHeight(),
uid: 0,
infoData: {},
groupArray:[],
levelArray:[],
groupIndex:-1,
levelIndex:-1,
visibleLable:false,
visibleBalance:false,
type: 0,
visibleMember:false,
visibleCoupon:false,
isShow:false
}
},
onLoad(options) {
this.uid = options.uid
this.userInfo(1);
},
methods: {
openTap(){
this.isShow = !this.isShow
},
couponTap(){
this.$refs.coupon.userCoupon(0);
this.visibleCoupon = true;
},
couponSeeTap(){
this.$refs.coupon.userCoupon(2);
this.visibleCoupon = true;
},
couponCloseDrawer(e){
this.visibleCoupon = false;
if(e){
this.userInfo();
}
},
memberTap(){
this.visibleMember = true;
},
memberCloseDrawer(){
this.visibleMember = false;
},
balanceTap(){
this.type = 1;
this.visibleBalance = true;
},
integralTap(){
this.type = 0;
this.visibleBalance = true;
},
successChange(){
this.visibleBalance = false
this.visibleMember = false;
this.userInfo();
},
balanceCloseDrawer(){
this.visibleBalance = false
},
lableCloseDrawer(e){
this.visibleLable = false
if(e){
this.userInfo();
}
},
editLabels(){
this.visibleLable = true
this.$refs.lable.productLabel(JSON.parse(JSON.stringify(this.infoData)),0,[]);
},
bindPickerChange(e){
this.groupIndex = e.detail.value
this.userUpdate(4)
},
bindLevelChange(e){
this.levelIndex = e.detail.value
this.userUpdate(1)
},
userUpdate(num){
let data = {}
if(num == 4){
data = {
type:4,
uid:this.uid,
group_id:this.groupArray[this.groupIndex].id
}
}else{
data = {
type:1,
uid:this.uid,
level:this.levelArray[this.levelIndex].id
}
}
postUserUpdate(data).then(res=>{
this.$util.Tips({
title: res.msg
});
}).catch(err=>{
this.$util.Tips({
title: err
});
})
},
levelList(){
getLevelList().then(res=>{
let id = this.infoData.level
res.data.list.forEach((item,index)=>{
if(item.id == id){
this.levelIndex = index
}
})
this.levelArray = res.data.list;
}).catch(err=>{
this.$util.Tips({
title: err
});
})
},
groupList(){
getGroupList().then(res=>{
let id = this.infoData.group_id
res.data.forEach((item,index)=>{
if(item.id == id){
this.groupIndex = index
}
})
this.groupArray = res.data;
}).catch(err=>{
this.$util.Tips({
title: err
});
})
},
goarrow(){
uni.navigateBack()
},
userInfo(num){
getUserInfo(this.uid).then(res=>{
this.infoData = res.data;
if(num){
this.groupList();
this.levelList();
}
}).catch(err=>{
this.$util.Tips({
title: err
});
})
}
}
}
</script>
<style lang="scss" scoped>
.accountTitle{
background: linear-gradient(270deg, $gradient-primary-admin 0%, $primary-admin 100%);
position: fixed;
left:0;
top:0;
width: 100%;
z-index: 99;
.sysTitle{
width: 100%;
position: relative;
font-weight: 500;
color: #fff;
font-size: 30rpx;
.iconfont{
position: absolute;
font-size: 39rpx;
left:11rpx;
width: 60rpx;
font-weight: 600;
}
}
}
.user-details{
padding-bottom: 1rpx;
padding-bottom: calc(1rpx + constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
padding-bottom: calc(1rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
.header{
background: linear-gradient(270deg, $gradient-primary-admin 0%, $primary-admin 100%);
height: 346rpx;
padding: 20rpx 30rpx 0 30rpx;
position: relative;
.picTxt{
.pictrue{
width: 112rpx;
height: 112rpx;
image {
width: 100%;
height: 100%;
border-radius: 50%;
}
}
.text{
margin-left: 32rpx;
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: rgba(255, 255, 255, 0.5);
.name{
margin-bottom: 12rpx;
.nameCon{
font-size: 32rpx;
color: #fff;
max-width: 300rpx;
}
.svip{
width: 56rpx;
height: 26rpx;
background: linear-gradient(270deg, #484643 0%, #1F1B17 100%);
border-radius: 14rpx;
font-size: 18rpx;
font-weight: 600;
color: #FDDAA4;
margin-left: 12rpx;
}
.vip{
width: 68rpx;
height: 26rpx;
background: #FEF0D9;
margin-left: 12rpx;
border-radius: 50rpx;
font-size: 18rpx;
font-weight: 500;
color: #DFA541;
.iconfont{
font-size: 20rpx;
margin-right: 4rpx;
}
}
}
}
}
.bottom{
font-size: 26rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: rgba(255, 255, 255, 0.8);
margin-top: 40rpx;
.item{
margin-right: 44rpx;
.num{
margin-left: 8rpx;
color: #FFFFFF;
}
}
}
&::after{
position: absolute;
content: '';
width: 50%;
height: 88rpx;
background: linear-gradient(180deg, $primary-admin 0%, #F5F5F5 100%);
left:0;
bottom: 0;
}
&::before{
position: absolute;
content: '';
width: 50%;
height: 88rpx;
background: linear-gradient(180deg, $gradient-primary-admin 0%, #F5F5F5 100%);
right:0;
bottom: 0;
}
}
.list{
width: 710rpx;
background-color: #fff;
border-radius: 24rpx;
margin: -96rpx auto 0 auto;
position: relative;
font-family: PingFang SC, PingFang SC;
color: #333333;
padding: 32rpx 24rpx 40rpx 24rpx;
.title{
margin-bottom: 40rpx;
.name{
font-size: 30rpx;
font-weight: 600;
}
.tip{
font-size: 26rpx;
font-weight: 400;
color: #999999;
.iconfont {
font-size: 22rpx;
margin-left: 4rpx;
}
}
}
.listn{
margin-top: 52rpx;
}
.item {
font-weight: 400;
&~.item{
margin-top: 52rpx;
}
.not{
color: #999;
}
.iconfont {
font-size: 26rpx;
color: #999;
margin-left: 6rpx;
}
.info{
color: #999999;
width: 465rpx;
text-align: right;
}
.add{
font-size: 24rpx;
color: $primary-admin;
.iconfont {
margin-right: 8rpx;
color: $primary-admin;
}
}
.labelList{
margin-top: 12rpx;
.label{
border: 1px solid $primary-admin;
border-radius: 20rpx;
font-size: 20rpx;
color: $primary-admin;
padding: 4rpx 16rpx;
margin-right: 16rpx;
margin-top: 16rpx;
}
}
}
}
.property{
width: 710rpx;
background-color: #fff;
border-radius: 24rpx;
margin: 20rpx auto;
font-family: PingFang SC, PingFang SC;
.title{
font-size: 30rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 600;
color: #333333;
padding: 32rpx 24rpx 2rpx 24rpx;
margin-bottom: 32rpx;
}
.info{
margin: 0 26rpx;
.item{
width: 50%;
font-size: 28rpx;
font-weight: 400;
color: #999999;
padding: 10rpx 40rpx 40rpx 18rpx;
&~.item{
border-left: 1px solid #EEEEEE;
padding-left: 40rpx;
padding-right: 14rpx;
}
.bottom{
margin-top: 20rpx;
.num{
font-size: 30rpx;
font-weight: 600;
color: #333333;
}
.give{
font-size: 24rpx;
font-weight: 400;
color: $primary-admin;
padding-left: 40rpx;
}
}
.icon-ic_rightarrow{
font-size: 26rpx;
padding: 6rpx 0 6rpx 40rpx;
}
}
&~.info{
border-top: 1px solid #EEEEEE;
.item{
padding-top: 40rpx;
}
}
}
}
}
</style>

View File

@@ -0,0 +1,678 @@
<template>
<view class="user-list">
<!-- #ifdef MP || APP-PLUS -->
<view class="accountTitle">
<view :style="{height:getHeight.barTop+'px'}"></view>
<view class="sysTitle acea-row row-center-wrapper" :style="{height:getHeight.barHeight+'px'}">
<view>用户管理</view>
<text class="iconfont icon-ic_leftarrow" @click="goarrow"></text>
</view>
</view>
<view :style="{height:(getHeight.barTop+getHeight.barHeight)+'px'}"></view>
<!-- #endif -->
<view class="searchCon acea-row row-between-wrapper">
<view class="search acea-row row-middle" :class="administer?'on':''">
<text class="iconfont icon-ic_search"></text>
<input class="inputs" placeholder='请输入用户昵称/ID' placeholder-class='placeholder' confirm-type='search' name="search"
v-model="keyword" @confirm="searchSubmit"></input>
</view>
<view @click="manageTap" v-if="administer">取消</view>
<view class="edit acea-row row-center-wrapper" @click="manageTap" v-else>
<text class="iconfont icon-ic_batch"></text>
</view>
<view class="edit acea-row row-center-wrapper" @click="filterTap" v-if="!administer">
<text class="iconfont icon-ic_sort"></text>
</view>
</view>
<view class="list" v-if="userLists.length">
<checkbox-group @change="checkboxChange">
<view class="acea-row row-middle" v-for="(item, index) in userLists" :key="index">
<!-- #ifndef MP -->
<checkbox class="checkbox" v-if="administer" :value="(item.uid).toString()" :checked="item.checked"
color="#ffffff" backgroundColor="#ffffff"
activeBackgroundColor="#2A7EFB" activeBorderColor="#2A7EFB"/>
<!-- #endif -->
<!-- #ifdef MP -->
<checkbox class="checkbox" v-if="administer" :value="item.uid" :checked="item.checked" color="#ffffff" />
<!-- #endif -->
<view class="item acea-row row-center-wrapper" @click="goDetails(item)">
<view class="pictrue">
<image :src="item.avatar"></image>
</view>
<view class="text">
<view class="top acea-row row-middle">
<view class="name line1">{{item.nickname}}</view>
<view class="svip acea-row row-center-wrapper" v-if="item.isMember == 1">SVIP</view>
<view class="vip acea-row row-center-wrapper" v-if="item.level_status == 1 && item.level_grade">
<text class="iconfont icon-huiyuandengji"></text>
V{{item.level_grade}}
</view>
</view>
<view class="phone">{{item.phone}}</view>
<view class="info acea-row row-middle">
<view>积分<text>{{item.integral}}</text></view>
<view>余额<text>{{item.now_money}}</text></view>
</view>
</view>
<view v-if="!administer" class="iconfont icon-ic_more" @click.stop="openDrawer(item)"></view>
</view>
</view>
</checkbox-group>
</view>
<block v-if="userLists.length == 0 && !loading">
<emptyPage title="暂无用户信息~" src="/statics/images/empty-box.gif"></emptyPage>
</block>
<Loading :loaded="loadend" :loading="loading"></Loading>
<view class="footerH"></view>
<view class="footer acea-row row-between-wrapper" v-if="administer">
<checkbox-group @change="checkboxAllChange">
<checkbox value="all" :checked="isAllSelect"
color="#ffffff" backgroundColor="#ffffff"
activeBackgroundColor="#2A7EFB" activeBorderColor="#2A7EFB" />
<text class='checkAll'>全选({{getIds().length}})</text>
</checkbox-group>
<view class="acea-row row-middle">
<view class="bnt acea-row row-center-wrapper">
<picker @change="bindPickerChange" :range="groupArray" range-key="group_name">
<view>修改分组</view>
</picker>
</view>
<view class="bnt acea-row row-center-wrapper" @click="editLabels">添加标签</view>
<view class="bnt acea-row row-center-wrapper" @click="sendCoupon">发送优惠券</view>
</view>
</view>
<base-drawer mode="bottom" :visible="visible" background-color="transparent" mask maskClosable @close="closeDrawer">
<view class="edit-list rd-t-40rpx">
<view class="item" v-for="(item, index) in editList" :key="index" @tap="editInfo(index)">
<picker @change="bindLevelChange" :range="levelArray" range-key="name" v-if="index == 2">
<view class="uni-input">{{item.name}}</view>
</picker>
<text v-else>{{item.name}}</text>
</view>
</view>
</base-drawer>
<view style="height: 110rpx;"></view>
<footer-page></footer-page>
<edit-lable ref="lable" :visible='visibleLable' @closeDrawer='lableCloseDrawer'></edit-lable>
<edit-balance ref="balance" :visible='visibleBalance' :type = 'type' :uid='uid' @closeDrawer='balanceCloseDrawer' @successChange='successChange'></edit-balance>
<member ref="member" :visible='visibleMember' :userInfo='userInfo' @closeDrawer='memberCloseDrawer' @successChange='successChange'></member>
<coupon ref="coupon" :visible='visibleCoupon' :uid='uid' @closeDrawer='couponCloseDrawer'></coupon>
<user-filter ref="filter" :visible='visibleFilter' :groupArray='groupArray' :levelArray='levelArray' @closeDrawer='filterCloseDrawer' @successChange='filterChange'></user-filter>
</view>
</template>
<script>
import Loading from '@/components/Loading/index'
import emptyPage from '@/components/emptyPage.vue';
import footerPage from '../components/footerPage/index.vue';
import editLable from './components/userLable/index.vue';
import editBalance from './components/editBalance/index.vue';
import member from './components/member/index.vue';
import coupon from './components/coupon/index.vue';
import userFilter from './components/filter/index.vue';
import {
getUserList,
getGroupList,
postUserUpdate,
getLevelList
} from "@/api/admin";
export default {
components: {
editLable,
editBalance,
member,
coupon,
userFilter,
footerPage,
emptyPage,
Loading
},
data() {
return {
getHeight: this.$util.getWXStatusHeight(),
editList:[
{
name:'修改积分'
},
{
name:'修改余额'
},
{
name:'修改等级'
},
{
name:'赠送会员'
},
{
name:'赠送优惠券'
},
],
administer:0,
isAllSelect: false,
userLists:[],
visible:false,
visibleLable:false, //标签是否显示
loadTitle: '加载更多',
loading: false,
loadend: false,
limit: 20,
page: 1,
keyword:'', //搜索字段
visibleBalance: false,
type: 0,
visibleMember:false,
visibleCoupon:false,
uid: 0,
groupArray:[],
userInfo:{},
levelArray:[],
visibleFilter:false,
filterData:{
labelIds:'',
groupIds:0,
levelIds:0
}
}
},
onShow() {
},
onLoad() {
this.userList();
this.groupList();
},
methods: {
goarrow(){
uni.navigateBack()
},
filterChange(data){
this.visibleFilter = false
this.filterData = data
this.init();
},
filterCloseDrawer(){
this.visibleFilter = false
},
filterTap(){
this.visibleFilter = true;
this.$refs.filter.productLabel();
this.levelList();
// this.groupList();
},
sendCoupon(){
if(!this.getIds().length){
this.$util.Tips({
title: '请选择商品'
});
return
}
this.visibleCoupon = true;
this.$refs.coupon.userCoupon(1,this.getIds());
},
levelList(){
getLevelList().then(res=>{
this.levelArray = res.data.list;
}).catch(err=>{
this.$util.Tips({
title: err
});
})
},
groupList(){
getGroupList().then(res=>{
this.groupArray = res.data;
}).catch(err=>{
this.$util.Tips({
title: err
});
})
},
userUpdate(data){
postUserUpdate(data).then(res=>{
this.$util.Tips({
title: res.msg
});
}).catch(err=>{
this.$util.Tips({
title: err
});
})
},
bindLevelChange(e){
this.userUpdate({
type:1,
uid:this.uid,
level:this.levelArray[e.detail.value].id
})
this.init();
},
bindPickerChange(e){
if(!this.getIds().length){
this.$util.Tips({
title: '请选择商品'
});
return
}
this.userUpdate({
type:4,
uid:this.getIds(),
group_id:this.groupArray[e.detail.value].id
})
},
goDetails(item){
uni.navigateTo({
url: '/pages/admin/user/index?uid='+item.uid
})
},
couponCloseDrawer(){
this.visibleCoupon = false
},
memberCloseDrawer(){
this.visibleMember = false
},
balanceCloseDrawer(){
this.visibleBalance = false
},
successChange(){
this.visibleMember = false
this.visibleBalance = false
this.init();
},
//批量编辑标签
editLabels(){
if(!this.getIds().length){
this.$util.Tips({
title: '请选择商品'
});
return
}
this.visibleLable = true
this.visible = false
this.$refs.lable.productLabel({},1,this.getIds());
},
//批量获取id集合
getIds(){
let ids = []
this.userLists.forEach(item=>{
if(item.checked){
ids.push(item.uid)
}
})
ids.slice(0, 100)
return ids
},
init(){
this.userLists = [];
this.page = 1;
this.loadend = false;
this.loading = false;
this.userList();
},
searchSubmit(){
this.init();
},
userList(){
let that = this;
if (this.loading) return;
if (this.loadend) return;
that.loading = true;
that.loadTitle = "";
getUserList({
page: that.page,
limit: that.limit,
nickname: that.keyword,
group_id: that.filterData.groupIds,
level: that.filterData.levelIds,
label_id: that.filterData.labelIds
}).then(res=>{
let userLists = res.data.list;
userLists.forEach(item => {
item.checked = false;
})
this.isAllSelect = false
let loadend = userLists.length < that.limit;
that.userLists = that.$util.SplitArray(userLists, that.userLists);
that.$set(that, 'userLists', that.userLists);
that.loadend = loadend;
that.loadTitle = loadend ? '没有更多内容啦~' : '加载更多';
that.page = that.page + 1;
that.loading = false;
}).catch(err=>{
that.loading = false;
that.loadTitle = "加载更多";
})
},
editInfo(index){
switch (index) {
case 0:
this.visible = false
this.visibleBalance = true
this.type = 0
break;
case 1:
this.visible = false
this.visibleBalance = true
this.type = 1
break;
case 2:
this.visible = false
break;
case 3:
this.visible = false
this.visibleMember = true
break;
case 4:
this.visible = false
this.visibleCoupon = true
break;
}
},
lableCloseDrawer(){
this.visibleLable = false
},
openDrawer(item){
this.visible = true
this.uid = item.uid
this.userInfo = item;
this.levelList();
this.$refs.coupon.userCoupon(0);
},
closeDrawer(){
this.visible = false
},
manageTap() {
this.administer = !this.administer;
},
checkboxChange(event) {
let idList = event.detail.value;
this.userLists.forEach((item) => {
if (idList.indexOf(item.uid + '') !== -1) {
item.checked = true;
} else {
item.checked = false;
}
})
if (idList.length == this.userLists.length) {
this.isAllSelect = true;
} else {
this.isAllSelect = false;
}
},
forGoods(val) {
let that = this;
if (!that.userLists.length) return
that.userLists.forEach((item) => {
if (val) {
item.checked = true;
} else {
item.checked = false;
}
})
},
checkboxAllChange(event) {
let value = event.detail.value;
if (value.length) {
if(this.userLists.length>100){
this.$util.Tips({
title: '每次最多只提交100条数据'
});
}
this.isAllSelect = true;
this.forGoods(1)
} else {
this.isAllSelect = false;
this.forGoods(0)
}
},
},
onReachBottom(){
this.userList();
}
}
</script>
<style lang="scss" scoped>
/deep/checkbox .wx-checkbox-input.wx-checkbox-input-checked {
border: 1px solid $primary-admin !important;
background-color: $primary-admin !important;
}
/deep/checkbox:not([disabled]) .uni-checkbox-input:hover {
border-color: #d1d1d1 !important;
}
/deep/.empty-page{
margin-top: 20rpx;
}
.accountTitle{
background: #F5F5F5;
position: fixed;
left:0;
top:0;
width: 100%;
z-index: 99;
padding-bottom: 6rpx;
.sysTitle{
width: 100%;
position: relative;
font-weight: 500;
color: #333333;
font-size: 30rpx;
.iconfont{
position: absolute;
font-size: 42rpx;
left:20rpx;
width: 60rpx;
font-weight: 500;
}
}
}
.user-list{
padding: 20rpx 20rpx 0 20rpx;
.searchCon{
.search{
width: 526rpx;
height: 72rpx;
background: #FFFFFF;
border-radius: 50rpx;
padding: 0 34rpx;
&.on{
width: 618rpx;
}
.iconfont{
color: #999;
font-size: 32rpx;
margin-right: 16rpx;
}
.inputs{
font-size: 28rpx;
width: 100%;
height: 100%;
flex: 1;
}
.placeholder{
color: #ccc;
}
}
.edit{
width: 72rpx;
height: 72rpx;
background: #FFFFFF;
border-radius: 50%;
.iconfont {
color: #666;
font-size: 36rpx;
}
}
}
.list{
padding-bottom: 20rpx;
margin-top: 32rpx;
/deep/uni-checkbox .uni-checkbox-input{
margin: 0 20rpx 20rpx 0;
}
/deep/wx-checkbox .wx-checkbox-input{
margin: 0 20rpx 20rpx 0;
}
.item {
width: 100%;
background-color: #fff;
padding: 30rpx 24rpx;
box-sizing: border-box;
margin-bottom: 20rpx;
border-radius: 24rpx;
position: relative;
flex: 1;
.icon-ic_more{
position: absolute;
right: 20rpx;
top: 30rpx;
color: #999;
font-size: 40rpx;
}
.pictrue{
width: 96rpx;
height: 96rpx;
margin-right: 24rpx;
image {
width: 100%;
height: 100%;
border-radius: 50%;
}
}
.text{
flex: 1;
overflow: hidden;
.top{
.name {
max-width: 230rpx;
font-size: 28rpx;
font-weight: 600;
color: #333333;
font-family: PingFang SC, PingFang SC;
}
.svip {
width: 56rpx;
height: 26rpx;
background: linear-gradient(270deg, #484643 0%, #1F1B17 100%);
border-radius: 100rpx;
font-size: 18rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 600;
color: #FDDAA4;
margin-left: 10rpx;
}
.vip{
width: 64rpx;
// height: 26rpx;
background: #FEF0D9;
border: 1px solid #FACC7D;
border-radius: 50rpx;
font-size: 18rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
color: #DFA541;
margin-left: 10rpx;
.iconfont {
font-size: 20rpx;
margin-right: 4rpx;
}
}
}
.phone{
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #999999;
margin-top: 4rpx;
}
.info {
font-size: 24rpx;
font-weight: 400;
color: #999999;
margin-top: 4rpx;
text {
color: #333333;
margin-right: 28rpx;
}
}
}
.bottom{
margin-top: 26rpx;
.bnt{
width: 144rpx;
height: 56rpx;
border:1px solid #ccc;
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #333333;
border-radius: 50rpx;
&~.bnt{
margin-left: 16rpx;
}
&.on{
border-color: #2A7EFB;
background-color: #2A7EFB;
color: #fff;
}
&.up{
border-color: #FF7E00;
color: #FF7E00;
}
}
}
}
}
.footerH {
height: calc(constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
height: calc(env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
}
.footer {
box-sizing: border-box;
padding: 0 32rpx;
width: 100%;
height: 96rpx;
background-color: #fff;
position: fixed;
bottom: 0;
z-index: 30;
height: calc(96rpx + constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
height: calc(96rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
padding-bottom: constant(safe-area-inset-bottom); ///兼容 IOS<11.2/
padding-bottom: env(safe-area-inset-bottom); ///兼容 IOS>11.2/
width: 100%;
left: 0;
/deep/uni-checkbox .uni-checkbox-input{
margin-bottom: 6rpx;
}
.bnt {
width: 160rpx;
height: 64rpx;
border-radius: 50rpx;
border: 1rpx solid #2A7EFB;
color: #2A7EFB;
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
&~.bnt{
margin-left: 16rpx;
}
}
}
.edit-list{
background-color: #fff;
padding: 45rpx 34rpx;
.item{
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #333333;
font-size: 32rpx;
text-align: center;
height: 106rpx;
line-height: 106rpx;
}
}
}
</style>