index.vue 9.6 KB

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