index.vue 11 KB

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