|
|
|
@ -121,17 +121,39 @@ |
|
|
|
|
<el-input onkeyup="value=this.value.replace(/\D+/g,'')" |
|
|
|
|
:class="!scope.row.periodOfUse&&whetherSubmit?'red':''" |
|
|
|
|
:disabled="viewDisabled||editDisabled" maxlength="4" |
|
|
|
|
@change="deadLine($event,scope.row),zero($event,scope.row)" |
|
|
|
|
@change="deadLine(scope.row.periodOfUse,scope.row,scope.row.options)" |
|
|
|
|
oninput="value=value.replace(/[^0-9.]/g,'')" |
|
|
|
|
v-model="scope.row.periodOfUse" placeholder="输入时间"></el-input> |
|
|
|
|
<span style="margin-left:5px">月</span> |
|
|
|
|
<span style="margin-left:5px"> |
|
|
|
|
<el-select v-model="scope.row.options" :disabled="viewDisabled||editDisabled" placeholder="请选择" @change="deadLine(scope.row.periodOfUse,scope.row,scope.row.options)"> |
|
|
|
|
<el-option label="日" :value="0"></el-option> |
|
|
|
|
<el-option label="月" :value="1"></el-option> |
|
|
|
|
<el-option label="年" :value="2"></el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</span> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="起止日期" align="center" min-width="100"> |
|
|
|
|
<el-table-column label="起止日期" align="center" min-width="150"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<p v-if="!scope.row.startTime">请输入使用期限</p> |
|
|
|
|
<p v-else>{{ scope.row.startTime }} - {{ scope.row.endTime }}</p> |
|
|
|
|
<p v-if="!scope.row.startTime"> |
|
|
|
|
<el-date-picker |
|
|
|
|
style="width:130px" |
|
|
|
|
v-model="scope.row.startTime" |
|
|
|
|
type="date" :disabled="viewDisabled||editDisabled" |
|
|
|
|
@change="deadLine(scope.row.periodOfUse,scope.row,scope.row.options)" |
|
|
|
|
placeholder="请选择使用日期"> |
|
|
|
|
</el-date-picker> |
|
|
|
|
</p> |
|
|
|
|
<p v-else> |
|
|
|
|
<el-date-picker |
|
|
|
|
style="width:130px" |
|
|
|
|
v-model="scope.row.startTime" |
|
|
|
|
type="date" :disabled="viewDisabled||editDisabled" |
|
|
|
|
@change="deadLine(scope.row.periodOfUse,scope.row,scope.row.options)" |
|
|
|
|
placeholder="请选择使用日期"> |
|
|
|
|
</el-date-picker> |
|
|
|
|
<span v-if="scope.row.startTime"><span v-if='scope.row.endTime'> - </span>{{ scope.row.endTime }}</span></p> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="剩余期限" align="center" min-width="80"> |
|
|
|
@ -236,17 +258,39 @@ |
|
|
|
|
<el-input onkeyup="value=this.value.replace(/\D+/g,'')" |
|
|
|
|
:class="!scope.row.periodOfUse&&whetherSubmit?'red':''" |
|
|
|
|
:disabled="viewDisabled||editDisabled" maxlength="4" |
|
|
|
|
@change="deadLine($event,scope.row),zero($event,scope.row)" |
|
|
|
|
@change="deadLine(scope.row.periodOfUse,scope.row,scope.row.options)" |
|
|
|
|
oninput="value=value.replace(/[^0-9.]/g,'')" |
|
|
|
|
v-model="scope.row.periodOfUse" placeholder="输入时间"></el-input> |
|
|
|
|
<span style="margin-left:5px">月</span> |
|
|
|
|
<span style="margin-left:5px"> |
|
|
|
|
<el-select v-model="scope.row.options" :disabled="viewDisabled||editDisabled" placeholder="请选择" @change="deadLine(scope.row.periodOfUse,scope.row,scope.row.options)"> |
|
|
|
|
<el-option label="日" :value="0"></el-option> |
|
|
|
|
<el-option label="月" :value="1"></el-option> |
|
|
|
|
<el-option label="年" :value="2"></el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</span> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="起止日期" align="center" min-width="100"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<p v-if="!scope.row.startTime">请输入使用期限</p> |
|
|
|
|
<p v-else>{{ scope.row.startTime }} - {{ scope.row.endTime }}</p> |
|
|
|
|
<p v-if="!scope.row.startTime"> |
|
|
|
|
<el-date-picker |
|
|
|
|
style="width:130px" |
|
|
|
|
v-model="scope.row.startTime" |
|
|
|
|
type="date" :disabled="viewDisabled||editDisabled" |
|
|
|
|
@change="deadLine(scope.row.periodOfUse,scope.row,scope.row.options)" |
|
|
|
|
placeholder="请选择使用日期"> |
|
|
|
|
</el-date-picker> |
|
|
|
|
</p> |
|
|
|
|
<p v-else> |
|
|
|
|
<el-date-picker |
|
|
|
|
style="width:130px" |
|
|
|
|
v-model="scope.row.startTime" |
|
|
|
|
type="date" :disabled="viewDisabled||editDisabled" |
|
|
|
|
@change="deadLine(scope.row.periodOfUse,scope.row,scope.row.options)" |
|
|
|
|
placeholder="请选择使用日期"> |
|
|
|
|
</el-date-picker> |
|
|
|
|
<span v-if="scope.row.startTime"><span v-if='scope.row.endTime'> - </span>{{ scope.row.endTime }}</span></p> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="剩余期限" align="center" min-width="80"> |
|
|
|
@ -599,6 +643,7 @@ export default { |
|
|
|
|
endTime: "" // 期限-尾 |
|
|
|
|
// orderId: '', // 绑定订单id |
|
|
|
|
}, |
|
|
|
|
value1:'', |
|
|
|
|
contractTime: [],// 合同起止日期绑定值 |
|
|
|
|
token: "", |
|
|
|
|
orderOther: {// 订单其他数据 |
|
|
|
@ -816,7 +861,8 @@ export default { |
|
|
|
|
cityId: form.cityId, |
|
|
|
|
phone: form.phone, |
|
|
|
|
orderAmount: form.orderAmount, |
|
|
|
|
orderId: form.orderId |
|
|
|
|
orderId: form.orderId, |
|
|
|
|
options: form.options, |
|
|
|
|
}; |
|
|
|
|
this.coursePermissions = list.filter(i => i.authority === 1); |
|
|
|
|
this.dataPlatformPermissions = list.filter(i => i.authority === 0); |
|
|
|
@ -1002,7 +1048,8 @@ export default { |
|
|
|
|
totalAmount: "",// 总价 |
|
|
|
|
isEnable: 1, // 启用否:1启用,0禁用 |
|
|
|
|
ship: 0,// 发货否(0未发货,1已发货,默认不发货) |
|
|
|
|
authority: 1 // 区分权限 0为数据平台权限,1为课程权限 |
|
|
|
|
authority: 1, // 区分权限 0为数据平台权限,1为课程权限 |
|
|
|
|
options: 0, |
|
|
|
|
}; |
|
|
|
|
that.coursePermissions.push(obj); |
|
|
|
|
}; |
|
|
|
@ -1113,7 +1160,8 @@ export default { |
|
|
|
|
totalAmount: "",// 总价 |
|
|
|
|
isEnable: 1, // 启用否:1启用,0禁用 |
|
|
|
|
ship: 0,// 发货否(0未发货,1已发货,默认不发货) |
|
|
|
|
authority: 0// 数据平台权限 |
|
|
|
|
authority: 0,// 数据平台权限 |
|
|
|
|
options:0, |
|
|
|
|
}; |
|
|
|
|
that.dataPlatformPermissions.push(obj); |
|
|
|
|
}; |
|
|
|
@ -1181,7 +1229,7 @@ export default { |
|
|
|
|
// 课程/数据平台-发货 |
|
|
|
|
handleDeliver(e, row) { |
|
|
|
|
if (this.editDisabled) { |
|
|
|
|
this.$post(this.api.ship + "?id=" + `${row.dataOrCourseId}`).then(res => {}); |
|
|
|
|
this.$post(this.api.ship,row).then(res => {}); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 计算折扣率 |
|
|
|
@ -1246,56 +1294,29 @@ export default { |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 使用期限转换以及计算剩余天数 |
|
|
|
|
deadLine(e, row) { |
|
|
|
|
function completeDate(value) { |
|
|
|
|
if (value == 0) return "12"; |
|
|
|
|
return value < 10 ? "0" + value : value; |
|
|
|
|
} |
|
|
|
|
let char = "-"; |
|
|
|
|
let nowDate = new Date(); |
|
|
|
|
let day = nowDate.getDate(); |
|
|
|
|
let month = nowDate.getMonth() + 1; |
|
|
|
|
let year = nowDate.getFullYear(); |
|
|
|
|
if (this.renewDisabled || row.renew) {/* 处于续费状态 */ |
|
|
|
|
if (!e) return row.endTime = ""; |
|
|
|
|
let arr = row.startTime.split("-"); |
|
|
|
|
let renewY = arr.shift();/* 年 */ |
|
|
|
|
let renewM = arr.shift();/* 月 */ |
|
|
|
|
let renewD = arr.shift();/* 日 */ |
|
|
|
|
if ((+renewM + (+e)) > 12) { |
|
|
|
|
renewY = +renewY + Math.ceil((+renewM + (+e)) / 12) - 1; |
|
|
|
|
deadLine(e,row,options) { |
|
|
|
|
let optionsData = '' |
|
|
|
|
if(e > 0){ |
|
|
|
|
if (options == 1){ |
|
|
|
|
optionsData = e*30*24*60*60*1000 |
|
|
|
|
}else if(options == 2){ |
|
|
|
|
optionsData = e*365*24*60*60*1000 |
|
|
|
|
}else{ |
|
|
|
|
optionsData = e*24*60*60*1000 |
|
|
|
|
} |
|
|
|
|
let endYear = renewY + char + completeDate((+renewM + (+e)) % 12) + char + renewD; |
|
|
|
|
row.endTime = endYear; |
|
|
|
|
|
|
|
|
|
// 计算剩余天数 |
|
|
|
|
let date1 = Date.parse(endYear); |
|
|
|
|
let date2 = Date.parse(row.startTime); |
|
|
|
|
let ms = Math.abs(date1 - date2); |
|
|
|
|
row.remainingPeriod = Math.floor(ms / (24 * 3600 * 1000)); |
|
|
|
|
} else { |
|
|
|
|
if (e === "" || (e.substr(0, 1) === "0")) { |
|
|
|
|
row.startTime = ""; |
|
|
|
|
row.endTime = ""; |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
//补全0,并拼接当前的时间点 |
|
|
|
|
let nowYear = year + char + completeDate(month) + char + completeDate(day); |
|
|
|
|
// 判断结束日期 |
|
|
|
|
if ((+month + (+e)) > 12) { |
|
|
|
|
year = +year + Math.ceil((+month + (+e)) / 12) - 1; |
|
|
|
|
} |
|
|
|
|
let endYear = year + char + completeDate((+month + (+e)) % 12) + char + completeDate(day); |
|
|
|
|
// 得出起始年月日 |
|
|
|
|
row.startTime = nowYear; |
|
|
|
|
row.endTime = endYear; |
|
|
|
|
// 计算剩余天数 |
|
|
|
|
let date1 = Date.parse(endYear); |
|
|
|
|
let date2 = Date.parse(nowYear); |
|
|
|
|
let ms = Math.abs(date1 - date2); |
|
|
|
|
let days = Math.floor(ms / (24 * 3600 * 1000)); |
|
|
|
|
row.remainingPeriod = days; |
|
|
|
|
}else{ |
|
|
|
|
optionsData = 0 |
|
|
|
|
} |
|
|
|
|
let time = new Date(row.startTime).getTime(); |
|
|
|
|
let endTime = time + optionsData |
|
|
|
|
row.endTime = time + optionsData |
|
|
|
|
var timestamp = endTime; |
|
|
|
|
var dt = new Date(timestamp); //根据时间戳生成的时间对象 |
|
|
|
|
var date = (dt.getFullYear()) + "-" + (dt.getMonth() + 1) + "-" + (dt.getDate()) |
|
|
|
|
row.endTime = date; |
|
|
|
|
let endYear = timestamp - time |
|
|
|
|
let endYears = endYear/1000/60/60/24 |
|
|
|
|
row.remainingPeriod = endYears |
|
|
|
|
}, |
|
|
|
|
// 清除省份 |
|
|
|
|
clearprovince() { |
|
|
|
|