personal.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. <template>
  2. <div id="personal">
  3. <!-- 用户信息-->
  4. <div class="userinfo">
  5. <van-row class="padding">
  6. <van-col span="3" offset="2">
  7. <view class="cu-avatar radius lg" :style="'background-image:url('+userinfo.portrait+');'"></view>
  8. </van-col>
  9. <van-col span="12" offset="1">
  10. <div class="flex flex-direction align-start justify-start">
  11. <div>
  12. <text class="text-black text-bold">{{ userinfo.user_name }}</text>
  13. </div>
  14. <div class="flex justify-between align-center">
  15. <button class="cu-btn sm round level_btn">
  16. <template v-if="userinfo.level == 0">
  17. 普通会员
  18. </template>
  19. <template v-if="userinfo.level == 1">
  20. 体验会员
  21. </template>
  22. <template v-if="userinfo.level == 2">
  23. 黄金会员
  24. </template>
  25. <template v-if="userinfo.level == 3">
  26. 普通会员
  27. </template>
  28. <template v-if="userinfo.level == 4">
  29. 钻石会员
  30. </template>
  31. <template v-if="userinfo.level == 5">
  32. 创客代理
  33. </template>
  34. <template v-if="userinfo.level == 6">
  35. 区域代理
  36. </template>
  37. <template v-if="userinfo.level == 7">
  38. 合伙人
  39. </template>
  40. <template v-if="userinfo.level == 8">
  41. 店员
  42. </template>
  43. <template v-if="userinfo.level == 9">
  44. 店长
  45. </template>
  46. </button>
  47. <view class="text-xs padding-left">有效期至 2020.11.11</view>
  48. </div>
  49. </div>
  50. </van-col>
  51. <van-col span="5">
  52. <view class="text" @click="to_user_center">
  53. <text class="cuIcon-people"></text>
  54. <text class="under_line">会员中心</text>
  55. </view>
  56. </van-col>
  57. </van-row>
  58. <van-row class="padding">
  59. <view style="opacity: 0;">
  60. <van-col span="4" class="lg" offset="2">
  61. <text class="cuIcon-selection"></text>
  62. 积分:
  63. </van-col>
  64. <van-col span="8">
  65. <text class="text-white text-bold text-xxl jifen">{{ userinfo.experience }}</text>
  66. </van-col>
  67. </view>
  68. </van-row>
  69. <van-row>
  70. <van-col span="6" offset="2">
  71. <div class="flex flex-direction align-center">
  72. <text class="text-xxl">{{ userinfo.playtime }}</text>
  73. <text class="font-sm">可用时长(分钟)</text>
  74. </div>
  75. </van-col>
  76. <van-col span="6" offset="2">
  77. <div class="flex flex-direction align-center">
  78. <text class="text-xxl">{{ userinfo.coupon }}</text>
  79. <text class="font-sm">优惠券/码</text>
  80. </div>
  81. </van-col>
  82. <van-col span="6" offset="2">
  83. <div class="flex flex-direction align-center">
  84. <text class="text-xxl">{{ userinfo.experience }}</text>
  85. <text class="font-sm">次卡</text>
  86. </div>
  87. </van-col>
  88. </van-row>
  89. </div>
  90. <!-- 领券弹窗-->
  91. <van-popup :show="first" :close-on-click-overlay="false" custom-class="pop">
  92. <div class="quan_container">
  93. <van-row gutter="10">
  94. <van-col span="14" offset="1">
  95. <div class="padding-top-sm">
  96. <text class="title">
  97. 水母会员次卡体验券1张
  98. </text>
  99. </div>
  100. <div>
  101. <text class="subtitle">
  102. 2020.09.21 13:00之前领取有效
  103. </text>
  104. </div>
  105. <view class="padding-tb">
  106. <text class="time">
  107. 10
  108. </text>
  109. <text class="time_text">
  110. 分钟
  111. </text>
  112. </view>
  113. </van-col>
  114. <van-col span="5" offset="4" class="" @click="get_ticket">
  115. <view class="get_ticket_text">领取</view>
  116. </van-col>
  117. </van-row>
  118. </div>
  119. </van-popup>
  120. <!-- 窗口弹出-->
  121. <van-popup :show="pop_show" @close="close_pop" round :close-on-click-overlay="false">
  122. <div class="err_container flex flex-direction align-center justify-around">
  123. <view>
  124. <text class="title">
  125. 您当前剩余时间不足
  126. </text>
  127. </view>
  128. <view>
  129. <text class="sub-title">
  130. 请充值后进行游戏
  131. </text>
  132. </view>
  133. <img src="https://img.shuimuai.com/web/sign_notimeJfish.png" class="err_img" alt="">
  134. <button class="cu-btn lg bg-primary text-white" @click="to_recharge">立即充值</button>
  135. </div>
  136. </van-popup>
  137. </div>
  138. </template>
  139. <script>
  140. import {userDetail} from "../../requests/user";
  141. var $this
  142. export default {
  143. name: "personal",
  144. data() {
  145. return {
  146. userinfo: {
  147. portrait: 'https://img.shuimuai.com/weixintouxiang.png',
  148. user_name: "小疯兔屁屁",
  149. phone: "15627202057",
  150. experience: "0",
  151. playtime: 0,
  152. validity_time: "0",
  153. coupon: "0",
  154. level: 0,
  155. nick_name: ""
  156. //判断是否第一次进入小程序 1为是第一次 0为非第一次
  157. },
  158. first: 0,
  159. pop_show: false
  160. }
  161. },
  162. methods: {
  163. get_ticket() {
  164. this.userinfo.first = 0
  165. console.log('获取体验券');
  166. },
  167. close_pop() {
  168. this.pop_show = false
  169. },
  170. //跳转充值中心
  171. to_recharge() {
  172. mpvue.navigateTo({
  173. url: "/pages/user_center/recharge/main"
  174. })
  175. },
  176. //跳转用户中心
  177. to_user_center() {
  178. mpvue.navigateTo({
  179. url: "/pages/user_center/main"
  180. })
  181. }
  182. },
  183. mounted() {
  184. //获取用户信息
  185. //获取用户信息
  186. userDetail().then((res) => {
  187. let $data = res.data
  188. //判断如果是第一次登录就 弹出领取体验卡
  189. $this.userinfo = $data.data
  190. // if ($this.userinfo.login_time == 0) {
  191. // $this.first = true
  192. // } else if ($this.userinfo.play_time == 0) {
  193. // $this.pop_show = true
  194. // }
  195. $this.$store.commit('set_userinfo', $data.data);
  196. })
  197. },
  198. created() {
  199. $this = this
  200. }
  201. }
  202. </script>
  203. <style scoped>
  204. .userinfo {
  205. background-image: url("https://img.shuimuai.com/huiyuankadiban.png");
  206. background-position: center;
  207. background-size: 100% 100%;
  208. width: 95%;
  209. height: 181px;
  210. margin: 0px auto;
  211. }
  212. #personal {
  213. width: 100%;
  214. position: relative;
  215. top: -60px;
  216. z-index: 3;
  217. }
  218. .level_btn {
  219. background-color: #E3A000;
  220. }
  221. .jifen {
  222. position: absolute;
  223. top: 73px;
  224. }
  225. .font-sm {
  226. font-size: 10px;
  227. }
  228. .quan_container {
  229. background-image: url("https://img.shuimuai.com/web/index_item_quan.png");
  230. background-position: center;
  231. background-size: 100% 100%;
  232. width: 340px;
  233. height: 115px;
  234. }
  235. /*标题*/
  236. .quan_container .title {
  237. font-size: 15px;
  238. font-weight: 400;
  239. color: #030000;
  240. line-height: 24px;
  241. }
  242. /*子标题*/
  243. .quan_container .sub-title {
  244. font-size: 10px;
  245. font-weight: 400;
  246. color: #030000;
  247. line-height: 24px;
  248. }
  249. /*分钟数*/
  250. .quan_container .time {
  251. font-size: 36px;
  252. font-weight: 400;
  253. color: #030000;
  254. line-height: 24px;
  255. }
  256. /*分钟二字*/
  257. .quan_container .time_text {
  258. font-size: 12px;
  259. font-weight: 400;
  260. color: #030000;
  261. line-height: 24px;
  262. }
  263. /*领取二字*/
  264. .quan_container .get_ticket_text {
  265. font-size: 18px;
  266. font-weight: 400;
  267. color: #FFFFFF;
  268. line-height: 24px;
  269. margin: 45px 0px;
  270. }
  271. /*弹窗模块*/
  272. .err_container {
  273. width: 260px;
  274. height: 300px;
  275. border-radius: 5px;
  276. }
  277. /*标题*/
  278. .err_container .title {
  279. font-size: 20px;
  280. font-weight: bold;
  281. color: #4C4C4C;
  282. line-height: 24px;
  283. }
  284. /*子标题*/
  285. .err_container .sub-title {
  286. font-size: 12px;
  287. font-family: Microsoft YaHei;
  288. font-weight: 400;
  289. color: #4B4B4B;
  290. line-height: 24px;
  291. }
  292. .err_img {
  293. width: 73px;
  294. height: 83px;
  295. }
  296. </style>
  297. <style>
  298. .pop {
  299. background-color: rgba(255, 255, 255, 0) !important;
  300. }
  301. </style>