|
|
|
@ -247,7 +247,7 @@ |
|
|
|
|
</el-switch> |
|
|
|
|
<el-switch |
|
|
|
|
v-else |
|
|
|
|
:disabled="viewDisabled || scope.row.status === 3" |
|
|
|
|
:disabled="viewDisabled" |
|
|
|
|
v-model="scope.row.isEnable" |
|
|
|
|
:active-value="1" |
|
|
|
|
:inactive-value="0" |
|
|
|
@ -642,7 +642,7 @@ |
|
|
|
|
</el-dialog> |
|
|
|
|
</div> |
|
|
|
|
<!-- 选择客户 --> |
|
|
|
|
<select-client @back="backToOrder" v-show="showSelectClient" :refresh="showSelectClient"></select-client> |
|
|
|
|
<select-client ref="client" @back="backToOrder" v-show="showSelectClient" :refresh="showSelectClient"></select-client> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
@ -943,25 +943,27 @@ export default { |
|
|
|
|
let list = orderOther.map(e => { |
|
|
|
|
const now = Date.now() |
|
|
|
|
const item = renewList.find(n => n.dataOrCourseId === e.dataOrCourseId && n.authority === e.authority) // 匹配renew接口返回的数据 |
|
|
|
|
if (item) { |
|
|
|
|
// if (item) { |
|
|
|
|
// 处于续费 |
|
|
|
|
const cur = item || e |
|
|
|
|
if (this.renewDisabled) { |
|
|
|
|
let end = Date.parse(item.endTime); |
|
|
|
|
let end = Date.parse(cur.endTime); |
|
|
|
|
if (now < end) { |
|
|
|
|
let time = new Date(item.endTime.split(" ")[0]) |
|
|
|
|
let time = new Date(cur.endTime.split(" ")[0]) |
|
|
|
|
time = new Date(time.setDate(time.getDate() + 1)) |
|
|
|
|
e.startTime = `${time.getFullYear()}-${time.getMonth() + 1}-${time.getDate()}` |
|
|
|
|
} else { |
|
|
|
|
const date = new Date() |
|
|
|
|
// 过期 |
|
|
|
|
e.startTime = ""; |
|
|
|
|
e.startTime = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}` |
|
|
|
|
} |
|
|
|
|
e.endTime = ""; |
|
|
|
|
e.periodOfUse = ""; |
|
|
|
|
} else if (!this.viewDisabled) { // 如果不是查看 |
|
|
|
|
e.startTime = item.startTime.split(" ")[0]; |
|
|
|
|
e.endTime = item.endTime.split(" ")[0]; |
|
|
|
|
} |
|
|
|
|
e.startTime = cur.startTime.split(" ")[0]; |
|
|
|
|
e.endTime = cur.endTime.split(" ")[0]; |
|
|
|
|
} |
|
|
|
|
// } |
|
|
|
|
const startTime = new Date(e.startTime) |
|
|
|
|
const endTime = new Date(e.endTime) |
|
|
|
|
// 1: 未生效,2:生效中,3:已过期 |
|
|
|
@ -976,6 +978,13 @@ export default { |
|
|
|
|
this.coursePermissions = list.filter(i => i.authority === 1); |
|
|
|
|
this.dataPlatformPermissions = list.filter(i => i.authority === 0); |
|
|
|
|
}, |
|
|
|
|
// 刷新缓存 |
|
|
|
|
refreshCache() { |
|
|
|
|
const { customerId } = this.form |
|
|
|
|
const clients = this.$refs.client.listData |
|
|
|
|
const curClient = clients.find(e => e.customerId == customerId) |
|
|
|
|
this.$post(`${this.api.refreshCache}?schoolId=${curClient ? curClient.schoolId : ''}`).then(res => {}).catch(res => {}) |
|
|
|
|
}, |
|
|
|
|
// 新增订单 |
|
|
|
|
submitOrder() { |
|
|
|
|
let purchase = 0 // 总采购成本 |
|
|
|
@ -1054,6 +1063,7 @@ export default { |
|
|
|
|
this.loading = true; |
|
|
|
|
if (this.editDisabled) { |
|
|
|
|
this.$post(this.api.orderUpdate, param).then(res => { |
|
|
|
|
this.refreshCache() |
|
|
|
|
this.$message.success("修改成功"); |
|
|
|
|
this.loading = false; |
|
|
|
|
this.$router.back(); |
|
|
|
@ -1062,9 +1072,10 @@ export default { |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
this.$post(this.api.orderAdd, param).then(res => { |
|
|
|
|
this.refreshCache() |
|
|
|
|
this.$message.success("添加订单成功"); |
|
|
|
|
this.loading = false; |
|
|
|
|
this.$router.back(); |
|
|
|
|
this.renewDisabled ? this.$router.push('/order') : this.$router.back(); |
|
|
|
|
}).catch(err => { |
|
|
|
|
this.loading = false; |
|
|
|
|
}); |
|
|
|
@ -1362,6 +1373,7 @@ export default { |
|
|
|
|
const list = data ? this.dataPlatformPermissions : this.coursePermissions |
|
|
|
|
list.map(e => e.ship = ship) |
|
|
|
|
if (this.editDisabled) { |
|
|
|
|
this.refreshCache() |
|
|
|
|
this.$post(this.api.bulkShipping, { |
|
|
|
|
orderOthers: list |
|
|
|
|
}).then(res => {}) |
|
|
|
@ -1370,6 +1382,7 @@ export default { |
|
|
|
|
// 课程/数据平台-发货 |
|
|
|
|
handleDeliver(e, row) { |
|
|
|
|
if (this.editDisabled) { |
|
|
|
|
this.refreshCache() |
|
|
|
|
this.$post(this.api.ship,row).then(res => {}); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
@ -1488,9 +1501,10 @@ export default { |
|
|
|
|
unit === 1 ? |
|
|
|
|
price / 12 * useUnit : |
|
|
|
|
price * useUnit)).toFixed(2) |
|
|
|
|
|
|
|
|
|
this.dealComputers(e, row) |
|
|
|
|
|
|
|
|
|
row.authority ? this.calculateDiscountCourse(e, row) : this.calculateDiscount(e, row) |
|
|
|
|
|
|
|
|
|
// 只有改变了起止日期才需要调接口查询订单,该接口作用是把开始时间传过去,会返回一个提示或者时间,如果是时间,则把时间+1天,如果是提示,则无法保存 |
|
|
|
|
if (isDate) { |
|
|
|
|
const cId = row.dataOrCourseId |
|
|
|
|