index.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. <template>
  2. <view class="container">
  3. <!-- 机构信息区域 -->
  4. <view class="ws-header">
  5. <!-- 用户信息 -->
  6. <view class="user-info">
  7. <image src="@/static/ws/default_avatar.png" mode="widthFix"></image>
  8. <view class="ws-login">请登录</view>
  9. </view>
  10. <!-- 背景图 -->
  11. <image class="user-bg" src="@/static/ws/user_bg.png" mode="widthFix"></image
  12. ></view>
  13. </view>
  14. </template>
  15. <script>
  16. import uniBadge from '@/components/uni-badge/uni-badge.vue'
  17. import upgradeAlert from '@/components/cm-module/modelAlert/upgradeAlert.vue'
  18. import authorize from '@/common/config/authorize.js'
  19. import { mapState, mapMutations } from 'vuex'
  20. import { cancelPrompt } from '@/services/use.js'
  21. export default {
  22. components: {
  23. uniBadge,
  24. upgradeAlert
  25. },
  26. data() {
  27. return {
  28. nvabarData: {
  29. //顶部自定义导航
  30. showCapsule: 1, // 是否显示左上角图标 1表示显示 0表示不显示,
  31. showSearch: 0,
  32. title: '我的', // 导航栏 中间的标题
  33. haveBack: false,
  34. textLeft: this.$store.state.isIphone,
  35. textColor: '#FFFFFF',
  36. bgColor: ''
  37. },
  38. CustomBar: this.CustomBar, // 顶部导航栏高度
  39. StatusBar: this.StatusBar,
  40. isCmcustom: false,
  41. isUpgradeAlert: false,
  42. bgImgUrl: 'https://img.caimei365.com/group1/M00/03/B0/Cmis217Z_i6ASHobAAhl69yz3SM078.png',
  43. name: '',
  44. userType: '',
  45. headpic: '',
  46. userMoney: '0.00',
  47. contactNumber: '',
  48. openid: '',
  49. aboutHtml: '',
  50. telPhone: '',
  51. bindMobile: '',
  52. clubStatus: '', //机构升级会员机构审核状态1:待审核 91:审核失败
  53. userIdentity: '', //机构等级
  54. confirmedCount: 0, //待确认
  55. paymentCount: 0, //待付款角标
  56. waitShipmentsCount: 0, //待收货角标
  57. shipmentsCount: 0, //已发货角标
  58. salesReturnCount: '', //退货/款角标
  59. firstList: [{ name: '帮机构下单', path: '/pages/user/club/club-list', icon: 'icon-yunyingrenyuanguanli' }]
  60. }
  61. },
  62. onLoad() {},
  63. computed: {
  64. ...mapState(['hasLogin', 'userInfo'])
  65. },
  66. methods: {
  67. getUserInfo() {
  68. let self = this
  69. this.UserService.PersonalInfo({ userID: this.userID })
  70. .then(response => {
  71. this.$store.commit('updateAllNum', response.data.count)
  72. let data = response.data
  73. let $userData = data.user
  74. let $clubData = data.club
  75. if ($userData.ableUserMoney == 0 || $userData.ableUserMoney == null) {
  76. this.userMoney = '0.00'
  77. } else {
  78. let i = $userData.ableUserMoney.toString().lastIndexOf('.')
  79. let money
  80. if (i == -1) {
  81. money = this.$api.FormatMoney($userData.ableUserMoney) //会所剩余余额
  82. this.userMoney = money + '.00'
  83. } else {
  84. money = this.$api.FormatMoney($userData.ableUserMoney) //会所剩余余额
  85. this.userMoney = money
  86. }
  87. }
  88. this.userIdentity = $userData.userIdentity //机构等级
  89. if (this.userIdentity == 2) {
  90. this.name = $clubData.name //会员机构名称
  91. this.userType = '会员机构'
  92. } else {
  93. this.name = $userData.userName //普通机构名称
  94. this.userType = '普通机构'
  95. }
  96. this.headpic = $userData.image //会所头像
  97. this.bindMobile = $userData.bindMobile //登录手机号
  98. this.clubStatus = $userData.clubStatus //机构审核状态
  99. this.contactNumber = data.organize.contactNumber //联系电话
  100. this.confirmedCount = this.showBadge(data.confirmedCount) //待确认
  101. this.paymentCount = this.showBadge(data.paymentCount) //待付款
  102. this.waitShipmentsCount = this.showBadge(data.waitShipmentsCount) //待收货
  103. this.shipmentsCount = this.showBadge(data.shipmentsCount) //已发货
  104. this.salesReturnCount = this.showBadge(data.salesReturnCount) //退货/款
  105. let clubInfo = { name: this.name, image: this.headpic, clubID: $clubData.clubID }
  106. if ($userData.tipStatus == '0') {
  107. this.isUpgradeAlert = true
  108. }
  109. uni.setStorage({ key: 'clubInfo', data: clubInfo })
  110. })
  111. .catch(error => {
  112. this.$util.msg(error.msg, 2000)
  113. })
  114. },
  115. getPhone() {
  116. this.CommonService.QueryAfterSale()
  117. .then(response => {
  118. this.contactNumber = response.data.contactNumber
  119. })
  120. .catch(error => {
  121. this.$util.msg(error.msg, 2000)
  122. })
  123. },
  124. toPhone() {
  125. uni.makePhoneCall({
  126. phoneNumber: this.contactNumber //仅为示例
  127. })
  128. },
  129. hanldUnBindUpgrade() {
  130. //普通用户不升级会员机构
  131. cancelPrompt({ userId: this.userID }).then(response => {
  132. this.isUpgradeAlert = false
  133. })
  134. },
  135. hanldGoApply() {
  136. cancelPrompt({ userId: this.userID }).then(response => {
  137. this.isUpgradeAlert = false
  138. this.$api.navigateTo(`/pages/login/apply?clubStatus=${this.clubStatus}`)
  139. })
  140. },
  141. navigator(url) {
  142. authorize.getSetting().then(wxResponse => {
  143. // console.log('是否已授权',res);//0:为取消授权 1:为已授权 2:为未操作
  144. if (wxResponse == 1) {
  145. if (this.hasLogin) {
  146. this.$api.navigateTo(url)
  147. } else {
  148. this.$api.navigateTo('/pages/login/login?type=0')
  149. }
  150. } else {
  151. this.$api.navigateTo('/pages/authorization/authorization?type=1')
  152. }
  153. })
  154. },
  155. navigatorNex(url, type) {
  156. authorize.getSetting().then(wxResponse => {
  157. // console.log('是否已授权',res);//0:为取消授权 1:为已授权 2:为未操作
  158. if (wxResponse == 1) {
  159. if (!this.hasLogin) {
  160. this.$api.navigateTo(url)
  161. }
  162. } else {
  163. this.$api.navigateTo(`/pages/authorization/authorization?type=${type}`)
  164. }
  165. })
  166. },
  167. showBadge(n) {
  168. let num = ''
  169. if (n > 100) {
  170. num = 99
  171. } else {
  172. num = n
  173. }
  174. return num
  175. },
  176. clubStatusText(state) {
  177. let stateText
  178. switch (state) {
  179. case 90:
  180. stateText = ''
  181. break
  182. case 1:
  183. stateText = '正在审核中'
  184. break
  185. case 92:
  186. stateText = '审核不通过'
  187. break
  188. }
  189. return stateText
  190. }
  191. },
  192. onPageScroll(e) {
  193. //实时获取到滚动的值
  194. if (e.scrollTop > 20) {
  195. this.isCmcustom = true
  196. this.nvabarData.bgColor = '#E37A4B'
  197. this.nvabarData.textColor = '#FFFFFF'
  198. } else {
  199. this.isCmcustom = false
  200. this.nvabarData.bgColor = ''
  201. this.nvabarData.textColor = '#FFFFFF'
  202. }
  203. },
  204. onPullDownRefresh() {
  205. //下拉刷新
  206. if (this.hasLogin) {
  207. this.getUserInfo()
  208. uni.stopPullDownRefresh()
  209. } else {
  210. uni.stopPullDownRefresh()
  211. }
  212. },
  213. onShow() {
  214. if (this.hasLogin) {
  215. this.$api
  216. .getComStorage('userInfo')
  217. .then(resolve => {
  218. this.userID = resolve.userID
  219. this.getUserInfo()
  220. })
  221. .catch(reject => {
  222. console.log('异常处理=========>', reject)
  223. })
  224. } else {
  225. this.getPhone()
  226. this.$store.commit('updateAllNum', 0)
  227. }
  228. }
  229. }
  230. </script>
  231. <style lang="scss">
  232. @import '@/uni.scss';
  233. .ws-header {
  234. position: relative;
  235. .user-info{
  236. position: absolute;
  237. z-index: 10;
  238. width: 750rpx;
  239. height: 280rpx;
  240. display: flex;
  241. flex-direction: column;
  242. align-items: center;
  243. image {
  244. width: 120rpx;
  245. height: 120rpx;
  246. border-radius: 50%;
  247. }
  248. }
  249. .user-bg{
  250. width: 100%;
  251. }
  252. .ws-login {
  253. width: 184rpx;
  254. height: 56rpx;
  255. border-radius: 28rpx;
  256. }
  257. }
  258. </style>