|
@@ -6,6 +6,7 @@
|
|
:loading="false"
|
|
:loading="false"
|
|
:elevation="0"
|
|
:elevation="0"
|
|
:isTools="false"
|
|
:isTools="false"
|
|
|
|
+ :total="total"
|
|
:showPage="true"
|
|
:showPage="true"
|
|
:showSelect="false"
|
|
:showSelect="false"
|
|
:page-info="queryParams"
|
|
:page-info="queryParams"
|
|
@@ -21,10 +22,10 @@
|
|
{{ item.record.deliverInfo ? JSON.parse(item.record.deliverInfo).name + '-' + JSON.parse(item.record.deliverInfo).no : ''}}
|
|
{{ item.record.deliverInfo ? JSON.parse(item.record.deliverInfo).name + '-' + JSON.parse(item.record.deliverInfo).no : ''}}
|
|
</template>
|
|
</template>
|
|
<template #receiveInfo="{ item }">
|
|
<template #receiveInfo="{ item }">
|
|
- {{ item.record.receiveInfo ? JSON.parse(item.record.receiveInfo).name + ',' + JSON.parse(item.record.receiveInfo).phone + ',' + JSON.parse(item.record.receiveInfo).address : ''}}
|
|
|
|
|
|
+ {{ orderReceiveInfo(item) }}
|
|
</template>
|
|
</template>
|
|
<template #actions="{ item }">
|
|
<template #actions="{ item }">
|
|
- <v-btn v-if="item.record.isReceive && !item.record.receiveInfo" color="primary" @click.stop="handleSelectAddress(item)" variant="text">选择收货地址</v-btn>
|
|
|
|
|
|
+ <v-btn v-if="!item.record.isReceive && !item.record.receiveInfo" color="primary" @click.stop="handleReceive(item)" variant="text">领取</v-btn>
|
|
</template>
|
|
</template>
|
|
</CtTable>
|
|
</CtTable>
|
|
|
|
|
|
@@ -37,46 +38,17 @@
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
defineOptions({ name: 'mall-user-prize-index' })
|
|
defineOptions({ name: 'mall-user-prize-index' })
|
|
-import { ref } from 'vue'
|
|
|
|
|
|
+import { ref, computed } from 'vue'
|
|
import SelectAddress from '@/views/mall/user/address'
|
|
import SelectAddress from '@/views/mall/user/address'
|
|
import Snackbar from '@/plugins/snackbar'
|
|
import Snackbar from '@/plugins/snackbar'
|
|
|
|
+import { getLuckLotteryRecordPage, luckyLotteryRecordReceive } from '@/api/mall/prize'
|
|
|
|
|
|
const queryParams = ref({
|
|
const queryParams = ref({
|
|
pageNo: 1,
|
|
pageNo: 1,
|
|
pageSize: 10,
|
|
pageSize: 10,
|
|
})
|
|
})
|
|
-const items = ref([
|
|
|
|
- {
|
|
|
|
- record: {
|
|
|
|
- createTime: 1735128516469,
|
|
|
|
- isReceive: true,
|
|
|
|
- deliverInfo: "{\"no\":\"SF112056000216589\",\"name\":\"顺丰速运\"}",
|
|
|
|
- receiveInfo: '{"name":"张三","phone":"13800138000","address":"北京市海淀区上地十街10号百度大厦"}',
|
|
|
|
- },
|
|
|
|
- prize: {
|
|
|
|
- name: '三亚酒店房券',
|
|
|
|
- image: 'https://menduner.citupro.com:3443/dev/e13f9b76b26907f35d0ccf7e7f3e88f89a725429172e0b56ceb88362bc9032e6.jpg'
|
|
|
|
- },
|
|
|
|
- lottery: {
|
|
|
|
- name: '房券抽奖活动'
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- record: {
|
|
|
|
- createTime: 1735128516469,
|
|
|
|
- isReceive: true,
|
|
|
|
- deliverInfo: '',
|
|
|
|
- receiveInfo: ''
|
|
|
|
- },
|
|
|
|
- prize: {
|
|
|
|
- name: '三亚酒店房券',
|
|
|
|
- image: 'https://menduner.citupro.com:3443/dev/e13f9b76b26907f35d0ccf7e7f3e88f89a725429172e0b56ceb88362bc9032e6.jpg'
|
|
|
|
- },
|
|
|
|
- lottery: {
|
|
|
|
- name: '房券抽奖活动'
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-])
|
|
|
|
|
|
+const total = ref(0)
|
|
|
|
+const items = ref([])
|
|
|
|
|
|
const headers = [
|
|
const headers = [
|
|
{ title: '活动名称', key: 'lottery.name', sortable: false },
|
|
{ title: '活动名称', key: 'lottery.name', sortable: false },
|
|
@@ -87,17 +59,39 @@ const headers = [
|
|
{ title: '操作', key: 'actions', sortable: false }
|
|
{ title: '操作', key: 'actions', sortable: false }
|
|
]
|
|
]
|
|
|
|
|
|
-// 设置收货地址
|
|
|
|
|
|
+// 获取中奖记录
|
|
|
|
+const getLuckLotteryRecordList = async () => {
|
|
|
|
+ const result = await getLuckLotteryRecordPage(queryParams.value)
|
|
|
|
+ items.value = result?.list || []
|
|
|
|
+ total.value = result?.total || 0
|
|
|
|
+}
|
|
|
|
+getLuckLotteryRecordList()
|
|
|
|
+
|
|
|
|
+// 收货信息
|
|
|
|
+const orderReceiveInfo = computed(() => (item) => {
|
|
|
|
+ const info = item.record.receiveInfo ? JSON.parse(item.record.receiveInfo) : {}
|
|
|
|
+ if (!info || !Object.keys(info).length) return ''
|
|
|
|
+ return `${info.name},${info.mobile},${info.areaName} ${info.detailAddress}`
|
|
|
|
+})
|
|
|
|
+
|
|
|
|
+// 领取
|
|
const selectAddressRef = ref()
|
|
const selectAddressRef = ref()
|
|
const showDialog = ref(false)
|
|
const showDialog = ref(false)
|
|
-const handleSelectAddress = () => {
|
|
|
|
|
|
+const recordId = ref('')
|
|
|
|
+const handleReceive = (item) => {
|
|
|
|
+ recordId.value = item.record.id
|
|
showDialog.value = true
|
|
showDialog.value = true
|
|
}
|
|
}
|
|
|
|
|
|
const handleSubmit = async () => {
|
|
const handleSubmit = async () => {
|
|
const receive = selectAddressRef.value.getSelected() || {}
|
|
const receive = selectAddressRef.value.getSelected() || {}
|
|
if (!receive || !Object.keys(receive).length) return Snackbar.warning('请选择您的收货地址')
|
|
if (!receive || !Object.keys(receive).length) return Snackbar.warning('请选择您的收货地址')
|
|
- console.log(receive, '收货地址')
|
|
|
|
|
|
+ // console.log(receive, '收货地址', recordId.value)
|
|
|
|
+ await luckyLotteryRecordReceive({ id: recordId.value, receiveInfo: JSON.stringify(receive) })
|
|
|
|
+ showDialog.value = false
|
|
|
|
+ recordId.value = null
|
|
|
|
+ Snackbar.success('领取成功,待商家发货')
|
|
|
|
+ getLuckLotteryRecordList()
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
|
|
|