index.vue 9.5 KB

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