mine.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  1. <template>
  2. <view style="overflow: scroll; background-color: #232428">
  3. <img
  4. src="https://file.rongcyl.cn/festatic/bkm/mine/mine_bgt.png"
  5. style="width: 100%; height: 658rpx; position: absolute; z-index: 99"
  6. />
  7. <div style="width: 100%; height: 658rpx; z-index: 100; position: relative">
  8. <div
  9. :style="{
  10. color: '#fff',
  11. 'margin-top': menuButton.top + 'px',
  12. 'line-height': menuButton.height + 'px',
  13. textAlign: 'center',
  14. }"
  15. >
  16. 我的
  17. </div>
  18. <div class="flex pt-3 px-5">
  19. <img
  20. @click="toUserInfo"
  21. style="width: 116rpx; height: 116rpx"
  22. :src="userInfo.avatar"
  23. v-if="hasLogin"
  24. class="rounded-full"
  25. />
  26. <img
  27. style="width: 116rpx; height: 116rpx; border: 4rpx solid #fff; background-color: #bbbcc3; opacity: 0.4"
  28. v-if="!hasLogin"
  29. class="rounded-full"
  30. />
  31. <div style="color: #bbbcc3" class="ml-3" v-if="hasLogin">
  32. <div>
  33. <span>{{ userInfo.nickname || '' }}</span>
  34. <span style="color: #9e9e9e" class="fs12 ml-4">ID:{{ userId || '' }}</span>
  35. </div>
  36. <div class="relative inline-block" style="width: 100rpx; height: 60rpx">
  37. <img src="https://file.rongcyl.cn/festatic/bkm/mine/vip2.png" style="width: 100rpx; height: 60rpx" />
  38. <div
  39. class="absolute fs13"
  40. style="top: 0; height: 60rpx; right: 15rpx; color: #713b08; z-index: 999; line-height: 60rpx"
  41. >
  42. {{ userInfoDetail.userLevel || 0 }}
  43. </div>
  44. </div>
  45. </div>
  46. <div class="text-white mt-4 ml-3" @click="toLogin" v-else>点击登录</div>
  47. </div>
  48. <div class="flex justify-around text-white mt-4 items-center text-center">
  49. <div class="" @click="$navigateTo('/pages/integralRecord/integralRecord')">
  50. <div class="fs16 bold">{{ userInfoDetail.integral || 0 }}</div>
  51. <div class="fs14">积分</div>
  52. </div>
  53. <div class="" @click="$navigateTo('/pages/coupon/coupon')">
  54. <div class="fs16 bold">{{ userInfoDetail.couponNum || 0 }}</div>
  55. <div class="fs14">优惠券</div>
  56. </div>
  57. </div>
  58. <img
  59. @click="$navigateTo('/pages/vip/vip')"
  60. src="https://file.rongcyl.cn/festatic/bkm/mine/vip.png"
  61. style="width: 152rpx; height: 170rpx; position: absolute"
  62. :style="{ top: vipTop, right: '15rpx' }"
  63. />
  64. </div>
  65. <div
  66. style="
  67. margin-top: -320rpx;
  68. height: calc(100vh - 358rpx);
  69. width: 100vw;
  70. position: relative;
  71. z-index: 100;
  72. background: url(https://file.rongcyl.cn/festatic/bkm/mine/mine_bg.png) no-repeat;
  73. background-size: cover;
  74. color: #bbbcc3;
  75. padding: 0 30rpx;
  76. box-sizing: border-box;
  77. padding-top: 100rpx;
  78. "
  79. >
  80. <uni-popup class="popup" ref="popup" type="center">
  81. <image
  82. class="qrcodeImg"
  83. :show-menu-by-longpress="true"
  84. :src="'https://file.rongcyl.cn/festatic/bkm/imgv2/QRcode.png'"
  85. mode="widthFix"
  86. />
  87. </uni-popup>
  88. <div class="flex justify-between items-center">
  89. <div class="fs14">我的订单</div>
  90. <div class="flex items-center">
  91. <span class="fs12" @click="$navigateTo('/pages/order/order')">查看全部</span>
  92. <img
  93. class="ml-2 inline-block"
  94. src="https://file.rongcyl.cn/festatic/bkm/arrow.png"
  95. style="width: 28rpx; height: 28rpx"
  96. />
  97. </div>
  98. </div>
  99. <div class="flex justify-around my-5 fs12 text-center">
  100. <div @click="$navigateTo('/pages/order/order?type=1')">
  101. <img src="https://file.rongcyl.cn/festatic/bkm/mine/t2.png" style="width: 100rpx; height: 100rpx" />
  102. <div class="mt-1">待付款</div>
  103. </div>
  104. <div @click="$navigateTo('/pages/order/order?type=2')">
  105. <img src="https://file.rongcyl.cn/festatic/bkm/mine/t1.png" style="width: 100rpx; height: 100rpx" />
  106. <div class="mt-1">待发货</div>
  107. </div>
  108. <div @click="$navigateTo('/pages/order/order?type=3')">
  109. <img src="https://file.rongcyl.cn/festatic/bkm/mine/t3.png" style="width: 100rpx; height: 100rpx" />
  110. <div class="mt-1">待收货</div>
  111. </div>
  112. <div @click="$navigateTo('/pages/consumptionRecords/consumptionRecords')">
  113. <img src="https://file.rongcyl.cn/festatic/bkm/mine/t4.png" style="width: 100rpx; height: 100rpx" />
  114. <div class="mt-1">消费记录</div>
  115. </div>
  116. </div>
  117. <!-- <div class="flex justify-between fs14 items-center border-t border-zinc-600" style="height: 92rpx">
  118. <div class="flex items-center">
  119. <img
  120. src="https://file.rongcyl.cn/festatic/bkm/mine/s1.png"
  121. class="inline-block mr-2"
  122. style="width: 32rpx; height: 32rpx"
  123. />
  124. <span>常见问题</span>
  125. </div>
  126. <img
  127. src="https://file.rongcyl.cn/festatic/bkm/arrow.png"
  128. style="width: 28rpx; height: 28rpx; display: inline-block"
  129. />
  130. </div>
  131. <div class="flex justify-between fs14 items-center border-t border-zinc-600" style="height: 92rpx">
  132. <div class="flex items-center">
  133. <img
  134. src="https://file.rongcyl.cn/festatic/bkm/mine/s2.png"
  135. class="inline-block mr-2"
  136. style="width: 32rpx; height: 32rpx"
  137. />
  138. <span>意见反馈</span>
  139. </div>
  140. <img
  141. src="https://file.rongcyl.cn/festatic/bkm/arrow.png"
  142. style="width: 28rpx; height: 28rpx; display: inline-block"
  143. />
  144. </div> -->
  145. <div
  146. @click="showQRcode"
  147. class="flex justify-between fs14 items-center border-t border-zinc-600"
  148. style="height: 92rpx"
  149. >
  150. <div class="flex items-center">
  151. <img
  152. src="https://file.rongcyl.cn/festatic/bkm/mine/s3.png"
  153. class="inline-block mr-2"
  154. style="width: 32rpx; height: 32rpx"
  155. />
  156. <span>加入群组</span>
  157. </div>
  158. <img
  159. src="https://file.rongcyl.cn/festatic/bkm/arrow.png"
  160. style="width: 28rpx; height: 28rpx; display: inline-block"
  161. />
  162. </div>
  163. <button
  164. open-type="contact"
  165. class="btn flex justify-between fs14 items-center border-t border-zinc-600"
  166. style="height: 92rpx"
  167. >
  168. <div class="flex items-center">
  169. <img
  170. src="https://file.rongcyl.cn/festatic/bkm/mine/s4.png"
  171. class="inline-block mr-2"
  172. style="width: 32rpx; height: 32rpx"
  173. />
  174. <span>联系客服</span>
  175. </div>
  176. <img
  177. src="https://file.rongcyl.cn/festatic/bkm/arrow.png"
  178. style="width: 28rpx; height: 28rpx; display: inline-block"
  179. />
  180. </button>
  181. <div
  182. class="flex justify-between fs14 items-center border-t border-zinc-600"
  183. style="height: 92rpx"
  184. @click="pageTo('/pages/addressManage/addressManage')"
  185. >
  186. <div class="flex items-center">
  187. <img
  188. src="https://file.rongcyl.cn/festatic/bkm/mine/s5.png"
  189. class="inline-block mr-2"
  190. style="width: 32rpx; height: 32rpx"
  191. />
  192. <span>地址管理</span>
  193. </div>
  194. <img
  195. src="https://file.rongcyl.cn/festatic/bkm/arrow.png"
  196. style="width: 28rpx; height: 28rpx; display: inline-block"
  197. />
  198. </div>
  199. <div
  200. @click="$navigateTo('/pages/rule/rule', { type: 0 })"
  201. class="flex justify-between fs14 items-center border-t border-zinc-600"
  202. style="height: 92rpx"
  203. >
  204. <div class="flex items-center">
  205. <img
  206. src="https://file.rongcyl.cn/festatic/bkm/mine/s6.png"
  207. class="inline-block mr-2"
  208. style="width: 32rpx; height: 32rpx"
  209. />
  210. <span>游戏规则</span>
  211. </div>
  212. <img
  213. src="https://file.rongcyl.cn/festatic/bkm/arrow.png"
  214. style="width: 28rpx; height: 28rpx; display: inline-block"
  215. />
  216. </div>
  217. <div
  218. @click="$navigateTo('/pages/userAgreement/userAgreement')"
  219. class="flex justify-between fs14 items-center border-t border-b border-zinc-600"
  220. style="height: 92rpx"
  221. >
  222. <div class="flex items-center">
  223. <img
  224. src="https://file.rongcyl.cn/festatic/bkm/mine/s7.png"
  225. class="inline-block mr-2"
  226. style="width: 32rpx; height: 32rpx"
  227. />
  228. <span>用户协议</span>
  229. </div>
  230. <img
  231. src="https://file.rongcyl.cn/festatic/bkm/arrow.png"
  232. style="width: 28rpx; height: 28rpx; display: inline-block"
  233. />
  234. </div>
  235. </div>
  236. </view>
  237. </template>
  238. <script>
  239. import { userInfoApi } from '@/api/user.js'
  240. import { messageListApi } from '@/api/message.js'
  241. export default {
  242. data() {
  243. return {
  244. isLogin: false,
  245. userInfo: null,
  246. userId: '-',
  247. hasLogin: false,
  248. userInfoDetail: {},
  249. massageNum: 0,
  250. safeAreaTop: 0,
  251. menuButton: {
  252. top: 0,
  253. height: 0,
  254. },
  255. }
  256. },
  257. created() {
  258. const { top, height } = wx.getMenuButtonBoundingClientRect()
  259. this.menuButton.top = top
  260. this.menuButton.height = height
  261. wx.getSystemInfo({
  262. success: res => {
  263. console.log(res.safeArea)
  264. this.safeAreaTop = res.safeArea.top + 'px'
  265. },
  266. })
  267. },
  268. computed: {
  269. vipTop() {
  270. return this.menuButton.height + 15 + 'px'
  271. },
  272. },
  273. onShow() {
  274. // this.userInfo = wx.getStorageSync('userInfo');
  275. this.userId = wx.getStorageSync('userId')
  276. //获取用户的登录信息
  277. if (wx.getStorageSync('token')) {
  278. this.hasLogin = true
  279. getApp().globalData.hasLogin = true
  280. // 获取用户信息详情
  281. this.getUserInfo()
  282. this.getMassage()
  283. } else {
  284. this.userInfo = null
  285. this.hasLogin = false
  286. getApp().globalData.hasLogin = false
  287. this.userInfoDetail = {}
  288. }
  289. },
  290. methods: {
  291. getMassage() {
  292. let params = {
  293. page: 1,
  294. limit: 1,
  295. status: 0,
  296. }
  297. messageListApi(params).then(res => {
  298. this.massageNum = res.data.total
  299. })
  300. },
  301. toUserInfo() {
  302. this.$navigateTo('/pages/user/user')
  303. if (this.isLogin) {
  304. this.$navigateTo('/pages/user/user')
  305. }
  306. },
  307. getUserInfo() {
  308. userInfoApi().then(res => {
  309. console.log(res, '详细用户信息')
  310. this.userInfoDetail = res.data
  311. // wx.setStorageSync('userInfo', res.data)
  312. this.userInfo = res.data
  313. })
  314. },
  315. toLogin() {
  316. wx.navigateTo({ url: '/pages/login/login' })
  317. },
  318. pageTo(url) {
  319. wx.navigateTo({ url: url })
  320. },
  321. showQRcode() {
  322. this.$refs.popup.open()
  323. },
  324. },
  325. }
  326. </script>
  327. <style scoped lang="scss">
  328. .btn {
  329. // border: none;
  330. outline: none;
  331. background: #232428;
  332. color: #bbbcc3;
  333. padding: 0;
  334. &::after {
  335. // border: none;
  336. }
  337. }
  338. .qrcodeImg {
  339. width: 70vw;
  340. position: relative;
  341. z-index: 1000;
  342. border-radius: 10rpx;
  343. }
  344. </style>