user.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. <template>
  2. <view class="user-page">
  3. <view class="top-box">
  4. <view class="flex">
  5. <view class="avatar">
  6. <!-- <open-data type="userAvatarUrl"></open-data> -->
  7. <image style="width:100%;height:100%" :src="globalImgUrls.defaultAvatar" mode="aspectFill"/>
  8. </view>
  9. <view style="padding-top:10rpx">
  10. <view class="user-name">{{userInfo.real_name||'--'}}</view>
  11. <view class="tel" v-if="userInfo.mobile">{{userInfo.mobile}}</view>
  12. <view class="tel" v-else>{{userInfo.email}}</view>
  13. </view>
  14. </view>
  15. <view class="flex company">
  16. <image src="../../static/company.png" mode="widthFix"/>
  17. <text>{{userInfo.company_name||'--'}}</text>
  18. </view>
  19. </view>
  20. <view class="content">
  21. <view class="flex item-card" >
  22. <image src="../../static/user-icon-1.png" mode="widthFix" />
  23. <text class="label">品种权限</text>
  24. <block v-if="userInfo.status=='冻结'||(userInfo.status=='试用'&&userInfo.is_suspend==1)">
  25. <text style="color:#666666;margin-left:10px">暂无权限</text>
  26. <van-button
  27. custom-class="apply-btn"
  28. plain round color="#DDAA6A"
  29. size="small"
  30. @click.stop="handleContact"
  31. >联系销售</van-button>
  32. </block>
  33. <block v-else-if="userInfo.permission_list.length==0">
  34. <text style="color:#666666;margin-left:10px">暂无权限</text>
  35. <van-button
  36. custom-class="apply-btn"
  37. plain round color="#DDAA6A"
  38. size="small"
  39. @click.stop="handleGoApplyPermission"
  40. >立即申请</van-button>
  41. </block>
  42. <view v-else class="right-text look" @click="handleToUserPermission">
  43. <text>查看</text>
  44. <van-icon name="arrow"></van-icon>
  45. </view>
  46. </view>
  47. <view class="flex item-card">
  48. <image src="../../static/calendar.png" mode="widthFix" />
  49. <text class="label">服务截止日期</text>
  50. <text class="right-text" v-if="!(userInfo.status=='冻结'||(userInfo.status=='试用'&&userInfo.is_suspend==1))">{{lastTime}}</text>
  51. </view>
  52. </view>
  53. <!-- 弹窗 -->
  54. <van-popup :show="pupData.show" @close="pupData.show=false" :close-on-click-overlay="false">
  55. <view class="global-pup">
  56. <view class="content">
  57. <rich-text :nodes="pupData.content"></rich-text>
  58. </view>
  59. <view class="flex bot">
  60. <view @click="pupData.show=false">知道了</view>
  61. </view>
  62. </view>
  63. </van-popup>
  64. </view>
  65. </template>
  66. <script>
  67. const moment=require('@/utils/moment-with-locales.min')
  68. import {apiLastApplyRecord,apiApplyPermission} from '@/api/user'
  69. export default {
  70. computed: {
  71. lastTime(){
  72. let timeArr=[]
  73. this.userInfo.permission_list&&this.userInfo.permission_list.forEach(item=>{
  74. item.permission_list.forEach(item2=>{
  75. timeArr.push(new Date(item2.end_date))
  76. })
  77. })
  78. let maxTime=Math.max(...timeArr)
  79. if(timeArr.length===0){
  80. return ''
  81. }else{
  82. return moment(maxTime).format('YYYY.MM.DD')
  83. }
  84. }
  85. },
  86. data () {
  87. return {
  88. pupData:{
  89. show:false,
  90. content:'',//弹窗html字符串
  91. }
  92. }
  93. },
  94. onShow() {
  95. this.$store.dispatch('getUserInfo')
  96. },
  97. methods: {
  98. async handleGoApplyPermission(){
  99. const res=await apiLastApplyRecord({source:1})
  100. if(res.code===200){
  101. if(!res.data){
  102. uni.navigateTo({
  103. url:"/pages-applyPermission/applyPermission?source=1&from_page=我的"
  104. })
  105. }else{
  106. this.pupData.show=true
  107. this.pupData.content=`<p>您已提交过申请,请耐心等待</p>`
  108. // uni.navigateTo({
  109. // url:"/pages-applyPermission/applyResult"
  110. // })
  111. }
  112. }
  113. },
  114. handleToUserPermission(){
  115. if(this.userInfo.permission_list.length==0) return
  116. uni.navigateTo({ url: '/pages-user/permissionList' })
  117. },
  118. handleContact(){
  119. apiApplyPermission({
  120. company_name:this.userInfo.company_name,
  121. real_name:this.userInfo.real_name,
  122. source:1,
  123. from_page:'我的'
  124. }).then(res=>{
  125. if(res.code===200){
  126. console.log('主动申请成功');
  127. }
  128. })
  129. uni.makePhoneCall({
  130. phoneNumber: this.userInfo.seal_mobile
  131. });
  132. }
  133. }
  134. }
  135. </script>
  136. <style lang="scss">
  137. .user-page{
  138. min-height: calc(100vh - calc(50px + constant(safe-area-inset-bottom)));
  139. min-height: calc(100vh - calc(50px + env(safe-area-inset-bottom)));
  140. background-color: #EDEDED;
  141. }
  142. .top-box{
  143. height: 392rpx;
  144. background-color: #fff;
  145. padding: 98rpx 50rpx 0 50rpx;
  146. .avatar{
  147. width: 154rpx;
  148. height: 154rpx;
  149. border-radius: 50%;
  150. overflow: hidden;
  151. margin-right: 40rpx;
  152. }
  153. .user-name{
  154. font-size: 24px;
  155. font-weight: bold;
  156. color: #060606;
  157. }
  158. .tel{
  159. margin-top: 26rpx;
  160. color: #999;
  161. }
  162. .company{
  163. margin-top: 50rpx;
  164. image{
  165. width: 32rpx;
  166. height: 32rpx;
  167. margin-right: 8rpx;
  168. }
  169. color:#DBA665;
  170. }
  171. }
  172. .content{
  173. background-color: #fff;
  174. margin-top: 12rpx;
  175. padding: 0 34rpx;
  176. .item-card{
  177. position: relative;
  178. padding: 30rpx 0;
  179. border-bottom: 1px solid $global-border-color;
  180. image{
  181. width: 36rpx;
  182. height: 36rpx;
  183. }
  184. .label{
  185. font-weight: bold;
  186. margin-left: 20rpx;
  187. }
  188. .apply-btn{
  189. position: absolute;
  190. top: 50%;
  191. right: 0;
  192. transform: translateY(-50%);
  193. height: 50rpx;
  194. width: 156rpx;
  195. }
  196. .right-text{
  197. position: absolute;
  198. top: 50%;
  199. right: 0;
  200. transform: translateY(-50%);
  201. color: #666666;
  202. }
  203. .look{
  204. width: 100rpx;
  205. height: 100rpx;
  206. text-align: right;
  207. line-height: 100rpx;
  208. }
  209. }
  210. .item-card:last-child{
  211. border: none;
  212. }
  213. }
  214. </style>