index.vue 9.9 KB

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