This commit is contained in:
2026-06-08 08:57:37 +08:00
parent 08d8e27bc9
commit a14fef3841
3 changed files with 362 additions and 6 deletions
+220
View File
@@ -165,6 +165,8 @@
{ text: '* 品項名稱', value: 'act_item_selected.text', sortable: false },
{ text: '預設金額', value: 'price', sortable: false },
{ text: '數量', value: 'qty', sortable: false },
{ text: '陽上/祈福人數限制', value: 'limit_yang', sortable: false },
{ text: '超渡人數限制', value: 'limit_chao', sortable: false },
{ text: '', value: 'actions', sortable: false, width: "200px" },
],
footersDetail: {
@@ -191,6 +193,10 @@
price: 0,
qty: 0,
files: [],
has_yang_limit: false,
has_chao_limit: false,
yang_limit_count: 0,
chao_limit_count: 0,
},
defaultItem: {
id: 0,
@@ -203,6 +209,10 @@
price: 0,
qty: 0,
files: [],
has_yang_limit: false,
has_chao_limit: false,
yang_limit_count: 0,
chao_limit_count: 0,
},
//列印
data_table: {
@@ -267,10 +277,23 @@
order_dialog: {
show: false,
},
loading: false,
search: '',
headers: [
{ text: '訂單編號', value: 'order_no' },
{ text: '信眾編號', value: 'f_number' },
{ text: '信眾姓名', value: 'u_name' },
{ text: '聯絡電話', value: 'phone' },
{ text: '建立日期', value: 'order_date' },
],
items: [
{ order_no: "D", member_name: "S", order_date:"2025-12-07"}
],
}
},
mounted() {
this.search_dialog.current = this.search_dialog.controls.search1
this.loadUnfilledList();
//console.log("mounted");
},
watch: {
@@ -482,6 +505,10 @@
actItem_num: this.editedItem.act_item_selected.val,
price: this.editedItem.price,
qty: this.editedItem.qty,
has_yang_limit: this.editedItem.has_yang_limit,
has_chao_limit: this.editedItem.has_chao_limit,
yang_limit_count: this.editedItem.yang_limit_count,
chao_limit_count: this.editedItem.chao_limit_count,
}
axios
.post(HTTP_HOST + 'api/activity/SaveRelatingData', pro_order_detail)
@@ -886,6 +913,113 @@
const _date = $('#<%= startDate_solar.ClientID%>').val();
return _subject + " " + _date;
},
loadUnfilledList() {
if (!this.this_id) return;
this.unfilled_list.loading = true;
axios.get(HTTP_HOST + 'api/activity/GetUnfilledOrdersByActivity/' + this.this_id)
.then(response => {
this.unfilled_list.items = response.data.list || [];
})
.catch(error => {
console.log(error);
this.snackbar.text = "名單載入失敗:" + error;
this.snackbar.show = true;
})
.finally(() => {
this.unfilled_list.loading = false;
});
},
async printUnfilledList() {
if (!this.this_id) return;
try {
const response = await axios.get(
HTTP_HOST + `api/activity/GetUnfilledOrdersByActivity/${this.this_id}`,
{ params: { page: 1, pageSize: 99999 } }
);
const allItems = response.data.list || [];
if (allItems.length === 0) {
this.snackbar.text = "目前沒有未填寫品項的資料可供列印!";
this.snackbar.show = true;
return;
}
const activityTitle = this.titleword();
const rows = allItems.map(item => `
<tr>
<td>${item.order_no}</td>
<td>${item.f_number || ''}</td>
<td>${item.u_name}</td>
<td>${item.phone}</td>
<td>${item.order_date}</td>
</tr>
`).join('');
const win = window.open('', '_blank');
win.document.write(`
<html>
<head>
<title>未填寫品項名單 - ${activityTitle}</title>
<style>
body { font-family: "Microsoft JhengHei", Arial, sans-serif; padding: 20px; color: #000; }
.header-container { text-align: center; margin-bottom: 30px; }
h2 { margin-bottom: 5px; font-size: 24px; }
h4 { margin-top: 0; color: #333; font-weight: normal; }
table { width: 100%; border-collapse: collapse; }
th, td { border: 1px solid #000; padding: 10px 8px; text-align: left; font-size: 14px; }
th { background-color: #eee; font-weight: bold; }
.text-center { text-align: center; }
@media print {
@page { margin: 1.5cm; }
button { display: none; }
}
</style>
</head>
<body>
<div class="header-container">
<h2>尚未報名品項之信眾清單</h2>
<h4>活動名稱:${activityTitle}</h4>
</div>
<table>
<thead>
<tr>
<th width="18%">訂單編號</th>
<th width="15%">信眾編號</th>
<th width="20%">信眾姓名</th>
<th width="20%">聯絡電話</th>
<th width="27%">建單日期</th>
</tr>
</thead>
<tbody>${rows}</tbody>
</table>
<div style="margin-top: 20px; text-align: right; font-size: 12px;">
列印時間:${new Date().toLocaleString()}
</div>
</body>
</html>
`);
win.document.close();
// 確保內容載入完成後再呼叫列印
setTimeout(() => {
win.print();
win.close();
}, 300);
} catch (error) {
console.error("列印出錯:", error);
this.snackbar.text = "讀取列印資料失敗:" + error;
this.snackbar.show = true;
}
}
},
computed: {
},
@@ -925,6 +1059,10 @@
<%-- <button v-if="this_id!=''" class="nav-link" id="sec2-tab3" data-bs-toggle="tab" data-bs-target="#sec2-page3"
type="button" role="tab" aria-controls="profile" aria-selected="false">
備品項目</button>--%>
<button v-if="this_id!=''" class="nav-link" id="sec2-tab4" data-bs-toggle="tab" data-bs-target="#sec2-page4"
type="button" role="tab" aria-controls="profile" aria-selected="false" @click="loadUnfilledList">
未填寫名單
</button>
</div>
</nav>
</div>
@@ -1098,6 +1236,53 @@
<v-text-field v-model="editedItem.qty" :hide-details="true" dense single-line v-if="item.id === editedItem.id" ></v-text-field>
<span v-else>{{item.qty}}</span>
</template>
<template v-slot:item.limit_yang="{ item }">
<div class="d-flex align-center">
<v-text-field v-model="editedItem.yang_limit_count" v-if="item.id === editedItem.id"
type="number"
dense
:hide-details="true"
single-line
:disabled="!editedItem.has_yang_limit"
suffix="人" >
</v-text-field>
<v-checkbox v-if="item.id === editedItem.id"
v-model="editedItem.has_yang_limit"
label="不限"
hide-details
class="ml-2 mt-0"
:true-value="false"
:false-value="true"
:disabled="item.id !== editedItem.id">
</v-checkbox>
<span v-if="item.id !== editedItem.id && !item.has_yang_limit">不限</span>
<span v-if="item.id !== editedItem.id && item.has_yang_limit">{{item.yang_limit_count}} 人</span>
</div>
</template>
<template v-slot:item.limit_chao="{ item }">
<div class="d-flex align-center">
<v-text-field v-model="editedItem.chao_limit_count" v-if="item.id === editedItem.id"
type="number"
dense
:hide-details="true"
single-line
:disabled="!editedItem.has_chao_limit"
suffix="人" >
</v-text-field>
<v-checkbox v-if="item.id === editedItem.id"
v-model="editedItem.has_chao_limit"
label="不限"
hide-details
class="ml-2 mt-0"
:true-value="false"
:false-value="true"
:disabled="item.id !== editedItem.id">
</v-checkbox>
<span v-if="item.id !== editedItem.id && !item.has_chao_limit">不限</span>
<span v-if="item.id !== editedItem.id && item.has_chao_limit">{{item.chao_limit_count}} 人</span>
</div>
</template>
<template v-slot:item.actions="{ item }">
<template v-if="item.id === editedItem.id">
<v-icon color="red" class="mr-2" @click="cancel">
@@ -1207,6 +1392,41 @@
</div>
<div class="tab-pane fade" id="sec2-page4" role="tabpanel" aria-labelledby="sec2-tab4" v-if="this_id!=''">
<v-card class="mx-auto" outlined id="print-unfilled-area">
<v-data-table
:headers="unfilled_list.headers"
:items="unfilled_list.items"
:loading="unfilled_list.loading"
:search="unfilled_list.search"
class="elevation-1"
fixed-header
height="350px">
<template v-slot:top>
<v-toolbar flat color="white" class="d-print-none">
<div class="d-flex w-100">
<v-text-field
v-model="unfilled_list.search"
append-icon="mdi-magnify"
label="搜尋姓名或訂單號"
dense outlined single-line hide-details>
</v-text-field>
<v-btn color="primary" class="ml-2 white--text" @click="printUnfilledList">
<v-icon left>mdi-printer</v-icon>列印所有名單
</v-btn>
</div>
</v-toolbar>
</template>
<template v-slot:item.status="{ item }">
<v-chip small color="error">未選品項</v-chip>
</template>
</v-data-table>
</v-card>
</div>
</div>
</div>
</asp:Panel>
</div>