Refactor(ALL):Vue3同步调整为Vue2
This commit is contained in:
@@ -22,63 +22,71 @@
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {ref} from '@vue/composition-api'
|
||||
import {onShow} from '@dcloudio/uni-app'
|
||||
import {VUE_APP_RESOURCES_URL as webUrl} from '../../config/index'
|
||||
<script>
|
||||
import {getLogs, takePrize} from "@/api/lottery";
|
||||
|
||||
const ready = ref(false)
|
||||
|
||||
onShow(() => {
|
||||
list.value = []
|
||||
fetchList()
|
||||
})
|
||||
|
||||
const page = ref(1)
|
||||
const list = ref([])
|
||||
const fetchList = async () => {
|
||||
const res = await getLogs(page.value, 20)
|
||||
if (res.success) {
|
||||
res.data['records']?.forEach(item => list.value.push(item))
|
||||
ready.value = true
|
||||
}
|
||||
}
|
||||
|
||||
const onBottom = () => {
|
||||
page.value++
|
||||
fetchList()
|
||||
}
|
||||
|
||||
const takeItem = async (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
|
||||
uni.showModal({
|
||||
title: '领取成功',
|
||||
content: '您的奖品已经领取成功,请前往我的订单查看奖品发货信息',
|
||||
cancelText: '下次再说',
|
||||
confirmText: '查看订单',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
console.log('用户点击确定');
|
||||
uni.navigateTo({
|
||||
url: '/pages/order/MyOrder/index'
|
||||
})
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
}
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
webUrl: this.$VUE_APP_RESOURCES_URL,
|
||||
ready: false,
|
||||
page: 1,
|
||||
list: []
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.page = 1
|
||||
this.list = []
|
||||
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
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
onBottom() {
|
||||
this.page++
|
||||
this.fetchList()
|
||||
},
|
||||
|
||||
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
|
||||
uni.showModal({
|
||||
title: '领取成功',
|
||||
content: '您的奖品已经领取成功,请前往我的订单查看奖品发货信息',
|
||||
cancelText: '下次再说',
|
||||
confirmText: '查看订单',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
console.log('用户点击确定');
|
||||
uni.navigateTo({
|
||||
url: '/pages/order/MyOrder/index'
|
||||
})
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
|
||||
Reference in New Issue
Block a user