Commit ed247072 authored by 郭欢's avatar 郭欢

'修改,'

parent bc65a5c9
This diff is collapsed.
export default {
purchase: [
{
name: 'purchase_plan',
title: '采购计划',
icon: require('@assets/images/index/icon1-plan.png'),
page: 'purchasePlan',
num: 0
},
{
name: 'purchase_order',
title: '采购订单',
icon: require('@assets/images/index/icon1-order.png'),
page: 'purchaseOrder',
num: 0
},
{
name: 'purchase_ruku',
title: '入库订单',
icon: require('@assets/images/index/icon1-ruku.png'),
page: 'purchaseEntry',
num: 0
},
{
name: 'purchase_goods',
title: '入库商品',
icon: require('@assets/images/index/icon1-goods.png'),
page: 'goodsList',
params: 'entry',
num: 0
}
],
sale: [
{
name: 'purchase_plan',
title: '销售订单',
icon: require('@assets/images/index/icon2-sale-order.png'),
page: 'saleOrder',
num: 0
},
{
name: 'purchase_order',
title: '销售商品',
icon: require('@assets/images/index/icon2-sale-goods.png'),
page: 'saleGoodsList',
params: 'sale',
num: 0
},
{
name: 'purchase_ruku',
title: '出库订单',
icon: require('@assets/images/index/icon2-chuku.png'),
page: 'saleOutOrder',
num: 0
},
{
name: 'purchase_goods',
title: '出库商品',
icon: require('@assets/images/index/icon2-chuku-goods.png'),
page: 'saleOutGoodsList',
params: 'out',
num: 0
}
],
archives: [
{
name: 'purchase_plan',
title: '调价清单',
icon: require('@assets/images/index/icon3-adjust-price.png'),
page: 'adjustPrice',
num: 0
},
{
name: 'purchase_order',
title: '调价商品',
icon: require('@assets/images/index/icon3-adjust-goods.png'),
page: 'adjustPriceGoods',
num: 0
},
{
name: 'purchase_ruku',
title: '调库清单',
icon: require('@assets/images/index/icon3-stock.png'),
page: 'adjustStock',
num: 0
},
{
name: 'purchase_goods',
title: '调库商品',
icon: require('@assets/images/index/icon3-goods.png'),
page: 'adjustStockGoods',
num: 0
}
],
devops: [
{
name: 'purchase_plan',
title: '商品档案',
icon: require('@assets/images/index/icon4-goods-list.png'),
page: 'goods',
num: 0
},
{
name: 'purchase_order',
title: '采购退货',
icon: require('@assets/images/index/icon4-purchase.png'),
page: 'purchaseReturn',
num: 0
},
// todo: 采购换货 -- 首页num需要修改
// {
// name: 'purchase_ruku',
// title: '采购换货',
// icon: require('@assets/images/index/icon4-exchange.png'),
// page: 'purchaseExchange',
// num: 0
// },
{
name: 'purchase_ruku',
title: '销售退货',
icon: require('@assets/images/index/icon4-sale.png'),
page: 'saleReturn',
num: 0
},
{
name: 'purchase_goods',
title: '赠送入库',
icon: require('@assets/images/index/icon4-free.png'),
page: 'freeList',
num: 0
},
{
name: 'purchase_goods',
title: '协助订单',
icon: require('@assets/images/index/icon4-goods.png'),
page: 'assistList',
num: 0
// tips: true
}
]
}
// 机构信息
export const SELFSHOP = 'self_shop'
// 采购计划的购物车
export const PURCHASE_CART = 'PURCHASE_CART'
// 添加采购计划商品页面数据
export const PURCHASE_DATA = 'PURCHASE_DATA'
// 采购计划、采购订单列表、销售列表、赠送入库列表刷新
export const PURCHASE_LIST = 'PURCHASE_LIST'
export const REFRESH_LIST = 'REFRESH_LIST'
// 详情页刷新
export const DETAIL_REFRESH = 'DETAIL_REFRESH'
// 采购退货刷新
export const PURCHASE_RETURN_REFRESH = 'PURCHASE_RETURN_REFRESH'
// 销售退货刷新
export const SALE_RETURN_REFRESH = 'SALE_RETURN_REFRESH'
// 选择商户
export const CHOOSE_SHOP = 'CHOOSE_SHOP'
// 选择添加的商品
export const CHOOSE_ADD_GOODS = 'CHOOSE_ADD_GOODS'
// 添加赠送入库刷新
export const ADD_FREE_REFRESH = 'ADD_FREE_REFRESH'
// 个人中心刷新(机构切换刷新)
export const MY_REFRESH = 'MY_REFRESH'
// 首页刷新(绑定机构)
export const INDEX_REFRESH = 'INDEX_REFRESH'
// export const SELFSHOP = 'self_shop'
/**
* 设置缓存 getLocalStorage
* @param {*} key key
......
<template>
<div>
<!-- 筛选 -->
<div class="condition-header" :class="curType.length < 3 ? 'condition-header-one' : '' ">
<div class="header cont-list">{{selfShop ? selfShop.text : '--'}}</div>
<div class="condition-cont cont-list" :class="curType.length < 3 ? 'condition-cont-one' : '' " v-if="curType.length">
<!-- 审核状态 -->
<template v-for="(item, index) in curType">
<p class="btn-cont" @click="showPicker=true" v-if="item == 'status'" :key='index'>
<span class="one-line item-condition-cont">{{cur_audit_status.text}}</span>
<span class="iconfont icon-arrow-down"></span>
</p>
<!-- 其它状态 -->
<p class="btn-cont" @click="otherShow=true" v-if="item == 'otherstatus'" :key='index'>
<span class="one-line item-condition-cont">{{cur_other_status.text}}</span>
<span class="iconfont icon-arrow-down"></span>
</p>
<!-- 供应商审核 (采购:采购订单、入库订单) -->
<p class="btn-cont" @click="supplierShow=true" v-if="item == 'supplier'" :key="index">
<span class="one-line item-condition-cont">{{cursupplier.text ? cursupplier.text : '供货商选择'}}</span>
<span class="iconfont icon-arrow-down"></span>
</p>
<!-- 商户 -->
<p class="btn-cont time-btn" @click="goMerchant" v-if="item == 'shop'" :key="index">
<span class="one-line item-condition-cont">{{storeDetail ? storeDetail.shop_name : '全部商户'}}</span>
<span class="iconfont icon-arrow-down"></span>
</p>
<!-- 商品 -->
<p class="btn-cont time-btn" @click="goGoods" v-if="item == 'goods'" :key="index">
<span class="one-line item-condition-cont">{{goodsDetail ? goodsDetail.title : '全部商品'}}</span>
<span class="iconfont icon-arrow-down"></span>
</p>
<!-- 日期 -->
<p class="btn-cont time-btn" @click="showDate" v-if="item == 'date'" :key="index">
<span class="one-line item-condition-cont">{{cur_date ? cur_date : '日期'}}</span>
<span class="iconfont icon-arrow-down"></span>
</p>
</template>
</div>
</div>
<!-- 选择审核状态 -->
<van-popup v-model="showPicker" round position="bottom">
<van-picker
title="状态"
show-toolbar
:default-index="cur_audit_index"
:columns="auditStatusList"
@confirm="chooseAuditStatus"
@cancel="showPicker = false"
/>
</van-popup>
<van-popup v-model="otherShow" round position="bottom">
<van-picker
title="状态"
show-toolbar
:default-index="cur_other_index"
:columns="otherStatusList"
@confirm="chooseOtherStatus"
@cancel="otherShow = false"
/>
</van-popup>
<!-- 选择时间 -->
<van-calendar
v-model="dateShow"
type="range"
:max-date="curday"
:min-date="minday"
:default-date="defaultday"
@confirm="chooseDate"
:allow-same-day="true"
ref="dateview"
color="#325BEF"
:poppable="true"
>
</van-calendar>
<!-- 选择供应商 -->
<van-popup v-model="supplierShow" round position="bottom">
<van-picker
title="供应商"
show-toolbar
:default-index="cur_sup_index"
:columns="supplier"
@confirm="chooseSupplier"
@cancel="supplierShow = false"
/>
</van-popup>
</div>
</template>
<script>
import { SELFSHOP, getLocalStorage } from '@assets/js/self.js'
export default {
name: 'myCondition',
props: {
curType: {
type: Array,
default: () => ['date']
},
// 审核状态信息
auditStatusList: { // 审核状态列表
type: Array,
default: () => [{ key: 1, text: '待审核状态' }, { key: 2, text: '全部' }]
},
cur_audit_status: { // 当前选中的审核状态
type: Object,
value: { key: 1, text: '待审核状态' }
},
// 供应商
supplier: { // 供应商列表
type: Array,
value: [{ id: 0, text: '全部供应商' }]
},
cursupplier: { // 当前选中的供应商
type: Object,
value: { id: 0, text: '全部供应商' }
},
// 其它状态
otherStatusList: {
type: Array,
default: () => [{ key: 1, text: '已下单/已接单' }, { key: 2, text: '全部' }]
},
cur_other_status: {
type: Object,
value: { key: 1, text: '已下单/已接单' }
},
// 商户
storeDetail: {
type: Object,
value: null
},
// 商品
goodsDetail: {
type: Object,
value: null
},
cur_date: {
type: String,
value: ''
}
},
computed: {
cur_audit_index: (vm) => {
return 0
// return vm.auditStatusList.findIndex(item => item.key === vm.cur_audit_status.key)
},
cur_sup_index: (vm) => {
return 0
// return vm.supplier.findIndex(item => item.key === vm.cursupplier.key)
},
cur_other_index: (vm) => {
return vm.otherStatusList.findIndex(item => item.key === 1)
}
},
data () {
return {
selfShop: null,
// curIndex: 0,
// 审核状态
showPicker: false,
// 供应商
supplierShow: false,
// 其它
otherShow: false,
// 日期
dateShow: false,
curday: new Date(),
minday: new Date('2021-06-01'),
defaultday: new Date()
}
},
methods: {
// 选择审核状态
chooseAuditStatus (value, index) {
// this.curIndex = index
this.showPicker = false
this.$emit('chooseAuditStatus', value, index)
},
// 选择其它状态
chooseOtherStatus (value, index) {
// this.curIndex = index
this.otherShow = false
this.$emit('chooseOtherStatus', value, index)
},
// 选择供应商
chooseSupplier (value, index) {
// this.cur_sup_index = index
this.supplierShow = false
this.$emit('chooseSupplier', value, index)
},
// 日期
showDate () {
this.$refs.dateview.reset()
this.dateShow = true
},
chooseDate (date) {
const [start, end] = date
this.dateShow = false
const curStatus = this.curType.length > 2
const curdate = `${this.formatDate(start, curStatus)} ~ ${this.formatDate(end, curStatus)}`
var formatDate = `${this.formatDate(start)},${this.formatDate(end)}`
this.$emit('changeDate', {
cur_date: curdate,
format_date: formatDate
})
},
formatDate (date, curStatus = false) {
var d = new Date(date)
var month = '' + (d.getMonth() + 1)
var day = '' + d.getDate()
var year = d.getFullYear()
if (month.length < 2) month = '0' + month
if (day.length < 2) day = '0' + day
if (curStatus) {
return [month, day].join('-')
}
return [year, month, day].join('-')
},
// 商户
goMerchant () {
// chooseShop
this.$router.push({
name: 'searchShop'
})
},
// 商品
goGoods () {
// changeGoods
const idlist = []
if (this.goodsDetail) {
idlist.push(this.goodsDetail.id)
}
this.$router.push({
name: 'addGoodsSearch',
params: {
ids: idlist,
type: 2 // 选择商品
}
})
}
},
mounted () {
this.selfShop = getLocalStorage(SELFSHOP) ? getLocalStorage(SELFSHOP) : null
this.showPicker = false
this.supplierShow = false
this.otherShow = false
this.dateShow = false
this.curday = new Date()
this.minday = new Date('2021-06-01')
this.defaultday = new Date()
}
}
</script>
<style lang="scss" scoped>
@import "@assets/styles/common/module.scss";
</style>
......@@ -8,12 +8,8 @@ import myAxios from './api/index'
import Vant from 'vant'
import 'vant/lib/index.css'
import vConsole from '@/plugins/vconsole.js'
import myCondition from '@/components/common/condition.vue'
import listTips from '@/components/common/listtips.vue'
// Vue.component('chooseDate', chooseDate)
// import chooseDate from '@/components/common/chooseDate.vue'
Vue.component('myCondition', myCondition)
Vue.component('listTips', listTips)
Vue.use(vConsole)
......
<template>
<div class="login-view">
<div class="logo-view">
<img src="@assets/images/login/logo.png" />
<p class="title">机构端</p>
</div>
<!-- <div>
<div class="filed-list">
<img class="icon-img" src="@assets/images/login/tel-icon.png" />
<van-field v-model.trim="tel" type="tel" placeholder="请输入手机号" maxlength="11" />
</div>
<div class="filed-list code-cont">
<img class="icon-img" src="@assets/images/login/code-icon.png" />
<van-field v-model.trim="code" type="text" placeholder="请输入验证码" maxlength="6" />
<div class="code-btn" @click="getCode">{{buttonText}}</div>
</div>
</div> -->
<div class="login-btn" @click="goLogin">重新登录</div>
</div>
</template>
<script>
export default {
name: 'againLogin',
data () {
return {}
},
methods: {
goLogin () {
window.document.location = this.$myApi.WINDOWHREF_INDEX // url-
}
}
// beforeCreate () {
// document.querySelector('body').setAttribute('style', 'background: #ffffff')
// },
// beforeDestroy () {
// document.querySelector('body').removeAttribute('style')
// }
}
</script>
<style lang="scss" scoped>
@import "@assets/styles/login/login.scss";
</style>
<template>
<div class="login-view">
<div class="logo-view">
<img src="@assets/images/login/logo.png" />
<p class="title">绑定机构</p>
</div>
<div>
<div class="filed-list">
<img class="icon-img" src="@assets/images/login/tel-icon.png" />
<van-field v-model.trim="tel" type="tel" placeholder="请输入手机号" maxlength="11" />
</div>
<div class="filed-list code-cont">
<img class="icon-img" src="@assets/images/login/code-icon.png" />
<van-field v-model.trim="code" type="text" placeholder="请输入验证码" maxlength="6" />
<div class="code-btn" @click="getCode">{{buttonText}}</div>
</div>
</div>
<div class="login-btn" @click="goLogin">绑定</div>
</div>
</template>
<script>
import { INDEX_REFRESH, setLocalStorage } from '@assets/js/self.js'
export default {
name: 'login',
data () {
return {
tel: '', // 手机号
code: '', // 验证码
buttonText: '获取验证码',
isSending: false,
seconds: 60,
timer: null
}
},
methods: {
checkData () {
if (this.tel.length !== 11) {
this.$toast('请正确输入手机号码')
return true
}
if (!(/^1(3|4|5|6|7|8|9)\d{9}$/.test(this.tel))) {
this.$toast('请正确输入手机号码------')
return true
}
if (this.code.length !== 6) {
this.$toast('请正确输入验证码')
return true
}
return false
},
getCode () {
if (this.isSending) return
if (this.tel.length !== 11) {
this.$toast('请正确输入手机号码')
return true
}
const curParams = { tel: this.tel }
this.$http.post(this.$myApi.SENDCODE, curParams)
.then(res => {
console.log(res, 'res----------')
this.isSending = true
this.countDown()
})
.catch(() => {})
},
countDown () {
// const _this = this
let seconds = 60
this.timer = setInterval(() => {
seconds--
this.buttonText = `重新获取(${seconds}s)`
if (seconds < 1) {
this.isSending = false
this.buttonText = '重新获取'
clearInterval(this.timer)
}
}, 1000)
},
goLogin () {
if (this.checkData()) return true
const curParams = {
tel: this.tel,
code: this.code
}
this.$http.post(this.$myApi.BINDLOGINTWO, curParams)
.then(res => {
console.log(res)
this.$toast('绑定成功')
setLocalStorage(INDEX_REFRESH, true)
setTimeout(() => {
this.$router.replace({
name: 'home'
})
}, 500)
})
.catch(() => {})
},
fetchData (to, from) {
this.tel = '' // 手机号
this.code = '' // 验证码
this.buttonText = '获取验证码'
this.isSending = false
this.seconds = 60
this.timer = null
}
},
beforeRouteEnter (to, from, next) {
next(vm => {
vm.fetchData(to, from, next)
})
},
beforeRouteLeave (to, from, next) {
if (this.timer) {
clearInterval(this.timer)
}
next()
}
// beforeCreate () {
// document.querySelector('body').setAttribute('style', 'background: #ffffff')
// },
// beforeDestroy () {
// document.querySelector('body').removeAttribute('style')
// }
}
</script>
<style lang="scss" scoped>
@import "@assets/styles/login/login.scss";
</style>
This diff is collapsed.
<template>
<div class="relation-users-page">
<div class="header">
<p class="name">{{supplier ? supplier.shop_name : '--'}}</p>
<p>绑定账号:{{supplier_tel}}</p>
</div>
<div class="list">
<div :class="['list-item', index+1 >= list.length?'no-border':'' ]"
v-for="(item, index) in list" :key="index">
<img :src="item.avatar" v-if="item.avatar"/>
<img src="@assets/images/my/touxiang.png" v-else/>
<p>{{item.nickname}}</p>
</div>
</div>
</div>
</template>
<script>
import { SELFSHOP, getLocalStorage } from '@assets/js/self.js'
import { getInfoRes } from '@assets/js/cart_res.js'
export default {
name: 'relationUsers',
data () {
return {
supplier: null, // 机构信息
supplier_tel: '',
list: [],
isloading: false,
page: 1,
more: true,
locked: false,
limit: 10
}
},
methods: {
// 初始化
initData () {
this.list = []
this.page = 1
this.more = true
this.locked = false
this.isloading = false
},
// 绑定的微信列表
getUserList () {
if (this.more && !this.isloading) {
const curParams = {
page: this.page,
pageSize: this.limit,
shop_id: getLocalStorage(SELFSHOP) ? getLocalStorage(SELFSHOP).id : ''
}
this.isloading = true
this.$http.get(this.$myApi.WXLIST, curParams)
.then(data => {
this.list = this.page === 1 ? data.list : this.list.concat(data.list)
this.page = data.next
this.more = data.more
this.locked = false
this.isloading = false
})
.catch(() => {
this.locked = false
this.isloading = false
})
}
},
// 获取机构信息
getSupplierDetail () {
getInfoRes(this)
},
onRefresh () {
setTimeout(() => {
this.isloading = false
}, 1000)
},
scroll () {
if (
window.pageYOffset /
(document.documentElement.scrollHeight - window.innerHeight) >=
0.7 &&
this.more
) {
if (!this.locked) {
this.locked = true
this.getUserList()
}
}
},
fetchData (to, from) {
this.initData()
this.getUserList()
this.getSupplierDetail()
window.addEventListener('scroll', this.scroll, false)
}
},
beforeRouteEnter (to, from, next) {
next(vm => {
vm.fetchData(to, from, next)
})
},
beforeRouteLeave (to, from, next) {
window.removeEventListener('scroll', this.scroll, false)
next()
}
}
</script>
<style lang="scss" scoped>
@import "@assets/styles/my/relation-users.scss";
</style>
This diff is collapsed.
<template>
<div class="cont" v-if="user">
<div class="top"></div>
<div class="info-item">
<div class="photo">
<img src="@assets/images/my/touxiang.png" alt />
</div>
<div class="btn">工作中</div>
<div class="name">{{user.name}}</div>
<div class="group">{{user.department.name}}</div>
<div class="tel flex-h">
<div class="telNumber">{{user.phone}}</div>
<img src="@assets/images/my/bianji.png" alt />
</div>
<div
class="cont"
v-if="user"
>
<div class="top"></div>
<div class="info-item">
<div class="photo">
<img
src="@assets/images/my/touxiang.png"
alt
/>
</div>
<div class="btn">工作中</div>
<div class="name">{{user.name}}</div>
<div class="group">{{user.department.name}}</div>
<div class="tel flex-h">
<div class="telNumber">{{user.phone}}</div>
<img
src="@assets/images/my/bianji.png"
alt
/>
</div>
</div>
<!-- tabbar -->
<my-tabbar curname="my"></my-tabbar>
</div>
<!-- tabbar -->
<my-tabbar curname="my"></my-tabbar>
</div>
</template>
<script>
......@@ -25,90 +34,90 @@ export default {
components: {
myTabbar
},
data(){
return{
user: '',
}
data () {
return {
user: ''
}
},
created() {
this.getUserInfo()
created () {
this.getUserInfo()
},
methods: {
getUserInfo () {
this.$http.get(this.$myApi.USERINFO)
.then(res => {
this.user = res
getUserInfo () {
this.$http
.get(this.$myApi.USERINFO)
.then((res) => {
this.user = res
})
.catch(() => {})
},
}
}
}
</script>
<style lang="scss" scoped>
.cont {
min-height: 100vh;
background: #f7f7f7;
min-height: 100vh;
background: #f7f7f7;
}
.top {
width: 100%;
height: 2.82rem;
background: #0054ff;
position: relative;
width: 100%;
height: 2.82rem;
background: #0054ff;
position: relative;
}
.info-item {
width: 7.5rem;
height: 8.05rem;
background: #ffffff;
border-radius: 0.28rem 0.28rem 0rem 0rem;
position: absolute;
top: 2.5rem;
left: 0;
text-align: center;
width: 7.5rem;
height: 8.05rem;
background: #ffffff;
border-radius: 0.28rem 0.28rem 0rem 0rem;
position: absolute;
top: 2.5rem;
left: 0;
text-align: center;
}
.photo {
width: 1.7rem;
height: 1.7rem;
border-radius: 50%;
background: #f1f1f1;
position: absolute;
top: -1rem;
left: 2.9rem;
width: 1.7rem;
height: 1.7rem;
border-radius: 50%;
background: #f1f1f1;
position: absolute;
top: -1rem;
left: 2.9rem;
}
.btn {
width: 1.38rem;
height: 0.48rem;
background: #0054ff;
border-radius: 0.24rem;
color: #fff;
text-align: center;
line-height: 0.48rem;
margin: 1.13rem auto 0.59rem;
width: 1.38rem;
height: 0.48rem;
background: #0054ff;
border-radius: 0.24rem;
color: #fff;
text-align: center;
line-height: 0.48rem;
margin: 1.13rem auto 0.59rem;
}
.name {
color: #000000;
font-size: 0.38rem;
margin-bottom: 0.27rem;
font-weight: bold;
color: #000000;
font-size: 0.38rem;
margin-bottom: 0.27rem;
font-weight: bold;
}
.group {
color: #000000;
font-size: 0.3rem;
margin-bottom: 0.48rem;
color: #000000;
font-size: 0.3rem;
margin-bottom: 0.48rem;
}
.tel {
width: 2rem;
height: 0.28rem;
margin: 0 auto;
width: 2rem;
height: 0.28rem;
margin: 0 auto;
}
.tel .telNumber {
color: #000000;
font-size: 0.3rem;
margin-right: 0.2rem;
color: #000000;
font-size: 0.3rem;
margin-right: 0.2rem;
}
.tel img {
width: 0.28rem;
height: 0.28rem;
width: 0.28rem;
height: 0.28rem;
}
</style>
\ No newline at end of file
</style>
......@@ -19,4 +19,4 @@ export default {
<style lang="scss" scoped>
@import "@assets/styles/tabbar/modifyPhone.scss";
</style>
\ No newline at end of file
</style>
<template>
<div class="my-page">
<div class="my-header">
<img :src="userInfo.avatar" class="user-img" v-if="userInfo && userInfo.avatar" />
<img src="@assets/images/my/touxiang.png" class="user-img" v-else />
<div class="left-cont">
<p class="user-name one-line">{{userInfo.wx_nick_name}}</p>
<p class="">绑定账号:{{supplier_tel}}</p>
</div>
</div>
<div class="navlist">
<div class="list-item">
<div class="icon"><span class="iconfont icon-bangding1"></span></div>
<div class="content" @click="goRelation">
<span class="title">绑定微信</span>
<span class="iconfont icon-youhuaxiangyougengduo"></span>
</div>
</div>
<div class="list-item">
<div class="icon"><span class="iconfont icon-bangding2"></span></div>
<div class="content" @click="addRelation">
<span class="title">绑定机构</span>
<span class="iconfont icon-youhuaxiangyougengduo"></span>
</div>
</div>
<div class="list-item no-border">
<div class="icon"><span class="iconfont icon-dingyue1"></span></div>
<div class="content" @click="codeShow=true">
<span class="title">订阅通知</span>
<span class="iconfont icon-youhuaxiangyougengduo"></span>
</div>
</div>
</div>
<!-- 退出登录 -->
<div class="login-out-btn" @click="logout_click">退出当前机构</div>
<van-popup v-model="codeShow">
<img src="@assets/images/my/qrcode.jpg"/>
</van-popup>
<!-- tabbar -->
<my-tabbar curname="my"></my-tabbar>
</div>
</template>
<script>
import myTabbar from '@components/common/tabbar.vue'
import { getInfoRes } from '@assets/js/cart_res.js'
import { MY_REFRESH, INDEX_REFRESH, getLocalStorage, setLocalStorage, removeLocalStorage } from '@assets/js/self.js'
export default {
name: 'my',
components: {
myTabbar
},
data () {
return {
isclick: false,
codeShow: false,
userInfo: {},
supplier_tel: ''
}
},
methods: {
goRelation () {
this.$router.push({
name: 'relationUsers'
})
},
addRelation () {
this.$router.push({
name: 'addRelation'
})
},
getUserInfo () {
getInfoRes(this, (data) => {
this.userInfo = data
removeLocalStorage(MY_REFRESH)
})
},
logout () {
this.isclick = true
// 发起网络请求
this.$http.post(this.$myApi.LOGOUT)
.then(res => {
this.isclick = false
// 清除缓存
this.userInfo = {}
this.supplier_tel = ''
window.localStorage.clear()
setLocalStorage(INDEX_REFRESH, true)
this.$router.push({
name: 'againLogin'
})
})
.catch(() => {
this.isclick = false
})
},
logout_click () {
if (this.isclick) return
this.$dialog.confirm({
title: '提示',
message: '确定要退出当前账号吗',
theme: 'round-button',
confirmButtonColor: '#325BEF',
cancelButtonColor: '#FFFFFF',
className: 'self-dialog'
})
.then(() => {
this.logout()
})
.catch(() => {})
},
fetchData (to, from) {
this.isclick = false
if (getLocalStorage(MY_REFRESH)) {
this.getUserInfo()
}
}
},
mounted () {
this.getUserInfo()
},
beforeRouteEnter (to, from, next) {
next(vm => {
vm.fetchData()
})
}
}
</script>
<style lang="scss" scoped>
@import "@assets/styles/tabbar/my.scss";
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment