user.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  1. <template>
  2. <view class="user-page">
  3. <view class="top-box">
  4. <view class="flex" @click="toMySetting">
  5. <view class="avatar">
  6. <!-- <open-data type="userAvatarUrl"></open-data> -->
  7. <image style="width:100%;height:100%;border-radius: 50%;" :src="userInfo.head_img_url" mode="aspectFill"/>
  8. <image src="@/static/upload_avatar.png" class="avatar_ico"></image>
  9. </view>
  10. <view style="padding-top:10rpx">
  11. <view class="user-name">{{userInfo.real_name||'--'}}</view>
  12. <view class="nick-name">
  13. 昵称:{{userInfo.nick_name || ''}}
  14. <text v-if="!userInfo.nick_name" style="color: #E3B377;">设置专属昵称</text>
  15. </view>
  16. <view class="tel" v-if="userInfo.mobile">{{userInfo.mobile}}</view>
  17. <view class="tel" v-else>{{userInfo.email}}</view>
  18. </view>
  19. </view>
  20. <view class="flex company">
  21. <image src="../../static/company.png" mode="widthFix"/>
  22. <text>{{userInfo.company_name||'--'}}</text>
  23. </view>
  24. </view>
  25. <view class="content">
  26. <view class="flex item-card" >
  27. <image src="../../static/user-icon-1.png" mode="widthFix" />
  28. <text class="label">品种权限</text>
  29. <block v-if="userInfo.status=='冻结'||(userInfo.status=='试用'&&userInfo.is_suspend==1)">
  30. <text style="color:#666666;margin-left:10px">暂无权限</text>
  31. <van-button
  32. custom-class="apply-btn"
  33. plain round color="#DDAA6A"
  34. size="small"
  35. @click.stop="handleContact"
  36. >联系销售</van-button>
  37. </block>
  38. <block v-else-if="userInfo.permission_list.length==0">
  39. <text style="color:#666666;margin-left:10px">暂无权限</text>
  40. <van-button
  41. custom-class="apply-btn"
  42. plain round color="#DDAA6A"
  43. size="small"
  44. @click.stop="handleGoApplyPermission"
  45. >立即申请</van-button>
  46. </block>
  47. <view v-else class="right-text look" @click="handleToUserPermission">
  48. <!-- <text>查看</text> -->
  49. <van-icon name="arrow"></van-icon>
  50. </view>
  51. </view>
  52. <view class="flex item-card" >
  53. <image src="@/static/message_ico.png" mode="widthFix" />
  54. <view class="label flex" style="align-items: center;">消息通知</view>
  55. <view class="right-text look" @click="toMessageHadle">
  56. <text class="unread-ico" v-if="userInfo.un_read">{{userInfo.un_read}}</text>
  57. <van-icon name="arrow"></van-icon>
  58. </view>
  59. </view>
  60. <view class="flex item-card">
  61. <image src="../../static/question/question-icon.png" mode="widthFix" />
  62. <text class="label">我的问答</text>
  63. <view class="right-text look" @click="handleToQuestionPage">
  64. <!-- <text>查看</text> -->
  65. <text class="hint" v-if="questionUnread!==0">{{questionUnread}}</text>
  66. <van-icon name="arrow"></van-icon>
  67. </view>
  68. </view>
  69. <navigator url="/pages-voice/myVoice">
  70. <view class="flex item-card">
  71. <image src="../../static/voice/mine-voice-icon.png" mode="widthFix" />
  72. <text class="label">我的语音</text>
  73. <view class="right-text look">
  74. <van-icon name="arrow"></van-icon>
  75. </view>
  76. </view>
  77. <view></view>
  78. </navigator>
  79. <navigator url="/pages-user/myCollect">
  80. <view class="flex item-card">
  81. <image src="../../static/collect-user-icon.png" mode="widthFix" />
  82. <text class="label">我的收藏</text>
  83. <view class="right-text look">
  84. <van-icon name="arrow"></van-icon>
  85. </view>
  86. </view>
  87. <view></view>
  88. </navigator>
  89. <navigator url="/pages/chart/chart" v-if="userInfo.is_inner==1">
  90. <view class="flex item-card">
  91. <image src="../../static/user_eta.png" mode="widthFix" />
  92. <text class="label">ETA图库</text>
  93. <view class="right-text look">
  94. <van-icon name="arrow"></van-icon>
  95. </view>
  96. </view>
  97. <view></view>
  98. </navigator>
  99. <view class="flex item-card" v-if="userInfo.status!='试用'">
  100. <image src="../../static/calendar.png" mode="widthFix" />
  101. <text class="label">服务截止日期</text>
  102. <text class="right-text" v-if="!(userInfo.status=='冻结'||(userInfo.status=='试用'&&userInfo.is_suspend==1))">{{lastTime}}</text>
  103. </view>
  104. </view>
  105. <!-- 弹窗 -->
  106. <van-popup :show="pupData.show" @close="pupData.show=false" :close-on-click-overlay="false">
  107. <view class="global-pup">
  108. <view class="content">
  109. <rich-text :nodes="pupData.content"></rich-text>
  110. </view>
  111. <view class="flex bot">
  112. <view @click="pupData.show=false">知道了</view>
  113. </view>
  114. </view>
  115. </van-popup>
  116. </view>
  117. </template>
  118. <script>
  119. const dayjs=require('@/utils/dayjs.min')
  120. import {apiLastApplyRecord,apiApplyPermission} from '@/api/user'
  121. import {apiGetUnread} from '@/api/question'
  122. export default {
  123. computed: {
  124. lastTime(){
  125. let timeArr=[]
  126. this.userInfo.permission_list&&this.userInfo.permission_list.forEach(item=>{
  127. item.permission_list.forEach(item2=>{
  128. timeArr.push(new Date(item2.end_date))
  129. })
  130. })
  131. let maxTime=Math.max(...timeArr)
  132. if(timeArr.length===0){
  133. return ''
  134. }else{
  135. return dayjs(maxTime).format('YYYY.MM.DD')
  136. }
  137. }
  138. },
  139. data () {
  140. return {
  141. pupData:{
  142. show:false,
  143. content:'',//弹窗html字符串
  144. },
  145. questionUnread:0
  146. }
  147. },
  148. onShow() {
  149. this.$store.dispatch('getUserInfo')
  150. this.getQuestionUnread()
  151. },
  152. methods: {
  153. async handleGoApplyPermission(){
  154. const res=await apiLastApplyRecord({source:1})
  155. if(res.code===200){
  156. if(!res.data){
  157. // 流失客户主动申请一次
  158. if(this.userInfo.status=='流失'||this.userInfo.status=='关闭'){
  159. apiApplyPermission({
  160. company_name:this.userInfo.company_name,
  161. real_name:this.userInfo.real_name,
  162. source:1,
  163. from_page:'我的'
  164. }).then(res=>{
  165. if(res.code===200){
  166. console.log('主动申请成功');
  167. this.pupData.show=true
  168. this.pupData.content=`<p>申请已提交</p><p>请等待销售人员与您联系</p>`
  169. }
  170. })
  171. return
  172. }
  173. uni.navigateTo({
  174. url:"/pages-applyPermission/applyPermission?source=1&from_page=我的"
  175. })
  176. }else{
  177. this.pupData.show=true
  178. this.pupData.content=`<p>您已提交过申请,请耐心等待</p>`
  179. // uni.navigateTo({
  180. // url:"/pages-applyPermission/applyResult"
  181. // })
  182. }
  183. }
  184. },
  185. handleToUserPermission(){
  186. if(this.userInfo.permission_list.length==0) return
  187. uni.navigateTo({ url: '/pages-user/permissionList' })
  188. },
  189. /* 消息通知页 */
  190. toMessageHadle() {
  191. uni.navigateTo({ url: '/pages-user/messageList' })
  192. },
  193. /* 我的设置 */
  194. toMySetting() {
  195. uni.navigateTo({ url: '/pages-user/mysetting' })
  196. },
  197. handleToQuestionPage(){
  198. uni.navigateTo({url:'/pages-question/answerList'})
  199. },
  200. handleContact(){
  201. apiApplyPermission({
  202. company_name:this.userInfo.company_name,
  203. real_name:this.userInfo.real_name,
  204. source:1,
  205. from_page:'我的'
  206. }).then(res=>{
  207. if(res.code===200){
  208. console.log('主动申请成功');
  209. }
  210. })
  211. uni.makePhoneCall({
  212. phoneNumber: this.userInfo.seal_mobile
  213. });
  214. },
  215. getQuestionUnread(){
  216. apiGetUnread().then(
  217. res=>{
  218. if(res.code===200){
  219. this.questionUnread = res.data
  220. }
  221. }
  222. )
  223. }
  224. }
  225. }
  226. </script>
  227. <style>
  228. page{
  229. padding-bottom: 0;
  230. }
  231. </style>
  232. <style lang="scss">
  233. .user-page{
  234. min-height: 100vh;
  235. /* min-height: calc(100vh - calc(50px + constant(safe-area-inset-bottom)));
  236. min-height: calc(100vh - calc(50px + env(safe-area-inset-bottom))); */
  237. background-color: #EDEDED;
  238. }
  239. .top-box{
  240. height: 392rpx;
  241. background-color: #fff;
  242. padding: 98rpx 50rpx 0 50rpx;
  243. .avatar{
  244. width: 154rpx;
  245. height: 154rpx;
  246. border-radius: 50%;
  247. // overflow: hidden;
  248. margin-right: 40rpx;
  249. position: relative;
  250. .avatar_ico {
  251. width: 40rpx;
  252. height: 40rpx;
  253. position: absolute;
  254. bottom: 0;
  255. right: 0;
  256. z-index: 2;
  257. }
  258. }
  259. .user-name{
  260. font-size: 24px;
  261. font-weight: bold;
  262. color: #060606;
  263. }
  264. .tel{
  265. color: #999;
  266. }
  267. .company{
  268. margin-top: 50rpx;
  269. image{
  270. width: 32rpx;
  271. height: 32rpx;
  272. margin-right: 8rpx;
  273. }
  274. color:#DBA665;
  275. }
  276. .nick-name {
  277. font-size: 28rpx;
  278. margin: 20rpx 0;
  279. }
  280. }
  281. .content{
  282. background-color: #fff;
  283. margin-top: 12rpx;
  284. padding: 0 34rpx;
  285. .item-card{
  286. position: relative;
  287. padding: 30rpx 0;
  288. border-bottom: 1px solid $global-border-color;
  289. image{
  290. width: 36rpx;
  291. height: 36rpx;
  292. }
  293. .label{
  294. font-weight: bold;
  295. margin-left: 20rpx;
  296. }
  297. .apply-btn{
  298. position: absolute;
  299. top: 50%;
  300. right: 0;
  301. transform: translateY(-50%);
  302. height: 50rpx;
  303. width: 156rpx;
  304. }
  305. .right-text{
  306. position: absolute;
  307. top: 50%;
  308. right: 0;
  309. transform: translateY(-50%);
  310. color: #666666;
  311. }
  312. .look{
  313. width: 100rpx;
  314. height: 100rpx;
  315. text-align: right;
  316. line-height: 100rpx;
  317. display: flex;
  318. align-items: center;
  319. justify-content: flex-end;
  320. .hint{
  321. width:30rpx;
  322. height:30rpx;
  323. background-color: #FF0000FF;
  324. color:#fff;
  325. font-size: 20rpx;
  326. text-align: center;
  327. line-height: 30rpx;
  328. border-radius: 50%;
  329. display: inline-block;
  330. }
  331. }
  332. .unread-ico {
  333. width: 30rpx;
  334. height: 30rpx;
  335. display: inline-block;
  336. border-radius: 50%;
  337. color: #ffff;
  338. background: #D62020;
  339. line-height: 30rpx;
  340. text-align: center;
  341. font-size: 24rpx;
  342. margin-left: 20rpx;
  343. }
  344. }
  345. .item-card:last-child{
  346. border: none;
  347. }
  348. }
  349. </style>