personal.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  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">有效期至 {{ userinfo['validity_time'] }}</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.play_time }}</text>
  73. <text class="font-sm">可用时长(分钟)</text>
  74. </div>
  75. </van-col>
  76. <van-col span="6" offset="2" @click="to_coupons">
  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. 新人有效
  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. <van-toast id="van-toast"/>
  138. </div>
  139. </template>
  140. <script>
  141. import {userDetail} from "../../requests/user";
  142. import {couponReceiveFirst} from "../../requests/coupons";
  143. import Toast from '../../../static/vant/toast/toast';
  144. import {formatTime} from "../../utils";
  145. import {reload_userinfo} from "../../utils/user";
  146. var $this
  147. export default {
  148. name: "personal",
  149. data() {
  150. return {
  151. userinfo: {
  152. //判断是否第一次进入小程序 1为是第一次 0为非第一次
  153. },
  154. first: 0,
  155. pop_show: false
  156. }
  157. },
  158. methods: {
  159. get_ticket() {
  160. couponReceiveFirst().then((res) => {
  161. let $res = res.data;
  162. if ($res.code == 0) {
  163. $this.first = false
  164. Toast.success($res.errmsg)
  165. } else {
  166. Toast.fail($res.errmsg)
  167. }
  168. })
  169. },
  170. close_pop() {
  171. this.pop_show = false
  172. },
  173. //跳转充值中心
  174. to_recharge() {
  175. mpvue.navigateTo({
  176. url: "/pages/user_center/recharge/main"
  177. })
  178. },
  179. //跳转用户中心
  180. to_user_center() {
  181. mpvue.navigateTo({
  182. url: "/pages/user_center/main"
  183. })
  184. },
  185. to_coupons() {
  186. mpvue.navigateTo({
  187. url: "/pages/coupons/main"
  188. })
  189. },
  190. },
  191. mounted() {
  192. reload_userinfo($this)
  193. $this.userinfo = wx.getStorageSync('userinfo')
  194. if ($this.userinfo.login_time == 0) {
  195. $this.first = true
  196. } else if ($this.userinfo.play_time == 0) {
  197. $this.pop_show = true
  198. }
  199. $this.userinfo.play_time = Math.ceil($this.userinfo.play_time / 60)
  200. }
  201. ,
  202. onShow() {
  203. console.log(1)
  204. reload_userinfo($this)
  205. }
  206. ,
  207. created() {
  208. $this = this
  209. }
  210. }
  211. </script>
  212. <style scoped>
  213. .userinfo {
  214. background-image: url("https://img.shuimuai.com/huiyuankadiban.png");
  215. background-position: center;
  216. background-size: 100% 100%;
  217. width: 95%;
  218. height: 181px;
  219. margin: 0px auto;
  220. }
  221. #personal {
  222. width: 100%;
  223. position: relative;
  224. top: -95px;
  225. z-index: 3;
  226. }
  227. .level_btn {
  228. background-color: #E3A000;
  229. }
  230. .jifen {
  231. position: absolute;
  232. top: 73px;
  233. }
  234. .font-sm {
  235. font-size: 10px;
  236. }
  237. .quan_container {
  238. background-image: url("https://img.shuimuai.com/web/index_item_quan.png");
  239. background-position: center;
  240. background-size: 100% 100%;
  241. width: 340px;
  242. height: 115px;
  243. }
  244. /*标题*/
  245. .quan_container .title {
  246. font-size: 15px;
  247. font-weight: 400;
  248. color: #030000;
  249. line-height: 24px;
  250. }
  251. /*子标题*/
  252. .quan_container .sub-title {
  253. font-size: 10px;
  254. font-weight: 400;
  255. color: #030000;
  256. line-height: 24px;
  257. }
  258. /*分钟数*/
  259. .quan_container .time {
  260. font-size: 36px;
  261. font-weight: 400;
  262. color: #030000;
  263. line-height: 24px;
  264. }
  265. /*分钟二字*/
  266. .quan_container .time_text {
  267. font-size: 12px;
  268. font-weight: 400;
  269. color: #030000;
  270. line-height: 24px;
  271. }
  272. /*领取二字*/
  273. .quan_container .get_ticket_text {
  274. font-size: 18px;
  275. font-weight: 400;
  276. color: #FFFFFF;
  277. line-height: 24px;
  278. margin: 45px 0px;
  279. }
  280. /*弹窗模块*/
  281. .err_container {
  282. width: 260px;
  283. height: 300px;
  284. border-radius: 5px;
  285. }
  286. /*标题*/
  287. .err_container .title {
  288. font-size: 20px;
  289. font-weight: bold;
  290. color: #4C4C4C;
  291. line-height: 24px;
  292. }
  293. /*子标题*/
  294. .err_container .sub-title {
  295. font-size: 12px;
  296. font-family: Microsoft YaHei;
  297. font-weight: 400;
  298. color: #4B4B4B;
  299. line-height: 24px;
  300. }
  301. .err_img {
  302. width: 73px;
  303. height: 83px;
  304. }
  305. </style>
  306. <style>
  307. .pop {
  308. background-color: rgba(255, 255, 255, 0) !important;
  309. }
  310. </style>