mine.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  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" ref="tabbarMain" :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_deduction from '@/apis/pagejs/deduction.js'
  132. import * as API_message from '@/apis/pagejs/message.js'
  133. import Tabbar from '@/components/Tabbar.vue'
  134. export default {
  135. components: {
  136. Tabbar
  137. },
  138. data() {
  139. return {
  140. companyInfo:{},
  141. regUser:{},
  142. userList:[],
  143. changeUserShow:false,
  144. defaultIndex:0,
  145. prefetchNum:0,
  146. personInfo:{
  147. },
  148. contractList:[]
  149. }
  150. },
  151. onLoad() {
  152. this.personInfo=this.carhelp.getPersonInfo()
  153. //this.homePage()
  154. this.userList=this.carhelp.getPersonInfoPlus().userList
  155. //this.prefetch()
  156. //this.personalCenter()
  157. this.getContractList()
  158. },
  159. onShow() {
  160. this.query()
  161. },
  162. methods: {
  163. getContractList() {
  164. API_deduction.contractList({
  165. pageIndex: 1,
  166. pageSize: 9999
  167. }).then((response) => {
  168. uni.hideLoading();
  169. this.contractList = response.data.data;
  170. }).catch(error => {
  171. uni.hideLoading();
  172. })
  173. },
  174. prefetch(){
  175. API_message.prefetch({
  176. }).then((response) => {
  177. //this.prefetchNum=response.data
  178. if (this.$refs.tabbarMain) {
  179. this.$refs.tabbarMain.setprefetchNum(response.data);
  180. }
  181. }).catch(error => {
  182. //uni.hideLoading();
  183. })
  184. },
  185. query(){
  186. uni.showLoading({
  187. title: "加载中",
  188. mask: true,
  189. })
  190. API_user.findByOpenId({
  191. noerror:true,
  192. openId: this.carhelp.getOpenId(),
  193. }).then((response) => {
  194. //this.loginset(response)
  195. uni.hideLoading();
  196. var token = response ? response.data.token : '';
  197. this.carhelp.setToken(token);
  198. this.carhelp.setPersonInfo(response.data.tenantInfo);
  199. this.carhelp.setPersonInfoPlus(response.data)
  200. this.companyInfo=response.data.companyInfo;
  201. this.regUser=response.data.regUser;
  202. this.personInfo=response.data.tenantInfo;
  203. this.prefetch();
  204. //this.homePage()
  205. }).catch(error => {
  206. uni.hideLoading();
  207. })
  208. },
  209. changeUserShowBtn(){
  210. this.defaultIndex=this.userList.findIndex(item=>{
  211. return item.id==this.regUser.id
  212. })
  213. this.changeUserShow=true
  214. },
  215. selector1confirm(e){
  216. var obj=this.userList[e[0]]
  217. uni.showLoading({
  218. title: "加载中",
  219. mask: true,
  220. })
  221. API_user.changeUser({
  222. id:obj.id,
  223. openId:this.carhelp.getOpenId()
  224. }).then((response) => {
  225. this.query()
  226. //this.companyInfo=response.data.companyInfo;
  227. }).catch(error => {
  228. uni.hideLoading();
  229. })
  230. },
  231. personalCenter(){
  232. uni.showLoading({
  233. title: "加载中",
  234. mask: true,
  235. })
  236. API_user.personalCenter({
  237. }).then((response) => {
  238. uni.hideLoading();
  239. //this.companyInfo=response.data.companyInfo;
  240. }).catch(error => {
  241. uni.hideLoading();
  242. })
  243. },
  244. homePage(){
  245. uni.showLoading({
  246. title: "加载中",
  247. mask: true,
  248. })
  249. API.homePage({
  250. }).then((response) => {
  251. uni.hideLoading();
  252. this.companyInfo=response.data.companyInfo;
  253. this.regUser=response.data.regUser;
  254. this.personInfo=response.data.tenantInfo;
  255. }).catch(error => {
  256. uni.hideLoading();
  257. })
  258. }
  259. }
  260. }
  261. </script>
  262. <style lang="scss" scoped>
  263. .background{
  264. background: linear-gradient(180deg, rgba(194,219,255,1) 53%,rgba(180,211,255,0) 100%);
  265. padding: 72rpx 32rpx;
  266. // 个人信息
  267. .person-infos{
  268. display: flex;
  269. align-items: center;
  270. .photo{
  271. width: 112rpx;
  272. height: 112rpx;
  273. border-radius: 50px;
  274. .img{
  275. width: 100%;
  276. height: 100%;
  277. }
  278. }
  279. .else{
  280. margin-left: 24rpx;
  281. .name{
  282. color: rgb(16,16,16);
  283. font-size: 36rpx;
  284. font-weight: bold;
  285. }
  286. .company{
  287. color: rgba(16,16,16,1);
  288. }
  289. }
  290. }
  291. // 地址
  292. .address-box{
  293. border-radius: 8px;
  294. background: linear-gradient(90deg, rgba(49,110,207,1) 2%,rgba(20,73,159,1) 100%);
  295. color: #fff;
  296. padding:40rpx 32rpx;
  297. margin-top: 40rpx;
  298. display: flex;
  299. align-items: center;
  300. position: relative;
  301. .address{
  302. .address-title{
  303. font-size: 40rpx;
  304. }
  305. .address-value{
  306. font-size: 24rpx;
  307. margin-top: 8rpx;
  308. }
  309. }
  310. // 切换
  311. .change{
  312. border: 1px solid rgba(255,255,255,1);
  313. width: 128rpx;
  314. height: 64rpx;
  315. line-height: 64rpx;
  316. border-radius: 50px;
  317. color: rgba(255,255,255,1);
  318. text-align: center;
  319. margin-left: auto;
  320. z-index: 99;
  321. }
  322. .image {
  323. width: 174rpx;
  324. height: 174rpx;
  325. position: absolute;
  326. right: 0;
  327. top: 20rpx;
  328. .img {
  329. width: 100%;
  330. height: 100%;
  331. }
  332. }
  333. }
  334. }
  335. // 功能
  336. .function-group{
  337. border-radius: 8px;
  338. background-color: #fff;
  339. margin: 0 32rpx 24rpx;
  340. .function-item{
  341. display: flex;
  342. align-items: center;
  343. padding: 26rpx 26rpx 26rpx 0;
  344. margin-left: 26rpx;
  345. border-bottom: 1px solid rgba(221,221,221,1);
  346. .icon{
  347. width: 40rpx;
  348. height: 40rpx;
  349. .img{
  350. width: 100%;
  351. height: 100%;
  352. }
  353. }
  354. .name{
  355. color: rgba(51,51,51,1);
  356. font-size: 30rpx;
  357. margin-left: 26rpx;
  358. }
  359. .arrow{
  360. margin-left: auto;
  361. }
  362. }
  363. }
  364. </style>