mine.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391
  1. <template>
  2. <view>
  3. <view class="background">
  4. <!-- 个人信息 @click="gotoUrl('/pages/mine/personInfos')" -->
  5. <view class="person-infos" >
  6. <view class="photo">
  7. <image class="img" src="@/assets/img/默认头像.png" mode=""></image>
  8. </view>
  9. <view class="else">
  10. <view class="name">
  11. {{regUser.name}}
  12. </view>
  13. <view class="company">
  14. {{personInfo.fullName}}
  15. </view>
  16. </view>
  17. </view>
  18. <!-- 地址 -->
  19. <view class="address-box" >
  20. <view class="address">
  21. <view class="address-title">
  22. {{personInfo.name}}
  23. </view>
  24. <view class="address-value" v-if="false" >
  25. <!-- -->
  26. <u-icon name="map" v-if="personInfo.remark"></u-icon>{{personInfo.remark}}
  27. <!-- {{companyInfo.typeN}} -->
  28. </view>
  29. </view>
  30. <!-- 切换 -->
  31. <u-picker v-model="changeUserShow" mode="selector" :range="userList"
  32. :default-selector="[defaultIndex]" range-key="tenantName" @confirm="selector1confirm" ></u-picker>
  33. <view class="change" @click="changeUserShowBtn" v-if="userList&&userList.length>1">
  34. 切换
  35. </view>
  36. <view class="image" >
  37. <image class="img" src="@/assets/img/mineBackground.svg" mode=""></image>
  38. </view>
  39. </view>
  40. </view>
  41. <!-- 功能 -->
  42. <view class="function-group">
  43. <view class="function-item" v-if="false" @click="gotoUrl('/pages/mine/tenantInformation')" >
  44. <view class="icon">
  45. <image class="img" src="@/assets/img/riLine-contacts-book-line.svg" mode=""></image>
  46. </view>
  47. <view class="name">
  48. 用户信息
  49. </view>
  50. <view class="arrow">
  51. <u-icon name="arrow-right" color="#b2b2b2"></u-icon>
  52. </view>
  53. </view>
  54. <view class="function-item" v-if="false">
  55. <view class="icon">
  56. <image class="img" src="@/assets/img/riLine-pie-chart-line.svg" mode=""></image>
  57. </view>
  58. <view class="name">
  59. 用电监控
  60. </view>
  61. <view class="arrow">
  62. <u-icon name="arrow-right" color="#b2b2b2"></u-icon>
  63. </view>
  64. </view>
  65. <view class="function-item" v-if="false">
  66. <view class="icon">
  67. <image class="img" src="@/assets/img/riLine-book-2-line.svg" mode=""></image>
  68. </view>
  69. <view class="name">
  70. 用电常识
  71. </view>
  72. <view class="arrow">
  73. <u-icon name="arrow-right" color="#b2b2b2"></u-icon>
  74. </view>
  75. </view>
  76. <view class="function-item" @click="gotoUrl('/pages/invoiceManagement/invoiceManagement')" >
  77. <view class="icon">
  78. <image class="img" src="@/assets/img/iconPark-order2.svg" mode=""></image>
  79. </view>
  80. <view class="name">
  81. 发票管理
  82. </view>
  83. <view class="arrow">
  84. <u-icon name="arrow-right" color="#b2b2b2"></u-icon>
  85. </view>
  86. </view>
  87. <view class="function-item" @click="gotoUrl('/pages/mine/contactService')" >
  88. <view class="icon">
  89. <image class="img" src="@/assets/img/riLine-customer-service-2-line.svg" mode=""></image>
  90. </view>
  91. <view class="name">
  92. 客服热线
  93. </view>
  94. <view class="arrow">
  95. <u-icon name="arrow-right" color="#b2b2b2"></u-icon>
  96. </view>
  97. </view>
  98. </view>
  99. <view class="function-group" v-if="false">
  100. <view class="function-item">
  101. <view class="icon">
  102. <image class="img" src="@/assets/img/riLine-user-settings-line.svg" mode=""></image>
  103. </view>
  104. <view class="name">
  105. 个人信息
  106. </view>
  107. <view class="arrow">
  108. <u-icon name="arrow-right" color="#b2b2b2"></u-icon>
  109. </view>
  110. </view>
  111. </view>
  112. <view class="function-group" >
  113. <view class="function-item" @click="gotoUrl('/pages/mine/setting')">
  114. <view class="icon">
  115. <image class="img" src="@/assets/img/riLine-settings-2-line.svg" mode=""></image>
  116. </view>
  117. <view class="name">
  118. 设置
  119. </view>
  120. <view class="arrow">
  121. <u-icon name="arrow-right" color="#b2b2b2"></u-icon>
  122. </view>
  123. </view>
  124. </view>
  125. <Tabbar :current="2" :prefetchNum="prefetchNum" ></Tabbar>
  126. </view>
  127. </template>
  128. <script>
  129. import * as API from '@/apis/pagejs/index.js'
  130. import * as API_user from '@/apis/pagejs/user.js'
  131. import * as API_message from '@/apis/pagejs/message.js'
  132. import Tabbar from '@/components/Tabbar.vue'
  133. export default {
  134. components: {
  135. Tabbar
  136. },
  137. data() {
  138. return {
  139. companyInfo:{},
  140. regUser:{},
  141. userList:[],
  142. changeUserShow:false,
  143. defaultIndex:0,
  144. prefetchNum:0,
  145. personInfo:{
  146. }
  147. }
  148. },
  149. onLoad() {
  150. this.personInfo=this.carhelp.getPersonInfo()
  151. this.homePage()
  152. this.userList=this.carhelp.getPersonInfoPlus().userList
  153. this.prefetch()
  154. //this.personalCenter()
  155. },
  156. methods: {
  157. prefetch(){
  158. API_message.prefetch({
  159. }).then((response) => {
  160. //this.prefetchNum=response.data
  161. }).catch(error => {
  162. //uni.hideLoading();
  163. })
  164. },
  165. query(){
  166. uni.showLoading({
  167. title: "加载中",
  168. mask: true,
  169. })
  170. API_user.findByOpenId({
  171. noerror:true,
  172. openId: this.carhelp.getOpenId(),
  173. }).then((response) => {
  174. //this.loginset(response)
  175. uni.hideLoading();
  176. var token = response ? response.data.token : '';
  177. this.carhelp.setToken(token);
  178. this.carhelp.setPersonInfo(response.data.tenantInfo);
  179. this.carhelp.setPersonInfoPlus(response.data)
  180. this.companyInfo=response.data.companyInfo;
  181. this.regUser=response.data.regUser;
  182. this.personInfo=response.data.tenantInfo;
  183. this.prefetch();
  184. //this.homePage()
  185. }).catch(error => {
  186. uni.hideLoading();
  187. })
  188. },
  189. changeUserShowBtn(){
  190. this.defaultIndex=this.userList.findIndex(item=>{
  191. return item.id==this.regUser.id
  192. })
  193. this.changeUserShow=true
  194. },
  195. selector1confirm(e){
  196. var obj=this.userList[e[0]]
  197. uni.showLoading({
  198. title: "加载中",
  199. mask: true,
  200. })
  201. API_user.changeUser({
  202. id:obj.id,
  203. openId:this.carhelp.getOpenId()
  204. }).then((response) => {
  205. this.query()
  206. //this.companyInfo=response.data.companyInfo;
  207. }).catch(error => {
  208. uni.hideLoading();
  209. })
  210. },
  211. personalCenter(){
  212. uni.showLoading({
  213. title: "加载中",
  214. mask: true,
  215. })
  216. API_user.personalCenter({
  217. }).then((response) => {
  218. uni.hideLoading();
  219. //this.companyInfo=response.data.companyInfo;
  220. }).catch(error => {
  221. uni.hideLoading();
  222. })
  223. },
  224. homePage(){
  225. uni.showLoading({
  226. title: "加载中",
  227. mask: true,
  228. })
  229. API.homePage({
  230. }).then((response) => {
  231. uni.hideLoading();
  232. this.companyInfo=response.data.companyInfo;
  233. this.regUser=response.data.regUser;
  234. this.personInfo=response.data.tenantInfo;
  235. }).catch(error => {
  236. uni.hideLoading();
  237. })
  238. }
  239. }
  240. }
  241. </script>
  242. <style lang="scss" scoped>
  243. .background{
  244. background: linear-gradient(180deg, rgba(194,219,255,1) 53%,rgba(180,211,255,0) 100%);
  245. padding: 72rpx 32rpx;
  246. // 个人信息
  247. .person-infos{
  248. display: flex;
  249. align-items: center;
  250. .photo{
  251. width: 112rpx;
  252. height: 112rpx;
  253. border-radius: 50px;
  254. .img{
  255. width: 100%;
  256. height: 100%;
  257. }
  258. }
  259. .else{
  260. margin-left: 24rpx;
  261. .name{
  262. color: rgb(16,16,16);
  263. font-size: 36rpx;
  264. font-weight: bold;
  265. }
  266. .company{
  267. color: rgba(16,16,16,1);
  268. }
  269. }
  270. }
  271. // 地址
  272. .address-box{
  273. border-radius: 8px;
  274. background: linear-gradient(90deg, rgba(49,110,207,1) 2%,rgba(20,73,159,1) 100%);
  275. color: #fff;
  276. padding:40rpx 32rpx;
  277. margin-top: 40rpx;
  278. display: flex;
  279. align-items: center;
  280. position: relative;
  281. .address{
  282. .address-title{
  283. font-size: 40rpx;
  284. }
  285. .address-value{
  286. font-size: 24rpx;
  287. margin-top: 8rpx;
  288. }
  289. }
  290. // 切换
  291. .change{
  292. border: 1px solid rgba(255,255,255,1);
  293. width: 128rpx;
  294. height: 64rpx;
  295. line-height: 64rpx;
  296. border-radius: 50px;
  297. color: rgba(255,255,255,1);
  298. text-align: center;
  299. margin-left: auto;
  300. z-index: 99;
  301. }
  302. .image {
  303. width: 174rpx;
  304. height: 174rpx;
  305. position: absolute;
  306. right: 0;
  307. top: 20rpx;
  308. .img {
  309. width: 100%;
  310. height: 100%;
  311. }
  312. }
  313. }
  314. }
  315. // 功能
  316. .function-group{
  317. border-radius: 8px;
  318. background-color: #fff;
  319. margin: 0 32rpx 24rpx;
  320. .function-item{
  321. display: flex;
  322. align-items: center;
  323. padding: 26rpx 26rpx 26rpx 0;
  324. margin-left: 26rpx;
  325. border-bottom: 1px solid rgba(221,221,221,1);
  326. .icon{
  327. width: 40rpx;
  328. height: 40rpx;
  329. .img{
  330. width: 100%;
  331. height: 100%;
  332. }
  333. }
  334. .name{
  335. color: rgba(51,51,51,1);
  336. font-size: 30rpx;
  337. margin-left: 26rpx;
  338. }
  339. .arrow{
  340. margin-left: auto;
  341. }
  342. }
  343. }
  344. </style>