|
@@ -8,11 +8,16 @@
|
|
|
<view class="choice-list-item" v-for="(item, index) in prizeList" :key="index"
|
|
|
@click="selectPrize(item, index)">
|
|
|
<view
|
|
|
- :class="{'flex action': actionIndex == index, 'flex confirm': actionIndex != index, 'flex null': item.remainQty == 0}">
|
|
|
- <view class="info">
|
|
|
+ :class="{'item-info action': actionIndex == index && total > 1, 'item-info confirm': actionIndex != index, 'item-info null': item.remainQty == 0}">
|
|
|
+ <view class="flex info">
|
|
|
<image :src="item.picUrl" mode="aspectFill"></image>
|
|
|
- <view class="title">{{ item.title }}</view>
|
|
|
- <view class="tip" v-if="item.remainQty == 0">已兑完</view>
|
|
|
+ </view>
|
|
|
+ <view class="title" v-if="item.prizeType && item.prizeType.value != 'coin'">{{ item.title }}
|
|
|
+ </view>
|
|
|
+ <view class="title" v-else>盲豆x {{ item.value }}</view>
|
|
|
+ <view class="tip" v-if="item.remainQty == 0">已兑完</view>
|
|
|
+ <view class="flex action-icon" v-if="actionIndex == index && total > 1">
|
|
|
+ <u-icon name="checkmark" color="#fff" size="24"></u-icon>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -28,6 +33,25 @@
|
|
|
<view class="btn" @click="toIndex">确认</view>
|
|
|
</view>
|
|
|
</u-popup>
|
|
|
+
|
|
|
+ <u-popup :show="comfirmShow" :round="10" mode="center">
|
|
|
+ <view class="confirm-prize">
|
|
|
+ <view class="flex confirm-prize-info">
|
|
|
+ <image :src="actionInfo.picUrl" mode="aspectFill"></image>
|
|
|
+ <view class="title" v-if="actionInfo.prizeType && actionInfo.prizeType.value != 'coin'">
|
|
|
+ {{ actionInfo.title }}
|
|
|
+ </view>
|
|
|
+ <view class="title" v-else>盲豆x {{ actionInfo.value }}</view>
|
|
|
+ </view>
|
|
|
+ <view class="confirm-prize-tip" v-if="actionInfo.prizeType && actionInfo.prizeType.value != 'coin'">
|
|
|
+ 已放入我的奖品库</view>
|
|
|
+ <view class="confirm-prize-tip" v-else>已放入“我的盲豆”</view>
|
|
|
+ <view class="flex confirm-prize-btn">
|
|
|
+ <view class="back" @click="back">返回</view>
|
|
|
+ <view class="confirm" @click="toPrize">前往查看</view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </u-popup>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
@@ -41,7 +65,9 @@
|
|
|
prizeList: [],
|
|
|
total: 0,
|
|
|
actionIndex: 0,
|
|
|
- tipShow: false
|
|
|
+ tipShow: false,
|
|
|
+ comfirmShow: false,
|
|
|
+ actionInfo: {}
|
|
|
};
|
|
|
},
|
|
|
onLoad(options) {
|
|
@@ -67,13 +93,14 @@
|
|
|
res.data.prizeList.forEach(item => {
|
|
|
let picUrlArr = item.picUrl.split(',')
|
|
|
item.picUrl = env.filePublic + picUrlArr[0]
|
|
|
+ item.prizeType = JSON.parse(item.prizeType)
|
|
|
})
|
|
|
this.prizeList = res.data.prizeList
|
|
|
this.ticketId = res.data.ticketId
|
|
|
- this.total = res.data.length
|
|
|
+ this.total = this.prizeList.length
|
|
|
} else if (res.code == 1018) {
|
|
|
this.tipShow = true
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
this.tipShow = true
|
|
|
}
|
|
|
}).catch(() => {
|
|
@@ -92,29 +119,38 @@
|
|
|
confirmPrize() {
|
|
|
let _this = this
|
|
|
let item = _this.prizeList[_this.actionIndex]
|
|
|
- uni.showModal({
|
|
|
- title: '提示',
|
|
|
- content: '确定选择该奖品吗?',
|
|
|
- success(res) {
|
|
|
- if (res.confirm) {
|
|
|
- $http.post('/api/v1/mp/user/ticket/cashPrize', {
|
|
|
- ticketId: _this.ticketId,
|
|
|
- awardsId: item.awardsId,
|
|
|
- prizeId: item.prizeId
|
|
|
- }).then(res => {
|
|
|
- if (res.code == 0) {
|
|
|
- uni.$u.toast('兑换成功');
|
|
|
- setTimeout(() => {
|
|
|
- uni.switchTab({
|
|
|
- url: '/pages/index/index'
|
|
|
- })
|
|
|
- }, 500)
|
|
|
- }
|
|
|
- })
|
|
|
+ _this.actionInfo = item
|
|
|
+ if (_this.prizeList.length > 1) {
|
|
|
+ uni.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: '确定选择该奖品吗?',
|
|
|
+ success(res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ $http.post('/api/v1/mp/user/ticket/cashPrize', {
|
|
|
+ ticketId: _this.ticketId,
|
|
|
+ awardsId: item.awardsId,
|
|
|
+ prizeId: item.prizeId
|
|
|
+ }).then(res => {
|
|
|
+ if (res.code == 0) {
|
|
|
+ uni.$u.toast('兑换成功');
|
|
|
+ _this.comfirmShow = true
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ $http.post('/api/v1/mp/user/ticket/cashPrize', {
|
|
|
+ ticketId: _this.ticketId,
|
|
|
+ awardsId: item.awardsId,
|
|
|
+ prizeId: item.prizeId
|
|
|
+ }).then(res => {
|
|
|
+ if (res.code == 0) {
|
|
|
+ uni.$u.toast('兑换成功');
|
|
|
+ _this.comfirmShow = true
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
toIndex() {
|
|
@@ -122,6 +158,25 @@
|
|
|
url: '/pages/index/index'
|
|
|
})
|
|
|
},
|
|
|
+
|
|
|
+ back() {
|
|
|
+ let pages = getCurrentPages();
|
|
|
+ if (pages.length > 1) {
|
|
|
+ uni.navigateBack({
|
|
|
+ delta: 1
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ uni.switchTab({
|
|
|
+ url: '/pages/core/index'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ toPrize() {
|
|
|
+ uni.switchTab({
|
|
|
+ url: '/pages/user/index'
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
@@ -150,65 +205,87 @@
|
|
|
&-list {
|
|
|
justify-content: space-around;
|
|
|
flex-wrap: wrap;
|
|
|
- margin-top: 60rpx;
|
|
|
+ padding: 60rpx;
|
|
|
margin-bottom: 60rpx;
|
|
|
|
|
|
&-item {
|
|
|
- width: 40%;
|
|
|
+ position: relative;
|
|
|
+ width: 43%;
|
|
|
height: 440rpx;
|
|
|
margin-bottom: 40rpx;
|
|
|
+ background-color: #FFFFFF;
|
|
|
+ border-radius: 10rpx;
|
|
|
+
|
|
|
+ .item-info {
|
|
|
+ height: 100%;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: center;
|
|
|
+ border: 2px solid #FFFFFF;
|
|
|
+ border-radius: 10rpx;
|
|
|
+ }
|
|
|
|
|
|
.confirm {
|
|
|
- height: 100%;
|
|
|
background: none;
|
|
|
box-shadow: none;
|
|
|
- border: none;
|
|
|
+ }
|
|
|
+
|
|
|
+ .action-icon{
|
|
|
+ position: absolute;
|
|
|
+ bottom: -15rpx;
|
|
|
+ right: -15rpx;
|
|
|
+ width: 82rpx;
|
|
|
+ height: 82rpx;
|
|
|
+ line-height: 82rpx;
|
|
|
+ background-color: rgba(236, 122, 61, 100);
|
|
|
+ text-align: center;
|
|
|
+ box-shadow: 0px 4rpx 12rpx 0px rgba(0, 0, 0, 0.4);
|
|
|
+ border-radius: 50%;
|
|
|
}
|
|
|
|
|
|
.action {
|
|
|
- height: 100%;
|
|
|
- background-color: #4cd964;
|
|
|
box-shadow: 0px 2px 6px 0px rgba(0, 0, 0, 0.4);
|
|
|
- border: 1px solid rgba(187, 187, 187, 54);
|
|
|
+ border: 2px solid rgba(236, 122, 61, 100);
|
|
|
}
|
|
|
|
|
|
.null {
|
|
|
- height: 100%;
|
|
|
- background: #918b8d;
|
|
|
box-shadow: 0px 2px 6px 0px rgba(0, 0, 0, 0.4);
|
|
|
- border: 1px solid rgba(187, 187, 187, 54);
|
|
|
+ border: 2px solid rgba(187, 187, 187, 54);
|
|
|
}
|
|
|
|
|
|
.info {
|
|
|
- width: 80%;
|
|
|
- height: 80%;
|
|
|
- background-color: #C0C0C0;
|
|
|
+ width: 100%;
|
|
|
+ height: 75%;
|
|
|
+ background-color: #F8F8F8;
|
|
|
+ border-top-left-radius: 10rpx;
|
|
|
+ border-top-right-radius: 10rpx;
|
|
|
}
|
|
|
|
|
|
image {
|
|
|
width: 100%;
|
|
|
- height: 60%;
|
|
|
+ height: 80%;
|
|
|
}
|
|
|
|
|
|
.title {
|
|
|
- margin-top: 20rpx;
|
|
|
- color: #FFFFFF;
|
|
|
- text-align: center;
|
|
|
+ width: 100%;
|
|
|
+ font-size: 24rpx;
|
|
|
+ margin: 16rpx 0 0 10rpx;
|
|
|
+ color: #333;
|
|
|
}
|
|
|
|
|
|
.tip {
|
|
|
- margin-top: 20rpx;
|
|
|
+ margin: 16rpx 0 0 10rpx;
|
|
|
+ font-size: 24rpx;
|
|
|
color: red;
|
|
|
- text-align: center;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
.btn {
|
|
|
.confirm {
|
|
|
- width: 320rpx;
|
|
|
- height: 60rpx;
|
|
|
- line-height: 60rpx;
|
|
|
+ width: 400rpx;
|
|
|
+ height: 80rpx;
|
|
|
+ line-height: 80rpx;
|
|
|
border-radius: 8px;
|
|
|
background-color: rgba(235, 112, 9, 100);
|
|
|
color: rgba(255, 255, 255, 100);
|
|
@@ -240,4 +317,57 @@
|
|
|
text-align: center;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ .confirm-prize {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ width: 80vw;
|
|
|
+ padding: 40rpx 0;
|
|
|
+
|
|
|
+ &-info {
|
|
|
+ width: 80%;
|
|
|
+ margin-bottom: 60rpx;
|
|
|
+ justify-content: space-around;
|
|
|
+
|
|
|
+ image {
|
|
|
+ width: 150rpx;
|
|
|
+ height: 200rpx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ &-tip {
|
|
|
+ text-align: center;
|
|
|
+ margin-bottom: 60rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ &-btn {
|
|
|
+ width: 80%;
|
|
|
+ justify-content: space-around;
|
|
|
+
|
|
|
+ .back {
|
|
|
+ width: 160rpx;
|
|
|
+ height: 60rpx;
|
|
|
+ line-height: 60rpx;
|
|
|
+ border-radius: 8rpx;
|
|
|
+ color: rgba(235, 112, 9, 100);
|
|
|
+ font-size: 28rpx;
|
|
|
+ text-align: center;
|
|
|
+ font-family: Microsoft Yahei;
|
|
|
+ border: 1px solid rgba(235, 112, 9, 100);
|
|
|
+ }
|
|
|
+
|
|
|
+ .confirm {
|
|
|
+ width: 160rpx;
|
|
|
+ height: 60rpx;
|
|
|
+ line-height: 60rpx;
|
|
|
+ border-radius: 8rpx;
|
|
|
+ background-color: rgba(235, 112, 9, 100);
|
|
|
+ color: rgba(253, 253, 253, 100);
|
|
|
+ font-size: 28rpx;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
</style>
|