index.vue 9.7 KB

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