index.vue 11 KB

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