|
|
|
@ -438,6 +438,155 @@ |
|
|
|
|
</el-table> |
|
|
|
|
</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 && !renewDisabled && dataPlatformPermissions.length"> |
|
|
|
|
<el-button v-if="dataPlatformPermissions.find(e => !e.ship)" v-auth="'/order:发货'" type="primary" round @click="batchDeliver(1, 2)">一键发货</el-button> |
|
|
|
|
<el-button v-else v-auth="'/order:发货'" type="primary" round @click="batchDeliver(0, 2)">取消全部发货</el-button> |
|
|
|
|
</template> |
|
|
|
|
<el-button v-if="!viewDisabled&&!editDisabled&&!renewDisabled" type="primary" round class="mag" @click="addValueJurisdiction()">添加</el-button> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<!--:summary-method="getSummaries"--> |
|
|
|
|
<el-table :data="valuePermissions" class="orderTable orderTables" 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" min-width="100"> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="使用期限" align="center" min-width="190"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<div class="small"> |
|
|
|
|
<el-input |
|
|
|
|
class="time-input" |
|
|
|
|
:class="!scope.row.periodOfUse&&whetherSubmit?'red':''" |
|
|
|
|
:disabled="viewDisabled||editDisabled" maxlength="4" |
|
|
|
|
@change="deadLine(scope.row.periodOfUse,scope.row,scope.row.options)" |
|
|
|
|
@input="scope.row.periodOfUse = scope.row.periodOfUse.replace(/[^0-9.]/g,'')" |
|
|
|
|
v-model="scope.row.periodOfUse" placeholder="输入时间"></el-input> |
|
|
|
|
<span style="margin-left:5px"> |
|
|
|
|
<el-select class="time-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="240"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<p v-if="!scope.row.startTime"> |
|
|
|
|
<el-date-picker |
|
|
|
|
:class="orderRepeat.includes(scope.row.dataOrCourseId) ? 'red' : ''" |
|
|
|
|
style="width:130px" |
|
|
|
|
v-model="scope.row.startTime" |
|
|
|
|
type="date" :disabled="viewDisabled||editDisabled" |
|
|
|
|
placeholder="请选择使用日期"> |
|
|
|
|
</el-date-picker> |
|
|
|
|
</p> |
|
|
|
|
<p v-else> |
|
|
|
|
<el-date-picker |
|
|
|
|
:class="orderRepeat.includes(scope.row.dataOrCourseId) ? 'red' : ''" |
|
|
|
|
style="width:130px" |
|
|
|
|
v-model="scope.row.startTime" |
|
|
|
|
type="date" :disabled="viewDisabled||editDisabled" |
|
|
|
|
@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="120"> |
|
|
|
|
<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')" |
|
|
|
|
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" width="180"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<div class="flex-c-c"> |
|
|
|
|
<el-button |
|
|
|
|
v-if="!editDisabled&&!viewDisabled" |
|
|
|
|
type="text" |
|
|
|
|
@click="delDataForm(scope.$index)" |
|
|
|
|
style="margin-right:10px;" |
|
|
|
|
>删除</el-button> |
|
|
|
|
<el-switch |
|
|
|
|
v-if="scope.row.status === 1 || 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 ? '已发货' : '未发货'" |
|
|
|
|
@change="handleDeliver($event,scope.row)"> |
|
|
|
|
</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)"> |
|
|
|
|
</el-switch> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
</el-table> |
|
|
|
|
</div> |
|
|
|
|
</el-card> |
|
|
|
|
<!-- 合同 --> |
|
|
|
|
<el-card shadow="hover" class="mgb20"> |
|
|
|
|
<div> |
|
|
|
@ -592,6 +741,16 @@ |
|
|
|
|
</span> |
|
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
|
|
<el-dialog :visible.sync="valueVisible" width="50%" center> |
|
|
|
|
<el-checkbox-group v-model="valueCheck"> |
|
|
|
|
<el-checkbox v-for="(item, i) in valueList" :key="i" :label="item.id">{{ item.moduleName }}</el-checkbox> |
|
|
|
|
</el-checkbox-group> |
|
|
|
|
<span slot="footer" class="dialog-footer"> |
|
|
|
|
<el-button @click="valueVisible = false">取 消</el-button> |
|
|
|
|
<el-button type="primary" v-preventReClick @click="addValue">确 定</el-button> |
|
|
|
|
</span> |
|
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
|
|
<!-- 选择IP --> |
|
|
|
|
<el-dialog :visible.sync="ipVisible" width="70%" center> |
|
|
|
|
<div class="flex-center mgb20"> |
|
|
|
@ -685,6 +844,7 @@ export default { |
|
|
|
|
}, |
|
|
|
|
coursePermissions: [],// 课程权限 |
|
|
|
|
dataPlatformPermissions: [],// 数据平台权限 |
|
|
|
|
valuePermissions: [], |
|
|
|
|
contract: { // 合同信息 |
|
|
|
|
contractName: "", // 合同名称 |
|
|
|
|
contractFile: "", // 合同文件 |
|
|
|
@ -798,12 +958,15 @@ export default { |
|
|
|
|
platfromPage: 1,// 页码 |
|
|
|
|
platformList: [],// 数据平台列表 |
|
|
|
|
platformSelect: [],// 数据平台弹框选中 |
|
|
|
|
valueVisible: false, |
|
|
|
|
valueCheck: [], |
|
|
|
|
productName: "",// 搜索产品名称 |
|
|
|
|
searchTimer: null, |
|
|
|
|
titlesw:'', |
|
|
|
|
orderRepeat: [], |
|
|
|
|
repeatMsg: '', |
|
|
|
|
clients: [] |
|
|
|
|
clients: [], |
|
|
|
|
valueList: [] |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
watch: { |
|
|
|
@ -914,12 +1077,12 @@ export default { |
|
|
|
|
const { customerId } = form |
|
|
|
|
const list = [] |
|
|
|
|
// 课程和数据的分别调接口查询 |
|
|
|
|
if (orderOther.find(e => e.authority)) { |
|
|
|
|
if (orderOther.find(e => e.authority === 1)) { |
|
|
|
|
promises.push(new Promise((resolve, reject) => { |
|
|
|
|
this.$post(this.api.renew, { |
|
|
|
|
authority: 1, |
|
|
|
|
customerId, |
|
|
|
|
productId: orderOther.filter(e => e.authority).map(e => e.dataOrCourseId) |
|
|
|
|
productId: orderOther.filter(e => e.authority === 1).map(e => e.dataOrCourseId) |
|
|
|
|
}).then(({ orderOthers }) => { |
|
|
|
|
list.push(...orderOthers) |
|
|
|
|
resolve() |
|
|
|
@ -938,6 +1101,18 @@ export default { |
|
|
|
|
}).catch(err => {}) |
|
|
|
|
})) |
|
|
|
|
} |
|
|
|
|
if (orderOther.find(e => e.authority === 2)) { |
|
|
|
|
promises.push(new Promise((resolve, reject) => { |
|
|
|
|
this.$post(this.api.renew, { |
|
|
|
|
authority: 2, |
|
|
|
|
customerId, |
|
|
|
|
productId: orderOther.filter(e => e.authority === 2).map(e => e.dataOrCourseId) |
|
|
|
|
}).then(({ orderOthers }) => { |
|
|
|
|
list.push(...orderOthers) |
|
|
|
|
resolve() |
|
|
|
|
}).catch(err => {}) |
|
|
|
|
})) |
|
|
|
|
} |
|
|
|
|
Promise.all(promises).then(_ => { |
|
|
|
|
this.setStartDate(list, orderOther) |
|
|
|
|
}) |
|
|
|
@ -987,6 +1162,7 @@ export default { |
|
|
|
|
this.coursePermissions = list.filter(i => i.authority === 1); |
|
|
|
|
console.log("🚀 ~ file: AddOrder.vue ~ line 979 ~ setStartDate ~ this.coursePermissions ", this.coursePermissions ) |
|
|
|
|
this.dataPlatformPermissions = list.filter(i => i.authority === 0); |
|
|
|
|
this.valuePermissions = list.filter(i => i.authority === 2); |
|
|
|
|
}, |
|
|
|
|
// 获取全部客户 |
|
|
|
|
getClients() { |
|
|
|
@ -1013,8 +1189,8 @@ export default { |
|
|
|
|
submitOrder() { |
|
|
|
|
let purchase = 0 // 总采购成本 |
|
|
|
|
let profit = 0 // 总利润 |
|
|
|
|
if (!this.coursePermissions.length && !this.dataPlatformPermissions.length) { |
|
|
|
|
return this.$message.error("请选择课程权限或数据权限后再确认订单"); |
|
|
|
|
if (!this.coursePermissions.length && !this.dataPlatformPermissions.length && !this.valuePermissions.length) { |
|
|
|
|
return this.$message.error("请选择课程权限或数据权限或职站增值模块权限后再确认订单"); |
|
|
|
|
} else { |
|
|
|
|
// 课程权限参数校验 |
|
|
|
|
if (this.coursePermissions.length) { |
|
|
|
@ -1058,11 +1234,31 @@ export default { |
|
|
|
|
return this.$message.error("请把产品参数输入完整"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (this.valuePermissions.length) { |
|
|
|
|
let courseVerify = |
|
|
|
|
this.valuePermissions.some(e => { |
|
|
|
|
if (!e.periodOfUse || e.finalPrice === '') { |
|
|
|
|
return false; |
|
|
|
|
} else { |
|
|
|
|
const curPurchase = +e.settlementPrice + (e.settlementPrice / 10) |
|
|
|
|
purchase += curPurchase |
|
|
|
|
profit += +e.finalPrice - curPurchase |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
if (!courseVerify) { |
|
|
|
|
this.whetherSubmit = true; |
|
|
|
|
setTimeout(() => { |
|
|
|
|
this.whetherSubmit = false; |
|
|
|
|
}, 4000); |
|
|
|
|
return this.$message.error("请把课程参数输入完整"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
this.$refs["form"].validate((valid) => { |
|
|
|
|
if (valid) { |
|
|
|
|
if (this.orderRepeat.length) return this.$message.error(this.repeatMsg) |
|
|
|
|
let tempArr = [...this.dataPlatformPermissions, ...this.coursePermissions]; |
|
|
|
|
let tempArr = [...this.dataPlatformPermissions, ...this.coursePermissions, ...this.valuePermissions]; |
|
|
|
|
let renew = tempArr.some(e => e.renew); |
|
|
|
|
if (this.renewDisabled || renew) {/* 续费状态下 */ |
|
|
|
|
this.form.orderNature = 2; |
|
|
|
@ -1272,6 +1468,50 @@ export default { |
|
|
|
|
this.showPlatform = true; |
|
|
|
|
this.getDataJurisdiction(); |
|
|
|
|
}, |
|
|
|
|
addValueJurisdiction() { |
|
|
|
|
if (!this.form.customerId) return this.$message.warning("请先选择客户"); |
|
|
|
|
this.valueVisible = true; |
|
|
|
|
this.getValueJurisdiction(); |
|
|
|
|
}, |
|
|
|
|
getValueJurisdiction() { |
|
|
|
|
this.$post(this.api.getValueModule + '?platformId=1').then(res => { |
|
|
|
|
this.valueList = res.valueList |
|
|
|
|
}).catch(err => { |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
addValue() { |
|
|
|
|
const val = this.valueCheck |
|
|
|
|
if (!val.length) return this.$message.warning("请选择模块"); |
|
|
|
|
const data = [] |
|
|
|
|
const { orderType } = this.form |
|
|
|
|
val.map(e => { |
|
|
|
|
data.push({ |
|
|
|
|
dataOrCourseId: e,// id |
|
|
|
|
productName: this.valueList.find(n => n.id === e).moduleName,// 名称 |
|
|
|
|
periodOfUse: "",// 使用期限 |
|
|
|
|
startTime: new Date(),// 开始 |
|
|
|
|
endTime: "", // 终止 |
|
|
|
|
remainingPeriod: "",// 剩余期限 |
|
|
|
|
marketValue: '', // 市场单价(订单里需要保存的) |
|
|
|
|
marketPrice: e.market, // 原始市场单价(产品里添加的) |
|
|
|
|
finalPrice: orderType === 2 ? 0 : '',// 成交价 |
|
|
|
|
finalValue: orderType === 2 ? 0 : '', // 成交单价 |
|
|
|
|
discountRate: "",// 折扣率 |
|
|
|
|
accountNum: "",// 账号数 |
|
|
|
|
totalAmount: orderType === 2 ? 0 : '',// 总价 |
|
|
|
|
isEnable: 1, // 启用否:1启用,0禁用 |
|
|
|
|
ship: 0,// 发货否(0未发货,1已发货,默认不发货) |
|
|
|
|
authority: 2, |
|
|
|
|
options:1, |
|
|
|
|
settlementPrice: orderType === 2 ? 0 : '', // 结算价 |
|
|
|
|
settlementMethod: e.settlementMethod, // 结算方式,0为单价,1为分成 |
|
|
|
|
settlementPriceUnit: e.settlementPrice, // 结算单价 |
|
|
|
|
businessProportion: e.businessProportion, // 商务占比 |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
this.valuePermissions = data |
|
|
|
|
this.valueVisible = false |
|
|
|
|
}, |
|
|
|
|
// 获取数据权限列表 |
|
|
|
|
getDataJurisdiction() { |
|
|
|
|
let param = { |
|
|
|
@ -1522,7 +1762,7 @@ export default { |
|
|
|
|
const useUnit = row.periodOfUse // 使用期限 |
|
|
|
|
let price = row.marketPrice // 市场单价 |
|
|
|
|
// 结算单价是元/年,所以如果选择的不是年,要进行换算(日:/365,月:/12) |
|
|
|
|
row.marketValue = ((!unit ? |
|
|
|
|
if (useUnit && price) row.marketValue = ((!unit ? |
|
|
|
|
price / 365 * useUnit : |
|
|
|
|
unit === 1 ? |
|
|
|
|
price / 12 * useUnit : |
|
|
|
|