Merge branch 'dev' into test

This commit is contained in:
lifizer
2025-04-16 10:19:55 +08:00
3 changed files with 427 additions and 302 deletions
+343 -284
View File
@@ -10,293 +10,308 @@
title="购物车" title="购物车"
fixed fixed
/> />
<view v-if="isLoad" :style="{paddingBottom: list.length > 0 ? '120rpx;' : ''}" class="list-wrap"> <view
<view class="v12-justify-between v12-px-2"> v-if="isLoad"
<view class="v12-font-28 v12-dark-text v12-align-center" @click="show = true"> :style="{paddingBottom: list.length > 0 ? '120rpx;' : ''}"
<image :src="webUrl+'/orderIcon/map.png'" style="width: 30rpx;height: 30rpx" class="v12-mr-1"/> class="list-wrap"
<text>{{ addressInfo.city }}</text> >
<view class="v12-ml-1" style="margin-top: 2px;"> <view v-if="isNoLogin" class="no-login-wrap">
<u-icon name="arrow-down"></u-icon> <image
:src="webUrl + '/page/my/nologin.png'"
class="img"
/>
<view class="txt">您还未登录</view>
<view class="desc">请注册/登录账户后重试</view>
<view class="btn">去登录</view>
</view>
<view v-else>
<view class="v12-justify-between v12-px-2">
<view class="v12-font-28 v12-dark-text v12-align-center" @click="show = true">
<image :src="webUrl+'/orderIcon/map.png'" style="width: 30rpx;height: 30rpx" class="v12-mr-1"/>
<text>{{ addressInfo.city }}</text>
<view class="v12-ml-1" style="margin-top: 2px;">
<u-icon name="arrow-down"></u-icon>
</view>
</view>
<view
v-if="list.length > 0"
class="v12-font-28 v12-font-bold v12-dark-text"
@click="editCart"
>{{ isEdit ? '完成' : '管理' }}</view>
</view>
<view
v-if="list.length === 0"
class="tc v12-my-6"
>
<image
:src="$VUE_APP_RESOURCES_URL + '/orderIcon/购物车2.png'"
style="width: 294rpx;height: 354rpx"
mode="scaleToFill"
/>
</view>
<view v-if="list.length === 0">
<view class="v12-px-14">
<u-divider
text=" · 猜你喜欢 · "
textColor="#333"
lineColor="#333"
textPosition="center"
></u-divider>
</view>
<view class="userlike-wrap">
<view
v-for="(item, index) in userLikeList"
:key="index"
@click="goGoodsCon(item)"
class="v12-radius-20 v12-white v12-mb-3 like-card"
>
<view class="img-wrap">
<image :src="item.image" class="img"></image>
<image
v-if="item.isOldBrand"
:src="webUrl + '/home/old-mark.png'"
class="mark-img"
/>
<image
v-if="item.isLandmarkGoods"
:src="webUrl + '/home/mark-land.png'"
class="mark-img"
/>
<image
v-if="item.isCountyFamous"
:src="webUrl + '/home/qixian-mark.png'"
class="mark-img"
/>
</view>
<view class="info-wrap v12-pa-2">
<view class="more-t v12-font-28 v12-dark-text v12-mb-2">
{{ item.storeName }}
</view>
<view v-if="item.bestContent" class="more-t v12-mb-2 v12-font-24 v12-yellow-text v12-font-weight-300">
{{ item.bestContent }}
</view>
<view class="v12-align-center v12-primary-text v12-font-24 v12-mb-2" v-if="item.couponName">
<view class="v12-primary-border v12-radius-8 v12-px-1">券</view>
<view class="v12-primary-border v12-radius-8 v12-px-1">{{ item.couponName }}</view>
</view>
<view class="v12-justify-between v12-align-center">
<view class="v12-font-40 v12-font-bold v12-primary-text">
<text class="">¥</text>
<text class="price-txt price-red">{{ item.price }}</text>
</view>
<view class="btn">
<image
:src="webUrl + '/home/icon-cart.png'"
class="img-icon"
/>
</view>
</view>
</view>
</view>
</view> </view>
</view> </view>
<view <view
v-if="list.length > 0" v-for="(item, index) in list"
class="v12-font-28 v12-font-bold v12-dark-text" :key="index"
@click="editCart" class="group-item"
>{{ isEdit ? '完成' : '管理' }}</view> >
</view> <view class="flex jc-between">
<view <view class="flex ai-center mer-left">
v-if="list.length === 0" <!-- <CheckboxIcon
class="tc v12-my-6" :default-state="item['state']"
> :mark="[index]"
<image
:src="$VUE_APP_RESOURCES_URL + '/orderIcon/购物车2.png'"
style="width: 294rpx;height: 354rpx"
mode="scaleToFill"
/>
</view>
<view v-if="list.length === 0">
<view class="v12-px-14">
<u-divider
text=" · 猜你喜欢 · "
textColor="#333"
lineColor="#333"
textPosition="center"
></u-divider>
</view>
<view class="userlike-wrap">
<view
v-for="(item, index) in userLikeList"
:key="index"
@click="goGoodsCon(item)"
class="v12-radius-20 v12-white v12-mb-3 like-card"
>
<view class="img-wrap">
<image :src="item.image" class="img"></image>
<image
v-if="item.isOldBrand"
:src="webUrl + '/home/old-mark.png'"
class="mark-img"
/>
<image
v-if="item.isLandmarkGoods"
:src="webUrl + '/home/mark-land.png'"
class="mark-img"
/>
<image
v-if="item.isCountyFamous"
:src="webUrl + '/home/qixian-mark.png'"
class="mark-img"
/>
</view>
<view class="info-wrap v12-pa-2">
<view class="more-t v12-font-28 v12-dark-text v12-mb-2">
{{ item.storeName }}
</view>
<view v-if="item.bestContent" class="more-t v12-mb-2 v12-font-24 v12-yellow-text v12-font-weight-300">
{{ item.bestContent }}
</view>
<view class="v12-align-center v12-primary-text v12-font-24 v12-mb-2" v-if="item.couponName">
<view class="v12-primary-border v12-radius-8 v12-px-1">券</view>
<view class="v12-primary-border v12-radius-8 v12-px-1">{{ item.couponName }}</view>
</view>
<view class="v12-justify-between v12-align-center">
<view class="v12-font-40 v12-font-bold v12-primary-text">
<text class="">¥</text>
<text class="price-txt price-red">{{ item.price }}</text>
</view>
<view class="btn">
<image
:src="webUrl + '/home/icon-cart.png'"
class="img-icon"
/>
</view>
</view>
</view>
</view>
</view>
</view>
<view
v-for="(item, index) in list"
:key="index"
class="group-item"
>
<view class="flex jc-between">
<view class="flex ai-center mer-left">
<!-- <CheckboxIcon
:default-state="item['state']"
:mark="[index]"
style="margin-right: 24rpx;"
@change="onChange"
/> -->
<image
:src="item['merAvatar']"
class="store-cover"
mode="scaleToFill"
/>
<view class="mer-name v12-font-24 v12-font-bold">{{ item['merName'] }}</view>
</view>
<view
class="flex ai-center hotle-btn v12-primary-text"
@click="navToStore(item['hotelId'])"
>
进店逛逛>
<!-- <image
:src="$VUE_APP_RESOURCES_URL + '/20240109234706982937.png'"
style="width: 24rpx;height: 24rpx"
mode="scaleToFill"
/> -->
</view>
</view>
<view class="good-box">
<view
v-for="(good, gIndex) in item['carts']"
:key="gIndex"
class="good flex v12-align-start"
>
<view class="v12-align-center">
<CheckboxIcon
:default-state="good['state']"
:mark="[index, gIndex]"
style="margin-right: 24rpx;" style="margin-right: 24rpx;"
@change="onChange" @change="onChange"
/> /> -->
<image <image
v-if="good['productInfo']['attrInfo']['image']" :src="item['merAvatar']"
:src="good['productInfo']['attrInfo']['image']" class="store-cover"
class="good-cover flex-0 v12-radius-16"
mode="scaleToFill" mode="scaleToFill"
@click="navToGood(good, item)"
/>
<image
v-else
:src="good['productInfo']['image']"
mode="scaleToFill"
class="good-cover flex-0"
@click="navToGood(good, item)"
/> />
<view class="mer-name v12-font-24 v12-font-bold">{{ item['merName'] }}</view>
</view> </view>
<view style="width: 100%"> <view
<view class="flex ai-center hotle-btn v12-primary-text"
class="one-t v12-font-28" @click="navToStore(item['hotelId'])"
@click="navToGood(good, item)" >
>{{ good['productInfo']['storeName'] }}</view> 进店逛逛>
<view <!-- <image
class="sku ai-center" :src="$VUE_APP_RESOURCES_URL + '/20240109234706982937.png'"
@click="changeGoodAttrHandle(good)" style="width: 24rpx;height: 24rpx"
> mode="scaleToFill"
规格:{{ good['productInfo']['attrInfo']['sku'] }} /> -->
</view> </view>
<!-- <view class="v12-mt-1 v12-align-center"> </view>
<view class="v12-primary-text v12-primary-border v12-radius-8 v12-font-24 v12-px-1"> <view class="good-box">
<text>券</text> <view
</view> v-for="(good, gIndex) in item['carts']"
<view class="v12-primary-text v12-primary-border v12-radius-8 v12-font-24 v12-px-1"> :key="gIndex"
<text>满100-30</text> class="good flex v12-align-start"
</view> >
</view> --> <view class="v12-align-center">
<view <CheckboxIcon
class="flex jc-between ai-center" :default-state="good['state']"
style="width: 100%;margin-top: 4rpx;" :mark="[index, gIndex]"
> style="margin-right: 24rpx;"
<view @change="onChange"
class="v12-font-bold v12-primary-text" />
<image
v-if="good['productInfo']['attrInfo']['image']"
:src="good['productInfo']['attrInfo']['image']"
class="good-cover flex-0 v12-radius-16"
mode="scaleToFill"
@click="navToGood(good, item)" @click="navToGood(good, item)"
> />
<text class="bold v12-font-22">¥</text> <image
<text class="v12-font-36">{{ good['truePrice'] }}</text> v-else
</view> :src="good['productInfo']['image']"
<u-number-box mode="scaleToFill"
:value="good.cartNum" class="good-cover flex-0"
:max="good['productInfo']['attrInfo']['stock']" @click="navToGood(good, item)"
integer />
disabledInput
iconStyle="color: #fff"
class="num-step"
@change="e => changeNumHandle(index, gIndex, good, e)"
@overlimit="overlimit"
>
<template v-slot:minus>
<view class="v12-minus-btn v12-font-bold flex jc-center ai-center">
<u-icon name="minus" size="12" color="#FFFFFF"/>
</view>
</template>
<template v-slot:input>
<view class="num-input tc v12-num-input">{{ good['cartNum'] }}</view>
</template>
<template v-slot:plus>
<view class="v12-plus-btn v12-font-bold flex jc-center ai-center v12-primary">
<u-icon name="plus" size="12" color="#FFFFFF"/>
</view>
</template>
</u-number-box>
</view> </view>
</view> <view style="width: 100%">
</view>
</view>
</view>
<view class="footer-fixed flex jc-between ai-center" v-if="list.length > 0">
<view style="margin-left: 32rpx;">
<CheckboxIcon
style="margin-right: 24rpx;"
:default-state="isAll"
:mark="[-1]"
@change="onChange"
/>
<text class="v12-dark-text v12-font-32 v12-font-bold">全选({{ selectCount }})</text>
</view>
<view class="flex ai-center" v-if="!isEdit">
<view >
<text class="v12-font-24 v12-dark-text v12-font-weight-550"> 合计:</text>
<text class="v12-font-22 v12-primary-text v12-font-bold">¥</text>
<text class="v12-font-26 v12-primary-text v12-font-bold">{{ total }}</text>
</view>
<view class="btn-submit v12-mx-3 flex jc-center ai-center v12-radius-80 v12-primary" @click="submit">结算</view>
</view>
<view class="flex ai-center" v-else>
<view @click="clearCart" class="v12-justify-between v12-align-center">
<view style="margin-top: 1px"><u-icon name="trash"></u-icon> </view>
<view>清空</view>
</view>
<view @click="remove" class="btn-submit v12-mx-3 flex jc-center ai-center v12-radius-80 v12-primary">删除</view>
</view>
</view>
<view
v-show="showAttr"
class="good-attr-wrap"
>
<view class="layer" @click="closeAttr" />
<view class="content">
<view class="close">
<text class="iconfont icon-guanbi" @click="closeAttr"></text>
</view>
<view class="good-info">
<view class="name-img">
<image :src="currGoodAttr.image" class="img" />
<view class="name">
<view class="more-t">
{{ currGood.productInfo.storeName }}
</view>
<view class="price">
<text class="txt">¥</text>{{ currGoodAttr.price }}
</view>
</view>
</view>
</view>
<view class="attr-wrap">
<view
v-for="(item, index) in goodAttr.productAttr"
:key="index"
class="item"
>
<view class="title">{{ item.attrName }}</view>
<view class="acea-row row-middle">
<view <view
v-for="(attr, attrIndex) in item.attrValue" class="one-t v12-font-28"
:key="attr" @click="navToGood(good, item)"
:class="{ >{{ good['productInfo']['storeName'] }}</view>
'on': attr.check, <view
'disabled': getAttrItemData(attr.attr).stock === 0 class="sku ai-center"
}" @click="changeGoodAttrHandle(good)"
class="attr"
@click="attrItemClick(attr, attrIndex, index)"
> >
{{ attr.attr }} 规格:{{ good['productInfo']['attrInfo']['sku'] }}
<text </view>
v-if="getAttrItemData(attr.attr).stock === 0" <!-- <view class="v12-mt-1 v12-align-center">
class="tag" <view class="v12-primary-text v12-primary-border v12-radius-8 v12-font-24 v12-px-1">
>缺货</text> <text>券</text>
</view>
<view class="v12-primary-text v12-primary-border v12-radius-8 v12-font-24 v12-px-1">
<text>满100-30</text>
</view>
</view> -->
<view
class="flex jc-between ai-center"
style="width: 100%;margin-top: 4rpx;"
>
<view
class="v12-font-bold v12-primary-text"
@click="navToGood(good, item)"
>
<text class="bold v12-font-22">¥</text>
<text class="v12-font-36">{{ good['truePrice'] }}</text>
</view>
<u-number-box
:value="good.cartNum"
:max="good['productInfo']['attrInfo']['stock']"
integer
disabledInput
iconStyle="color: #fff"
class="num-step"
@change="e => changeNumHandle(index, gIndex, good, e)"
@overlimit="overlimit"
>
<template v-slot:minus>
<view class="v12-minus-btn v12-font-bold flex jc-center ai-center">
<u-icon name="minus" size="12" color="#FFFFFF"/>
</view>
</template>
<template v-slot:input>
<view class="num-input tc v12-num-input">{{ good['cartNum'] }}</view>
</template>
<template v-slot:plus>
<view class="v12-plus-btn v12-font-bold flex jc-center ai-center v12-primary">
<u-icon name="plus" size="12" color="#FFFFFF"/>
</view>
</template>
</u-number-box>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<view class="bottom"> </view>
<view <view class="footer-fixed flex jc-between ai-center" v-if="list.length > 0">
:class="currGoodAttr.stock === 0 ? 'disabled' : ''" <view style="margin-left: 32rpx;">
class="btn" <CheckboxIcon
@click="changeAttrConfirm" style="margin-right: 24rpx;"
> :default-state="isAll"
确认 :mark="[-1]"
@change="onChange"
/>
<text class="v12-dark-text v12-font-32 v12-font-bold">全选({{ selectCount }})</text>
</view>
<view class="flex ai-center" v-if="!isEdit">
<view >
<text class="v12-font-24 v12-dark-text v12-font-weight-550"> 合计:</text>
<text class="v12-font-22 v12-primary-text v12-font-bold">¥</text>
<text class="v12-font-26 v12-primary-text v12-font-bold">{{ total }}</text>
</view>
<view class="btn-submit v12-mx-3 flex jc-center ai-center v12-radius-80 v12-primary" @click="submit">结算</view>
</view>
<view class="flex ai-center" v-else>
<view @click="clearCart" class="v12-justify-between v12-align-center">
<view style="margin-top: 1px"><u-icon name="trash"></u-icon> </view>
<view>清空</view>
</view>
<view @click="remove" class="btn-submit v12-mx-3 flex jc-center ai-center v12-radius-80 v12-primary">删除</view>
</view>
</view>
<view
v-show="showAttr"
class="good-attr-wrap"
>
<view class="layer" @click="closeAttr" />
<view class="content">
<view class="close">
<text class="iconfont icon-guanbi" @click="closeAttr"></text>
</view>
<view class="good-info">
<view class="name-img">
<image :src="currGoodAttr.image" class="img" />
<view class="name">
<view class="more-t">
{{ currGood.productInfo.storeName }}
</view>
<view class="price">
<text class="txt">¥</text>{{ currGoodAttr.price }}
</view>
</view>
</view>
</view>
<view class="attr-wrap">
<view
v-for="(item, index) in goodAttr.productAttr"
:key="index"
class="item"
>
<view class="title">{{ item.attrName }}</view>
<view class="acea-row row-middle">
<view
v-for="(attr, attrIndex) in item.attrValue"
:key="attr"
:class="{
'on': attr.check,
'disabled': getAttrItemData(attr.attr).stock === 0
}"
class="attr"
@click="attrItemClick(attr, attrIndex, index)"
>
{{ attr.attr }}
<text
v-if="getAttrItemData(attr.attr).stock === 0"
class="tag"
>缺货</text>
</view>
</view>
</view>
</view>
<view class="bottom">
<view
:class="currGoodAttr.stock === 0 ? 'disabled' : ''"
class="btn"
@click="changeAttrConfirm"
>
确认
</view>
</view> </view>
</view> </view>
</view> </view>
@@ -374,7 +389,9 @@ export default {
isEdit: false, isEdit: false,
addressList:[], addressList:[],
addressInfo: {}, addressInfo: {},
userLikeList: [] userLikeList: [],
// 是否已登录
isNoLogin: false
} }
}, },
computed: { computed: {
@@ -450,21 +467,26 @@ export default {
}, },
getAddress() { getAddress() {
getAddressList({page: 1, limit: 9999}).then(res => { getAddressList({page: 1, limit: 9999}).then(res => {
const { data = [] } = res if (res.isNoLogin) {
this.addressList = data this.isNoLogin = true
this.addressInfo = data.find(e => e.isDefault == 1) || uni.getStorageSync('cartChooseAddress') || (data && data[0]) || null return
if (!this.addressInfo.id) {
this.addressInfo = data.find(e => e.isDefault == 1) || (data && data[0]) || null
} else { } else {
let isExist = false const { data = [] } = res
data.map(item => { this.addressList = data
if (item.id === this.addressInfo.id) { this.addressInfo = data.find(e => e.isDefault == 1) || uni.getStorageSync('cartChooseAddress') || (data && data[0]) || null
isExist = true if (!this.addressInfo.id) {
}
})
console.log(2, isExist);
if (!isExist) {
this.addressInfo = data.find(e => e.isDefault == 1) || (data && data[0]) || null this.addressInfo = data.find(e => e.isDefault == 1) || (data && data[0]) || null
} else {
let isExist = false
data.map(item => {
if (item.id === this.addressInfo.id) {
isExist = true
}
})
console.log(2, isExist);
if (!isExist) {
this.addressInfo = data.find(e => e.isDefault == 1) || (data && data[0]) || null
}
} }
} }
}) })
@@ -500,6 +522,11 @@ export default {
}, },
async getCart() { async getCart() {
const res = await getCartGroup() const res = await getCartGroup()
if (res.isNoLogin) {
this.isNoLogin = true
this.isLoad = true
return
}
if (res.success) { if (res.success) {
this.isLoad = true this.isLoad = true
const invalid = res.data['invalid'].map(e => { const invalid = res.data['invalid'].map(e => {
@@ -1093,4 +1120,36 @@ view {
overflow: hidden; overflow: hidden;
border-radius: 20rpx; border-radius: 20rpx;
} }
.no-login-wrap {
position: relative;
top: 50%;
text-align: center;
transform: translateY(-50%);
.img {
display: block;
width: 478rpx;
height: 398rpx;
margin: 0 auto;
}
.txt {
font-size: 36rpx;
line-height: 56rpx;
color: #666;
}
.desc {
font-size: 28rpx;
line-height: 56rpx;
color: #999;
}
.btn {
width: 320rpx;
height: 80rpx;
margin: 40rpx auto 0 auto;
border-radius: 40rpx;
line-height: 80rpx;
color: #fff;
font-size: 30rpx;
background-color: #C52733;
}
}
</style> </style>
+74 -15
View File
@@ -1,9 +1,6 @@
<template> <template>
<view class="user user-page tabbar-page"> <view class="user user-page tabbar-page">
<view <view class="acea-row row-column">
v-if="$store.getters.token || userInfo.uid"
class="acea-row row-column"
>
<view class="my-hearder"> <view class="my-hearder">
<view class="my-header-bg"> <view class="my-header-bg">
<image <image
@@ -28,7 +25,10 @@
> >
地标文化特产 地标文化特产
</view> </view>
<view class="info"> <view
v-if="$store.getters.token || userInfo.uid"
class="info"
>
<view class="name-cont"> <view class="name-cont">
<view class="txt flex"> <view class="txt flex">
<view class="txt-cont"> <view class="txt-cont">
@@ -59,21 +59,52 @@
<image :src="userInfo.avatar" class="img" /> <image :src="userInfo.avatar" class="img" />
</view> </view>
</view> </view>
<view
v-else
class="info"
>
<view class="name-cont">
<view class="txt flex">
<view class="txt-cont">
您还未登录
</view>
</view>
<view>
<view class="qrcode qrcode2" @click="toLoginHandle">
<text class="v12-font-30">
去登录
</text>
</view>
</view>
</view>
<view class="avatar-cont">
<image
:src="webUrl + '/page/my/avatar.jpg'"
class="img"
/>
</view>
</view>
</view> </view>
<view class="my-hdeader-bottom"> <view class="my-hdeader-bottom">
<view class="item" @click="linkTo('/pages/user/UserBill/index')"> <view class="item" @click="linkTo('/pages/user/UserBill/index')">
<view class="number"> <view v-if="!isNoLogin" class="number">
{{ userInfo.nowMoney ? force2Decimal(userInfo.nowMoney) : 0.00 }} {{ userInfo.nowMoney ? force2Decimal(userInfo.nowMoney) : 0.00 }}
</view> </view>
<view v-else class="number">
--
</view>
<view class="txt"> <view class="txt">
<image :src="webUrl + '/icon/icon-yue.png'" class="img" /> <image :src="webUrl + '/icon/icon-yue.png'" class="img" />
余额 余额
</view> </view>
</view> </view>
<view class="item" @click="linkTo('/pages/user/Points/index')"> <view class="item" @click="linkTo('/pages/user/Points/index')">
<view class="number"> <view v-if="!isNoLogin" class="number">
{{ userInfo.integral || 0 }} {{ userInfo.integral || 0 }}
</view> </view>
<view v-else class="number">
--
</view>
<view class="txt"> <view class="txt">
<image :src="webUrl + '/icon/icon-jifen.png'" class="img" /> <image :src="webUrl + '/icon/icon-jifen.png'" class="img" />
积分 积分
@@ -359,7 +390,9 @@ export default {
bannerBgUrl: '', bannerBgUrl: '',
userCenterBannerUrl: '', userCenterBannerUrl: '',
pageKeyId: Object.freeze('userIndex'), pageKeyId: Object.freeze('userIndex'),
nowrap: true nowrap: true,
// 是否已登录
isNoLogin: false
} }
}, },
computed: mapGetters(['userInfo']), computed: mapGetters(['userInfo']),
@@ -370,19 +403,23 @@ export default {
}, },
onShow() { onShow() {
if (this.$store.getters.token) { if (this.$store.getters.token) {
this.isNoLogin = false
uni.showLoading({ uni.showLoading({
title: '加载中' title: '加载中'
}) })
this.$store.dispatch('getUser', true) this.$store.dispatch('getUser', true)
// 获取用户等级信息 // 获取用户等级信息
this.getUserLevelInfo() this.getUserLevelInfoReq()
this.isWeixin = isWeixin() this.isWeixin = isWeixin()
this.getUnreadMsgList() // this.getUnreadMsgList()
} else { } else {
this.isNoLogin = true
/*
cookie.set('redirect', '/pages/user/User/index') cookie.set('redirect', '/pages/user/User/index')
uni.reLaunch({ uni.reLaunch({
url: '/pages/authorization/index' url: '/pages/authorization/index'
}) })
*/
} }
}, },
onHide() { onHide() {
@@ -451,6 +488,9 @@ export default {
this.$yrouter.push('/pages/order/ReturnList/index') this.$yrouter.push('/pages/order/ReturnList/index')
}, },
goMyOrder(type) { goMyOrder(type) {
if (this.isNoLogin) {
return
}
const types = { const types = {
0: 0, 0: 0,
1: 1, 1: 1,
@@ -475,14 +515,18 @@ export default {
this.$yrouter.push('/pkg_user/views/personalData') this.$yrouter.push('/pkg_user/views/personalData')
}, },
// 获取用户等级信息 // 获取用户等级信息
getUserLevelInfo: function () { getUserLevelInfoReq() {
const _this = this const _this = this
getUserLevelInfo().then((res) => { getUserLevelInfo().then((res) => {
if (res.data) { if (res.isNoLogin) {
_this.getTextWidth() this.isNoLogin = true
_this.userLevelInfo = res.data return
} else {
if (res.data) {
_this.getTextWidth()
_this.userLevelInfo = res.data
}
} }
uni.hideLoading()
}).catch(err => { }).catch(err => {
uni.hideLoading() uni.hideLoading()
if (err.toLogin) { if (err.toLogin) {
@@ -534,6 +578,9 @@ export default {
}) })
}, },
toolItemClickHandle(item) { toolItemClickHandle(item) {
if (this.isNoLogin) {
return
}
const url = item.url const url = item.url
if (item.showTip) { if (item.showTip) {
this.$dialog.toast({ this.$dialog.toast({
@@ -550,6 +597,9 @@ export default {
if (!url) { if (!url) {
return return
} }
if (this.isNoLogin) {
return
}
uni.navigateTo({ url }) uni.navigateTo({ url })
}, },
bannerClickHandle() { bannerClickHandle() {
@@ -557,6 +607,12 @@ export default {
return return
} }
this.linkTo(this.userCenterBannerUrl) this.linkTo(this.userCenterBannerUrl)
},
toLoginHandle() {
cookie.set('redirect', '/pages/user/User/index')
uni.reLaunch({
url: '/pages/authorization/index'
})
} }
} }
} }
@@ -736,6 +792,9 @@ export default {
font-size: 13px; font-size: 13px;
} }
} }
.qrcode2 {
width: 92rpx;
}
} }
.avatar-cont { .avatar-cont {
.img { .img {
+10 -3
View File
@@ -99,15 +99,22 @@ function baseRequest(options) {
return Promise.reject({msg: "请求失败", res, resData}) return Promise.reject({msg: "请求失败", res, resData})
} }
if (resData.status === 401) { if (resData.status === 401) {
const whiteApiList = ['guide/status', 'cart/count', 'product/hasFavorite'] const whiteApiList = [
'guide/status',
'cart/count',
'product/hasFavorite',
'cart/listGroup',
'address/list',
'user/levelInfo'
]
let flag = false let flag = false
whiteApiList.map(item => { whiteApiList.map(item => {
if (options.url.indexOf(item) > -1) { if (url.indexOf(item) > -1) {
flag = true flag = true
} }
}) })
if (flag) { if (flag) {
return Promise.resolve(resData, res) return Promise.resolve({ ...resData, isNoLogin: true }, res)
} else { } else {
handleLoginFailure(); handleLoginFailure();
return Promise.reject({msg: '未登录', res, resData, toLogin: true}) return Promise.reject({msg: '未登录', res, resData, toLogin: true})