index.vue 9.8 KB

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