123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468 |
- <template>
- <view class="container">
- <!-- 机构信息区域 -->
- <view class="ws-header">
- <!-- 用户信息 -->
- <view class="user-info">
- <image src="@/static/ws/default_avatar.png" mode="widthFix"></image>
- <view
- class="ws-login"
- @click="navigator('/pages/login/login')"
- v-if="!hasLogin"
- >
- 请登录
- </view>
- <view class="user-text" v-else> 瑞恺迪光电科技有限公司有限公司 </view>
- </view>
- <!-- 背景图 -->
- <image class="user-bg" src="@/static/ws/user_bg.png" mode="widthFix"></image>
- </view>
- <!-- 机构信息END -->
- <!-- 订单状态区域 -->
- <view class="order-wrap">
- <view class="more">
- <text class="title">我的订单</text>
- <view @click="navigator('/pages/user/order/order-list?state=0')">
- <text class="more-right">全部订单</text>
- <text class="iconfont icon-chakangengduo"></text>
- </view>
- </view>
- <view class="line"></view>
- <!-- 菜单选项 -->
- <view class="order-nav">
- <view
- class="order-nav-item"
- @click="navigator('/pages/user/order/order-list?state=1')"
- >
- <image src="@/static/ws/dh_dfk_02.png" mode="widthFix"></image>
- <text>待付款</text>
- </view>
- <view
- class="order-nav-item"
- @click="navigator('/pages/user/order/order-list?state=2')"
- >
- <image src="@/static/ws/dh_dfh_03.png" mode="widthFix"></image>
- <text>待发货</text>
- </view>
- <view
- class="order-nav-item"
- @click="navigator('/pages/user/order/order-list?state=3')"
- >
- <image src="@/static/ws/dh_yfh_04.png" mode="widthFix"></image>
- <text>已发货</text>
- </view>
- <view
- class="order-nav-item"
- @click="navigator('/pages/user/order/order-list?state=4')"
- >
- <image src="@/static/ws/dh_tk_05.png" mode="widthFix"></image>
- <text>退货/款</text>
- </view>
- </view>
- </view>
- <!-- 订单状态区域END -->
- <!-- 帮机构下单 -->
- <view class="place-order" @click="navigator('/pages/user/club/club-list')">
- <view class="place-left">
- <text class="iconfont icon-bangjigouxiadan"></text>
- <text class="title">帮机构下单</text>
- </view>
- <text class="iconfont icon-chakangengduo"></text>
- </view>
- <!-- 帮机构下单END -->
- <!-- 客服 -->
- <button class="ws-service" open-type="contact" @bindcontact="handleContact">
- <text class="iconfont icon-zaixiankefu"></text> 在线客服
- </button>
- </view>
- </template>
- <script>
- import { mapState, mapMutations } from 'vuex'
- import authorize from '@/common/config/authorize.js'
- import wxLogin from '@/common/config/wxLogin.js'
- export default {
- data() {
- return {
- nvabarData: {
- //顶部自定义导航
- showCapsule: 1, // 是否显示左上角图标 1表示显示 0表示不显示,
- showSearch: 0,
- title: '我的', // 导航栏 中间的标题
- haveBack: false,
- textLeft: this.$store.state.isIphone,
- textColor: '#FFFFFF',
- bgColor: ''
- },
- CustomBar: this.CustomBar, // 顶部导航栏高度
- StatusBar: this.StatusBar,
- isCmcustom: false,
- isUpgradeAlert: false,
- bgImgUrl:
- 'https://img.caimei365.com/group1/M00/03/B0/Cmis217Z_i6ASHobAAhl69yz3SM078.png',
- name: '',
- userType: '',
- headpic: '',
- userMoney: '0.00',
- contactNumber: '',
- openid: '',
- aboutHtml: '',
- telPhone: '',
- bindMobile: '',
- clubStatus: '', //机构升级会员机构审核状态1:待审核 91:审核失败
- userIdentity: '', //机构等级
- confirmedCount: 0, //待确认
- paymentCount: 0, //待付款角标
- waitShipmentsCount: 0, //待收货角标
- shipmentsCount: 0, //已发货角标
- salesReturnCount: '', //退货/款角标
- firstList: [
- {
- name: '帮机构下单',
- path: '/pages/user/club/club-list',
- icon: 'icon-yunyingrenyuanguanli'
- }
- ]
- }
- },
- onLoad() {
- authorize.getSetting().then(res => {
- //0:为取消授权 1:为已授权 2:为未操作
- if (res == 1) {
- this.getWxAuthorize()
- } else {
- this.$api
- .getComStorage('userInfo')
- .then(resolve => {
- this.userID = resolve.userID ? resolve.userID : 0
- // this.getHomeInformation()
- })
- .catch(error => {
- // this.getHomeInformation()
- })
- }
- })
- },
- computed: {
- ...mapState(['hasLogin', 'userInfo'])
- },
- methods: {
- ...mapMutations(['login', 'logout']),
- // 获取用户信息
- async getWxAuthorize() {
- // const wechatCode = await
- const wechatCode = await authorize.getCode('weixin')
- // 初始化用户状态
- // const res = await userInfoLogin({code:wechatCode})
- const res = await this.UserService.userInfoLogin({code:wechatCode})
- console.log(res)
- if(res.code === -1){
- this.navigator('/pages/login/login')
- }
- },
- // 客服
- handleContact(e) {
- console.log(e.detail.path)
- console.log(e.detail.query)
- },
- getUserInfo() {
- let self = this
- this.UserService.PersonalInfo({ userID: this.userID })
- .then(response => {
- this.$store.commit('updateAllNum', response.data.count)
- let data = response.data
- let $userData = data.user
- let $clubData = data.club
- if ($userData.ableUserMoney == 0 || $userData.ableUserMoney == null) {
- this.userMoney = '0.00'
- } else {
- let i = $userData.ableUserMoney.toString().lastIndexOf('.')
- let money
- if (i == -1) {
- money = this.$api.FormatMoney($userData.ableUserMoney) //会所剩余余额
- this.userMoney = money + '.00'
- } else {
- money = this.$api.FormatMoney($userData.ableUserMoney) //会所剩余余额
- this.userMoney = money
- }
- }
- this.userIdentity = $userData.userIdentity //机构等级
- if (this.userIdentity == 2) {
- this.name = $clubData.name //会员机构名称
- this.userType = '会员机构'
- } else {
- this.name = $userData.userName //普通机构名称
- this.userType = '普通机构'
- }
- this.headpic = $userData.image //会所头像
- this.bindMobile = $userData.bindMobile //登录手机号
- this.clubStatus = $userData.clubStatus //机构审核状态
- this.contactNumber = data.organize.contactNumber //联系电话
- this.confirmedCount = this.showBadge(data.confirmedCount) //待确认
- this.paymentCount = this.showBadge(data.paymentCount) //待付款
- this.waitShipmentsCount = this.showBadge(data.waitShipmentsCount) //待收货
- this.shipmentsCount = this.showBadge(data.shipmentsCount) //已发货
- this.salesReturnCount = this.showBadge(data.salesReturnCount) //退货/款
- let clubInfo = {
- name: this.name,
- image: this.headpic,
- clubID: $clubData.clubID
- }
- if ($userData.tipStatus == '0') {
- this.isUpgradeAlert = true
- }
- uni.setStorage({ key: 'clubInfo', data: clubInfo })
- })
- .catch(error => {
- this.$util.msg(error.msg, 2000)
- })
- },
- getPhone() {
- this.CommonService.QueryAfterSale()
- .then(response => {
- this.contactNumber = response.data.contactNumber
- })
- .catch(error => {
- this.$util.msg(error.msg, 2000)
- })
- },
- toPhone() {
- uni.makePhoneCall({
- phoneNumber: this.contactNumber //仅为示例
- })
- },
- hanldUnBindUpgrade() {
- //普通用户不升级会员机构
- cancelPrompt({ userId: this.userID }).then(response => {
- this.isUpgradeAlert = false
- })
- },
- hanldGoApply() {
- cancelPrompt({ userId: this.userID }).then(response => {
- this.isUpgradeAlert = false
- this.$api.navigateTo(`/pages/login/apply?clubStatus=${this.clubStatus}`)
- })
- },
- navigator(url) {
- authorize.getSetting().then(wxResponse => {
- // console.log('是否已授权',res);//0:为取消授权 1:为已授权 2:为未操作
- if (wxResponse == 1) {
- if (this.hasLogin) {
- this.$api.navigateTo(url)
- } else {
- this.$api.navigateTo('/pages/login/login?type=0')
- }
- } else {
- this.$api.navigateTo('/pages/authorization/authorization?type=1')
- }
- })
- },
- navigatorNex(url, type) {
- authorize.getSetting().then(wxResponse => {
- // console.log('是否已授权',res);//0:为取消授权 1:为已授权 2:为未操作
- if (wxResponse == 1) {
- if (!this.hasLogin) {
- this.$api.navigateTo(url)
- }
- } else {
- this.$api.navigateTo(`/pages/authorization/authorization?type=${type}`)
- }
- })
- },
- showBadge(n) {
- let num = ''
- if (n > 100) {
- num = 99
- } else {
- num = n
- }
- return num
- },
- clubStatusText(state) {
- let stateText
- switch (state) {
- case 90:
- stateText = ''
- break
- case 1:
- stateText = '正在审核中'
- break
- case 92:
- stateText = '审核不通过'
- break
- }
- return stateText
- }
- },
- onPageScroll(e) {
- //实时获取到滚动的值
- if (e.scrollTop > 20) {
- this.isCmcustom = true
- this.nvabarData.bgColor = '#E37A4B'
- this.nvabarData.textColor = '#FFFFFF'
- } else {
- this.isCmcustom = false
- this.nvabarData.bgColor = ''
- this.nvabarData.textColor = '#FFFFFF'
- }
- },
- onPullDownRefresh() {
- //下拉刷新
- if (this.hasLogin) {
- this.getUserInfo()
- uni.stopPullDownRefresh()
- } else {
- uni.stopPullDownRefresh()
- }
- }
- }
- </script>
- <style lang="scss">
- @import '@/uni.scss';
- .container {
- background: #f7f7f7;
- }
- // 用户登录信息区域
- .ws-header {
- position: relative;
- height: 280rpx;
- .user-info {
- position: absolute;
- z-index: 10;
- width: 750rpx;
- height: 280rpx;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- image {
- display: block;
- width: 120rpx;
- height: 120rpx;
- border-radius: 50%;
- }
- }
- // 登录按钮
- .ws-login {
- width: 184rpx;
- height: 56rpx;
- margin-top: 25rpx;
- border-radius: 28rpx;
- background: linear-gradient(to right, #fccd90, #b6762f);
- line-height: 56rpx;
- text-align: center;
- color: #ffffff;
- font-size: 28rpx;
- }
- // 公司名
- .user-text {
- width: 446rpx;
- margin-top: 25rpx;
- color: #fff;
- font-size: 28rpx;
- line-height: 40rpx;
- text-align: center;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- .user-bg {
- width: 100%;
- }
- }
- .more {
- width: 750rpx;
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 23rpx 25rpx;
- box-sizing: border-box;
- background: #fff;
- .more-right {
- font-size: 26rpx;
- line-height: 37rpx;
- margin-right: 10rpx;
- }
- .title {
- font-size: 32rpx;
- line-height: 45rpx;
- color: #333333;
- }
- .iconfont {
- font-size: 20rpx;
- vertical-align: middle;
- }
- }
- .order-wrap {
- background: #fff;
- .line {
- width: 702rpx;
- height: 1px;
- margin: 0 auto;
- background: #f0f0f0;
- }
- .order-nav {
- display: flex;
- justify-content: space-evenly;
- align-items: center;
- padding: 40rpx 0;
- .order-nav-item {
- display: flex;
- align-items: center;
- flex-direction: column;
- image {
- width: 56rpx;
- height: 56rpx;
- }
- text {
- font-size: 26rpx;
- line-height: 37rpx;
- margin-top: 8rpx;
- }
- }
- }
- }
- .place-order {
- width: 750rpx;
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 23rpx 25rpx;
- box-sizing: border-box;
- background: #fff;
- margin-top: 20rpx;
- .place-left {
- .title {
- font-size: 28rpx;
- line-height: 40rpx;
- margin-left: 10rpx;
- }
- .iconfont {
- font-size: 36rpx;
- vertical-align: middle;
- }
- }
- .iconfont {
- font-size: 20rpx;
- }
- }
- .ws-service {
- width: 160rpx;
- height: 48rpx;
- margin: 40rpx auto 0;
- display: flex;
- justify-content: center;
- align-items: center;
- font-size: 22rpx;
- background: linear-gradient(to right, #fccd90, #b6762f);
- color: #fff;
- border-radius: 24rpx;
- .iconfont {
- font-size: 30rpx;
- margin-right: 6rpx;
- }
- }
- </style>
|