index.vue 8.5 KB

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