index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  1. <template>
  2. <view class="my">
  3. <view class="top-box">
  4. <view class="user-info">
  5. <image class="image" :src="userInfo.imgPath || defaultImg" lazy-load mode=""></image>
  6. <view class="info">
  7. <view class="user-name">{{userInfo.nickname ||'用户'}}</view>
  8. <view class="tel" :style="{color:filterMeal(userInfo.setMealCode).color,backgroundColor:filterMeal(userInfo.setMealCode).bgColor}">{{filterMeal(userInfo.setMealCode).setMealName ||'开通会员'}}</view>
  9. </view>
  10. <image class="setting" src="../../static/edit-icon.png" @click="setting" mode=""></image>
  11. </view>
  12. <view class="level-box" @click="jump('../../my/memberCenter/index')">
  13. <view class="level-content">
  14. <image class="level" :src="`../../static/level${levelImgNameObj[userInfo.setMealCode]|| 0}.png`" mode=""></image>
  15. <!-- <view class="num" v-if="userInfo.setMealCode&&(userInfo.setMealCode!=0)" :style="{color:filterMeal(userInfo.setMealCode).bgColor}">
  16. 已为您节省99元
  17. </view> -->
  18. </view>
  19. </view>
  20. </view>
  21. <view class="box">
  22. <view class="box-title">
  23. 我的订单
  24. </view>
  25. <view class="btn-group">
  26. <view class="item" @click="jump('../../my/order/index')">
  27. <image class="icon" src="../../static/my/icon1.png" mode=""></image>
  28. <view class="label">
  29. 全部订单
  30. </view>
  31. </view>
  32. <view class="item" @click="jump('../../my/order/index?type=WAIT_PAYMENT')">
  33. <image class="icon" src="../../static/my/icon2.png" mode=""></image>
  34. <view class="label">
  35. 待付款
  36. </view>
  37. </view>
  38. <view class="item" @click="jump('../../my/order/index?type=WAIT_USE')">
  39. <image class="icon" src="../../static/my/icon3.png" mode=""></image>
  40. <view class="label">
  41. 待使用
  42. </view>
  43. </view>
  44. <view class="item" @click="jump('../../my/order/index?type=APPLY_REFUND')">
  45. <image class="icon" src="../../static/my/icon4.png" mode=""></image>
  46. <view class="label">
  47. 退款
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. <view class="type-box">
  53. <view class="type-item" @click="jump('/my/coupon/index')">
  54. <view class="left">
  55. <view class="title">
  56. 我的优惠券
  57. </view>
  58. <view class="desc">
  59. 会员享受更多优惠
  60. </view>
  61. </view>
  62. <image class="icon" src="../../static/type-icon1.png" mode=""></image>
  63. </view>
  64. <view class="type-item" @click="jump('/invite/index')">
  65. <view class="left">
  66. <view class="title">
  67. 推广邀请
  68. </view>
  69. <view class="desc">
  70. 百万佣金发放中
  71. </view>
  72. </view>
  73. <image class="icon" src="../../static/type-icon2.png" mode=""></image>
  74. </view>
  75. </view>
  76. <u-cell-group :border="false">
  77. <!-- <u-cell title="优惠券" @click="jump('../../my/coupon/index')" :border="false" :isLink="true" arrow-direction="right">
  78. <image slot="icon" class="cell-icon" src="../../static/icon7.png" mode=""></image>
  79. </u-cell> -->
  80. <!-- <u-cell title="研学MBTI测试" @click="jump('../../study/test')" :border="false" :isLink="true" arrow-direction="right">
  81. <image slot="icon" class="cell-icon" src="../../static/icon8.png" mode=""></image>
  82. </u-cell> -->
  83. <!-- <u-cell title="会员激活" @click="jump('../../my/vipActivation/index')" :border="false" :isLink="true" arrow-direction="right">
  84. <image slot="icon" class="cell-icon" src="../../static/vip-icon.png" mode=""></image>
  85. </u-cell> -->
  86. <u-cell title="设置" @click="jump('../../my/edit/edit')" :border="false" :isLink="true" arrow-direction="right">
  87. <image slot="icon" class="cell-icon" src="../../static/setting-icon.png" mode=""></image>
  88. </u-cell>
  89. <u-cell title="客服" @click="jump('../../my/service/index')" :border="false" :isLink="true" arrow-direction="right">
  90. <image slot="icon" class="cell-icon" src="../../static/service-icon.png" mode=""></image>
  91. </u-cell>
  92. <!-- <u-cell title="订阅" @click="Subscribe" :border="false" :isLink="true" arrow-direction="right">
  93. <image slot="icon" class="cell-icon" src="../../static/service-icon.png" mode=""></image>
  94. </u-cell> -->
  95. </u-cell-group>
  96. </view>
  97. </template>
  98. <script>
  99. import {
  100. getUserDetail
  101. } from '@/api/common.js'
  102. import {mealList} from '@/api/combo.js'
  103. import {levelImgName} from '@/utils/config.js'
  104. export default {
  105. data() {
  106. return {
  107. active: 1,
  108. keyword: '',
  109. userId: '',
  110. loading: false,
  111. status: 'more',
  112. defaultImg: 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fci.xiaohongshu.com%2Fc34b7b74-ba38-0456-982a-43c0f97522fe%3FimageView2%2F2%2Fw%2F1080%2Fformat%2Fjpg&refer=http%3A%2F%2Fci.xiaohongshu.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1693532127&t=a2e186c12aecaab7723611cb52a6778f',
  113. userInfo: {
  114. imgPath: null,
  115. lastLogin: "",
  116. level: null,
  117. nickname: null,
  118. openId: "",
  119. phoneNum: "",
  120. sex: 0,
  121. userId: "",
  122. valid: 0,
  123. setMealCode:0
  124. },
  125. levelImgNameObj:levelImgName,
  126. list:[],//套餐列表
  127. }
  128. },
  129. onShow() {
  130. if (uni.getStorageSync('token')) {
  131. this.getUserDetail()
  132. }else{
  133. this.userInfo = {
  134. imgPath: null,
  135. lastLogin: "",
  136. level: null,
  137. nickname: null,
  138. openId: "",
  139. phoneNum: "",
  140. sex: 0,
  141. userId: "",
  142. valid: 0
  143. },
  144. uni.showModal({
  145. title:'请登录',
  146. confirmText:'去登录',
  147. success(res){
  148. if(res.confirm){
  149. uni.navigateTo({
  150. url:'../../login/login/login?redirect=/pages/my/index'
  151. })
  152. }
  153. }
  154. })
  155. }
  156. },
  157. onLoad() {
  158. this.mealList()
  159. },
  160. methods: {
  161. Subscribe(){
  162. wx.requestSubscribeMessage({
  163. tmplIds: ['2MWtGXO1dOgEieVbIoBicAdLUj945Nv__4K2vh-Pk9Q'],
  164. success (res) {
  165. console.log(res);
  166. uni.showToast({
  167. title:'订阅成功'
  168. })
  169. },
  170. fail(){
  171. uni.showToast({
  172. title:'订阅失败'
  173. })
  174. }
  175. })
  176. },
  177. filterMeal(val) {
  178. let color
  179. let bgColor
  180. let setMealName
  181. this.list.filter(item=>{
  182. if(item.setMealCode == val){
  183. color = item.colour
  184. bgColor = item.backColour
  185. setMealName = item.setMealName
  186. }
  187. })
  188. return {
  189. color,bgColor,setMealName
  190. }
  191. },
  192. // 点击设置
  193. setting() {
  194. if (uni.getStorageSync('token')) {
  195. uni.navigateTo({
  196. url: '../../my/edit/edit'
  197. })
  198. } else {
  199. uni.showModal({
  200. title:'请登录',
  201. confirmText:'去登录',
  202. success(res){
  203. console.log(res);
  204. if(res.confirm){
  205. uni.navigateTo({
  206. url:'../../login/login/login?redirect=/pages/my/index'
  207. })
  208. }
  209. }
  210. })
  211. }
  212. },
  213. jump(url) {
  214. if(!uni.getStorageSync('token')){
  215. return uni.showModal({
  216. title:'请登录',
  217. confirmText:'去登录',
  218. success(res){
  219. console.log(res);
  220. if(res.confirm){
  221. uni.navigateTo({
  222. url:'../../login/login/login?redirect=/pages/my/index'
  223. })
  224. }
  225. }
  226. })
  227. }
  228. uni.navigateTo({
  229. url
  230. })
  231. },
  232. // 获取用户详情
  233. getUserDetail() {
  234. getUserDetail().then(res => {
  235. if(res.state == 'Success'){
  236. this.userInfo = res.content
  237. uni.setStorageSync('userInfo', JSON.stringify(this.userInfo))
  238. }
  239. })
  240. },
  241. // 获取套餐列表
  242. mealList(){
  243. mealList({currentPage:1,pageSize:99,status:1}).then(res=>{
  244. if (res.state == 'Success') {
  245. this.list = res.content.records
  246. }
  247. })
  248. },
  249. }
  250. }
  251. </script>
  252. <style lang="scss">
  253. .my {
  254. height: 100vh;
  255. padding: 0 24rpx;
  256. background: #F9F9F9;
  257. .top-box {
  258. width: 750rpx;
  259. height: 460rpx;
  260. margin-left: -24rpx;
  261. padding: 150rpx 30rpx 0;
  262. box-sizing: border-box;
  263. background: url('https://zswl-dev.oss-cn-chengdu.aliyuncs.com/63b7c68b71a69169d1b33f92/store/bdb/user/avatar/CXvU8kSyyCxUe83c049e4ddb2b66e0c80f6cb5c6b4b1.png/1.png') no-repeat;
  264. background-size: 100% 460rpx;
  265. position: relative;
  266. .user-info {
  267. display: flex;
  268. align-items: center;
  269. justify-content: space-between;
  270. padding: 15rpx 0;
  271. color: #222222;
  272. .image {
  273. width: 108rpx;
  274. height: 108rpx;
  275. background: #f1f1f1;
  276. border-radius: 50%;
  277. }
  278. .info {
  279. flex: 1;
  280. margin-left: 30rpx;
  281. .user-name {
  282. font-size: 32rpx;
  283. font-weight: bold;
  284. }
  285. .tel {
  286. font-size: 20rpx;
  287. margin-top: 10rpx;
  288. display: inline-block;
  289. padding: 0 12rpx;
  290. line-height: 36rpx;
  291. border-radius: 18rpx 18rpx 18rpx 18rpx;
  292. box-sizing: border-box;
  293. background: #423625;
  294. color: #F3CC90;
  295. }
  296. }
  297. .setting {
  298. width: 40rpx;
  299. height: 40rpx;
  300. }
  301. }
  302. .level-box {
  303. position: absolute;
  304. left: 0;
  305. bottom: -24rpx;
  306. padding: 0 35rpx 22rpx;
  307. width: 750rpx;
  308. box-sizing: border-box;
  309. .level-content {
  310. width: 702rpx;
  311. height: 134rpx;
  312. position: absolute;
  313. bottom: 0rpx;
  314. left: 50%;
  315. transform: translateX(-50%);
  316. .level {
  317. width: 702rpx;
  318. height: 134rpx;
  319. }
  320. .num {
  321. font-size: 28rpx;
  322. color: #F3CC90;
  323. position: absolute;
  324. right: 25rpx;
  325. top: 30rpx;
  326. }
  327. }
  328. }
  329. }
  330. .box{
  331. background: #fff;
  332. padding-top: 10rpx;
  333. .box-title{
  334. font-size: 32rpx;
  335. font-weight: bold;
  336. color: #222222;
  337. padding-top: 20rpx;
  338. margin-left: 24rpx;
  339. }
  340. .btn-group {
  341. display: flex;
  342. align-items: center;
  343. padding: 30rpx 20rpx;
  344. // margin-top: 20rpx;
  345. border-radius: 0 0 16rpx 16rpx;
  346. width: 690rpx;
  347. box-sizing: border-box;
  348. .item {
  349. flex: 1;
  350. display: flex;
  351. flex-direction: column;
  352. align-items: center;
  353. .icon {
  354. width: 100rpx;
  355. height: 100rpx;
  356. }
  357. .label {
  358. font-size: 24rpx;
  359. color: #121212;
  360. }
  361. }
  362. }
  363. }
  364. .type-box {
  365. display: flex;
  366. justify-content: space-between;
  367. .type-item+.type-item{
  368. background: linear-gradient( 91deg, rgba(132,176,255,0.2) 0%, #FFFFFF 100%);
  369. }
  370. .type-item {
  371. width: 335rpx;
  372. border-radius: 16rpx;
  373. background: linear-gradient( 91deg, rgba(254,198,92,0.3) 0%, #FFFFFF 100%);
  374. padding: 32rpx 24rpx;
  375. margin-top: 20rpx;
  376. box-sizing: border-box;
  377. display: flex;
  378. justify-content: space-between;
  379. align-items: center;
  380. .left {
  381. .title {
  382. font-weight: bold;
  383. color: #181818;
  384. font-size: 32rpx;
  385. }
  386. .desc {
  387. color: #AAAAAA;
  388. font-size: 24rpx;
  389. margin-top: 16rpx;
  390. }
  391. }
  392. .icon {
  393. width: 80rpx;
  394. height: 80rpx;
  395. }
  396. }
  397. }
  398. .cell-icon {
  399. width: 48rpx;
  400. height: 48rpx;
  401. }
  402. .u-cell-group {
  403. margin-top: 20rpx;
  404. background: #fff;
  405. }
  406. }
  407. </style>