客户联调

dev_2022-05-11
yujialong 3 years ago
parent e6b84e58f5
commit 5e64a06a64
  1. 3
      src/utils/api.js
  2. 17
      src/utils/util.js
  3. 125
      src/views/customer/AddCustomer.vue

@ -39,7 +39,8 @@ export default {
updateCustomerByRoleId: `nakadai/nakadai/customer/updateCustomerByRoleId`,
checkEmailOrPhone: `nakadai/nakadai/customer/checkEmailOrPhone`, // 新增客户前:校验手机号或者邮箱
getProductsSubscribedByCustomers: `nakadai/nakadai/customer/getProductsSubscribedByCustomers`,
orderBulkDisableEnable: `/nakadai/nakadai/orderOther/orderBulkDisableEnable`,
orderBulkDisableEnable: `nakadai/nakadai/orderOther/orderBulkDisableEnable`,
exportSubscribedRecords: `nakadai/nakadai/order/exportSubscribedRecords`,
resetPwdCustomer: `nakadai/nakadai/customer/resetPwd`,
queryCustomerIsExists: `nakadai/nakadai/customer/queryCustomerIsExists`,

@ -24,7 +24,22 @@ const util = {
});
}
return result;
}
},
// 传入文件名和数据,下载文件
downloadFileDirect(fileName,data) {
if ('download' in document.createElement('a')) { // 非IE下载
const elink = document.createElement('a')
elink.download = fileName
elink.style.display = 'none'
elink.href = URL.createObjectURL(data)
document.body.appendChild(elink)
elink.click()
URL.revokeObjectURL(elink.href) // 释放URL 对象
document.body.removeChild(elink)
} else { // IE10+下载
navigator.msSaveBlob(data, fileName)
}
},
};
export default util;

