index.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  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. this._getPacketNum();
  175. },
  176. methods: {
  177. updateWindowHeight() {
  178. const systemInfo = uni.getSystemInfoSync();
  179. this.windowHeight = systemInfo.windowHeight;
  180. console.log(this.windowHeight);
  181. },
  182. _getredpacket() {
  183. let url = '/pages/redpacket/list';
  184. if (this.packetList.length == 1) {
  185. url = `/pages/redpacket/index?packet_id=${this.packetList[0].custom_redpacket_id}`;
  186. }
  187. uni.navigateTo({
  188. url: url
  189. });
  190. },
  191. _goWithdraw() {
  192. uni.navigateTo({
  193. url: '/pages/user/withdraw'
  194. });
  195. },
  196. _goBalance() {
  197. uni.navigateTo({
  198. url: '/pages/balance/index'
  199. });
  200. },
  201. closePacket() {
  202. this.show_packet = false;
  203. },
  204. onChange(e) {
  205. console.log(e);
  206. }
  207. }
  208. };
  209. </script>
  210. <style lang="scss" scoped>
  211. @import '@/uni.scss'; // 引入全局scss变量
  212. .page_content {
  213. background: #f8f8f8;
  214. }
  215. .bg {
  216. width: 750rpx;
  217. height: 456rpx;
  218. }
  219. .user_box {
  220. width: 680rpx;
  221. height: 180rpx;
  222. overflow: hidden;
  223. padding: 10rpx 35rpx;
  224. .box_left {
  225. float: left;
  226. display: block;
  227. width: 140rpx;
  228. height: 140rpx;
  229. .user_image {
  230. display: block;
  231. width: 120rpx;
  232. height: 120rpx;
  233. border-radius: 50%;
  234. margin: 10rpx auto;
  235. }
  236. }
  237. .box_center {
  238. float: left;
  239. width: 300rpx;
  240. height: 140rpx;
  241. margin-left: 35rpx;
  242. .user_name {
  243. font-size: 30rpx;
  244. line-height: 80rpx;
  245. }
  246. .user_info {
  247. color: #999999;
  248. font-size: 24rpx;
  249. line-height: 60rpx;
  250. }
  251. }
  252. .box_right {
  253. float: right;
  254. width: 140rpx;
  255. height: 140rpx;
  256. font-size: 20rpx;
  257. line-height: 140rpx;
  258. .setting_page {
  259. width: 140rpx;
  260. height: 140rpx;
  261. display: block;
  262. overflow: hidden;
  263. .setting_icon {
  264. width: 60rpx;
  265. height: 60rpx;
  266. display: block;
  267. margin: 40rpx auto;
  268. }
  269. }
  270. .company_text {
  271. color: #e03519;
  272. width: 140rpx;
  273. height: 140rpx;
  274. font-size: 20rpx;
  275. text-align: center;
  276. line-height: 140rpx;
  277. }
  278. }
  279. }
  280. .navigator_list_vip {
  281. height: 108rpx;
  282. border-radius: 30rpx;
  283. background: #ffffff;
  284. margin-bottom: 50rpx;
  285. }
  286. .navigator_list_other {
  287. background: #ffffff;
  288. margin-bottom: 50rpx;
  289. height: 296rpx;
  290. }
  291. .navigator_title_vip_banner {
  292. width: 100%;
  293. display: block;
  294. height: 108rpx;
  295. font-size: 30rpx;
  296. .vip-banner-image {
  297. width: 100%;
  298. height: 108rpx;
  299. display: block;
  300. }
  301. }
  302. .navigator_list {
  303. border-top: 1rpx solid #eeeeee;
  304. height: 505rpx;
  305. margin: 30rpx;
  306. border-radius: 30rpx;
  307. .navigator_item_one {
  308. background: #ffffff;
  309. position: relative;
  310. border-radius: 30rpx 30rpx 0rpx 0rpx;
  311. }
  312. .navigator_item_two {
  313. background: #ffffff;
  314. position: relative;
  315. }
  316. .navigator_item_three {
  317. background: #ffffff;
  318. position: relative;
  319. border-radius: 0rpx 0rpx 30rpx 30rpx;
  320. }
  321. .navigator_title_ico {
  322. position: absolute;
  323. right: 30rpx;
  324. top: 25rpx;
  325. }
  326. .navigator_title {
  327. display: block;
  328. font-size: 30rpx;
  329. line-height: 40rpx;
  330. border-bottom: 1rpx solid #eeeeee;
  331. padding: 30rpx 30rpx;
  332. }
  333. }
  334. .alter_info {
  335. display: block;
  336. color: #e03519;
  337. font-size: 20rpx;
  338. overflow: hidden;
  339. margin: 20rpx auto;
  340. background: #ffffff;
  341. line-height: 40rpx;
  342. padding: 35rpx 35rpx;
  343. }
  344. .balance_content {
  345. margin: 20rpx;
  346. padding: 35rpx;
  347. background-color: #fff;
  348. box-sizing: border-box;
  349. .balance_content_main {
  350. display: flex;
  351. justify-content: space-between;
  352. align-items: center;
  353. margin-bottom: 36rpx;
  354. .price_content {
  355. display: flex;
  356. flex-direction: column;
  357. > .title {
  358. font-size: 24rpx;
  359. margin-bottom: 15rpx;
  360. }
  361. }
  362. .withdraw_btn {
  363. color: #ffffff;
  364. background-color: #169bd5;
  365. border-radius: 60rpx;
  366. padding: 10rpx 20rpx;
  367. width: 90rpx;
  368. text-align: center;
  369. line-height: 40rpx;
  370. }
  371. }
  372. .balance_content_detail {
  373. display: flex;
  374. justify-content: space-between;
  375. align-items: center;
  376. border-top: 2rpx solid #f3f3f3;
  377. font-size: 24rpx;
  378. padding-top: 18rpx;
  379. }
  380. }
  381. .packet_content {
  382. position: absolute;
  383. right: 0;
  384. bottom: 15%;
  385. width: 160rpx;
  386. height: 160rpx;
  387. .red_packet {
  388. width: 100%;
  389. height: 100%;
  390. }
  391. .close_btn {
  392. width: 40rpx;
  393. height: 40rpx;
  394. font-size: 24rpx;
  395. line-height: 40rpx;
  396. border-radius: 50%;
  397. border: 1rpx solid #ddd;
  398. display: flex;
  399. align-items: center;
  400. justify-content: center;
  401. position: absolute;
  402. top: 5rpx;
  403. left: 0;
  404. }
  405. }
  406. .service {
  407. position: absolute;
  408. bottom: 20%;
  409. right: 5%;
  410. color: $uni-primary;
  411. font-size: 28rpx;
  412. margin-bottom: 40rpx;
  413. text-align: right;
  414. }
  415. </style>