index.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  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 }}</view>
  11. <navigator class="user_name" url="/pages/login/index" v-if="!is_login">请登录</navigator>
  12. <view class="user_info">{{ userInfo.phone }}</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/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. this._getPacketNum();
  133. },
  134. methods: {
  135. _getredpacket() {
  136. let url = "/pages/redpacket/list";
  137. if (this.packetList.length == 1) {
  138. url = `/pages/redpacket/index?packet_id=${this.packetList[0].custom_redpacket_id}`;
  139. }
  140. uni.navigateTo({
  141. url: url,
  142. });
  143. },
  144. _goWithdraw() {
  145. uni.navigateTo({
  146. url: "/pages/user/withdraw",
  147. });
  148. },
  149. _goBalance() {
  150. uni.navigateTo({
  151. url: "/pages/balance/index",
  152. });
  153. },
  154. //获取红包数量是否展示红包领取页面
  155. _getPacketNum() {
  156. this.$http.request("api/redpacket/get_list").then((callback) => {
  157. if (callback.code == "success") {
  158. this.packetList = callback.data.data || [];
  159. if (callback.data.data.length > 0) {
  160. this.show_packet = true;
  161. }
  162. }
  163. });
  164. },
  165. closePacket() {
  166. this.show_packet = false;
  167. },
  168. },
  169. };
  170. </script>
  171. <style lang="less">
  172. .user_box {
  173. width: 680rpx;
  174. height: 180rpx;
  175. overflow: hidden;
  176. background: #ffffff;
  177. padding: 10rpx 35rpx;
  178. .box_left {
  179. float: left;
  180. display: block;
  181. width: 140rpx;
  182. height: 140rpx;
  183. .user_image {
  184. display: block;
  185. width: 120rpx;
  186. height: 120rpx;
  187. border-radius: 50%;
  188. margin: 10rpx auto;
  189. }
  190. }
  191. .box_center {
  192. float: left;
  193. width: 300rpx;
  194. height: 140rpx;
  195. margin-left: 35rpx;
  196. .user_name {
  197. font-size: 30rpx;
  198. line-height: 80rpx;
  199. }
  200. .user_info {
  201. color: #999999;
  202. font-size: 24rpx;
  203. line-height: 60rpx;
  204. }
  205. }
  206. .box_right {
  207. float: right;
  208. width: 140rpx;
  209. height: 140rpx;
  210. font-size: 20rpx;
  211. line-height: 140rpx;
  212. .setting_page {
  213. width: 140rpx;
  214. height: 140rpx;
  215. display: block;
  216. overflow: hidden;
  217. .setting_icon {
  218. width: 60rpx;
  219. height: 60rpx;
  220. display: block;
  221. margin: 40rpx auto;
  222. }
  223. }
  224. .company_text {
  225. color: #e03519;
  226. width: 140rpx;
  227. height: 140rpx;
  228. font-size: 20rpx;
  229. text-align: center;
  230. line-height: 140rpx;
  231. }
  232. }
  233. }
  234. .navigator_list {
  235. background: #ffffff;
  236. border-top: 1rpx solid #eeeeee;
  237. .navigator_item {
  238. position: relative;
  239. .navigator_title_ico{
  240. position: absolute;
  241. right: 30rpx;
  242. top: 17rpx;
  243. }
  244. .navigator_title {
  245. width: 100%;
  246. display: block;
  247. font-size: 30rpx;
  248. line-height: 40rpx;
  249. padding: 20rpx 30rpx;
  250. border-bottom: 1rpx solid #eeeeee;
  251. }
  252. .navigator_title_vip{
  253. width: 100%;
  254. display: block;
  255. font-size: 30rpx;
  256. line-height: 40rpx;
  257. padding: 30rpx 60rpx;
  258. border-bottom: 1rpx solid #eeeeee;
  259. font-size: 30rpx;
  260. }
  261. }
  262. }
  263. .alter_info {
  264. display: block;
  265. color: #e03519;
  266. font-size: 20rpx;
  267. overflow: hidden;
  268. margin: 20rpx auto;
  269. background: #ffffff;
  270. line-height: 40rpx;
  271. padding: 35rpx 35rpx;
  272. }
  273. .balance_content {
  274. margin: 20rpx;
  275. padding: 35rpx;
  276. background-color: #fff;
  277. box-sizing: border-box;
  278. .balance_content_main {
  279. display: flex;
  280. justify-content: space-between;
  281. align-items: center;
  282. margin-bottom: 36rpx;
  283. .price_content {
  284. display: flex;
  285. flex-direction: column;
  286. > .title {
  287. font-size: 24rpx;
  288. margin-bottom: 15rpx;
  289. }
  290. }
  291. .withdraw_btn {
  292. color: #ffffff;
  293. background-color: #169bd5;
  294. border-radius: 60rpx;
  295. padding: 10rpx 20rpx;
  296. width: 90rpx;
  297. text-align: center;
  298. line-height: 40rpx;
  299. }
  300. }
  301. .balance_content_detail {
  302. display: flex;
  303. justify-content: space-between;
  304. align-items: center;
  305. border-top: 2rpx solid #f3f3f3;
  306. font-size: 24rpx;
  307. padding-top: 18rpx;
  308. }
  309. }
  310. .packet_content {
  311. position: absolute;
  312. right: 0;
  313. bottom: 15%;
  314. width: 160rpx;
  315. height: 160rpx;
  316. .red_packet {
  317. width: 100%;
  318. height: 100%;
  319. }
  320. .close_btn {
  321. width: 40rpx;
  322. height: 40rpx;
  323. font-size: 24rpx;
  324. line-height: 40rpx;
  325. border-radius: 50%;
  326. border: 1rpx solid #ddd;
  327. display: flex;
  328. align-items: center;
  329. justify-content: center;
  330. position: absolute;
  331. top: 5rpx;
  332. left: 0;
  333. }
  334. }
  335. </style>