快速報名

This commit is contained in:
2026-05-21 17:47:47 +08:00
parent 9fa8ef90cf
commit 77f642b2d2
6 changed files with 579 additions and 386 deletions
+2
View File
@@ -41,6 +41,8 @@ namespace Model.ViewModel
public string country { get; set; }
public string country2 { get; set; }
public List<pro_order_detail> details { get; set; }
}
public class pro_order_detail
+99
View File
@@ -138,10 +138,109 @@ public class FollowerController : ApiController
return count;
}
[HttpPost]
[Route("api/follower/GetFollowerNew")]
public IHttpActionResult GetFollowerNew([FromBody] Model.ViewModel.follower q)
{
////var qry = _db.followers.Where(a => a.IsDel == false).AsQueryable();////不確定是否新增欄位? 先註解
var qry = _db.followers.AsQueryable();
if (!string.IsNullOrEmpty(q.f_number))
qry = qry.Where(o => o.f_number.Contains(q.f_number.Trim()));
if (!string.IsNullOrEmpty(q.u_name))
qry = qry.Where(o => o.u_name.Contains(q.u_name.Trim()));
if (q.birthday.HasValue)
qry = qry.Where(o => o.birthday >= q.birthday.Value);
if (q.birthday2.HasValue)
{
var tmpBirthday2 = Convert.ToDateTime(q.birthday2.Value).AddDays(1);
qry = qry.Where(o => o.birthday < tmpBirthday2);
}
if (!string.IsNullOrEmpty(q.address))
qry = qry.Where(o => o.address != null && o.address.Contains(q.address.Trim()));
//if (q.num.HasValue && q.num.Value>0)
// qry = qry.Where(o => o.num==q.num.Value);
if (q.ept_self.HasValue && q.ept_self.Value)//排除自己
{
qry = qry.Where(o => o.num != q.num.Value);
}
if (!string.IsNullOrEmpty(q.country))
qry = qry.Where(o => o.country == q.country);
if (!string.IsNullOrEmpty(q.country2))
{
if (q.country2 == "1")
{
qry = qry.Where(o => o.country == "158");
}
else if (q.country2 == "2")
{
qry = qry.Where(o => o.country != "158");
}
}
//if (!string.IsNullOrEmpty(q.phone_idcode)){
// MyWeb.encrypt enc = new MyWeb.encrypt();
// qry = qry.Where(o => o.phone ==enc.DecryptAutoKey(q.phone_idcode) || o.cellphone==enc.DecryptAutoKey(q.phone_idcode));
//}
// 電話/證號搜尋 (使用 search_keywords HEX 編碼)
if (!string.IsNullOrEmpty(q.phone_idcode) && GlobalVariables.UseSearchKeywords)
{
MyWeb.encrypt enc = new MyWeb.encrypt();
string hexSearch = enc.ConvertToHex(q.phone_idcode.Trim());
if (!string.IsNullOrEmpty(hexSearch))
{
qry = qry.Where(o => o.search_keywords != null && o.search_keywords.Contains(hexSearch));
}
}
MyWeb.encrypt encrypt = new MyWeb.encrypt();
var tdesc = publicFun.enum_desc<Model.follower.type>();
var ret = new
{
list = qry.AsEnumerable().Select(x => new
{
num = x.num,
f_number = x.f_number,
u_name = x.u_name,
sex = x.sex,
birthday = x.birthday, //?.ToString("yyyy/MM/dd"),
birthday2 = publicFun.chagenDate(x.birthday), //?.ToString("yyyy/MM/dd"),
sign = Model.follower.chagenSign(x.birthday), //NULL??
sexagenary = Model.follower.sexagenary(x.birthday),
identity_type = x.identity_type,
identity_type_desc = tdesc[x.identity_type ?? 1],//TryGetValue..
id_code = x.id_code,
id_codeDes = encrypt.DecryptAutoKey(x.id_code),
passport = x.passport,
passportDes = encrypt.DecryptAutoKey(x.passport),
phone = x.phone,
phoneDes = encrypt.DecryptAutoKey(x.phone), //--MyWeb.function X
refugedate = x.refugedate,
refuge_name = x.refuge_name,
email = x.email,
address = x.address,
cellphone = x.cellphone,
cellphoneDes = encrypt.DecryptAutoKey(x.cellphone),
}).ToList()
};
if (ret.list == null) {
return Ok(new {result="N",message="查無信眾"});
} //throw new HttpResponseException(HttpStatusCode);
return Ok(ret);
}
[HttpPost]
[Route("api/follower/GetFollower")]
public IHttpActionResult GetFollower([FromBody] Model.ViewModel.follower q)
{
////var qry = _db.followers.Where(a => a.IsDel == false).AsQueryable();////不確定是否新增欄位? 先註解
var qry = _db.followers.AsQueryable();
+103 -1
View File
@@ -329,7 +329,7 @@ public class orderController : ApiController
return Ok(ret);
}
[HttpPost]
[HttpPost,HttpGet]
[Route("api/order/GetItemList")]
public IHttpActionResult GetItemList([FromBody] Model.ViewModel.pro_order_detail q, int page, int pageSize = 10,
string sortBy = "", bool sortDesc = false)
@@ -680,7 +680,109 @@ public class orderController : ApiController
}
[HttpPost]
[Route("api/order/SaveWithDetails")]
public IHttpActionResult SaveWithDetails([FromBody] Model.ViewModel.pro_order item)
{
try
{
MyWeb.encrypt encrypt = new MyWeb.encrypt();
Model.pro_order new_pro_order = new Model.pro_order();//新增
new_pro_order.order_no = createOrderNumber();
var details = item.details;
var last_order_no = details[0].order_no;
//撈前次報名的資料塞進去
var last_order = _db.pro_order.Where(x => x.order_no == last_order_no).FirstOrDefault();
if (last_order != null)
{
new_pro_order.up_time = DateTime.Now;
new_pro_order.reg_time = DateTime.Now;
new_pro_order.phone = last_order.phone;
new_pro_order.address = last_order.address;
new_pro_order.keyin1 = last_order.keyin1;
new_pro_order.f_num = item.f_num;
new_pro_order.activity_num = item.activity_num;
new_pro_order.demo = last_order.demo;
new_pro_order.customize_data = last_order.customize_data;
new_pro_order.send_receipt = last_order.send_receipt;
new_pro_order.receipt_title = last_order.receipt_title;
_db.pro_order.Add(new_pro_order);
foreach (var item1 in details)
{
var last_detail = _db.pro_order_detail.Where(x => x.num == item1.num).FirstOrDefault();
var detail = new pro_order_detail();
detail.order_no = new_pro_order.order_no;
detail.actItem_num = last_detail.actItem_num;
detail.f_num_tablet = last_detail.f_num_tablet;
detail.from_id = last_detail.from_id;
detail.price = last_detail.price;
detail.qty = last_detail.qty;
detail.printed_files = last_detail.printed_files;
detail.style = last_detail.style;
detail.UpdateTime = DateTime.Now;
detail.start_date = DateTime.Now;//這兩個要用活動的
detail.due_date = DateTime.Now;//
_db.pro_order_detail.Add(detail);
}
_db.SaveChanges();
return Ok(new
{
result = "Y",
message = "報名成功"
});
}
else
{
return Ok(new
{
result = "N",
message = "沒有勾選任何功德項目"
});
}
}
catch (Exception ex)
{
return Ok(new
{
result = "N",
message = ex.Message+ex.InnerException+ex.StackTrace
});
}
}
protected string createOrderNumber()
{
//Application.Lock();
string order_no = "AA" + DateTime.Now.ToString("yyMMdd");
var qry = _db.companies.AsQueryable();
//var prod = qry.Where(q => q.last_order_no.Contains(order_no)).FirstOrDefault();
var prod = qry.Where(q => q.num == 1).FirstOrDefault();
if (prod != null)
{
if (!string.IsNullOrEmpty(prod.last_order_no) && prod.last_order_no.Contains(order_no))
{
int tmp = Convert.ToInt32(prod.last_order_no.Replace(order_no, "")) + 1;
order_no = order_no + tmp.ToString("0000");
}
else
{
order_no = order_no + "0001";
}
prod.last_order_no = order_no;
_db.SaveChanges();
}
else
order_no = "";
//Application.UnLock();
return order_no;
}
[HttpPost]
[Route("api/order/SaveDetailData")]
+127 -361
View File
@@ -1,8 +1,38 @@
<template>
<div class="container-fluid">
<v-expansion-panels accordion>
<v-expansion-panel v-for="(item,i) in 1"
:key="i">
<v-expansion-panel-header>查詢條件</v-expansion-panel-header>
<v-expansion-panel-content>
<v-row>
<v-col cols="2" md="2">
<v-text-field label="法會分類">
</v-text-field>
</v-col>
<v-col cols="2" md="2">
<v-text-field label="法會名稱">
</v-text-field>
</v-col>
<v-col cols="2" md="2">
<v-text-field label="開始日期">
</v-text-field>
</v-col>
<v-col cols="2" md="2">
<v-text-field label="結束日期">
</v-text-field>
</v-col>
</v-row>
</v-expansion-panel-content>
</v-expansion-panel>
</v-expansion-panels>
<v-data-table v-model="data_table.selected"
:items="data_table.list"
:search-props="search"
item-key="order_no"
:options.sync="options"
:headers="data_table.header"
@@ -23,8 +53,9 @@
{{ item.u_name }}
</template>
<template #item.slot_btn="{ item }">
<a @click="gotoSignup(item)" class="btn btn-outline-secondary btn-sm">報名</a>
<a @click="gotoSignupList(item)" class="btn btn-outline-secondary btn-sm">明細</a>
<a @click="deleteItem(item)" class="btn btn-outline-secondary btn-sm"><i class="mdi mdi-trash-can"></i>刪除</a>
</template>
</v-data-table>
<v-container>
@@ -60,7 +91,6 @@
this_act:'',
options: { multiSort: false },
search_options: { multiSort: false },
data_table: {
loading: true,
list: [],
@@ -83,17 +113,17 @@
},
},
//列印管理報表
print_conditions: 'yy',
print_search: {
year: '',
month: '',
season: '',
chk_hasact: false,
chk_noact: false,
select_act: '',
select_actitem: '',
//print_conditions: 'yy',
//print_search: {
// year: '',
// month: '',
// season: '',
// chk_hasact: false,
// chk_noact: false,
// select_act: '',
// select_actitem: '',
},
//},
select_act_list: [],
select_items: {
month: [{
@@ -105,85 +135,85 @@
val: 0
},],
},
print_dialog: {
show: false,
},
search_dialog: {
controls: {
search1: {
id: 'search1',
title: '國籍',
text_prop: 'name_zh',
value_prop: 'id',
keys: [
{ id: 'keyword', title: '關鍵字' },
],
api_url: HTTP_HOST + 'api/country/GetList',
columns: [
{ id: 'id', title: '代碼' },
{ id: 'name_en', title: '英文短名稱' },
{ id: 'name_zh', title: '中文名稱' },
],
selected: {},
select(item, t) {
//console.log("select search1", t);
t.search.country = item.id;
t.search.country2 = '';
}
},
search2: {
id: 'search2',
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) {
t.print_search.select_act = item.num;
}
},
search3: {
id: 'search3',
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) {
t.print_search.select_actitem = item.num;
}
}
//print_dialog: {
// show: false,
//},
//search_dialog: {
// controls: {
// search1: {
// id: 'search1',
// title: '國籍',
// text_prop: 'name_zh',
// value_prop: 'id',
// keys: [
// { id: 'keyword', title: '關鍵字' },
// ],
// api_url: HTTP_HOST + 'api/country/GetList',
// columns: [
// { id: 'id', title: '代碼' },
// { id: 'name_en', title: '英文短名稱' },
// { id: 'name_zh', title: '中文名稱' },
// ],
// selected: {},
// select(item, t) {
// //console.log("select search1", t);
// t.search.country = item.id;
// t.search.country2 = '';
// }
// },
// search2: {
// id: 'search2',
// 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) {
// t.print_search.select_act = item.num;
// }
// },
// search3: {
// id: 'search3',
// 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) {
// t.print_search.select_actitem = item.num;
// }
// }
}, show: false,
current: {},
list: [],
count: 0,
page: 1,
loading: false,
footer: {
showFirstLastPage: true,
disableItemsPerPage: true,
itemsPerPageAllText: '',
itemsPerPageText: '',
},
},
// }, show: false,
// current: {},
// list: [],
// count: 0,
// page: 1,
// loading: false,
// footer: {
// showFirstLastPage: true,
// disableItemsPerPage: true,
// itemsPerPageAllText: '',
// itemsPerPageText: '',
// },
//},
search: {
keyin1: '',
order_no: '',
@@ -197,21 +227,6 @@
country: '',
country2: '',
hasPrice: '',
}
//報到
, check_dialog: {
show: false,
},
check_data: {
f_num: 0,
u_name: '',
activity_num: 0,
activity_name: '',
qty: 1,
status: {
text: '',
val: 1
},
},
keyin1_items: [//狀態
//{
@@ -223,9 +238,9 @@
},
mounted() {
//this.detalKeyinArray();
this.search_dialog.current = this.search_dialog.controls.search1 ///default
if (this.this_act != '')
this.search.activity_num = this.this_act;
//this.search_dialog.current = this.search_dialog.controls.search1 ///default
//if (this.this_act != '')
// this.search.activity_num = this.this_act;
//this.initPrintSearch();
//this.initActivity();
const navEntries = performance.getEntriesByType("navigation");
@@ -255,80 +270,12 @@
},
},
methods: {
gotoSignup(item) {
this.$emit('custom-event', { action: 'add', item: item });
},
gotoSignupList(item) {
this.$emit('custom-event', { action:'detail', item:item });
},
search_show(curr) {
//console.log("btn_click:", curr, curr.api_url);
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.search_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 == 'search2') {
params = { sortBy: 'startDate_solar', sortDesc: true, page: this.search_dialog.page, pageSize: 10 };//url params
}
console.log("search_get", api_url, search, params, this.search_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) => {
r.push({
text: t.title,
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;
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(row, this);
}
this.search_dialog.show = false;
//console.log(row, row["u_name"], row["f_number"], curr.id, target);
},
getDetail(clearpage = false) {
console.log("test");
const { sortBy, sortDesc, page, itemsPerPage } = this.options
@@ -369,39 +316,6 @@
editItem(item) {
console.log("edit", item);
},
deleteItem(item) {
if (confirm('是否確定刪除此筆資料?')) {
const index = this.data_table.list.indexOf(item)
if (index != -1) {
axios
.delete(HTTP_HOST + 'api/order/' + item.order_no)
.then(response => {
console.log("del", item);
this.data_table.list.splice(index, 1);
this.data_table.count = this.data_table.list.length
})
.catch(error => console.log(error))
}
}
},
deleteAll() {
if (confirm('是否確定刪除已勾選的資料?')) {
axios
.delete(HTTP_HOST + 'api/order/DeleteAll/' + this.data_table.selected.map(x => x.order_no))
.then(response => {
//console.log("delAll");
//for (var i = 0; i < this.data_table.selected.length; i++) {
// const index = this.data_table.list.indexOf(this.data_table.selected[i]);
// this.data_table.list.splice(index, 1);
//}
//this.data_table.selected = [];
//this.data_table.count = this.data_table.list.length
location.reload();
})
.catch(error => console.log(error))
}
},
btn_search() {
this.this_act = '';
this.search.activity_num = '';
@@ -414,154 +328,6 @@
clearObjProps(this.search);
this.btn_search()
},
checkInMsg(item) {
this.check_data.f_num = item.f_num;
this.check_data.u_name = item.u_name;
this.check_data.activity_num = item.activity_num;
this.check_data.activity_name = item.subject;
this.check_dialog.show = true;
},
checkIn() {
if (this.check_data.qty > 0 && this.check_data.status.val > 0) {
var chechdata =
{
f_num: this.check_data.f_num,
activity_num: this.check_data.activity_num,
status: this.check_data.status.val,
qty: this.check_data.qty,
}
axios
.post(HTTP_HOST + 'api/activity/OrderCheckIn', chechdata)
.then(response => {
//清空
this.check_data.f_num = 0;
this.check_data.u_name = '';
this.check_data.activity_num = 0;
this.check_data.activity_name = '';
this.check_data.qty = 1;
this.check_data.status.text = '';
this.check_data.status.val = 1;
this.check_dialog.show = false;
msgtop('簽到成功')
})
.catch(
error => {
console.log(error)
msgtop('簽到失敗', 'error')
}
)
} else {
msgbox('報到資訊請填寫完整');
}
}, goPrint() {
let _qry = "";
Object.keys(this.search).forEach(key => {
//console.log(`${key}: ${this.search[key]}`);
if (this.search[key] != undefined && this.search[key] != null && this.search[key] != '') {
_qry += (_qry != '' ? '&' : '?') + (key + '=' + this.search[key]);
}
});
window.open("print.aspx" + _qry, '_blank');
},
countryChange() {
this.search.country = '';
$('#country_txt').val('')
},
//列印管理報表
print_close() {
this.print_dialog.show = false;
}
,
initPrintSearch() {
//下拉選單
for (let i = 1; i <= 12; i++) {
var _tmp = {
text: i,
val: i,
}
this.select_items.month.push(_tmp);
}
for (let i = 1; i <= 4; i++) {
var _tmp = {
text: i,
val: i,
}
this.select_items.season.push(_tmp);
}
//預設值
const Today = new Date();//現在日期時間
const first_date = new Date(Today.getFullYear(), Today.getMonth(), 1); //本月第一天
const last_month_date = new Date(first_date - 1); //上個月最後一天
this.print_search.year = last_month_date.getFullYear();
this.print_search.month = last_month_date.getMonth() + 1 //預設上個月的年份
let _season = 1;
const _month = first_date.getMonth() + 1; //本月
if (_month >= 1 && _month <= 3) {
_season = 4;
} else if (_month >= 4 && _month <= 6) {
_season = 1;
} else if (_month >= 7 && _month <= 9) {
_season = 2;
} else if (_month >= 10 && _month <= 12) {
_season = 3;
}
this.print_search.season = _season; //預設上一季
},
goPrint2() {
if (this.print_search.year != '') {
if (this.print_search.chk_noact || this.print_search.chk_hasact) {
let _qry = "";
Object.keys(this.print_search).forEach(key => {
if (this.print_search[key] != undefined && this.print_search[key] != null && this.print_search[key] != '') {
if (key == 'month') {
if (this.print_conditions == 'mm') {
_qry += "&month=" + this.print_search.month;
}
} else if (key == 'season') {
if (this.print_conditions == 'ss') {
_qry += "&season=" + this.print_search.season;
}
}
else {
_qry += (_qry != '' ? '&' : '?') + (key + '=' + this.print_search[key]);
}
}
});
this.print_dialog.show = false;
window.open("print.aspx" + _qry, '_blank');
} else {
msgbox('活動/非活動至少勾選一項');
}
} else {
msgbox('請輸入年份');
}
}, chk_hasact_change() {
if (!this.print_search.chk_hasact) {
//$('#activity_num_txt').val('')
//this.print_search.select_act = '';
this.clear_select_act();
$('#activity_num_txt').attr("placeholder", "可選擇單一活動(需先勾選活動報名)");
} else {
$('#activity_num_txt').attr("placeholder", "可選擇單一活動");
}
},
clear_select_act() {
$('#activity_num_txt').val('')
this.print_search.select_act = '';
}, clear_select_actitem() {
$('#actItem_num_txt').val('')
this.print_search.select_actitem = '';
},
initActivity() {
axios.get(HTTP_HOST + 'api/activity')
.then(response => {
+238 -15
View File
@@ -3,10 +3,15 @@
<v-card>
<v-card-title class="bg-primary white--text text-center">
<h5 class="mb-0">快速報名</h5>
<v-btn class="ms-auto" @click.prevent="saveOrder()">儲存</v-btn>
</v-card-title>
<v-card-text>
<v-row>
<v-col cols="12" md="2">
<v-text-field v-model="name"
:counter="20"
label="姓名"></v-text-field>
</v-col>
<v-col cols="12" md="2">
<v-text-field v-model="idNo"
:counter="20"
@@ -24,72 +29,290 @@
<v-divider></v-divider>
<v-row>
<v-col cols="12" md="2">
<v-text-field v-model="follower.f_number"
<v-text-field v-model="follower.f_number" readonly
label="信眾編號"></v-text-field>
</v-col>
<v-col cols="12" md="2">
<v-text-field v-model="follower.u_name"
<v-text-field v-model="follower.u_name" readonly
label="信眾姓名"></v-text-field>
</v-col>
<v-col cols="12" md="2">
<v-text-field v-model="follower.phoneDes"
<v-text-field v-model="follower.phoneDes" readonly
label="電話"></v-text-field>
</v-col>
<v-col cols="12" md="2">
<v-text-field v-model="follower.cellphoneDes"
<v-text-field v-model="follower.cellphoneDes" readonly
label="行動電話"></v-text-field>
</v-col>
<v-col cols="12" md="2">
<v-text-field v-model="follower.id_code"
<v-text-field v-model="follower.id_code" readonly
label="身分證號"></v-text-field>
</v-col>
<v-col cols="12" md="2">
<v-text-field v-model="follower.passport"
<v-text-field v-model="follower.passport" readonly
label="護照號碼"></v-text-field>
</v-col>
</v-row>
<v-row>
<v-col cols="12" md="12">
<v-text-field v-model="follower.address"
<v-text-field v-model="follower.address" readonly
label="地址"></v-text-field>
</v-col>
</v-row>
<hr class="hr-text" data-content="前次法會功德">
<v-row v-show="tablet_show">
<v-col cols="12" sm="12">
<v-data-iterator :items="tablet_list" :items-per-page="-1"
hide-default-footer>
<template v-slot:default="{ items }">
<v-row>
<v-col cols="3" md="3" v-for="(item, i) in items" :key="i">
<v-card-title>
<v-checkbox v-model="item.actitem_num_checked"
:disabled="item.disabled" class="custom-checkbox">
<template v-slot:label>
<h5 :class="renderDisabled(item)">{{ item.actitem_num_selected.text }}</h5>
</template>
</v-checkbox>
</v-card-title>
<v-card-text>
<div v-html="renderTabletContent(item)" style="font-size:20px;"></div>
<v-divider></v-divider>
</v-card-text>
</v-col>
</v-row>
</template>
<template v-slot:no-data>
<v-alert :value="true" color="error" icon="warning">
無資料可顯示可能此信眾未曾參加過
</v-alert>
</template>
</v-data-iterator>
</v-col>
</v-row>
</v-card-text>
</v-card>
<v-dialog v-model="message_dialog.show" style="width: 300px !important; height: 300px !important;">
<template>
<v-card>
<v-card-title>
{{ message_dialog.message }}
</v-card-title>
<v-card-text>
<v-btn @click.prevent="message_dialog.show=false">關閉</v-btn>
</v-card-text>
</v-card>
</template>
</v-dialog>
</v-container>
</template>
<script>
module.exports = {
props: {
num: {
type: Number // num
}
},
data() {
return {
message_dialog: { show: false, message: "" },
idNo: "",
phoneNum: "",
name: "",
follower: {},
orders: [],
tablet_list: [],
act_items: [],
search: {},
query: {
id_code: { type: String }, cellphone: { type: String }
}
},
search_options: { multiSort: false },
tablet_show: false
}
},
activated() {
//this.getFollower()
this.getActItem()
},
methods: {
getFollower() {
this.search = { id_code: this.query.id_code, cellphone: this.query.cellphone }
renderDisabled(item) {
if (item.disabled) {
return "disabled-checkbox"
} else {
return "enabled-checkbox"
}
},
getActItem() {
this.act_items.length = 0
this.search = { num: this.num }
let params = { sortBy: 'num', sortDesc: false, page: 1, pageSize: -1 };
axios
.post(HTTP_HOST + 'api/follower/GetFollower', this.search)
.post(HTTP_HOST + 'api/activity/GetActRelaList', this.search, { params: params })
.then(response => {
console.log(response)
if (response.data.list)
this.follower = response.data.list
if (response.data.list) {
this.act_items = response.data.list
}
else
console.log("查無資料");
})
.catch(error => console.log(error))
},
getFollower() {
this.tablet_show = false
this.tablet_list.length = 0
this.follower = {}
this.search = { id_code: this.idNo, u_name: this.name, phone_idcode: this.phoneNum }
//應該要檢查他是否已經報完名
axios
.post(HTTP_HOST + 'api/follower/GetFollowerNew', this.search)
.then(response => {
if (response.data.list) {
console.log(response.data.list)
if (response.data.list.length > 1) {
//alert("相同條件不只一人")
this.message_dialog.show = true
this.message_dialog.message = "相同條件不只一人,請增加查詢條件"
} else {
this.tablet_show = true
this.follower = response.data.list[0]
this.getOrder()
}
}
else {
this.message_dialog.show = true
this.message_dialog.message = response.message
}
//alter(response.message);
// console.log("查無資料");
})
.catch(error => console.log(error))
},
getOrder() {
let params = { page: 1, pageSize: 10, sortBy: 'reg_time', sortDesc: true };
this.search = { f_num: this.follower.num }
axios
.post(HTTP_HOST + 'api/order/GetList', this.search, { params: params })
.then(response => {
if (response.data.list && response.data.list.length > 0) {
this.orders = response.data.list
this.orders = this.orders.filter(x => x.activity_num !== this.num)
if (this.orders && this.orders.length > 0) {
this.getOrderDetail()
}
}
else
console.log("getOrder 查無資料");
})
.catch(error => console.log(error))
},
getOrderDetail() {
this.tablet_show = true
let params = { sortBy: 'num', sortDesc: true, page: 1, pageSize: -1 };
let search1 = { order_no: this.orders[0].order_no }
axios
.post(HTTP_HOST + 'api/order/GetItemList', search1, { params: params })
.then(response => {
if (response.data.list) {
this.tablet_list = response.data.list
this.tablet_list.forEach(x => {
let act_item = this.act_items.filter(y => y.act_item_selected.val === x.actitem_num_selected.val)
if (act_item && act_item.length > 0) {
x.disabled = false
} else {
x.disabled = true
}
})
}
else
console.log("getOrderDetail 查無資料");
})
.catch(error => console.log(error))
},
renderTabletContent(item) {
let data = JSON.parse(item.f_num_tablet)
let left = data.left_items
let mid = data.mid_items
let returnVal = ""
if (left) {
returnVal = "陽上:" + left.map(x => x.fam_name).join("、")
}
if (mid) {
returnVal = returnVal + "<br>標題:" + mid.map(x => x.fam_name).join("、")
}
return returnVal
},
saveOrder() {
let detail = []
//整理資料存檔//只要抓那個活動的那幾筆功德項目代號
this.tablet_list.forEach(x => {
if (x.actitem_num_checked && x.actitem_num_checked == true) {
detail.push({ num: x.num, order_no: x.order_no })
console.log("saveOrder:", x, x.num, x.order_no)
}
})
//放主檔資料,
let main = {
activity_num: this.num, f_num: this.follower.num,
details: detail
}
axios
.post(HTTP_HOST + 'api/order/SaveWithDetails', main)
.then(response => {
if (response.result && response.result === "Y") {
console.log();
}
console.log(response.message)
}).catch(error => console.log(error));
}
}
}
</script>
<style>
.hr-text {
display: flex;
align-items: center;
border: 0;
}
.hr-text::before,
.hr-text::after {
content: "";
flex: 1;
border-top: 1px solid #ccc; /* 分隔線樣式 */
margin: 0 10px;
}
.hr-text::before {
content: attr(data-content);
padding: 0 50px;
color: black;
font-size: 28px;
}
/* 当 checkbox 被禁用时,改变鼠标状态 */
input[type="checkbox"]:disabled {
cursor: not-allowed;
opacity: 0.4; /* 控制反灰程度 */
color: lightgray;
}
.disabled-checkbox {
cursor: not-allowed;
opacity: 0.8; /* 控制反灰程度 */
color: lightgray;
}
.enabled-checkbox {
}
</style>
+4 -3
View File
@@ -28,7 +28,7 @@
<div id="content" class="container py-4">
<keep-alive>
<component :is="currentView" :form-data="$data"
:twoData="twoData"
:num="twoData"
@custom-event="changeView">
</component>
</keep-alive>
@@ -109,11 +109,12 @@
console.log(item);
if (item.action === "detail") {
this.twoData = item.item.num
console.log(this.twoData);
this.currentView = "fastSignUp2-component"
} else if (item.action==="add") {
} else if (item.action === "add") {
this.twoData=item.item.num
this.currentView = "fastSignUp3-component"
}
console.log("item.action:",this.twoData)
},
getDetail() {
const { sortBy, sortDesc, page, itemsPerPage } = this.options