Commit 637b37f9 by zhangquan

添加同步按钮

1 parent bbb7d4f0
......@@ -149,6 +149,14 @@ const getHwActiveDayApi= params => {
})
}
const syncHwDataApi= params => {
params.method = `scrm.api.equity.hw.order.sync`
return http({
data: params,
sign: true
})
}
export default {
getEquityCardList,
......@@ -169,5 +177,6 @@ export default {
exportHWOrderList,
gethwBrandList,
editHwActiveDayApi,
getHwActiveDayApi
getHwActiveDayApi,
syncHwDataApi
}
......@@ -13,6 +13,7 @@
<div class="operate_wrap">
<span class="table_title"></span>
<div class="operate_btn">
<el-button class="export_btn" type="primary" size="small" @click="syncDataFn">同步数据</el-button>
<el-button class="export_btn" size="small" @click="handleExport">导出</el-button>
</div>
</div>
......@@ -77,7 +78,7 @@
<td>小计/元</td>
</tr>
<tr v-for="(item,index) in (curDetailInfo.productInfo || [])" :key="index">
<td>{{ item.name || '--'}}</td>
<td>{{ item.productName || '--'}}</td>
<td>{{ item.price || '0'}}</td>
<td>{{ item.amount || '--'}}</td>
<td>{{ calcPrice(item.price, item.amount) || '0' }}</td>
......@@ -339,15 +340,22 @@ export default {
},
activeDayBlur(e){
const MAX_DAY = 30
if(+this.limitedDay>MAX_DAY) return this.$message.error(`限时活动时长最大为${MAX_DAY}天`)
this.$apis.equityApi.editHwActiveDayApi({limitedDay: this.limitedDay}).then(res => {
if(res){
this.$message.success(`操作成功`)
this.isEdit= false
this.$confirm('确认修改活动时长?', '提示', {
type: 'warning'
}).then((resp) => {
if(confirm){
if(+this.limitedDay>MAX_DAY) return this.$message.error(`限时活动时长最大为${MAX_DAY}天`)
this.$apis.equityApi.editHwActiveDayApi({limitedDay: this.limitedDay}).then(res => {
if(res){
this.$message.success(`操作成功`)
}
}).finally(end =>{
this.getActiveDay()
})
}
}).finally(end =>{
setTimeout(()=>{
this.getActiveDay()
},1000)
}).catch(err => {
this.getActiveDay()
})
},
getActiveDay(){
......@@ -358,7 +366,7 @@ export default {
let nowTime = new Date().getTime()
let oldTime = new Date(res.updateTime).getTime()
let subtime = (nowTime - oldTime) / 1000;
let days = Math.ceil(subtime / 86400);
let days = Math.floor(subtime / 86400);
this.residueDay = res.limitedDay - days
}
})
......@@ -379,14 +387,14 @@ export default {
},
filterData({productInfo: list}, type) {
return list?.map(item => {
return `${item.name || '--'}:${item.amount || '0'}`
return `${item.productName || '--'}:${item.amount || '0'}`
}) || []
},
formatParams() {
var params = JSON.parse(JSON.stringify(this.searchForm))
if(params.daterange?.length){
params.startTime = params.daterange?.length ? this.searchForm.daterange[0] : ''
params.endTime = params.daterange?.length ? this.searchForm.daterange[1] : ''
params.startTime = params.daterange?.length ? this.searchForm.daterange[0] + ' 00:00:00' : ''
params.endTime = params.daterange?.length ? this.searchForm.daterange[1] + ' 23:59:59': ''
}else{
delete params.startTime
delete params.endTime
......@@ -400,6 +408,22 @@ export default {
this.exportFn(res.data)
})
},
syncDataFn(){
const today = new Date()
const year = today.getFullYear()
let month = today.getMonth() + 1
month = month < 10 ? '0'+ month : month
let day = today.getDate()
day = day < 10 ? '0'+ day : day
console.log(year, month, day)
const params = {
startTime: `${year}-${month}-${day} 00:00:00`,
endTime: `${year}-${month}-${day} 23:59:59`
}
this.$apis.equityApi.syncHwDataApi({params}).then(res=>{
console.log(res)
})
},
beforeSearchFn() {
return new Promise((resolve, reject) => {
this.searchFormTable = this.formatParams()
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!