订单修复,资源库联调

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`, updateMarketing: `nakadai/nakadai/mall/marketing/promotion/update`,
bannerEnableOrDisable: `nakadai/nakadai/mall/marketing/promotion/bannerEnableOrDisable`, bannerEnableOrDisable: `nakadai/nakadai/mall/marketing/promotion/bannerEnableOrDisable`,
paginatedFootagesList: `nakadai/resourceLibrary/paginatedFootagesList`, resourceLibrary: `nakadai/resourceLibrary/resourceLibrary`,
resourceDel: `nakadai/resourceLibrary/batchDeletion`, resourceDel: `nakadai/resourceLibrary/batchDeletion`,
resourceFind: `nakadai/resourceLibrary/findById`, resourceFind: `nakadai/resourceLibrary/findById`,
resourceSave: `nakadai/resourceLibrary/saveOrUpdate`, resourceSave: `nakadai/resourceLibrary/saveOrUpdate`,

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

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

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

Loading…
Cancel
Save