index.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  1. <template>
  2. <view>
  3. <view class="user_box">
  4. <view class="box_left">
  5. <navigator url="/pages/user/settings">
  6. <image class="user_image" :src="userInfo.userpic"></image>
  7. </navigator>
  8. </view>
  9. <view class="box_center">
  10. <view class="user_name" v-if="is_login">{{ userInfo.username }} {{userInfo.vip_info !=null ? 'VIP':''}}</view>
  11. <navigator class="user_name" url="/pages/login/index" v-if="!is_login">请登录</navigator>
  12. <view class="user_info" v-if="userInfo.vip_info !=null ">有效期:{{ userInfo.vip_info.vip_end_time}}</view>
  13. </view>
  14. <view class="box_right">
  15. <navigator url="/pages/user/settings" class="setting_page" v-if="is_login">
  16. <image class="setting_icon" src="https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/icon/setting.png"></image>
  17. </navigator>
  18. </view>
  19. </view>
  20. <view class="navigator_list">
  21. <navigator class="navigator_item" url="/">
  22. <view class="navigator_title_vip">VIP展示信息</view>
  23. </navigator>
  24. <navigator class="navigator_item" url="/pages/orders/index">
  25. <view class="navigator_title">订单记录</view>
  26. <view class="navigator_title_ico">></view>
  27. </navigator>
  28. <navigator class="navigator_item" url="/">
  29. <view class="navigator_title">分享有礼</view>
  30. <view class="navigator_title_ico">></view>
  31. </navigator>
  32. <navigator class="navigator_item" url="/">
  33. <view class="navigator_title">邀请有礼</view>
  34. <view class="navigator_title_ico">></view>
  35. </navigator>
  36. </view>
  37. <view class="packet_content" v-if="show_packet">
  38. <view class="close_btn" @click="closePacket"> X </view>
  39. <image src="https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/icon/red_packet.gif" class="red_packet" @click="_getredpacket" />
  40. </view>
  41. </view>
  42. </template>
  43. <script>
  44. export default {
  45. data() {
  46. return {
  47. userInfo: {
  48. username: "请登录",
  49. userpic: "https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/icon/doctor.png",
  50. phone: "kailin",
  51. status: 0,
  52. city_id: 0,
  53. },
  54. is_login:0,
  55. packetList: [],
  56. show_packet: false,
  57. };
  58. },
  59. onLoad(param) {
  60. // 存储分享标识
  61. if (param.share_uid) {
  62. uni.setStorageSync("share_uid", param.share_uid);
  63. console.log("share_uid", param.share_uid);
  64. }
  65. // #ifdef MP-WEIXIN
  66. //分享按钮
  67. uni.showShareMenu({
  68. withShareTicket: true,
  69. menus: ["shareAppMessage", "shareTimeline"],
  70. });
  71. // #endif
  72. },
  73. onShareAppMessage(obj) {
  74. // 店铺ID
  75. let shopId = uni.getStorageSync("shopId");
  76. //获取当前用户信息
  77. let userInfo = uni.getStorageSync("userInfo");
  78. let param = "?shop_id"+shopId;
  79. if (userInfo.uid) {
  80. param = "&share_uid=" + userInfo.uid;
  81. }
  82. // 获取分享信息
  83. let shareList = getApp().globalData.shareList;
  84. // 获取分享信息
  85. let shareObj = {
  86. title: "999智控终端平台\n药优惠 得积分 兑豪礼",
  87. //path: '/pages/score/lottery',
  88. path: "/pages/user/index",
  89. imageUrl: "",
  90. };
  91. // 循环列表
  92. for (let i in shareList) {
  93. if (shareList[i].pages == "pages/user/index") {
  94. shareObj.path = shareList[i].path ? shareList[i].path : shareObj.path;
  95. shareObj.title = shareList[i].title ? `999智控终端平台\n${shareList[i].title}` : shareObj.title;
  96. shareObj.imageUrl = shareList[i].image_url ? shareList[i].image_url : shareObj.imageUrl;
  97. }
  98. }
  99. if (param) {
  100. shareObj.path += param;
  101. }
  102. // 返回分享信息
  103. return shareObj;
  104. },
  105. onShow() {
  106. // 登录提示
  107. this.is_login = this.$checkAccess.checkLogin()
  108. // 未登录不请求
  109. if ( !this.is_login ) {
  110. this.userInfo = {
  111. username: '请登录',
  112. userpic: 'https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/icon/doctor.png',
  113. phone: 'kailin',
  114. status: 0,
  115. city_id: 0,
  116. is_video_vip:0,
  117. amount:0.00,
  118. transfer_amount:0.00
  119. };
  120. return;
  121. }
  122. // 判断数据
  123. this.$http.request("api/question_bank/question_reception/custom/get_info").then((callback) => {
  124. if (callback.code == "success") {
  125. if (!callback.data.userpic) callback.data.userpic = "https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/icon/doctor.png";
  126. // 赋值
  127. this.userInfo = callback.data;
  128. // 存储登录标识
  129. uni.setStorageSync("userInfo", callback.data);
  130. }
  131. });
  132. },
  133. methods: {
  134. _getredpacket() {
  135. let url = "/pages/redpacket/list";
  136. if (this.packetList.length == 1) {
  137. url = `/pages/redpacket/index?packet_id=${this.packetList[0].custom_redpacket_id}`;
  138. }
  139. uni.navigateTo({
  140. url: url,
  141. });
  142. },
  143. _goWithdraw() {
  144. uni.navigateTo({
  145. url: "/pages/user/withdraw",
  146. });
  147. },
  148. _goBalance() {
  149. uni.navigateTo({
  150. url: "/pages/balance/index",
  151. });
  152. },
  153. closePacket() {
  154. this.show_packet = false;
  155. },
  156. },
  157. };
  158. </script>
  159. <style lang="less">
  160. .user_box {
  161. width: 680rpx;
  162. height: 180rpx;
  163. overflow: hidden;
  164. background: #ffffff;
  165. padding: 10rpx 35rpx;
  166. .box_left {
  167. float: left;
  168. display: block;
  169. width: 140rpx;
  170. height: 140rpx;
  171. .user_image {
  172. display: block;
  173. width: 120rpx;
  174. height: 120rpx;
  175. border-radius: 50%;
  176. margin: 10rpx auto;
  177. }
  178. }
  179. .box_center {
  180. float: left;
  181. width: 300rpx;
  182. height: 140rpx;
  183. margin-left: 35rpx;
  184. .user_name {
  185. font-size: 30rpx;
  186. line-height: 80rpx;
  187. }
  188. .user_info {
  189. color: #999999;
  190. font-size: 24rpx;
  191. line-height: 60rpx;
  192. }
  193. }
  194. .box_right {
  195. float: right;
  196. width: 140rpx;
  197. height: 140rpx;
  198. font-size: 20rpx;
  199. line-height: 140rpx;
  200. .setting_page {
  201. width: 140rpx;
  202. height: 140rpx;
  203. display: block;
  204. overflow: hidden;
  205. .setting_icon {
  206. width: 60rpx;
  207. height: 60rpx;
  208. display: block;
  209. margin: 40rpx auto;
  210. }
  211. }
  212. .company_text {
  213. color: #e03519;
  214. width: 140rpx;
  215. height: 140rpx;
  216. font-size: 20rpx;
  217. text-align: center;
  218. line-height: 140rpx;
  219. }
  220. }
  221. }
  222. .navigator_list {
  223. background: #ffffff;
  224. border-top: 1rpx solid #eeeeee;
  225. .navigator_item {
  226. position: relative;
  227. .navigator_title_ico{
  228. position: absolute;
  229. right: 30rpx;
  230. top: 20rpx;
  231. }
  232. .navigator_title {
  233. width: 100%;
  234. display: block;
  235. font-size: 30rpx;
  236. line-height: 40rpx;
  237. padding: 25rpx 30rpx;
  238. border-bottom: 1rpx solid #eeeeee;
  239. }
  240. .navigator_title_vip{
  241. width: 100%;
  242. display: block;
  243. font-size: 30rpx;
  244. line-height: 40rpx;
  245. padding: 35rpx 60rpx;
  246. border-bottom: 1rpx solid #eeeeee;
  247. font-size: 30rpx;
  248. }
  249. }
  250. }
  251. .alter_info {
  252. display: block;
  253. color: #e03519;
  254. font-size: 20rpx;
  255. overflow: hidden;
  256. margin: 20rpx auto;
  257. background: #ffffff;
  258. line-height: 40rpx;
  259. padding: 35rpx 35rpx;
  260. }
  261. .balance_content {
  262. margin: 20rpx;
  263. padding: 35rpx;
  264. background-color: #fff;
  265. box-sizing: border-box;
  266. .balance_content_main {
  267. display: flex;
  268. justify-content: space-between;
  269. align-items: center;
  270. margin-bottom: 36rpx;
  271. .price_content {
  272. display: flex;
  273. flex-direction: column;
  274. > .title {
  275. font-size: 24rpx;
  276. margin-bottom: 15rpx;
  277. }
  278. }
  279. .withdraw_btn {
  280. color: #ffffff;
  281. background-color: #169bd5;
  282. border-radius: 60rpx;
  283. padding: 10rpx 20rpx;
  284. width: 90rpx;
  285. text-align: center;
  286. line-height: 40rpx;
  287. }
  288. }
  289. .balance_content_detail {
  290. display: flex;
  291. justify-content: space-between;
  292. align-items: center;
  293. border-top: 2rpx solid #f3f3f3;
  294. font-size: 24rpx;
  295. padding-top: 18rpx;
  296. }
  297. }
  298. .packet_content {
  299. position: absolute;
  300. right: 0;
  301. bottom: 15%;
  302. width: 160rpx;
  303. height: 160rpx;
  304. .red_packet {
  305. width: 100%;
  306. height: 100%;
  307. }
  308. .close_btn {
  309. width: 40rpx;
  310. height: 40rpx;
  311. font-size: 24rpx;
  312. line-height: 40rpx;
  313. border-radius: 50%;
  314. border: 1rpx solid #ddd;
  315. display: flex;
  316. align-items: center;
  317. justify-content: center;
  318. position: absolute;
  319. top: 5rpx;
  320. left: 0;
  321. }
  322. }
  323. </style>