index.vue 11 KB

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