Fix(抽奖):[#972]抽奖抽中优惠券,优惠券直接自动领取并保存在优惠券卡包,不需要再通过抽奖记录进行领取
This commit is contained in:
@@ -1,35 +1,48 @@
|
||||
<template>
|
||||
<view class="pkg-lottery-log" v-if="ready">
|
||||
<image style="width: 734rpx;height: 1418rpx" :src="webUrl+'/20240125215943273915.png'" mode="scaleToFill"/>
|
||||
|
||||
<view class="pkg-lottery-log">
|
||||
<image
|
||||
:src="webUrl+'/20240125215943273915.png'"
|
||||
mode="scaleToFill"
|
||||
style="width: 734rpx;height: 1418rpx"
|
||||
/>
|
||||
<view class="th flex">
|
||||
<view>日期</view>
|
||||
<view style="margin-left: 168rpx;">抽奖结果</view>
|
||||
</view>
|
||||
|
||||
<scroll-view class="list-box" scroll-y @scrolltolower="onBottom">
|
||||
<view class="item flex jc-between ai-center" v-for="(item,index) in list" :key="index">
|
||||
<scroll-view
|
||||
scroll-y
|
||||
class="list-box"
|
||||
@scrolltolower="onBottom"
|
||||
>
|
||||
<view
|
||||
v-for="(item, index) in list"
|
||||
:key="index"
|
||||
class="item flex jc-between ai-center"
|
||||
>
|
||||
<view class="flex ai-center">
|
||||
<view style="width: 288rpx;color:#BD2323;font-size: 28rpx">{{ item['drawTime'] }}</view>
|
||||
<view class="more-t">{{ item['prizeName'] }}</view>
|
||||
</view>
|
||||
|
||||
<image class="flex-0" style="width: 111rpx;height: 64rpx" :src="webUrl+'/20240124232010456109.png'"
|
||||
mode="scaleToFill" v-if="item['isHit']===1 && item['status']===1" @click="takeItem(item)"/>
|
||||
<image
|
||||
v-if="item['isHit'] === 1 && item['status'] === 1"
|
||||
:src="webUrl+'/20240124232010456109.png'"
|
||||
class="flex-0"
|
||||
style="width: 111rpx;height: 64rpx"
|
||||
mode="scaleToFill"
|
||||
@click="takeItem(item, index)"
|
||||
/>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getLogs, takePrize} from "@/api/lottery";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
webUrl: this.$VUE_APP_RESOURCES_URL,
|
||||
ready: false,
|
||||
loading: false,
|
||||
page: 1,
|
||||
list: []
|
||||
}
|
||||
@@ -40,30 +53,44 @@ export default {
|
||||
this.fetchList()
|
||||
},
|
||||
methods: {
|
||||
async fetchList() {
|
||||
const res = await getLogs(this.page, 20)
|
||||
if (res.success) {
|
||||
res.data['records']?.forEach(item => this.list.push(item))
|
||||
this.ready = true
|
||||
}
|
||||
fetchList() {
|
||||
this.loading = true
|
||||
getLogs(this.page, 20).then(res => {
|
||||
const { success, data } = res
|
||||
if (success) {
|
||||
if (data) {
|
||||
if (data.records) {
|
||||
data.records.map(item => {
|
||||
this.list.push(item)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
this.loading = false
|
||||
}).catch(() => {
|
||||
this.loading = false
|
||||
}).finally(() => {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
|
||||
onBottom() {
|
||||
if (this.loading) {
|
||||
return
|
||||
}
|
||||
this.page++
|
||||
this.fetchList()
|
||||
},
|
||||
|
||||
async takeItem (item) {
|
||||
async takeItem(item) {
|
||||
// 领取商品
|
||||
if (item['prizeType'] === 1 && item['status'] === 1) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/order/OrderSubmission/index?lotteryRecordId=' + item['id']
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
const res = await takePrize(item.id)
|
||||
if (res.success) {
|
||||
item['status'] = 2
|
||||
this.$set(this.list[index], 'status', 2)
|
||||
uni.showModal({
|
||||
title: '领取成功',
|
||||
content: '您的奖品已经领取成功,请前往我的订单查看奖品发货信息',
|
||||
@@ -84,9 +111,6 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
|
||||
@@ -25,8 +25,15 @@
|
||||
获得{{ diceResult['prizeName'] }}一份
|
||||
</view>
|
||||
</view>
|
||||
<image class="btn-result" style="width: 240rpx;height: 68rpx" :src="webUrl+'/20240125205521152611.png'"
|
||||
mode="scaleToFill" @click="closeResultModel" v-if="diceResult['isHit']!==0"/>
|
||||
<!-- fix bug#972: 抽奖抽中优惠券,优惠券直接自动领取并保存在优惠券卡包,不需要再通过抽奖记录进行领取 -->
|
||||
<image
|
||||
v-if="diceResult['isHit'] === 1 && diceResult.prizeType !== 3"
|
||||
:src="webUrl+'/20240125205521152611.png'"
|
||||
class="btn-result"
|
||||
style="width: 240rpx;height: 68rpx"
|
||||
mode="scaleToFill"
|
||||
@click="closeResultModel"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<view class="dialog-take flex jc-center" :style="{'backgroundImage':`url(${webUrl}/20240124210904824337.png)`}"
|
||||
@@ -90,6 +97,7 @@ export default {
|
||||
},
|
||||
diceImg: '',
|
||||
diceResult: {
|
||||
prizeType: '', // 1-商城商品,2-积分,3-优惠券,4-谢谢参与
|
||||
prizeName: '',
|
||||
prizeImage: '',
|
||||
diceImage: '',
|
||||
@@ -174,11 +182,13 @@ export default {
|
||||
},
|
||||
|
||||
closeResultModel() {
|
||||
// 谢谢参与
|
||||
if (this.diceResult['prizeType'] === 4) {
|
||||
this.showResult = false
|
||||
this.showDialog = false
|
||||
return
|
||||
}
|
||||
// 领取商品
|
||||
if (this.diceResult['prizeType'] === 1) {
|
||||
this.showResult = false
|
||||
this.showDialog = false
|
||||
|
||||
Reference in New Issue
Block a user