index.vue 9.9 KB

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