123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641 |
- <template>
- <view class="container">
- <!-- #ifdef APP-PLUS -->
- <view class="bar-height"></view>
- <!-- #endif -->
- <!-- <scroll-view class="content-box" scroll-y="true"> -->
- <view class="user-section">
- <view class="bg">
- <image src="../../static/user/ground.png" mode=""></image>
- </view>
-
- <!-- top -->
- <view class="user-info-box ">
- <view class="detail flex" @click="navTo('/pages/userinfo/userinfo')">
- <view class="portrait-box"><image class="portrait" :src="userInfo.avatar || '/static/error/missing-face.png'"></image></view>
- <view class="info-box">
- <view class="username">{{ userInfo.nickname || '游客' }}</view>
- <view class="font-size-sm" v-if="userInfo.uid">19999999999</view>
- </view>
- </view>
- <view class="config">
- <text class="setting " @click="navTo('/pages/set/set')">
- <image src="../../static/user/set.png" mode=""></image>
- </text>
- 设置
- </view>
- </view>
- <!-- 会员卡功能 -->
-
- </view>
- <view class="item-box">
- <view class="box-title flex borde-b">
- <view class="title"><text>我的订单</text></view>
- <view class="link" @click="navTo('/pages/order/order?state=5')" hover-class="common-hover">
-
- <text class="iconfont iconenter"></text>
- </view>
- </view>
- <view class="order-section">
- <view class="order-item" @click="navTo('/pages/order/order?state=1')" hover-class="common-hover" :hover-stay-time="50">
- <view class=" icon1 position-relative">
- <image class="icon-img" src="/static/icon/i2.png" mode="aspectFit"></image>
- <view class="corner" v-if="orderInfo.unshipped_count > 0">
- <text>{{ orderInfo.unshipped_count }}</text>
- </view>
- </view>
- <text>待发货</text>
- </view>
- <view class="order-item" @click="navTo('/pages/order/order?state=2')" hover-class="common-hover" :hover-stay-time="50">
- <view class="icon1 position-relative">
- <image class="icon-img" src="/static/icon/i3.png" mode="aspectFit"></image>
- <view class="corner" v-if="orderInfo.received_count > 0">
- <text>{{ orderInfo.received_count }}</text>
- </view>
- </view>
- <text>待收货</text>
- </view>
- <view class="order-item" @click="navTo('/pages/order/order?state=3')" hover-class="common-hover" :hover-stay-time="50">
- <view class="icon1 position-relative">
- <image class="icon-img" src="/static/icon/i4.png" mode="aspectFit"></image>
- <view class="corner" v-if="orderInfo.evaluated_count > 0">
- <text>{{ orderInfo.evaluated_count }}</text>
- </view>
- </view>
- <text>待评价</text>
- </view>
- <view class="order-item" @click="navTo('/pages/order/refundOrder?state=0')" hover-class="common-hover" :hover-stay-time="50">
- <view class=" icon1 position-relative">
- <image class="icon-img" src="/static/icon/i1.png" mode="aspectFit"></image>
- </view>
- <text>退款</text>
- </view>
- </view>
- </view>
- <!-- <view class="cover-container"> -->
- <view class="vip">
- <image src="../../static/user/upgrade.png" mode=""></image>
- </view>
-
- <!-- 订单 -->
-
- <view class="item-box " v-if="isShowIllegality">
- <view class="order-section order">
- <view class="order-item" @click="navTo('/pages/wallet/wallet')" hover-class="common-hover" :hover-stay-time="50">
- <view class=" icon position-relative"><image class="icon-img" src="../../static/user/balance.png" mode="aspectFit"></image></view>
- <text>我的余额</text>
- </view>
- <view class="order-item" @click="navTo('/pages/award/award')" hover-class="common-hover" :hover-stay-time="50">
- <view class=" icon position-relative"><image class="icon-img" src="../../static/user/commission.png" mode="aspectFit"></image></view>
- <text>我的佣金</text>
- </view>
- <view class="order-item" @click="navTo('/pages/scoreAccumulate/scoreAccumulate')" hover-class="common-hover" :hover-stay-time="50">
- <view class=" icon position-relative"><image class="icon-img" src="../../static/user/integral.png" mode="aspectFit"></image></view>
- <text>我的积分</text>
- </view>
- <view class="order-item" @click="navTo('/pages/coupon/consumer')" hover-class="common-hover" :hover-stay-time="50">
- <view class=" icon position-relative"><image class="icon-img" src="../../static/user/coupon.png" mode="aspectFit"></image></view>
- <text>我的消费券</text>
- </view>
- <!-- <view v-if="userInfo.is_store == 1" class="order-item" @click="openQr" hover-class="common-hover" :hover-stay-time="50">
- <view class=" icon position-relative"><image class="icon-img" src="/static/icon/u4.png" mode="aspectFit"></image></view>
- <text>核销</text>
- </view> -->
- </view>
-
- <!-- <image class="arc" v-if="isShowIllegality" src="/static/img/arc.png"></image> -->
- <!-- <view class="tj-sction" v-if="isShowIllegality">
- <view class="tj-item" @click="navTo('/pages/wallet/wallet')">
- <text class="num">{{ userInfo.now_money || '0.00' }}</text>
- <text>余额</text>
- </view>
- <view class="tj-item" @click="navTo('/pages/award/award')">
- <text class="num">{{ userInfo.brokerage_price || '0.00' }}</text>
- <text>佣金</text>
- </view>
- <view class="tj-item" @click="navTo('/pages/scoreAccumulate/scoreAccumulate')">
- <text class="num">{{ userInfo.integral || '0.00' }}</text>
- <text>积分</text>
- </view>
- <view class="tj-item" @click="navTo('/pages/coupon/consumer')">
- <text class="num">{{ userInfo.consumer || '0.00' }}</text>
- <text>消费券</text>
- </view>
- </view> -->
- <!-- 浏览历史 -->
- <view class="history-section ">
- <uni-list>
- <uni-list-item v-if="isShowIllegality" title="我的推广" @click="navTo('/pages/wallet/wallet')" thumb="/static/user/tuiguang.png"></uni-list-item>
- <uni-list-item title="邀请海报" @click="navTo('/pages/myteam/myteam')" thumb="/static/user/haibao.png"></uni-list-item>
- <uni-list-item title="我的收藏" @click="navTo('/pages/favorites/favorites')" thumb="/static/user/collect.png"></uni-list-item>
- <uni-list-item title="收货地址" @click="navTo('/pages/shareQrCode/index')" thumb="/static/user/address.png"></uni-list-item>
- <uni-list-item title="商家入口" @click="navTo('/pages/merchant/merchant')" thumb="/static/user/shopping.png"></uni-list-item>
- </uni-list>
- </view>
- </view>
- <!-- </scroll-view> -->
- </view>
- </template>
- <script>
- import { mapState, mapMutations } from 'vuex';
- import uniList from '@/components/uni-list/uni-list.vue';
- import uniListItem from '@/components/uni-list-item/uni-list-item.vue';
- import { orderData, orderVerific } from '@/api/user.js';
- import { getUserInfo } from '@/api/login.js';
- let startY = 0,
- moveY = 0,
- pageAtTop = true;
- export default {
- components: {
- uniList,
- uniListItem
- },
- data() {
- return {
- coverTransform: 'translateY(0px)',
- coverTransition: '0s',
- moving: false,
- userDowm: 0, //卡片升级专属高度
- userMaxDowm: 0, //卡片最高高度
- orderinfo: {
- complete_count: 0,
- received_count: 0,
- unshipped_count: 0,
- order_count: 0
- },
- // 判断是否已经点击过一次取消关注公众号
- watchful: true
- };
- },
- onShow() {
- // 判断是否已经登录
- if (this.hasLogin) {
- this.loadBaseData();
- }
- },
- onReady() {
- // 初始化获取页面宽度
- uni.createSelectorQuery()
- .select('.container')
- .fields(
- {
- size: true
- },
- data => {
- // 计算最多下拉的高度
- this.userDowm = Math.floor((data.width / 750) * 200);
- // 计算最大触发修改高度事件
- this.userMaxDowm = Math.floor((data.width / 750) * 250);
- }
- )
- .exec();
- },
- computed: {
- ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin']),
- // #ifdef H5
- ...mapState(['weichatObj']),
- // #endif
- ...mapState(['isShowIllegality'])
- },
- methods: {
- ...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
- // 加载初始数据
- loadBaseData() {
- let obj = this;
- getUserInfo({})
- .then(({ data }) => {
- orderData({})
- .then(({ data }) => {
- obj.setOrderInfo(data);
- })
- .catch(e => {
- obj.setOrderInfo({
- complete_count: 0, //完成
- received_count: 0, //待收货
- unshipped_count: 0, //待发货
- order_count: 0, //订单总数
- unpaid_count: 0 //待付款
- });
- });
- obj.setUserInfo(data);
- // 判断是否已经关注公众号
- if (data.subscribe == 0 && obj.watchful) {
- uni.showModal({
- title: '温馨提醒',
- content: '为提供更好的服务,请关注公众号。',
- success: res => {
- obj.watchful = false;
- // 判断是否点击了确认
- if (res.confirm) {
- uni.navigateTo({
- url: '/pages/shareQrCode/wechatQr'
- });
- }
- }
- });
- }
- })
- .catch(e => {
- console.log(e);
- });
- },
- /**
- * 统一跳转接口,拦截未登录路由
- * navigator标签现在默认没有转场动画,所以用view
- */
- navTo(url) {
- if (!this.hasLogin) {
- url = '/pages/public/login';
- // #ifdef H5
- let weichatBrowser = uni.getStorageSync('weichatBrowser');
- // 判断是否为微信浏览器
- if (weichatBrowser) {
- url = '/pages/public/wxLogin';
- }
- // #endif
- // #ifdef MP-WEIXIN
- url = '/pages/public/wxLogin';
- // #endif
- }
- uni.navigateTo({
- url
- });
- },
- /**
- * 会员卡下拉和回弹
- * 1.关闭bounce避免ios端下拉冲突
- * 2.由于touchmove事件的缺陷(以前做小程序就遇到,比如20跳到40,h5反而好很多),下拉的时候会有掉帧的感觉
- * transition设置0.1秒延迟,让css来过渡这段空窗期
- * 3.回弹效果可修改曲线值来调整效果,推荐一个好用的bezier生成工具 http://cubic-bezier.com/
- */
- coverTouchstart(e) {
- // console.log(e);
- if (pageAtTop === false) {
- return;
- }
- this.coverTransition = 'transform .1s linear';
- startY = e.touches[0].clientY;
- },
- coverTouchmove(e) {
- // console.log(e);
- moveY = e.touches[0].clientY;
- let moveDistance = moveY - startY;
- let maxDowm = this.userMaxDowm;
- let Dowm = this.userDowm;
- if (moveDistance < 0) {
- this.moving = false;
- return;
- }
- this.moving = true;
- if (moveDistance >= Dowm && moveDistance < maxDowm) {
- moveDistance = Dowm;
- }
- if (moveDistance > 0 && moveDistance <= Dowm) {
- this.coverTransform = `translateY(${moveDistance}px)`;
- }
- },
- coverTouchend() {
- if (this.moving === false) {
- return;
- }
- this.moving = false;
- this.coverTransition = 'transform 0.3s cubic-bezier(.21,1.93,.53,.64)';
- this.coverTransform = 'translateY(0px)';
- },
- // 核销
- openQr() {
- let obj = this;
- // #ifndef H5
- uni.scanCode({
- success(e) {
- obj.orderVerific(e.result);
- }
- });
- // #endif
- // #ifdef H5
- this.weichatObj.scanQRCode({
- needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
- scanType: ['qrCode', 'barCode'], // 可以指定扫二维码还是一维码,默认二者都有
- success: function(res) {
- obj.orderVerific(res.resultStr); // 当needResult 为 1 时,扫码返回的结果
- }
- });
- // #endif
- },
- // 核销请求
- orderVerific(data) {
- orderVerific({
- verify_code: data
- })
- .then(e => {
- uni.showModal({
- title: '核销',
- content: '已核销成功',
- showCancel: false
- });
- })
- .catch(e => {
- uni.showModal({
- title: '错误',
- content: JSON.stringify(e),
- showCancel: false
- });
- console.log(e);
- });
- }
- }
- };
- </script>
- <style lang="scss">
- %flex-center {
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- }
- %section {
- display: flex;
- justify-content: space-around;
- align-content: center;
- background: #fff;
- border-radius: 10rpx;
- }
- .container {
- height: 100%;
- background-color: #FFFFFF;
- /* #ifdef APP-PLUS */
- .bar-height {
- height: var(--status-bar-height);
- background-color: $base-color;
- }
- /* #endif */
- }
- .content-box {
- height: 100%;
- }
- .user-section {
- height: 435rpx;
- padding: 60rpx 0 0 30rpx;
- position: relative;
- .bg {
- position: absolute;
- height: 480rpx;
- width: 100%;
- left: 0;
- top: 0;
- image{
- width: 100%;
- height: 100%;
- }
- // background-color: $base-color;
- }
- }
- .user-info-box {
- height: 180rpx;
- color: white;
- display: flex;
- align-items: center;
- justify-content: space-between;
- position: relative;
- z-index: 1;
- .detail {
- height: 130rpx;
- .portrait-box {
- height: 100%;
- .portrait {
- width: 130rpx;
- height: 100%;
- border: 5rpx solid #fff;
- border-radius: 50%;
- }
- }
- .info-box {
- margin-left: 20rpx;
- line-height: 1.5;
- .username {
- font-size: $font-lg + 6rpx;
- height: 100%;
- }
- }
- }
- .config {
- font-size: 28rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #52C696;
- display: flex;
- justify-content: center;
- align-items: center;
- width: 165rpx;
- height: 64rpx;
- background: #FFFFFF;
- border-radius: 32px 0px 0px 32px;
- .setting {
- width: 32rpx;
- height: 32rpx;
- image{
- width: 100%;
- height: 100%;
- }
-
- // margin-right: 51rpx;
- }
- }
- }
- .vip-card-box {
- display: flex;
- flex-direction: column;
- color: #f7d680;
- height: 240rpx;
- background: linear-gradient(left, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.8));
- border-radius: 16rpx 16rpx 0 0;
- overflow: hidden;
- position: relative;
- padding: 20rpx 24rpx;
- .card-bg {
- position: absolute;
- top: 20rpx;
- right: 0;
- width: 380rpx;
- height: 260rpx;
- }
- .b-btn {
- position: absolute;
- right: 20rpx;
- top: 16rpx;
- width: 132rpx;
- height: 40rpx;
- text-align: center;
- line-height: 40rpx;
- font-size: 22rpx;
- color: #36343c;
- border-radius: 20px;
- background: linear-gradient(left, #f9e6af, #ffd465);
- z-index: 1;
- }
- .tit {
- font-size: $font-base + 2rpx;
- color: #f7d680;
- margin-bottom: 28rpx;
- .iconfont {
- color: #f6e5a3;
- margin-right: 16rpx;
- font-size: 30rpx;
- }
- }
- .e-b {
- font-size: $font-sm;
- color: #d8cba9;
- margin-top: 10rpx;
- }
- }
- .vip{
- margin-top: -110rpx;
- padding: 0 30rpx;
- height: 170rpx;
- image{
- height: 100%;
- width: 100%;
- }
- }
- .cover-container {
- display: flex;
- flex-direction: column;
- background: $page-color-base;
- padding: 0 30rpx;
- position: relative;
- background: #f5f5f5;
- padding-bottom: 20rpx;
- margin-top: -110rpx;
- .arc {
- position: absolute;
- left: 0;
- top: -34rpx;
- width: 100%;
- height: 36rpx;
- }
- }
- .tj-sction {
- @extend %section;
- .tj-item {
- @extend %flex-center;
- flex-direction: column;
- height: 140rpx;
- font-size: $font-sm;
- color: #75787d;
- }
- .num {
- font-size: $font-lg;
- color: $font-color-dark;
- margin-bottom: 8rpx;
- }
- }
- .item-box {
- position: relative;
- border-radius: 10rpx;
- background-color: white;
- top: -130rpx;
- margin: 0 30rpx;
- .box-title {
- line-height: 1;
- padding: 30rpx;
- .title {
- font-size: $font-lg;
- font-weight: bold;
- }
- .link {
- font-size: $font-base - 2rpx;
- color: $font-color-light;
- }
- }
- .order{
- margin-top: 70rpx;
- }
- .order-section {
-
- @extend %section;
- padding: 28rpx 0;
- .order-item {
- @extend %flex-center;
- width: 120rpx;
- height: 120rpx;
- border-radius: 10rpx;
- font-size: $font-sm;
- color: $font-color-dark;
- }
- .iconfont {
- font-size: 48rpx;
- margin-bottom: 18rpx;
- color: #fa436a;
- }
- .icon-shouhoutuikuan {
- font-size: 44rpx;
- }
- .icon {
- height: 88rpx;
- width: 90rpx;
- margin-bottom: 18rpx;
- background-size: 100%;
- background-repeat: no-repeat;
- background-position: center;
- .icon-img {
- width: 100%;
- height: 100%;
- }
- }
- .icon1 {
- height: 50rpx;
- width: 48rpx;
- margin-bottom: 18rpx;
- background-size: 100%;
- background-repeat: no-repeat;
- background-position: center;
- .icon-img {
- width: 100%;
- height: 100%;
- }
- }
- }
- }
- .history-section {
- // padding: 30rpx 0 0;
- margin-top: 20rpx;
- background: #fff;
- border-radius: 10rpx;
- .sec-header {
- display: flex;
- align-items: center;
- font-size: $font-base;
- color: $font-color-dark;
- line-height: 40rpx;
- margin-left: 30rpx;
- padding-top: 30rpx;
- .iconfont {
- font-size: 44rpx;
- color: $color-red;
- margin-right: 16rpx;
- line-height: 40rpx;
- }
- }
- .h-list {
- white-space: nowrap;
- padding: 30rpx 30rpx 0;
- image {
- display: inline-block;
- width: 160rpx;
- height: 160rpx;
- margin-right: 20rpx;
- border-radius: 10rpx;
- }
- }
- }
- </style>
|