index.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  1. <template>
  2. <Container
  3. title="我的"
  4. :scrollStyle="{
  5. padding: 0
  6. }"
  7. :showBack="false"
  8. bgColor="url('https://openwork-oss.oss-cn-shenzhen.aliyuncs.com/uploads/question/2025/05/bHbLzGDSB07Gc0tqCVCI3NLUx4sbUU4KHKSolvBq.png') no-repeat; background-size:100% 422rpx;background-color:"
  9. >
  10. <view>
  11. <view class="user_box">
  12. <view class="box_left">
  13. <navigator url="/pages/user/settings">
  14. <image class="user_image" :src="userInfo.userpic"></image>
  15. </navigator>
  16. </view>
  17. <view class="box_center">
  18. <view class="user_name" v-if="is_login">{{ userInfo.username }} {{ userInfo.vip_info != null ? 'VIP' : '' }}</view>
  19. <navigator class="user_name" url="/pages/login/index" v-if="!is_login">请登录</navigator>
  20. <view class="user_info" v-if="userInfo.vip_info != null">有效期:{{ userInfo.vip_info.vip_end_time }}</view>
  21. </view>
  22. <view class="box_right">
  23. <navigator url="/pages/user/settings" class="setting_page" v-if="is_login">
  24. <uni-icons type="gear" size="30"></uni-icons>
  25. </navigator>
  26. </view>
  27. </view>
  28. <view class="page_content">
  29. <view class="navigator_list">
  30. <view class="navigator_list_vip">
  31. <navigator class="navigator_item_banner" url="/pages/recharge/index">
  32. <view class="navigator_title_vip_banner">
  33. <image
  34. class="vip-banner-image"
  35. src="https://openwork-oss.oss-cn-shenzhen.aliyuncs.com/uploads/question/2025/05/PVwRdwglRHKrCFFAG6gQWiBDZDLdDa1zuPg9wnj4.png"
  36. mode="aspectFill"
  37. ></image>
  38. </view>
  39. </navigator>
  40. </view>
  41. <view class="navigator_list_other">
  42. <navigator class="navigator_item_one" url="/pages/order/index">
  43. <view class="navigator_title">订单记录</view>
  44. <view class="navigator_title_ico"><uni-icons type="right" size="20"></uni-icons></view>
  45. </navigator>
  46. <navigator class="navigator_item_two" url="/pages/user/share">
  47. <view class="navigator_title">分享有礼</view>
  48. <view class="navigator_title_ico"><uni-icons type="right" size="20"></uni-icons></view>
  49. </navigator>
  50. <navigator class="navigator_item_three" url="/">
  51. <view class="navigator_title">邀请有礼</view>
  52. <view class="navigator_title_ico"><uni-icons type="right" size="20"></uni-icons></view>
  53. </navigator>
  54. </view>
  55. </view>
  56. <view class="packet_content" v-if="show_packet">
  57. <view class="close_btn" @click="closePacket">X</view>
  58. <image src="https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/icon/red_packet.gif" class="red_packet" @click="_getredpacket" />
  59. </view>
  60. </view>
  61. </view>
  62. <view class="service">
  63. <CustomerService>联系客服</CustomerService>
  64. </view>
  65. </Container>
  66. </template>
  67. <script>
  68. import Container from '../../components/Container/Container.vue';
  69. import CustomerService from '@/components/CustomerService/CustomerService.vue';
  70. export default {
  71. data() {
  72. return {
  73. userInfo: {
  74. username: '请登录',
  75. userpic: 'https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/icon/doctor.png',
  76. phone: 'kailin',
  77. status: 0,
  78. city_id: 0
  79. },
  80. is_login: 0,
  81. packetList: [],
  82. show_packet: false,
  83. windowHeight: 0
  84. };
  85. },
  86. onLoad(param) {
  87. // 存储分享标识
  88. if (param.share_uid) {
  89. uni.setStorageSync('share_uid', param.share_uid);
  90. console.log('share_uid', param.share_uid);
  91. }
  92. // #ifdef MP-WEIXIN
  93. //分享按钮
  94. uni.showShareMenu({
  95. withShareTicket: true,
  96. menus: ['shareAppMessage', 'shareTimeline']
  97. });
  98. // #endif
  99. },
  100. mounted() {
  101. this.updateWindowHeight();
  102. // 监听窗口变化(H5、小程序生效,App需用 onWindowResize)
  103. uni.onWindowResize((res) => {
  104. this.windowHeight = res.size.windowHeight;
  105. });
  106. console.log(this.windowHeight);
  107. },
  108. onShareAppMessage(obj) {
  109. // 店铺ID
  110. let shopId = uni.getStorageSync('shopId');
  111. //获取当前用户信息
  112. let userInfo = uni.getStorageSync('userInfo');
  113. let param = '?shop_id' + shopId;
  114. if (userInfo.uid) {
  115. param = '&share_uid=' + userInfo.uid;
  116. }
  117. // 获取分享信息
  118. let shareList = getApp().globalData.shareList;
  119. // 获取分享信息
  120. let shareObj = {
  121. title: '999智控终端平台\n药优惠 得积分 兑豪礼',
  122. //path: '/pages/score/lottery',
  123. path: '/pages/user/index',
  124. imageUrl: ''
  125. };
  126. // 循环列表
  127. for (let i in shareList) {
  128. if (shareList[i].pages == 'pages/user/index') {
  129. shareObj.path = shareList[i].path ? shareList[i].path : shareObj.path;
  130. shareObj.title = shareList[i].title ? `999智控终端平台\n${shareList[i].title}` : shareObj.title;
  131. shareObj.imageUrl = shareList[i].image_url ? shareList[i].image_url : shareObj.imageUrl;
  132. }
  133. }
  134. if (param) {
  135. shareObj.path += param;
  136. }
  137. // 返回分享信息
  138. return shareObj;
  139. },
  140. onShow() {
  141. // 登录提示
  142. this.is_login = this.$checkAccess.checkLogin();
  143. // 未登录不请求
  144. if (!this.is_login) {
  145. this.userInfo = {
  146. username: '请登录',
  147. userpic: 'https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/icon/doctor.png',
  148. phone: 'kailin',
  149. status: 0,
  150. city_id: 0,
  151. is_video_vip: 0,
  152. amount: 0.0,
  153. transfer_amount: 0.0
  154. };
  155. return;
  156. }
  157. // 判断数据
  158. this.$http.request('api/question_bank/question_reception/custom/get_info').then((callback) => {
  159. if (callback.code == 'success') {
  160. if (!callback.data.userpic) callback.data.userpic = 'https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/icon/doctor.png';
  161. // 赋值
  162. this.userInfo = callback.data;
  163. // 存储登录标识
  164. uni.setStorageSync('userInfo', callback.data);
  165. }
  166. });
  167. this._getPacketNum();
  168. },
  169. methods: {
  170. updateWindowHeight() {
  171. const systemInfo = uni.getSystemInfoSync();
  172. this.windowHeight = systemInfo.windowHeight;
  173. console.log(this.windowHeight);
  174. },
  175. _getredpacket() {
  176. let url = '/pages/redpacket/list';
  177. if (this.packetList.length == 1) {
  178. url = `/pages/redpacket/index?packet_id=${this.packetList[0].custom_redpacket_id}`;
  179. }
  180. uni.navigateTo({
  181. url: url
  182. });
  183. },
  184. _goWithdraw() {
  185. uni.navigateTo({
  186. url: '/pages/user/withdraw'
  187. });
  188. },
  189. _goBalance() {
  190. uni.navigateTo({
  191. url: '/pages/balance/index'
  192. });
  193. },
  194. closePacket() {
  195. this.show_packet = false;
  196. },
  197. onChange(e) {
  198. console.log(e);
  199. }
  200. }
  201. };
  202. </script>
  203. <style lang="scss" scoped>
  204. @import '@/uni.scss'; // 引入全局scss变量
  205. .page_content {
  206. background: #f8f8f8;
  207. }
  208. .user_box {
  209. width: 680rpx;
  210. height: 180rpx;
  211. overflow: hidden;
  212. padding: 10rpx 35rpx;
  213. .box_left {
  214. float: left;
  215. display: block;
  216. width: 140rpx;
  217. height: 140rpx;
  218. .user_image {
  219. display: block;
  220. width: 120rpx;
  221. height: 120rpx;
  222. border-radius: 50%;
  223. margin: 10rpx auto;
  224. }
  225. }
  226. .box_center {
  227. float: left;
  228. width: 300rpx;
  229. height: 140rpx;
  230. margin-left: 35rpx;
  231. .user_name {
  232. font-size: 30rpx;
  233. line-height: 80rpx;
  234. }
  235. .user_info {
  236. color: #999999;
  237. font-size: 24rpx;
  238. line-height: 60rpx;
  239. }
  240. }
  241. .box_right {
  242. float: right;
  243. width: 140rpx;
  244. height: 140rpx;
  245. font-size: 20rpx;
  246. line-height: 140rpx;
  247. .setting_page {
  248. width: 140rpx;
  249. height: 140rpx;
  250. display: block;
  251. overflow: hidden;
  252. .setting_icon {
  253. width: 60rpx;
  254. height: 60rpx;
  255. display: block;
  256. margin: 40rpx auto;
  257. }
  258. }
  259. .company_text {
  260. color: #e03519;
  261. width: 140rpx;
  262. height: 140rpx;
  263. font-size: 20rpx;
  264. text-align: center;
  265. line-height: 140rpx;
  266. }
  267. }
  268. }
  269. .navigator_list_vip {
  270. height: 108rpx;
  271. border-radius: 30rpx;
  272. background: #ffffff;
  273. margin-bottom: 50rpx;
  274. }
  275. .navigator_list_other {
  276. background: #ffffff;
  277. margin-bottom: 50rpx;
  278. height: 296rpx;
  279. }
  280. .navigator_title_vip_banner {
  281. width: 100%;
  282. display: block;
  283. height: 108rpx;
  284. font-size: 30rpx;
  285. .vip-banner-image {
  286. width: 100%;
  287. height: 108rpx;
  288. display: block;
  289. }
  290. }
  291. .navigator_list {
  292. border-top: 1rpx solid #eeeeee;
  293. height: 505rpx;
  294. margin: 30rpx;
  295. border-radius: 30rpx;
  296. .navigator_item_one {
  297. background: #ffffff;
  298. position: relative;
  299. border-radius: 30rpx 30rpx 0rpx 0rpx;
  300. }
  301. .navigator_item_two {
  302. background: #ffffff;
  303. position: relative;
  304. }
  305. .navigator_item_three {
  306. background: #ffffff;
  307. position: relative;
  308. border-radius: 0rpx 0rpx 30rpx 30rpx;
  309. }
  310. .navigator_title_ico {
  311. position: absolute;
  312. right: 30rpx;
  313. top: 25rpx;
  314. }
  315. .navigator_title {
  316. display: block;
  317. font-size: 30rpx;
  318. line-height: 40rpx;
  319. border-bottom: 1rpx solid #eeeeee;
  320. padding: 30rpx 30rpx;
  321. }
  322. }
  323. .alter_info {
  324. display: block;
  325. color: #e03519;
  326. font-size: 20rpx;
  327. overflow: hidden;
  328. margin: 20rpx auto;
  329. background: #ffffff;
  330. line-height: 40rpx;
  331. padding: 35rpx 35rpx;
  332. }
  333. .balance_content {
  334. margin: 20rpx;
  335. padding: 35rpx;
  336. background-color: #fff;
  337. box-sizing: border-box;
  338. .balance_content_main {
  339. display: flex;
  340. justify-content: space-between;
  341. align-items: center;
  342. margin-bottom: 36rpx;
  343. .price_content {
  344. display: flex;
  345. flex-direction: column;
  346. > .title {
  347. font-size: 24rpx;
  348. margin-bottom: 15rpx;
  349. }
  350. }
  351. .withdraw_btn {
  352. color: #ffffff;
  353. background-color: #169bd5;
  354. border-radius: 60rpx;
  355. padding: 10rpx 20rpx;
  356. width: 90rpx;
  357. text-align: center;
  358. line-height: 40rpx;
  359. }
  360. }
  361. .balance_content_detail {
  362. display: flex;
  363. justify-content: space-between;
  364. align-items: center;
  365. border-top: 2rpx solid #f3f3f3;
  366. font-size: 24rpx;
  367. padding-top: 18rpx;
  368. }
  369. }
  370. .packet_content {
  371. position: absolute;
  372. right: 0;
  373. bottom: 15%;
  374. width: 160rpx;
  375. height: 160rpx;
  376. .red_packet {
  377. width: 100%;
  378. height: 100%;
  379. }
  380. .close_btn {
  381. width: 40rpx;
  382. height: 40rpx;
  383. font-size: 24rpx;
  384. line-height: 40rpx;
  385. border-radius: 50%;
  386. border: 1rpx solid #ddd;
  387. display: flex;
  388. align-items: center;
  389. justify-content: center;
  390. position: absolute;
  391. top: 5rpx;
  392. left: 0;
  393. }
  394. }
  395. .service {
  396. position: absolute;
  397. bottom: 20%;
  398. right: 5%;
  399. color: $uni-primary;
  400. font-size: 28rpx;
  401. margin-bottom: 40rpx;
  402. text-align: right;
  403. }
  404. </style>