@ -83,13 +83,13 @@
<ul class="filter">
<li>
<label>产品类型</label>
<el-select v-model="form2.productType" clearable placeholder="请选择产品类型">
<el-select v-model="form2.productType" placeholder="请选择产品类型" @change="filterForm2">
<el-option v-for="(item,index) in productTypeList" :key="index" :label="item.name" :value="item.id"></el-option>
</el-select>
</li>
<li>
<label>订阅状态</label>
<el-select v-model="form2.status" clearable placeholder="请选择订阅状态" @change="filterForm2">
<el-select v-model="form2.status" placeholder="请选择订阅状态" @change="filterForm2">
<el-option v-for="(item,index) in subStatusList" :key="index" :label="item.name" :value="item.name"></el-option>
</el-select>
</li>
@ -98,7 +98,7 @@
</li>
</ul>
<div>
<el-button type="primary">导出列表</el-button>
<el-button type="primary" @click="exportList">导出列表</el-button>
</div>
</div>
<el-table :data="products" class="orderTable" stripe header-align="center" @selection-change="handleSelectionChange" row-key="customerId">
@ -106,17 +106,16 @@
<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="courseName" label="产品类型" align="center">
<template slot-scope="scope">
{{scope.row.authority ? '课程' : '数据'}}
</template>
</el-table-column>
<el-table-column prop="productTypeName" label="产品类型" align="center"></el-table-column>
<el-table-column label="起止日期" align="center">
<template slot-scope="scope">
{{scope.row.status === '已过期' ? '' : scope.row.startTime + ' ~ ' + scope.row.endTime}}
<!-- <el-tooltip class="item" effect="dark" content="Top&nbsp;nbspCenter 提示文字" placement="top">
{{ scope.row.status === '已过期' ? '' : scope.row.startAndEndTime }}
<el-tooltip v-if="scope.row.other" class="item" effect="dark" placement="top">
<div slot="content">
还有<span v-html="scope.row.other"></span><br>的订单还未生效
</div>
<i class="el-icon-warning warning"></i>
</el-tooltip> -->
</el-tooltip>
</template>
</el-table-column>
<el-table-column label="剩余期限" align="center">
@ -127,7 +126,7 @@
<el-table-column prop="status" label="订阅状态" align="center"></el-table-column>
<el-table-column label="产品状态" align="center">
<template slot-scope="scope">
<el-switch v-model="scope.row.isEnable" :active-value="0" :inactive-value="1" :active-text="scope.row.isEnable ? '禁用' : '启用'" :disabled="scope.row.status !== '生效中'" @change="switchOff($event,scope.row,scope.$index)"></el-switch>
<el-switch v-model="scope.row.isEnable" :active-value="1" :inactive-value="0" :active-text="scope.row.isEnable ? '启用' : '禁用'" :disabled="scope.row.status === '已过期'" @change="switchOff($event,scope.row,scope.$index)"></el-switch>
</template>
</el-table-column>
</el-table>
@ -138,13 +137,13 @@
<ul class="filter">
<li>
<label>订单类型</label>
<el-select v-model="form.provinces" clearable placeholder="请选择订单类型">
<el-option v-for="(item,index) in customerTypeList" :key="index" :label="item.name" :value="item.id"></el-option>
<el-select v-model="form3.orderType" clearable placeholder="请选择订单类型">
<el-option v-for="(item,index) in orderTypeList" :key="index" :label="item.name" :value="item.id"></el-option>
</el-select>
</li>
<li>
<label>订单状态</label>
<el-select v-model="form.provinces" clearable placeholder="请选择订单状态">
<el-select v-model="form3.orderStatus" clearable placeholder="请选择订单状态">
<el-option v-for="(item,index) in orderStatusList" :key="index" :label="item.name" :value="item.id"></el-option>
</el-select>
</li>
@ -153,7 +152,7 @@
</li>
</ul>
<div>
<el-input style="width: 250px;" placeholder="请输入订单编号、内容" prefix-icon="el-icon-search" clearable></el-input>
<el-input style="width: 250px;" placeholder="请输入订单编号、内容" prefix-icon="el-icon-search" clearable v-model="form3.keyword"></el-input>
</div>
</div>
<el-table :data="orders" class="orderTable" stripe header-align="center" @selection-change="handleSelectionChange" row-key="customerId">
@ -253,10 +252,13 @@
<script>
import pdf from '../../components/pdf.vue'
import util from '@/utils/util'
import axios from 'axios'
export default {
components:{pdf},
data() {
return {
token: sessionStorage.getItem('token'),
customerId : this.$route.query.id,
isDetail : Boolean(this.$route.query.show),
curTab: 'tab1',
@ -369,7 +371,7 @@ export default {
name: '实训课程产品'
},
{
id: 2,
id: 0,
name: '理论课程产品'
},
{
@ -396,11 +398,21 @@ export default {
name: '待生效'
}
],
pageOrder: 1,
pageSizeOrder: 10,
orders: [],
form3: {
orderType: '',
orderStatus: '',
keyword: ''
},
//
orderTypeList: [{
name: '正式',
value: 1
},
{
name: '试用',
value: 2
}],
//
orderStatusList: [
{
@ -416,6 +428,10 @@ export default {
name: '待发货'
}
],
pageOrder: 1,
pageSizeOrder: 10,
orders: [],
countryList: [{
name:'中国'
}],
@ -467,7 +483,7 @@ export default {
name: customer.name,
position: customer.position,
}
this.getOrder()
// this.getOrder()
this.contractInformations = res.result.contractInformations.filter(e => e.contractNumber || e.contractName); //
this.coursePermissionss = res.result.coursePermissionss
this.dataPermissionss = res.result.dataPermissionss
@ -483,8 +499,9 @@ export default {
//
getProduct() {
this.$get(this.api.getProductsSubscribedByCustomers, {
customeId: this.customerId
customeId: 19
}).then(({ data }) => {
const { productTypeList } = this
data.map(e => {
const list = e.startAndEndTimeList
let connect = true //
@ -508,6 +525,7 @@ export default {
e.startTime = list[0].startTime
e.endTime = list[list.length - 1].endTime
e.status = '生效中'
e.orderEnable = list[0].isEnable
} else {
for (const i in list) {
const n = list[i]
@ -517,16 +535,13 @@ export default {
e.endTime = n.endTime
e.status = '生效中'
e.orderEnable = n.isEnable
//
if (list[i + 1]) {
e.other = '还有‘’2022-7.01-8.01的订单还未生效'
}
break
} else if (i && now > new Date(list[i - 1].endTime).getTime() && now < new Date(n.startTime).getTime()) {
//
e.startTime = n.startTime
e.endTime = n.endTime
e.status = '未生效'
e.orderEnable = n.isEnable
break
}
}
@ -535,13 +550,19 @@ export default {
e.remain = this.getRemain(e.startTime, e.endTime) //
e.startTime = e.startTime.replace(' 00:00:00', '')
e.endTime = e.endTime.replace(' 00:00:00', '')
e.isEnable = connect ?
1 :
(e.status === '已过期' || !e.orderEnable) ?
0 :
e.status === '生效中' ?
1 :
0
e.startAndEndTime = e.startTime + ' ~ ' + e.endTime
//
if (e.notActiveList.length) {
e.other = ''
e.notActiveList.map(j => {
e.other += `<br>${j.startTime.replace(' 00:00:00', '')} ~ ${j.endTime.replace(' 00:00:00', '')}`
})
}
e.productTypeName = productTypeList.find(n => n.id === e.productType).name
// 1 0
e.isEnable = (e.status === '已过期' || !e.orderEnable) ?
0 :
1
})
this.products = data
this.productAll = data
@ -555,7 +576,31 @@ export default {
filterForm2() {
const list = this.productAll
const { productType, status, keyword } = this.form2
this.products = list.filter(e => e.status === status && e.productName.includes(keyword))
this.products = list.filter(e => (productType === '' || productType === e.productType) && (e.status === status || status === '全部') && e.productName.includes(keyword))
},
//
exportList() {
let list = this.productAll
if(this.multipleSelection.length) list = this.multipleSelection
const data = []
list.map(e => {
data.push({
productName: e.productName,
productStatus: e.status,
productType: e.productName,
remainingPeriod: e.remain,
startAndEndTime: e.startAndEndTime,
subscriptionStatus: e.isEnable ? '启用' : '禁用',
})
})
axios.post(this.api.exportSubscribedRecords, data, {
headers: {
token: this.token
},
responseType: 'blob'
}).then((res) => {
util.downloadFileDirect(`已订阅产品.xls`, new Blob([res.data]))
}).catch(res => {})
},
//
@ -655,11 +700,9 @@ export default {
}).catch(res => {});
},
switchOff(val, row) {
this.$post(`${this.api.orderBulkDisableEnable}?isOpen=${val}`, {
ids: row.id
}).then(res => {
this.$message.success(val ? '禁用成功' : '启用成功')
}).catch(res => {})
this.$post(`${this.api.orderBulkDisableEnable}?isOpen=${val}`, row.startAndEndTimeList.map(e => e.id)).then(res => {
this.$message.success(val ? '启用成功' : '禁用成功')
}).catch(res => {})
},
phoneChange() { //
let regex = /^1[3456789]\d{9}$/;

Loading…
Cancel
Save