index.vue 10.0 KB

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