index.vue 9.9 KB

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