index.vue 11 KB

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