index.vue 10 KB

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