You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

401 lines
9.5 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<template>
<!-- 20221019 -->
<view class="mine-index-page">
<!-- 页面内容 -->
<view class="page-content padding-bottom-tab-bar-20">
<!-- 顶部信息 -->
<view class="width-100p position-relative padding-lr-40 bg-main-gradient" style="z-index:0">
<!-- #ifdef APP-PLUS -->
<!-- 占位 view避免页面内容出现在状态栏 -->
<view class="height-status-bar"></view>
<!-- #endif -->
<!-- 设置按钮 -->
<view class="line-height-header flex align-center justify-end">
<text class="tyIcon-shezhi text-42 text-ff" @click="go('pages/user/config/index')"></text>
</view>
<!-- -->
<jc-mine-auth :is-login="isLogin" :head-img="headImg" :nick-name="nickName"
@showLayer="isRegisterShow = true" @getUserProfileSuccess="getUserProfileSuccess">
</jc-mine-auth>
</view>
<!-- 我的订单导航 -->
<view class="width-100p position-relative" style="margin-top: -40rpx;z-index: 1;">
<ty-bar-order-nav :list="orderTabs" @needLogin="needLogin"></ty-bar-order-nav>
</view>
<!-- 我的项目 -->
<view class="margin-top-20 bg-ff">
<ty-block-nav-image :list="navList" @needLogin="needLogin"></ty-block-nav-image>
<!-- #ifdef MP-WEIXIN -->
<view class="padding-lr-30 line-height-100 border-top-ed flex align-center justify-between" @click="goSubscribe" v-if="!isSubscribeWeixin">
<view class="text-24 text-1a">关注公众号收取小程序通知</view>
<view class="text-24 text-1a">
<text>去关注</text>
<text class="margin-left-10 tyIcon-fanhui text-26 text-1a"></text>
</view>
</view>
<!-- #endif -->
<!-- #ifdef MP-WEIXIN|APP -->
<view class="flex justify-center padding-tb-30 border-top-ed">
<view class="line-height-70 radius-35 border-ed flex align-center justify-center"
style="width: 301rpx;" @click="scanCode">
<text class="text-30 text-33">扫码核销</text>
<text class="margin-left-10 tyIcon-saoyisao text-36 text-main"></text>
</view>
</view>
<!-- #endif -->
</view>
<!-- 好物推荐 -->
<view class="margin-top-30">
<jc-mall-recommendProduct :list="list" :load_status="load_status" type="2"></jc-mall-recommendProduct>
</view>
</view>
<!-- 页面组件 -->
<view class="page-layer">
<!-- 登录浮层 -->
<ty-register-login :show.sync="isRegisterShow" :agree.sync="isRegisterAgree" @login="login" @close="close">
<!-- #ifdef APP-PLUS -->
<view class="bg-ff">
<!-- 占位 view避免页面内容出现在状态栏 -->
<view class="height-status-bar"></view>
</view>
<!-- #endif -->
</ty-register-login>
</view>
</view>
</template>
<script>
import mall from '../mall/api/mall.js'
import user from '../user/api/user.js'
import project from '../project/api/project.js'
export default {
data() {
return {
// 注册浮层组件:是否显示
isRegisterShow: false,
// 注册浮层组件:是否选中用户协议
isRegisterAgree: false,
// 自动关注公众号图文链接
autoSubscribeWeixinNewsUrl:'',
// 是否关注公众号
isSubscribeWeixin: false,
// 是否登录
isLogin: false,
// 用户头像
headImg: '',
// 用户昵称
nickName: '',
// 列表加载状态
load_status: '',
// 推荐商品列表
list: [],
// 订单tab
orderTabs: {
list: [{
icon: 'tyIcon-qianbao',
name: '待支付',
size: 46,
number: 0,
url: 'pages/mall/my/orderList?index=1'
}, {
icon: 'tyIcon-daishouhuo1',
name: '待发货',
size: 42,
number: 0,
url: 'pages/mall/my/orderList?index=2'
}, {
icon: 'tyIcon-daishouhuo',
name: '待收货',
size: 50,
number: 0,
url: 'pages/mall/my/orderList?index=3'
}, {
icon: 'tyIcon-pingjia',
name: '待评价',
size: 52,
number: 0,
url: 'pages/mall/my/orderList?index=4'
}],
last: {
icon: 'tyIcon-weibiaoti-',
name: '全部订单',
size: 54,
number: 0,
url: 'pages/mall/my/orderList'
}
},
// 我的服务tab
navList: [{
name: '我的优惠券',
image: '/static/mine/my_coupon.png',
url: '/pages/discount/coupon/myCouponList',
login: true,
},
{
name: '我的收藏',
image: '/static/mine/my_collect.png',
url: '/pages/mall/my/collectList',
login: true,
},
{
name: '我的积分',
image: '/static/mine/my_integral.png',
url: '/pages/integral/myintegral',
login: true,
},
{
name: '地址管理',
image: '/static/mine/address.png',
url: '/pages/user/address/list',
login: true,
},
{
name: '我的评价',
image: '/static/mine/my_review.png',
url: '/pages/mall/my/evaluateList',
login: true,
},
{
name: '浏览记录',
image: '/static/mine/my_browse.png',
url: '/pages/mall/my/browseList',
login: true,
},
{
name: '常见问题',
image: '/static/mine/question.png',
url: '/pages/project/question',
login: false,
},
{
name: '关于我们',
image: '/static/mine/about_us.png',
url: '/pages/common/richText?title=关于我们&url=project/api/Config/getAboutUsData&param=about_us',
login: false,
},
{
name: '分销中心',
image: '/static/mine/distribution_center.png',
url: '/pages/distribution/index',
login: true,
},
{
name: '余额',
image: '/static/mine/money.png',
url: '/pages/money/list',
login: true,
},
{
name: '新闻',
image: '/static/mine/news.png',
url: '/pages/news/index',
login: false,
},
{
name: '反馈意见',
image: '/static/mine/feedback.png',
url: '/pages/feedback/index',
login: true,
},
{
name: '积分商城',
image: '/static/mine/integral.png',
url: '/pages/integral/index',
login: false,
},
{
name: '订单中心',
image: '/static/mine/order_center.png',
url: '/pages/mine/orderCenter',
login: true,
},
{
name: '车牌键盘',
image: '/static/mine/about_us.png',
url: '/pages/keyboard/keyboard',
login: true,
},
{
name: 'DEMO LIST',
image: '/static/mine/about_us.png',
url: '/pages/demo/index',
login: false,
},
{
name: '聊天',
image: '/static/mine/about_us.png',
url: '/pages/chat/index',
login: true,
},
],
}
},
onReady() {
this.loadList(1)
// #ifdef MP-WEIXIN
// 获取自动关注公众号图文链接
project.getMpweixinConfig().then(res=>{
if(res.code == 0){
this.autoSubscribeWeixinNewsUrl = res.data.mpweixin.auto_subscribe_weixin_news_url
}
})
// #endif
},
onShow() {
// 是否登录
this.isLogin = this.cn.isLogin()
if (this.isLogin) {
// 获取用户信息
this.getUserInfo()
// 获取订单数量
this.countOrderNumber()
} else {
this.orderTabs.list[0].number = 0
this.orderTabs.list[1].number = 0
this.orderTabs.list[2].number = 0
this.orderTabs.list[3].number = 0
}
// #ifdef MP-WEIXIN
// 是否关注公众号
user.isSubscribeWeixin().then(res=>{
if(res.code == 0){
this.isSubscribeWeixin = res.data.is_subscribe_weixin
}
})
// #endif
},
onReachBottom() {
this.loadList(0)
},
methods: {
/**
* 登录浮层关闭
* @date 2022-10-14
*/
close() {
// 更新登录信息
this.isLogin = this.cn.isLogin()
// 重新加载用户信息
if (this.isLogin) {
this.getUserInfo()
}
},
/**
* 去关注公众号
* @date 2022-12-28
*/
goSubscribe(){
uni.setStorageSync('webview_url', this.autoSubscribeWeixinNewsUrl)
uni.navigateTo({
url: '/pages/common/webview'
})
},
/**
* 获取用户信息
* @date 2022-12-28
*/
getUserInfo() {
user.getUserInfo().then(res => {
if (res.code == 0) {
this.headImg = res.data.info.head_img
this.nickName = res.data.info.nick_name
}
})
},
//(仅小程序)获取微信信息成功
getUserProfileSuccess() {
this.getUserInfo() //获取用户信息
},
/**
* 获取订单数量
* @date 2022-12-28
*/
countOrderNumber() {
mall.countOrderNumber().then(res => {
if (res.code == 0) {
this.orderTabs.list[0].number = res.data.number.wait_pay
this.orderTabs.list[1].number = res.data.number.wait_deliver
this.orderTabs.list[2].number = res.data.number.wait_finish
this.orderTabs.list[3].number = res.data.number.wait_evaluate
}
})
},
/**
* 需要登录
* @date 2022-12-28
*/
needLogin() {
this.isRegisterShow = true
},
/**
* 获取推荐商品
* @param {int} isFirstPage 是否第一页 0--不是 1--是
* @date 2022-10-27
*/
loadList(isFirstPage) {
mall.listProduct(this, isFirstPage, '', '', '', 1, '', '', 5)
},
/**
* 扫一扫
* @date 2022-12-28
*/
scanCode() {
uni.scanCode({
success: (res) => {
uni.navigateTo({
url: '/pages/integral/writeoff?id=' + res.result
})
},
fail: (err) => {
// console.log(err)
}
})
},
/**
* 登录
* @date 2022-12-28
*/
login() {
this.isLogin = this.cn.isLogin()
// 获取用户信息
this.getUserInfo()
// 获取订单数量
this.countOrderNumber()
}
}
}
</script>
<style scoped>
</style>