订单修复,资源库联调

dev_202412
yujialong 2 months ago
parent 69fc4e49b2
commit 3bf85a18bb
  1. 2
      src/utils/api.js
  2. 87
      src/views/order/AddOrder.vue
  3. 160
      src/views/resourse/index.vue
  4. 27
      src/views/resourse/upload.vue

@ -532,7 +532,7 @@ export default {
updateMarketing: `nakadai/nakadai/mall/marketing/promotion/update`,
bannerEnableOrDisable: `nakadai/nakadai/mall/marketing/promotion/bannerEnableOrDisable`,
paginatedFootagesList: `nakadai/resourceLibrary/paginatedFootagesList`,
resourceLibrary: `nakadai/resourceLibrary/resourceLibrary`,
resourceDel: `nakadai/resourceLibrary/batchDeletion`,
resourceFind: `nakadai/resourceLibrary/findById`,
resourceSave: `nakadai/resourceLibrary/saveOrUpdate`,

@ -526,7 +526,7 @@
<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>
@click="delTheoryTrialForm(scope.$index, scope.row)" style="margin-right:10px;">删除</el-button>
<!-- 1: 未生效2生效中3已过期 -->
<!--
1查看时不可操作
@ -2033,7 +2033,6 @@ export default {
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, ...this.theoryTrialList];
console.log('tempArr=>', tempArr)
let renew = tempArr.some(e => e.renew);
if (this.renewDisabled || renew) {/* 续费状态下 */
this.form.orderNature = 2;
@ -2056,7 +2055,6 @@ export default {
orderOther: tempArr//
};
this.loading = true;
console.log(param)
if (this.editDisabled) {
this.$post(this.api.orderUpdate, param).then(res => {
this.refreshCache()
@ -2168,6 +2166,19 @@ export default {
// }
});
},
//
delTheoryTrialForm (index, row) {
this.$confirm("确定要删除吗?", "提示", {
type: "warning"
}).then(() => {
// if (this.renewDisabled && this.theoryCourseList.length === 1) {
// return this.$message.warning("");
// } else {
this.handleOrderRepeat(row.mallId)
this.theoryTrialList.splice(index, 1);
// }
});
},
//
delDataForm (index, row) {
@ -2293,49 +2304,53 @@ export default {
mallNonAssociatedLinks: e.mallNonAssociatedLinks //
}
that[name].push(row)
};
}
const productId = []
this.practicalCoursesSelect.map(e => {//
const promises = []
this.practicalCoursesSelect.map(async (e) => {//
productId.push(e.mallId)
let find = this[name].some(i => e.mallId === i.mallId);// id
if (!find) {
//
this.$post(`${this.api.queryCitySettlementPrice}?mallId=${e.mallId}&provinceId=${this.form.provinceId}&cityId=${this.form.cityId}`).then(res => {
promises.push(new Promise(async (resolve, reject) => {
//
const res = await this.$post(`${this.api.queryCitySettlementPrice}?mallId=${e.mallId}&provinceId=${this.form.provinceId}&cityId=${this.form.cityId}`)
const mall = res.mallPrice
if (mall) {
e.settlementPrice = mall.discountRate
}
if (mall) e.settlementPrice = mall.discountRate
createProduct(e)
}).catch((res) => { })
resolve()
}))
}
});
})
this.practicalCourseVisible = false
this.practicalCourseName = ''
this.practicalCoursesSelect = []
/* 调接口,判断是否为客户已有的产品功能 */
if (productId.length) {
const res = await this.$post(this.api.renew, {
authority,
customerId: this.form.customerId,
productId,
})
this[name].map(e => {
const cur = res.orderOthers.find(n => n.mallId === e.mallId && n.dataOrCourseId == e.dataOrCourseId && n.authority == authority)
if (cur) {
let time = new Date(cur.endTime)
time = new Date(time.setDate(time.getDate() + 1))
e.startTime = `${time.getFullYear()}-${time.getMonth() + 1}-${time.getDate()}`
e.endTime = ''
// e.periodOfUse = orderType === 2 ? 0 : ''
e.renew = true
}
if (orderType === 2) {
this.deadLine(e.periodOfUse, e, e.options, 1)
this.calculateDiscountCourse(e)
}
})
}
Promise.all(promises).then(async () => {
/* 调接口,判断是否为客户已有的产品功能 */
if (productId.length) {
const res = await this.$post(this.api.renew, {
authority,
customerId: this.form.customerId,
productId,
})
this[name].map(e => {
const cur = res.orderOthers.find(n => n.mallId === e.mallId && n.dataOrCourseId == e.dataOrCourseId && n.authority == authority)
if (cur) {
let time = new Date(cur.endTime)
time = new Date(time.setDate(time.getDate() + 1))
e.startTime = `${time.getFullYear()}-${time.getMonth() + 1}-${time.getDate()}`
e.endTime = ''
// e.periodOfUse = orderType === 2 ? 0 : ''
e.renew = true
}
if (orderType === 2) {
this.deadLine(e.periodOfUse, e, e.options, 1)
this.calculateDiscountCourse(e)
}
})
}
}).catch(err => { })
} else {
return this.$message.warning("请选择数据");
}
@ -2490,7 +2505,6 @@ export default {
priceUnit * useUnit) * (row.authority ?
1 :
row.accountNum)).toFixed(2)
console.log("🚀 ~ file: AddOrder.vue:2287 ~ dealSettlePrice ~ sPrice:", row, sPrice)
row.settlementPrice = this.handleNaN(sPrice)
}
@ -2749,7 +2763,6 @@ export default {
},
filters: {
dialogTitle (options) {
console.log(options)
switch (options) {
case 1:
return '实训课程产品列表'

@ -1,8 +1,8 @@
<template>
<div class="page" style="padding-top: 0;" v-loading="loading">
<div class="tabs mgb20">
<a class="item" v-for="(item, i) in tabs" :key="i" :class="{ active: i == active }" @click="tabChange(i)">{{ item
}}</a>
<a class="item" v-for="(item, i) in tabs" :key="i" :class="{ active: item.id == active }"
@click="tabChange(item.id)">{{ item.name }}</a>
</div>
<div class="tool mul">
<ul class="filter">
@ -24,27 +24,38 @@
end-placeholder="结束日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd" clearable></el-date-picker>
</li>
<li>
<el-input placeholder="请输入资源名称、章节" suffix-icon="el-icon-search" v-model="form.keyword" clearable></el-input>
<el-input :placeholder="`请输入资源名称、${active === 2 ? '描述' : '章节'}`" suffix-icon="el-icon-search"
v-model="form.keyword" clearable></el-input>
</li>
</ul>
</div>
<div class="tool mul">
<ul class="filter">
<li v-if="active !== 2">
<label>课程</label>
<el-select v-if="!active" v-model="form.resourceType" clearable @change="initData">
<el-option v-for="(item, i) in courses" :key="i" :label="item.curriculumName" :value="item.cid"></el-option>
</el-select>
<el-select v-else v-model="form.resourceType" clearable @change="initData">
<el-option v-for="(item, i) in theoreticalCourses" :key="i" :label="item.courseName"
:value="item.id"></el-option>
</el-select>
</li>
<li>
<label>资源类型</label>
<el-select v-model="form.resourceType" clearable @change="initData">
<el-option v-for="(item, i) in types" :key="i" :label="item.name" :value="item.id"></el-option>
<el-select v-model="form.displayFileType" clearable @change="initData">
<el-option v-for="(item, i) in types" :key="i" :label="item.name" :value="item.name"></el-option>
</el-select>
</li>
<li>
<label>编辑人</label>
<el-select v-model="form.editor" clearable @change="initData">
<el-option v-for="(item, i) in releaseTypes" :key="i" :label="item.name" :value="item.id"></el-option>
<el-option v-for="(item, i) in types" :key="i" :label="item.name" :value="item.id"></el-option>
</el-select>
</li>
</ul>
<div>
<el-button type="primary" @click="uploadFile">上传文件</el-button>
<el-button v-if="active === 2" type="primary" @click="uploadFile">上传文件</el-button>
<el-button type="primary" @click="delAllSelection">批量删除</el-button>
</div>
</div>
@ -58,19 +69,20 @@
</template>
</el-table-column>
<el-table-column prop="resourceName" min-width="160" label="资源名称" align="center"></el-table-column>
<el-table-column prop="resourceType" min-width="160" label="资源类型" align="center"></el-table-column>
<template v-if="active === 'tab3'">
<el-table-column prop="resourceDescription" min-width="160" label="资源描述" align="center"></el-table-column>
<el-table-column prop="name" min-width="160" label="是否被引用" align="center">
<el-table-column prop="displayFileType" width="90" label="资源类型" align="center"></el-table-column>
<template v-if="active === 2">
<el-table-column key="1" prop="resourceDescription" min-width="160" label="资源描述"
align="center"></el-table-column>
<el-table-column key="2" prop="name" width="100" label="是否被引用" align="center">
<template slot-scope="scope">{{ scope.row.isReferenced ? '是' : '否' }}</template>
</el-table-column>
</template>
<template v-else>
<el-table-column prop="name" min-width="160" label="课程名称" align="center"></el-table-column>
<el-table-column prop="name" min-width="160" label="章节" align="center"></el-table-column>
<el-table-column key="3" prop="curriculumName" min-width="160" label="课程名称" align="center"></el-table-column>
<el-table-column key="4" prop="chapterSubsection" min-width="160" label="章节" align="center"></el-table-column>
</template>
<el-table-column prop="createTime" label="入库时间" align="center" width="160"></el-table-column>
<el-table-column prop="founderName" label="编辑人" width="130" align="center"></el-table-column>
<el-table-column prop="editor" label="编辑人" width="130" align="center"></el-table-column>
<el-table-column label="操作" align="center" width="180">
<template slot-scope="scope">
<el-button type="text" @click="edit(scope.row)">编辑</el-button>
@ -114,7 +126,7 @@
style="z-index: 2000">
<div class="el-image-viewer__mask"></div>
<span class="el-image-viewer__btn el-image-viewer__close" :class="{ 'doc-close': isWord }"
:style="{ top: isWord ? '50px' : '5px' }" @click="closeIframe"><i class="el-icon-circle-close"
:style="{ top: isWord ? '50px' : '15px' }" @click="closeIframe"><i class="el-icon-circle-close"
style="color: #fff"></i></span>
<div class="el-image-viewer__canvas">
<iframe v-if="iframeSrc" class="fileIframe" id="fileIframe" :src="iframeSrc" frameborder="0"></iframe>
@ -160,81 +172,32 @@ export default {
components: { Pdf, Upload },
data () {
return {
active: this.$route.query.type || 'tab1',
tabs: {
tab1: '教学课程',
tab2: '精品课程',
tab3: '文件素材',
},
timer: null,
types: SourceConst.types,
releaseTypes: [
{
id: '',
name: "不限"
},
active: +this.$route.query.type || 0,
tabs: [
{
id: 0,
name: '发布信息'
},
{
id: 1,
name: '完整比赛'
}
],
rangeList: [
{
id: null,
name: "不限"
name: '教学课程'
},
{
id: 1,
name: "全平台"
name: '精品课程'
},
{
id: 2,
name: "指定区域"
name: '文件素材'
},
{
id: 0,
name: "校内"
}
],
competitionTypes: [
{
id: '',
name: '不限'
},
{
id: 0,
name: '个人赛'
},
{
id: 1,
name: '团队赛'
}
],
publishStatus: [
{
id: '',
name: '不限'
},
{
id: 0,
name: '未发布'
},
{
id: 1,
name: '已发布'
}
],
timer: null,
types: SourceConst.types,
courses: [],
theoreticalCourses: [],
list: [],
form: {
month: '',
keyword: '',
startTime: '',
endTime: '',
resourceType: '',
displayFileType: '',
editor: '',
},
multipleSelection: [],
@ -323,16 +286,18 @@ export default {
},
mounted () {
this.getData()
this.getCourse()
},
methods: {
async getData () {
this.loading = true
try {
const { form } = this
const { page } = await this.$post(this.api.paginatedFootagesList, {
const { page } = await this.$post(this.api.resourceLibrary, {
pageNum: this.page,
pageSize: this.pageSize,
platformId: Setting.platformId,
type: this.active,
...form
})
this.list = page.records
@ -341,13 +306,40 @@ export default {
this.loading = false
}
},
tabChange (index) {
this.active = index
//
async getCourse () {
//
if (!this.courses.length) {
const sid = this.$store.state.dataPer.find(e => e.permissionName === '课程管理')
const { page } = await this.$post(this.api.curriculumList, {
pageNum: 1,
pageSize: 1000,
supplierId: sid ? sid.supplierId : '',
platformId: Setting.platformId
})
this.courses = page.records
}
//
if (!this.theoreticalCourses.length) {
const { page } = await this.$post(this.api.listTheoreticalCourse, {
pageNum: 1,
pageSize: 1000,
createPlatform: 0,
platformSource: Setting.platformSource,
})
this.theoreticalCourses = page.records
}
},
tabChange (id) {
this.active = id
this.initData()
this.getCourse()
this.$router.push({
path: '/resourse',
query: {
...this.$route.query,
type: index
type: id
}
})
},
@ -375,7 +367,7 @@ export default {
delAllSelection () {
const list = this.multipleSelection
if (list.length) {
this.$confirm("确定要删除吗?", "提示", {
this.$confirm('删除后用户将无法再查看和使用这些资源,确定删除?', '提示', {
type: "warning"
}).then(() => {
this.$post(this.api.resourceDel, list.map(e => e.id)).then(res => {
@ -385,15 +377,15 @@ export default {
}).catch(err => { })
}).catch(() => { })
} else {
this.$message.warning("请先选择赛事 !")
this.$message.warning("请先选择数据 !")
}
},
edit (row, chapterId) {
this.chapterId = chapterId;
this.sectionId = row.id;
this.sectionForm.sectionName = row.name;
this.sectionNameVisible = true;
this.chapterId = chapterId
this.sectionId = row.id
this.sectionForm.sectionName = row.name
this.sectionNameVisible = true
},
//
download (row) {

@ -20,7 +20,7 @@
<el-input v-model="form.resourceName" placeholder="请输入资源名称" />
</el-form-item>
<el-form-item label="资源类型">
<el-select v-model="form.resourceType" clearable>
<el-select v-model="form.resourceType" disabled>
<el-option v-for="(item, i) in types" :key="i" :label="item.name" :value="item.id"></el-option>
</el-select>
</el-form-item>
@ -38,6 +38,7 @@
import Util from '@/libs/util'
import Setting from '@/setting'
import SourceConst from '@/const/source'
import _ from 'lodash'
import Oss from '@/components/upload/upload.js'
export default {
props: ['visible'],
@ -46,7 +47,6 @@ export default {
uploadVisible: false,
types: SourceConst.types,
uploadList: [],
info: null,
uploading: false,
submiting: false,
form: {
@ -58,6 +58,7 @@ export default {
resourceType: '',
resourceDescription: '',
},
originForm: {},
};
},
watch: {
@ -67,12 +68,12 @@ export default {
}
},
mounted () {
this.originForm = _.cloneDeep(this.form)
},
methods: {
init () {
this.info = null
this.uploadList = []
this.form = _.cloneDeep(this.originForm)
},
//
@ -81,6 +82,22 @@ export default {
`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!`
)
},
//
handleType (ext) {
let type = 6
if (Util.isVideo(ext)) {
type = 2
} else if (Util.isAudio(ext)) {
type = 5
} else if (Util.isImg(ext)) {
type = 3
} else if (Util.isDoc(ext) || ext === 'pdf') {
type = 1
} else if (ext === 'txt') {
type = 4
}
this.form.resourceType = type
},
//
async handleRequest ({ file }) {
Oss.upload(file).then(res => {
@ -89,6 +106,7 @@ export default {
this.form.fileType = res.format
this.form.fileUrl = res.url
this.form.fileName = res.name
this.handleType(res.format)
})
},
uploadError () {
@ -108,7 +126,6 @@ export default {
},
handleRemove (file, fileList) {
this.uploadList = fileList
this.info = null
},
async submit () {
if (this.submiting) return false

Loading…
Cancel
Save