mine.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. <template>
  2. <view class="mine">
  3. <view class="index-bg"></view>
  4. <view class="mine-tips" v-if="userinfo.certification_type != 0">
  5. <u-notice-bar mode="horizontal" bg-color="rgba(0,0,0,0)" :list="[`${userinfo.certification_type == 1 ? config.intermediary_explain : config.people_explain}`]" padding="0" :volume-icon="false" color="#fff" font-size="22"></u-notice-bar>
  6. </view>
  7. <view class="user-box u-flex">
  8. <image v-if="userinfo.headimg" :src="userinfo.headimg" class="user-head" mode=""></image>
  9. <image v-else src="../../static/images/head.png" class="user-head" mode=""></image>
  10. <view class="user-center u-flex-1 u-flex-col u-col-top">
  11. <text class="text1" v-if="userinfo.name">{{userinfo.name}}</text>
  12. <button open-type="getPhoneNumber" class="text1" @getphonenumber="login" v-else>点击进行登录</button>
  13. <text class="text2" v-if="userinfo.certification_type == 0">未认证</text>
  14. <text class="text2" v-if="userinfo.certification_type == 1">中介经纪人</text>
  15. <text class="text2" v-if="userinfo.certification_type == 2">全民经纪人</text>
  16. </view>
  17. <u-icon name="edit-pen-fill" color="#fff" @click="toinfo" size="36"></u-icon>
  18. </view>
  19. <view class="yongjin-box">
  20. <view class="price u-flex u-row-center">
  21. <image src="../../static/images/qianbao.png" class="img" mode=""></image>
  22. <view class="text u-flex-col">
  23. <text>{{userinfo.balance || '0.00'}}</text>
  24. <text>佣金总额(元)</text>
  25. </view>
  26. </view>
  27. <view class="mingxi" @click="toyongjin">
  28. 佣金明细
  29. </view>
  30. </view>
  31. <view class="tabs-box u-flex">
  32. <view class="tabs-item u-flex-col u-col-center" @click="tourl(1)" v-if="(userinfo.certification_type == 1 || userinfo.certification_type == 0) && config.intermediary_show == 1">
  33. <image src="../../static/images/mine-tabs1.png" mode=""></image>
  34. <text>中介经纪人</text>
  35. </view>
  36. <view class="tabs-item u-flex-col u-col-center" @click="tourl(2)" v-if="(userinfo.certification_type == 2 || userinfo.certification_type == 0) && config.people_show == 1">
  37. <image src="../../static/images/mine-tabs2.png" mode=""></image>
  38. <text>全民经纪人</text>
  39. </view>
  40. <view class="tabs-item u-flex-col u-col-center" @click="tobaobei">
  41. <image src="../../static/images/mine-tabs3.png" mode=""></image>
  42. <text>我的报备</text>
  43. </view>
  44. </view>
  45. <view class="setting-box u-flex u-row-between" @click="tosetting">
  46. <text>系统设置</text>
  47. <u-icon name="arrow-right"></u-icon>
  48. </view>
  49. </view>
  50. </template>
  51. <script>
  52. import {
  53. mapState
  54. } from "vuex"
  55. export default {
  56. data() {
  57. return {
  58. userinfo: {
  59. certification_type: 0
  60. }
  61. }
  62. },
  63. onLoad() {
  64. },
  65. computed: {
  66. ...mapState(['config'])
  67. },
  68. onShow() {
  69. if (uni.getStorageSync("token")) {
  70. this.getuser()
  71. } else {
  72. this.userinfo = {
  73. certification_type: 0
  74. }
  75. }
  76. },
  77. methods: {
  78. tourl(type) {
  79. if (this.$islogin()) return
  80. uni.navigateTo({
  81. url: "/pages/index/broker?type=" + type
  82. })
  83. },
  84. login(e) {
  85. if (e.detail.code) {
  86. var phoneCode = e.detail.code
  87. uni.login({
  88. success: (code) => {
  89. this.$u.post('/api/Login/login', {
  90. code: code.code
  91. }).then(res => {
  92. if (res.code == 1) {
  93. uni.setStorageSync("token", res.data.token)
  94. if (!res.data.phone || 1) {
  95. this.$u.post('/api/Member/bind_Phone', {
  96. code: phoneCode
  97. }).then(res => {
  98. if (res.code == 1) {
  99. this.$u.toast("登录成功")
  100. this.$u.post('/api/Member/member_info').then(res => {
  101. uni.setStorageSync("hx_username", res.data.hx_username)
  102. this.$WebIM.conn.open({
  103. user: res.data.hx_username,
  104. pwd: "999999",
  105. }).then(() => {
  106. console.log("login success");
  107. }).catch((reason) => {
  108. console.log("login fail", reason);
  109. });
  110. })
  111. this.getuser()
  112. } else {
  113. this.$u.toast(res.msg)
  114. }
  115. })
  116. } else {
  117. this.$u.toast("登录成功")
  118. this.getuser()
  119. }
  120. } else {
  121. this.$u.toast(res.msg)
  122. }
  123. })
  124. }
  125. })
  126. }
  127. },
  128. getuser() {
  129. this.$u.post('/api/Member/member_info').then(res => {
  130. uni.setStorageSync("name", res.data.name)
  131. uni.setStorageSync("headimg", res.data.headimg)
  132. this.userinfo = res.data
  133. })
  134. },
  135. tosetting() {
  136. if (this.$islogin()) return
  137. uni.navigateTo({
  138. url: "./setting"
  139. })
  140. },
  141. tobaobei() {
  142. if (this.$islogin()) return
  143. uni.navigateTo({
  144. url: "./baobei-list"
  145. })
  146. },
  147. toyongjin() {
  148. if (this.$islogin()) return
  149. uni.navigateTo({
  150. url: "./yongjin"
  151. })
  152. },
  153. toinfo() {
  154. if (this.$islogin()) return
  155. uni.navigateTo({
  156. url: "./userinfo"
  157. })
  158. }
  159. }
  160. }
  161. </script>
  162. <style lang="scss">
  163. page {
  164. background-color: #F6F6F6;
  165. }
  166. .mine {
  167. position: relative;
  168. z-index: 1;
  169. .setting-box {
  170. width: 702rpx;
  171. height: 82rpx;
  172. background: #FFFFFF;
  173. border-radius: 20rpx;
  174. margin: 0 auto;
  175. padding: 0 24rpx;
  176. font-size: 24rpx;
  177. font-weight: 400;
  178. color: #333333;
  179. }
  180. .tabs-box {
  181. width: 702rpx;
  182. height: 218rpx;
  183. background: #FFFFFF;
  184. border-radius: 20rpx;
  185. margin: 20rpx auto;
  186. .tabs-item {
  187. width: 25%;
  188. image {
  189. width: 84rpx;
  190. height: 84rpx;
  191. margin-bottom: 20rpx;
  192. border-radius: 20rpx;
  193. }
  194. text {
  195. font-size: 24rpx;
  196. font-family: PingFangSC-Regular, PingFang SC;
  197. font-weight: 400;
  198. color: #131415;
  199. }
  200. }
  201. }
  202. .yongjin-box {
  203. width: 702rpx;
  204. background: #FFFFFF;
  205. border-radius: 20rpx;
  206. margin: 0 auto;
  207. padding: 0 50rpx;
  208. .mingxi {
  209. line-height: 82rpx;
  210. text-align: center;
  211. font-size: 24rpx;
  212. font-family: PingFangSC-Regular, PingFang SC;
  213. font-weight: 400;
  214. color: #333333;
  215. }
  216. .price {
  217. height: 226rpx;
  218. border-bottom: 2rpx solid rgba(245, 245, 245, 1);
  219. .img {
  220. width: 94rpx;
  221. height: 94rpx;
  222. margin-right: 34rpx;
  223. }
  224. .text {
  225. text:first-child {
  226. font-size: 48rpx;
  227. font-family: PingFangSC-Medium, PingFang SC;
  228. font-weight: 500;
  229. color: #333333;
  230. }
  231. text:last-child {
  232. font-size: 24rpx;
  233. font-family: PingFangSC-Regular, PingFang SC;
  234. font-weight: 400;
  235. color: #999999;
  236. }
  237. }
  238. }
  239. }
  240. .user-box {
  241. padding: 48rpx 24rpx 82rpx 24rpx;
  242. .user-center {
  243. margin: 0 32rpx;
  244. .text1 {
  245. font-size: 32rpx;
  246. font-family: PingFangSC-Medium, PingFang SC;
  247. font-weight: 500;
  248. color: #FFFFFF;
  249. margin: 0 0 20rpx 0;
  250. padding: 0;
  251. border: none;
  252. background-color: rgba(0, 0, 0, 0);
  253. line-height: 1.5;
  254. text-align: left;
  255. }
  256. .text1::after {
  257. margin: 0;
  258. padding: 0;
  259. border: none;
  260. }
  261. .text2 {
  262. padding: 0 20rpx;
  263. min-width: 102rpx;
  264. line-height: 40rpx;
  265. border-radius: 24rpx;
  266. border: 2rpx solid #FFFFFF;
  267. text-align: center;
  268. font-size: 24rpx;
  269. font-family: PingFangSC-Regular, PingFang SC;
  270. font-weight: 400;
  271. color: #FFFFFF;
  272. }
  273. }
  274. .user-head {
  275. width: 120rpx;
  276. height: 120rpx;
  277. border-radius: 100rpx;
  278. }
  279. }
  280. .mine-tips {
  281. width: 750rpx;
  282. line-height: 56rpx;
  283. background: rgba(255, 255, 255, 0.1);
  284. padding: 0 24rpx;
  285. font-size: 22rpx;
  286. font-family: PingFangSC-Regular, PingFang SC;
  287. font-weight: 400;
  288. color: #FFFFFF;
  289. }
  290. .index-bg {
  291. width: 750rpx;
  292. height: 556rpx;
  293. background: linear-gradient(180deg, #1E7DFF 0%, #F6F6F6 100%);
  294. position: absolute;
  295. top: 1;
  296. left: 0;
  297. z-index: -1;
  298. }
  299. }
  300. </style>