Merge branch 'dev' into test
This commit is contained in:
+343
-284
@@ -10,293 +10,308 @@
|
||||
title="购物车"
|
||||
fixed
|
||||
/>
|
||||
<view v-if="isLoad" :style="{paddingBottom: list.length > 0 ? '120rpx;' : ''}" class="list-wrap">
|
||||
<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
|
||||
v-if="isLoad"
|
||||
:style="{paddingBottom: list.length > 0 ? '120rpx;' : ''}"
|
||||
class="list-wrap"
|
||||
>
|
||||
<view v-if="isNoLogin" class="no-login-wrap">
|
||||
<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
|
||||
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
|
||||
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]"
|
||||
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
|
||||
v-if="good['productInfo']['attrInfo']['image']"
|
||||
:src="good['productInfo']['attrInfo']['image']"
|
||||
class="good-cover flex-0 v12-radius-16"
|
||||
:src="item['merAvatar']"
|
||||
class="store-cover"
|
||||
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 style="width: 100%">
|
||||
<view
|
||||
class="one-t v12-font-28"
|
||||
@click="navToGood(good, item)"
|
||||
>{{ good['productInfo']['storeName'] }}</view>
|
||||
<view
|
||||
class="sku ai-center"
|
||||
@click="changeGoodAttrHandle(good)"
|
||||
>
|
||||
规格:{{ good['productInfo']['attrInfo']['sku'] }}
|
||||
</view>
|
||||
<!-- <view class="v12-mt-1 v12-align-center">
|
||||
<view class="v12-primary-text v12-primary-border v12-radius-8 v12-font-24 v12-px-1">
|
||||
<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"
|
||||
<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;"
|
||||
@change="onChange"
|
||||
/>
|
||||
<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)"
|
||||
>
|
||||
<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>
|
||||
/>
|
||||
<image
|
||||
v-else
|
||||
:src="good['productInfo']['image']"
|
||||
mode="scaleToFill"
|
||||
class="good-cover flex-0"
|
||||
@click="navToGood(good, item)"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</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 style="width: 100%">
|
||||
<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)"
|
||||
class="one-t v12-font-28"
|
||||
@click="navToGood(good, item)"
|
||||
>{{ good['productInfo']['storeName'] }}</view>
|
||||
<view
|
||||
class="sku ai-center"
|
||||
@click="changeGoodAttrHandle(good)"
|
||||
>
|
||||
{{ attr.attr }}
|
||||
<text
|
||||
v-if="getAttrItemData(attr.attr).stock === 0"
|
||||
class="tag"
|
||||
>缺货</text>
|
||||
规格:{{ good['productInfo']['attrInfo']['sku'] }}
|
||||
</view>
|
||||
<!-- <view class="v12-mt-1 v12-align-center">
|
||||
<view class="v12-primary-text v12-primary-border v12-radius-8 v12-font-24 v12-px-1">
|
||||
<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 class="bottom">
|
||||
<view
|
||||
:class="currGoodAttr.stock === 0 ? 'disabled' : ''"
|
||||
class="btn"
|
||||
@click="changeAttrConfirm"
|
||||
>
|
||||
确认
|
||||
</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
|
||||
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>
|
||||
@@ -374,7 +389,9 @@ export default {
|
||||
isEdit: false,
|
||||
addressList:[],
|
||||
addressInfo: {},
|
||||
userLikeList: []
|
||||
userLikeList: [],
|
||||
// 是否已登录
|
||||
isNoLogin: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -450,21 +467,26 @@ export default {
|
||||
},
|
||||
getAddress() {
|
||||
getAddressList({page: 1, limit: 9999}).then(res => {
|
||||
const { data = [] } = res
|
||||
this.addressList = data
|
||||
this.addressInfo = data.find(e => e.isDefault == 1) || uni.getStorageSync('cartChooseAddress') || (data && data[0]) || null
|
||||
if (!this.addressInfo.id) {
|
||||
this.addressInfo = data.find(e => e.isDefault == 1) || (data && data[0]) || null
|
||||
if (res.isNoLogin) {
|
||||
this.isNoLogin = true
|
||||
return
|
||||
} else {
|
||||
let isExist = false
|
||||
data.map(item => {
|
||||
if (item.id === this.addressInfo.id) {
|
||||
isExist = true
|
||||
}
|
||||
})
|
||||
console.log(2, isExist);
|
||||
if (!isExist) {
|
||||
const { data = [] } = res
|
||||
this.addressList = data
|
||||
this.addressInfo = data.find(e => e.isDefault == 1) || uni.getStorageSync('cartChooseAddress') || (data && data[0]) || null
|
||||
if (!this.addressInfo.id) {
|
||||
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() {
|
||||
const res = await getCartGroup()
|
||||
if (res.isNoLogin) {
|
||||
this.isNoLogin = true
|
||||
this.isLoad = true
|
||||
return
|
||||
}
|
||||
if (res.success) {
|
||||
this.isLoad = true
|
||||
const invalid = res.data['invalid'].map(e => {
|
||||
@@ -1093,4 +1120,36 @@ view {
|
||||
overflow: hidden;
|
||||
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>
|
||||
+74
-15
@@ -1,9 +1,6 @@
|
||||
<template>
|
||||
<view class="user user-page tabbar-page">
|
||||
<view
|
||||
v-if="$store.getters.token || userInfo.uid"
|
||||
class="acea-row row-column"
|
||||
>
|
||||
<view class="acea-row row-column">
|
||||
<view class="my-hearder">
|
||||
<view class="my-header-bg">
|
||||
<image
|
||||
@@ -28,7 +25,10 @@
|
||||
>
|
||||
地标文化特产
|
||||
</view>
|
||||
<view class="info">
|
||||
<view
|
||||
v-if="$store.getters.token || userInfo.uid"
|
||||
class="info"
|
||||
>
|
||||
<view class="name-cont">
|
||||
<view class="txt flex">
|
||||
<view class="txt-cont">
|
||||
@@ -59,21 +59,52 @@
|
||||
<image :src="userInfo.avatar" class="img" />
|
||||
</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 class="my-hdeader-bottom">
|
||||
<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 }}
|
||||
</view>
|
||||
<view v-else class="number">
|
||||
--
|
||||
</view>
|
||||
<view class="txt">
|
||||
<image :src="webUrl + '/icon/icon-yue.png'" class="img" />
|
||||
余额
|
||||
</view>
|
||||
</view>
|
||||
<view class="item" @click="linkTo('/pages/user/Points/index')">
|
||||
<view class="number">
|
||||
<view v-if="!isNoLogin" class="number">
|
||||
{{ userInfo.integral || 0 }}
|
||||
</view>
|
||||
<view v-else class="number">
|
||||
--
|
||||
</view>
|
||||
<view class="txt">
|
||||
<image :src="webUrl + '/icon/icon-jifen.png'" class="img" />
|
||||
积分
|
||||
@@ -359,7 +390,9 @@ export default {
|
||||
bannerBgUrl: '',
|
||||
userCenterBannerUrl: '',
|
||||
pageKeyId: Object.freeze('userIndex'),
|
||||
nowrap: true
|
||||
nowrap: true,
|
||||
// 是否已登录
|
||||
isNoLogin: false
|
||||
}
|
||||
},
|
||||
computed: mapGetters(['userInfo']),
|
||||
@@ -370,19 +403,23 @@ export default {
|
||||
},
|
||||
onShow() {
|
||||
if (this.$store.getters.token) {
|
||||
this.isNoLogin = false
|
||||
uni.showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
this.$store.dispatch('getUser', true)
|
||||
// 获取用户等级信息
|
||||
this.getUserLevelInfo()
|
||||
this.getUserLevelInfoReq()
|
||||
this.isWeixin = isWeixin()
|
||||
this.getUnreadMsgList()
|
||||
// this.getUnreadMsgList()
|
||||
} else {
|
||||
this.isNoLogin = true
|
||||
/*
|
||||
cookie.set('redirect', '/pages/user/User/index')
|
||||
uni.reLaunch({
|
||||
url: '/pages/authorization/index'
|
||||
})
|
||||
*/
|
||||
}
|
||||
},
|
||||
onHide() {
|
||||
@@ -451,6 +488,9 @@ export default {
|
||||
this.$yrouter.push('/pages/order/ReturnList/index')
|
||||
},
|
||||
goMyOrder(type) {
|
||||
if (this.isNoLogin) {
|
||||
return
|
||||
}
|
||||
const types = {
|
||||
0: 0,
|
||||
1: 1,
|
||||
@@ -475,14 +515,18 @@ export default {
|
||||
this.$yrouter.push('/pkg_user/views/personalData')
|
||||
},
|
||||
// 获取用户等级信息
|
||||
getUserLevelInfo: function () {
|
||||
getUserLevelInfoReq() {
|
||||
const _this = this
|
||||
getUserLevelInfo().then((res) => {
|
||||
if (res.data) {
|
||||
_this.getTextWidth()
|
||||
_this.userLevelInfo = res.data
|
||||
if (res.isNoLogin) {
|
||||
this.isNoLogin = true
|
||||
return
|
||||
} else {
|
||||
if (res.data) {
|
||||
_this.getTextWidth()
|
||||
_this.userLevelInfo = res.data
|
||||
}
|
||||
}
|
||||
uni.hideLoading()
|
||||
}).catch(err => {
|
||||
uni.hideLoading()
|
||||
if (err.toLogin) {
|
||||
@@ -534,6 +578,9 @@ export default {
|
||||
})
|
||||
},
|
||||
toolItemClickHandle(item) {
|
||||
if (this.isNoLogin) {
|
||||
return
|
||||
}
|
||||
const url = item.url
|
||||
if (item.showTip) {
|
||||
this.$dialog.toast({
|
||||
@@ -550,6 +597,9 @@ export default {
|
||||
if (!url) {
|
||||
return
|
||||
}
|
||||
if (this.isNoLogin) {
|
||||
return
|
||||
}
|
||||
uni.navigateTo({ url })
|
||||
},
|
||||
bannerClickHandle() {
|
||||
@@ -557,6 +607,12 @@ export default {
|
||||
return
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
.qrcode2 {
|
||||
width: 92rpx;
|
||||
}
|
||||
}
|
||||
.avatar-cont {
|
||||
.img {
|
||||
|
||||
+10
-3
@@ -99,15 +99,22 @@ function baseRequest(options) {
|
||||
return Promise.reject({msg: "请求失败", res, resData})
|
||||
}
|
||||
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
|
||||
whiteApiList.map(item => {
|
||||
if (options.url.indexOf(item) > -1) {
|
||||
if (url.indexOf(item) > -1) {
|
||||
flag = true
|
||||
}
|
||||
})
|
||||
if (flag) {
|
||||
return Promise.resolve(resData, res)
|
||||
return Promise.resolve({ ...resData, isNoLogin: true }, res)
|
||||
} else {
|
||||
handleLoginFailure();
|
||||
return Promise.reject({msg: '未登录', res, resData, toLogin: true})
|
||||
|
||||
Reference in New Issue
Block a user