<template>
|
<view class="u-page">
|
<view class="u-demo-block-2">
|
<u-radio-group v-model="curSubAccount" placement="column">
|
<u-cell-group>
|
<u-cell v-for="(item, index) in list" :key="index" @click="handleSwitchSubAccount(item)">
|
<view slot="icon" class="f10">
|
<!-- <image src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/56/56d1a93862a4470e9b4481b970fd6fc9子账号管理.png" class="image-icon"></image> -->
|
<u-radio :key="index"
|
:name="item.id" @change="handleSwitchSubAccount(item)"
|
>
|
<u-icon name="account"></u-icon>
|
</u-radio>
|
|
</view>
|
<view slot="title" class="cell-title">{{ item.name }} {{ item.contact }} {{ item.phone }}</view>
|
<!-- <view slot="label" class="cell-lable">{{ item.name2 }} {{ item.tel }}</view> -->
|
<view slot="value" class="cell-value">
|
|
</view>
|
</u-cell>
|
</u-cell-group>
|
</u-radio-group>
|
|
</view>
|
|
</view>
|
</template>
|
|
<script>
|
export default {
|
data() {
|
return {
|
curSubAccount:'',
|
listApi:'/api/supplierSub/sub/all',
|
};
|
},
|
onLoad(options) {
|
this.getCurrentSubAccount()
|
},
|
onShow() {
|
this.getList();
|
},
|
async onPullDownRefresh() {
|
this.getList();
|
},
|
methods: {
|
|
getCurrentSubAccount(){
|
const currentInfo = this.$store.state.currentInfo
|
this.curSubAccount=currentInfo?.supplierSub?.id
|
},
|
|
async handleSwitchSubAccount(item) {
|
|
let res=await this.$store.dispatch('getSwitchSubAccount',item);
|
if (res && res.code == 0) {
|
const data=res.data
|
if(data&&data.supplierSub&&data.supplierSub.id){
|
this.curSubAccount=data?.supplierSub?.id
|
uni.$u.toast('切换成功!');
|
}
|
uni.navigateBack({ delta: 1 })
|
} else {
|
uni.$u.toast('切换失败!');
|
}
|
|
},
|
|
}
|
};
|
</script>
|
|
<style lang="scss">
|
.u-page {
|
font-size: 14px;
|
|
.image-icon {
|
width: 30rpx;
|
height: 30rpx;
|
}
|
|
.u-button--plain.data-v-3bf2dba7 {
|
background-color: #00BCD4 !important;
|
}
|
|
.u-button--plain.u-button--primary.data-v-3bf2dba7 {
|
color: #FFFFFF;
|
}
|
|
.u-button--primary.data-v-3bf2dba7 {
|
color: #fff;
|
border-color: #00BCD4 !important;
|
border-width: 1px;
|
border-style: solid;
|
border-radius: 10rpx;
|
width: 200rpx;
|
}
|
|
.u-demo-block {
|
padding: 10rpx;
|
background-color: #FFFFFF;
|
border-radius: 50rpx;
|
background-color: #00AF68;
|
margin: 20rpx;
|
|
.tixian {
|
margin-top: 30rpx;
|
margin-bottom: 30rpx;
|
}
|
}
|
|
.u-demo-block-2 {
|
margin: 30rpx;
|
padding: 10rpx;
|
background-color: #FFFFFF;
|
border-radius: 10rpx;
|
}
|
|
.title {
|
text-align: center;
|
font-size: 30rpx;
|
color: #909399;
|
margin: 10rpx;
|
}
|
|
.grid-text-white {
|
color: white;
|
}
|
|
.grid-text {
|
font-size: 14px;
|
color: #909399;
|
padding: 10rpx 0 20rpx 0rpx;
|
/* #ifndef APP-PLUS */
|
box-sizing: border-box;
|
/* #endif */
|
}
|
|
.statis_val {
|
font-size: 16px;
|
color: black;
|
// font-weight: bold;
|
}
|
|
.margin-10 {
|
margin: 10rpx;
|
}
|
|
.cell-title {
|
font-size: 12px;
|
}
|
|
.cell-lable {
|
font-size: 10px;
|
color: gray;
|
}
|
|
.cell-value {
|
display: flex;
|
justify-content: space-between;
|
width: 50px;
|
}
|
}
|
</style>
|