diff --git a/src/component/Administrator/coupons/addAllUser.vue b/src/component/Administrator/coupons/addAllUser.vue
index bbc91b4c..6a1cbd81 100644
--- a/src/component/Administrator/coupons/addAllUser.vue
+++ b/src/component/Administrator/coupons/addAllUser.vue
@@ -60,9 +60,16 @@
/>
+
PaidCommission:
{
+ const startTime = new Date(time * 1000);
+ const timezoneOffset = startTime.getTimezoneOffset() * 60000;
+ const localDate = new Date(startTime.getTime() - timezoneOffset);
+ return localDate
+ }
+ function getMidnightTimestamp(seconds,str) {
+ const date = new Date(seconds * 1000); // 转为毫秒
+ if(str == 'state'){
+ date.setHours(0, 0, 0, 0); // 设置为 00:00:00.000
+ }else{
+ date.setHours(23, 59, 59, 0);
+ }
+ return Math.floor(date.getTime() / 1000); // 返回秒级时间戳
}
let setAddData = ()=>{
const timestampMs = new Date(operationsData.rangePickerValue).getTime() / 1000; // 直接获取毫秒时间戳
+ const startTime = new Date(operationsData.startTime).getTime() / 1000; // 直接获取毫秒时间戳
return {
"percentOff": operationsData.percentOff,
"maxRedemptions": operationsData.maxRedemptions,
- "commissionRate": operationsData.commissionRate,
- "timestamp": timestampMs,
+ "commissionRate": operationsData.commissionRate == 0?'':operationsData.commissionRate,
+ "startTime": getMidnightTimestamp(Math.trunc(startTime),'state'),
+ "endTime": getMidnightTimestamp(Math.trunc(timestampMs),'end'),
cooperator:operationsData.cooperator,
remark:operationsData.remark,
}
}
let setEditData = ()=>{
- const timestampMs = new Date(operationsData.rangePickerValue).getTime() / 1000; // 直接获取毫秒时间戳
+ const startTime = new Date(operationsData.startTime).getTime() / 1000; // 直接获取毫秒时间戳
return {
id: operationsData.id,
- paidCommission: operationsData.commissionRate,
+ paidCommission: operationsData.paidCommission,
cooperator:operationsData.cooperator,
remark:operationsData.remark,
+ "startTime": getMidnightTimestamp(Math.trunc(startTime),'state'),
}
}
let cancelDsign = ()=>{
@@ -193,6 +219,7 @@ export default defineComponent({
operationsData.cooperator=''
operationsData.paidCommission=''
operationsData.remark=''
+ operationsData.startTime=''
operationsData.id=''
operations.operationsModal = false
}
@@ -200,7 +227,7 @@ export default defineComponent({
let data
if(operations.title == 'Add'){
data = setAddData()
- if(!data.commissionRate || !data.timestamp || !data.percentOff)return message.warning('Please check the input box marked with *')
+ if(!data.commissionRate || !data.endTime || !data.percentOff)return message.warning('Please check the input box marked with *')
Https.axiosPost(Https.httpUrls.createCoupon, data).then(
(rv) => {
if (rv) {
diff --git a/src/component/Administrator/coupons/index.vue b/src/component/Administrator/coupons/index.vue
index c4b5c9b8..cb1535d9 100644
--- a/src/component/Administrator/coupons/index.vue
+++ b/src/component/Administrator/coupons/index.vue
@@ -127,7 +127,7 @@ export default defineComponent({
const columns: any = computed(() => {
return [
{
- title: 'User Id',
+ title: 'Id',
align: "center",
ellipsis: true,
dataIndex: "id",
@@ -136,12 +136,14 @@ export default defineComponent({
sorter: true,
fixed: "left",
},
+
{
- title: 'Max Redemptions',
+ title: 'cooperator',
align: "center",
- dataIndex: "maxRedemptions",
- key: "maxRedemptions",
- width:200,
+ ellipsis: true,
+ dataIndex: "cooperator",
+ key: "cooperator",
+ width:150,
},
{
@@ -161,7 +163,10 @@ export default defineComponent({
width:150,
customRender: (record: any) => {
if(record.text){
- return new Date(record.text * 1000).toISOString().split('T')[0] // "2025-04-24"
+ const startTime = new Date(record.text * 1000);
+ const timezoneOffset = startTime.getTimezoneOffset() * 60000;
+ const localDate = new Date(startTime.getTime() - timezoneOffset);
+ return localDate.toISOString().split('T')[0] // "2025-04-24"
}
},
},
@@ -188,13 +193,22 @@ export default defineComponent({
},
},
{
- title: 'cooperator',
+ title: 'Start Time',
align: "center",
ellipsis: true,
- dataIndex: "cooperator",
- key: "cooperator",
+ dataIndex: "startTime",
+ key: "startTime",
width:150,
+ customRender: (record: any) => {
+ if(record.text){
+ const startTime = new Date(record.text * 1000);
+ const timezoneOffset = startTime.getTimezoneOffset() * 60000;
+ const localDate = new Date(startTime.getTime() - timezoneOffset);
+ return localDate.toISOString().split('T')[0] // "2025-04-24"
+ }
+ },
},
+
{
title: 'Total Earnings',
align: "center",
@@ -235,7 +249,15 @@ export default defineComponent({
dataIndex: "remark",
key: "remark",
width:150,
- }, {
+ },
+ {
+ title: 'Max Redemptions',
+ align: "center",
+ dataIndex: "maxRedemptions",
+ key: "maxRedemptions",
+ width:200,
+ },
+ {
title: "Operations",
key: "operation",
width:120,
@@ -315,14 +337,13 @@ export default defineComponent({
changePage(e: any, filters:any, sorter:any) {
this.currentPage = e.current;
this.pageSize = e.pageSize;
- console.log(sorter)
- // this.gettrialList();
- // if(sorter.order){
- // if(sorter.columnKey == 'id'){
- // this.orderBy = 'id'
- // }
- // }
+ if(sorter.order){
+ if(sorter.columnKey == 'id'){
+ this.orderBy = 'id'
+ }
+ }
this.orderBy = sorter.order == "descend" ? "DESC" : "ASC";
+ this.gettrialList();
},
//查询列表
@@ -366,13 +387,12 @@ export default defineComponent({
cooperator:this.cooperator,//合作商
isExpired:this.isExpired,//是否过期
promotionCode:this.promotionCode,//优惠码
- orderById:null,//排序字段
+ orderById:this.orderBy,//排序字段
size:this.pageSize,
page:this.currentPage,
}
Https.axiosPost(Https.httpUrls.getAllCoupons,data).then((rv: any) => {
if (rv) {
- console.log(rv)
this.dataList = rv.records
this.total = rv.total
// this.workspaceItem.position = this.singleTypeList[0].label