yujialong 2 years ago
parent 33fbe643b5
commit 21e1cfebbc
  1. 2
      src/setting.js
  2. 3
      src/utils/api.js
  3. 2
      src/utils/editor.js
  4. 165
      src/views/course/AddCurriculum.vue
  5. 65
      src/views/data/Product.vue
  6. 734
      src/views/order/AddOrder.vue
  7. 335
      src/views/shop/addProduct/index.vue
  8. 100
      src/views/shop/list/product/index.vue

@ -12,7 +12,7 @@ if (isDev) {
// host = 'http://121.37.12.51/'
// host = 'https://huorantech.cn/'
// host = 'http://192.168.31.151:9000/'// 榕
host = 'http://192.168.31.116:9000/'// 赓
host = 'http://192.168.31.52:9000/'// 赓
} else if (isPro) {
jumpPath = 'https://www.huorantech.cn/judgmentPoint/'
}

@ -440,12 +440,14 @@ export default {
addProductType: `nakadai/productType/addProductType`,
deleteProductType: `nakadai/productType/deleteProductType`,
productTypeList: `nakadai/productType/productTypeList`,
updateProductType: `nakadai/productType/updateProductType`,
addSupplier: `nakadai/supplier/addSupplier`,
deleteSupplier: `nakadai/supplier/deleteSupplier`,
supplierList: `nakadai/supplier/supplierList`,
addTags: `nakadai/tags/addTags`,
deleteTags: `nakadai/tags/deleteTags`,
tagsList: `nakadai/tags/tagsList`,
updateTags: `nakadai/tags/updateTags`,
addGoods: `nakadai/mall/addGoods`,
listOfGoods: `nakadai/mall/listOfGoods`,
deletionOfGoods: `nakadai/mall/deletionOfGoods`,
@ -453,6 +455,7 @@ export default {
renewalOfGoods: `nakadai/mall/renewalOfGoods`,
goodsOffTheShelf: `nakadai/mall/goodsOffTheShelf`,
goodsSelection: `nakadai/mall/goodsSelection`,
queryCitySettlementPrice: `nakadai/mallPrice/queryCitySettlementPrice`,
// 营销推广
delMarketing: `nakadai/nakadai/mall/marketing/promotion/batchDeletion`,

@ -376,7 +376,7 @@ export default {
ed.target.editorCommands.execCommand("fontName", false, "Microsoft Yahei")
ed.target.editorCommands.execCommand("fontSize", false, "19px")
ed.target.editorCommands.execCommand("lineHeight", false, "1.5")
const el = top.document.querySelector('#articleTitle')
const el = top.document.querySelector('#focus-el')
el && el.focus() // 第一个字段聚焦
})
},

