index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  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 ) return;
  140. // 判断数据
  141. this.$http.request('api/custom/get_info').then((callback) => {
  142. if (callback.code == 'success') {
  143. if (!callback.data.userpic) callback.data.userpic = 'https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/icon/doctor.png';
  144. // 赋值
  145. this.userInfo = callback.data;
  146. // 存储登录标识
  147. uni.setStorageSync('userInfo', callback.data);
  148. }
  149. });
  150. this._getPacketNum();
  151. },
  152. methods: {
  153. _getredpacket() {
  154. let url = '/pages/redpacket/list';
  155. if (this.packetList.length == 1) {
  156. url = `/pages/redpacket/index?packet_id=${this.packetList[0].custom_redpacket_id}`;
  157. }
  158. uni.navigateTo({
  159. url: url,
  160. });
  161. },
  162. _goWithdraw() {
  163. uni.navigateTo({
  164. url: '/pages/user/withdraw',
  165. });
  166. },
  167. _goBalance() {
  168. uni.navigateTo({
  169. url: '/pages/balance/index',
  170. });
  171. },
  172. //获取红包数量是否展示红包领取页面
  173. _getPacketNum() {
  174. this.$http.request('api/redpacket/get_list').then((callback) => {
  175. if (callback.code == 'success') {
  176. this.packetList = callback.data.data || [];
  177. if (callback.data.data.length > 0) {
  178. this.show_packet = true;
  179. }
  180. }
  181. });
  182. },
  183. closePacket() {
  184. this.show_packet = false;
  185. },
  186. },
  187. };
  188. </script>
  189. <style lang="less">
  190. .user_box {
  191. width: 680rpx;
  192. height: 180rpx;
  193. overflow: hidden;
  194. background: #ffffff;
  195. padding: 10rpx 35rpx;
  196. .box_left {
  197. float: left;
  198. display: block;
  199. width: 140rpx;
  200. height: 140rpx;
  201. .user_image {
  202. display: block;
  203. width: 120rpx;
  204. height: 120rpx;
  205. border-radius: 50%;
  206. margin: 10rpx auto;
  207. }
  208. }
  209. .box_center {
  210. float: left;
  211. width: 300rpx;
  212. height: 140rpx;
  213. margin-left: 35rpx;
  214. .user_name {
  215. font-size: 30rpx;
  216. line-height: 80rpx;
  217. }
  218. .user_info {
  219. color: #999999;
  220. font-size: 24rpx;
  221. line-height: 60rpx;
  222. }
  223. }
  224. .box_right {
  225. float: right;
  226. width: 140rpx;
  227. height: 140rpx;
  228. font-size: 20rpx;
  229. line-height: 140rpx;
  230. .setting_page {
  231. width: 140rpx;
  232. height: 140rpx;
  233. display: block;
  234. overflow: hidden;
  235. .setting_icon {
  236. width: 60rpx;
  237. height: 60rpx;
  238. display: block;
  239. margin: 40rpx auto;
  240. }
  241. }
  242. .company_text {
  243. color: #e03519;
  244. width: 140rpx;
  245. height: 140rpx;
  246. font-size: 20rpx;
  247. text-align: center;
  248. line-height: 140rpx;
  249. }
  250. }
  251. }
  252. .navigator_list {
  253. display: flex; // 弹性盒模型
  254. overflow: hidden;
  255. margin: 20rpx auto;
  256. background: #ffffff;
  257. padding: 35rpx 0rpx;
  258. .navigator_item {
  259. float: left;
  260. height: 160rpx;
  261. display: block;
  262. // margin: 0rpx auto;
  263. text-align: center;
  264. width: 25%;
  265. .navigator_image {
  266. width: 80rpx;
  267. height: 80rpx;
  268. margin: 20rpx auto;
  269. border-radius: 5rpx;
  270. }
  271. .navigator_title {
  272. width: 100%;
  273. display: block;
  274. font-size: 30rpx;
  275. line-height: 40rpx;
  276. text-align: center;
  277. }
  278. }
  279. }
  280. .alter_info {
  281. display: block;
  282. color: #e03519;
  283. font-size: 20rpx;
  284. overflow: hidden;
  285. margin: 20rpx auto;
  286. background: #ffffff;
  287. line-height: 40rpx;
  288. padding: 35rpx 35rpx;
  289. }
  290. .balance_content {
  291. margin: 20rpx;
  292. padding: 35rpx;
  293. background-color: #fff;
  294. box-sizing: border-box;
  295. .balance_content_main {
  296. display: flex;
  297. justify-content: space-between;
  298. align-items: center;
  299. margin-bottom: 36rpx;
  300. .price_content {
  301. display: flex;
  302. flex-direction: column;
  303. > .title {
  304. font-size: 24rpx;
  305. margin-bottom: 15rpx;
  306. }
  307. }
  308. .withdraw_btn {
  309. color: #ffffff;
  310. background-color: #169bd5;
  311. border-radius: 60rpx;
  312. padding: 10rpx 20rpx;
  313. width: 90rpx;
  314. text-align: center;
  315. line-height: 40rpx;
  316. }
  317. }
  318. .balance_content_detail {
  319. display: flex;
  320. justify-content: space-between;
  321. align-items: center;
  322. border-top: 2rpx solid #f3f3f3;
  323. font-size: 24rpx;
  324. padding-top: 18rpx;
  325. }
  326. }
  327. .packet_content {
  328. position: absolute;
  329. right: 0;
  330. bottom: 15%;
  331. width: 160rpx;
  332. height: 160rpx;
  333. .red_packet {
  334. width: 100%;
  335. height: 100%;
  336. }
  337. .close_btn {
  338. width: 40rpx;
  339. height: 40rpx;
  340. font-size: 24rpx;
  341. line-height: 40rpx;
  342. border-radius: 50%;
  343. border: 1rpx solid #ddd;
  344. display: flex;
  345. align-items: center;
  346. justify-content: center;
  347. position: absolute;
  348. top: 5rpx;
  349. left: 0;
  350. }
  351. }
  352. </style>