Files
17168ERP/web/admin/order/reg.aspx
2025-08-29 01:27:25 +08:00

2597 lines
142 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<%@ Page Title="後端管理" Language="C#" MasterPageFile="~/admin/Templates/TBS5ADM001/MasterPage.master" AutoEventWireup="true" CodeFile="reg.aspx.cs" Inherits="admin_order_reg" ValidateRequest="false" %>
<%@ Register Src="~/admin/_uc/alert.ascx" TagPrefix="uc1" TagName="alert" %>
<asp:Content ID="Content1" ContentPlaceHolderID="page_header" runat="Server">
<style>
.sticky-card-title {
position: sticky;
top: 0;
background-color: white;
z-index: 10;
border-bottom: 1px solid #eee;
}
</style>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="footer_script" runat="Server">
<script>
Vue.filter('timeString', function (value, myFormat) {
return value == null || value == "" ? "" : moment(value).format(myFormat || 'YYYY-MM-DD, HH:mm:ss');
});
// 模組化工作: 結合: UC, MIXIN...
let VueApp = new Vue({
el: '#app',
vuetify: new Vuetify(vuetify_options),
data() {
return {
xiaozai: [],
chaojian: [],
order_no: '<%= Request["order_no"] %>',
activity_id: '<%=_activity_id %>',
follower_id: '<%=_follower_id %>',
org_from_id_cuz_data: '<%=_org_from_id_cuz_data %>',
org_activity_cuz_data: '<%=_org_activity_cuz_data %>',
//canPrint: false,
canPrint: false,
options: {},
optionsDetail: {
multiSort: false,
itemsPerPage: -1,
},
optionsPastDetail: { multiSort: false, itemsPerPage: -1 },
search_dialog: {
controls: {
search1: {
id: 'search1',
title: '姓名/名稱',
text_prop: 'u_name',
value_prop: 'num',
keys: [
{ id: 'f_number', title: '編號', value: '' },
{ id: 'u_name', title: '姓名', value: '' },
{ id: 'address', title: '地址', value: '' },
],
api_url: HTTP_HOST + 'api/follower/GetList',
columns: [
{ id: 'f_number', title: '編號' },
{ id: 'u_name', title: '姓名' },
{ id: 'address', title: '地址' },
],
selected: {},
select(item, t) {
if (t.cellphoneDes) {
$('#<%= phone.ClientID %>').val(t.cellphoneDes);
}
else {
$('#<%= phone.ClientID %>').val(t.phoneDes);
}
$('#<%= address.ClientID %>').val(t.address);
}
},
search2: {
id: 'search2',
title: '介紹人',
text_prop: 'u_name',
value_prop: 'num',
keys: [
{ id: 'f_number', title: '編號', value: '' },
{ id: 'u_name', title: '姓名', value: '' },
{ id: 'address', title: '地址', value: '' },
],
api_url: HTTP_HOST + 'api/follower/GetList',
columns: [
{ id: 'f_number', title: '編號' },
{ id: 'u_name', title: '姓名' },
{ id: 'address', title: '地址' },
],
selected: {},
select(item, t) {
}
},
search3: {
id: 'search3',
title: '報名活動',
text_prop: 'subject',
value_prop: 'num',
keys: [
{ id: 'subject', title: '活動名稱', value: '' },
{ id: 'kindTxt', title: '活動分類' },
],
api_url: HTTP_HOST + 'api/activity/GetList',
columns: [
{ id: 'subject', title: '活動名稱' },
{ id: 'kindTxt', title: '活動分類' },
],
selected: {},
select(item, t) {
//帶出明細
if (t != null) {
}
}
},
search4: {
id: 'search4',
title: '姓名/名稱',
text_prop: 'u_name',
value_prop: 'num',
keys: [
{ id: 'f_number', title: '編號', value: '' },
{ id: 'u_name', title: '姓名', value: '' },
{ id: 'address', title: '地址', value: '' },
{ id: 'num', visible: false },
],
api_url: HTTP_HOST + 'api/follower/GetFamilyList',
columns: [
{ id: 'f_number', title: '編號' },
{ id: 'u_name', title: '姓名' },
{ id: 'address', title: '地址' },
],
selected: {},
select(item, t) {
item.address = t.address;
item.f_num_selected.text = t.u_name //=====?
item.f_num_selected.val = t.num //=====?
}
},
search5: {
id: 'search5',
title: '活動品項',
text_prop: 'subject',
value_prop: 'num',
keys: [
{ id: 'subject', title: '項目名稱', value: '' },
{ id: 'kindTxt', title: '項目分類' },
{ id: 'num', visible: false },
],
api_url: HTTP_HOST + 'api/activity/GetOrderList',
columns: [
{ id: 'subject', title: '項目名稱' },
{ id: 'kindTxt', title: '項目分類' },
],
selected: {},
select(item, t) {
if (item.actitem_num_selected.val != t.num) {
item.actitem_num_selected.text = t.subject
item.actitem_num_selected.val = t.num
item.category = t.category
if (t.category == 1) { //報名項目
//陽上/報恩者 預設帶入報名者
item.from_id_selected.text = $('#<%= f_num_txt.ClientID %>').val()
item.from_id_selected.val = parseInt($('#<%= f_num.ClientID %>').val())
}
item.price = t.price;//預設金額
item.files = t.files;
//自訂列印欄位===
item.customize_data_comb = [];
var Info = {};
Info.from_id_cuz_data = VueApp.org_from_id_cuz_data;
Info.activity_cuz_data = VueApp.org_activity_cuz_data;
Info.actitem_cuz_data = t.customize_data;
Info.order_cuz_data = $('#<%= customize_data.ClientID %>').val()
item.customize_data_comb = Info;
item.customize_data = VueApp.cuz_data_word(item.customize_data_comb, t.files);
//====
}
//this == search5
}
}, search6: {
id: 'search6',
title: '陽上/報恩者',
text_prop: 'u_name',
value_prop: 'num',
keys: [
{ id: 'f_number', title: '編號', value: '' },
{ id: 'u_name', title: '姓名', value: '' },
{ id: 'address', title: '地址', value: '' },
{ id: 'num', visible: false },
],
api_url: HTTP_HOST + 'api/follower/GetFamilyList',
columns: [
{ id: 'f_number', title: '編號' },
{ id: 'u_name', title: '姓名' },
{ id: 'address', title: '地址' },
],
selected: {},
select(item, t) {
item.from_id_selected.text = t.u_name
item.from_id_selected.val = t.num
}
}, search7: {
id: 'search7',
title: '牌位標題:超渡',
text_prop: 'title',
value_prop: 'num',
keys: [
{ id: 'title', title: '標題', value: '' },
],
api_url: HTTP_HOST + 'api/follower/GetTabletList',
columns: [
{ id: 'type', title: '超渡/陽上', width: '100px' },
{ id: 'title', title: '牌位標題' },
],
selected: {},
select(item, t) {
}
}, search8: {
id: 'search8',
title: '牌位標題:陽上',
text_prop: 'title',
value_prop: 'num',
keys: [
{ id: 'title', title: '標題', value: '' },
],
api_url: HTTP_HOST + 'api/follower/GetTabletList',
columns: [
{ id: 'type', title: '超渡/陽上', width: '100px' },
{ id: 'title', title: '牌位標題' },
],
selected: {},
select(item, t) {
}
},
},
show: false,
current: {},
list: [],
count: 0,
page: 1,
loading: false,
footer: {
showFirstLastPage: true,
disableItemsPerPage: true,
itemsPerPageAllText: '',
itemsPerPageText: '',
//'items-per-page-options': [10, 20, 30, 40, 50, 100]
},
},
snackbar: {
show: false,
text: "",
},
data_dialog: {
show: false,
isAddNew: false,
},
actItem_kind_num: "",
itemKindList: {
num: 0,
kind: ''
}
//報名詳細資料
, detail_total_price: 0
, disableButton: true
, searchDetail: '',
headersDetail: [
{ text: '* 項目名稱', value: 'actitem_num_selected.text', sortable: false, width:'200px' },
// { text: '姓名', value: 'f_num_selected.text', sortable: false },
/* { text: '代表地址', value: 'address', sortable: false },*/
// { text: '陽上/報恩者', value: 'from_id_selected.text', sortable: false },
//{ text: '姓名', value: 'f_num_tablet', sortable: false },
//{ text: '陽上/報恩者', value: 'from_id_tablet', sortable: false },
{ text: '標題/陽上', value: 'f_num_tablet', sortable: false, width: '200px' },
{ text: '開始/期滿日期', value: 'start_date', sortable: false, width:'150px' },
//{ text: '期滿日期', value: 'due_date', sortable: false },
{ text: '延續日', value: 'extend_date', sortable: false },
//{ text: '劃位狀態', value: 'calculated', sortable: false },
/*{ text: '預設金額', value: 'price', sortable: false },*/
{ text: "包含疏文", value: 'shuwen', sortbale: false },
{ text: '* 數量', value: 'qty', sortable: false },
{ text: '合計', value: 'total', sortable: false },
{ text: '報名狀態(未收)', value: 'keyin1_selected.text', sortable: false },
{ text: '掛單', value: 'bed', sortable: false, },
{ text: '', value: 'actions', sortable: false, width: "210px" },
],
footersDetail: {
showFirstLastPage: false,
disableItemsPerPage: false,
itemsPerPageAllText: '',
itemsPerPageText: '',
'prev-icon': null,
'next-icon': null,
'disable-pagination':true,
'items-per-page-options': []
},
rules: {
//required: value => !!value || 'Required.',
min: (v) => {
return v > 0 || `請輸入正確數字`;
},
},
desserts: [],
desserts_count: 0,
editedIndex: -1,
editedItem: {
id: 0,
num: 0,
actitem_num_selected: {
text: '',
val: 0
},
f_num_selected: {
text: '',
val: 0
},
f_num_tablet: '',
print_id: '',
address: '',
from_id_selected: {
text: '',
val: 0
},
from_id_tablet: '',
due_date: '',
start_date: new Date().format("yyyy-MM-dd"),
extend_date: '',
price: 0,
qty: 0,
writeBedQty: 0,
notBedQty: 0,
category: 0,
pay: 0,
pay_date: '',
keyin1_selected: {
text: '未確認',
val: 1
},
demo: '',
files: [],
customize_data: '',
customize_data_comb: [],
printed_files: '',
},
defaultItem: {
id: 0,
num: 0,
actitem_num_selected: {
text: '',
val: 0
},
f_num_selected: {
text: '',
val: 0
},
f_num_tablet: '',
print_id: '',
address: '',
from_id_selected: {
text: '',
val: 0
},
from_id_tablet: '',
due_date: '',
start_date: new Date().format("yyyy-MM-dd"),
extend_date: '',
price: 0,
qty: 0,
writeBedQty: 0,
notBedQty: 0,
category: 0,
pay: 0,
pay_date: '',
keyin1_selected: {
text: '未確認',
val: 1
},
demo: '',
files: [],
customize_data: '',
customize_data_comb: [],
printed_files: '',
},
keyin1_items: [{ //報名狀態
text: "請選擇",
val: 0
},],
//列印文件
file_dialog: {
show: false,
},
//未付款紀錄
recordsDetail: { multiSort: false },
topDetail: [
{ text: '訂單編號', value: 'orderno', sortable: false },
{ text: '訂單日期', value: 'up_time', sortable: false },
{ text: '姓名/名稱', value: 'u_name', sortable: false },
{ text: '訂單金額', value: 'totalprice', sortable: false, align: 'end', },
{ text: '已收金額', value: 'payprice', sortable: false, align: 'end', },
{ text: '未收金額', value: 'notpay', sortable: false, align: 'end', },
],
lists: [],
order_total_price: 0,
order_payprice_price: 0,
order_notpay_price: 0,
//單筆訂單未付款紀錄
order2lDetail: { multiSort: false },
popDetail: [
{ text: '項目名稱', value: 'actItem_numTxt', sortable: false },
{ text: '姓名', value: 'u_name', sortable: false },
{ text: '金額', value: 'price', sortable: false, align: 'end', },
{ text: '已收金額', value: 'pay', sortable: false, align: 'end', },
{ text: '未收金額', value: 'notpay', sortable: false, align: 'end', },
],
order2lists: [],
order2_total_price: 0,
order2_payprice_price: 0,
order2_notpay_price: 0,
//單筆明細複製
copy_dialog: {
show: false,
},
copy_data: {
item_num: 0,
qty: 1,
},
//複製以往報名
copy_past_dialog: {
show: false,
},
copy_past_data: {
},
past_table: {
selected: [],
desserts: [],
headersDetail: [
{ text: '訂單編號', value: 'order_no', sortable: false },
{ text: '項目名稱', value: 'actitem_num_selected.text', sortable: false },
{ text: '活動名稱', value: 'activity_selected.text', sortable: false },
{ text: '報名日期', value: 'up_time', sortable: false },
],
singleSelect: false,
searchOrderDetail: '',
count: 0,
},
//編輯牌位
tablet_edit: {
show: false,
initialized: false,
currentItem: {}
},
//收款註記
cash_dialog: {
show: false,
isAddNew: false,
},
cashDetail: { multiSort: false },
cash_table: {
disableButton: true,
desserts: [],
count: 0,
headersDetail: [
{ text: '* 日期', value: 'pay_date', sortable: false },
{ text: '* 收款金額', value: 'price', sortable: false },
{ text: '* 收款帳戶', value: 'payment_selected.text', sortable: false },
{ text: '付款機構', value: 'organization', sortable: false },
{ text: '帳號後5碼', value: 'bank_code', sortable: false },
{ text: '', value: 'actions', sortable: false, width: "120px" },
],
searchOrderDetail: '',
editedIndex: -1,
editedItem: {
id: 0,
num: 0,
payment_selected: {
text: '現金',
val: 1
},
price: 0,
pay_date: new Date().format("yyyy-MM-dd"),
organization: '',
bank_code: '',
},
defaultItem: {
id: 0,
num: 0,
payment_selected: {
text: '現金',
val: 1
},
price: 0,
pay_date: new Date().format("yyyy-MM-dd"),
organization: '',
bank_code: '',
},
payment_items: [{ //付款方式
text: "請選擇",
val: 0
},],
},
}
},
mounted() {
this.detalKeyinArray();
this.initKindList();
//this.pastOrderList();
this.search_dialog.current = this.search_dialog.controls.search1 ///default
this.cashPaymentArray();
// 監聽來自 iframe 的消息
window.addEventListener('message', async (event) => {
if (event.data.source === 'editor.btn.click') {
const receivedData = event.data.data;
// 更新編輯中的項目
//if (receivedData.tabletItem && this.editedIndex > -1) {
if (receivedData.tabletItem) {
// 將 tablet_data 轉換為 JSON 字串
//this.editedItem.f_num_tablet = JSON.stringify(receivedData.tablet_data);
// 確保其他必要欄位保持不變
const currentItem = this.desserts[this.editedIndex];
//currentItem.f_num_tablet = JSON.stringify(receivedData.tablet_data);
this.editedItem = {
...currentItem,
f_num_tablet: JSON.stringify(receivedData.tablet_data)
};
// 呼叫 save 方法
await this.save();
}
// 關閉編輯對話框
this.tablet_edit.show = false;
// 顯示成功訊息
this.snackbar.text = '牌位資料已更新';
this.snackbar.show = true;
}
});
// 初始化 iframe
const iframe = document.querySelector('iframe#tablet_edit_iframe');
if (iframe) {
iframe.onload = () => {
this.tablet_edit.initialized = true;
};
}
},
watch: {
options: {
handler() {
this.search_get()
},
deep: true,
},
'tablet_edit.show': {
handler(newVal) {
if (!newVal && this._savedEditedItem) {
this.editedItem = $.extend(true, {}, this._savedEditedItem);
this._savedEditedItem = null;
}
}
},
optionsDetail: {
handler() {
this.initialize();
},
deep: true,
},
recordsDetail: {
handler() {
this.initCollection();
},
deep: true,
},
order2lDetail: {
handler() {
//this.initUnpayDetail();
},
deep: true,
},
optionsPastDetail: {
handler() {
this.pastOrderList();
},
deep: true,
},
cashDetail: {
handler() {
this.payOrderList();
},
deep: true,
},
desserts: {
handler(newVal) {
this.processData();
},
deep: true
}
},
methods: {
dataDialogClose() {
},
search_show(curr) {
this.search_dialog.current = curr;
this.search_clear()
//this.search_get()//清除完自動會重抓, 故取消
this.search_dialog.show = true;
},
search_clear() {
if (!this.search_dialog.current.keys) return;
this.search_dialog.current.keys.forEach((t, i) => { t.value = '' })
this.search_get()
},
search_get() {
if (!this.search_dialog.current.keys) return;
let api_url = this.search_dialog.current.api_url;
let keys = this.search_dialog.current.keys;
//const { page, itemsPerPage } = this.options
//const { sortBy, sortDesc, page, itemsPerPage } = this.options
this.search_dialog.page = this.options.page ?? 1
let params = { page: this.search_dialog.page, pageSize: 10 };//url params
var search = {};//post body
keys.forEach((t, i) => {
search[t.id] = t.value;
});
//necessary parameter===
if (this.search_dialog.current.id == 'search5') {
search['num'] = this.activity_id;
}
if (this.search_dialog.current.id == 'search4') {
search['num'] = this.follower_id;
}
if (this.search_dialog.current.id == 'search6') {
search['num'] = this.follower_id;
}
if (this.search_dialog.current.id == 'search7' || this.search_dialog.current.id == 'search8') {
search['num'] = this.follower_id;
}
console.log("search_get", api_url, search, params, this.options);
this.search_dialog.loading = true
axios.post(api_url, search, { params: params })
.then(response => {
this.search_dialog.list = response.data.list
this.search_dialog.count = response.data.count
this.search_dialog.loading = false
})
.catch(error => {
console.log(error)
this.search_dialog.list = []
this.search_dialog.count = 0
this.search_dialog.loading = false
this.snackbar.text = "錯誤:" + error
this.snackbar.show = true
})
},
search_headers() {
if (!this.search_dialog.current.columns) return;
r = [];
this.search_dialog.current.columns.forEach((t, i) => {
//console.log("search_headers:", t, i);
r.push({
text: t.title,
width: t.width,
align: 'start',
sortable: false,
value: t.id,
})
})
return r
},
search_select(row) {
let curr = this.search_dialog.current;
let target = $(`[data-search-control=${curr.id}]`);
curr.selected = row;
//牌位
if (curr.id == 'search7') {
this.editedItem.f_num_tablet = curr.selected[curr.text_prop];
} else if (curr.id == 'search8') {
this.editedItem.from_id_tablet = curr.selected[curr.text_prop];
} else {
target.children("input.search-text").val(curr.selected[curr.text_prop])//text
target.children("input:hidden").val(curr.selected[curr.value_prop])//value
}
if (curr.select instanceof Function) {
curr.select(this.editedItem, row);
}
this.search_dialog.show = false;
//console.log(row, row["u_name"], row["f_number"], curr.id, target);
},
//報名詳細資料
initKindList() {
axios
.get(HTTP_HOST + 'api/actItem_kind/GetAll')
.then(response => {
this.itemKindList = response.data
})
.catch(error => console.log(error))
},
detalKeyinArray() {
var getArray = <%=Newtonsoft.Json.JsonConvert.SerializeObject(_keyin1Item, Newtonsoft.Json.Formatting.Indented) %> || {};
if (typeof getArray === 'object' && getArray !== null) {
var keys = Object.keys(getArray);
for (let i = 0; i < keys.length; i++) {
//console.log(`${keys[i]}:${getArray[keys[i]]}`); //value : text
var _tmp = {
text: getArray[keys[i]],
val: parseInt(keys[i]),
}
this.keyin1_items.push(_tmp);
}
}
},
cashPaymentArray() {
const params = {
page: 1, pageSize: 999999
};
const search = {
record_payment: "Y",
}
axios
.post(HTTP_HOST + 'api/accounting/GetAccountKindList', search, { params: params })
.then(response => {
//this.cash_table.payment_items = response.data.list
if (response.data.count > 0) {
for (let i = 0; i < response.data.list.length; i++) {
var _tmp = {
text: response.data.list[i].kind,
val: response.data.list[i].num
}
this.cash_table.payment_items.push(_tmp);
}
}
})
.catch(error => console.log(error))
},
calutotalPrice() {
this.detail_total_price = 0;
if (this.desserts.length > 0)
for (var i = 0; i < this.desserts.map(x => x.id).length; i++) {
this.detail_total_price += parseInt(this.desserts[i].price * this.desserts[i].qty);
}
},
initialize() {
if (this.order_no != '') {
const { sortBy, sortDesc, page, itemsPerPage } = this.optionsDetail
const params = {
sortBy: sortBy[0], sortDesc: sortDesc[0],
page: page, pageSize: itemsPerPage,////若-1, 抓全部
//page: page,
pageSize: itemsPerPage,//// 抓全部
};
var searchItemDetail = {
order_no: this.order_no,
actItem_kind_num: this.actItem_kind_num,
}
axios
////此處不必翻頁
.post(HTTP_HOST + 'api/order/GetItemList', searchItemDetail, { params: params })
.then(response => {
this.desserts = response.data.list !== undefined ? response.data.list : []
this.desserts_count = response.data.list !== undefined ? response.data.count : 0
this.calutotalPrice();
this.disableButton = false;
})
.catch(
error => console.log(error)
)
}
},
editItem(item) {
item.customize_data = item.num > 0 ? item.customize_data??"" : this.cuz_data_word(item.customize_data_comb, item.files);
this.editedIndex = this.desserts.indexOf(item);
//日期處理
let isValidDate = Date.parse(item.due_date);
if (!isNaN(isValidDate))
item.due_date = new Date(item.due_date).format("yyyy-MM-dd")
isValidDate = Date.parse(item.start_date);
if (!isNaN(isValidDate))
item.start_date = new Date(item.start_date).format("yyyy-MM-dd")
isValidDate = Date.parse(item.extend_date);
if (!isNaN(isValidDate))
item.extend_date = new Date(item.extend_date).format("yyyy-MM-dd")
isValidDate = Date.parse(item.pay_date);
if (!isNaN(isValidDate))
item.pay_date = new Date(item.pay_date).format("yyyy-MM-dd")
this.editedItem = $.extend(true, {}, item);
this.data_dialog.show = true;
this.data_dialog.isAddNew = false;
//this.editedItem.actitem_num =
},
printItem(item) {
this.editedIndex = this.desserts.indexOf(item);
this.editedItem = $.extend(true, {}, item);
this.file_dialog.show = true;
},
async editTablet(item) {
this.editedIndex = this.desserts.indexOf(item);
this.editedItem = $.extend(true, {}, item);
try {
// 如果是新項目,先保存
if (this.editedItem.num <= 0 || this.editedItem.num === null || this.editedItem.num === undefined) {
this.editedItem.qty = 1;
const savedItem = await this.save(false);
if (savedItem) {
this.$set(this.desserts, this.editedIndex, savedItem);
this.editedItem = $.extend(true, {}, savedItem);
}
}
// 先發送消息
await this.sendMessageToIframe();
// 保存當前的 editedItem 數據
const currentData = $.extend(true, {}, this.editedItem);
// 顯示對話框
this.tablet_edit.show = true;
// 立即恢復數據
this.editedItem = $.extend(true, {}, currentData);
} catch (error) {
console.error('Error in editTablet:', error);
}
},
async sendMessageToIframe() {
const iframe = document.querySelector('iframe#tablet_edit_iframe');
// 在這裡深度複製 editedItem確保數據不會被修改
const itemToSend = $.extend(true, {}, this.editedItem);
if (iframe) {
try {
// 準備要發送的數據
let familyMembers = [];
try {
// 嘗試獲取家族成員數據
const response = await axios.get(HTTP_HOST + 'api/familymembers/follower/' + this.follower_id);
familyMembers = response.data;
} catch (error) {
console.warn('error:', error);
}
// 準備發送的數據
const itemInfo = {
source: 'order.btn.click',
tabletItem: {
...itemToSend,
title: this.titleword() // 確保標題被包含
},
familyMembers: familyMembers
};
iframe.contentWindow.postMessage(itemInfo, '*');
// 發送後確認數據完整性
// 如果數據被清除,立即恢復
if (!this.editedItem.num && itemToSend.num) {
this.$nextTick(() => {
this.editedItem = $.extend(true, {}, itemToSend);
});
}
} catch (error) {
console.error('Error in sendMessageToIframe:', error);
}
} else {
console.error('iframe not found');
}
},
deleteItem(item) {
//confirm('確定要刪除此筆資料嗎?') && this.desserts.splice(index, 1);
if (confirm('確定要刪除此筆資料嗎?')) {
const index = this.desserts.indexOf(item);
if (item.num > 0) {
if (index != -1) {
axios
.delete(HTTP_HOST + 'api/order/DeleteItem/' + item.num)
.then(response => {
console.log("del", item);
this.desserts.splice(index, 1)
this.calutotalPrice();
this.desserts_count = this.desserts_count-1
})
.catch(error => console.log(error))
}
} else {
this.desserts.splice(index, 1)
}
}
},
cancel() {
//data-search-control need to return to the original value
this.spliceNullData();
this.close();
},
spliceNullData() {
//if new data ,then splice it
if (this.data_dialog.isAddNew && this.editedItem.num == 0) {
for (var i = 0; i < this.desserts.map(x => x.id).length; i++) {
if (this.desserts[i].id == this.editedItem.id) {
this.desserts.splice(i, 1); break;
}
}
}
},
close() {
setTimeout(() => {
this.editedItem = $.extend(true, {}, this.defaultItem);
this.editedIndex = -1;
}, 300)
},
addNew() {
//addObj.id = this.desserts.length + 1;
var keysArr = [];
for (var i = 0; i < this.desserts.map(x => x.id).length; i++) {
keysArr.push(parseInt(this.desserts[i].id));
}
var _c = Math.max.apply(null, keysArr);
const addObj = $.extend(true, {}, this.defaultItem);
addObj.id = (isFinite(_c) ? _c : 0) + 1;
this.desserts.unshift(addObj);
this.editItem(addObj);
this.data_dialog.show = true;
this.data_dialog.isAddNew = true;
},
requireData(data, isNumber) {
if (data == null) return false;
else if (data === undefined) return false;
else if (data == "") return false;
if (isNumber) {
if (parseInt(data) == 0) return false;
}
return true;
},
async save(shouldClose = true) {
if (this.editedIndex > -1) {
if (this.order_no != '') {
//chcck necessary params
if (this.editedItem.actitem_num_selected.val != 0 &&
this.editedItem.keyin1_selected.val !=0 &&
/*this.editedItem.f_num_selected.val != 0 &&*/
/* (this.editedItem.category=="1"? this.editedItem.from_id_selected.val != 0 : true) &&*/
this.requireData(this.editedItem.qty, (this.editedItem.num == 0 ? false : true)) ) /* qty為0視為不需要此項目,不儲存此筆資料*/
{
//check price
if (this.editedItem.pay <= this.editedItem.price * this.editedItem.qty) {
//check qty
//數量不可小於掛單明細的數量
if (this.editedItem.qty >= this.editedItem.writeBedQty + this.editedItem.notBedQty) {
//insert or update data
var pro_order_detail =
{
num: this.editedItem.num<=0 ? null : this.editedItem.num,
order_no: this.order_no,
parent_num: this.editedItem.parent_num,
actItem_num: this.editedItem.actitem_num_selected.val,
f_num: this.editedItem.f_num_selected.val,
f_num_tablet: this.editedItem.f_num_tablet,
print_id: this.editedItem.print_id,
address: this.editedItem.address,
from_id: this.editedItem.from_id_selected.val,
from_id_tablet: this.editedItem.from_id_tablet,
start_date: this.editedItem.category == 1 ? this.editedItem.start_date : null,
due_date: this.editedItem.category == 1 ? this.editedItem.due_date : null,
extend_date: this.editedItem.category == 1 ? this.editedItem.extend_date : null,
price: this.editedItem.price,
qty: this.editedItem.qty,
//total: this.editedItem.total,
keyin1: this.editedItem.keyin1_selected.val,
demo: this.editedItem.demo,
pay: this.editedItem.pay,
pay_date: this.editedItem.pay_date,
customize_data: this.editedItem.customize_data,
}
await axios
.post(HTTP_HOST + 'api/order/SaveDetailData', pro_order_detail)
.then(response => {
// 使用 Vue.set 或 $set 來確保響應式更新
const updatedItem = {
...this.editedItem,
num: response.data.num,
customize_data: response.data.customize_data,
print_id: response.data.print_id,
isPackage: response.data.isPackage,
////f_num_tablet: response.data.f_num_tablet//不需更新, 已經有, 且無傳回
};
// 更新 desserts 數組
this.$set(this.desserts, this.editedIndex, updatedItem);
// 更新 editedItem
this.editedItem = $.extend(true, {}, updatedItem);
if (shouldClose) {
this.close();
this.data_dialog.show = false;
}
// 強制更新
this.$forceUpdate();
})
.catch(error => console.log(error))
} else {
const _w = "數量不可小於掛單明細數量,如需減少數量,請先至掛單明細刪除";
msgbox(_w)
this.snackbar.text = _w;
this.snackbar.show = true
}
} else {
this.snackbar.text = "已收金額不可大於應收金額";
this.snackbar.show = true
}
} else {
this.snackbar.text = "必填項目未填寫完整";
this.snackbar.show = true
}
} else {
this.snackbar.text = "單號錯誤";
this.snackbar.show = true
}
}
return this.editedItem; // 返回更新後的項目
},
selectChange(obj,select_val) {
for (var value of obj.values()) {
if (select_val == value.val) {
if (obj === this.keyin1_items)
this.editedItem.keyin1_selected.text = value.text;
break;
}
}
},
toBedItem(item) {
if (item.writeBedQty == 0 && item.notBedQty == 0) {
if (item.f_num_selected.val > 0) {
if (confirm('是否確定轉掛單表單?')) {
var pro_order_detail =
{
num: item.num,
order_no: this.order_no,
qty: item.qty,
}
axios
.post(HTTP_HOST + 'api/bed/CreateBedList', pro_order_detail)
.then(response => {
window.location = 'bed_reg.aspx?order_no=' + this.order_no + '&detail=' + item.num;
})
.catch(
error => console.log(error)
)
}
} else {
this.snackbar.text = "請先選擇姓名";
this.snackbar.show = true
}
} else if (item.writeBedQty + item.notBedQty != item.qty){
if (confirm('劃位數量不符,如欲減少數量請先取消後修改報名明細數量,如欲增加請確認儲存。')) {
var pro_order_detail =
{
num: item.num,
order_no: this.order_no,
f_num: item.f_num_selected.val,
}
axios
.post(HTTP_HOST + 'api/bed/CreateBedList', pro_order_detail)
.then(response => {
window.location = 'bed_reg.aspx?order_no=' + this.order_no + '&detail=' + item.num;
})
.catch(
error => console.log(error)
)
}
}
else {
window.location = 'bed_reg.aspx?order_no=' + this.order_no + '&detail=' + item.num;
}
},
cuz_data_word(cuz, columnList) {
//console.log({...columnList})
var _column = [];
if (columnList.length > 0) {
for (var i = 0; i < columnList.length; i++) {
var _list = columnList[i].cuz_column.split('$');
_list.forEach(function (item, index, array) {
//console.log(item, index);
if (item != '' && item != null && item !== undefined) {
//_column.push("$" + item.replace("\r\n", "").trim())
const str = "$" + item.replace("\r\n", "").trim().split(':')[0] + ":";
if (!_column.includes(str))//有重複不加入
_column.push(str)////不再加入值
}
});
}
}
//格式->品項->活動->信眾->報名->報名明細
//未在格式定義的參數也要顯示
if (cuz.actitem_cuz_data != '' && cuz.actitem_cuz_data != null && cuz.actitem_cuz_data !== undefined) {
var _list = cuz.actitem_cuz_data.split('$');
this.proCuzData(cuz, columnList, _list, _column)
}
if (cuz.activity_cuz_data != '' && cuz.activity_cuz_data != null && cuz.activity_cuz_data !== undefined) {
var _list = cuz.activity_cuz_data.split('$');
this.proCuzData(cuz, columnList, _list, _column)
}
if (cuz.from_id_cuz_data != '' && cuz.from_id_cuz_data != null && cuz.from_id_cuz_data !== undefined) {
var _list = cuz.from_id_cuz_data.split('$');
this.proCuzData(cuz, columnList, _list, _column)
}
if (cuz.order_cuz_data != '' && cuz.order_cuz_data != null && cuz.order_cuz_data !== undefined) {
var _list = cuz.order_cuz_data.split('$');
this.proCuzData(cuz, columnList, _list, _column)
}
return _column.join("\r\n");
},
proCuzData(cuz, columnList, _list, _column) {
_list.forEach(function (item, index, array) {
if (item != '' && item != null && item !== undefined) {
var _k = item.split(':');
//for (var i = 0; i < columnList.length; i++) {
// const _cdata = columnList[i].cuz_column;
// if (_cdata != '' && _cdata != null && _cdata !== undefined) {
// const _l = _cdata.indexOf(_k[0]);
// if (_l > -1) {
// let dd = _cdata.substring(_l, _cdata.length - 1);
// //console.log(dd)
// var _v = dd.split('$');
// _column.push("$" + _v[0].replace("\r\n", "").trim() + _k[1]);
// }
// }
//}
//不再加入值
let isExist = false;
for (var i = 0; i < _column.length; i++) {
if (_column[i].split(':')[0] == ("$" + _k[0])) {
//if (_k[1] != '' && _k[1] != null && _k[1] !== undefined)
// _column[i] = _column[i].split(':')[0] + ":" + _k[1].trim();
isExist = true;
}
}
if (!isExist) {
//未在格式定義的參數要加入
_column.push("$" + _k[0] + ":")
}
}
});
}, printItemLog(num, detail,printed_files) {
var goApi = true;
if (printed_files != '') {
var _k = printed_files.split(',');
for (var i = 0; i < _k.length; i++) {
if ("\"" + num + "\"" == _k[i]) {
goApi = false;
break;
}
}
}
if (goApi) {
const _url = HTTP_HOST +"api/order/printFileLog/" + num + "/" + detail;
axios.get(_url)
.then(response => {
this.editedItem.printed_files = response.data;
})
.catch(error => {
console.log(error)
})
}
}, printedThis(num) {
if (this.editedItem.printed_files != '') {
var _k = this.editedItem.printed_files.split(',');
for (var i = 0; i < _k.length; i++) {
if ("\"" + num + "\"" == _k[i]) {
return true
}
}
}
return false
},
//單筆複製
copyItem(item) {
this.copy_data.item_num = item.num;
this.copy_data.qty = 1;
this.copy_dialog.show = true;
},
copyDetailData() {
if (this.copy_data.qty >= 1) {
axios
.get(HTTP_HOST + 'api/order/copyDetailData/' + this.copy_data.item_num + '/' + this.copy_data.qty)
.then(response => {
this.copy_dialog.show = false;
this.initialize();
})
.catch(
error => console.log(error)
)
} else {
this.snackbar.text = "數量不正確";
this.snackbar.show = true
}
},
//複製以往報名
pastOrderList() {
if (this.order_no != '') {
const { sortBy, sortDesc, page, itemsPerPage } = this.optionsPastDetail
const params = {
sortBy: sortBy[0], sortDesc: sortDesc[0],
page: page,
pageSize: itemsPerPage,
//pageSize: -1,
};
var searchItemDetail = {
f_num: this.follower_id,
order_no: this.order_no,
}
axios
.post(HTTP_HOST + 'api/order/GetPastOrderList', searchItemDetail, { params: params })
.then(response => {
this.past_table.desserts = response.data.list !== undefined ? response.data.list : []
this.past_table.count = response.data.list !== undefined ? response.data.count : 0
})
.catch(
error => console.log(error)
)
}
},
copyPastItem() {
var params = {
order_no: this.order_no,
};
var list = [];
list = this.past_table.selected.map(x => x.num)
if (list.length > 0) {
const _url = HTTP_HOST + 'api/order/copyMultiPastItem';
axios.post(_url, list, { params: params })
.then(response => {
this.copy_past_dialog.show = false;
this.initialize();
this.past_table.selected=[]
})
.catch(error => {
console.log(error)
})
}else {
this.snackbar.text = "未選擇複製項目";
this.snackbar.show = true
}
},
//未付款資訊
initCollection() {
if (this.follower_id != '') {
const { sortBy, sortDesc, page, itemsPerPage } = this.recordsDetail
const params = {
sortBy: sortBy[0], sortDesc: sortDesc[0],
page: page, pageSize: itemsPerPage,
order_no: '',
};
var searchItemDetail = {
num: this.follower_id,
}
axios
.post(HTTP_HOST + 'api/order/GetUnpayList', searchItemDetail, { params: params })
.then(response => {
this.lists = response.data.list;
for (var i = 0; i < this.lists.map(x => x.id).length; i++) {
this.order_total_price += parseInt(this.lists[i].totalPrice);
this.order_payprice_price += parseInt(this.lists[i].payPrice);
this.order_notpay_price += parseInt(this.lists[i].totalPrice) - parseInt(this.lists[i].payPrice);
}
})
.catch(
error => console.log(error)
)
}
},
initUnpayDetail() {
//if (this.follower_id != '') {
// const { sortBy, sortDesc, page, itemsPerPage } = this.recordsDetail
// const params = {
// sortBy: sortBy[0], sortDesc: sortDesc[0],
// page: page, pageSize: itemsPerPage,
// };
// var searchItemDetail = {
// order_no: this.order_no,
// }
// axios
// .post(HTTP_HOST + 'api/order/GetUnpayDetail', searchItemDetail, { params: params })
// .then(response => {
// this.order2lists = response.data.list;
// for (var i = 0; i < this.order2lists.map(x => x.id).length; i++) {
// this.order2_total_price += parseInt(this.order2lists[i].price);
// this.order2_payprice_price += parseInt(this.order2lists[i].pay);
// this.order2_notpay_price += (parseInt(this.order2lists[i].price) - parseInt(this.order2lists[i].pay));
// }
// })
// .catch(
// error => console.log(error)
// )
//}
}, titleword() {
const _f_num_txt = $('#<%= f_num_txt_link.ClientID%>').text();
const _date = $('#titleDate').text();
return this.order_no +" "+ _f_num_txt + " " + _date;
},
//收款註記
payOrderList() {
if (this.order_no != '' && this.editedItem.num !='') {
const { sortBy, sortDesc, page, itemsPerPage } = this.cashDetail
const params = {
sortBy: sortBy[0], sortDesc: sortDesc[0],
page: page, pageSize: itemsPerPage,
};
var searchItemDetail = {
detail_num: this.editedItem.num,
}
axios
.post(HTTP_HOST + 'api/order/GetPayOrderList', searchItemDetail, { params: params })
.then(response => {
this.cash_table.desserts = response.data.list !== undefined ? response.data.list : []
this.cash_table.count = response.data.list !== undefined ? response.data.count : 0
this.cash_table.disableButton = false;
})
.catch(
error => console.log(error)
)
}
},
payOrderList2() {
if (this.order_no != '' && this.editedItem.num != '') {
const params = {
page: 1, pageSize: 10,
};
var searchItemDetail = {
detail_num: this.editedItem.num,
}
axios
.post(HTTP_HOST + 'api/order/GetPayOrderList', searchItemDetail, { params: params })
.then(response => {
this.cash_table.desserts = response.data.list !== undefined ? response.data.list : []
this.cash_table.count = response.data.list !== undefined ? response.data.count : 0
this.cash_table.disableButton = false;
})
.catch(
error => console.log(error)
)
}
},
spliceCashNullData() {
//if new data ,then splice it
if (this.cash_table.editedItem.num == 0) {
for (var i = 0; i < this.cash_table.desserts.map(x => x.id).length; i++) {
if (this.cash_table.desserts[i].id == this.cash_table.editedItem.id) {
this.cash_table.desserts.splice(i, 1); break;
}
}
}
},
addCashNew() {
this.spliceCashNullData();
this.cash_table.editedIndex = -1;
var keysArr = [];
for (var i = 0; i < this.cash_table.desserts.map(x => x.id).length; i++) {
//console.log(this.desserts[i].id)
keysArr.push(parseInt(this.cash_table.desserts[i].id));
}
var _c = Math.max.apply(null, keysArr);
const addObj = $.extend(true, {}, this.cash_table.defaultItem);
addObj.id = (isFinite(_c) ? _c : 0) + 1;
this.cash_table.desserts.unshift(addObj);
this.cash_editItem(addObj);
this.cash_dialog.isAddNew = true;
this.cash_table.disableButton = true;
},
cash_editItem(item) {
this.cash_table.editedIndex = this.cash_table.desserts.indexOf(item);
//日期處理
let isValidDate = Date.parse(item.pay_date);
if (!isNaN(isValidDate))
item.pay_date = new Date(item.pay_date).format("yyyy-MM-dd")
this.cash_table.editedItem = $.extend(true, {}, item);
this.cash_dialog.isAddNew = false;
},
cash_deleteItem(item) {
if (confirm('確定要刪除此筆資料嗎?')) {
const index = this.cash_table.desserts.indexOf(item);
if (item.num > 0) {
if (index != -1) {
axios
.delete(HTTP_HOST + 'api/order/DeleteRecordDetail/' + item.num)
.then(response => {
console.log("del", item);
this.cash_table.desserts.splice(index, 1)
this.cash_table.count = this.cash_table.desserts_count - 1;
this.calePrice();
})
.catch(error => console.log(error))
}
} else {
this.cash_table.desserts.splice(index, 1)
}
}
},
cash_close() {
this.spliceCashNullData();
this.cash_table.disableButton = false;
setTimeout(() => {
this.cash_table.editedItem = Object.assign({}, this.cash_table.defaultItem);
this.cash_table.editedIndex = -1;
}, 300)
},
cash_selectChange(obj, select_val) {
for (var value of obj.values()) {
//console.log(value.text,value.val);
if (select_val == value.val) {
if (obj === this.cash_table.payment_items)
this.cash_table.editedItem.payment_selected.text = value.text;
break;
}
}
}, cash_save() {
if (this.cash_table.editedIndex > -1) {
if (this.order_no != '' && this.editedItem.num > 0) {
//chcck necessary params
if (this.cash_table.editedItem.pay_date != '' && this.cash_table.editedItem.price > 0 && this.cash_table.editedItem.payment_selected.val > 0) {
//檢查:已收金額不能超過總額
if (parseInt(this.cash_table.editedItem.price) + parseInt(this.editedItem.pay) <= parseInt(this.editedItem.price) * parseInt(this.editedItem.qty)) {
//insert or update data
var detail =
{
num: this.cash_table.editedItem.num,
detail_num: this.editedItem.num,
price: this.cash_table.editedItem.price,
payment: this.cash_table.editedItem.payment_selected.val,
pay_date: this.cash_table.editedItem.pay_date,
organization: this.cash_table.editedItem.organization,
bank_code: this.cash_table.editedItem.bank_code,
}
axios
.post(HTTP_HOST + 'api/order/SaveRecordDetail', detail)
.then(response => {
this.cash_table.editedItem.num = response.data;
//處理下拉文字
for (let i = 0; i < this.cash_table.payment_items.length; i++) {
if (this.cash_table.payment_items[i].val == this.cash_table.editedItem.payment_selected.val) {
this.cash_table.editedItem.payment_selected.text = this.cash_table.payment_items[i].text;
break;
}
}
//this.cash_table.editedItem.payment_selected.text = this.cash_table.payment_items[this.cash_table.editedItem.payment_selected.val].text;
Object.assign(this.cash_table.desserts[this.cash_table.editedIndex], this.cash_table.editedItem)
this.calePrice();
this.cash_close();
})
.catch(
error => console.log(error)
)
} else {
this.snackbar.text = "已收金額不能超過小計";
this.snackbar.show = true
}
} else {
this.snackbar.text = "必填項目未填寫完整";
this.snackbar.show = true
}
} else {
this.snackbar.text = "訂單或品項錯誤";
this.snackbar.show = true
}
}
},
calePrice() {
//重新計算已收金額
this.editedItem.pay = 0;
for (var i = 0; i < this.cash_table.desserts.map(x => x.id).length; i++) {
this.editedItem.pay += parseInt(this.cash_table.desserts[i].price);
}
},
checkItemStatus(item) {
if (item.num==0 || item.num === null || item.num === '') {
Swal.fire({
title: '尚未儲存',
text: '請先儲存上層項目, 才能加入子項目',
confirmButtonText: 'OK'
});
} else {
// Logic for fetching sub items will go here
itemNum = item.actitem_num_selected.val;
api_url = HTTP_HOST + "api/order/GetChildItems?item_num=" + itemNum
+ "&order_no=" + item.order_no +"&order_detail_num="+item.num;
var hasChild = this.desserts.some(x => x.parent_num == item.num);
if (hasChild) {
Swal.fire({
title: '已有子項目',
text: '已經有子項目,無法加入!',
confirmButtonText: 'OK'
});
}else{
axios.post(api_url)//, { item_num: itemNum }
.then(response => {
// Assuming the API returns an array of child items
//this.childItems = response.data;
value = response.data;
if (value === null || value === undefined || (Array.isArray(value) && value.length === 0)) {
Swal.fire({
title: '沒有子項目',
text: '沒有對應的子項目!',
confirmButtonText: 'OK'
});
}
////Assuming this method is inside the VueApp object
//insertAfterItem(item, value) {
const index = this.desserts.indexOf(item);
// 修改前:
// this.desserts.splice(index + 1, 0, ...value);
// 修改後:
// 1. 先創建新的響應式對象數組
const newItems = value.map(newItem => ({
...this.defaultItem, // 包含默認值
...newItem // 覆蓋新數據
}));
this.desserts.splice(index + 1, 0, ...newItems);
//}
})
.catch(error => {
console.error("Error fetching child items:", error);
Swal.fire({
title: '沒有子項目',
text: '沒有對應的子項目!!',
confirmButtonText: 'OK'
});
});
}
// this is VUE code
// use item actitem_num_selected.value to get child items from act_bom
// call the api in : \App_Code\api\orderController.cs
// api/order/SaveRecordDetail, pass actitem_num_selected.value
// and get the list here
}
},
processData() {
const grouped = {};
this.xiaozai = []
this.desserts.forEach(item => {
if (true) {
if (!item.f_num_tablet) {
return;
}
var pw = JSON.parse(item.f_num_tablet)
if (!pw || !pw.mid_items || item.isPackage == 1) {
return;
}
if (item.actitem_num_selected.text.includes('消')) {
pw.mid_items.forEach(midItem => {
if (midItem.IsShuWen) {
if (!this.xiaozai.includes(midItem.fam_name))
this.xiaozai.push(midItem.fam_name)
}
})
}
else if (item.actitem_num_selected.text.includes('超')) {
const leftNames = []
for (const leftItem of pw.left_items) {
if (!leftNames.includes(leftItem.fam_name?.trim())) {
leftNames.push(leftItem.fam_name?.trim())
}
}
var leftFamName = leftNames.join(' ');
if (!leftFamName) return;
function convertToSet(str) {
return new Set(str.split(/\s+/));
}
function compareSets(set1, set2) {
if (set1.size !== set2.size) return false;
for (let item of set1) {
if (!set2.has(item)) return false;
}
return true;
}
let matchedKey = null;
let leftFamNameSet = convertToSet(leftFamName);
for (let key in grouped) {
let groupSet = convertToSet(key);
if (compareSets(groupSet, leftFamNameSet)) {
matchedKey = key;
break;
}
}
if (matchedKey) {
leftFamName = matchedKey
}
if (!grouped[leftFamName]) {
grouped[leftFamName] = [];
}
for (const midItem of pw.mid_items) {
if (midItem.fam_name && midItem.IsShuWen) {
const name = midItem.fam_name.trim();
if (!grouped[leftFamName].includes(name)) {
grouped[leftFamName].push(name);
}
}
}
}
}
});
const result = Object.entries(grouped).map(([fam_name, mid_names]) => ({
fam_name,
mid_names
}));
this.chaojian = result;
},
customPastOrderFilter(value, search, item) {
debugger;
// value 實際上是欄位值item 是整列物件
if (!search) return true;
search = search.toLowerCase();
// 只針對4個欄位
return (
(item.order_no && String(item.order_no).toLowerCase().includes(search)) ||
(item.actitem_num_selected && item.actitem_num_selected.text && String(item.actitem_num_selected.text).toLowerCase().includes(search)) ||
(item.activity_selected && item.activity_selected.text && String(item.activity_selected.text).toLowerCase().includes(search)) ||
(item.up_time && String(item.up_time).toLowerCase().includes(search))
);
},
},
computed: {
getTabletText() { // 不需要參數,因為會返回一個函數
return (f_num_tablet) => { // 保持原有的函數結構
try {
if (!f_num_tablet) {
return { mid: '', left: '' };
}
const data = typeof f_num_tablet === 'string'
? JSON.parse(f_num_tablet)
: f_num_tablet;
// 格式化函數
const formatItems = (items) => {
if (!items || !Array.isArray(items)) return '';
return items.map(i => i.fam_name)
.reduce((acc, name, index, arr) => {
const isBreak = items[index].option_break;
return acc + name + (index < arr.length - 1 ? (isBreak ? '<br>' : ' ') : '');
}, '');
};
return {
mid: formatItems(data.mid_items),
left: formatItems(data.left_items)
};
} catch (e) {
console.error('Error in getTabletText:', e);
return { mid: '', left: '' };
}
};
}
},
filters: {
currency: function (value) {
return value == null || value==="" ? "" :
('$' + parseFloat(value).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, "$1,").replace(".00", ""));
},
}
})
</script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="page_nav" runat="Server">
<div class="scroll-nav nav nav-tabs mb-2 mb-sm-0 d-none d-sm-flex">
<template v-if="order_no !='' "> {{titleword()}} </template>
</div>
<div class="">
<asp:Button ID="add" runat="server" Text="送出" OnClick="add_Click" CssClass="btn btn-primary" />
<asp:Button ID="edit" runat="server" Text="修改" Visible="false" OnClick="edit_Click" CssClass="btn btn-primary" />
<asp:Button ID="goback" runat="server" Text="回列表" Visible="false" CausesValidation="false" OnClick="goback_Click" CssClass="btn btn-outline-secondary" />
</div>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<uc1:alert runat="server" ID="L_msg" Text="" />
<div id="content" class="container-fluid">
<div class="card shadow-sm my-2" id="sec2">
<div class="card-header py-0">
<nav class="navbar py-0">
<div class="nav nav-tabs">
<button class="nav-link active" id="sec2-tab1" data-bs-toggle="tab" data-bs-target="#sec2-page1"
type="button" role="tab" aria-controls="home" aria-selected="true">
基本資料</button>
<button class="nav-link" id="sec2-tab2" data-bs-toggle="tab" data-bs-target="#sec2-page2"
type="button" role="tab" aria-controls="profile" aria-selected="false">
報名明細</button>
<button class="nav-link" id="sec2-tab5" data-bs-toggle="tab" data-bs-target="#sec2-page5"
type="button" role="tab" aria-controls="profile" aria-selected="false">
疏文名單</button>
<button 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" v-if="lists.length > 0">
未付款紀錄 </button>
<button 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" v-if="order2lists.length > 0" >
未付款紀錄 </button>
</div>
</nav>
</div>
<div class="card-body">
<div class="tab-content" id="myTabContent">
<div class="tab-pane fade show active" id="sec2-page1" role="tabpanel" aria-labelledby="sec2-tab1">
<div>
<div class="form-text text-muted">以下 * 欄位為必填欄位</div>
</div>
<div class="label-sm-right">
<div class="row mb-1 ">
<label class="col-sm-2 col-lg-1 col-form-label">單號</label>
<div class="col-sm-4 col-lg-3 pt-2">
<asp:Literal ID="order_no" runat="server"></asp:Literal>
</div>
<label class="col-sm-2 col-lg-1 col-form-label">報名日期 *</label>
<div class="col-sm-4 col-lg-3">
<asp:PlaceHolder ID="up_timePH" runat="server">
<asp:TextBox ID="up_time" runat="server" CssClass="form-control " TextMode="Date" autocomplete="off" data-date-format="yyyy-mm-dd"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" ControlToValidate="up_time" runat="server" ErrorMessage="必填!" Display="Dynamic" SetFocusOnError="true"></asp:RequiredFieldValidator>
</asp:PlaceHolder>
<asp:Literal ID="up_time2" runat="server"></asp:Literal>
</div>
<label class="col-sm-2 col-lg-1 col-form-label">單據狀態 *</label>
<div class="col-sm-4 col-lg-3">
<asp:DropDownList ID="keyin1" runat="server" CssClass="form-select"></asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator5" ControlToValidate="keyin1" runat="server" ErrorMessage="必填!" Display="Dynamic" SetFocusOnError="true"></asp:RequiredFieldValidator>
</div>
</div>
<div class="row mb-1 ">
<label class="col-sm-2 col-lg-1 col-form-label">報名活動</label>
<div class="col-sm-10 col-lg-3">
<asp:PlaceHolder ID="activity_numPH" runat="server">
<div class="input-group mb-3" data-search-control="search3" @click="order_no=='' && search_show(search_dialog.controls.search3)">
<input class="form-control search-text" type="text" readonly
id="activity_num_txt" runat="server" placeholder="報名活動" value="">
<asp:HiddenField ID="activity_num" runat="server" Value="" />
<button class="btn btn-outline-secondary" type="button">
<i class="mdi mdi-view-list-outline"></i>
</button>
</div>
</asp:PlaceHolder>
<asp:Literal ID="activity_num_txt2" runat="server"></asp:Literal>
</div>
<label class="col-sm-2 col-lg-1 col-form-label">姓名/名稱 *</label>
<div class="col-sm-4 col-lg-3">
<asp:PlaceHolder ID="f_numPH" runat="server">
<div class="input-group mb-3" data-search-control="search1" @click="order_no=='' && search_show(search_dialog.controls.search1)" >
<input class="form-control search-text" type="text" readonly
id="f_num_txt" runat="server" placeholder="姓名/名稱" value="">
<asp:HiddenField ID="f_num" runat="server" Value="" />
<button class="btn btn-outline-secondary" type="button">
<i class="mdi mdi-view-list-outline"></i>
</button>
</div>
<asp:RequiredFieldValidator ID="RequiredFieldValidator6" ControlToValidate="f_num_txt" runat="server" ErrorMessage="必填!" Display="Dynamic" SetFocusOnError="true"></asp:RequiredFieldValidator>
</asp:PlaceHolder>
<asp:HyperLink ID="f_num_txt_link" runat="server" Target="_blank" CssClass="nav-link pt-2"></asp:HyperLink>
</div>
<label class="col-sm-2 col-lg-1 col-form-label">聯絡電話 *</label>
<div class="col-sm-4 col-lg-3">
<asp:TextBox ID="phone" MaxLength="15" runat="server" CssClass="form-control" data-encrypt="Y" placeholder="請輸入聯絡電話"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator9" ControlToValidate="phone" runat="server" ErrorMessage="必填!" Display="Dynamic" SetFocusOnError="true"></asp:RequiredFieldValidator>
</div>
</div>
<div class="row mb-1 label-sm-right">
<label class="col-sm-2 col-lg-1 col-form-label">介紹人</label>
<div class="col-sm-4 col-lg-3">
<div class="input-group mb-3" data-search-control="search2" @click="search_show(search_dialog.controls.search2)">
<input class="form-control search-text" type="text" readonly
id="introducer_txt" runat="server" placeholder="介紹人" value="">
<asp:HiddenField ID="introducer" runat="server" Value="" />
<button class="btn btn-outline-secondary" type="button">
<i class="mdi mdi-view-list-outline"></i>
</button>
</div>
</div>
<label class="col-sm-2 col-lg-1 col-form-label">收件地址</label>
<div class="col-sm-10 col-lg-7">
<asp:TextBox ID="address" MaxLength="200" runat="server" CssClass="form-control" placeholder="請輸入收件地址"></asp:TextBox>
</div>
</div>
<div class="row mb-1 label-sm-right">
<div class="col-sm-6 col-lg-4">
<div class="input-group mb-3">
<asp:CheckBox ID="send_receipt" runat="server" Text="是否寄送收據" />
</div>
</div>
<label class="col-sm-2 col-lg-1 col-form-label">收據抬頭</label>
<div class="col-sm-10 col-lg-7">
<asp:TextBox ID="receipt_title" MaxLength="200" runat="server" CssClass="form-control" placeholder="請輸入收據抬頭"></asp:TextBox>
</div>
</div>
</div>
<hr />
<div class="row mb-1">
<label class="col-form-label">備註</label>
<div class="">
<asp:TextBox ID="demo" runat="server" Rows="5" TextMode="MultiLine" CssClass="form-control" placeholder="請輸入備註"></asp:TextBox>
</div>
</div>
<div class="row mb-1">
<label class="col-form-label">自定義欄位預設值</label>
<div class="">
<asp:TextBox ID="customize_data" runat="server" Rows="3" TextMode="MultiLine" CssClass="form-control" placeholder="一行輸入一個定義欄位預設值,如:&#10;$活動:OO年法會&#10;$地點:台中市OO區OO路" ToolTip="一行輸入一個定義欄位預設值,格式: $變數名稱:值"></asp:TextBox>
</div>
</div>
<div class="row mb-1">
<asp:Panel ID="timePanel1" runat="server" CssClass="col-12 text-right text-primary" Visible="false">建檔時間:<asp:Literal ID="reg_time" runat="server"></asp:Literal></asp:Panel>
</div>
</div>
<div class="tab-pane fade label-sm-right" id="sec2-page2" role="tabpanel" aria-labelledby="sec2-tab2">
<v-card class="mx-auto" outlined v-if="order_no!=''">
<v-data-table
:headers="headersDetail"
:items="desserts"
:footer-props="footersDetail"
:search="searchDetail"
:options.sync="optionsDetail" class="elevation-1" fixed-header height="350px"
item-key="num"
<%-- :server-items-length="desserts_count"--%>
>
<v-divider inset></v-divider>
<template v-slot:top>
<v-toolbar flat color="white">
<div class="d-flex w-100">
<select class="form-select mr-2" style="width: 180px;" v-model="actItem_kind_num" @change="initialize">
<option value="">選擇分類</option>
<option v-for="item in itemKindList" :value="item.num">{{item.kind}}</option>
</select>
<v-text-field v-model="searchDetail" append-icon="mdi-magnify" label="查詢" dense outlined single-line hide-details></v-text-field>
<v-btn
color="orange"
class="ml-2 white--text"
:disabled="disableButton"
@click="copy_past_dialog.show=true;past_table.selected=[]">
<v-icon dark>mdi-plus</v-icon>複製以往報名
</v-btn>
<v-btn
color="primary"
class="ml-2 white--text"
:disabled="disableButton"
@click="addNew">
<v-icon dark>mdi-plus</v-icon>新增
</v-btn>
</div>
</v-toolbar>
</template>
<template v-slot:item.actitem_num_selected.text="{ item }">
<v-icon color="orange" class="mr-2"
title ="加入子項目"
@click="checkItemStatus(item)"
v-if="item.isPackage==1">
mdi-file-tree
</v-icon>
<v-icon color="grey" class="ms-2"
v-if="item.parent_num>0">
mdi-subdirectory-arrow-right
</v-icon>
{{item.actitem_num_selected.text}}
<div v-if="item.num<=0" class="text-danger">(預設資料,未存檔)</div>
</template>
<template v-slot:item.from_id_selected.text="{ item }">
<span v-if="item.category==1">{{item.from_id_selected.text}}</span>
</template>
<template v-slot:item.f_num_tablet="{ item }">
<span v-if="item.isPackage==0">
<div>
<span class="badge rounded-pill bg-secondary">標題</span>
<span v-html="getTabletText(item.f_num_tablet).mid"></span>
</div>
<div>
<span class="badge rounded-pill bg-secondary">陽上</span>
<span v-html="getTabletText(item.f_num_tablet).left"></span>
</div>
<div class="d-none">
{{item.f_num_tablet}}
</div>
</span>
</template>
<template v-slot:item.shuwen="{item}">
{{ item.f_num_tablet && item.f_num_tablet.includes('"IsShuWen":true') ? '是' : '否'}}
</template>
<template v-slot:item.start_date="{ item }">
<span v-if="item.category==1">
<div>
<span class="badge rounded-pill bg-secondary">開始</span>
<span>{{item.start_date|timeString('YYYY/MM/DD')}}</span>
</div>
<div>
<span class="badge rounded-pill bg-secondary">期滿</span>
<span>{{item.due_date|timeString('YYYY/MM/DD')}}</span>
</div>
</span>
</template>
<template v-slot:item.extend_date="{ item }">
<span v-if="item.category==1">{{item.extend_date|timeString('YYYY/MM/DD')}}</span>
</template>
<template v-slot:item.calculated="{ item }">
<span v-if="item.category==2">{{item.notBedQty}}/{{item.writeBedQty}}</span>
</template>
<%--<template v-slot:item.price="{ item }">
{{item.price | currency }}
</template> --%>
<template v-slot:item.qty="{ item }">
{{item.qty}}
</template>
<template v-slot:item.total="{ item }">
{{item.price * item.qty | currency }}
</template>
<template v-slot:item.keyin1_selected.text="{ item }">
{{item.keyin1_selected.text}}({{item.price * item.qty - item.pay | currency}})
</template>
<template v-slot:item.bed="{ item }">
<div v-if="item.category==2" >
<v-icon class="mr-2" @click="toBedItem(item);">
mdi-bed
</v-icon>
</div>
</template>
<template v-slot:item.actions="{ item }">
<%-- <div v-if="item.id === editedItem.id">
<v-icon color="red" class="mr-3" @click="cancel">
mdi-window-close
</v-icon>
<v-icon color="green" @click="save">
mdi-content-save
</v-icon>
</div>--%>
<div >
<v-icon title="複製" color="orange" class="mr-2" @click="copyItem(item)" v-if="item.num>0" >
mdi-plus
</v-icon>
<v-icon title="編輯" color="green" class="mr-2" @click="editItem(item);">
mdi-pencil
</v-icon>
<v-icon title="刪除" color="red" class="mr-2" @click="deleteItem(item)">
mdi-delete
</v-icon>
<v-icon title="編輯牌位" color="blue" class="mr-2" @click="editTablet(item);">
mdi-file-document-edit-outline
</v-icon>
<v-icon title="列印" color="blue" class="mr-2" @click="printItem(item);" v-if="canPrint || lists.length==0" >
mdi-printer
</v-icon>
</div>
</template>
<template v-slot:body.append>
<tr>
<td colspan="6" class="text-right">合計</td>
<td class="text-right"> {{detail_total_price | currency }}</td>
</tr>
</template>
</v-data-table>
</v-card>
<div class="mx-auto" v-else >
<p class="lead">請先儲存基本資料後再新增明細</p>
</div>
</div>
<div class="tab-pane fade" id="sec2-page3" role="tabpanel" aria-labelledby="sec2-tab3" >
<v-card class="mx-auto mt-10" outlined v-if="order_no!=''">
<v-data-table
:headers="topDetail"
:items="lists"
class="elevation-1" fixed-header height="350px">
<v-divider inset></v-divider>
<template v-slot:item.orderno="{ item }">
<a :href="'../order/reg.aspx?order_no='+item.order_no" target="_blank" >{{item.order_no}}</a>
</template>
<template v-slot:item.up_time="{ item }">
<span >{{item.up_time|timeString('YYYY/MM/DD')}}</span>
</template>
<template v-slot:item.totalprice="{ item }">
{{item.totalPrice | currency }}
</template>
<template v-slot:item.payprice="{ item }">
{{item.payPrice | currency }}
</template>
<template v-slot:item.notpay="{ item }">
<span >{{item.totalPrice - item.payPrice | currency}}</span>
</template>
<template v-slot:body.append>
<tr>
<td colspan="3" class="text-right">合計</td>
<td class="text-right"> {{order_total_price | currency }}</td>
<td class="text-right"> {{order_payprice_price | currency }}</td>
<td class="text-right"> {{order_notpay_price | currency }}</td>
</tr>
</template>
</v-data-table>
</v-card>
<v-checkbox
v-model="canPrint"
label="允許列印文件"
color="success"
value="false"
hide-details>
</v-checkbox>
</div>
<div class="tab-pane fade" id="sec2-page4" role="tabpanel" aria-labelledby="sec2-tab4" >
<v-card class="mx-auto mt-10" outlined v-if="order_no!=''">
<v-data-table
:headers="popDetail"
:items="order2lists"
:options.sync="order2lDetail" class="elevation-1" fixed-header height="350px">
<v-divider inset></v-divider>
<template v-slot:item.price="{ item }">
{{item.price | currency }}
</template>
<template v-slot:item.pay="{ item }">
{{item.pay | currency }}
</template>
<template v-slot:item.notpay="{ item }">
<span >{{item.price - item.pay | currency}}</span>
</template>
<template v-slot:body.append>
<tr>
<td colspan="2" class="text-right">合計</td>
<td class="text-right"> {{order2_total_price | currency }}</td>
<td class="text-right"> {{order2_payprice_price | currency }}</td>
<td class="text-right"> {{order2_notpay_price | currency }}</td>
</tr>
</template>
</v-data-table>
</v-card>
</div>
<div class="tab-pane fade label-sm-right" id="sec2-page5" role="tabpanel" aria-labelledby="sec2-tab2">
<p>消災名單</p>
<div>
{{Array.from(xiaozai).join(' ')}}
</div>
<hr/>
<template>
<p>超薦名单</p>
<div v-for="name in chaojian" :key="name.fam_name" class="block" v-if="name.mid_names && name.mid_names.length > 0">
<div class="mid-names">
{{ name.mid_names.join(' ') }}
</div>
<div class="fam-name">
—— {{ name.fam_name }}
</div>
<hr/>
</div>
</template>
</div>
</div>
</div>
</div>
<v-dialog v-model="data_dialog.show" max-width="900px" persistent >
<v-card>
<v-card-title class="justify-space-between grey lighten-2">
報名明細
<v-btn icon @click="data_dialog.show=false;cancel()"><v-icon>mdi-close</v-icon></v-btn>
</v-card-title>
<v-card-text>
<v-row dense class="pt-2">
<v-col :cols="2" class="pt-3 text-end" >
<span class="fs-6 text text-dark">項目名稱 *</span>
</v-col>
<v-col :cols="10" >
<div class="input-group mb-3" data-search-control="search5" @click="search_show(search_dialog.controls.search5)" >
<input class="form-control search-text" type="text" readonly
placeholder="項目名稱" v-model="editedItem.actitem_num_selected.text" >
<input type="hidden" v-model="editedItem.actitem_num_selected.val">
<button class="btn btn-outline-secondary" type="button">
<i class="mdi mdi-view-list-outline"></i>
</button>
</div>
</v-col>
</v-row>
<v-row dense class="pt-2">
<v-col :cols="2" class="pt-3 text-end" >
<span class="fs-6 text text-dark">牌位編號</span>
</v-col>
<v-col :cols="10" >
<v-text-field v-model="editedItem.print_id" :hide-details="true" dense single-line :maxlength=100></v-text-field>
</v-col>
</v-row>
<%--<v-row dense class="pt-2">
<v-col :cols="2" class="pt-3 text-end" >
<span class="fs-6 text text-dark">姓名</span>
</v-col>
<v-col :cols="10" >
<div class="input-group mb-3" data-search-control="search4" @click="search_show(search_dialog.controls.search4)" >
<input class="form-control search-text" type="text" readonly
placeholder="姓名" v-model="editedItem.f_num_selected.text" >
<input type="hidden" v-model="editedItem.f_num_selected.val" >
<button class="btn btn-outline-secondary" type="button">
<i class="mdi mdi-view-list-outline"></i>
</button>
</div>
</v-col>
</v-row>--%>
<v-row dense class="pt-2 d-none">
<v-col :cols="2" class="pt-3 text-end" >
<span class="fs-6 text text-dark">牌位資料</span>
</v-col>
<v-col :cols="10" >
<div class="input-group mb-3" >
<%--<textarea class="form-control search-text" placeholder="牌位標題" rows="4" v-model="editedItem.f_num_tablet"></textarea>--%>
<v-textarea
ref="textarea"
label="牌位標題"
v-model="editedItem.f_num_tablet"
:value="editedItem.f_num_tablet"
></v-textarea>
<div >
<button class="btn btn-outline-secondary " type="button"
data-search-control="search7" @click="search_show(search_dialog.controls.search7)" >
<i class="mdi mdi-view-list-outline"></i>
</button>
</div>
</div>
</v-col>
</v-row>
<%-- <v-row dense class="pt-2" v-if="editedItem.category==1">
<v-col :cols="2" class="pt-3 text-end" >
<span class="fs-6 text text-dark">陽上/報恩者</span>
</v-col>
<v-col :cols="10" >
<div class="input-group mb-3" data-search-control="search6" @click="search_show(search_dialog.controls.search6)" >
<input class="form-control search-text" type="text" readonly
placeholder="陽上/報恩者" v-model="editedItem.from_id_selected.text">
<input type="hidden" v-model="editedItem.from_id_selected.val">
<button class="btn btn-outline-secondary" type="button">
<i class="mdi mdi-view-list-outline"></i>
</button>
</div>
</v-col>
</v-row>--%>
<v-row dense class="pt-2 d-none">
<v-col :cols="2" class="pt-3 text-end" >
<span class="fs-6 text text-dark">牌位資料(舊)</span>
</v-col>
<v-col :cols="10" >
<div class="input-group mb-3" >
<v-textarea
ref="textarea"
label="牌位標題"
v-model="editedItem.from_id_tablet"
></v-textarea>
<div >
<button class="btn btn-outline-secondary " type="button"
data-search-control="search8" @click="search_show(search_dialog.controls.search8)" >
<i class="mdi mdi-view-list-outline"></i>
</button>
</div>
</div>
</v-col>
</v-row>
<v-row dense class="pt-2">
<v-col :cols="2" class="pt-3 text-end" >
<span class="fs-6 text text-dark">代表地址</span>
</v-col>
<v-col :cols="10" >
<v-text-field v-model="editedItem.address" :hide-details="true" dense single-line :maxlength=200></v-text-field>
</v-col>
</v-row>
<v-row dense class="pt-2" v-if="editedItem.category==1">
<v-col :cols="2" class="pt-3 text-end" >
<span class="fs-6 text text-dark">開始日期</span>
</v-col>
<v-col :cols="10" :md="4" >
<v-text-field v-model="editedItem.start_date" :hide-details="true" dense single-line type="date" ></v-text-field>
</v-col>
<v-col :cols="2" class="pt-3 text-end" >
<span class="fs-6 text text-dark">期滿日期</span>
</v-col>
<v-col :cols="10" :md="4" >
<v-text-field v-model="editedItem.due_date" :hide-details="true" dense single-line type="date" ></v-text-field>
</v-col>
</v-row>
<v-row dense class="pt-2" v-if="editedItem.category==1">
<v-col :cols="2" class="pt-3 text-end" >
<span class="fs-6 text text-dark">延續日</span>
</v-col>
<v-col :cols="10" :md="4" >
<v-text-field v-model="editedItem.extend_date" :hide-details="true" dense single-line type="date" ></v-text-field>
</v-col>
</v-row>
<v-row dense class="pt-2" v-if="editedItem.category==2">
<v-col :cols="2" class="pt-3 text-end" >
<span class="fs-6 text text-dark">劃位狀態</span>
</v-col>
<v-col :cols="10" class="pt-3" >
{{editedItem.notBedQty}}/{{editedItem.writeBedQty}}
</v-col>
</v-row>
<v-row dense class="pt-2" >
<v-col :cols="2" class="pt-5 text-end" >
<span class="fs-6 text text-dark">報名狀態 *</span>
</v-col>
<v-col :cols="10" :md="4" >
<v-select @change="selectChange(keyin1_items,editedItem.keyin1_selected.val)"
item-text="text"
item-value="val"
v-model="editedItem.keyin1_selected.val"
:items="keyin1_items"
></v-select>
</v-col>
</v-row>
<v-row dense class="pt-2 " >
<v-col :cols="2" class="pt-3 text-end" >
<span class="fs-6 text text-dark">功德金</span>
</v-col>
<v-col :cols="10" :md="3" >
<v-text-field v-model="editedItem.price" :hide-details="true" dense single-line :maxlength=8 placeholder="金額" type="number" min="0" ></v-text-field>
</v-col>
<v-col :cols="2" :sm="1" class="pt-3 text-end" >
<span class="fs-6 text text-dark">數量 *</span>
</v-col>
<v-col :cols="10" :md="3" >
<v-text-field v-model="editedItem.qty" :hide-details="true" dense single-line :maxlength=8 type="number" min="0" ></v-text-field>
</v-col>
<v-col :cols="2" :sm="1" class="pt-3 text-end" >
<span class="fs-6 text text-dark">合計</span>
</v-col>
<v-col :cols="10" :md="2" class="pt-3 fs-6 text fw-bold" >
{{editedItem.price * editedItem.qty | currency }}
</v-col>
</v-row>
<v-row dense class="pt-2" >
<v-col :cols="2" class="pt-3 text-end" >
<span class="fs-6 text text-dark">已收</span>
</v-col>
<v-col :cols="10" :md="2" class="pt-3 fs-6 text fw-bold" >
<%-- <v-text-field v-model="editedItem.pay" :hide-details="true" dense single-line :maxlength=8 ></v-text-field>--%>
{{editedItem.pay | currency }}
</v-col>
<v-col :cols="2" class="pt-3 text-end" >
<span class="fs-6 text text-dark">未收</span>
</v-col>
<v-col :cols="10" :md="2" class="pt-3 fs-6 text fw-bold">
{{editedItem.price * editedItem.qty - editedItem.pay | currency }}
</v-col>
<v-col :cols="12" :md="2" v-if="editedItem.num >0" >
<v-btn class="ma-2" color="primary" dark @click="cash_dialog.show = true;payOrderList2()" > 收款紀錄 <v-icon dark right > mdi-cash-plus </v-icon> </v-btn>
</v-col>
</v-row>
<v-row dense class="pt-2" >
<v-col :cols="2" class="pt-3 text-end" >
<span class="fs-6 text text-dark">付款期限</span>
</v-col>
<v-col :cols="10" :md="4" >
<v-text-field v-model="editedItem.pay_date" :hide-details="true" dense single-line type="date" ></v-text-field>
</v-col>
</v-row>
<v-row dense class="pt-2" >
<v-col :cols="2" class="pt-3 text-end" >
<span class="fs-6 text text-dark">狀態備註</span>
</v-col>
<v-col :cols="10" >
<v-text-field v-model="editedItem.demo" :hide-details="true" dense single-line ></v-text-field>
</v-col>
</v-row>
<v-row dense class="pt-2" >
<v-col :cols="5" :md="2" class="pt-3 text-end" >
<span class="fs-6 text text-dark">自定義列印欄位</span>
</v-col>
<v-col :cols="12" :md="10" >
<v-textarea v-model="editedItem.customize_data" ></v-textarea
</v-col>
</v-row>
<v-row dense class="pt-2" >
<v-col :cols="12" class="pt-3 text-center" >
<v-btn class="ma-2" color="primary" dark @click="save()" > 儲存 <v-icon dark right > mdi-content-save </v-icon> </v-btn>
</v-col>
</v-row>
</v-card-text>
</v-card>
</v-dialog>
<v-dialog v-model="search_dialog.show" max-width="700px">
<v-card>
<v-card-title class="justify-space-between grey lighten-2">
查詢:{{search_dialog.current.title}}
<v-btn icon @click="search_dialog.show=false"><v-icon>mdi-close</v-icon></v-btn>
</v-card-title>
<v-card-text >
<v-row>
<v-col v-for="item in search_dialog.current.keys"
:cols="search_dialog.current.keys.length>1?6:12" >
<v-text-field v-model="item.value" :label="item.title" v-if="item.visible===undefined || item.visible==true "></v-text-field>
</v-col>
<v-col cols="12" class="text-end">
<v-btn color="primary" elevation="0" @click="search_get()">查詢</v-btn>
<v-btn elevation="0" @click="search_clear()">清除條件</v-btn>
</v-col>
</v-row>
<v-data-table
:headers="search_headers()"
:items="search_dialog.list"
:footer-props="search_dialog.footer"
:items-per-page="10"
:server-items-length="search_dialog.count"
:page.sync="search_dialog.page"
:options.sync="options"
@click:row="search_select"
:loading="search_dialog.loading"
></v-data-table>
</v-card-text>
<v-card-actions>
</v-card-actions>
</v-card>
</v-dialog>
<v-dialog v-model="file_dialog.show" max-width="400px">
<v-card>
<v-card-title class="justify-space-between grey lighten-2">
相關文件
<v-btn icon @click="file_dialog.show=false;"><v-icon>mdi-close</v-icon></v-btn>
</v-card-title>
<v-card-text >
<v-row v-for="item in editedItem.files" densee class="pt-3" >
<v-col :cols="1" >
<v-icon dense >mdi-rhombus-medium</v-icon>
</v-col>
<v-col :cols="7" >
<a :href="'../print/print.aspx?num='+item.num+'&detail='+editedItem.num+'&class='+item.paperset" @click="printItemLog(item.num,editedItem.num,editedItem.printed_files)" target="_blank" class="text-decoration-none">
<span class="fs-6 text text-dark">{{item.subject}}</span>
</a>
</v-col>
<v-col :cols="4" class="text-right">
<v-icon color="blue" class="mr-2" v-if="printedThis(item.num)" >
mdi-check-circle
</v-icon>
<a :href="'../print/print.aspx?num='+item.num+'&detail='+editedItem.num+'&class='+item.paperset" @click="printItemLog(item.num,editedItem.num,editedItem.printed_files)" target="_blank" class="text-decoration-none">
<v-icon color="blue" >
mdi-printer
</v-icon>
</a>
</v-col>
</v-row>
</v-card-text>
<v-card-actions>
</v-card-actions>
</v-card>
</v-dialog>
<v-dialog v-model="copy_dialog.show" max-width="400px">
<v-card>
<v-card-title class="justify-space-between grey lighten-2">
複製
<v-btn icon @click="copy_dialog.show=false;"><v-icon>mdi-close</v-icon></v-btn>
</v-card-title>
<v-card-text >
<v-row densee class="pt-3" >
<v-col :cols="2" class="pt-5" >
<span class="fs-6 text text-dark">筆數</span>
</v-col>
<v-col :cols="10" >
<v-text-field v-model.number="copy_data.qty"
:rules="[rules.min( copy_data.qty)]"
type="number" />
<a slot="prepend" @click="copy_data.qty--;"><v-icon color="green" >mdi-minus</v-icon></a>
<a slot="append" @click="copy_data.qty++;"><v-icon color="red">mdi-plus</v-icon></a>
</v-row>
<v-row densee class="pt-3" >
<v-col :cols="12" class="pt-3 text-center" >
<v-btn class="ma-2" color="primary" dark @click="copyDetailData()" > 確認 </v-btn>
</v-col>
</v-row>
</v-card-text>
</v-card>
</v-dialog>
<v-dialog v-model="copy_past_dialog.show" max-width="800px">
<v-card>
<v-card-title class="justify-space-between grey lighten-2">
以往報名
<v-btn icon @click="copy_past_dialog.show=false;past_table.selected=[]"><v-icon>mdi-close</v-icon></v-btn>
</v-card-title>
<div style="max-height: 60vh; overflow-y: auto;">
<v-data-table
v-model="past_table.selected"
item-key="num"
:headers="past_table.headersDetail"
:items="past_table.desserts"
:search="past_table.searchOrderDetail"
:custom-filter="customPastOrderFilter"
:single-select="past_table.singleSelect"
:server-items-length="past_table.count"
show-select
:options.sync="optionsPastDetail" class="elevation-1" fixed-header>
<v-divider inset></v-divider>
<template v-slot:top>
<v-toolbar flat color="white">
<div class="d-flex w-100">
<v-text-field v-model="past_table.searchOrderDetail" append-icon="mdi-magnify" label="查詢" dense outlined single-line hide-details></v-text-field>
<v-btn
color="orange"
class="ml-2 white--text"
@click="copyPastItem">
複製勾選<v-icon dark>mdi-turn-right</v-icon>
</v-btn>
</div>
</v-toolbar>
</template>
<template v-slot:item.isprinted="{ item }">
<v-icon color="blue" class="mr-2" v-if="item.isPrinted" >
mdi-check-circle
</v-icon>
</template>
<template #item.up_time="{ item }" >
{{ item.up_time|timeString('YYYY/MM/DD') }}
</template>
</v-data-table>
</div>
</v-card>
</v-dialog>
<v-dialog v-model="cash_dialog.show" max-width="850px">
<v-card>
<v-card-title class="justify-space-between grey lighten-2">
收款紀錄
<v-btn icon @click="cash_dialog.show=false;cash_close()"><v-icon>mdi-close</v-icon></v-btn>
</v-card-title>
<v-data-table
:headers="cash_table.headersDetail"
:items="cash_table.desserts"
:search="cash_table.searchOrderDetail"
:options.sync="cashDetail" class="elevation-1" fixed-header height="750px">
<v-divider inset></v-divider>
<template v-slot:top>
<v-toolbar flat color="white">
<div class="d-flex w-100">
<v-text-field v-model="cash_table.searchOrderDetail" append-icon="mdi-magnify" label="查詢" dense outlined single-line hide-details></v-text-field>
<v-btn
color="primary"
class="ml-2 white--text"
:disabled="cash_table.disableButton"
@click="addCashNew">
<v-icon dark>mdi-plus</v-icon>新增
</v-btn>
</div>
</v-toolbar>
</template>
<template v-slot:item.pay_date="{ item }">
<v-text-field v-model="cash_table.editedItem.pay_date" :hide-details="true" dense single-line type="date" v-if="item.id === cash_table.editedItem.id" ></v-text-field>
<span v-else>{{ item.pay_date|timeString('YYYY/MM/DD') }} </span>
<span v-if="item.num==0" class="text-danger">(尚未存檔)</span>
</template>
<template v-slot:item.price="{ item }">
<v-text-field v-model="cash_table.editedItem.price" :hide-details="true" dense single-line v-if="item.id === cash_table.editedItem.id" maxlength=7 ></v-text-field>
<span v-else>{{item.price}}</span>
</template>
<template v-slot:item.payment_selected.text="{ item }">
<v-select @change="cash_selectChange(cash_table.payment_items,cash_table.editedItem.payment_selected.val)"
item-text="text"
item-value="val"
v-model="cash_table.editedItem.payment_selected.val"
:items="cash_table.payment_items"
v-if="item.id === cash_table.editedItem.id"
></v-select>
<span v-else>{{item.payment_selected.text}}</span>
</template>
<template v-slot:item.organization="{ item }">
<v-text-field v-model="cash_table.editedItem.organization" :hide-details="true" dense single-line v-if="item.id === cash_table.editedItem.id" maxlength=50 ></v-text-field>
<span v-else>{{item.organization}}</span>
</template>
<template v-slot:item.bank_code="{ item }">
<v-text-field v-model="cash_table.editedItem.bank_code" :hide-details="true" dense single-line v-if="item.id === cash_table.editedItem.id" maxlength=5 ></v-text-field>
<span v-else>{{item.bank_code}}</span>
</template>
<template v-slot:item.actions="{ item }">
<div v-if="item.id === cash_table.editedItem.id">
<v-icon color="red" class="mr-3" @click="cash_close">
mdi-window-close
</v-icon>
<v-icon color="green" @click="cash_save">
mdi-content-save
</v-icon>
</div>
<div v-else>
<v-icon color="green" class="mr-3" @click="cash_editItem(item);">
mdi-pencil
</v-icon>
<v-icon color="red" @click="cash_deleteItem(item)">
mdi-delete
</v-icon>
</div>
</template>
</v-data-table>
</v-card>
</v-dialog>
<v-dialog v-model="tablet_edit.show" max-width="1000px" persistent eager :class="{'d-none': !tablet_edit.initialized}">
<v-card>
<v-card-title class="justify-space-between grey lighten-2">
<span class="fs-6 text text-dark">編輯牌位 : {{editedItem.actitem_num_selected.text}} - {{editedItem.print_id}}</span>
<v-btn icon @click="tablet_edit.show=false"><v-icon>mdi-close</v-icon></v-btn>
</v-card-title>
<v-card-text>
<iframe id="tablet_edit_iframe" src="../print/tablet_edit/editor.html" style="width: 100%; height: 550px;" frameborder="0"></iframe>
</v-card-text>
</v-card>
</v-dialog>
<v-snackbar
v-model="snackbar.show"
timeout="2000"
>
{{ snackbar.text }}
<template v-slot:action="{ attrs }">
<v-btn
text
v-bind="attrs"
@click="snackbar.show = false"
>
關閉
</v-btn>
</template>
</v-snackbar>
</div>
</asp:Content>