功能條整
This commit is contained in:
@@ -42,7 +42,7 @@ namespace MyWeb
|
|||||||
}
|
}
|
||||||
//定義欄位cookie==================end
|
//定義欄位cookie==================end
|
||||||
|
|
||||||
private AdmItem JDecode(string json)
|
public AdmItem JDecode(string json)
|
||||||
{
|
{
|
||||||
json = encrypt.DecryptAutoKey(json); //解密
|
json = encrypt.DecryptAutoKey(json); //解密
|
||||||
AdmItem mItem = JsonConvert.DeserializeObject<AdmItem>(json);
|
AdmItem mItem = JsonConvert.DeserializeObject<AdmItem>(json);
|
||||||
|
|||||||
@@ -1,17 +1,20 @@
|
|||||||
using PagedList;
|
using DocumentFormat.OpenXml.EMMA;
|
||||||
|
using MINOM.COM.Utility;
|
||||||
|
using MyWeb;
|
||||||
|
using PagedList;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Configuration;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
using System.Text;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Http;
|
using System.Web.Http;
|
||||||
using MyWeb;
|
using static MyWeb.admin;
|
||||||
using MINOM.COM.Utility;
|
|
||||||
using System.Text;
|
|
||||||
// api/pre_order
|
// api/pre_order
|
||||||
//[ezAuthorize(Roles = "admin")]//群組:*
|
//[ezAuthorize(Roles = "admin")]//群組:*
|
||||||
//[ezAuthorize]
|
//[ezAuthorize]
|
||||||
public class preOrderController: ApiController
|
public class preOrderController : ApiController
|
||||||
{
|
{
|
||||||
|
|
||||||
private Model.ezEntities _db = new Model.ezEntities();
|
private Model.ezEntities _db = new Model.ezEntities();
|
||||||
@@ -76,11 +79,12 @@ public class preOrderController: ApiController
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex)
|
||||||
|
{
|
||||||
return Ok(new
|
return Ok(new
|
||||||
{
|
{
|
||||||
result="N",
|
result = "N",
|
||||||
message=ex.Message,
|
message = ex.Message,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -92,20 +96,21 @@ public class preOrderController: ApiController
|
|||||||
public IHttpActionResult GetPreOrder([FromBody] Model.ViewModel.preOrder pre, int page, int pageSize = 10,
|
public IHttpActionResult GetPreOrder([FromBody] Model.ViewModel.preOrder pre, int page, int pageSize = 10,
|
||||||
string sortBy = "", bool sortDesc = false)
|
string sortBy = "", bool sortDesc = false)
|
||||||
{
|
{
|
||||||
var qry=_db.pre_order.AsQueryable();
|
var qry = _db.pre_order.AsQueryable();
|
||||||
if (!string.IsNullOrEmpty(pre.f_name))
|
if (!string.IsNullOrEmpty(pre.f_name))
|
||||||
{
|
{
|
||||||
qry = qry.Where(x => _db.followers.Where(y => y.u_name.Contains( pre.f_name)).Select(y => y.num).ToList().Contains((int)x.f_num));
|
qry = qry.Where(x => _db.followers.Where(y => y.u_name.Contains(pre.f_name)).Select(y => y.num).ToList().Contains((int)x.f_num));
|
||||||
}
|
}
|
||||||
if (!string.IsNullOrEmpty(pre.order_no)) {
|
if (!string.IsNullOrEmpty(pre.order_no))
|
||||||
|
{
|
||||||
qry = qry.Where(x => x.order_no.Contains(pre.order_no));
|
qry = qry.Where(x => x.order_no.Contains(pre.order_no));
|
||||||
}
|
}
|
||||||
if (!string.IsNullOrEmpty(pre.act_name))
|
if (!string.IsNullOrEmpty(pre.act_name))
|
||||||
{
|
{
|
||||||
qry = qry.Where(x => _db.activities.Where(z=>z.subject.Contains(pre.act_name)).Select(z=>z.num).ToList().Contains((int)x.act_num));
|
qry = qry.Where(x => _db.activities.Where(z => z.subject.Contains(pre.act_name)).Select(z => z.num).ToList().Contains((int)x.act_num));
|
||||||
}
|
}
|
||||||
//sortBy = sortBy ?? string.Empty;
|
//sortBy = sortBy ?? string.Empty;
|
||||||
qry =qry.OrderByDescending(x => x.num);
|
qry = qry.OrderByDescending(x => x.num);
|
||||||
var count = qry.Count(); //pageSize = count;//一次取回??
|
var count = qry.Count(); //pageSize = count;//一次取回??
|
||||||
if (pageSize == -1)
|
if (pageSize == -1)
|
||||||
{
|
{
|
||||||
@@ -117,10 +122,19 @@ public class preOrderController: ApiController
|
|||||||
{
|
{
|
||||||
list = qry.ToPagedList(page, pageSize).Select(x => new
|
list = qry.ToPagedList(page, pageSize).Select(x => new
|
||||||
{
|
{
|
||||||
x.num,x.f_num,x.admin_num,x.order_no,x.item_count,x.total_amt,x.reg_time,x.receipt_num,x.act_num,
|
x.num,
|
||||||
f_name=_db.followers.Where(z=>z.num==x.f_num).Select(z=>z.u_name).FirstOrDefault(),
|
x.f_num,
|
||||||
act_name=_db.activities.Where(w=>w.num==x.act_num).Select(w=>w.subject).FirstOrDefault(),
|
x.admin_num,
|
||||||
receipt_amt=(_db.receipt_detail.Where(rd=>_db.receipt_master.Where(rm=>rm.order_no==x.order_no).Select(rm=>rm.num).ToList().Contains((int)rd.receipt_num))).Select(rd=>rd.amt).Sum()
|
x.order_no,
|
||||||
|
x.item_count,
|
||||||
|
x.total_amt,
|
||||||
|
x.reg_time,
|
||||||
|
x.receipt_num,
|
||||||
|
x.act_num,
|
||||||
|
admin_name=_db.admins.Where(q=>q.num==x.admin_num).Select(q=>q.u_name).FirstOrDefault(),
|
||||||
|
f_name = _db.followers.Where(z => z.num == x.f_num).Select(z => z.u_name).FirstOrDefault(),
|
||||||
|
act_name = _db.activities.Where(w => w.num == x.act_num).Select(w => w.subject).FirstOrDefault(),
|
||||||
|
receipt_amt = (_db.receipt_detail.Where(rd => _db.receipt_master.Where(rm => rm.order_no == x.order_no).Select(rm => rm.num).ToList().Contains((int)rd.receipt_num))).Select(rd => rd.amt).Sum()
|
||||||
}).ToList(),
|
}).ToList(),
|
||||||
count = count
|
count = count
|
||||||
};
|
};
|
||||||
@@ -136,12 +150,25 @@ public class preOrderController: ApiController
|
|||||||
{
|
{
|
||||||
//要檢查有無報過名
|
//要檢查有無報過名
|
||||||
var qry1 = _db.pro_order.AsQueryable();
|
var qry1 = _db.pro_order.AsQueryable();
|
||||||
qry1 = qry1.Where(y=>y.f_num==pre.f_num&&y.activity_num==pre.act_num);
|
qry1 = qry1.Where(y => y.f_num == pre.f_num && y.activity_num == pre.act_num);
|
||||||
var o=qry1.FirstOrDefault();
|
var o = qry1.FirstOrDefault();
|
||||||
if (o != null && !string.IsNullOrEmpty(o.order_no))
|
if (o != null && !string.IsNullOrEmpty(o.order_no))
|
||||||
{
|
{
|
||||||
throw new Exception("已經報過名,請勿重複報名");
|
throw new Exception("已經報過名,請勿重複報名");
|
||||||
}
|
}
|
||||||
|
string scc = ConfigurationManager.AppSettings["shopCarCode"].ToString();
|
||||||
|
int admin_num =0;
|
||||||
|
|
||||||
|
if (HttpContext.Current.Session[scc + "admin"] != null)
|
||||||
|
{
|
||||||
|
MyWeb.admin admin = new MyWeb.admin();
|
||||||
|
AdmItem item = admin.JDecode(HttpContext.Current.Session[scc + "admin"].ToString());
|
||||||
|
string info = item.u_id;
|
||||||
|
if (!string.IsNullOrEmpty(info))
|
||||||
|
{
|
||||||
|
admin_num=_db.admins.Where(x => x.u_id == info).Select(x=>x.num).FirstOrDefault();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var qry = _db.followers.AsQueryable();
|
var qry = _db.followers.AsQueryable();
|
||||||
qry = qry.Where(x => x.num == pre.f_num);
|
qry = qry.Where(x => x.num == pre.f_num);
|
||||||
@@ -154,29 +181,31 @@ public class preOrderController: ApiController
|
|||||||
preO.act_num = pre.act_num;
|
preO.act_num = pre.act_num;
|
||||||
preO.f_num = pre.f_num;
|
preO.f_num = pre.f_num;
|
||||||
preO.item_count = pre.item_count;
|
preO.item_count = pre.item_count;
|
||||||
|
if (admin_num!=0) {
|
||||||
|
preO.admin_num = admin_num;
|
||||||
|
}
|
||||||
preO.total_amt = pre.total_amt;
|
preO.total_amt = pre.total_amt;
|
||||||
preO.reg_time = DateTime.Now;
|
preO.reg_time = DateTime.Now;
|
||||||
|
|
||||||
proO.up_time= DateTime.Now;
|
proO.up_time = DateTime.Now;
|
||||||
proO.reg_time = DateTime.Now;
|
proO.reg_time = DateTime.Now;
|
||||||
proO.order_no = preO.order_no;
|
proO.order_no = preO.order_no;
|
||||||
proO.activity_num = pre.act_num;
|
proO.activity_num = pre.act_num;
|
||||||
proO.f_num = pre.f_num;
|
proO.f_num = pre.f_num;
|
||||||
proO.keyin1 = "A01";
|
proO.keyin1 = "A01";
|
||||||
proO.phone = f.phone;
|
proO.phone = f.phone;
|
||||||
proO.address = f.address??"";
|
proO.address = f.address ?? "";
|
||||||
proO.demo = "";
|
proO.demo = "";
|
||||||
|
|
||||||
_db.pre_order.Add(preO);
|
_db.pre_order.Add(preO);
|
||||||
_db.pro_order.Add(proO);
|
_db.pro_order.Add(proO);
|
||||||
_db.SaveChanges();
|
_db.SaveChanges();
|
||||||
return Ok(new {result="Y",message="新增成功"});
|
return Ok(new { result = "Y", message = "新增成功" });
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogUtility log = new LogUtility();
|
LogUtility log = new LogUtility();
|
||||||
log.writeErrorPath(ex.Message+ex.StackTrace);
|
log.writeErrorPath(ex.Message + ex.StackTrace);
|
||||||
return Ok(new { result = "N", message = $"新增失敗 {ex.Message}" });
|
return Ok(new { result = "N", message = $"新增失敗 {ex.Message}" });
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -191,13 +220,13 @@ public class preOrderController: ApiController
|
|||||||
{
|
{
|
||||||
var qry = _db.pre_order.AsQueryable();
|
var qry = _db.pre_order.AsQueryable();
|
||||||
|
|
||||||
qry = qry.Where(x => x.order_no==pre.order_no);
|
qry = qry.Where(x => x.order_no == pre.order_no);
|
||||||
//sortBy = sortBy ?? string.Empty;
|
//sortBy = sortBy ?? string.Empty;
|
||||||
qry = qry.OrderByDescending(x => x.num);
|
qry = qry.OrderByDescending(x => x.num);
|
||||||
|
|
||||||
var ret = new
|
var ret = new
|
||||||
{
|
{
|
||||||
data=qry.Select(x => new
|
data = qry.Select(x => new
|
||||||
{
|
{
|
||||||
x.num,
|
x.num,
|
||||||
x.f_num,
|
x.f_num,
|
||||||
@@ -212,8 +241,9 @@ public class preOrderController: ApiController
|
|||||||
act_name = _db.activities.Where(w => w.num == x.act_num).Select(w => w.subject).FirstOrDefault(),
|
act_name = _db.activities.Where(w => w.num == x.act_num).Select(w => w.subject).FirstOrDefault(),
|
||||||
}).FirstOrDefault()
|
}).FirstOrDefault()
|
||||||
};
|
};
|
||||||
if (ret.data == null) {
|
if (ret.data == null)
|
||||||
return Ok(new {result="N",message=""});
|
{
|
||||||
|
return Ok(new { result = "N", message = "" });
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
return Ok(new
|
return Ok(new
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
</asp:Content>
|
</asp:Content>
|
||||||
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
|
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
|
||||||
<div id="content" class="container-fluid py-4">
|
<div id="content" class="container-fluid py-4">
|
||||||
<keep-alive>
|
<keep-alive :exclude="['pre_order-component']">
|
||||||
<component :is="currentView" ref="myChild"
|
<component :is="currentView" ref="myChild" :reload="reload"
|
||||||
@custom-event="changeView" :search="search">
|
@custom-event="changeView" :search="search">
|
||||||
</component>
|
</component>
|
||||||
</keep-alive>
|
</keep-alive>
|
||||||
@@ -50,6 +50,7 @@
|
|||||||
order_no: '',
|
order_no: '',
|
||||||
f_name:'',
|
f_name:'',
|
||||||
},
|
},
|
||||||
|
reload:0,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
@@ -84,6 +85,7 @@
|
|||||||
if (item.action === "add") {
|
if (item.action === "add") {
|
||||||
this.currentView = "pre_order_reg-component";
|
this.currentView = "pre_order_reg-component";
|
||||||
} else if (item.action === "list") {
|
} else if (item.action === "list") {
|
||||||
|
this.reload++;
|
||||||
this.currentView = "pre_order-component";
|
this.currentView = "pre_order-component";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -14,11 +14,13 @@
|
|||||||
:page.sync="data_table.page"
|
:page.sync="data_table.page"
|
||||||
:items-per-page.sync="data_table.pageSize"
|
:items-per-page.sync="data_table.pageSize"
|
||||||
class="elevation-1">
|
class="elevation-1">
|
||||||
|
<template #item.reg_time="{ item }">
|
||||||
|
{{ item.reg_time|timeString('YYYY/MM/DD') }}
|
||||||
|
</template>
|
||||||
<template #item.slot_btn="{ item }">
|
<template #item.slot_btn="{ item }">
|
||||||
<a @click.prevent="openReceipt(item)" class="btn btn-outline-secondary btn-sm"><i class="mdi mdi-receipt-text"></i>開立收據</a>
|
<a @click.prevent="openReceipt(item)" class="btn btn-outline-secondary btn-sm"><i class="mdi mdi-receipt-text"></i>開立收據</a>
|
||||||
<!--<a :href="'reg.aspx?order_no='+item.order_no" class="btn btn-outline-secondary btn-sm"><i class="mdi mdi-pencil-box-outline"></i>編輯</a>
|
<!--<a :href="'reg.aspx?order_no='+item.order_no" class="btn btn-outline-secondary btn-sm"><i class="mdi mdi-pencil-box-outline"></i>編輯</a>
|
||||||
<a @click="deleteItem(item)" class="btn btn-outline-secondary btn-sm"><i class="mdi mdi-trash-can"></i>刪除</a>-->
|
<a @click="deleteItem(item)" class="btn btn-outline-secondary btn-sm"><i class="mdi mdi-trash-can"></i>刪除</a>-->
|
||||||
</template>
|
</template>
|
||||||
</v-data-table>
|
</v-data-table>
|
||||||
<v-container>
|
<v-container>
|
||||||
@@ -67,13 +69,18 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
Vue.filter('timeString', function (value, myFormat) {
|
||||||
|
return value == null || value == "" ? "" : moment(value).format(myFormat || 'YYYY-MM-DD, HH:mm:ss');
|
||||||
|
});
|
||||||
module.exports = {
|
module.exports = {
|
||||||
props: {
|
props: {
|
||||||
formData: {},
|
formData: {},
|
||||||
search: {
|
search: {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
reload: {
|
||||||
|
type: Number
|
||||||
|
}
|
||||||
},
|
},
|
||||||
name:"ParentComponent",
|
name:"ParentComponent",
|
||||||
components: {
|
components: {
|
||||||
@@ -105,7 +112,7 @@
|
|||||||
{ text: '功德項目數量', value: 'item_count' },
|
{ text: '功德項目數量', value: 'item_count' },
|
||||||
{ text: '總金額', value: 'total_amt' },
|
{ text: '總金額', value: 'total_amt' },
|
||||||
{ text: '收據金額', value: 'receipt_amt' },
|
{ text: '收據金額', value: 'receipt_amt' },
|
||||||
{ text: '登錄人員', value: 'admin_num' },
|
{ text: '登錄人員', value: 'admin_name' },
|
||||||
{ text: '登錄時間', value: 'reg_time' },
|
{ text: '登錄時間', value: 'reg_time' },
|
||||||
{ text: '', value: 'slot_btn', sortable: false, align: 'end' }
|
{ text: '', value: 'slot_btn', sortable: false, align: 'end' }
|
||||||
],
|
],
|
||||||
@@ -168,7 +175,18 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
options: {
|
||||||
|
handler() {
|
||||||
|
this.loadData()
|
||||||
|
},
|
||||||
|
deep: true,
|
||||||
|
},
|
||||||
|
reload: {
|
||||||
|
handler() {
|
||||||
|
this.loadData()
|
||||||
|
},
|
||||||
|
deep: true,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
pageCount() {
|
pageCount() {
|
||||||
|
|||||||
@@ -55,7 +55,7 @@
|
|||||||
<v-card>
|
<v-card>
|
||||||
<v-card-title>
|
<v-card-title>
|
||||||
|
|
||||||
<v-text-field v-model="picker.search.name" :label="picker.search.text" @keyup.enter.prevent=""></v-text-field>
|
<v-text-field v-model="picker.search.name" :label="picker.search.text" @keyup.enter.prevent="getFollowers"></v-text-field>
|
||||||
</v-card-title>
|
</v-card-title>
|
||||||
<v-card-text>
|
<v-card-text>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@@ -182,6 +182,11 @@
|
|||||||
watch: {
|
watch: {
|
||||||
"picker.target": {
|
"picker.target": {
|
||||||
handler(newVal) {
|
handler(newVal) {
|
||||||
|
//this.options.page = 1;
|
||||||
|
//this.options.pageSize = 10;
|
||||||
|
this.options = { multiSort: false }
|
||||||
|
this.picker.data_table.page = 1;
|
||||||
|
this.picker.data_table.pageSize=10;
|
||||||
if (this.picker.target === "follower") {
|
if (this.picker.target === "follower") {
|
||||||
this.picker.search.name = ""
|
this.picker.search.name = ""
|
||||||
this.picker.search.text = "信眾姓名"
|
this.picker.search.text = "信眾姓名"
|
||||||
@@ -196,7 +201,12 @@
|
|||||||
},
|
},
|
||||||
deep: true,
|
deep: true,
|
||||||
},
|
},
|
||||||
|
options: {
|
||||||
|
handler() {
|
||||||
|
this.getFollowers()
|
||||||
|
},
|
||||||
|
deep: true,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleRowClick(item, row) {
|
handleRowClick(item, row) {
|
||||||
@@ -230,7 +240,7 @@
|
|||||||
page: page??1, pageSize: itemsPerPage??10
|
page: page??1, pageSize: itemsPerPage??10
|
||||||
};
|
};
|
||||||
this.picker.data_table.loading = true;
|
this.picker.data_table.loading = true;
|
||||||
let search = {}
|
let search = {u_name:this.picker.search.name}
|
||||||
axios
|
axios
|
||||||
.post(HTTP_HOST + 'api/follower/GetList', search, { params: params })
|
.post(HTTP_HOST + 'api/follower/GetList', search, { params: params })
|
||||||
.then(response => {
|
.then(response => {
|
||||||
|
|||||||
@@ -973,7 +973,7 @@
|
|||||||
})
|
})
|
||||||
return g;
|
return g;
|
||||||
},
|
},
|
||||||
renderNormal(mid, d)
|
renderNormal(mid, d) {
|
||||||
let self = this;
|
let self = this;
|
||||||
let txt = $(`<div class='${d.elementID}'>${mid==undefined?"":mid}</div>`).css({
|
let txt = $(`<div class='${d.elementID}'>${mid==undefined?"":mid}</div>`).css({
|
||||||
"z-index": 9999, visibility: d.visibility,
|
"z-index": 9999, visibility: d.visibility,
|
||||||
|
|||||||
Reference in New Issue
Block a user