index.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  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/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/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. },
  173. methods: {
  174. _getredpacket() {
  175. let url = "/pages/redpacket/list";
  176. if (this.packetList.length == 1) {
  177. url = `/pages/redpacket/index?packet_id=${this.packetList[0].custom_redpacket_id}`;
  178. }
  179. uni.navigateTo({
  180. url: url,
  181. });
  182. },
  183. _goWithdraw() {
  184. uni.navigateTo({
  185. url: "/pages/user/withdraw",
  186. });
  187. },
  188. _goBalance() {
  189. uni.navigateTo({
  190. url: "/pages/balance/index",
  191. });
  192. },
  193. //获取红包数量是否展示红包领取页面
  194. _getPacketNum() {
  195. this.$http.request("api/redpacket/get_list").then((callback) => {
  196. if (callback.code == "success") {
  197. this.packetList = callback.data.data || [];
  198. if (callback.data.data.length > 0) {
  199. this.show_packet = true;
  200. }
  201. }
  202. });
  203. },
  204. closePacket() {
  205. this.show_packet = false;
  206. },
  207. onChange(e) {
  208. console.log(e);
  209. },
  210. },
  211. };
  212. </script>
  213. <style lang="scss" scoped>
  214. @import "@/uni.scss"; // 引入全局scss变量
  215. .user_box {
  216. width: 680rpx;
  217. height: 180rpx;
  218. overflow: hidden;
  219. background: #ffffff;
  220. padding: 10rpx 35rpx;
  221. .box_left {
  222. float: left;
  223. display: block;
  224. width: 140rpx;
  225. height: 140rpx;
  226. .user_image {
  227. display: block;
  228. width: 120rpx;
  229. height: 120rpx;
  230. border-radius: 50%;
  231. margin: 10rpx auto;
  232. }
  233. }
  234. .box_center {
  235. float: left;
  236. width: 300rpx;
  237. height: 140rpx;
  238. margin-left: 35rpx;
  239. .user_name {
  240. font-size: 30rpx;
  241. line-height: 80rpx;
  242. }
  243. .user_info {
  244. color: #999999;
  245. font-size: 24rpx;
  246. line-height: 60rpx;
  247. }
  248. }
  249. .box_right {
  250. float: right;
  251. width: 140rpx;
  252. height: 140rpx;
  253. font-size: 20rpx;
  254. line-height: 140rpx;
  255. .setting_page {
  256. width: 140rpx;
  257. height: 140rpx;
  258. display: block;
  259. overflow: hidden;
  260. .setting_icon {
  261. width: 60rpx;
  262. height: 60rpx;
  263. display: block;
  264. margin: 40rpx auto;
  265. }
  266. }
  267. .company_text {
  268. color: #e03519;
  269. width: 140rpx;
  270. height: 140rpx;
  271. font-size: 20rpx;
  272. text-align: center;
  273. line-height: 140rpx;
  274. }
  275. }
  276. }
  277. .navigator_list {
  278. background: #ffffff;
  279. border-top: 1rpx solid #eeeeee;
  280. .navigator_item {
  281. position: relative;
  282. .navigator_title_ico {
  283. position: absolute;
  284. right: 30rpx;
  285. top: 17rpx;
  286. }
  287. .navigator_title {
  288. width: 100%;
  289. display: block;
  290. font-size: 30rpx;
  291. line-height: 40rpx;
  292. padding: 20rpx 30rpx;
  293. border-bottom: 1rpx solid #eeeeee;
  294. }
  295. .navigator_title_vip {
  296. width: 100%;
  297. display: block;
  298. font-size: 30rpx;
  299. line-height: 40rpx;
  300. padding: 30rpx 60rpx;
  301. border-bottom: 1rpx solid #eeeeee;
  302. font-size: 30rpx;
  303. }
  304. }
  305. }
  306. .alter_info {
  307. display: block;
  308. color: #e03519;
  309. font-size: 20rpx;
  310. overflow: hidden;
  311. margin: 20rpx auto;
  312. background: #ffffff;
  313. line-height: 40rpx;
  314. padding: 35rpx 35rpx;
  315. }
  316. .balance_content {
  317. margin: 20rpx;
  318. padding: 35rpx;
  319. background-color: #fff;
  320. box-sizing: border-box;
  321. .balance_content_main {
  322. display: flex;
  323. justify-content: space-between;
  324. align-items: center;
  325. margin-bottom: 36rpx;
  326. .price_content {
  327. display: flex;
  328. flex-direction: column;
  329. > .title {
  330. font-size: 24rpx;
  331. margin-bottom: 15rpx;
  332. }
  333. }
  334. .withdraw_btn {
  335. color: #ffffff;
  336. background-color: #169bd5;
  337. border-radius: 60rpx;
  338. padding: 10rpx 20rpx;
  339. width: 90rpx;
  340. text-align: center;
  341. line-height: 40rpx;
  342. }
  343. }
  344. .balance_content_detail {
  345. display: flex;
  346. justify-content: space-between;
  347. align-items: center;
  348. border-top: 2rpx solid #f3f3f3;
  349. font-size: 24rpx;
  350. padding-top: 18rpx;
  351. }
  352. }
  353. .packet_content {
  354. position: absolute;
  355. right: 0;
  356. bottom: 15%;
  357. width: 160rpx;
  358. height: 160rpx;
  359. .red_packet {
  360. width: 100%;
  361. height: 100%;
  362. }
  363. .close_btn {
  364. width: 40rpx;
  365. height: 40rpx;
  366. font-size: 24rpx;
  367. line-height: 40rpx;
  368. border-radius: 50%;
  369. border: 1rpx solid #ddd;
  370. display: flex;
  371. align-items: center;
  372. justify-content: center;
  373. position: absolute;
  374. top: 5rpx;
  375. left: 0;
  376. }
  377. }
  378. .service {
  379. position: absolute;
  380. bottom: 20%;
  381. right: 5%;
  382. color: $uni-primary;
  383. font-size: 28rpx;
  384. margin-bottom: 40rpx;
  385. text-align: right;
  386. }
  387. </style>