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>