订单添加理实课程

dev_202412
yujialong 2 months ago
parent 89abb11569
commit 07b36913d2
  1. 194
      src/views/order/AddOrder.vue
  2. 2
      src/views/shop/add.vue

@ -400,6 +400,155 @@
</div>
</el-card>
<!-- 理实课程 -->
<el-card shadow="hover" class="mgb20">
<div>
<div class="flex-between mgb20 user_header">
<div class="flex-center">
<p class="addhr_tag"></p>
<span>理实课程产品权限</span>
</div>
<div>
<!-- 处理中 || 有未生效的课程 || 新增订单 && 有课程 -->
<template v-if="!viewDisabled && (dispose || (isAdd && theoryTrialList.length))">
<el-button v-if="theoryTrialList.find(e => !e.ship)" v-auth="'/order:发货'" type="primary" round
@click="batchDeliver(1, 6)">一键发货</el-button>
<el-button v-else v-auth="'/order:发货'" type="primary" round
@click="batchDeliver(0, 6)">取消全部发货</el-button>
</template>
<el-button v-if="!viewDisabled && !isEdit && !renewDisabled" type="primary" round
@click="addCourseJurisdiction(7)">添加</el-button>
</div>
</div>
<el-table :data="theoryTrialList" class="orderTable" header-align="center">
<el-table-column type="index" width="60" label="序号" align="center">
</el-table-column>
<el-table-column prop="productName" label="产品名称" align="center" min-width="150" show-overflow-tooltip>
</el-table-column>
<el-table-column label="使用期限" align="center" min-width="190">
<template slot="header" slot-scope="scope">
<template v-if="viewDisabled || isEdit">使用期限</template>
<template v-else>
<el-input class="batch-time" :disabled="viewDisabled || isEdit" maxlength="4"
@change="batchDeadlineChange(1)"
@input="productProps[6].deadline = productProps[6].deadline.replace(/[^0-9.]/g, '')"
v-model="productProps[6].deadline" placeholder="批量输入时间" />
<el-select class="batch-unit" v-model="productProps[6].unit" :disabled="viewDisabled || isEdit"
placeholder="请选择" @change="batchUnitChange(1)">
<el-option v-for="(item, i) in units" :key="i" :label="item.name" :value="item.id"></el-option>
</el-select>
</template>
</template>
<template slot-scope="scope">
<div class="small">
<el-input class="time-input" :class="!scope.row.periodOfUse && whetherSubmit ? 'red' : ''"
:disabled="viewDisabled || isEdit" maxlength="4"
@change="deadLine(scope.row.periodOfUse, scope.row, scope.row.options, 1)"
@input="scope.row.periodOfUse = scope.row.periodOfUse.replace(/[^0-9.]/g, '')"
v-model="scope.row.periodOfUse" placeholder="输入时间"></el-input>
<el-select class="time-select" v-model="scope.row.options" :disabled="viewDisabled || isEdit"
placeholder="请选择" @change="deadLine(scope.row.periodOfUse, scope.row, scope.row.options, 1)">
<el-option v-for="(item, i) in units" :key="i" :label="item.name" :value="item.id"></el-option>
</el-select>
</div>
</template>
</el-table-column>
<el-table-column label="起止日期" align="center" min-width="240">
<template slot-scope="scope">
<p v-if="!scope.row.startTime">
<el-date-picker :class="orderRepeat.includes(scope.row.mallId) ? 'red' : ''" style="width:130px"
v-model="scope.row.startTime" type="date" :disabled="viewDisabled || isEdit"
@change="deadLine(scope.row.periodOfUse, scope.row, scope.row.options, 1)"
placeholder="请选择使用日期">
</el-date-picker>
</p>
<p v-else>
<el-date-picker :class="orderRepeat.includes(scope.row.mallId) ? 'red' : ''" style="width:130px"
v-model="scope.row.startTime" type="date" :disabled="viewDisabled || isEdit"
@change="deadLine(scope.row.periodOfUse, scope.row, scope.row.options, 1)"
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="110">
<template slot-scope="scope">
<div class="small">
<el-input disabled v-model="scope.row.remainingPeriod" placeholder="" type="text"></el-input>
<span style="margin-left:5px"></span>
</div>
</template>
</el-table-column>
<el-table-column label="市场价" align="center" min-width="170">
<template slot-scope="scope">
<div class="small">
<el-input class="normal" disabled v-model="scope.row.marketValue" type="text"></el-input>
</div>
</template>
</el-table-column>
<el-table-column label="折扣率 " align="center" min-width="110">
<template slot-scope="scope">
<el-input class="normal" disabled v-model="scope.row.discountRate" placeholder="" type="text"
size="small" style="width: 100%"></el-input>
</template>
</el-table-column>
<el-table-column label="成交价" align="center" min-width="170">
<template slot-scope="scope">
<div class="small">
<el-input :class="['normal', scope.row.finalPrice === '' && whetherSubmit ? 'red' : '']"
:disabled="viewDisabled"
@input="scope.row.finalPrice = scope.row.finalPrice.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')"
@change="[allAmount(scope.row), calculateDiscountCourse(scope.row)]"
v-model="scope.row.finalPrice" type="text"></el-input>
</div>
</template>
</el-table-column>
<el-table-column label="结算价" align="center" min-width="170">
<template slot-scope="scope">
<div class="small">
<el-input :class="['normal', scope.row.settlementPrice === '' && whetherSubmit ? 'red' : '']"
:disabled="viewDisabled"
@input="scope.row.settlementPrice = scope.row.settlementPrice.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')"
v-model="scope.row.settlementPrice" type="text"></el-input>
</div>
</template>
</el-table-column>
<el-table-column label="端口地址 " align="center" min-width="100">
<template slot-scope="scope">
<el-button @click="configure(scope.row)">配置</el-button>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="180">
<template slot-scope="scope">
<div class="flex-c-c">
<el-button v-if="!isEdit && !viewDisabled" type="text"
@click="delCourseDataForm(scope.$index, scope.row)" style="margin-right:10px;">删除</el-button>
<!-- 1: 未生效2生效中3已过期 -->
<!--
1查看时不可操作
2发货和启用不要同时出现生效前只会显示发货不发货按钮生效后只显示禁启用按钮
3处理中的订单显示发货不显示禁用
-->
<el-switch v-if="scope.row.ship === 0 || dispose || isAdd" v-auth="'/order:发货'"
style="margin-right:10px;" v-model="scope.row.ship" :active-value="1" :inactive-value="0"
:active-text="scope.row.ship ? '已发货' : '未发货'" :disabled="viewDisabled"
@change="handleDeliver($event, scope.row, 6)">
</el-switch>
<el-switch v-else :disabled="viewDisabled" v-model="scope.row.isEnable" :active-value="1"
:inactive-value="0" :active-text="scope.row.isEnable ? '启用' : '禁用'"
@change="handleEnable($event, scope.row, 6)">
</el-switch>
</div>
</template>
</el-table-column>
</el-table>
</div>
</el-card>
<!-- 数据平台权限 -->
<el-card shadow="hover" class="mgb20">
<div>
@ -1211,6 +1360,12 @@ export default {
deadline: '',
unit: '',
},
{
id: 7,
name: 'theoryTrialList',
deadline: '',
unit: '',
},
],
pageTypes: false,
dataPageTypes: false,
@ -1395,10 +1550,11 @@ export default {
shipContent: '',
shipInfo: '',
curRow: {},
// 1 2 3 45 6
// 1 2 3 45 6 7
classificationId: 0,
//
theoryCourseList: [],
theoryTrialList: [],
units: [
{
id: 0,
@ -1662,6 +1818,7 @@ export default {
});//
this.coursePermissions = list.filter(i => i.authority === 1 && (i.mallClassificationId == 1 || !i.mallClassificationId));
this.theoryCourseList = list.filter(i => i.authority === 1 && i.mallClassificationId == 2);
this.theoryTrialList = list.filter(i => i.authority === 1 && i.mallClassificationId == 7);
this.dataPlatformPermissions = list.filter(i => i.authority === 0);
this.valuePermissions = list.filter(i => i.authority === 2);
this.practicalCourses = list.filter(i => i.authority === 3);
@ -1723,7 +1880,7 @@ export default {
submitOrder () {
let purchase = 0 //
let profit = 0 //
if (!this.coursePermissions.length && !this.theoryCourseList.length && !this.dataPlatformPermissions.length && !this.valuePermissions.length && !this.practicalCourses.length && !this.expTools.length) {
if (!this.coursePermissions.length && !this.theoryCourseList.length && !this.theoryTrialList.length && !this.dataPlatformPermissions.length && !this.valuePermissions.length && !this.practicalCourses.length && !this.expTools.length) {
return this.$message.error("请选择产品权限后再确认订单");
} else {
//
@ -1769,6 +1926,27 @@ export default {
return this.$message.error("请把课程参数输入完整");
}
}
if (this.theoryTrialList.length) {
let courseVerify =
this.theoryTrialList.some(e => {
// if (!e.periodOfUse || e.finalPrice === '') {
if (!e.periodOfUse || e.finalPrice === '' || !e.startTime) {
return false;
} else {
const curPurchase = +e.settlementPrice + (e.settlementPrice * (this.rate / 100))
purchase += curPurchase
profit += +e.finalPrice - curPurchase
return true;
}
});
if (!courseVerify) {
this.whetherSubmit = true;
setTimeout(() => {
this.whetherSubmit = false;
}, 4000);
return this.$message.error("请把课程参数输入完整");
}
}
//
if (this.dataPlatformPermissions.length) {
let dataVerify =
@ -1854,7 +2032,7 @@ export default {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.orderRepeat.length) return this.$message.error(this.repeatMsg)
let tempArr = [...this.dataPlatformPermissions, ...this.coursePermissions, ...this.valuePermissions, ...this.practicalCourses, ...this.expTools, ...this.theoryCourseList];
let tempArr = [...this.dataPlatformPermissions, ...this.coursePermissions, ...this.valuePermissions, ...this.practicalCourses, ...this.expTools, ...this.theoryCourseList, ...this.theoryTrialList];
console.log('tempArr=>', tempArr)
let renew = tempArr.some(e => e.renew);
if (this.renewDisabled || renew) {/* 续费状态下 */
@ -2082,6 +2260,9 @@ export default {
case 6:
authority = 4
break;
case 7:
authority = 1
break;
default:
break;
}
@ -2211,8 +2392,9 @@ export default {
this.expTools :
data === 5 ?
this.theoryCourseList :
this.coursePermissions
data === 6 ?
this.theoryTrialList :
this.coursePermissions
list.map(e => {
e.ship = ship
if (e.ship === 1) {
@ -2581,6 +2763,8 @@ export default {
return '数据前瞻平台权限列表'
case 6:
return '实验工具列表'
case 7:
return '理实课程列表'
default:
break;
}

@ -900,7 +900,7 @@ export default {
this.$post(`${this.api.curriculumDetail}?cid=${id}`).then(({ data }) => {
form.supplierIds = data.supplier.split(',').map(e => +e)
this.selectedProduct = true
form.classificationIds = !data.curriculumType ? 2 : data.curriculumType
form.classificationIds = !data.curriculumType ? 2 : data.curriculumType === 1 ? 1 : 7
if (data.curriculumDisciplines && data.curriculumDisciplines.length) {
form.mallDisciplines = data.curriculumDisciplines

Loading…
Cancel
Save