123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660 |
- <template>
- <div class="userCenterIntegralExchange">
- <div class="user">
- <div class="head">
- <div class="headPortrait">
- <img
- v-if="!booleanFlag.headPortraitDefaultImg"
- :src="'api/file/pub/' + user.umsUser.userPic"
- alt=""
- style="width: 100%; height: 100%"
- @error="booleanFlag.headPortraitDefaultImg = true"
- />
- <img
- v-if="booleanFlag.headPortraitDefaultImg"
- :src="require('@/assets/img/userCenter/user.png')"
- alt=""
- style="width: 100%; height: 100%"
- />
- </div>
- <!-- 白银用户 -->
- <div v-if="userLevel1 == 2" class="level">
- <div v-if="isZh">
- <img
- v-if="!booleanFlag.levelDefaultImg"
- :src="require('@/assets/img/userCenter/白银用户.png')"
- alt=""
- style="width: 100%; height: 100%"
- />
- </div>
- <div v-else>
- <img
- v-if="!booleanFlag.levelDefaultImg"
- :src="require('@/assets/img/userCenter/@1白银用户.png')"
- alt=""
- style="width: 100%; height: 100%"
- />
- </div>
- </div>
- <!-- 黄金用户 -->
- <div v-if="userLevel1 == 3" class="level">
- <div v-if="isZh">
- <img
- v-if="!booleanFlag.levelDefaultImg"
- :src="require('@/assets/img/userCenter/level02.png')"
- alt=""
- style="width: 100%; height: 100%"
- />
- </div>
- <div v-else>
- <img
- v-if="!booleanFlag.levelDefaultImg"
- :src="require('@/assets/img/userCenter/黄金用户e.png')"
- alt=""
- style="width: 100%; height: 100%"
- />
- </div>
- </div>
- <!-- 白金用户 -->
- <div v-if="userLevel1 == 4" class="level">
- <div v-if="isZh">
- <img
- v-if="!booleanFlag.levelDefaultImg"
- :src="require('@/assets/img/userCenter/白金用户.png')"
- alt=""
- style="width: 100%; height: 100%"
- />
- </div>
- <div v-else>
- <img
- v-if="!booleanFlag.levelDefaultImg"
- :src="require('@/assets/img/userCenter/白金用户e.png')"
- alt=""
- style="width: 100%; height: 100%"
- />
- </div>
- </div>
- <!-- 钻石用户 -->
- <div v-if="userLevel1 == 5" class="level">
- <div v-if="isZh">
- <img
- v-if="!booleanFlag.levelDefaultImg"
- :src="require('@/assets/img/userCenter/白金用户.png')"
- alt=""
- style="width: 100%; height: 100%"
- />
- </div>
- <div v-else>
- <img
- v-if="!booleanFlag.levelDefaultImg"
- :src="require('@/assets/img/userCenter/白金用户e.png')"
- alt=""
- style="width: 100%; height: 100%"
- />
- </div>
- </div>
- </div>
- <div class="content">
- <div class="con1">
- <div class="name">
- <span style="font-size: 20px; font-weight: 600">{{
- realName
- }}</span>
- </div>
- <div class="integral">
- <span style="font-size: 18px"
- >{{ $i18n.locale == 'zh' ? '可用积分' : 'Integral' }}:
- </span>
- <span style="font-size: 22px; font-weight: 600; color: #f37003">{{
- integral
- }}</span>
- </div>
- </div>
- <div class="con2">
- <div style="margin-top: 54px" @click="toRank">
- <span
- v-if="userLevel1 == 2"
- style="font-size: 22px; font-weight: 600; color: #eaedf0"
- >V1</span
- >
- <span
- v-if="userLevel1 == 3"
- style="font-size: 22px; font-weight: 600; color: #be8e60"
- >V2</span
- >
- <span
- v-if="userLevel1 == 4"
- style="font-size: 22px; font-weight: 600; color: #eaedf0"
- >V3</span
- >
- </div>
- <div style="margin-top: 50px">
- <span style="font-size: 18px"
- >{{ $i18n.locale == 'zh' ? '当前等级' : 'Current Level' }}
- </span>
- </div>
- </div>
- <div class="con3">
- <div style="margin-top: 54px">
- <span style="font-size: 22px; font-weight: 600; color: #a8a8a8">{{
- growth
- }}</span>
- </div>
- <div style="margin-top: 50px">
- <span style="font-size: 18px"
- >{{
- $i18n.locale == 'zh' ? '当前成长值' : 'Current Growth Value'
- }}
- </span>
- </div>
- </div>
- <div class="con4">
- <div style="margin-top: 54px">
- <span style="font-size: 22px; font-weight: 600; color: #a8a8a8">{{
- byScore
- }}</span>
- </div>
- <div style="margin-top: 50px">
- <span style="font-size: 18px"
- >{{
- $i18n.locale == 'zh' ? '距下一等级还差' : 'From The Next Level '
- }}
- </span>
- </div>
- </div>
- </div>
- </div>
- <div style="max-height: 1200px; overflow-y: auto; padding-bottom: 20px">
- <!-- 热门兑换 -->
- <div class="commodity">
- <div class="title">
- <span
- style="
- width: 7px;
- height: 19px;
- background-color: #265186;
- margin-left: 4px;
- "
- ></span>
- <span style="margin-left: 8px; color: #265186">{{
- $i18n.locale == 'zh' ? '热门兑换' : 'Hot For'
- }}</span>
- </div>
- <div class="list">
- <div
- class="item"
- v-for="(item, index) in popularExchange"
- :key="index"
- >
- <div class="pic">
- <img :src="'api/file/pub/' + item.picture" alt="" />
- </div>
- <div class="text">
- <div class="texttitle">
- <span>{{
- $i18n.locale == 'zh'
- ? item.commodityName
- : item.commodityNameEn
- }}</span>
- </div>
- <div class="integral">
- <span
- >{{ item.point
- }}{{ $i18n.locale == 'zh' ? '积分' : 'Integral' }}</span
- >
- <span v-if="item.price !== 0" style="color: red">
- {{ item.price }}{{ $i18n.locale == 'zh' ? '元' : 'RMB' }}
- </span>
- </div>
- <div>
- <span
- >{{ $i18n.locale == 'zh' ? '累计兑换量' : 'Exchanged' }}:{{
- item.exchangeQuantity ? item.exchangeQuantity : '0'
- }}</span
- >
- <span v-html="' '"></span>
- <span v-if="isZh">{{
- item.usageQuantity > 100
- ? '库存充足'
- : '仅剩' + item.usageQuantity
- }}</span>
- <span v-if="!isZh">{{
- item.usageQuantity > 100
- ? 'Adequate Inventory'
- : 'Remain' + item.usageQuantity
- }}</span>
- </div>
- <div v-if="item.commodityStatus==2">
- <el-button
- :disabled="whetherFreez"
- v-if="isChecked"
- type="info"
- style="color: #fff;"
- @click="exchange(item)"
- >{{ $i18n.locale == 'zh' ? '立即兑换' : 'Exchange' }}
- </el-button>
- </div>
- <div v-else>
- <el-button
- :disabled="whetherFreez"
- v-if="isChecked"
- type="primary"
- style="color: #409eff; background-color: #fff"
- @click="exchange(item)"
- >{{ $i18n.locale == 'zh' ? '立即兑换' : 'Exchange' }}
- </el-button>
- </div>
- </div>
- </div>
- </div>
- </div>
- <!-- 资源兑换 -->
- <div class="commodity">
- <div class="title">
- <span
- style="
- width: 7px;
- height: 19px;
- background-color: #265186;
- margin-left: 4px;
- "
- ></span>
- <span style="margin-left: 8px; color: #265186">{{
- $i18n.locale == 'zh' ? '资源兑换' : 'Resources For'
- }}</span>
- <div style="display: inline-block; font-weight: 500; color: #128ded">
- <!-- <span style="margin-left: 40px">{{
- $i18n.locale == "zh" ? "积分范围" : "Integral Range"
- }}</span>
- <span
- style="
- margin-left: 16px;
- border: 1px solid #128ded;
- padding: 0 16px;
- border-radius: 16px;
- "
- v-for="(item, index) in list"
- :class="{ active: active == index }"
- @click="change(index)"
- >{{ item }}</span
- > -->
- </div>
- </div>
- <div class="list">
- <div
- class="item"
- v-for="(item, index) in pointCommoditys"
- :key="index"
- >
- <div class="pic">
- <img :src="'api/file/pub/' + item.picture" alt="" />
- </div>
- <div class="text">
- <div class="texttitle">
- <span>{{
- $i18n.locale == 'zh'
- ? item.commodityName
- : item.commodityNameEn
- }}</span>
- </div>
- <div class="integral">
- <span
- >{{ item.point
- }}{{ $i18n.locale == 'zh' ? '积分' : 'Integral' }}</span
- >
- <span v-if="item.price !== 0" style="color: red">
- {{ item.price }}{{ $i18n.locale == 'zh' ? '元' : 'RMB' }}
- </span>
- </div>
- <div>
- <span
- >{{ $i18n.locale == 'zh' ? '累计兑换量' : 'Exchanged' }}:{{
- item.exchangeQuantity ? item.exchangeQuantity : '0'
- }}</span
- >
- <span v-html="' '"></span>
- <span v-if="isZh">{{
- item.usageQuantity > 100
- ? '库存充足'
- : '仅剩' + item.usageQuantity
- }}</span>
- <span v-if="!isZh">{{
- item.usageQuantity > 100
- ? 'Adequate Inventory'
- : 'Remain' + item.usageQuantity
- }}</span>
- </div>
- <div v-if="item.commodityStatus==2">
- <el-button
- :disabled="whetherFreez"
- v-if="isChecked"
- type="info"
- style="color: #fff;"
- @click="exchange(item)"
- >{{ $i18n.locale == 'zh' ? '立即兑换' : 'Exchange' }}
- </el-button>
- </div>
- <div v-else>
- <el-button
- :disabled="whetherFreez"
- v-if="isChecked"
- type="primary"
- style="color: #409eff; background-color: #fff"
- @click="exchange(item)"
- >{{ $i18n.locale == 'zh' ? '立即兑换' : 'Exchange' }}
- </el-button>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- import {
- exchangeUserPoints,
- getUserPointPage,
- umsPointCommoditys,
- } from '@/api/user'
- export default {
- name: 'userCenterIntegralExchange',
- data() {
- return {
- booleanFlag: {
- headPortraitDefaultImg: false,
- levelDefaultImg: false,
- checkInsFlag: false,
- },
- orderForm: {
- address: '江苏省南京市雨花台区南京大数据产业基地5栋一层',
- num: '',
- },
- user: {},
- integral: '',
- growth: '',
- page: {
- pageNo: 1,
- pageSize: 10,
- total: 3,
- },
- popularExchange: [],
- pointCommoditys: [],
- active: 0,
- list: ['0-1000', '1000-2000', '2000以上'],
- userUsertypeDict: '',
- isChecked: null,
- isZh: true,
- hotFor: null,
- resourcesFor: null,
- whetherFreez: null,
- }
- },
- watch: {
- '$i18n.locale': {
- handler: function () {
- if (this.$i18n.locale == 'zh') {
- this.isZh = true
- } else {
- this.isZh = false
- }
- this.getUmsPointCommoditys()
- },
- deep: true,
- },
- },
- mounted() {
- let language = window.localStorage.getItem('locale')
- if (language == 'zh') {
- this.isZh = true
- } else {
- this.isZh = false
- }
- this.init()
- },
- methods: {
- toRank() {
- this.$router.push('userCenterRightsRank')
- },
- change(index) {
- this.active = index
- console.log(this.active)
- },
- init() {
- this.user = JSON.parse(window.localStorage.getItem('user'))
- if (this.user.umsUser.userPic == undefined) {
- this.user.umsUser.userPic = ''
- }
- this.userUsertypeDict = this.user.umsUser.userUsertypeDict
- // console.log(this.userUsertypeDict);
- if (this.userUsertypeDict !== 2) {
- this.isChecked = true
- } else {
- this.isChecked = false
- }
- this.getUmsPointCommoditys()
- this.getUmsUserPoints()
- },
- // 积分兑换商品列表
- getUmsPointCommoditys() {
- let params = {
- pageSize: 10,
- pageNo: 1,
- }
- umsPointCommoditys(params).then((res) => {
- if (res) {
- // 热门兑换
- this.popularExchange = res.data.popularExchange
- // 资源兑换
- this.pointCommoditys = res.data.pointCommoditys
- }
- })
- },
- // 个人积分
- getUmsUserPoints() {
- getUserPointPage().then((res) => {
- if (res) {
- this.integral = res.data.umsUserPoints[0].point
- if (JSON.stringify(res.data) !== '{}') {
- this.growth = res.data.umsUserPoints[0].growthValue
- } else {
- this.growth = 6000
- }
- if (res.data.umsUserPoints[0].pointStatus == 'n') {
- this.$message({
- message:
- this.$i18n.locale == 'zh'
- ? '该用户积分已冻结,请联系客服'
- : "The user's points have been frozen, please contact customer service",
- type: 'error',
- })
- this.whetherFreez = true
- } else {
- this.whetherFreez = false
- }
- }
- })
- },
- // 兑换商品详情页
- exchange(item) {
- console.log(item)
- window.localStorage.setItem('detailID', item.id)
- this.$router.push({
- path: `/userCenterIntegralExchangeDetail`,
- })
- },
- },
- computed: {
- // 判断有无真名
- realName() {
- if (this.user.umsUser.userNickName) {
- return this.user.umsUser.userNickName
- } else {
- return this.user.username
- }
- },
- // 判断差多少分
- byScore() {
- if (this.growth >= 0 && this.growth < 1000) {
- return parseInt(1000 - this.growth)
- } else if (this.growth >= 1000 && this.growth < 3000) {
- return parseInt(3000 - this.growth)
- } else if (this.growth >= 3000) {
- return 999999
- }
- },
- // 判断会员等级
- userLevel1() {
- if (this.growth >= 0 && this.growth < 1000) {
- return 2
- } else if (this.growth >= 1000 && this.growth < 3000) {
- return 3
- } else if (this.growth >= 3000) {
- return 4
- }
- },
- },
- }
- </script>
- <style scoped lang="less">
- .active {
- background-color: #ebf7ff;
- }
- .userCenterIntegralExchange {
- width: 100%;
- background: #fff;
- min-height: 700px;
- .user {
- display: flex;
- height: 200px;
- border: 1px solid #eeeff3;
- .head {
- width: 162px;
- padding: 0 0 0 22px;
- box-sizing: border-box;
- .headPortrait {
- width: 82px;
- height: 82px;
- border-radius: 50%;
- margin: 43px auto 0;
- }
- .level {
- width: 108px;
- height: 28px;
- border-radius: 14px;
- margin: 8px auto 0;
- }
- }
- .content {
- flex: 1;
- display: flex;
- .con1 {
- padding: 0 30px 0 15px;
- .name {
- margin-top: 56px;
- }
- .integral {
- margin-top: 50px;
- }
- }
- .con2,
- .con3,
- .con4 {
- padding: 0 30px;
- text-align: center;
- position: relative;
- &:before {
- content: '';
- width: 1px;
- height: 100px;
- background-color: #f0f0f2;
- display: inline-block;
- position: absolute;
- top: 60px;
- left: 0;
- }
- }
- }
- }
- .commodity {
- padding: 0 15px;
- .title {
- width: 100%;
- border-bottom: 1px solid #eeeff3;
- > span {
- display: inline-block;
- font-size: 18px;
- font-weight: 600;
- line-height: 66px;
- vertical-align: middle;
- }
- }
- .list {
- display: flex;
- flex-wrap: wrap;
- .item {
- width: 33%;
- height: 450px;
- padding: 0 45px;
- box-sizing: border-box;
- margin-top: 45px;
- .pic {
- width: 222px;
- height: 269px;
- img {
- width: 100%;
- height: 100%;
- }
- }
- .text {
- font-size: 16px;
- line-height: 32px;
- .texttitle {
- font-size: 18px;
- margin-top: 35px;
- /* 隐藏溢出元素 */
- overflow: hidden;
- /* 单行显示 */
- white-space: nowrap;
- /* 溢出显示省略号 */
- text-overflow: ellipsis;
- }
- .integral {
- font-size: 18px;
- color: #c96e6a;
- }
- }
- }
- }
- }
- /deep/ .el-dialog__wrapper {
- background-color: transparent !important;
- }
- }
- </style>
|