index.vue 13 KB

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