123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449 |
- <template>
- <view class="user-shop-details">
- <u-toast ref="uToast" />
- <view style="background-color: $color-white !important;">
- <u-navbar :back-text="i18n('Back')" :back-text-style="backStyle" back-icon-color="#fff" title-color="#fff"
- :background="background" title-width="300" :title="i18n('userShopDetails')"></u-navbar>
- </view>
- <view class="content">
- <view class="content-title">
- <image :src="websiteUrl + shopInfo.picture" class="left-pic"></image>
- </view>
- </view>
- <view class="shop-info">
- <view class="shop-title">
- <text>{{$i18n.locale=='zh'?shopInfo.commodityName:shopInfo.commodityNameEn}}</text>
- <text v-if="shopInfo.commodityStatus==2"
- style="margin-left: 1px; display: inline-block;text-align: center;width:65px;height:20px;line-height:20px; background-color:#f0f9eb;border:1px solid #eaf7e4;color:#5ec142;border-radius: 10px;font-size: 14rpx; ">
- {{ $i18n.locale == "zh" ? "已结束" : "Ended" }}
- </text>
- </view>
- <view class="shop-price">{{shopInfo.point}}{{$i18n.locale=='zh'?'积分':'integral'}}</view>
- <view class="shop-detail">
- <view class="shop-num">
- <view class="shop-get">{{$i18n.locale=='zh'?'已兑换':'Has change'}}:{{shopInfo.exchangeQuantity}}
- </view>
- <view class="shop-to">{{$i18n.locale=='zh'?'剩余':'Residue'}}:{{shopInfo.usageQuantity}}</view>
- </view>
- <view class="shop-time" v-if="$i18n.locale=='zh'">
- 有效期至:{{shopInfo.expirationType=='y'?'长期有效':`${moment(shopInfo.createDate).format('YYYY-MM-DD')}`}}
- </view>
- <view class="shop-time" v-if="$i18n.locale!='zh'">
- Valid
- until:{{shopInfo.expirationType=='y'?'Long effective':`${moment(shopInfo.createDate).format('YYYY-MM-DD')}`}}
- </view>
- </view>
- <view class="shop-need">
- <view class="shop-many">{{$i18n.locale=='zh'?'数量':'Quantity'}}</view>
- <view class="shop-btn">
- <view class="btn-little" @tap="downNum()">-</view>
- <view class="shop-munch btn-little" id="addtext">{{addtext}}</view>
- <view class="btn-little" @tap="addNum(shopInfo.usageQuantity)">+</view>
- </view>
- <view class="user-btn-ui" v-if="shopInfo.commodityStatus==2">
- <!-- <button class="user-defeat" @tap="tochangeAddress(shopInfo.id,shopInfo.exchangeObject)"
- v-if="shopInfo.usageQuantity>=1" disabled="true">
- {{$i18n.locale=='zh'?'确认兑换':'Confirm the change'}}
- </button>
- <button class="user-defeat" v-else>{{$i18n.locale=='zh'?'暂无存货':'No inventory'}}</button> -->
- </view>
- <view class="user-btn-ui" v-else>
- <button class="user-success" @tap="tochangeAddress(shopInfo.id,shopInfo.exchangeObject)"
- v-if="shopInfo.usageQuantity>=1">
- {{$i18n.locale=='zh'?'确认兑换':'Confirm the change'}}
- </button>
- <button class="user-defeat" v-else>{{$i18n.locale=='zh'?'暂无存货':'No inventory'}}</button>
- </view>
- </view>
- </view>
- <view class="user-info">
- <view class="user-title">{{$i18n.locale=='zh'?'规则信息':'Rules of the information'}}</view>
- <view class="user-what">
- <view class="user-who">{{$i18n.locale=='zh'?'兑换对象':'For object'}}:</view>
- <view class="user-right" v-if="$i18n.locale=='zh'">
- {{shopInfo.exchangeObject}}
- </view>
- <view class="user-right" v-if="$i18n.locale!='zh'">
- {{shopInfo.exchangeObject}}
- </view>
- </view>
- <view class="user-what">
- <view class="user-who">{{$i18n.locale=='zh'?'兑换限制':'Exchange restrictions'}}:</view>
- <view class="user-right" v-if="$i18n.locale=='zh'">
- {{shopInfo.restrict=='y'?shopInfo.exchangeRestrict:'无限制'}}
- </view>
- <view class="user-right" v-if="$i18n.locale!='zh'">
- {{shopInfo.restrict=='y'?shopInfo.exchangeRestrict:'Unrestricted'}}
- </view>
- </view>
- <view class="user-what">
- <view class="user-who">{{$i18n.locale=='zh'?'活动有效期':'Validity of activity'}}:</view>
- <view class="user-right" v-if="$i18n.locale=='zh'">
- {{shopInfo.expirationType=='y'?'长期有效':`${moment(shopInfo.createDate).format('YYYY-MM-DD')}`}}
- </view>
- <view class="user-right" v-if="$i18n.locale!='zh'">
- {{shopInfo.expirationType=='y'?'Long-term effective':`${moment(shopInfo.createDate).format('YYYY-MM-DD')}`}}
- </view>
- </view>
- <!-- <view class="user-what">
- <view class="user-who">{{$i18n.locale=='zh'?'活动限制':'Activity restrictions'}}:</view>
- <view class="user-right">{{$i18n.locale=='zh'?'活动有效期':'Validity of activity'}}</view>
- </view> -->
- </view>
- <view class="user-detail">
- <view class="user-shop-title">{{$i18n.locale=='zh'?'礼品介绍':'Products introduction'}}:</view>
- <view class="user-shop-pic">
- <image :src="websiteUrl + shopInfo.picture" class="left-pic"></image>
- </view>
- <view class="user-text">{{$i18n.locale=='zh'?shopInfo.commodityDetails:shopInfo.commodityDetailsEn}}</view>
- </view>
- <view class="table-null"></view>
- <view>
- <!-- 提示信息弹窗 -->
- <uni-popup ref="message">
- <uni-popup-message :type="msgType" :message="messageText" :duration="2000"></uni-popup-message>
- </uni-popup>
- </view>
- </view>
- </template>
- <script>
- import uniPopupDialog from '@/components/uni-popup/uni-popup-dialog.vue'
- import uniPopupMessage from '@/components/uni-popup/uni-popup-message.vue'
- import uniPopup from '@/components/uni-popup/uni-popup.vue'
- import moment from "moment"
- export default {
- components: {
- moment,
- uniPopupDialog,
- uniPopupMessage,
- uniPopup
- },
- data() {
- return {
- background: {
- backgroundImage: 'linear-gradient(270deg, #4BC0E2 0%, #538BE7 100%)',
- },
- backStyle: {
- color: '#FFFFFF',
- },
- shopInfo: {},
- grade: null,
- id: null,
- msgType: 'success',
- messageText: '这是一条成功提示',
- addtext: 1
- }
- },
- onLoad(id) {
- // console.log(id);
- this.grade = id.grade;
- this.id = id.id;
- this.getShopDetail()
- },
- filters: {
- twoDecimal(value) {
- return parseFloat(string(value)).toFixed(2);
- },
- time(data, type) {
- return moment(data).format(type);
- }
- },
- methods: {
- i18n(data) {
- return this.$t('common.' + data);
- },
- change(e) {
- console.log('当前模式:' + e.type + ',状态:' + e.show);
- },
- addNum(e) {
- // var num = document.getElementById('addtext');
- // if (num.innerHTML <= e - 1) {
- // num.innerHTML++;
- // }
- //document.cookie=num.value;
- if (this.addtext <= e - 1) {
- this.addtext = this.addtext + 1;
- }
- },
- downNum() {
- // var num = document.getElementById('addtext');
- // if (num.innerHTML >= 2) {
- // num.innerHTML--;
- // }
- if (this.addtext > 1) {
- this.addtext = this.addtext - 1;
- }
- },
- tochangeAddress(id, userGrade) {
- console.log(id, '--------->');
- // var num = document.getElementById('addtext');
- var num = this.addtext;
- // num = num.innerHTML
- console.log(userGrade, '==========');
- // console.log(num);
- if (userGrade == 'V3,V2,V1') {
- uni.navigateTo({
- url: './changeAddress?id=' + id + '&num=' + num,
- })
- } else if (userGrade == this.grade) {
- uni.navigateTo({
- url: './changeAddress?id=' + id + '&num=' + num,
- })
- } else {
- // this.msgType = type
- this.messageText = `当前用户等级不符合该礼品兑换需求`
- this.$refs.message.open()
- }
- },
- //获取礼品详情
- async getShopDetail() {
- // console.log(id, '-----------');
- const res = await this.$myRequest({
- url: '/uc/umsPointCommoditys',
- data: {
- id: this.id
- },
- })
- // console.log(res, '============');
- this.shopInfo = res.data.umsPointCommoditys[0]
- // console.log(this.shopInfo, '====================');
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .user-shop-details {
- background-color: #cacacaf;
- .content {
- width: 96%;
- height: 500rpx;
- margin-left: 2%;
- background-color: #dadee1ff;
- .content-title {
- width: 100%;
- height: 100%;
- .left-pic {
- width: 90%;
- margin-left: 5%;
- height: 400rpx;
- margin-top: 50rpx;
- }
- }
- }
- .shop-info {
- width: 96%;
- height: 240rpx;
- margin-left: 2%;
- background-color: #fff;
- margin-top: 20rpx;
- .shop-title {
- width: 100%;
- height: 60rpx;
- line-height: 60rpx;
- font-size: 32rpx;
- text-align: center;
- font-weight: 700;
- }
- .shop-price {
- font-size: 30rpx;
- font-weight: 700;
- color: red;
- width: 92%;
- height: 50rpx;
- line-height: 50rpx;
- margin-left: 4%;
- }
- .shop-detail {
- width: 92%;
- margin-left: 4%;
- height: 50rpx;
- display: flex;
- justify-content: space-between;
- .shop-num {
- width: 55%;
- height: 50rpx;
- display: flex;
- .shop-get {
- width: 55%;
- height: 50rpx;
- line-height: 50rpx;
- font-size: 24rpx;
- margin-right: 10rpx;
- }
- .shop-to {
- width: 45%;
- height: 50rpx;
- line-height: 50rpx;
- font-size: 24rpx;
- }
- }
- .shop-time {
- width: 45%;
- height: 50rpx;
- line-height: 50rpx;
- font-size: 24rpx;
- }
- }
- .shop-need {
- width: 92%;
- margin-left: 4%;
- display: flex;
- .shop-many {
- height: 80rpx;
- line-height: 80rpx;
- margin-right: 20rpx;
- }
- .shop-btn {
- display: flex;
- height: 80rpx;
- .btn-little {
- margin-top: 20rpx;
- text-align: center;
- width: 40rpx;
- height: 40rpx;
- line-height: 40rpx;
- border: 1rpx solid #b0b0b0;
- color: black;
- }
- .shop-munch {
- border-left: none;
- border-right: none;
- }
- }
- .user-btn-ui {
- height: 50rpx;
- margin-top: 10rpx;
- margin-left: 43%;
- border-radius: 50rpx;
- .user-success {
- width: 100%;
- height: 50rpx;
- line-height: 50rpx;
- text-align: center;
- background-color: #0000ff;
- border-radius: 50rpx;
- color: white;
- font-size: 26rpx;
- }
- .user-defeat {
- height: 50rpx;
- line-height: 50rpx;
- text-align: center;
- background-color: #989898;
- border-radius: 50rpx;
- color: white;
- font-size: 26rpx;
- }
- }
- }
- }
- .user-info {
- height: 300rpx;
- width: 96%;
- margin-left: 2%;
- background-color: #fff;
- margin-top: 20rpx;
- .user-title {
- width: 92%;
- margin-left: 4%;
- font-weight: 700;
- height: 80rpx;
- line-height: 80rpx;
- }
- .user-what {
- width: 92%;
- margin-left: 4%;
- display: flex;
- .user-who {
- width: 45%;
- font-size: 24rpx;
- color: #bcbcbe;
- height: 50rpx;
- line-height: 50rpx;
- text-align: right;
- transform: translateX(-10%);
- }
- .user-right {
- height: 50rpx;
- line-height: 50rpx;
- color: black;
- font-size: 26rpx;
- }
- }
- }
- .user-detail {
- width: 96%;
- margin-left: 2%;
- margin-top: 20rpx;
- background-color: #fff;
- .user-shop-title {
- width: 92%;
- margin-left: 4%;
- height: 80rpx;
- line-height: 80rpx;
- font-weight: 700;
- }
- .user-shop-pic {
- width: 100%;
- height: 500rpx;
- text-align: center;
- .left-pic {
- width: 90%;
- height: 400rpx;
- margin-top: 50rpx;
- }
- }
- .user-text {
- width: 92%;
- margin-left: 4%;
- overflow: hidden;
- }
- }
- .table-null {
- height: 30rpx;
- }
- }
- </style>
|