index.vue 11 KB

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