index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  1. <template>
  2. <view>
  3. <view class="user_box">
  4. <view class="box_left">
  5. <navigator url="/pages/user/settings">
  6. <image class="user_image" :src="userInfo.userpic"></image>
  7. </navigator>
  8. </view>
  9. <view class="box_center">
  10. <view class="user_name" v-if="is_login">{{ userInfo.username }}</view>
  11. <navigator class="user_name" url="/pages/login/index" v-if="!is_login">请登录</navigator>
  12. <view class="user_info">{{ userInfo.phone }}</view>
  13. </view>
  14. <view class="box_right">
  15. <navigator url="/pages/user/info" class="company_text" v-if="!userInfo.city_id">请选择城市</navigator>
  16. <navigator url="/pages/user/settings" class="setting_page" v-if="userInfo.city_id">
  17. <image class="setting_icon" src="https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/icon/setting.png"></image>
  18. </navigator>
  19. </view>
  20. </view>
  21. <view class="balance_content">
  22. <view class="balance_content_main">
  23. <view style="display: flex">
  24. <view class="price_content" style="margin-right: 45rpx">
  25. <text class="title">当前余额(元)</text> <text>{{ Number(userInfo.amount || 0).toFixed(2) }}</text></view
  26. >
  27. <view class="price_content">
  28. <text class="title">已成功提现(元)</text> <text>{{ Number(userInfo.transfer_amount || 0).toFixed(2) }}</text></view
  29. >
  30. </view>
  31. <view class="withdraw_btn" @click="_goWithdraw">提现</view>
  32. </view>
  33. <view class="balance_content_detail" @click="_goBalance">
  34. <view>查看余额明细</view>
  35. <view>></view>
  36. </view>
  37. </view>
  38. <view class="navigator_list">
  39. <navigator class="navigator_item" url="/pages/orders/index">
  40. <image class="navigator_image" src="https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/user/orders.png" mode=""></image>
  41. <view class="navigator_title">预约</view>
  42. </navigator>
  43. <navigator class="navigator_item" url="/pages/coupon/index">
  44. <image class="navigator_image" src="https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/user/coupon.png" mode=""></image>
  45. <view class="navigator_title">优惠券</view>
  46. </navigator>
  47. <navigator class="navigator_item" url="/pages/score/orders">
  48. <image class="navigator_image" src="https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/user/score.png" mode=""></image>
  49. <view class="navigator_title">积分订单</view>
  50. </navigator>
  51. <navigator class="navigator_item" url="/pages/recruitment/index">
  52. <image class="navigator_image" src="https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/user/newuser.png" mode=""></image>
  53. <view class="navigator_title">拉新活动</view>
  54. </navigator>
  55. </view>
  56. <view class="navigator_list">
  57. <navigator class="navigator_item" url="/pages/article/index">
  58. <image class="navigator_image" src="https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/user/article.png" mode=""></image>
  59. <view class="navigator_title">资讯</view>
  60. </navigator>
  61. <navigator class="navigator_item" url="/pages/video/index" v-if="userInfo.is_video_vip == 1">
  62. <image class="navigator_image" src="https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/user/video.png" mode=""></image>
  63. <view class="navigator_title">学习</view>
  64. </navigator>
  65. </view>
  66. <view class="alter_info">本程序暂不提供在线交易以及支付功能,您所提交的预约,我们将验证您的购药资质并交由有售卖药品资质的商业公司与您联系确认并提供线下后续服务。</view>
  67. <view class="packet_content" v-if="show_packet">
  68. <view class="close_btn" @click="closePacket"> X </view>
  69. <image src="https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/icon/red_packet.gif" class="red_packet" @click="_getredpacket" />
  70. </view>
  71. </view>
  72. </template>
  73. <script>
  74. export default {
  75. data() {
  76. return {
  77. userInfo: {
  78. username: '请登录',
  79. userpic: 'https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/icon/doctor.png',
  80. phone: 'kailin',
  81. status: 0,
  82. city_id: 0,
  83. is_video_vip:0,
  84. amount:0.00,
  85. transfer_amount:0.00
  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. //获取当前用户信息
  108. let userInfo = uni.getStorageSync('userInfo');
  109. let param = '';
  110. if (userInfo.uid) {
  111. param = '?share_uid=' + userInfo.uid;
  112. }
  113. // 获取分享信息
  114. let shareList = getApp().globalData.shareList;
  115. // 获取分享信息
  116. let shareObj = {
  117. title: '999智控终端平台\n药优惠 得积分 兑豪礼',
  118. //path: '/pages/score/lottery',
  119. path: '/pages/user/index',
  120. imageUrl: '',
  121. };
  122. // 循环列表
  123. for (let i in shareList) {
  124. if (shareList[i].pages == 'pages/user/index') {
  125. shareObj.path = shareList[i].path ? shareList[i].path : shareObj.path;
  126. shareObj.title = shareList[i].title ? `999智控终端平台\n${shareList[i].title}` : shareObj.title;
  127. shareObj.imageUrl = shareList[i].image_url ? shareList[i].image_url : shareObj.imageUrl;
  128. }
  129. }
  130. if (param) {
  131. shareObj.path += param;
  132. }
  133. // 返回分享信息
  134. return shareObj;
  135. },
  136. onShow() {
  137. this.is_login = this.$checkAccess.checkLogin()
  138. // 未登录不请求
  139. if ( !this.is_login ) {
  140. this.userInfo = {
  141. username: '请登录',
  142. userpic: 'https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/icon/doctor.png',
  143. phone: 'kailin',
  144. status: 0,
  145. city_id: 0,
  146. is_video_vip:0,
  147. amount:0.00,
  148. transfer_amount:0.00
  149. };
  150. return;
  151. }
  152. // 判断数据
  153. this.$http.request('api/custom/get_info').then((callback) => {
  154. if (callback.code == 'success') {
  155. if (!callback.data.userpic) callback.data.userpic = 'https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/icon/doctor.png';
  156. // 赋值
  157. this.userInfo = callback.data;
  158. // 存储登录标识
  159. uni.setStorageSync('userInfo', callback.data);
  160. }
  161. });
  162. this._getPacketNum();
  163. },
  164. methods: {
  165. _getredpacket() {
  166. let url = '/pages/redpacket/list';
  167. if (this.packetList.length == 1) {
  168. url = `/pages/redpacket/index?packet_id=${this.packetList[0].custom_redpacket_id}`;
  169. }
  170. uni.navigateTo({
  171. url: url,
  172. });
  173. },
  174. _goWithdraw() {
  175. uni.navigateTo({
  176. url: '/pages/user/withdraw',
  177. });
  178. },
  179. _goBalance() {
  180. uni.navigateTo({
  181. url: '/pages/balance/index',
  182. });
  183. },
  184. //获取红包数量是否展示红包领取页面
  185. _getPacketNum() {
  186. this.$http.request('api/redpacket/get_list').then((callback) => {
  187. if (callback.code == 'success') {
  188. this.packetList = callback.data.data || [];
  189. if (callback.data.data.length > 0) {
  190. this.show_packet = true;
  191. }
  192. }
  193. });
  194. },
  195. closePacket() {
  196. this.show_packet = false;
  197. },
  198. },
  199. };
  200. </script>
  201. <style lang="less">
  202. .user_box {
  203. width: 680rpx;
  204. height: 180rpx;
  205. overflow: hidden;
  206. background: #ffffff;
  207. padding: 10rpx 35rpx;
  208. .box_left {
  209. float: left;
  210. display: block;
  211. width: 140rpx;
  212. height: 140rpx;
  213. .user_image {
  214. display: block;
  215. width: 120rpx;
  216. height: 120rpx;
  217. border-radius: 50%;
  218. margin: 10rpx auto;
  219. }
  220. }
  221. .box_center {
  222. float: left;
  223. width: 300rpx;
  224. height: 140rpx;
  225. margin-left: 35rpx;
  226. .user_name {
  227. font-size: 30rpx;
  228. line-height: 80rpx;
  229. }
  230. .user_info {
  231. color: #999999;
  232. font-size: 24rpx;
  233. line-height: 60rpx;
  234. }
  235. }
  236. .box_right {
  237. float: right;
  238. width: 140rpx;
  239. height: 140rpx;
  240. font-size: 20rpx;
  241. line-height: 140rpx;
  242. .setting_page {
  243. width: 140rpx;
  244. height: 140rpx;
  245. display: block;
  246. overflow: hidden;
  247. .setting_icon {
  248. width: 60rpx;
  249. height: 60rpx;
  250. display: block;
  251. margin: 40rpx auto;
  252. }
  253. }
  254. .company_text {
  255. color: #e03519;
  256. width: 140rpx;
  257. height: 140rpx;
  258. font-size: 20rpx;
  259. text-align: center;
  260. line-height: 140rpx;
  261. }
  262. }
  263. }
  264. .navigator_list {
  265. display: flex; // 弹性盒模型
  266. overflow: hidden;
  267. margin: 20rpx auto;
  268. background: #ffffff;
  269. padding: 35rpx 0rpx;
  270. .navigator_item {
  271. float: left;
  272. height: 160rpx;
  273. display: block;
  274. // margin: 0rpx auto;
  275. text-align: center;
  276. width: 25%;
  277. .navigator_image {
  278. width: 80rpx;
  279. height: 80rpx;
  280. margin: 20rpx auto;
  281. border-radius: 5rpx;
  282. }
  283. .navigator_title {
  284. width: 100%;
  285. display: block;
  286. font-size: 30rpx;
  287. line-height: 40rpx;
  288. text-align: center;
  289. }
  290. }
  291. }
  292. .alter_info {
  293. display: block;
  294. color: #e03519;
  295. font-size: 20rpx;
  296. overflow: hidden;
  297. margin: 20rpx auto;
  298. background: #ffffff;
  299. line-height: 40rpx;
  300. padding: 35rpx 35rpx;
  301. }
  302. .balance_content {
  303. margin: 20rpx;
  304. padding: 35rpx;
  305. background-color: #fff;
  306. box-sizing: border-box;
  307. .balance_content_main {
  308. display: flex;
  309. justify-content: space-between;
  310. align-items: center;
  311. margin-bottom: 36rpx;
  312. .price_content {
  313. display: flex;
  314. flex-direction: column;
  315. > .title {
  316. font-size: 24rpx;
  317. margin-bottom: 15rpx;
  318. }
  319. }
  320. .withdraw_btn {
  321. color: #ffffff;
  322. background-color: #169bd5;
  323. border-radius: 60rpx;
  324. padding: 10rpx 20rpx;
  325. width: 90rpx;
  326. text-align: center;
  327. line-height: 40rpx;
  328. }
  329. }
  330. .balance_content_detail {
  331. display: flex;
  332. justify-content: space-between;
  333. align-items: center;
  334. border-top: 2rpx solid #f3f3f3;
  335. font-size: 24rpx;
  336. padding-top: 18rpx;
  337. }
  338. }
  339. .packet_content {
  340. position: absolute;
  341. right: 0;
  342. bottom: 15%;
  343. width: 160rpx;
  344. height: 160rpx;
  345. .red_packet {
  346. width: 100%;
  347. height: 100%;
  348. }
  349. .close_btn {
  350. width: 40rpx;
  351. height: 40rpx;
  352. font-size: 24rpx;
  353. line-height: 40rpx;
  354. border-radius: 50%;
  355. border: 1rpx solid #ddd;
  356. display: flex;
  357. align-items: center;
  358. justify-content: center;
  359. position: absolute;
  360. top: 5rpx;
  361. left: 0;
  362. }
  363. }
  364. </style>