优惠码页面部分调整新增字段
This commit is contained in:
@@ -60,9 +60,16 @@
|
||||
/>
|
||||
</div>
|
||||
<div class="admin_state_item" >
|
||||
<!-- <div class="admin_state_item" > -->
|
||||
<span>Start Time: </span>
|
||||
<a-space style="width:220px">
|
||||
<a-date-picker v-model:value="startTime" style="width:220px" />
|
||||
</a-space>
|
||||
</div>
|
||||
<div class="admin_state_item" >
|
||||
<!-- <div class="admin_state_item" > -->
|
||||
<span>End Time: <span>*</span></span>
|
||||
<a-space direction="vertical" style="width:220px">
|
||||
<a-space style="width:220px">
|
||||
<a-date-picker v-model:value="rangePickerValue" :disabled="title != 'Add'" style="width:220px" />
|
||||
</a-space>
|
||||
</div>
|
||||
@@ -77,7 +84,7 @@
|
||||
style="width: 220px"
|
||||
/>
|
||||
</div>
|
||||
<div class="admin_state_item" >
|
||||
<div class="admin_state_item" v-show="title != 'Add'">
|
||||
<span>PaidCommission:</span>
|
||||
<input
|
||||
v-model="paidCommission"
|
||||
@@ -133,6 +140,7 @@ export default defineComponent({
|
||||
})
|
||||
let operationsData = reactive({
|
||||
rangePickerValue:'',
|
||||
startTime:'',
|
||||
percentOff:'',
|
||||
commissionRate:'',
|
||||
maxRedemptions:'',
|
||||
@@ -154,8 +162,9 @@ export default defineComponent({
|
||||
operationsData.cooperator=data.cooperator
|
||||
operationsData.paidCommission=data.paidCommission
|
||||
operationsData.remark=data.remark
|
||||
operationsData.rangePickerValue = dayjs(new Date(data.redeemBy * 1000).toISOString().split('T')[0],'YYYY/MM/DD');
|
||||
|
||||
|
||||
operationsData.startTime = data.startTime?dayjs(getTime(data.startTime).toISOString(),'YYYY/MM/DD'):'';
|
||||
operationsData.rangePickerValue = data.redeemBy?dayjs(getTime(data.redeemBy).toISOString(),'YYYY/MM/DD'):'';
|
||||
// operationsData.rangePickerValue='2024-08-05T00:00:06'
|
||||
// operationsData.validEndTime='2024-08-05T00:00:06'
|
||||
// operationsData.commissionRate = data.commissionRate
|
||||
@@ -163,26 +172,43 @@ export default defineComponent({
|
||||
// operationsData.validStartTime = formatTime(data.validStartTime)
|
||||
// operationsData.validEndTime = formatTime(data.validEndTime)
|
||||
}
|
||||
|
||||
}
|
||||
let getTime = (time)=>{
|
||||
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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user