优惠码页面部分调整新增字段
This commit is contained in:
@@ -60,9 +60,16 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="admin_state_item" >
|
<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" > -->
|
<!-- <div class="admin_state_item" > -->
|
||||||
<span>End Time: <span>*</span></span>
|
<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-date-picker v-model:value="rangePickerValue" :disabled="title != 'Add'" style="width:220px" />
|
||||||
</a-space>
|
</a-space>
|
||||||
</div>
|
</div>
|
||||||
@@ -77,7 +84,7 @@
|
|||||||
style="width: 220px"
|
style="width: 220px"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="admin_state_item" >
|
<div class="admin_state_item" v-show="title != 'Add'">
|
||||||
<span>PaidCommission:</span>
|
<span>PaidCommission:</span>
|
||||||
<input
|
<input
|
||||||
v-model="paidCommission"
|
v-model="paidCommission"
|
||||||
@@ -133,6 +140,7 @@ export default defineComponent({
|
|||||||
})
|
})
|
||||||
let operationsData = reactive({
|
let operationsData = reactive({
|
||||||
rangePickerValue:'',
|
rangePickerValue:'',
|
||||||
|
startTime:'',
|
||||||
percentOff:'',
|
percentOff:'',
|
||||||
commissionRate:'',
|
commissionRate:'',
|
||||||
maxRedemptions:'',
|
maxRedemptions:'',
|
||||||
@@ -154,8 +162,9 @@ export default defineComponent({
|
|||||||
operationsData.cooperator=data.cooperator
|
operationsData.cooperator=data.cooperator
|
||||||
operationsData.paidCommission=data.paidCommission
|
operationsData.paidCommission=data.paidCommission
|
||||||
operationsData.remark=data.remark
|
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.rangePickerValue='2024-08-05T00:00:06'
|
||||||
// operationsData.validEndTime='2024-08-05T00:00:06'
|
// operationsData.validEndTime='2024-08-05T00:00:06'
|
||||||
// operationsData.commissionRate = data.commissionRate
|
// operationsData.commissionRate = data.commissionRate
|
||||||
@@ -163,26 +172,43 @@ export default defineComponent({
|
|||||||
// operationsData.validStartTime = formatTime(data.validStartTime)
|
// operationsData.validStartTime = formatTime(data.validStartTime)
|
||||||
// operationsData.validEndTime = formatTime(data.validEndTime)
|
// 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 = ()=>{
|
let setAddData = ()=>{
|
||||||
const timestampMs = new Date(operationsData.rangePickerValue).getTime() / 1000; // 直接获取毫秒时间戳
|
const timestampMs = new Date(operationsData.rangePickerValue).getTime() / 1000; // 直接获取毫秒时间戳
|
||||||
|
const startTime = new Date(operationsData.startTime).getTime() / 1000; // 直接获取毫秒时间戳
|
||||||
return {
|
return {
|
||||||
"percentOff": operationsData.percentOff,
|
"percentOff": operationsData.percentOff,
|
||||||
"maxRedemptions": operationsData.maxRedemptions,
|
"maxRedemptions": operationsData.maxRedemptions,
|
||||||
"commissionRate": operationsData.commissionRate,
|
"commissionRate": operationsData.commissionRate == 0?'':operationsData.commissionRate,
|
||||||
"timestamp": timestampMs,
|
"startTime": getMidnightTimestamp(Math.trunc(startTime),'state'),
|
||||||
|
"endTime": getMidnightTimestamp(Math.trunc(timestampMs),'end'),
|
||||||
cooperator:operationsData.cooperator,
|
cooperator:operationsData.cooperator,
|
||||||
remark:operationsData.remark,
|
remark:operationsData.remark,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let setEditData = ()=>{
|
let setEditData = ()=>{
|
||||||
const timestampMs = new Date(operationsData.rangePickerValue).getTime() / 1000; // 直接获取毫秒时间戳
|
const startTime = new Date(operationsData.startTime).getTime() / 1000; // 直接获取毫秒时间戳
|
||||||
return {
|
return {
|
||||||
id: operationsData.id,
|
id: operationsData.id,
|
||||||
paidCommission: operationsData.commissionRate,
|
paidCommission: operationsData.paidCommission,
|
||||||
cooperator:operationsData.cooperator,
|
cooperator:operationsData.cooperator,
|
||||||
remark:operationsData.remark,
|
remark:operationsData.remark,
|
||||||
|
"startTime": getMidnightTimestamp(Math.trunc(startTime),'state'),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let cancelDsign = ()=>{
|
let cancelDsign = ()=>{
|
||||||
@@ -193,6 +219,7 @@ export default defineComponent({
|
|||||||
operationsData.cooperator=''
|
operationsData.cooperator=''
|
||||||
operationsData.paidCommission=''
|
operationsData.paidCommission=''
|
||||||
operationsData.remark=''
|
operationsData.remark=''
|
||||||
|
operationsData.startTime=''
|
||||||
operationsData.id=''
|
operationsData.id=''
|
||||||
operations.operationsModal = false
|
operations.operationsModal = false
|
||||||
}
|
}
|
||||||
@@ -200,7 +227,7 @@ export default defineComponent({
|
|||||||
let data
|
let data
|
||||||
if(operations.title == 'Add'){
|
if(operations.title == 'Add'){
|
||||||
data = setAddData()
|
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(
|
Https.axiosPost(Https.httpUrls.createCoupon, data).then(
|
||||||
(rv) => {
|
(rv) => {
|
||||||
if (rv) {
|
if (rv) {
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ export default defineComponent({
|
|||||||
const columns: any = computed(() => {
|
const columns: any = computed(() => {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
title: 'User Id',
|
title: 'Id',
|
||||||
align: "center",
|
align: "center",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
dataIndex: "id",
|
dataIndex: "id",
|
||||||
@@ -136,12 +136,14 @@ export default defineComponent({
|
|||||||
sorter: true,
|
sorter: true,
|
||||||
fixed: "left",
|
fixed: "left",
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
title: 'Max Redemptions',
|
title: 'cooperator',
|
||||||
align: "center",
|
align: "center",
|
||||||
dataIndex: "maxRedemptions",
|
ellipsis: true,
|
||||||
key: "maxRedemptions",
|
dataIndex: "cooperator",
|
||||||
width:200,
|
key: "cooperator",
|
||||||
|
width:150,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -161,7 +163,10 @@ export default defineComponent({
|
|||||||
width:150,
|
width:150,
|
||||||
customRender: (record: any) => {
|
customRender: (record: any) => {
|
||||||
if(record.text){
|
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",
|
align: "center",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
dataIndex: "cooperator",
|
dataIndex: "startTime",
|
||||||
key: "cooperator",
|
key: "startTime",
|
||||||
width:150,
|
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',
|
title: 'Total Earnings',
|
||||||
align: "center",
|
align: "center",
|
||||||
@@ -235,7 +249,15 @@ export default defineComponent({
|
|||||||
dataIndex: "remark",
|
dataIndex: "remark",
|
||||||
key: "remark",
|
key: "remark",
|
||||||
width:150,
|
width:150,
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
|
title: 'Max Redemptions',
|
||||||
|
align: "center",
|
||||||
|
dataIndex: "maxRedemptions",
|
||||||
|
key: "maxRedemptions",
|
||||||
|
width:200,
|
||||||
|
},
|
||||||
|
{
|
||||||
title: "Operations",
|
title: "Operations",
|
||||||
key: "operation",
|
key: "operation",
|
||||||
width:120,
|
width:120,
|
||||||
@@ -315,14 +337,13 @@ export default defineComponent({
|
|||||||
changePage(e: any, filters:any, sorter:any) {
|
changePage(e: any, filters:any, sorter:any) {
|
||||||
this.currentPage = e.current;
|
this.currentPage = e.current;
|
||||||
this.pageSize = e.pageSize;
|
this.pageSize = e.pageSize;
|
||||||
console.log(sorter)
|
if(sorter.order){
|
||||||
// this.gettrialList();
|
if(sorter.columnKey == 'id'){
|
||||||
// if(sorter.order){
|
this.orderBy = 'id'
|
||||||
// if(sorter.columnKey == 'id'){
|
}
|
||||||
// this.orderBy = 'id'
|
}
|
||||||
// }
|
|
||||||
// }
|
|
||||||
this.orderBy = sorter.order == "descend" ? "DESC" : "ASC";
|
this.orderBy = sorter.order == "descend" ? "DESC" : "ASC";
|
||||||
|
this.gettrialList();
|
||||||
},
|
},
|
||||||
|
|
||||||
//查询列表
|
//查询列表
|
||||||
@@ -366,13 +387,12 @@ export default defineComponent({
|
|||||||
cooperator:this.cooperator,//合作商
|
cooperator:this.cooperator,//合作商
|
||||||
isExpired:this.isExpired,//是否过期
|
isExpired:this.isExpired,//是否过期
|
||||||
promotionCode:this.promotionCode,//优惠码
|
promotionCode:this.promotionCode,//优惠码
|
||||||
orderById:null,//排序字段
|
orderById:this.orderBy,//排序字段
|
||||||
size:this.pageSize,
|
size:this.pageSize,
|
||||||
page:this.currentPage,
|
page:this.currentPage,
|
||||||
}
|
}
|
||||||
Https.axiosPost(Https.httpUrls.getAllCoupons,data).then((rv: any) => {
|
Https.axiosPost(Https.httpUrls.getAllCoupons,data).then((rv: any) => {
|
||||||
if (rv) {
|
if (rv) {
|
||||||
console.log(rv)
|
|
||||||
this.dataList = rv.records
|
this.dataList = rv.records
|
||||||
this.total = rv.total
|
this.total = rv.total
|
||||||
// this.workspaceItem.position = this.singleTypeList[0].label
|
// this.workspaceItem.position = this.singleTypeList[0].label
|
||||||
|
|||||||
Reference in New Issue
Block a user