Feat:抽奖2.0(细节调整,查漏补缺)
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
<view class="side-entry rules" @click="openRulesModel">活动规则</view>
|
||||
<view class="side-entry mine" @click="navToLog">我的抽奖码</view>
|
||||
|
||||
<view class="winners-wrap" @click="navToLog">
|
||||
<view class="winners-wrap">
|
||||
<view class="winners-text" v-if="!winnerSortedList.length">暂时无人中奖</view>
|
||||
<view class="winners-text one-t" v-else-if="winnerSortedList.length === 1">
|
||||
恭喜 <text class="blue">{{ winnerSortedList[0].name }}</text>
|
||||
@@ -123,7 +123,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getDrawActivityInfo } from '@/api/lottery'
|
||||
import { getDrawActivityInfo, getDrawLatestWinners } from '@/api/lottery'
|
||||
import { postCartAdd } from '@/api/store'
|
||||
import ProductWindow from '@/components/ProductWindow'
|
||||
import goCartMixin from '@/mixins/goCartMixins'
|
||||
@@ -145,6 +145,7 @@ export default {
|
||||
prizePool: [],
|
||||
products: []
|
||||
},
|
||||
latestWinnerList: [],
|
||||
activityId: 0,
|
||||
linkType: 1,
|
||||
onlyOneToAddCart: false,
|
||||
@@ -184,7 +185,7 @@ export default {
|
||||
}))
|
||||
},
|
||||
winnerSortedList() {
|
||||
const list = this.activityInfo.winnerList || []
|
||||
const list = this.latestWinnerList || []
|
||||
if (!list.length) return []
|
||||
const mapped = list.map(item => ({
|
||||
name: item.realName || item.phone || '用户',
|
||||
@@ -194,7 +195,8 @@ export default {
|
||||
return mapped.sort((a, b) => this.getPeriodNoValue(b.periodNo) - this.getPeriodNoValue(a.periodNo))
|
||||
},
|
||||
buyThresholdText() {
|
||||
return 99
|
||||
const spendThreshold = this.activityInfo.spendThreshold || 0
|
||||
return spendThreshold
|
||||
},
|
||||
openDateText() {
|
||||
const target = this.getTargetDate()
|
||||
@@ -223,9 +225,12 @@ export default {
|
||||
})
|
||||
return
|
||||
}
|
||||
getDrawActivityInfo(this.activityId).then(res => {
|
||||
if (res.success) {
|
||||
const data = res.data || {}
|
||||
Promise.all([
|
||||
getDrawActivityInfo(this.activityId),
|
||||
getDrawLatestWinners()
|
||||
]).then(([activityRes, winnersRes]) => {
|
||||
if (activityRes && activityRes.success) {
|
||||
const data = activityRes.data || {}
|
||||
this.activityInfo = {
|
||||
...this.activityInfo,
|
||||
...data,
|
||||
@@ -234,6 +239,11 @@ export default {
|
||||
this.ready = true
|
||||
this.startCountdown()
|
||||
}
|
||||
const winnersData = winnersRes && winnersRes.data
|
||||
const list = Array.isArray(winnersData)
|
||||
? winnersData
|
||||
: (Array.isArray(winnersData && winnersData.list) ? winnersData.list : [])
|
||||
this.latestWinnerList = list
|
||||
})
|
||||
},
|
||||
getTargetDate() {
|
||||
@@ -291,9 +301,12 @@ export default {
|
||||
uni.navigateTo({ url: '/pkg-video/views/county-lottery-rules' })
|
||||
},
|
||||
navToWinners() {
|
||||
uni.navigateTo({
|
||||
url: `/pkg-video/views/county-winners?activityId=${this.activityId}`
|
||||
})
|
||||
const targetDate = this.getTargetDate()
|
||||
const isNotOpened = targetDate && targetDate.getTime() > Date.now()
|
||||
const url = isNotOpened
|
||||
? '/pkg-video/views/county-winners'
|
||||
: `/pkg-video/views/county-winners?activityId=${this.activityId}`
|
||||
uni.navigateTo({ url })
|
||||
},
|
||||
navToLog() {
|
||||
uni.navigateTo({ url: '/pkg-video/views/county-my-tickets' })
|
||||
|
||||
Reference in New Issue
Block a user