myinfo.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. <template>
  2. <view class="myinfo">
  3. <!-- 顶部信息 -->
  4. <view class="myinfo_top">
  5. <view @click="tologin()" class="userImg">
  6. <u--image width='128rpx' height="128rpx" :src="myinfo.img" shape="circle"></u--image>
  7. </view>
  8. <view @click="tologin()" class="myinfo_text">
  9. <view class="myinfo_name">
  10. <text class="userName" >{{myinfo.name}}</text>
  11. <!-- <view class="myinfo_id">
  12. id:{{myinfo.id}}
  13. </view> -->
  14. </view>
  15. <!-- <view class="myinfo_qm">
  16. {{myinfo.qm}}
  17. </view> -->
  18. </view>
  19. <view @click="toUserInfo()">
  20. <u--image width="40rpx" height="40rpx" src="/static/myinfo/iconm_bianj.png" ></u--image>
  21. </view>
  22. </view>
  23. <!-- 中段菜单 -->
  24. <view class="myinfo_menus">
  25. <view class="myinfo_title">
  26. 常用功能
  27. </view>
  28. <view class="menus">
  29. <view v-for="item in list" :key="item.id">
  30. <view class="menus_item" @click="openLink(item)">
  31. <u-badge v-if="item.name == '我的订单'" :absolute="true" :offset='offset'
  32. numberType="overflow" type="error" max="99" :value="myinfo.orderCount"></u-badge>
  33. <u--image width="64rpx" height="64rpx" :src="item.url" ></u--image>
  34. {{item.name}}
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. <!-- 下段菜单 -->
  40. <view class="myinfo_menus">
  41. <view class="myinfo_title">
  42. 其他
  43. </view>
  44. <view class="menus_foot">
  45. <view @click="openLink(item)" v-for="item in list2" :key="item.id">
  46. <view class="menus_foot_item">
  47. <view style="display: flex;align-items: center;">
  48. <u--image width="48rpx" height="48rpx" :src="item.url" ></u--image>
  49. <view style="margin-left: 20rpx;">{{item.name}}</view>
  50. </view>
  51. <u--image width="48rpx" height="48rpx" src="/static/myinfo/btn_right.png" ></u--image>
  52. </view>
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. </template>
  58. <script>
  59. import {myInfo} from '@/http/api/common.js'
  60. export default {
  61. data() {
  62. return {
  63. offset:[-10,-10],
  64. myinfo:{
  65. name:'未登录',
  66. id:'0',
  67. qm:'无',
  68. orderCount:'0',
  69. isVendor:'0',
  70. img:'https://cdn.uviewui.com/uview/album/1.jpg',
  71. },
  72. list:[
  73. {
  74. id:1,
  75. url:'/static/myinfo/iconm_xiaoxi.png',
  76. name:'消息中心',
  77. linkto:'/pages/myinfo/notifiesPage'
  78. },
  79. {
  80. id:2,
  81. url:'/static/myinfo/iconm_gouwu.png',
  82. name:'购物车',
  83. openType:'switchTab',
  84. linkto:'/pages/market/market'
  85. },
  86. {
  87. id:3,
  88. url:'/static/myinfo/icon_dingdang.png',
  89. name:'我的订单',
  90. linkto:'/pages/market/allOrder'
  91. },
  92. {
  93. id:4,
  94. url:'/static/myinfo/icomm_jilu.png',
  95. name:'浏览记录',
  96. linkto:'/pages/market/BrowsingHistory?showType=jilu'
  97. },
  98. ],
  99. list2:[
  100. {
  101. id:1,
  102. url:'/static/myinfo/icomx_wodgongy.png',
  103. name:'供应申报',
  104. linkto:'/supplierPages/pages/supplier/SupplyDeclaration'
  105. },
  106. {
  107. id:2,
  108. url:'/static/myinfo/icomx_gysrz.png',
  109. name:'供应商入驻',
  110. linkto:'/supplierPagespages/supplier/SupplierEntryForm'
  111. },
  112. {
  113. id:3,
  114. url:'/static/myinfo/icomx_souc.png',
  115. name:'我的收藏',
  116. linkto:'/pages/market/BrowsingHistory?showType=shouchang'
  117. },
  118. {
  119. id:31,
  120. url:'/static/myinfo/iconx_wodwd.png',
  121. name:'我的问答',
  122. linkto:'/pages/home/exchangeNew?showType=mywenda'
  123. },
  124. {
  125. id:4,
  126. url:'/static/myinfo/icomx_dizhi.png',
  127. name:'我的地址',
  128. linkto:'/pages/myinfo/address'
  129. },
  130. {
  131. id:5,
  132. url:'/static/myinfo/icomx_message.png',
  133. name:'意见反馈',
  134. linkto:'/pages/myinfo/userInfo?showType=fangkui'
  135. },
  136. // {
  137. // id:4,
  138. // url:'/static/myinfo/iconx_xitongg.png',
  139. // name:'设置'
  140. // },
  141. ]
  142. }
  143. },
  144. onShow() {
  145. if(uni.getStorageSync('AppAuthorization')){
  146. // 获取个人信息
  147. this.getmyInfo()
  148. }
  149. },
  150. methods: {
  151. async getmyInfo(){
  152. let res = await myInfo()
  153. if (res.data.code == 200) {
  154. this.myinfo.name = res.data.data.nickName
  155. this.myinfo.img = res.data.data.image
  156. this.myinfo.orderCount = res.data.data?.orderCount || 0
  157. this.myinfo.isVendor= res.data.data?.isVendor || 0
  158. }
  159. },
  160. tologin(){
  161. if(uni.getStorageSync('AppAuthorization')){
  162. //登录
  163. return
  164. }
  165. uni.navigateTo({
  166. url: '/pages/myinfo/login'
  167. });
  168. },
  169. toUserInfo(){
  170. if(!uni.getStorageSync('AppAuthorization')){
  171. uni.navigateTo({
  172. url: '/pages/myinfo/login'
  173. });
  174. //登录
  175. return
  176. }
  177. uni.navigateTo({
  178. url: '/pages/myinfo/userInfo'
  179. });
  180. },
  181. openLink(data){
  182. console.log(data.name,data.openType);
  183. if (data?.linkto) {
  184. if (data.openType == 'switchTab') {
  185. uni.switchTab({
  186. url: data.linkto
  187. });
  188. }else{
  189. if (data.name == '供应商入驻' && this.myinfo?.isVendor == '1') {
  190. uni.showToast({
  191. title: '您已经入驻供应商了',
  192. icon: 'none'
  193. });
  194. }else{
  195. uni.navigateTo({
  196. url: data.linkto
  197. });
  198. }
  199. }
  200. }
  201. }
  202. }
  203. }
  204. </script>
  205. <style>
  206. .myinfo{
  207. background: linear-gradient(180deg, #D3E5FF 0%, rgba(246,246,246,0.2) 100%);
  208. }
  209. .userImg{
  210. width: 128rpx;
  211. height: 128rpx;
  212. }
  213. .userName{
  214. min-width: 64rpx;
  215. height: 45rpx;
  216. font-size: 32rpx;
  217. font-weight: bold;
  218. color: #333333;
  219. line-height: 36rpx;
  220. }
  221. .myinfo_top{
  222. display: flex;
  223. width: 90vw;
  224. margin: 0 auto;
  225. align-items: center;
  226. padding-top: 40rpx;
  227. }
  228. .myinfo_text{
  229. margin-left: 40rpx;
  230. min-width: 460rpx;
  231. }
  232. .myinfo_name{
  233. display: flex;
  234. align-items: center;
  235. }
  236. .myinfo_id{
  237. margin-left: 20rpx;
  238. width: 145rpx;
  239. height: 40rpx;
  240. background: linear-gradient(180deg, #46A6FF 0%, #96CBFB 100%);
  241. border-radius: 24rpx 24rpx 24rpx 24rpx;
  242. opacity: 1;
  243. text-align: center;
  244. font-size: 24rpx;
  245. font-weight: 400;
  246. color: #FFFFFF;
  247. line-height: 36rpx;
  248. }
  249. .myinfo_qm{
  250. height: 40rpx;
  251. font-size: 28rpx;
  252. font-weight: 400;
  253. color: #999999;
  254. line-height: 36rpx;
  255. }
  256. .myinfo_menus{
  257. width: 90vw;
  258. margin: 0 auto;
  259. background-color: white;
  260. margin-top: 40rpx;
  261. border-radius: 24rpx 24rpx 24rpx 24rpx;
  262. opacity: 1;
  263. }
  264. .myinfo_title{
  265. font-size: 40rpx;
  266. padding: 30rpx 0 30rpx 40rpx;
  267. width: 128rpx;
  268. height: 45rpx;
  269. font-size: 32rpx;
  270. font-weight: bold;
  271. color: #333333;
  272. line-height: 45rpx;
  273. }
  274. .menus_item{
  275. display: flex;
  276. flex-direction: column;
  277. align-items: center;
  278. font-size: 28rpx;
  279. font-weight: 400;
  280. color: #333333;
  281. line-height: 36rpx;
  282. position: relative
  283. }
  284. .menus{
  285. padding-bottom: 40rpx;
  286. display: flex;
  287. justify-content: space-around;
  288. }
  289. .menus_foot{
  290. width: 90%;
  291. margin: 0 auto;
  292. }
  293. .menus_foot_item{
  294. display: flex;
  295. align-items: center;
  296. height: 100rpx;
  297. justify-content: space-between;
  298. }
  299. </style>