index.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. <template>
  2. <view class="content">
  3. <view class="user-info">
  4. <view class="user-data">
  5. <view class="user-name">{{userData.nickName}}</view>
  6. <view class="user-phone">{{userData.phone}}</view>
  7. </view>
  8. <view class="user-img">
  9. <u-avatar :src="userData.headImage" size="160"></u-avatar>
  10. </view>
  11. </view>
  12. <scroll-view scroll-x class="member-box">
  13. <view class="member-card" @click="goToMemberCard()" v-if="memberInfo.status == 0">
  14. <view class="member-info">
  15. <view class="member-title">我的账号</view>
  16. <view class="member-text">您目前尚未开通会员</view>
  17. </view>
  18. <view class="member-handle">立即开通&nbsp;<u-icon name="arrow-right"></u-icon>
  19. </view>
  20. </view>
  21. <template v-else>
  22. <view class="member-card" @click="goToMemberCard()" v-for="(item, index) in studentList" :key="index">
  23. <view class="member-info">
  24. <view class="member-title">{{item.studentName}}</view>
  25. <view class="member-text">
  26. <view>剩余&nbsp;{{item.days}}&nbsp;天到期</view>
  27. </view>
  28. </view>
  29. <view class="member-handle">立即续费&nbsp;<u-icon name="arrow-right"></u-icon>
  30. </view>
  31. </view>
  32. </template>
  33. </scroll-view>
  34. <view class="user-handle" v-for="(item, index) in handleList" :key="index" @click="goToHandle(item)">
  35. <view class="handle-icon">
  36. <u-image :src="item.icon" mode="aspectFit" width="28px" height="28px"></u-image>
  37. </view>
  38. <view class="handle-label">
  39. <!-- <button type="primary" open-type="share" @click="share" v-if="item.path == 'share'" class="share-text">{{item.label}}</button> -->
  40. <text>{{item.label}}</text>
  41. </view>
  42. <view class="handle-arrow">
  43. <u-icon name="arrow-right" color="#cccccc" size="32"></u-icon>
  44. </view>
  45. </view>
  46. <u-top-tips ref="uTips"></u-top-tips>
  47. </view>
  48. </template>
  49. <script>
  50. const NET = require('@/utils/request')
  51. const API = require('@/config/api')
  52. export default {
  53. data() {
  54. return {
  55. userData: {
  56. headImage: '',
  57. userId: '',
  58. nickName: '',
  59. userName: '',
  60. phone: '',
  61. },
  62. memberInfo: {
  63. lastDays: 0,
  64. status: 0,
  65. },
  66. handleList: [{
  67. label: '订单管理',
  68. path: 'orderList',
  69. icon: API.getServerImg + 'dingdanguanli.png'
  70. },
  71. {
  72. label: '学员信息',
  73. path: 'studentList',
  74. icon: API.getServerImg + 'xueyuanxinxi.png'
  75. },
  76. {
  77. label: '我的优惠券',
  78. path: 'couponList',
  79. icon: API.getServerImg + 'youhiquan.png'
  80. },
  81. {
  82. label: '分享有礼',
  83. path: 'shareInfo',
  84. icon: API.getServerImg + 'liwu.png'
  85. },
  86. {
  87. label: '我的评价',
  88. path: 'evaluateList',
  89. icon: API.getServerImg + 'pingjia.png'
  90. },
  91. {
  92. label: '预约体验',
  93. path: 'subscribeList',
  94. icon: API.getServerImg + 'yuyue.png'
  95. },
  96. ],
  97. studentList: []
  98. }
  99. },
  100. onLoad() {
  101. if (uni.getStorageSync('userData')) {
  102. this.userData = uni.getStorageSync('userData')
  103. }
  104. },
  105. onShow() {
  106. NET.request(API.getAllStudentList, {}, 'POST').then(res => {
  107. this.studentList = res.data
  108. }).catch(error => {
  109. this.$refs.uTips.show({
  110. title: error.message,
  111. type: 'warning',
  112. })
  113. })
  114. NET.request(API.getMemberInfo, {}, 'POST').then(res => {
  115. this.memberInfo = res.data
  116. }).catch(error => {
  117. this.$refs.uTips.show({
  118. title: error.message,
  119. type: 'warning',
  120. })
  121. })
  122. },
  123. methods: {
  124. // 跳转开通会员
  125. goToMemberCard() {
  126. uni.navigateTo({
  127. url: '/pagesMain/memberCardList'
  128. });
  129. },
  130. // 跳转我的各列表界面
  131. goToHandle(site) {
  132. uni.navigateTo({
  133. url: '/pagesMain/' + site.path
  134. });
  135. },
  136. // 分享
  137. share() {
  138. uni.share({
  139. provider: "weixin",
  140. scene: "WXSceneSession",
  141. type: 1,
  142. summary: "我正在使用HBuilderX开发uni-app,赶紧跟我一起来体验!",
  143. success: function(res) {
  144. console.log("success:" + JSON.stringify(res));
  145. },
  146. fail: function(err) {
  147. console.log("fail:" + JSON.stringify(err));
  148. }
  149. });
  150. }
  151. }
  152. }
  153. </script>
  154. <style lang='scss'>
  155. @import "@/static/css/themes.scss";
  156. .content {
  157. width: 100%;
  158. height: 100vh;
  159. float: left;
  160. .user-info {
  161. width: 100%;
  162. height: 110px;
  163. float: left;
  164. .user-data {
  165. width: calc(100% - 110px);
  166. height: 110px;
  167. padding: 15px 0 15px 15px;
  168. float: left;
  169. .user-name {
  170. width: 100%;
  171. float: left;
  172. font-size: 24px;
  173. line-height: 30px;
  174. margin-top: 10px;
  175. white-space: nowrap;
  176. overflow: hidden;
  177. text-overflow: ellipsis;
  178. }
  179. .user-phone {
  180. width: 100%;
  181. color: #cccccc;
  182. line-height: 30px;
  183. float: left;
  184. white-space: nowrap;
  185. overflow: hidden;
  186. text-overflow: ellipsis;
  187. }
  188. }
  189. .user-img {
  190. width: 110px;
  191. height: 110px;
  192. padding: 15px;
  193. float: left;
  194. display: flex;
  195. align-items: center;
  196. justify-content: center;
  197. }
  198. }
  199. .member-box {
  200. white-space: nowrap;
  201. float: left;
  202. width: 100vw;
  203. height: 92px;
  204. .member-card {
  205. width: calc(100vw - 30px);
  206. display: inline-block;
  207. border-radius: 10px;
  208. background-color: $mainColor;
  209. padding: 15px;
  210. margin: 0 15px 20px 15px;
  211. position: relative;
  212. .member-info {
  213. width: calc(100% - 100px);
  214. float: left;
  215. .member-title {
  216. font-size: 18px;
  217. line-height: 20px;
  218. color: #FFFFFF;
  219. font-weight: bold;
  220. }
  221. .member-text {
  222. margin-top: 5px;
  223. line-height: 16px;
  224. color: #FFFFFF;
  225. }
  226. }
  227. .member-handle {
  228. width: 90px;
  229. height: 30px;
  230. margin-top: 6px;
  231. float: right;
  232. background-color: #FFFFFF;
  233. border-radius: 20px;
  234. font-size: 13px;
  235. color: $mainColor;
  236. text-align: center;
  237. font-weight: bold;
  238. line-height: 30px;
  239. }
  240. }
  241. }
  242. .user-handle {
  243. width: 100vw;
  244. height: 40px;
  245. float: left;
  246. padding: 0 15px;
  247. margin-bottom: 10px;
  248. display: flex;
  249. align-items: center;
  250. .handle-icon {
  251. width: 40px;
  252. height: 40px;
  253. text-align: center;
  254. line-height: 40px;
  255. display: flex;
  256. align-items: center;
  257. }
  258. .handle-label {
  259. height: 40px;
  260. flex: 1;
  261. margin-left: 10px;
  262. line-height: 40px;
  263. font-size: 15px;
  264. position: relative;
  265. }
  266. .handle-arrow {
  267. line-height: 40px;
  268. }
  269. .share-text {
  270. width: 100vw;
  271. padding: 0 65px;
  272. font-size: 16px;
  273. text-align: left;
  274. color: #303133;
  275. background-color: transparent;
  276. position: absolute;
  277. left: -65px;
  278. }
  279. .share-text:after {
  280. border: none;
  281. }
  282. }
  283. }
  284. </style>