@ -45,31 +45,10 @@
:value="item.professionalId"></el-option>
</el-select>
</el-form-item>
<el-form-item label="市场单价格" prop="marketPrice">
<el-input placeholder="请输入市场单价格" v-model.trim="form.marketPrice">
<template slot="append">/</template>
</el-input>
</el-form-item>
<el-form-item label="结算方式" prop="settlementMethod" style="width: 800px">
<div class="settlement">
<el-radio v-model="form.settlementMethod" label="0">结算单价</el-radio>
<el-input v-model.trim="form.settlementPrice">
<template slot="append">/</template>
</el-input>
</div>
<div class="settlement">
<el-radio v-model="form.settlementMethod" label="1">比例分成</el-radio>
<span class="label">商务经理占比</span>
<el-input v-model.trim="form.businessProportion" @change="calcProp">
<template slot="append">%</template>
</el-input>
<span class="label">产品厂商占比</span>
<el-input v-model.trim="form.manufacturerProportion" @change="calcProp">
<template slot="append">%</template>
</el-input>
</div>
<el-form-item label="供应厂商" prop="supplier">
<el-select v-model="form.supplier" clearable placeholder="请选择供应厂商" multiple>
<el-option v-for="(item, i) in suppliers" :key="i" :label="item.supplierName" :value="item.supplierId"></el-option>
</el-select>
</el-form-item>
</el-col>
@ -95,66 +74,9 @@
<el-option label="64课时" value="64课时"></el-option>
</el-select>
</el-form-item>
<el-form-item label="供应厂商" prop="supplier">
<el-select v-model="form.supplier" clearable placeholder="请选择供应厂商" multiple>
<el-option v-for="(item, i) in suppliers" :key="i" :label="item.supplierName" :value="item.supplierId"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="14" :offset="5">
<el-form-item label="课程封面" prop="coverUrl">
<el-upload
class="avatar-uploader"
accept=".jpg,.png,.jpeg"
:on-remove="handleRemove"
:on-error="uploadError"
:on-success="uploadSuccess"
:before-remove="beforeRemove"
:limit="1"
:on-exceed="handleExceed"
:action="this.api.fileupload"
:headers="headers"
name="file"
>
<img v-if="form.coverUrl" :src="form.coverUrl" class="avatar">
<div class="uploader-default" v-else>
<i class="el-icon-plus"></i>
<p>上传封面</p>
</div>
<div slot="tip" class="el-upload__tip">
<p>只能上传jpg/png文件</p>
<p>课程封面图将按1:1显示最佳分辨率80*80</p>
</div>
</el-upload>
</el-form-item>
<el-form-item label="小程序图标" prop="miniProgramPictureAddress">
<el-upload
class="avatar-uploader"
accept=".jpg,.png,.jpeg"
:on-remove="handleRemoveMini"
:on-error="uploadError"
:on-success="uploadSuccessMini"
:before-remove="beforeRemove"
:limit="1"
:on-exceed="handleExceed"
:action="this.api.fileupload"
:headers="headers"
name="file"
>
<img v-if="form.miniProgramPictureAddress" :src="form.miniProgramPictureAddress" class="avatar">
<div class="uploader-default" v-else>
<i class="el-icon-plus"></i>
<p>上传封面</p>
</div>
<div slot="tip" class="el-upload__tip">
<p>只能上传jpg/png文件</p>
<p>课程封面图将按1:1显示最佳分辨率80*80</p>
</div>
</el-upload>
</el-form-item>
<el-form-item label="课程简介" prop="briefIntroduction">
<el-input type="textarea" :autosize="{ minRows: 4 }" placeholder="请输入课程简介"
v-model.trim="form.briefIntroduction"></el-input>
@ -411,19 +333,12 @@ export default {
categoryId: "",
professionalCategoryId: "",
professionalId: "",
coverUrl: "",
miniProgramPictureAddress: '',
expectedCourse: "",
marketPrice: "",
briefIntroduction: "",
teachingObjectives: "",
systemIdByAssessment: [],
systemIdByPractice: [],
supplier: '',
businessProportion: '',
manufacturerProportion: '',
settlementPrice: '',
settlementMethod: '0'
},
rules: {
curriculumName: [
@ -435,16 +350,6 @@ export default {
professionalId: [
{ required: true, message: "请选择专业", trigger: "change" }
],
marketPrice: [
{ required: true, message: "请输入市场单价格", trigger: "blur" },
{ pattern: /^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/, message: "请输入正确金额格式,可保留两位小数" }
],
supplier: [
{ required: true, message: "请输入供应厂商", trigger: "blur" }
],
settlementMethod: [
{ required: true, message: "请选择结算方式", trigger: "change" }
],
expectedCourse: [
{ required: true, message: "请选择预计课时", trigger: "change" }
],
@ -454,9 +359,6 @@ export default {
courseType: [
{ required: true, message: "请选择课程类别", trigger: "change" }
],
coverUrl: [
{ required: true, message: "请选择课程封面", trigger: "change" }
],
briefIntroduction: [
{ required: true, message: "请输入课程简介", trigger: "blur" }
],
@ -570,7 +472,6 @@ export default {
}
this.$nextTick(() => {
this.form = data;
data.miniProgramPictureAddress || this.$set(this.form, 'miniProgramPictureAddress', '')
const pList = data.practiceConfig
const { systemsAll } = this
pList.map(e => {
@ -658,49 +559,6 @@ export default {
}).catch(err => {
});
},
//
calcProp() {
const p1 = this.form.businessProportion
const p2 = this.form.manufacturerProportion
if (p1 && p2) {
if(isNaN(p1)) return this.$message.warning('商务经理占比请输入数字')
if(isNaN(p2)) return this.$message.warning('产品厂商占比请输入数字')
if(+p1 + +p2 !== 100) return this.$message.warning('比例分成总和须为100%,请重新修改')
}
},
handleExceed(files, fileList) { //
this.$message.warning("当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!");
},
uploadSuccess(res, file, fileList) { //
this.form.coverUrl = res.data.filesResult.fileUrl;
},
uploadError(err, file, fileList) { //
this.$message({
message: "上传出错,请重试!",
type: "error",
center: true
});
},
beforeRemove(file, fileList) { //
return this.$confirm(`确定移除 ${file.name}`);
},
handleRemove(file, fileList) { //
this.$del(`${this.api.fileDeletion}?keys=${this.form.coverUrl}`).then(res => {
this.form.coverUrl = "";
}).catch(err => {
});
},
uploadSuccessMini(res, file, fileList) { //
this.form.miniProgramPictureAddress = res.data.filesResult.fileUrl;
},
handleRemoveMini(file, fileList) { //
this.$del(`${this.api.fileDeletion}?keys=${this.form.miniProgramPictureAddress}`).then(res => {
this.form.miniProgramPictureAddress = "";
}).catch(err => {
});
},
//
handleConfig(type) {
this.systemKeyword = ''
@ -948,22 +806,7 @@ export default {
if (valid) {
if (this.submiting) return false
const form = JSON.parse(JSON.stringify(this.form))
const { businessProportion, manufacturerProportion, settlementMethod, settlementPrice } = form
if (settlementMethod == 0) {
if(!settlementPrice) return this.$message.warning('请输入结算单价')
if(isNaN(settlementPrice)) return this.$message.warning('结算单价请输入数字')
} else {
if(!businessProportion) return this.$message.warning('请输入商务经理占比')
if(isNaN(businessProportion)) return this.$message.warning('商务经理占比请输入数字')
if(!manufacturerProportion) return this.$message.warning('请输入产品厂商占比')
if(isNaN(manufacturerProportion)) return this.$message.warning('产品厂商占比请输入数字')
if(+businessProportion + +manufacturerProportion !== 100) return this.$message.warning('比例分成总和须为100%,请重新修改')
}
form.supplier = form.supplier.join()
if (!form.coverUrl) {
this.$message.warning("请上传课程封面");
return;
}
if (!this.practiceData.length) {
this.$message.warning("请添加练习配置");
return;

@ -56,41 +56,11 @@
<el-form-item label="数据产品名称">
<el-input v-model="productName" placeholder="请输入数据产品名称"></el-input>
</el-form-item>
<el-form-item label="市场单价格">
<el-input v-model="market" placeholder="请输入市场价格" :min="0">
<span slot="suffix">/账号/</span>
</el-input>
</el-form-item>
<el-form-item label="供应厂商" prop="supplier">
<el-select v-model="supplier" clearable placeholder="请选择供应厂商">
<el-option v-for="(item, i) in suppliers" :key="i" :label="item.supplierName" :value="item.supplierId"></el-option>
</el-select>
</el-form-item>
<el-form-item label="结算方式" prop="settlementMethod" style="width: 800px">
<div class="settlement" style="align-items: center">
<el-radio v-model="settlementMethod" label="0">结算单价</el-radio>
<el-input style="width: 244px" v-model.trim="settlementPrice">
<template slot="append">/账号/</template>
</el-input>
</div>
<div class="settlement">
<el-radio style="margin-top: 10px" v-model="settlementMethod" label="1">比例分成</el-radio>
<div class="settle-item">
<div style="margin-bottom: 10px">
<span class="label">商务经理占比</span>
<el-input v-model.trim="businessProportion" @change="calcProp">
<template slot="append">%</template>
</el-input>
</div>
<div>
<span class="label">产品厂商占比</span>
<el-input v-model.trim="manufacturerProportion" @change="calcProp">
<template slot="append">%</template>
</el-input>
</div>
</div>
</div>
</el-form-item>
<el-form-item label="配置数据">
<el-button type="primary" @click="configData">配置数据权限</el-button>
</el-form-item>
@ -193,12 +163,7 @@ export default {
id: '',
userId: '',
productName: '',
market: '',
supplier: '',
businessProportion: '',
manufacturerProportion: '',
settlementPrice: '',
settlementMethod: '0',
typeList: [],
loading: false,
defaultProps: {
@ -421,11 +386,6 @@ export default {
this.$post(`${this.api.findById}?id=${this.id}`).then(res => {
const data = res.product
this.productName = data.productName
this.market = data.market
this.businessProportion = data.businessProportion
this.manufacturerProportion = data.manufacturerProportion
this.settlementMethod = data.settlementMethod
this.settlementPrice = data.settlementPrice
this.supplier = data.supplier
this.checkedIds = data.tableId.split(',')
this.$refs.type.setCheckedKeys(this.checkedIds) //
@ -451,7 +411,6 @@ export default {
this.$post(this.api.updateProduct,{
id: row.id,
productName: row.productName,
market: row.market,
tableId: row.tableId,
userId: row.userId,
userName: row.userName,
@ -523,11 +482,6 @@ export default {
//
closeProduct(){
this.productName = ''
this.market = ''
this.businessProportion = ''
this.manufacturerProportion = ''
this.settlementMethod = '0'
this.settlementPrice = ''
this.supplier = ''
this.isDetail = false
this.typeList = []
@ -561,21 +515,9 @@ export default {
//
confirm(){
if(this.submited) return false
const { productName, market, businessProportion, manufacturerProportion, settlementMethod, settlementPrice, supplier } = this
const { productName, supplier } = this
if(!productName) return this.$message.warning('请输入数据产品名称')
if(!market) return this.$message.warning('请输入市场单价格')
if(isNaN(market)) return this.$message.warning('市场单价格请输入数字')
if(!supplier) return this.$message.warning('请选择供应厂商')
if (settlementMethod == 0) {
if(!settlementPrice) return this.$message.warning('请输入结算单价')
if(isNaN(settlementPrice)) return this.$message.warning('结算单价请输入数字')
} else {
if(!businessProportion) return this.$message.warning('请输入商务经理占比')
if(isNaN(businessProportion)) return this.$message.warning('商务经理占比请输入数字')
if(!manufacturerProportion) return this.$message.warning('请输入产品厂商占比')
if(isNaN(manufacturerProportion)) return this.$message.warning('产品厂商占比请输入数字')
if(+businessProportion + +manufacturerProportion !== 100) return this.$message.warning('比例分成总和须为100%,请重新修改')
}
if(!this.checkedIds.length) return this.$message.warning('请选择数据')
this.submited = true //
let tableId = this.checkedIds
@ -583,11 +525,6 @@ export default {
let data = {
id: this.id,
productName,
market,
businessProportion,
manufacturerProportion,
settlementMethod,
settlementPrice,
supplier,
tableId: tableId.join(),
userId: this.userId,

@ -864,14 +864,15 @@
<template slot-scope="scope">
<div class="flex-c-c">
<el-button
style="margin-right: 10px;"
type="text"
@click="showShip(scope.row)"
>编辑发货内容</el-button>
>{{ viewDisabled ? '' : '编辑' }}发货内容</el-button>
<el-button
v-if="!editDisabled&&!viewDisabled"
type="text"
@click="delPracticalCourses(scope.$index)"
style="margin-right:10px;"
style="margin: 0 10px;"
>删除</el-button>
<!-- 1: 未生效2生效中3已过期 -->
<!--
@ -1017,9 +1018,14 @@
</div>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="180">
<el-table-column label="操作" align="center" width="250">
<template slot-scope="scope">
<div class="flex-c-c">
<el-button
style="margin-right: 10px;"
type="text"
@click="showShip(scope.row)"
>{{ viewDisabled ? '' : '编辑' }}发货内容</el-button>
<el-button
v-if="!editDisabled&&!viewDisabled"
type="text"
@ -1130,100 +1136,7 @@
</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"
@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>
<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">
<span class="ellipsis">{{ scope.row.sysName }}</span>
</template>
</el-table-column>
<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>
<!-- 添加数据平台权限弹框 -->
<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"
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">
<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>
<!-- 职站增值弹框 -->
<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>
<!-- 实训课程弹框-->
<!-- 选择课程弹框-->
<el-dialog :visible.sync="practicalCourseVisible" width="50%" center :close-on-click-modal="false" @close="closeJCourse">
<div class="flex-between mgb20">
<div class="flex-center">
@ -1253,50 +1166,7 @@
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="practicalCourseVisible = false"> </el-button>
<el-button type="primary" v-preventReClick @click="practicalCourseSubmit"> 定147258</el-button>
</span>
</el-dialog>
<!-- 实验工具弹框-->
<el-dialog :visible.sync="expToolVisible" 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="practicalCourseName" clearable></el-input>
</div>
</div>
<el-table v-loading="dataLoading" :data="expToolList" stripe header-align="center"
@selection-change="expToolSelection" row-key="cid">
<el-table-column type="selection" :selectable="expToolSelectable" width="55"
align="center"></el-table-column>
<el-table-column type="index" width="100" label="序号" align="center">
</el-table-column>
<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">
<span class="ellipsis">{{ scope.row.sysName }}</span>
</template>
</el-table-column>
<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="expToolTotals"
@current-change="expToolChange" :current-page="expToolPage">
</el-pagination>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="expToolVisible = false"> </el-button>
<el-button type="primary" v-preventReClick @click="expToolSubmit"> </el-button>
<el-button type="primary" v-preventReClick @click="practicalCourseSubmit"> </el-button>
</span>
</el-dialog>
@ -1355,10 +1225,10 @@
<select-client ref="client" @back="backToOrder" v-show="showSelectClient" :refresh="showSelectClient"></select-client>
<el-dialog title="发货信息填写" :visible.sync="shipVisible" width="380px" class="dialog" :close-on-click-modal="false">
<el-input v-model="shipContent" placeholder="请填写需交付的产品登录地址、账号、密码等内容...(300个字以内)" type="textarea" :rows="10" maxlength="300"></el-input>
<span slot="footer" class="dialog-footer" >
<el-input :disabled="viewDisabled" v-model="shipContent" placeholder="请填写需交付的产品登录地址、账号、密码等内容...(300个字以内)" type="textarea" :rows="10" maxlength="300"></el-input>
<span slot="footer" class="dialog-footer">
<el-button @click="shipVisible = false">取消</el-button>
<el-button type="primary" @click="submitShip">确定</el-button>
<el-button v-if="!viewDisabled" type="primary" @click="submitShip">确定</el-button>
</span>
</el-dialog>
</div>
@ -1375,6 +1245,32 @@ export default {
return {
// authority: 01234
deliverShow: ['pageTypes', 'dataPageTypes', 'modelPageTypes', 'practiceCourseTypes', 'expToolTypes','theoryCourse'],
listName: [
{
id: 1,
name: 'coursePermissions'
},
{
id: 2,
name: 'theoryCourseList'
},
{
id: 3,
name: 'valuePermissions'
},
{
id: 4,
name: 'practicalCourses'
},
{
id: 5,
name: 'dataPlatformPermissions'
},
{
id: 6,
name: 'expTools'
},
],
pageTypes: false,
dataPageTypes: false,
modelPageTypes:false,
@ -1564,18 +1460,12 @@ export default {
};
},
watch: {
curriculumName(n) {
practicalCourseName(n) {
clearTimeout(this.searchTimer);
this.searchTimer = setTimeout(() => {
this.getCourseJurisdiction();
this.getPracticalCourses();
}, 500);
},
productName(n) {
clearTimeout(this.searchTimer);
this.searchTimer = setTimeout(() => {
this.getDataJurisdiction();
}, 500);
}
},
async created() {
this.getTeam()
@ -1817,12 +1707,6 @@ export default {
this.valuePermissions = list.filter(i => i.authority === 2);
this.practicalCourses = list.filter(i => i.authority === 3);
this.expTools = list.filter(i => i.authority === 4);
// this.dataPlatformPermissions = list.filter(i => i.authority === 0);
// this.theoryCourseList = list.filter(i => i.authority === 2);
// this.practicalCourses = list.filter(i => i.authority === 3);
// this.expTools = list.filter(i => i.authority === 4);
},
//
getRate() {
@ -1857,7 +1741,7 @@ export default {
submitOrder() {
let purchase = 0 //
let profit = 0 //
if (!this.coursePermissions.length && !this.dataPlatformPermissions.length && !this.valuePermissions.length && !this.practicalCourses.length && !this.expTools.length) {
if (!this.coursePermissions.length && !this.theoryCourseList.length && !this.dataPlatformPermissions.length && !this.valuePermissions.length && !this.practicalCourses.length && !this.expTools.length) {
return this.$message.error("请选择课程权限或数据权限或职站增值模块权限后再确认订单");
} else {
//
@ -1882,6 +1766,27 @@ export default {
return this.$message.error("请把课程参数输入完整");
}
}
if (this.theoryCourseList.length) {
let courseVerify =
this.theoryCourseList.some(e => {
// if (!e.periodOfUse || e.finalPrice === '') {
if (!e.periodOfUse || e.finalPrice === '' || !e.startTime) {
return false;
} else {
const curPurchase = +e.settlementPrice + (e.settlementPrice * (this.rate / 100))
purchase += curPurchase
profit += +e.finalPrice - curPurchase
return true;
}
});
if (!courseVerify) {
this.whetherSubmit = true;
setTimeout(() => {
this.whetherSubmit = false;
}, 4000);
return this.$message.error("请把课程参数输入完整");
}
}
//
if (this.dataPlatformPermissions.length) {
let dataVerify =
@ -2045,120 +1950,10 @@ export default {
this.$forceUpdate();
}
},
//
getCourseJurisdiction() {
const sid = this.$store.state.dataPer.find(e => e.permissionName === '课程管理')
let param = {
pageSize: 10,
pageNum: this.coursePage,
isShelves: 1, //
curriculumName: this.curriculumName,
supplierId: sid ? sid.supplierId : ''
};
this.dataLoading = true;
this.$post(this.api.curriculumList, param).then(res => {
this.courseList = res.page.records;
this.courseTotals = res.page.total;
this.dataLoading = false;
}).catch(err => {
this.dataLoading = false;
});
},
courseSelectable(row, index) { //
let boolean = true;
this.coursePermissions.length && this.coursePermissions.some(e => {
if (e.dataOrCourseId === row.cid) {
boolean = false;
}
});
return boolean;
},
// --
handleSelectionChange(val) {
this.courseSelection = val;
},
// --
handleCurrentChange(val) {
this.coursePage = val;
this.getCourseJurisdiction();
},
closeJCourse() { //
this.curriculumName = "";
this.courseVisible = false;
},
async addCourse() {
if (this.courseSelection.length > 0) {
let that = this;
const { orderType } = this.form
let fn = function(e) {
let obj = {
dataOrCourseId: e.cid,// id
productName: e.curriculumName,//
periodOfUse: "",// 使
startTime: new Date(),//
endTime: "", //
remainingPeriod: "",//
marketValue: '', //
marketPrice: e.marketPrice, //
finalPrice: orderType === 2 ? 0 : '',//
discountRate: "",//
accountNum: "",//
totalAmount: "",//
isEnable: 0, // 10
ship: 0,// 01
authority: 1, // 01
options: 1,
settlementPrice: orderType === 2 ? 0 : '', //
settlementMethod: e.settlementMethod, // 01
settlementPriceUnit: e.settlementPrice, //
businessProportion: e.businessProportion, //
};
that.coursePermissions.push(obj);
};
let idArr = [];
this.courseSelection.map(e => {//
idArr.push(e.cid);
if (this.coursePermissions.length > 0) {
// idpush
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 && el.authority) {
if (el.endTime) {
let time = new Date(el.endTime)
time = new Date(time.setDate(time.getDate() + 1))
e.startTime = `${time.getFullYear()}-${time.getMonth() + 1}-${time.getDate()}`
} else {
e.startTime = ''
}
e.endTime = "";
e.periodOfUse = "";
e.renew = true;
}
});
});
});
} else {
return this.$message.warning("请选择课程");
}
},
//
delCourseForm(index) {
this.$confirm("确定要删除吗?", "提示", {
@ -2184,165 +1979,6 @@ export default {
});
},
//
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, // 10
ship: 0,// 01
authority: 2,
options:1,
settlementPrice: orderType === 2 ? 0 : '', //
settlementMethod: e.settlementMethod, // 01
settlementPriceUnit: e.settlementPrice, //
businessProportion: e.businessProportion, //
})
})
this.valuePermissions = data
this.valueVisible = false
},
//
addDataJurisdiction() {
if (!this.form.customerId) return this.$message.warning("请先选择客户");
this.showPlatform = true;
this.getDataJurisdiction();
},
//
getDataJurisdiction() {
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;
this.platfromTotals = res.pageList.total;
this.dataLoading = false;
}).catch(err => {
this.dataLoading = false;
});
},
dataSelectable(row, index) { //
let boolean = true;
this.dataPlatformPermissions.length && this.dataPlatformPermissions.some(e => {
if (e.dataOrCourseId === row.id) {
boolean = false;
}
});
return boolean;
},
// --
dataPlatformSelection(val) {
this.platformSelect = val;
},
// --
async addPlatform() {
if (this.platformSelect.length > 0) {
let that = this;
const { orderType } = this.form
let fn = function(e) {
let obj = {
dataOrCourseId: e.id,// id
productName: e.productName,//
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, // 10
ship: 0,// 01
authority: 0,//
options:1,
settlementPrice: orderType === 2 ? 0 : '', //
settlementMethod: e.settlementMethod, // 01
settlementPriceUnit: e.settlementPrice, //
businessProportion: e.businessProportion, //
};
that.dataPlatformPermissions.push(obj);
};
let idArr = [];
this.platformSelect.map(e => {//
idArr.push(e.id);
if (this.dataPlatformPermissions.length > 0) {
// idpush
let find = this.dataPlatformPermissions.some(i => e.id === i.dataOrCourseId);// id
if (!find) {
fn(e);
}
} else {
fn(e);
}
});
this.showPlatform = false;
this.productName = "";
this.platformSelect = [];
/* 调接口,判断是否为客户已有的产品功能 */
let params = {
authority: 0,
customerId: this.form.customerId,
productId: idArr
};
await this.$post(this.api.renew, params).then(res => {
this.dataPlatformPermissions.map(e => {
res.orderOthers.map(el => {
if (el.dataOrCourseId === e.dataOrCourseId && !el.authority) {
let time = new Date(el.endTime)
time = new Date(time.setDate(time.getDate() + 1))
e.startTime = `${time.getFullYear()}-${time.getMonth() + 1}-${time.getDate()}`
e.endTime = "";
e.periodOfUse = "";
e.renew = true;
}
});
});
});
} else {
return this.$message.warning("请选择数据");
}
},
// --
platfromCurrentChange(val) {
this.platfromPage = val;
this.getDataJurisdiction();
},
//
delDataForm(index) {
this.$confirm("确定要删除吗?", "提示", {
@ -2371,20 +2007,15 @@ export default {
//
addPracticalCourses() {
if (!this.form.customerId) return this.$message.warning("请先选择客户");
this.practicalCourseVisible = true;
this.getPracticalCourses();
},
//
//
getPracticalCourses() {
this.dataLoading = true;
this.$post(this.api.listOfGoods, {
pageNum: this.practicalCoursePage,
productClassification: this.classificationId,
pageSize: 10,
isShelves: 0
isShelves: 0,
productName: this.practicalCourseName
}).then(({ page }) => {
this.practicalCourseList = page.records;
this.practicalCourseTotals = page.total;
@ -2402,11 +2033,11 @@ export default {
});
return boolean;
},
// --
// --
practicalCoursesSelection(val) {
this.practicalCoursesSelect = val;
},
// --
// --
async practicalCourseSubmit() {
if (this.practicalCoursesSelect.length > 0) {
let that = this;
@ -2434,71 +2065,43 @@ export default {
break;
}
const { orderType } = this.form
const { name } = this.listName.find(e => e.id == that.classificationId)
let fn = function(e) {
let obj = {
dataOrCourseId: e.associatedProduct,// id
mallId: e.mallId,
productName: e.productName,//
periodOfUse: "",// 使
startTime: new Date(),//
endTime: "", //
remainingPeriod: "",//
marketValue: '', //
marketPrice: '', //
finalPrice: orderType === 2 ? 0 : '',//
discountRate: "",//
accountNum: "",//
totalAmount: "",//
isEnable: 0, // 10
ship: 0,// 01
authority: authority, // 01
options: 1,
settlementPrice: orderType === 2 ? 0 : '', //
settlementMethod: e.settlementMethod, // 01
settlementPriceUnit: e.settlementPrice, //
businessProportion: e.businessProportion, //
};
switch (that.classificationId) {
case 1:
//
that.coursePermissions.push(obj)
break;
case 2:
//
that.theoryCourseList.push(obj)
break;
case 3:
//
that.valuePermissions.push(obj)
break;
case 4:
//
that.practicalCourses.push(obj)
break;
case 5:
//
that.dataPlatformPermissions.push(obj)
break;
case 6:
//
that.expTools.push(obj)
break;
default:
break;
}
// that.practicalCourses.push(obj);
that[name].push({
dataOrCourseId: e.associatedProduct,// id
mallId: e.mallId,
productName: e.productName,//
periodOfUse: "",// 使
startTime: new Date(),//
endTime: "", //
remainingPeriod: "",//
marketValue: '', //
marketPrice: e.marketUnitPrice, //
finalPrice: orderType === 2 ? 0 : '',//
discountRate: "",//
accountNum: "",//
totalAmount: "",//
isEnable: 0, // 10
ship: 0,// 01
authority, // 01
options: 1,
settlementPrice: orderType === 2 ? 0 : '', //
settlementPriceUnit: e.settlementPrice || 0, //
})
};
let idArr = [];
console.log("🚀 ~ file: AddOrder.vue:2095 ~ practicalCourseSubmit ~ idArr:", this[name],this.practicalCoursesSelect)
this.practicalCoursesSelect.map(e => {//
idArr.push(e.cid);
if (this.practicalCourses.length > 0) {
// idpush
let find = this.practicalCourses.some(i => e.cid === i.dataOrCourseId);// id
if (!find) {
fn(e);
idArr.push(e.mallId);
let find = this[name].some(i => e.associatedProduct === i.dataOrCourseId);// id
if (!find) {
this.$post(`${this.api.queryCitySettlementPrice}?mallId=${e.mallId}&provinceId=${this.form.provinceId}&cityId=${this.form.cityId}`).then(res => {
const mall = res.mallPrice
if (mall) {
e.settlementPrice = mall.discountRate
}
} else {
fn(e);
}).catch((res) => {})
}
});
this.practicalCourseVisible = false;
@ -2546,121 +2149,6 @@ export default {
});
},
//
addExpTool() {
if (!this.form.customerId) return this.$message.warning("请先选择客户");
this.expToolVisible = true;
this.getExpTool();
},
//
getExpTool() {
const sid = this.$store.state.dataPer.find(e => e.permissionName === '课程管理')
let param = {
pageSize: 10,
pageNum: this.expToolPage,
isShelves: 1, //
curriculumName: this.expToolName,
supplierId: sid ? sid.supplierId : ''
};
this.dataLoading = true;
this.$post(this.api.curriculumList, param).then(res => {
this.expToolList = res.page.records;
this.expToolTotals = res.page.total;
this.dataLoading = false;
}).catch(err => {
this.dataLoading = false;
});
},
expToolSelectable(row, index) { //
let boolean = true;
this.expTools.length && this.expTools.some(e => {
if (e.dataOrCourseId === row.cid) {
boolean = false;
}
});
return boolean;
},
// --
expToolSelection(val) {
this.expToolSelect = val;
},
// --
async expToolSubmit() {
if (this.expToolSelect.length > 0) {
let that = this;
const { orderType } = this.form
let fn = function(e) {
let obj = {
dataOrCourseId: e.cid,// id
productName: e.curriculumName,//
periodOfUse: "",// 使
startTime: new Date(),//
endTime: "", //
remainingPeriod: "",//
marketValue: '', //
marketPrice: e.marketPrice, //
finalPrice: orderType === 2 ? 0 : '',//
discountRate: "",//
accountNum: "",//
totalAmount: "",//
isEnable: 0, // 10
ship: 0,// 01
authority: 4, // 01
options: 1,
settlementPrice: orderType === 2 ? 0 : '', //
settlementMethod: e.settlementMethod, // 01
settlementPriceUnit: e.settlementPrice, //
businessProportion: e.businessProportion, //
};
that.expTools.push(obj);
};
let idArr = [];
this.expToolSelect.map(e => {//
idArr.push(e.cid);
if (this.expTools.length > 0) {
// idpush
let find = this.expTools.some(i => e.cid === i.dataOrCourseId);// id
if (!find) {
fn(e);
}
} else {
fn(e);
}
});
this.expToolVisible = false;
this.expToolName = "";
this.expToolsSelect = [];
/* 调接口,判断是否为客户已有的产品功能 */
let params = {
authority: 4,
customerId: this.form.customerId,
productId: idArr
};
await this.$post(this.api.renew, params).then(res => {
this.dataPlatformPermissions.map(e => {
res.orderOthers.map(el => {
if (el.dataOrCourseId === e.dataOrCourseId && el.authority == 4) {
let time = new Date(el.endTime)
time = new Date(time.setDate(time.getDate() + 1))
e.startTime = `${time.getFullYear()}-${time.getMonth() + 1}-${time.getDate()}`
e.endTime = "";
e.periodOfUse = "";
e.renew = true;
}
});
});
});
} else {
return this.$message.warning("请选择数据");
}
},
// --
expToolChange(val) {
this.expToolPage = val;
this.getExpTool();
},
//
delExpTool(index) {
this.$confirm("确定要删除吗?", "提示", {
@ -2675,7 +2163,7 @@ export default {
},
// /-
//
handleEnable(e, row,type) {
this[this.deliverShow[type]] = !this[this.deliverShow[type]]
},
@ -2708,13 +2196,13 @@ export default {
// }).then(res => {})
}
},
// /-
//
handleDeliver(e, row,type) {
this[this.deliverShow[type]] = row.ship === 1
if(row.ship === 1) {
row.isEnable = 1
}
if (type == 3 && row.ship) this.showShip(row) //
if ((type == 3 || type == 4) && row.ship) this.showShip(row) //
},
// 0
handleNaN(val) {
@ -2781,21 +2269,17 @@ export default {
const unit = row.options // 使
const useUnit = row.periodOfUse // 使
if (this.form.orderType !== 2) {
let sPrice = ''
if (row.settlementMethod == 0) {
// **/**(1)
const priceUnit = row.settlementPriceUnit
sPrice = ((!unit ?
// **/**(1)
const priceUnit = row.settlementPriceUnit
const sPrice = ((!unit ?
priceUnit / 365 * useUnit :
unit === 1 ?
priceUnit / 12 * useUnit :
priceUnit * useUnit) * (row.authority ?
1 :
row.accountNum)).toFixed(2)
} else {
// *
sPrice = (row.finalPrice * row.businessProportion / 100).toFixed(2)
}
console.log("🚀 ~ file: AddOrder.vue:2287 ~ dealSettlePrice ~ sPrice:", row,sPrice)
row.settlementPrice = this.handleNaN(sPrice)
}
},
@ -3038,8 +2522,6 @@ export default {
*/
addCourseJurisdiction(type) {
if (!this.form.customerId) return this.$message.warning("请先选择客户");
// this.courseVisible = true;
// this.getCourseJurisdiction();
this.classificationId = type
this.practicalCourseVisible = true;
this.getPracticalCourses();

@ -2,27 +2,27 @@
<div>
<el-card shadow="hover" class="m-b-20">
<div class="flex-between">
<el-page-header @back="back" :content="form.id ? '编辑产品' : '新增产品'"></el-page-header>
<el-page-header @back="back" :content="isDetail ? '查看产品' :(id ? '编辑产品' : '新增产品')"></el-page-header>
</div>
</el-card>
<el-card shadow="hover" class="m-b-20">
<el-form class="model" ref="form" label-width="110px">
<el-form class="model" ref="form" label-width="110px" :disabled="isDetail">
<el-row>
<el-col :span="6" :offset="5">
<el-form-item class="req" label="关联产品" prop="curriculumName">
<div>
<el-radio v-model="form.mall.isAssociatedProduct" :label="0"></el-radio>
<el-button class="m-l-5" type="primary" @click="setProduct">请选择</el-button>
<el-radio v-model="form.mall.isAssociatedProduct" :label="0" @change="associatedProductChange"></el-radio>
<el-button v-if="!form.mall.isAssociatedProduct" class="m-l-5" type="primary" @click="setProduct">请选择</el-button>
<span class="m-l-5">{{ form.mall.associatedProductName }}</span>
</div>
<div>
<el-radio v-model="form.mall.isAssociatedProduct" :label="1"></el-radio>
<el-radio v-model="form.mall.isAssociatedProduct" :label="1" @change="associatedProductChange"></el-radio>
</div>
</el-form-item>
<el-form-item class="req" label="产品名称" prop="categoryId">
<el-input placeholder="请输入产品名称" v-model.trim="form.mall.productName"></el-input>
<el-input placeholder="请输入产品名称" v-model.trim="form.mall.productName" id="focus-el"></el-input>
</el-form-item>
<el-form-item label="分类标签" prop="professionalId">
@ -41,7 +41,7 @@
</el-col>
<el-col :span="6" :offset="2">
<el-form-item class="req" label="产品分类">
<el-select v-model="form.classificationIds" clearable placeholder="请选择产品分类" :disabled="!!form.mall.associatedProduct && form.classificationIds">
<el-select v-model="form.classificationIds" clearable placeholder="请选择产品分类" :disabled="!!(form.mall.associatedProduct && form.classificationIds)">
<el-option v-for="(item, i) in productCategoryList" :key="i" :label="item.classificationName" :value="item.classificationId"></el-option>
</el-select>
</el-form-item>
@ -59,7 +59,7 @@
<el-button style="margin-left: 5px" type="primary" @click="setClass">自定义</el-button>
</el-form-item>
<el-form-item class="req" label="供应厂商" prop="supplier">
<el-select v-model="form.supplierIds" clearable placeholder="请选择供应厂商" multiple :disabled="!!form.mall.associatedProduct && form.supplierIds.length >1">
<el-select v-model="form.supplierIds" clearable placeholder="请选择供应厂商" multiple :disabled="selectedProduct">
<el-option v-for="(item, i) in suppliers" :key="i" :label="item.supplierName" :value="item.supplierId"></el-option>
</el-select>
</el-form-item>
@ -93,6 +93,7 @@
:value="item.professionalId"></el-option>
</el-select>
</el-form-item>
<i v-if="i" class="del el-icon-delete" @click="form.mallDisciplines.splice(i, 1)"></i>
</div>
</div>
<div class="subject-plus" @click="addSubject">
@ -187,39 +188,44 @@
</el-col>
<el-col :span="14" :offset="5">
<el-form-item class="req" label="市场建议单价" prop="briefIntroduction">
<el-input style="width: 250px" placeholder="请输入市场建议单价" v-model.trim="form.mall.marketUnitPrice">
<template slot="append">/</template>
<el-input type="number" style="width: 250px" placeholder="请输入市场建议单价" v-model.number="form.mall.marketUnitPrice">
<template slot="append">{{ isData ? '元/账号/年' : '元/年' }}</template>
</el-input>
</el-form-item>
<el-form-item class="req" label="厂商结算价" prop="briefIntroduction">
<template v-for="(item, i) in form.mallPrices">
<div v-if="!item.settlementPriceType && item.area === 0" :key="i">
普适地区
<el-select style="width: 250px;margin: 0 10px;" v-model="item.entryType" clearable placeholder="请选择">
<el-select style="width: 250px;margin: 0 10px;" v-model="item.entryType" clearable placeholder="请选择" @change="calcSettlement(item)">
<el-option label="手动录入" :value="0"></el-option>
<el-option label="按折扣" :value="1"></el-option>
</el-select>
<el-input style="width: 200px" v-model.trim="item.settlementPrice">
<template slot="append">{{ item.entryType ? '折' : '元/年' }}</template>
<el-input type="number" style="width: 200px" v-model.number="item.settlementPrice" @change="calcSettlement(item)">
<template slot="append">{{ handleUnit(item) }}</template>
</el-input>
<span v-if="item.entryType" class="m-l-20">{{ item.discountRate }} {{ isData ? '/账号/' : '/' }}</span>
</div>
</template>
<div style="display: flex;align-items: center;margin-top: 10px;">
除外地区
<i class="el-icon-circle-plus-outline plus" style="margin: 0 0 0 10px;" @click="addArea(0)"></i>
</div>
<div v-if="form.mallPrices.length" class="subject">
<div v-if="form.mallPrices.length && form.mallPrices.find(e => !e.settlementPriceType && e.area !== 0)" class="subject mini">
<template v-for="(item, i) in form.mallPrices">
<div v-if="!item.settlementPriceType && item.area !== 0" :key="i" class="line">
<el-select style="width: 150px" v-model="item.area" clearable placeholder="请选择地区">
<el-select style="width: 150px" v-model="item.area" clearable placeholder="请选择地区" @change="getCity(item, 1)">
<el-option v-for="(item, i) in provinces" :key="i" :label="item.provinceName" :value="item.provinceId"></el-option>
</el-select>
<el-select style="width: 150px;margin: 0 10px;" v-model="item.entryType" clearable placeholder="请选择">
<el-select style="width: 150px;margin: 0 10px;" v-model="item.cityId" clearable placeholder="请选择城市" :disabled="item.area ? false : true">
<el-option v-for="(item, i) in item.cities" :key="i" :label="item.cityName" :value="item.cityId"></el-option>
</el-select>
<el-select style="width: 150px;margin-right: 10px;" v-model="item.entryType" clearable placeholder="请选择">
<el-option v-for="(item, i) in entryTypes" :key="i" :label="item.name" :value="item.id"></el-option>
</el-select>
<el-input style="width: 200px" v-model.trim="item.settlementPrice">
<template slot="append">{{ item.entryType ? '折' : '元/年' }}</template>
<el-input type="number" style="width: 200px" v-model.number="item.settlementPrice">
<template slot="append">{{ handleUnit(item) }}</template>
</el-input>
<i class="del el-icon-delete" @click="form.mallPrices.splice(i, 1)"></i>
</div>
</template>
</div>
@ -228,46 +234,51 @@
<template v-for="(item, i) in form.mallPrices">
<div v-if="item.settlementPriceType && item.area === 0" :key="i">
普适地区
<el-select style="width: 250px;margin: 0 10px;" v-model="item.entryType" clearable placeholder="请选择">
<el-select style="width: 250px;margin: 0 10px;" v-model="item.entryType" clearable placeholder="请选择" @change="calcSettlement(item)">
<el-option label="手动录入" :value="0"></el-option>
<el-option label="按折扣" :value="1"></el-option>
</el-select>
<el-input style="width: 200px" v-model.trim="item.settlementPrice">
<template slot="append">{{ item.entryType ? '折' : '元/年' }}</template>
<el-input type="number" style="width: 200px" v-model.number="item.settlementPrice" @change="calcSettlement(item)">
<template slot="append">{{ handleUnit(item) }}</template>
</el-input>
<span v-if="item.entryType" class="m-l-20">{{ item.discountRate }} {{ isData ? '/账号/' : '/' }}</span>
</div>
</template>
<div style="display: flex;align-items: center;margin-top: 10px;">
除外地区
<i class="el-icon-circle-plus-outline plus" style="margin: 0 0 0 10px;" @click="addArea(1)"></i>
</div>
<div v-if="form.mallPrices.length" class="subject">
<div v-if="form.mallPrices.length && form.mallPrices.find(e => e.settlementPriceType && e.area !== 0)" class="subject">
<template v-for="(item, i) in form.mallPrices">
<div v-if="item.settlementPriceType && item.area !== 0" :key="i" class="line">
<el-select style="width: 150px" v-model="item.area" clearable placeholder="请选择地区">
<el-select style="width: 150px" v-model="item.area" clearable placeholder="请选择地区" @change="getCity(item, 1)">
<el-option v-for="(item, i) in provinces" :key="i" :label="item.provinceName" :value="item.provinceId"></el-option>
</el-select>
<el-select style="width: 150px;margin: 0 10px;" v-model="item.cityId" clearable placeholder="请选择城市" :disabled="item.area ? false : true">
<el-option v-for="(item, i) in item.cities" :key="i" :label="item.cityName" :value="item.cityId"></el-option>
</el-select>
<el-select style="width: 150px;margin: 0 10px;" v-model="item.entryType" clearable placeholder="请选择">
<el-option v-for="(item, i) in entryTypes" :key="i" :label="item.name" :value="item.id"></el-option>
</el-select>
<el-input style="width: 200px" v-model.trim="item.settlementPrice">
<template slot="append">{{ item.entryType ? '折' : '元/年' }}</template>
<el-input type="number" style="width: 200px" v-model.number="item.settlementPrice">
<template slot="append">{{ handleUnit(item) }}</template>
</el-input>
<i class="del el-icon-delete" @click="form.mallPrices.splice(i, 1)"></i>
</div>
</template>
</div>
</el-form-item>
<el-form-item class="req" label="产品简介" prop="briefIntroduction">
<el-input type="textarea" placeholder="请输入产品简介" v-model="form.mall.productIntroduction"></el-input>
<Editor api-key='rnk6zw9v267xqz7pf98twt1vmrvltmd436je7a642pckltda' v-model="form.mall.productIntroduction" :init="editorConfig" :disabled="isDetail" />
</el-form-item>
<el-form-item class="req" label="详情介绍" prop="briefIntroduction">
<Editor api-key='rnk6zw9v267xqz7pf98twt1vmrvltmd436je7a642pckltda' v-model="form.mall.detailedIntroduction" :init="editorConfig" />
<Editor api-key='rnk6zw9v267xqz7pf98twt1vmrvltmd436je7a642pckltda' v-model="form.mall.detailedIntroduction" :init="editorConfig" :disabled="isDetail" />
</el-form-item>
<el-form-item prop="file" label="产品参数">
<el-upload
:on-success="uploadSuccessFile"
:action="api.fileUploadNakadai"
:file-list="form.fileList"
:file-list="form.mallAnnex"
:headers="headers"
>
<el-button>上传文件</el-button>
@ -276,8 +287,8 @@
</el-col>
</el-row>
</el-form>
<div class="btns">
<el-button v-if="form.mall.isShelves" type="primary" @click="submit(0, 1)">保存并上架</el-button>
<div v-if="!isDetail" class="btns">
<el-button v-if="form.mall.isShelves" type="primary" @click="submit(0)">保存并上架</el-button>
<template v-else>
<el-button type="primary" @click="submit(0)">确认</el-button>
<el-button @click="submit(1)">保存草稿</el-button>
@ -307,7 +318,7 @@
<el-table-column label="操作" align="center" min-width="60">
<template slot-scope="scope">
<i v-if="scope.row.edit" class="el-icon-check edit" @click="submitClass(scope.row)"></i>
<!-- <i v-else class="el-icon-edit edit" @click="editClass(scope.row)"></i> -->
<i v-else class="el-icon-edit edit" @click="editClass(scope.row)"></i>
<i class="el-icon-delete del" @click="delClass(scope.row, scope.$index)"></i>
</template>
</el-table-column>
@ -338,7 +349,7 @@
<el-table-column label="操作" align="center" min-width="60">
<template slot-scope="scope">
<i v-if="scope.row.edit" class="el-icon-check edit" @click="submitLabel(scope.row)"></i>
<!-- <i v-else class="el-icon-edit edit" @click="editLabel(scope.row)"></i> -->
<i v-else class="el-icon-edit edit" @click="editLabel(scope.row)"></i>
<i class="el-icon-delete del" @click="delLabel(scope.row, scope.$index)"></i>
</template>
</el-table-column>
@ -365,16 +376,16 @@
</template>
</el-table-column>
<el-table-column prop="curriculumName" label="产品名称" min-width="150" align="center"></el-table-column>
</el-table>
<div class="pagination">
<el-pagination background layout="total, prev, pager, next" :total="total" @current-change="handleCurrentChange" :current-page="page">
</el-pagination>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="productVisible = false">取消</el-button>
<el-button type="primary" @click="submitProduct">确定</el-button>
</span>
</el-dialog>
</el-table>
<div class="pagination">
<el-pagination background layout="total, prev, pager, next" :total="total" @current-change="handleCurrentChange" :current-page="page">
</el-pagination>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="productVisible = false">取消</el-button>
<el-button type="primary" @click="submitProduct">确定</el-button>
</span>
</el-dialog>
</div>
</template>
@ -392,9 +403,9 @@ export default {
token: sessionStorage.getItem("token")
},
editorConfig,
isDetail: Boolean(this.$route.query.show),
isDetail: this.$route.query.show == 1,
id: this.$route.query.id || '',
form: {
id: this.$route.query.id,
supplierIds: [],
tagsIds: [],
typeIds: [],
@ -417,6 +428,7 @@ export default {
productName: '',
state: 1,
},
mallAnnex: [],
mallDisciplines: [
{
professionalClassList: [],
@ -429,15 +441,19 @@ export default {
mallPrices: [
{
area: 0,
cityId: '',
entryType: 0,
settlementPrice: '',
settlementPriceType: 0
settlementPriceType: 0,
discountRate: ''
},
{
area: 0,
cityId: '',
entryType: 0,
settlementPrice: '',
settlementPriceType: 1
settlementPriceType: 1,
discountRate: ''
}
],
},
@ -471,8 +487,12 @@ export default {
name: '折扣价'
}
],
searchTimer: null,
selectedProduct: false,
isData: false,
uploadList: [],
submiting: false,
pass: false,
updateTime: 0,
nameRepeat: false
};
@ -484,14 +504,38 @@ export default {
this.updateTime++
},
deep:true
},
productKeyword: function(val) {
clearTimeout(this.searchTimer);
this.searchTimer = setTimeout(() => {
this.initProduct();
}, 500);
}
},
//
beforeRouteLeave(to, from, next) {
if (this.submiting) {
next()
} else if (!this.pass) {
//
if (this.updateTime) {
this.$confirm(`所填写内容暂未保存,是否保存?`, '提示', {
type: 'warning'
}).then(() => {
this.submit(this.form.state, next)
}).catch(() => {
console.log(55)
next()
})
} else {
next()
}
} else {
next()
}
},
mounted() {
this.form.id && this.getData()
this.getCategory()
this.getLabel()
this.getClass()
this.getSupplier()
this.id ? this.getData() : this.getOp()
this.getSubject()
this.getProvince()
},
@ -500,25 +544,47 @@ export default {
},
methods: {
getData() {
this.$get(`${this.api.detailsOfGoods}?mallId=${this.form.id}`).then(res => {
this.$get(`${this.api.detailsOfGoods}?mallId=${this.id}`).then(res => {
const e = res.orderDetails
if (e.classificationIds && e.classificationIds.length) e.classificationIds = e.classificationIds[0]
if (e.typeIds && e.typeIds.length) e.typeIds = e.typeIds[0]
e.mall.interfaceDiagrams = e.mall.interfaceDiagram ? e.mall.interfaceDiagram.split(',') : []
e.mallAnnex.forEach(e => e.name = e.fileName)
this.form = e
this.getOp()
this.$nextTick(() => {
this.form.mallPrices.forEach(e => {
e.area && this.getCity(e)
})
this.form.mallDisciplines.forEach(e => {
this.$set(e, 'professionalClassList', [])
this.$set(e, 'professionalList', [])
this.getProfessionalClassData(e)
this.getProfessionalData(e)
e.categoryId && this.getProfessionalClassData(e)
e.professionalCategoryId && this.getProfessionalData(e)
})
setTimeout(() => {
this.updateTime = 0
}, 3000)
})
console.log("🚀 ~ file: index.vue:503 ~ this.$get ~ this.form:", this.form)
}).catch(err => {})
},
//
getOp() {
this.getCategory()
this.getLabel()
this.getClass()
this.getSupplier()
},
//
associatedProductChange(val) {
if (val === 1) {
const { mall } = this.form
mall.associatedProduct = ''
mall.associatedProductName = ''
this.selectedProduct = false
}
},
//
setProduct() {
this.productVisible = true
@ -528,6 +594,7 @@ export default {
getProduct() {
const active = this.productActive
const keyword = this.productKeyword
//
if (!active || active == 1) {
const sid = this.$store.state.dataPer.find(e => e.permissionName === '课程管理')
this.$post(this.api.curriculumList, {
@ -541,7 +608,7 @@ export default {
this.products = page.records
this.total = page.total
}).catch(err => {})
} else if (active == 2) {
} else if (active == 2) { //
this.$post(this.api.listByEntity,{
pageNum: this.page,
pageSize: this.pageSize,
@ -557,7 +624,7 @@ export default {
this.products = list
this.total = res.pageList.total
}).catch(res => {})
} else {
} else { //
this.$post(this.api.getValueModule + '?platformId=1').then(res => {
const list = res.valueList
list.forEach(e => {
@ -569,6 +636,10 @@ export default {
}).catch(err => {})
}
},
initProduct() {
this.page = 1
this.getProduct()
},
//
tabChange(i) {
this.page = 1
@ -588,10 +659,13 @@ export default {
const { form } = this
const { mall } = form
const active = this.productActive
this.selectedProduct = false
this.isData = false
//
if (!active || active == 1) {
this.$post(`${this.api.curriculumDetail}?cid=${id}`).then(({ data }) => {
form.supplierIds = data.supplier.split(',').map(e => +e)
this.selectedProduct = true
form.classificationIds = !data.curriculumType ? 2 : data.curriculumType
form.mallDisciplines = [{
professionalClassList: [],
@ -600,13 +674,28 @@ export default {
professionalId: data.professionalId,
professionalCategoryId: data.professionalCategoryId,
}]
form.mallPrices.find(e => e.settlementPriceType && e.area === 0).settlementPrice = data.settlementPrice
this.getProfessionalClassData(form.mallDisciplines[0])
this.getProfessionalData(form.mallDisciplines[0])
mall.courseHours = data.expectedCourse
mall.coverDrawing = data.coverUrl
mall.appletIcon = data.miniProgramPictureAddress
mall.productIntroduction = data.briefIntroduction
mall.marketUnitPrice = data.marketPrice
}).catch(err => {})
} else {
form.classificationIds = active == 2 ? 5 : 3
//
if (active == 2) {
const item = this.products.find(e => e.cid == id)
if (item) {
form.supplierIds = [+item.supplier]
this.selectedProduct = true
mall.marketUnitPrice = item.market
form.mallPrices.find(e => e.settlementPriceType && e.area === 0).settlementPrice = item.settlementPrice
this.isData = true
}
}
}
mall.associatedProduct = id
mall.associatedProductName = this.products.find(e => e.cid == id).curriculumName
@ -633,6 +722,15 @@ export default {
getLabel() {
this.$get(this.api.tagsList).then(res => {
this.labels = res.tagsList
const ids = []
this.form.tagsIds.forEach(item => {
this.labels.forEach(e => {
if (item == e.tagsId) {
ids.push(item)
}
})
})
this.form.tagsIds = ids
}).catch(err => {})
},
//
@ -667,12 +765,16 @@ export default {
}
},
//
submitLabel(row, showMsg = 1) {
async submitLabel(row, showMsg = 1) {
if (!row.tagsName) return Util.errorMsg('请输入主题名称')
this.$post(`${this.api.addTags}?tagsName=${row.tagsName}`).then(res => {
showMsg && Util.successMsg('新增成功')
this.getLabel()
}).catch(res => {})
row.tagsId ?
await this.$post(this.api.updateTags, {
tagsName: row.tagsName,
tagsId: row.tagsId
}) :
await this.$post(`${this.api.addTags}?tagsName=${row.tagsName}`)
showMsg && Util.successMsg(row.tagsId ? '修改成功' : '新增成功')
this.getLabel()
},
//
closeLabel() {
@ -699,7 +801,10 @@ export default {
//
getClass() {
this.$get(this.api.productTypeList).then(res => {
this.classifications = res.typeList
const list = res.typeList
const id = this.form.typeIds
if (id && !list.find(e => e.typeId == id)) this.form.typeIds = ''
this.classifications = list
}).catch(err => {})
},
//
@ -734,12 +839,16 @@ export default {
}
},
//
submitClass(row, showMsg = 1) {
async submitClass(row, showMsg = 1) {
if (!row.typeName) return Util.errorMsg('请输入分类名称')
this.$post(`${this.api.addProductType}?typeName=${row.typeName}`).then(res => {
showMsg && Util.successMsg((row.id ? '修改' : '新增') + '成功')
this.getClass()
}).catch(res => {})
row.typeId ?
await this.$post(this.api.updateProductType, {
typeName: row.typeName,
typeId: row.typeId
}) :
await this.$post(`${this.api.addProductType}?typeName=${row.typeName}`)
showMsg && Util.successMsg(row.typeId ? '修改成功' : '新增成功')
this.getClass()
},
//
closeClass() {
@ -820,17 +929,42 @@ export default {
addArea(type) {
this.form.mallPrices.push({
area: '',
cityId: '',
entryType: 0,
settlementPrice: '',
settlementPriceType: type
settlementPriceType: type,
discountRate: ''
})
},
//
calcSettlement(item) {
//
const unit = this.form.mall.marketUnitPrice
console.log("🚀 ~ file: index.vue:917 ~ calcSettlement ~ unit:", unit,item)
if (item.entryType && unit !== '') {
item.discountRate = item.settlementPrice / 10 * unit
}
},
//
handleUnit(item) {
return item.entryType ? '折' : this.isData ? '元/账号/年' : '元/年'
},
//
getProvince(){
this.$get(this.api.queryProvince).then(({ list }) => {
this.provinces = list
}).catch(res => {})
},
//
getCity(item, clear) {
this.$get(this.api.queryCity, {
provinceId: item.area
}).then(({ list }) => {
this.$set(item, 'cities', list)
if (clear) item.cityId = ''
}).catch(res => {})
},
handleExceed(files, fileList) { //
Util.warningMsg("当前限制选择 4 个文件,如需更换,请删除上一个文件再重新选择!");
@ -845,7 +979,14 @@ export default {
this.form.mall.interfaceDiagrams.push(res.data.filesResult.fileUrl)
},
uploadSuccessFile(res) { //
this.form.mall.appletIcon = res.data.filesResult.fileUrl;
const e = res.filesResult
this.form.mallAnnex = [{
mallId: this.id,
filePath: e.fileUrl,
fileName: e.originalFileName,
name: e.originalFileName,
}]
console.log(22, this.form)
},
uploadError(err, file, fileList) {
this.$message({
@ -863,8 +1004,8 @@ export default {
// this.form.mall.coverDrawing = ''
// }).catch(res => {});
},
submit(state, isShelves) {
const { form } = this
submit(state, next) {
const form = JSON.parse(JSON.stringify(this.form))
const { mall } = form
if (!mall.productName) return Util.errorMsg('请输入产品名称!')
if (!state) {
@ -893,6 +1034,8 @@ export default {
if (invalid) return
if (!mall.coverDrawing) return Util.errorMsg('请上传封面图!')
if (!mall.marketUnitPrice) return Util.errorMsg('请输入市场建议单价!')
if (form.mallPrices.find(e => !e.settlementPriceType && e.area === 0).settlementPrice === '') return Util.errorMsg('请输入厂商结算价!')
if (form.mallPrices.find(e => e.settlementPriceType && e.area === 0).settlementPrice === '') return Util.errorMsg('请输入平台结算价!')
if (!mall.productIntroduction) return Util.errorMsg('请输入产品简介!')
if (!mall.detailedIntroduction) return Util.errorMsg('请输入详情介绍!')
}
@ -900,47 +1043,45 @@ export default {
form.typeIds = [form.typeIds]
mall.interfaceDiagram = mall.interfaceDiagrams.join()
form.mall.state = state
if (isShelves) form.mall.isShelves = 0
form.mall.isShelves = state
if (this.submiting) return false
this.submiting = true
if (form.mall.mallId) {
this.$post(this.api.renewalOfGoods, form).then(res => {
this.submiting = false;
Util.successMsg("修改成功");
this.$router.back();
next ? next() : this.$router.back()
}).catch(err => {
this.submiting = false;
});
} else {
this.$post(this.api.addGoods, form).then(res => {
this.submiting = false;
Util.successMsg("修改成功");
this.$router.back();
Util.successMsg("新增成功");
next ? next() : this.$router.back()
}).catch(err => {
this.submiting = false;
});
}
},
//
backPage() {
this.$router.back()
},
//
back() {
const { id } = this.form
const updateTime = this.updateTime
this.pass = true
//
if ((id && updateTime > 2) || (!id && updateTime)) {
this.$confirm(`编辑的内容未保存,是否保存?`, '提示', {
type: 'warning'
if (this.updateTime) {
this.$confirm(`所填写内容暂未保存,是否保存?`, '提示', {
type: 'warning',
confirmButtonText: '是',
cancelButtonText: '否',
}).then(() => {
this.save()
this.submit(this.form.mall.state)
}).catch(() => {
this.backPage()
this.$router.back()
})
} else {
this.backPage()
this.$router.back()
}
}
},
}
};
</script>
@ -949,6 +1090,9 @@ export default {
.m-l-5 {
margin-left: 5px;
}
.m-l-20 {
margin-left: 20px;
}
.model {
height: calc(100vh - 350px);
overflow: auto;
@ -1045,8 +1189,13 @@ $avatar-width: 104px;
.subject {
padding: 10px;
border: 1px dashed #ccc;
&.mini {
width: 740px;
}
.line {
position: relative;
display: flex;
padding-right: 50px;
margin-bottom: 10px;
&:last-child {
margin-bottom: 0;
@ -1055,6 +1204,12 @@ $avatar-width: 104px;
.el-form-item {
margin-bottom: 0;
}
.del {
position: absolute;
top: 11px;
right: 20px;
cursor: pointer;
}
}
.subject-plus {
margin-top: 5px;

@ -45,11 +45,10 @@
</ul>
<div>
<el-button v-auth="'平台自建:新增'" type="primary" round @click="addCourse">新增</el-button>
<el-button v-auth="'平台自建:批量删除'" type="primary" round @click="delAllData">批量删除</el-button>
</div>
</div>
<el-table :data="list" class="table" ref="table" stripe header-align="center" @selection-change="handleSelectionChange" row-key="id">
<el-table :data="list" class="table" ref="table" stripe header-align="center" @selection-change="handleSelectionChange" row-key="id" @sort-change="sortChange">
<el-table-column type="selection" width="80" align="center" :reserve-selection="true"></el-table-column>
<el-table-column type="index" width="100" label="序号" align="center">
<template slot-scope="scope">
@ -58,21 +57,22 @@
</el-table-column>
<el-table-column prop="productName" label="产品名称" min-width="150" align="center"></el-table-column>
<el-table-column prop="supplierName" label="厂商" min-width="150" align="center"></el-table-column>
<el-table-column prop="classificationName" label="产品分类" min-width="150" align="center"></el-table-column>
<el-table-column prop="typeName" label="产品类型" min-width="150" align="center"></el-table-column>
<el-table-column prop="associatedProductName" label="关联产品" min-width="150" align="center"></el-table-column>
<el-table-column prop="courseName" label="状态" min-width="150" align="center">
<el-table-column prop="associatedProductName" label="关联产品" min-width="140" align="center"></el-table-column>
<el-table-column prop="courseName" label="状态" min-width="140" align="center">
<template slot-scope="scope">
{{ scope.row.isShelves ? '下架' : '上架' }}
</template>
</el-table-column>
<el-table-column prop="orderQuantity" label="订单量" min-width="150" align="center"></el-table-column>
<el-table-column prop="userName" label="最近编辑人" min-width="150" align="center"></el-table-column>
<el-table-column prop="courseName" label="精选" min-width="150" align="center">
<el-table-column prop="selected" label="精选" min-width="150" align="center" sortable="custom">
<template slot-scope="scope">
<i :class="['icon', scope.row.selected ? 'el-icon-check' : 'el-icon-close']" @click="selected(scope.row)"></i>
</template>
</el-table-column>
<el-table-column label="上架/下架" align="center">
<el-table-column label="上架/下架" align="center" width="90">
<template slot-scope="scope">
<el-switch
v-model="scope.row.isShelves"
@ -83,11 +83,14 @@
</el-switch>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="250">
<template v-if="scope.row.isShelves" slot-scope="scope">
<el-button v-auth="'平台自建:编辑信息'" type="text" @click="editCourse(scope.row)">编辑</el-button>
<el-table-column label="操作" align="center" width="120">
<template slot-scope="scope">
<template v-if="scope.row.isShelves">
<el-button v-auth="'平台自建:编辑信息'" type="text" @click="edit(scope.row)">编辑</el-button>
<el-button v-auth="'平台自建:删除'" type="text" @click="handleDelete(scope.row)">删除</el-button>
</template>
<el-button v-else v-auth="'平台自建:编辑信息'" type="text" @click="edit(scope.row, 1)">查看</el-button>
</template>
</el-table-column>
</el-table>
<div class="pagination">
@ -98,13 +101,14 @@
</template>
<script>
import util from "@/libs/util";
import Util from "@/libs/util";
import Setting from '@/setting'
export default {
data() {
return {
timer: null,
form: {
sort: 0,
categoryId: '',
productClassification: '',
productName: '',
@ -140,7 +144,6 @@ export default {
this.$post(this.api.listOfGoods, {
pageNum: this.page,
pageSize: this.pageSize,
sort: 0,
...this.form
}).then(({ page }) => {
this.list = page.records;
@ -153,7 +156,6 @@ export default {
this.getData();
},
//
getCategory() {
this.$get(this.api.productCategoryList).then(res => {
@ -211,8 +213,8 @@ export default {
addCourse() {
this.$router.push("/shop/addProduct");
},
editCourse(row) {
this.$router.push(`/shop/addProduct?id=${row.mallId}`);
edit(row, show = 0) {
this.$router.push(`/shop/addProduct?id=${row.mallId}&show=${show}`)
},
handleDelete(row) {
this.$confirm("此删除操作不可逆,是否确认删除选中项?", "提示", {
@ -220,7 +222,7 @@ export default {
})
.then(() => {
this.$post(this.api.deletionOfGoods, row.mallId).then(res => {
util.successMsg("删除成功");
Util.successMsg("删除成功");
this.initData();
}).catch(res => {
});
@ -244,14 +246,14 @@ export default {
})
this.$post(`${this.api.delTheoreticalCourse}?${data.join('&')}`).then(res => {
this.$refs.table.clearSelection();
util.successMsg("删除成功");
Util.successMsg("删除成功");
this.initData();
}).catch(res => {
});
}).catch(() => {
});
} else {
util.errorMsg("请先选择数据 !");
Util.errorMsg("请先选择数据 !");
}
},
handleCurrentChange(val) {
@ -259,18 +261,72 @@ export default {
this.getData();
},
//
changeSwitch(value, row) {
this.$post(`${this.api.goodsOffTheShelf}?mallId=${row.mallId}&isShelves=${value}`).then((res) => {
this.getData();
}).catch((res) => {
});
async changeSwitch(value, row) {
const res = await this.$get(`${this.api.detailsOfGoods}?mallId=${row.mallId}`)
const form = res.orderDetails
const { mall } = form
let err
let disErr
for (const e of form.mallDisciplines) {
if (!e.categoryId) {
disErr = '请选择学科类别!'
break
}
if (!e.professionalCategoryId) {
disErr = '请选择专业类!'
break
}
if (!e.professionalId) {
disErr = '请选择专业!'
break
}
}
if (!mall.isAssociatedProduct && !mall.associatedProduct) {
err = '请选择产品!'
} else if (!form.classificationIds.length) {
err = '请选择产品分类!'
} else if (!form.typeIds.length) {
err = '请选择产品类型!'
} else if (!form.supplierIds.length) {
err = '请选择供应厂商!'
} else if (disErr) {
err = disErr
} else if (!mall.coverDrawing) {
err = '请上传封面图!'
} else if (!mall.marketUnitPrice) {
err = '请输入市场建议单价!'
} else if (form.mallPrices.find(e => !e.settlementPriceType && e.area === 0).settlementPrice === '') {
err = '请输入厂商结算价!'
} else if (form.mallPrices.find(e => e.settlementPriceType && e.area === 0).settlementPrice === '') {
err = '请输入平台结算价!'
} else if (!mall.productIntroduction) {
err = '请输入产品简介!'
} else if (!mall.detailedIntroduction) {
err = '请输入详情介绍!'
}
if (err) {
Util.errorMsg('无法上架!' + err)
row.isShelves = 1
return
}
this.$post(`${this.api.goodsOffTheShelf}?mallId=${row.mallId}&isShelves=${value}`).then((res) => {
this.getData()
}).catch((res) => {})
},
//
selected(row) {
this.$post(`${this.api.goodsSelection}?mallId=${row.mallId}&selected=${row.selected ? 0 : 1}`).then((res) => {
this.getData();
}).catch((res) => {})
},
//
sortChange(column) {
const { order } = column
if (column.prop === 'selected') {
this.form.sort = order ? order === 'ascending' ? 4 : 3 : 0
}
this.getData()
},
}
};
</script>

Loading…
Cancel
Save