Sfoglia il codice sorgente

放弃奖品领取

Xiao_123 4 mesi fa
parent
commit
38047dee89

+ 7 - 0
src/api/mall/prize.js

@@ -32,6 +32,13 @@ export const luckyLotteryRecordReceive = async (data) => {
 	})
 }
 
+// 放弃奖品
+export const luckyLotteryRecordGiveUp = async (id) => {
+  return await request.post({
+		url: `/app-api/promotion/luck-lottery-record/give-up?id=${id}`
+	})
+}
+
 // 创建用户期望奖品记录
 export const luckTargetCreate = async (data) => {
   return await request.post({

+ 18 - 6
src/views/recruit/personal/PersonalCenter/tradeOrder/dynamic/myPrize.vue

@@ -21,21 +21,23 @@
       </div>
     </template>
     <template #receiveInfo="{ item }">
-      <div class="ellipsis" style="max-width: 200px;">
+      <div class="ellipsis" style="max-width: 180px;">
         {{ orderReceiveInfo(item) }}
         <v-tooltip activator="parent" location="top">{{ orderReceiveInfo(item) }}</v-tooltip>
       </div>
     </template>
     <template #deliverInfo="{ item }">
-      <div class="ellipsis" style="max-width: 200px;">
+      <div class="ellipsis" style="max-width: 150px;">
         {{ item.record.deliverInfo ? JSON.parse(item.record.deliverInfo).name + '-' + JSON.parse(item.record.deliverInfo).no  : ''}}
         <v-tooltip activator="parent" location="top">{{ item.record.deliverInfo ? JSON.parse(item.record.deliverInfo).name + '-' + JSON.parse(item.record.deliverInfo).no  : ''}}</v-tooltip>
       </div>
     </template>
     <template #actions="{ item }">
-      <v-btn v-if="!item.record.isReceive && !item.record.receiveInfo" color="primary" @click.stop="handleReceive(item)" variant="outlined">领取</v-btn>
-      <span v-else-if="item.record.deliverInfo" class="color-success">已发货</span>
-      <span v-else class="color-warning">等待发货</span>
+      <div v-if="!item.record.isReceive && !item.record.receiveInfo">
+        <v-btn color="primary" @click.stop="handleReceive(item)" variant="text">领取</v-btn>
+        <v-btn color="error" @click.stop="handleGiveUp(item)" variant="text">放弃</v-btn>
+      </div>
+      <span v-else class="color-666">{{ item.record.deliverInfo ? '已发货' : '等待发货' }}</span>
     </template>
   </CtTable>
 
@@ -51,8 +53,9 @@ defineOptions({ name: 'mall-user-prize-index' })
 import { ref, computed } from 'vue'
 import SelectAddress from '@/views/recruit/personal/PersonalCenter/shippingAddress/index.vue'
 import Snackbar from '@/plugins/snackbar'
-import { getLuckLotteryRecordPage, luckyLotteryRecordReceive } from '@/api/mall/prize'
+import { getLuckLotteryRecordPage, luckyLotteryRecordReceive, luckyLotteryRecordGiveUp } from '@/api/mall/prize'
 import { timesTampChange } from '@/utils/date'
+import Confirm from '@/plugins/confirm'
 
 const queryParams = ref({
 	pageNo: 1,
@@ -107,6 +110,15 @@ const handleSubmit = async () => {
   Snackbar.success('领取成功,待商家发货')
   getLuckLotteryRecordList()
 }
+
+// 放弃领取
+const handleGiveUp = async (item) => {
+  Confirm('系统提示', `是否确定放弃领取${item.prize.name}?`).then(async () => {
+    await luckyLotteryRecordGiveUp(item.record.id)
+    Snackbar.success('放弃成功')
+    getLuckLotteryRecordList()
+  })
+}
 </script>
 
 <style scoped lang="scss">