index.vue 9.7 KB

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