You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1509 lines
72 KiB

<template>
<div v-loading="loading">
<!-- 订单详情 -->
<div v-show="!showSelectClient">
4 years ago
<el-row :gutter="20">
<el-col :span="24">
<el-card shadow="hover" class="mgb20">
<div class="flex-between">
<div class="per_title" v-preventReClick @click="goBack()">
<i class="el-icon-arrow-left"></i>
<span class="per_back">返回</span>
<span class="per_school">订单处理</span>
</div>
<el-button v-if="!disabled" type="primary" round class="mag" v-preventReClick
@click="submitOrder">确定
4 years ago
</el-button>
</div>
</el-card>
4 years ago
<el-card shadow="hover" class="mgb20">
<div>
<div class="flex-center mgb20 user_header">
<p class="addhr_tag"></p>
<span>基本信息</span>
</div>
<div>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-col :span="6" :offset="5">
<el-form-item label="订单编号">
<el-input v-model="form.orderNumber" disabled placeholder="自动生成"></el-input>
</el-form-item>
4 years ago
<el-form-item label="订单时间" prop="createTime">
<el-date-picker
disabled
style="width:100%"
v-model="form.createTime"
type="date"
placeholder="自动生成">
</el-date-picker>
</el-form-item>
<el-form-item label="省份">
4 years ago
<el-select disabled v-model="form.provinceId" clearable placeholder="请选择省份"
@change="getCity" @clear="clearprovince()">
<el-option v-for="(item,index) in provinceList" :key="index"
:label="item.provinceName"
:value="item.provinceId"></el-option>
</el-select>
</el-form-item>
<el-form-item label="联系人">
4 years ago
<el-input disabled v-model="form.orderContact"
placeholder="请输入联系人姓名"></el-input>
</el-form-item>
<el-form-item label="邮箱">
<el-input disabled v-model="form.email" placeholder="请输入邮箱地址"></el-input>
</el-form-item>
</el-col>
<el-col :span="6" :offset="2">
<el-form-item prop="customerName" label="订单客户">
4 years ago
<div v-if="!disabled&&!editDisabled&&!renewDisabled" @click="gotoClient"
style="cursor: pointer">
<el-input v-model="form.customerName" placeholder="请选择客户"></el-input>
</div>
4 years ago
<el-input v-if="disabled||editDisabled||renewDisabled" disabled
v-model="form.customerName" placeholder="请选择客户"></el-input>
</el-form-item>
<el-form-item prop="orderType" label="订单类型">
4 years ago
<el-select :disabled="disabled||editDisabled||renewDisabled"
v-model="form.orderType" clearable placeholder="请选择订单类型">
<el-option v-for="(item,index) in orderTypeList" :key="index"
:label="item.name" :value="item.value"></el-option>
</el-select>
</el-form-item>
<el-form-item label="城市">
<el-select disabled v-model="form.cityId" placeholder="请选择">
<el-option
4 years ago
v-for="(item,index) in cityList"
:key="index"
:label="item.cityName"
:value="item.cityId">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="电话">
4 years ago
<el-input disabled v-model="form.phone" placeholder="请输入电话号码"
maxlength="11"></el-input>
</el-form-item>
<el-form-item label="订单金额(元)" prop="orderAmount">
4 years ago
<el-input disabled
oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')"
type="number" v-model="form.orderAmount"
placeholder="请输入订单金额"></el-input>
</el-form-item>
</el-col>
</el-form>
</div>
</div>
</el-card>
<!-- 课程 -->
4 years ago
<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>
<el-button v-if="!disabled&&!editDisabled&&!renewDisabled" type="primary" round
class="mag"
@click="addCourseJurisdiction()">添加
4 years ago
</el-button>
</div>
<el-table :data="coursePermissions" class="orderTable" stripe header-align="center">
<el-table-column type="index" width="60" label="序号" align="center">
</el-table-column>
<el-table-column prop="productName" label="课程名称" align="center" width="200">
</el-table-column>
<el-table-column label="使用期限" align="center">
<template slot-scope="scope">
<div class="small">
<el-input onkeyup="value=this.value.replace(/\D+/g,'')"
:class="!scope.row.periodOfUse&&whetherSubmit?'red':''"
:disabled="disabled||editDisabled" maxlength="4"
@change="deadLine($event,scope.row),zero($event,scope.row)"
4 years ago
oninput="value=value.replace(/[^0-9.]/g,'')"
v-model="scope.row.periodOfUse" placeholder="输入时间"></el-input>
<span style="margin-left:5px"></span>
</div>
</template>
</el-table-column>
<el-table-column label="起止日期" align="center" width="200">
<template slot-scope="scope">
<p v-if="!scope.row.startTime">请输入使用期限</p>
<p v-else>{{ scope.row.startTime }} - {{ scope.row.endTime }}</p>
</template>
</el-table-column>
<el-table-column label="剩余期限" align="center">
<template slot-scope="scope">
<div class="small">
<el-input disabled v-model="scope.row.remainingPeriod" placeholder=""
4 years ago
type="text"></el-input>
<span style="margin-left:5px"></span>
</div>
</template>
</el-table-column>
<el-table-column label="市场价" align="center">
<template slot-scope="scope">
<div class="small">
<el-input disabled v-model="scope.row.marketValue" placeholder=""
4 years ago
type="text"></el-input>
<span style="margin-left:5px"></span>
</div>
</template>
</el-table-column>
<el-table-column label="成交价" align="center">
<template slot-scope="scope">
<div class="small">
<el-input :class="!scope.row.finalPrice&&whetherSubmit?'red':''"
:disabled="disabled||editDisabled"
oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')"
@change="[allAmount($event,scope.row),calculateDiscount($event,scope.row)]"
4 years ago
v-model="scope.row.finalPrice" placeholder="请输入"
type="text"></el-input>
<span style="margin-left:5px"></span>
</div>
</template>
</el-table-column>
<el-table-column label="折扣率 " align="center">
<template slot-scope="scope">
<div class="small">
<el-input disabled v-model="scope.row.discountRate" placeholder=""
4 years ago
type="text"></el-input>
</div>
</template>
</el-table-column>
3 years ago
<el-table-column label="端口地址 " align="center" 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="230px">
<template slot-scope="scope">
<div class="flex-c-c">
<el-button
v-if="!editDisabled&&!disabled"
type="text"
@click="delCourseForm(scope.$index)"
style="margin-right:10px;"
>删除</el-button>
<el-switch
style="margin-right:10px"
v-show="scope.row.ship"
:disabled="disabled"
v-model="scope.row.isEnable"
:active-value="1"
:inactive-value="0"
:active-text="scope.row.isEnable ? '禁用' : '启用'"
@change="handleEnable($event,scope.row)">
</el-switch>
<el-switch
v-show="!scope.row.ship"
:disabled="scope.row.ship === 1 || disabled"
v-model="scope.row.ship"
:active-value="1"
:inactive-value="0"
:active-text="scope.row.ship ? '发货' : '未发货'"
@change="handleDeliver($event,scope.row)">
</el-switch>
</div>
</template>
</el-table-column>
</el-table>
</div>
4 years ago
</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>
<el-button v-if="!disabled&&!editDisabled&&!renewDisabled" type="primary"
4 years ago
round class="mag" @click="addDataJurisdiction()">添加
</el-button>
</div>
<!--:summary-method="getSummaries"-->
<el-table :data="dataPlatformPermissions" class="orderTable" stripe header-align="center">
<el-table-column type="index" width="60" label="序号" align="center">
</el-table-column>
4 years ago
<el-table-column prop="productName" label="产品名称" align="center" width="200">
</el-table-column>
<el-table-column label="使用期限" align="center">
<template slot-scope="scope">
<div class="small">
4 years ago
<el-input onkeyup="value=this.value.replace(/\D+/g,'')"
:class="!scope.row.periodOfUse&&whetherSubmit?'red':''"
:disabled="disabled||editDisabled" maxlength="4"
@change="deadLine($event,scope.row),zero($event,scope.row)"
oninput="value=value.replace(/[^0-9.]/g,'')"
v-model="scope.row.periodOfUse" placeholder="输入时间"></el-input>
<span style="margin-left:5px"></span>
</div>
</template>
</el-table-column>
<el-table-column label="起止日期" align="center" width="200">
<template slot-scope="scope">
<p v-if="!scope.row.startTime">请输入使用期限</p>
<p v-else>{{ scope.row.startTime }} - {{ scope.row.endTime }}</p>
</template>
</el-table-column>
<el-table-column label="剩余期限" align="center">
<template slot-scope="scope">
<div class="small">
<el-input disabled v-model="scope.row.remainingPeriod" placeholder=""
4 years ago
type="text"></el-input>
<span style="margin-left:5px"></span>
</div>
</template>
</el-table-column>
<el-table-column label="市场价" align="center">
<template slot-scope="scope">
<div class="small">
<el-input disabled v-model="scope.row.marketValue" placeholder=""
4 years ago
type="text"></el-input>
<span style="margin-left:5px">&nbsp;/&nbsp;</span>
</div>
</template>
</el-table-column>
<el-table-column label="成交价" align="center">
<template slot-scope="scope">
<div class="small">
4 years ago
<el-input :class="!scope.row.finalPrice&&whetherSubmit?'red':''"
:disabled="disabled||editDisabled"
oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')"
@change="[dealComputers($event,scope.row),calculateDiscount($event,scope.row),userAmount($event,scope.row)]"
v-model="scope.row.finalPrice" placeholder="请输入"
type="text"></el-input>
<span style="margin-left:5px">&nbsp;/&nbsp; </span>
</div>
</template>
</el-table-column>
<el-table-column label="折扣率" align="center">
<template slot-scope="scope">
<!-- <div class="discountRate"> -->
<div class="small">
4 years ago
<el-input disabled v-model="scope.row.discountRate" placeholder=""
type="text"></el-input>
</div>
</template>
</el-table-column>
<el-table-column label="账号数" align="center">
<template slot-scope="scope">
<div class="small">
4 years ago
<el-input :class="!scope.row.accountNum&&whetherSubmit?'red':''"
:disabled="disabled||editDisabled"
@change="[dealComputers($event,scope.row),dealBargain($event,scope.row),calculateDiscount($event,scope.row)]"
v-model="scope.row.accountNum" placeholder="请输入"
type="text"></el-input>
</div>
</template>
</el-table-column>
<!-- 金额自动计算计算方式账号数*成交价且可以手动修改保留两位小数 -->
<el-table-column label="总金额(元)" align="center">
<template slot-scope="scope">
<div class="small">
4 years ago
<el-input :class="!scope.row.totalAmount&&whetherSubmit?'red':''"
:disabled="disabled||editDisabled"
@blur="[allAmount($event,scope.row),allAmountChange($event,scope.row),calculateDiscount($event,scope.row)]"
oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')"
v-model="scope.row.totalAmount" placeholder="请输入"
type="text"></el-input>
</div>
</template>
</el-table-column>
4 years ago
<el-table-column label="操作" align="center" width="230px">
<template slot-scope="scope">
<div class="flex-c-c">
<el-button
v-if="!editDisabled&&!disabled"
type="text"
@click="delDataForm(scope.$index)"
style="margin-right:10px;"
>删除</el-button>
<el-switch
style="margin-right:10px"
v-show="scope.row.ship"
:disabled="disabled"
v-model="scope.row.isEnable"
:active-value="1"
:inactive-value="0"
:active-text="scope.row.isEnable ? '禁用' : '启用'"
@change="handleEnable($event,scope.row)">
</el-switch>
<el-switch
v-show="!scope.row.ship"
:disabled="scope.row.ship === 1 || disabled"
v-model="scope.row.ship"
:active-value="1"
:inactive-value="0"
:active-text="scope.row.ship ? '发货' : '未发货'"
@change="handleDeliver($event,scope.row)">
</el-switch>
</div>
</template>
</el-table-column>
</el-table>
</div>
</el-card>
<!-- 合同 -->
<el-card shadow="hover" class="mgb20">
<div>
<div class="flex-center mgb20 user_header">
<p class="addhr_tag"></p>
<span>合同信息</span>
</div>
<div>
4 years ago
<el-form :disabled="disabled" ref="contract" :model="contract" :rules="rules"
label-width="80px">
<el-col :span="8" :offset="4">
<el-form-item label="合同名称">
<el-input v-model="contract.contractName" placeholder="请输入合同名称"></el-input>
</el-form-item>
<el-form-item label="合同金额" prop="contractInformationSum">
4 years ago
<el-input oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')"
v-model="contract.contractMoney" placeholder="请输入合同金额"></el-input>
</el-form-item>
</el-col>
<el-col :span="8" :offset="2">
<el-form-item label="合同编号">
4 years ago
<el-input v-model="contract.contractNumber"
placeholder="请输入合同编号"></el-input>
</el-form-item>
<el-form-item label="合同期限">
<div class="contractDate">
<el-date-picker
v-model="contractTime"
style="wifth:100%"
type="daterange"
value-format="yyyy-MM-dd"
@change="contractTimeChange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
</div>
</el-form-item>
</el-col>
<el-col :span="24" :offset="4" class="flex-start">
<el-form-item label="上传合同">
<el-upload
class="contract"
:headers="{token}"
:on-remove="handleRemove"
:on-error="uploadError"
:on-success="uploadSuccess"
:before-upload="beforeAvatarUpload"
:before-remove="beforeRemove"
:limit="1"
:on-exceed="handleExceed"
4 years ago
:action="api.fileupload"
:file-list="uploadList"
>
<el-button size="medium" type="plain" class="uploadTitle">上传</el-button>
</el-upload>
</el-form-item>
<!-- <el-form-item>
<el-button size="medium" type="plain" style="height:40px">重新上传</el-button>
</el-form-item> -->
</el-col>
</el-form>
</div>
</div>
</el-card>
</el-col>
</el-row>
<!-- 添加课程权限弹框-->
<el-dialog :visible.sync="courseVisible" width="50%" center :close-on-click-modal="false" @close="closeJCourse">
<div class="flex-between mgb20">
<div class="flex-center">
<p class="addhr_tag"></p>
<span>课程列表</span>
</div>
<div>
<el-input placeholder="请输入课程名称" prefix-icon="el-icon-search" v-model.trim="curriculumName" clearable></el-input>
</div>
</div>
<el-table v-loading="dataLoading" :data="courseList" stripe header-align="center"
4 years ago
@selection-change="handleSelectionChange" row-key="cid">
<el-table-column type="selection" :selectable="courseSelectable" width="55"
align="center"></el-table-column>
<el-table-column type="index" width="100" label="序号" align="center">
</el-table-column>
4 years ago
<el-table-column prop="curriculumName" label="课程名称" align="center">
</el-table-column>
<el-table-column label="课程类型" align="center">
<template slot-scope="scope">
<span>{{ curriculumTypeKeys[scope.row.curriculumType] }}</span>
</template>
</el-table-column>
<el-table-column label="配置的实训应用" align="center">
<template slot-scope="scope">
4 years ago
<span class="ellipsis">{{ scope.row.sysName }}</span>
</template>
</el-table-column>
4 years ago
<el-table-column prop="expectedCourse" label="预计课时" align="center">
</el-table-column>
</el-table>
<div class="pagination">
<el-pagination background layout="total, prev, pager, next" :total="courseTotals"
@current-change="handleCurrentChange" :current-page="coursePage">
</el-pagination>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="closeJCourse"> </el-button>
<el-button type="primary" v-preventReClick @click="addCourse"> </el-button>
</span>
</el-dialog>
<!-- 添加数据平台权限弹框 -->
4 years ago
<el-dialog :visible.sync="showPlatform" width="50%" center>
<div class="flex-between mgb20">
<div class="flex-center">
<p class="addhr_tag"></p>
<span>数据产品列表</span>
</div>
<div>
<el-input placeholder="请输入产品名称" prefix-icon="el-icon-search" v-model="productName" clearable></el-input>
</div>
</div>
<el-table v-loading="dataLoading" :data="platformList" stripe header-align="center"
@selection-change="dataPlatformSelection" row-key="id">
<el-table-column type="selection" :selectable="dataSelectable" width="55"
4 years ago
align="center"></el-table-column>
<el-table-column type="index" width="100" label="序号" align="center"></el-table-column>
<el-table-column prop="productName" label="产品名称" align="center"></el-table-column>
<el-table-column prop="tableNum" label="数据量(表)" align="center"></el-table-column>
<el-table-column prop="userName" label="创建人" align="center"></el-table-column>
<el-table-column prop="orderNum" label="订单数量" align="center"></el-table-column>
<el-table-column prop="market" label="市场价" align="center"></el-table-column>
<el-table-column prop="createTime" label="创建时间" align="center"></el-table-column>
<!-- <el-table-column prop="orderNature" label="状态" align="center">
<template slot-scope="scope">
<p>{{scope.row.status ? '上架' : '下架'}}</p>
</template>
</el-table-column> -->
</el-table>
<div class="pagination">
4 years ago
<el-pagination background layout="total, prev, pager, next" :total="platfromTotals"
@current-change="platfromCurrentChange" :current-page="platfromPage">
</el-pagination>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="showPlatform = false"> </el-button>
<el-button type="primary" v-preventReClick @click="addPlatform()"> </el-button>
</span>
</el-dialog>
<!-- 选择IP -->
<el-dialog :visible.sync="ipVisible" width="70%" center>
<div class="flex-center mgb20">
<p class="hr_tag"></p>
<span>地址列表</span>
</div>
<el-table :data="IPData" stripe header-align="center">
<el-table-column type="index" width="100" label="序号" align="center">
</el-table-column>
<el-table-column prop="age" label="服务器名称" align="center">
</el-table-column>
<el-table-column label="IP" align="center">
<template slot-scope="scope">
<div class="tab_temp">
<div class="flex-center">
<label>内网:</label>
<el-input v-model="scope.row.Intranet" placeholder="请输入IP地址"></el-input>
</div>
<div class="flex-center mar10">
<label>外网:</label>
<el-input v-model="scope.row.extranet" placeholder="请输入端口号"></el-input>
</div>
</div>
</template>
</el-table-column>
<el-table-column label="端口" align="center">
<template slot-scope="scope">
<div class="tab_temp">
<div class="flex-center">
<label>内网:</label>
<el-input v-model="scope.row.Intranet" placeholder="请输入内网IP地址"></el-input>
</div>
<div class="flex-center mar10">
<label>外网:</label>
<el-input v-model="scope.row.extranet" placeholder="请输入外网IP地址"></el-input>
</div>
</div>
</template>
</el-table-column>
<el-table-column label="选择" align="center">
<template slot-scope="scope">
<i class="el-icon-success radio_icon"></i>
</template>
</el-table-column>
</el-table>
<span slot="footer" class="dialog-footer">
<el-button @click="ipVisible = false"> </el-button>
<el-button type="primary" @click="IPSure()"> </el-button>
</span>
</el-dialog>
</div>
<!-- 选择客户 -->
<select-client @back="backToOrder" v-show="showSelectClient" :refresh="showSelectClient"></select-client>
</div>
</template>
<script>
4 years ago
import selectClient from "./selectClient.vue";
export default {
4 years ago
components: {
selectClient
},
data() {
return {
4 years ago
loading: false,// 页面加载
disabled: false,// 查看禁用。
editDisabled: false,// 编辑禁用
renewDisabled: false,// 续费禁用
dataLoading: false,// 产品弹框加载
4 years ago
whetherSubmit: false,/* 提交否 */
4 years ago
showSelectClient: false,// 切换展示选择客户页
form: {// 基本信息
// orderNumber: '',// 编号
4 years ago
provinceId: "",// 省份id
orderContact: "",// 联系人
email: "",
customerId: "",// 客户id
orderType: "",
cityId: "",
phone: "",
orderAmount: 0,
// orderId: this.$store.state.orderId,
4 years ago
customerName: ""// 客户名称
},
coursePermissions: [],// 课程权限
dataPlatformPermissions: [],// 数据平台权限
4 years ago
contract: { // 合同信息
contractName: "", // 合同名称
contractFile: "", // 合同文件
contractMoney: "", // 合同金额
contractNumber: "",// 合同编号
startTime: "", // 期限-头
endTime: "" // 期限-尾
// orderId: '', // 绑定订单id
},
4 years ago
contractTime: [],// 合同起止日期绑定值
token: "",
4 years ago
orderOther: {// 订单其他数据
},
uploadList: [],
rules: {
orderNumber: [
4 years ago
{ required: true, message: "请输入订单编号", trigger: "blur" }
],
customerName: [
4 years ago
{ required: true, message: "请选择订单客户", trigger: "change" }
],
orderContact: [
4 years ago
{ required: true, message: "请输入联系人姓名", trigger: "blur" }
],
4 years ago
orderType: [
4 years ago
{ required: true, message: "请选择订单类型", trigger: "change" }
],
phone: [
4 years ago
{ required: true, message: "请输入手机号", trigger: "blur" },
{
pattern: /^(?:(?:\+|00)86)?1[3-9]\d{9}$/,
4 years ago
message: "请输入正确的手机号",
trigger: "blur"
}
],
email: [
4 years ago
{ required: true, message: "请输入邮箱地址", trigger: "blur" },
{
pattern: /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
4 years ago
message: "请输入正确的邮箱",
trigger: "blur"
}
],
4 years ago
orderAmount: [
// { pattern: /^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/, message: '请输入正确金额格式,可保留两位小数' }
4 years ago
{ required: true, message: "请输入订单金额", trigger: "blur" }
// { pattern: /(?:^[1-9]([0-9]+)?(?:\.[0-9]{1,2})?$)|(?:^(?:0)$)|(?:^[0-9]\.[0-9](?:[0-9])?$)/, message: '请输入正确金额格式,可保留两位小数', trigger: 'blur'}
4 years ago
]
},
orderTypeList: [{
4 years ago
name: "正式",
value: 1
},
4 years ago
{
name: "试用",
value: 2
}],
provinceList: this.$store.state.provinceList,
cityList: [],
schoolList: [],
4 years ago
yearList: [
{ name: "1个月", value: 30 },
{ name: "2个月", value: 60 },
{ name: "3个月", value: 90 },
{ name: "1年", value: 365 },
{ name: "2年", value: 730 },
{ name: "3年", value: 1095 }
],
// 课程权限弹框
courseVisible: false,
courseTotals: 0,
coursePage: 1,
courseList: [],
courseSelection: [],
4 years ago
curriculumName: "",
curriculumTypeKeys: {
0: "理论",
1: "实训"
}, // 课程类别
4 years ago
ipVisible: false,
4 years ago
IPData: [
{
id: 1,
age: "小额贷系统",
storeName: "1个月",
total: "2019.01.02 11:00",
payamount: "2019.01.02 11:00",
swtich: true,
Intranet: "10.20.202.1",
extranet: "10.20.202.1"
},
{
id: 2,
age: "小额贷系统",
storeName: "1个月",
total: "2019.01.02 11:00",
payamount: "2019.01.02 11:00",
swtich: true,
Intranet: "",
extranet: ""
}
],
curArr: "",
test: [],
// 数据平台权限弹框
4 years ago
showPlatform: false,// 弹框显示
platfromTotals: 0,// 列表条目
platfromPage: 1,// 页码
platformList: [],// 数据平台列表
4 years ago
platformSelect: [],// 数据平台弹框选中
productName: "",// 搜索产品名称
searchTimer: null,
};
},
watch: {
curriculumName(n) {
clearTimeout(this.searchTimer);
this.searchTimer = setTimeout(() => {
this.getCourseJurisdiction();
}, 500);
},
productName(n) {
clearTimeout(this.searchTimer);
this.searchTimer = setTimeout(() => {
this.getDataJurisdiction();
}, 500);
}
},
4 years ago
async created() {
this.token = sessionStorage.getItem("token");
// 处于查看状态
4 years ago
if (this.$route.query.watch) {
this.disabled = true;
await this.getDetail(this.$route.query.watch);
}
// 处于编辑状态
4 years ago
if (this.$route.query.edit) {
this.editDisabled = true;
await this.getDetail(this.$route.query.edit);
}
/* 处于续费状态 */
4 years ago
if (this.$route.query.renew) {
this.renewDisabled = true;
await this.getDetail(this.$route.query.renew);
}
4 years ago
this.getCityData();// 取得城市
},
4 years ago
methods: {
// 读取页面详情
getDetail(id) {
this.$get(this.api.orderDetail, { orderId: +id }).then(res => {
let form = res.orderDetails.order;// 基本信息
let contract = res.orderDetails.contractInformation ? res.orderDetails.contractInformation : {}; // 合同
let list = res.orderDetails.orderOther.map(e => {
// 处于续费
if (this.renewDisabled) {
let end = Date.parse(e.endTime);
let now = +new Date();
if (now < end) {
let time = e.endTime.split(" ")[0];
let arr = time.split("-");
e.startTime = arr[0] + "-" + arr[1] + "-" + (+arr[2] + 1);
4 years ago
} else {
// 过期
e.startTime = "";
}
e.endTime = "";
e.periodOfUse = "";
} else {
e.startTime = e.startTime.split(" ")[0];
e.endTime = e.endTime.split(" ")[0];
}
return e;
});// 俩列表
this.form = {
orderNumber: form.orderNumber,
createTime: form.createTime,
provinceId: form.provinceId,
orderContact: form.orderContact,
email: form.email,
customerId: form.customerId,
customerName: form.customerName,
orderType: form.orderType,
cityId: form.cityId,
phone: form.phone,
orderAmount: form.orderAmount,
4 years ago
orderId: form.orderId
};
this.contract = {
4 years ago
contractName: contract.contractName,
contractMoney: contract.contractMoney,
contractNumber: contract.contractNumber,
startTime: contract.startTime ? contract.startTime : "",
endTime: contract.endTime ? contract.endTime : "",
contractId: contract.contractId,
uploadList: {
name: contract.contractFile ? contract.contractFile.split("/").pop() : "",
url: contract.contractFile
}
};
if (contract.startTime && contract.endTime) {
this.contractTime = [contract.startTime, contract.endTime];
}
this.coursePermissions = list.filter(i => i.authority === 1);
this.dataPlatformPermissions = list.filter(i => i.authority === 0);
4 years ago
});
},
// 新增订单
submitOrder() {
if (!this.coursePermissions.length && !this.dataPlatformPermissions.length) {
return this.$message.error("请选择课程权限或数据权限后再确认订单");
3 years ago
} else {
// 课程权限参数校验
if (this.coursePermissions.length) {
let courseVerify =
this.coursePermissions.some(e => {
if (!e.periodOfUse || !e.finalPrice) {
return false;
} else {
return true;
}
});
if (!courseVerify) {
this.whetherSubmit = true;
setTimeout(() => {
this.whetherSubmit = false;
}, 4000);
return this.$message.error("请把课程参数输入完整");
}
}
3 years ago
// 数据平台权限参数校验
if (this.dataPlatformPermissions.length) {
let dataVerify =
this.dataPlatformPermissions.some(e => {
if (!e.periodOfUse || !e.finalPrice || !e.accountNum || !e.totalAmount) {
return false;
} else {
return true;
}
});
if (!dataVerify) {
this.whetherSubmit = true;
setTimeout(() => {
this.whetherSubmit = false;
}, 4000);
return this.$message.error("请把产品参数输入完整");
}
}
}
4 years ago
this.$refs["form"].validate((valid) => {
if (valid) {
let tempArr = [...this.dataPlatformPermissions, ...this.coursePermissions];
let renew = tempArr.some(e => e.renew);
4 years ago
if (this.renewDisabled || renew) {/* 续费状态下 */
this.form.orderNature = 2;
if (renew) {
tempArr.forEach(e => {
4 years ago
if (e.renew) delete e.renew;
});
}
}
let param = {
4 years ago
contractInformation: this.contract,//合同信息
order: this.form,// 订单基本数据
orderOther: tempArr//俩列表
4 years ago
};
this.loading = true;
if (this.editDisabled) {
this.$post(this.api.orderUpdate, param).then(res => {
this.$message.success("修改成功");
this.loading = false;
this.$router.back();
}).catch(err => {
this.loading = false;
});
} else {
this.$post(this.api.orderAdd, param).then(res => {
this.$message.success("添加订单成功");
this.loading = false;
this.$router.back();
}).catch(err => {
this.loading = false;
});
}
} else {
this.$message("请填上必填项");
return false;
}
4 years ago
});
},
/* 处理0开头的期限 */
4 years ago
zero(e, row) {
if (e[0] == "0") {
row.periodOfUse = e.substring(1);
this.zero(row.periodOfUse, row);
}
},
// 订单客户框触发选择页面
4 years ago
gotoClient() {
this.showSelectClient = !this.showSelectClient;
},
// 选择客户返回传值
4 years ago
backToOrder(val) {
this.showSelectClient = !this.showSelectClient;
if (val.id) {
this.form.customerName = val.name;
this.form.customerId = val.id;
this.form.phone = val.phone;
this.form.email = val.email;
this.form.orderContact = val.name;
this.$get(this.api.queryCustomerDetails, { customerId: val.id }).then(res => {
this.form.provinceId = res.result.customer.provinceId;
this.form.cityId = res.result.customer.cityId;
this.getCityData();
});
this.$forceUpdate();
}
},
// 添加课程权限
addCourseJurisdiction() {
if (!this.form.customerId) return this.$message.warning("请先选择客户");
this.courseVisible = true;
this.getCourseJurisdiction();
},
// 获取课程权限列表
getCourseJurisdiction() {
let param = {
4 years ago
pageSize: 10,
pageNum: this.platfromPage,
curriculumName: this.curriculumName
};
this.dataLoading = true;
this.$post(this.api.curriculumList, param).then(res => {
this.courseList = res.page.records;
this.courseTotals = res.page.total;
4 years ago
this.dataLoading = false;
}).catch(err => {
this.dataLoading = false;
});
},
// 课程--弹框列表选中
handleSelectionChange(val) {
this.courseSelection = val;
4 years ago
},
// 课程弹框--页数变更
handleCurrentChange(val) {
this.coursePage = val;
this.getCourseJurisdiction();
4 years ago
},
closeJCourse() { // 关闭课程选择对话框
this.curriculumName = "";
this.courseVisible = false;
},
async addCourse() {
if (this.courseSelection.length > 0) {
let that = this;
let fn = function(e) {
let obj = {
dataOrCourseId: e.cid,// id
productName: e.curriculumName,// 名称
periodOfUse: "",// 使用期限
startTime: "",// 开始
endTime: "", // 终止
remainingPeriod: "",// 剩余期限
marketValue: e.marketPrice,// 市场价
finalPrice: "",// 成交价
discountRate: "",// 折扣率
accountNum: "",// 账号数
totalAmount: "",// 总价
ship: 0,// 发货否(0未发货,1已发货,默认不发货)
authority: 1 // 区分权限 0为数据平台权限,1为课程权限
};
that.coursePermissions.push(obj);
};
let idArr = [];
this.courseSelection.map(e => {// 取得选中的值,进行赋值
idArr.push(e.cid);
if (this.coursePermissions.length > 0) {
// 比对是否存在该id,若存在,不操作,不存在,则进行push操作
let find = this.coursePermissions.some(i => e.cid === i.dataOrCourseId);// 判断已有的相同的id不进行处理
if (!find) {
fn(e);
}
} else {
fn(e);
}
});
this.courseVisible = false;
this.curriculumName = "";
this.platformSelect = [];
/* 调接口,判断是否为客户已有的课程 */
let params = {
authority: 1,
customerId: this.form.customerId,
productId: idArr
};
await this.$post(this.api.renew, params).then(res => {
this.coursePermissions.map(e => {
res.orderOthers.map(el => {
if (el.dataOrCourseId === e.dataOrCourseId) {
let time = el.endTime.split(" ")[0];
let arr = time.split("-");
e.startTime = arr[0] + "-" + arr[1] + "-" + (+arr[2] + 1);
e.endTime = "";
e.periodOfUse = "";
e.renew = true;
}
});
});
});
4 years ago
} else {
return this.$message.warning("请选择课程");
}
},
// 删除课程权限
delCourseForm(index) {
this.$confirm("确定要删除吗?", "提示", {
type: "warning"
}).then(() => {
if (this.renewDisabled && this.coursePermissions.length === 1) {
return this.$message.warning("续费至少保留一条课程权限");
} else {
this.coursePermissions.splice(index, 1);
}
});
},
// 添加数据平台权限
addDataJurisdiction() {
if (!this.form.customerId) return this.$message.warning("请先选择客户");
this.showPlatform = true;
this.getDataJurisdiction();
},
// 获取数据权限列表
getDataJurisdiction() {
4 years ago
let param = {
pageSize: 10,
pageNum: this.platfromPage,
status: 1,
productName: this.productName
};
this.dataLoading = true;
this.$post(this.api.listByEntity, param).then(res => {
this.platformList = res.pageList.records;
4 years ago
this.platfromTotals = res.pageList.total;
this.dataLoading = false;
}).catch(err => {
this.dataLoading = false;
});
},
// 数据平台--弹框列表选中
dataPlatformSelection(val) {
4 years ago
this.platformSelect = val;
},
// 数据平台弹框--确定
4 years ago
async addPlatform() {
if (this.platformSelect.length > 0) {
let that = this;
let fn = function(e) {
let obj = {
dataOrCourseId: e.id,// id
4 years ago
productName: e.productName,// 名称
periodOfUse: "",// 使用期限
startTime: "",// 开始
endTime: "", // 终止
remainingPeriod: "",// 剩余期限
marketValue: e.market,// 市场价
finalPrice: "",// 成交价
discountRate: "",// 折扣率
accountNum: "",// 账号数
4 years ago
totalAmount: "",// 总价
ship: 0,// 发货否(0未发货,1已发货,默认不发货)
4 years ago
authority: 0// 数据平台权限
};
that.dataPlatformPermissions.push(obj);
4 years ago
};
let idArr = [];
this.platformSelect.map(e => {// 取得选中的值,进行赋值
idArr.push(e.id);
if (this.dataPlatformPermissions.length > 0) {
// 比对是否存在该id,若存在,不操作,不存在,则进行push操作
let find = this.dataPlatformPermissions.some(i => e.id === i.dataOrCourseId);// 判断已有的相同的id不进行处理
4 years ago
if (!find) {
fn(e);
}
4 years ago
} else {
fn(e);
}
4 years ago
});
this.showPlatform = false;
this.productName = "";
4 years ago
this.platformSelect = [];
/* 调接口,判断是否为客户已有的产品功能 */
let params = {
4 years ago
authority: 0,
customerId: this.form.customerId,
productId: idArr
};
await this.$post(this.api.renew, params).then(res => {
this.dataPlatformPermissions.map(e => {
4 years ago
res.orderOthers.map(el => {
if (el.dataOrCourseId === e.dataOrCourseId) {
let time = el.endTime.split(" ")[0];
let arr = time.split("-");
e.startTime = arr[0] + "-" + arr[1] + "-" + (+arr[2] + 1);
4 years ago
e.endTime = "";
e.periodOfUse = "";
e.renew = true;
}
4 years ago
});
});
});
} else {
return this.$message.warning("请选择数据");
}
},
// 数据平台弹框--页数变更
platfromCurrentChange(val) {
this.platfromPage = val;
this.getDataJurisdiction();
},
// 删除数据平台权限
delDataForm(index) {
this.$confirm("确定要删除吗?", "提示", {
type: "warning"
}).then(() => {
if (this.renewDisabled && this.dataPlatformPermissions.length === 1) {
return this.$message.warning("续费至少保留一条产品信息");
} else {
this.dataPlatformPermissions.splice(index, 1);
}
});
},
// 课程/数据平台-启用
handleEnable(e, row) {
},
// 课程/数据平台-发货
handleDeliver(e, row) {
if (this.editDisabled) {
this.$post(this.api.ship + "?id=" + `${row.dataOrCourseId}`).then(res => {
});
}
},
// 计算折扣率
4 years ago
calculateDiscount(val, row) {
if (row.finalPrice)
row.discountRate = (row.finalPrice / row.marketValue * 100).toFixed(2) + "%";
},
// 已知成交和总额,计算账号数目
4 years ago
userAmount(val, row) {
if (val && row.totalAmount) {
row.accountNum = Math.floor(row.totalAmount / val);
}
},
// 合同起止日期选择
4 years ago
contractTimeChange(val) {
if (val.length > 0) {
this.contract.startTime = val[0];
this.contract.endTime = val[1];
}
},
// 新增数据平台权限时,计算总的金额数目
4 years ago
allAmount($event, row) {
// 课程权限总价
let courseArr = [];
this.coursePermissions.map(e => {
courseArr.push(+e.finalPrice);
4 years ago
});
let courseTotalPrice = courseArr.reduce((a, b) => a + b, 0);
// 数据权限总价
let dataArr = [];
this.dataPlatformPermissions.map(e => {
dataArr.push(+e.totalAmount);
});
let dataTotalPrice = dataArr.reduce((a, b) => a + b, 0);
this.form.orderAmount = courseTotalPrice * 10000 + dataTotalPrice;
},
4 years ago
// 总金额触发--计算账号或市场价
4 years ago
allAmountChange(val, row) {
if (row.totalAmount) {
let all = row.totalAmount;
if (row.accountNum) {// 若有账号
row.finalPrice = Math.round(all / row.accountNum).toFixed(2);
}
4 years ago
if (row.finalPrice) {// 若有市场价
row.accountNum = Math.floor(all / row.finalPrice);
}
}
},
4 years ago
// 计算成交总额
4 years ago
dealComputers(e, row) {
if (row.finalPrice && row.accountNum) {
row.totalAmount = Math.round((row.finalPrice) * (row.accountNum)).toFixed(2);
4 years ago
}
4 years ago
this.allAmount();
4 years ago
},
// 计算成交价
4 years ago
dealBargain(e, row) {
if (row.accountNum && row.totalAmount) {
row.finalPrice = Math.round(row.totalAmount / row.accountNum).toFixed(2);
4 years ago
}
},
// 使用期限转换以及计算剩余天数
4 years ago
deadLine(e, row) {
function completeDate(value) {
4 years ago
if (value == 0) return "12";
return value < 10 ? "0" + value : value;
}
4 years ago
let char = "-";
4 years ago
let nowDate = new Date();
let day = nowDate.getDate();
let month = nowDate.getMonth() + 1;
let year = nowDate.getFullYear();
4 years ago
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;
}
let endYear = renewY + char + completeDate((+renewM + (+e)) % 12) + char + renewD;
4 years ago
row.endTime = endYear;
// 计算剩余天数
let date1 = Date.parse(endYear);
let date2 = Date.parse(row.startTime);
4 years ago
let ms = Math.abs(date1 - date2);
row.remainingPeriod = Math.floor(ms / (24 * 3600 * 1000));
} else {
if (e === "" || (e.substr(0, 1) === "0")) {
4 years ago
row.startTime = "";
row.endTime = "";
return;
}
//补全0,并拼接当前的时间点
4 years ago
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);
// 得出起始年月日
4 years ago
row.startTime = nowYear;
row.endTime = endYear;
// 计算剩余天数
let date1 = Date.parse(endYear);
let date2 = Date.parse(nowYear);
4 years ago
let ms = Math.abs(date1 - date2);
let days = Math.floor(ms / (24 * 3600 * 1000));
4 years ago
row.remainingPeriod = days;
}
},
// 清除省份
4 years ago
clearprovince() {
this.form.cityId = "",
this.form.customerId = "",
this.form.orderContact = "";
this.form.phone = "";
this.form.email = "";
},
// 获取城市
4 years ago
getCity() {
this.clearprovince();
this.getCityData();
},
4 years ago
getCityData() {
let data = {
provinceId: this.form.provinceId
4 years ago
};
return this.$get(this.api.queryCity, data).then(res => {
this.cityList = res.list;
}).catch(res => {
});
},
// 清除城市
4 years ago
clearcity() {
this.form.customerId = "";
this.form.orderContact = "";
4 years ago
this.form.phone = "";
this.form.email = "";
},
// 获取学校/客户名称
4 years ago
getSchool() {
this.clearcity();
this.getSchoolData();
},
4 years ago
getSchoolData() {
let data = {
provinceId: this.form.provinceId,
cityId: this.form.cityId
4 years ago
};
this.$get(this.api.queryOrderCustomer, data).then(res => {
this.schoolList = res.message;
}).catch(res => {
});
},
4 years ago
clearcustomer() {
this.form.orderContact = "";
this.form.phone = "";
this.form.email = "";
},
// 获取学校/客户信息
4 years ago
getcustomer() {
let data = {
customerId: this.form.customerId
4 years ago
};
this.$get(this.api.queryOrderCustomerContact, data).then(res => {
this.form.orderContact = res.message[0].adminName;
this.form.phone = res.message[0].adminPhone;
this.form.email = res.message[0].email;
}).catch(res => {
});
},
discountChange(row) {
let reg = /^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/;
if (!(reg.test(row.transactionPrice))) {
this.$message.error("请输入正确金额格式,可保留两位小数");
row.transactionPrice = "";
} else {
row.discount = this.Percentage(row.transactionPrice, row.marketPrice);
}
},
getSummaries(param) { // 自定义的合计计算方法
const { columns, data } = param;
var sums = 0;
data.map(e => {
4 years ago
sums += Number(e.transactionPrice);
});
this.form.orderAmount = sums;
return sums;
},
4 years ago
// 上传文件超出
handleExceed(files, fileList) {
this.$message.warning(
`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择`
);
},
// 上传前
beforeAvatarUpload(file) {
const size = file.size / 1024 / 1024 < 10;
4 years ago
let type = file.name.split(".").pop();
let str = ["jpg", "jpeg", "gif", "png", "doc", "docx", "pdf"].includes(type.toLowerCase());
4 years ago
if (!str) {
this.$message.error("只能上传图片,word文件和pdf文件");
4 years ago
} else if (!size) {
this.$message.error("上传头像图片大小不能超过 10MB!");
}
4 years ago
return str && size;
},
// 上传成功
uploadSuccess(res, file, fileList) {
this.contract.contractFile = res.data.filesResult.fileUrl;
},
// 上传报错
uploadError(err, file, fileList) {
this.$message({
message: "上传出错,请重试",
type: "error",
center: true
});
},
// 删除上传文件前的确认
beforeRemove(file, fileList) {
4 years ago
let type = file.name.split(".").pop();
let str = ["jpg", "jpeg", "gif", "png", "doc", "pdf"].includes(type.toLowerCase());
const size = file.size / 1024 / 1024 < 10;
4 years ago
if (!size || !str) {
return true;
} else {
return this.$confirm(`确定移除 ${file.name}`);
}
},
// 删除文件钩子
handleRemove(file, fileList) {
4 years ago
this.contract.contractFile = "";
},
4 years ago
configure() {
this.ipVisible = true;
},
4 years ago
IPSure() {
this.ipVisible = false;
},
goBack() {
4 years ago
this.$router.go(-1);
},
dataSelectable(row, index) { // 禁止勾选已经选过的数据平台
4 years ago
let boolean = true;
this.dataPlatformPermissions.length && this.dataPlatformPermissions.some(e => {
4 years ago
if (e.dataOrCourseId === row.id) {
boolean = false;
}
4 years ago
});
return boolean;
},
courseSelectable(row, index) { // 禁止勾选已经选过的课程
let boolean = true;
this.coursePermissions.length && this.coursePermissions.some(e => {
if (e.dataOrCourseId === row.cid) {
boolean = false;
}
});
return boolean;
}
}
};
</script>
<style lang="scss" scoped>
4 years ago
/deep/ .course-input .el-input__inner {
width: 100px;
4 years ago
}
/deep/ .course-input .red .el-input__inner {
border: 1px solid red;
}
4 years ago
/deep/ .small .red .el-input__inner {
border: 1px solid red;
}
4 years ago
/deep/ .small .el-input__inner {
4 years ago
width: 100%;
margin-right: 5px;
4 years ago
}
/deep/ .discountRate .el-input__inner {
width: 85px;
4 years ago
}
/deep/ .contractDate .el-date-editor--daterange.el-input__inner {
width: 100%;
}
4 years ago
.mag {
margin-right: 20px;
}
4 years ago
.uploadTitle {
width: 100%;
height: 40px;
font-size: 16px;
}
4 years ago
.application_input {
width: 250px;
}
4 years ago
.contract .el-upload {
width: 100% !important;
}
4 years ago
.downcol .el-form-item__content {
margin-left: 0 !important;
}
4 years ago
.down {
// margin-top: 60px;
height: 40px;
}
4 years ago
/* 选择IP */
4 years ago
.tab_temp label {
width: 60px;
}
4 years ago
.mar10 {
margin-top: 10px;
}
4 years ago
.radio_icon {
font-size: 26px;
color: #9278FF;
}
4 years ago
.ellipsis {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
</style>