index.vue 11 KB

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