Commit 7e826a4e by 前端

更新月底版本代码

1 parent 00736a2f
...@@ -63,11 +63,22 @@ const getCaseDetailApi = params => { ...@@ -63,11 +63,22 @@ const getCaseDetailApi = params => {
}) })
} }
const topCaseApi = params => {
params.method = 'scrm.api.shopmall.discover.case.updateToTop'
return http({
url,
method: 'post',
data: params,
sign: true
})
}
export default { export default {
getCaseListApi, getCaseListApi,
getVideoListApi, getVideoListApi,
delCaseApi, delCaseApi,
addCaseApi, addCaseApi,
getCarSeriesApi, getCarSeriesApi,
getCaseDetailApi getCaseDetailApi,
topCaseApi
} }
\ No newline at end of file \ No newline at end of file
...@@ -75,6 +75,62 @@ const getMerchantListApi = params => { ...@@ -75,6 +75,62 @@ const getMerchantListApi = params => {
}) })
} }
const getBrowseListApi = params => {
params.method = 'scrm.api.shopmall.discover.goods.browse.records'
return http({
url,
method: 'post',
data: params,
sign: true
})
}
const getVisitorListApi = params => {
params.method = 'scrm.api.shopmall.discover.goods.visitor.records'
return http({
url,
method: 'post',
data: params,
sign: true
})
}
const getSharedListApi = params => {
params.method = 'scrm.api.shopmall.discover.goods.shared.records'
return http({
url,
method: 'post',
data: params,
sign: true
})
}
const exportBrowseApi = (params, TYPE = 1) => {
//TYPE 1 浏览 2 访客 3 分享
params.method = {
1: 'scrm.api.shopmall.discover.goods.browse.records.export',
2: 'scrm.api.shopmall.discover.goods.visitor.records.export',
3: 'scrm.api.shopmall.discover.goods.shared.records.export'
}[TYPE]
return http({
url,
method: 'POST',
data: params,
sign: true
})
}
const exportGoodsApi = params => {
params.method = 'scrm.api.shopmall.goods.configuration.export'
return http({
url,
method: 'post',
data: params,
sign: true
})
}
export default { export default {
getGoodsListApi, getGoodsListApi,
updateGoodsStatusApi, updateGoodsStatusApi,
...@@ -82,5 +138,10 @@ export default { ...@@ -82,5 +138,10 @@ export default {
getCarlifeGoodsApi, getCarlifeGoodsApi,
addGoodsApi, addGoodsApi,
getGoodsDetail, getGoodsDetail,
getMerchantListApi getMerchantListApi,
getBrowseListApi,
getVisitorListApi,
getSharedListApi,
exportBrowseApi,
exportGoodsApi
} }
\ No newline at end of file \ No newline at end of file
...@@ -29,8 +29,47 @@ function limitPrice(newValue, oldValue, intergerDigit, pointDigit, minValue, max ...@@ -29,8 +29,47 @@ function limitPrice(newValue, oldValue, intergerDigit, pointDigit, minValue, max
} else { } else {
return newValue ? oldValue : '' return newValue ? oldValue : ''
} }
};
function getExplorer() {
var ua = navigator.userAgent.toLocaleLowerCase()
var browserType = null
if (ua.match(/msie/) != null || ua.match(/trident/) != null) {
browserType = 'IE'
} else if (ua.match(/firefox/) != null) {
browserType = '火狐'
} else if (ua.match(/ubrowser/) != null) {
browserType = 'UC'
} else if (ua.match(/opera/) != null) {
browserType = '欧朋'
} else if (ua.match(/bidubrowser/) != null) {
browserType = '百度'
} else if (ua.match(/metasr/) != null) {
browserType = '搜狗'
} else if (ua.match(/tencenttraveler/) != null || ua.match(/qqbrowse/) != null) {
browserType = 'QQ'
} else if (ua.match(/maxthon/) != null) {
browserType = '遨游'
} else {
browserType = '谷歌'
}
return browserType
}
function exportFn(url) {
let browserType = getExplorer()
if (browserType == 'QQ') {
window.open(url)
return
}
let iframe = document.createElement('iframe')
iframe.style.display = 'none'
iframe.src = url
document.body.appendChild(iframe)
} }
const orderManageStatusList = [ const orderManageStatusList = [
{ confId: '1', confName: '未支付' }, { confId: '1', confName: '未支付' },
{ confId: '2', confName: '已支付' }, { confId: '2', confName: '已支付' },
...@@ -149,6 +188,8 @@ const stateList = [{ ...@@ -149,6 +188,8 @@ const stateList = [{
}, },
] ]
export { export {
limitPrice, limitPrice,
orderManageStatusList, orderManageStatusList,
...@@ -159,5 +200,7 @@ export { ...@@ -159,5 +200,7 @@ export {
memberTypeList, memberTypeList,
stateList, stateList,
orderTypesList, orderTypesList,
orderStatusList orderStatusList,
getExplorer,
exportFn
} }
\ No newline at end of file \ No newline at end of file
...@@ -60,6 +60,17 @@ ...@@ -60,6 +60,17 @@
buttonList: [ buttonList: [
{ {
type: 'el-button', type: 'el-button',
name: '置顶',
attrs: {
type: 'text',
fn: '置顶'
},
listeners: {
click: row => this.topFn(row.scope)
}
},
{
type: 'el-button',
name: '预览', name: '预览',
attrs: { attrs: {
type: 'text', type: 'text',
...@@ -159,11 +170,29 @@ ...@@ -159,11 +170,29 @@
created() {}, created() {},
mounted() {}, mounted() {},
methods: { methods: {
topFn({id, caseName}){
const h = this.$createElement
this.$confirm(h('div', [h('div',{ style: 'font-size: 18px;color:#333,margin-bottom:4px;margin-top:8px' }, '是否确定将此案例置顶?'),h('p', { style: 'color:#666;margin-top:4px' },'置顶后的案例会在小程序端优先置顶展示')]), '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: action => {
if (action == 'confirm') {
this.$apis.case.topCaseApi({id}).then(res => {
if(res){
this.$message.success('置顶成功')
this.handleSearch()
}
})
}
}
})
},
filterBrand({brandList}){ filterBrand({brandList}){
return brandList?.map(item => item.brandName) || [] return brandList?.map(item => item.brandName) || []
}, },
previewFn(row){ previewFn(row){
console.log(this.previewVideoUrl)
this.previewVideoUrl = row?.mediaInfo?.mediaUrl this.previewVideoUrl = row?.mediaInfo?.mediaUrl
this.previewVideoVisible = true this.previewVideoVisible = true
}, },
...@@ -236,4 +265,3 @@ ...@@ -236,4 +265,3 @@
} }
</style> </style>
\ No newline at end of file \ No newline at end of file
<template> <template>
<div class="goods-ctnr"> <div class="goods-ctnr">
<div class="global-title">{{!routeInfo.id ? '新增': disabled ? '查看' : '编辑'}}商品</div> <div class="global-title">{{ !routeInfo.id ? '新增' : disabled ? '查看' : '编辑' }}商品</div>
<div class="container"> <div class="container">
<glsx-combi-form :isInline="false" class="glsx-combi-form" ref="baseInfoRef" labelWidth="154px" defaultWidth="432px" :formObj.sync="formObj" :formData="formData" :formRules="myRule"> <glsx-combi-form :isInline="false" class="glsx-combi-form" ref="baseInfoRef" labelWidth="154px"
defaultWidth="432px" :formObj.sync="formObj" :formData="formData" :formRules="myRule">
<div slot="selectGoodsSlot"> <div slot="selectGoodsSlot">
<el-button :class="['el-icon-plus', {'disabled-class':disabled}]" size="small" @click="openGoodsDialog">{{formObj.smartcarlifeInfoId ? '重新选择': '选择商品'}}</el-button> <el-button :class="['el-icon-plus', {'disabled-class':disabled}]" size="small" @click="openGoodsDialog">
{{ formObj.smartcarlifeInfoId ? '重新选择' : '选择商品' }}
</el-button>
</div> </div>
<div slot="goodsInfoSlot" class="goods-wrap"> <div slot="goodsInfoSlot" class="goods-wrap">
<glsx-combi-form :isInline="false" ref="goodsInfoRef" labelWidth="154px" defaultWidth="432px" :formObj.sync="formObj" :formData="goodsFormData" :formRules="goodsRule"> <glsx-combi-form :isInline="false" ref="goodsInfoRef" labelWidth="154px" defaultWidth="432px"
:formObj.sync="formObj" :formData="goodsFormData" :formRules="goodsRule">
<div slot="uploadSlot" class="upload-calss"> <div slot="uploadSlot" class="upload-calss">
<glsx-preview :picOptions="posterOptions" :imageUrlArr="formObj.coverList" @change="changeChannelImg"></glsx-preview> <glsx-preview :picOptions="posterOptions" :imageUrlArr="formObj.coverList"
@change="changeChannelImg"></glsx-preview>
<span class="tip">建议尺寸750*750,图片格式为jpg,jpeg,png,大小2M以内</span> <span class="tip">建议尺寸750*750,图片格式为jpg,jpeg,png,大小2M以内</span>
</div> </div>
</glsx-combi-form> </glsx-combi-form>
...@@ -27,15 +32,18 @@ ...@@ -27,15 +32,18 @@
<div slot="saleStoreSlot"> <div slot="saleStoreSlot">
<el-button v-if="!disabled" class="el-icon-plus" size="small" @click="closeDialog">选择门店</el-button> <el-button v-if="!disabled" class="el-icon-plus" size="small" @click="closeDialog">选择门店</el-button>
<template v-if="saleMerchantList && saleMerchantList.length"> <template v-if="saleMerchantList && saleMerchantList.length">
<GLTable class="selected-table" :hasPage="false" ref="selectedRef" :tableParams="selectedtableParams" :tableData="saleMerchantList"> <GLTable class="selected-table" :hasPage="false" ref="selectedRef" :tableParams="selectedtableParams"
:tableData="saleMerchantList">
<div slot="activityPriceSlot" slot-scope="scope"> <div slot="activityPriceSlot" slot-scope="scope">
<format-input :disabled="disabled" :intDigit="6" :precise="2" placeholder="请输入" v-model="scope.scope.activityPrice"></format-input> <format-input :disabled="disabled" :intDigit="6" :precise="2" placeholder="请输入"
v-model="scope.scope.activityPrice"></format-input>
</div> </div>
<div slot="originalPriceSlot" slot-scope="scope"> <div slot="originalPriceSlot" slot-scope="scope">
<format-input :disabled="disabled" :intDigit="6" :precise="2" placeholder="请输入" v-model="scope.scope.originalPrice"></format-input> <format-input :disabled="disabled" :intDigit="6" :precise="2" placeholder="请输入"
v-model="scope.scope.originalPrice"></format-input>
</div> </div>
<div slot="retainagePriceSlot" slot-scope="scope"> <div slot="retainagePriceSlot" slot-scope="scope">
{{ retainagePriceFn(scope.scope.activityPrice) }} {{ retainagePriceFn(scope.scope.activityPrice) }}videoUrl
</div> </div>
<div slot="auth-button" slot-scope="scope"> <div slot="auth-button" slot-scope="scope">
<el-button v-if="!disabled" type="text" @click="handleDel(scope.scope)">删除</el-button> <el-button v-if="!disabled" type="text" @click="handleDel(scope.scope)">删除</el-button>
...@@ -43,20 +51,53 @@ ...@@ -43,20 +51,53 @@
</GLTable> </GLTable>
</template> </template>
</div> </div>
<div slot="productVideoSlot">
<el-form-item label="">
<template v-if="!formObj.goodsVideo">
<div class="upload-img">
<i class="el-icon-plus avatar-uploader-desc-icon"></i>
<div class="avatar-uploader-desc-word">上传视频</div>
<input type="file" class="upload-video" style="opacity: 0" accept=".mp4"
@change="e => handleVideoChange(e)"/>
</div>
</template>
<template v-else>
<div class="video-box">
<video id="video" width="100%" height="100%" preload loop muted>
<source :src="formObj.goodsVideo" type="video/mp4"/>
</video>
<div class="mask">
<div class="video-pane-close" @click="handleEnlarge(formObj.goodsVideo, 'video')">
<img src="../../assets/channel/view.png" alt=""/>
</div>
<div class="video-pane-close" @click="close('radio')">
<img src="../../assets/channel/dele.png" alt=""/>
</div>
</div>
</div>
</template>
<div class="text-tip2">作为商品详情页顶部展示和详情展示,格式建议mp4,大小不超过20M</div>
</el-form-item>
</div>
<div slot="carSeriesSlot"> <div slot="carSeriesSlot">
<el-radio-group :disabled="disabled" v-model="formObj.vehicleSeriesType"> <el-radio-group :disabled="disabled" v-model="formObj.vehicleSeriesType">
<el-radio :label="1">全部</el-radio> <el-radio :label="1">全部</el-radio>
<el-radio :label="2">部分</el-radio> <el-radio :label="2">部分</el-radio>
</el-radio-group> </el-radio-group>
<div v-if="formObj.vehicleSeriesType == 2"> <div v-if="formObj.vehicleSeriesType == 2">
<el-button type="default" v-if="!disabled" class="el-icon-plus" @click="handleCarSeriesClose">选择车系</el-button> <el-button type="default" v-if="!disabled" class="el-icon-plus" @click="handleCarSeriesClose">选择车系
</el-button>
<div class="car-series-wrap" v-if="vehicleSeriesRequestList && vehicleSeriesRequestList.length"> <div class="car-series-wrap" v-if="vehicleSeriesRequestList && vehicleSeriesRequestList.length">
<div class="car-series-item" v-for="item in vehicleSeriesRequestList" :key="item.vehicleSeriesId">{{ item.vehicleSeriesName }}</div> <div class="car-series-item" v-for="item in vehicleSeriesRequestList" :key="item.vehicleSeriesId">
{{ item.vehicleSeriesName }}
</div>
</div> </div>
</div> </div>
</div> </div>
<div slot="categorySlot"> <div slot="categorySlot">
<brandCascader :curInfo="curCategoryInfo" :disabled="disabled" @clickItem="selectCategory" class="category-class"></brandCascader> <brandCascader :curInfo="curCategoryInfo" :disabled="disabled" @clickItem="selectCategory"
class="category-class"></brandCascader>
</div> </div>
</glsx-combi-form> </glsx-combi-form>
</div> </div>
...@@ -64,9 +105,17 @@ ...@@ -64,9 +105,17 @@
<el-button @click="handleCancel">取消</el-button> <el-button @click="handleCancel">取消</el-button>
<el-button v-if="!disabled" type="primary" @click="handleSave">确定</el-button> <el-button v-if="!disabled" type="primary" @click="handleSave">确定</el-button>
</GLFooter> </GLFooter>
<selectCarDialog v-if="carDialogVisible" :echoData="vehicleSeriesRequestList" @handleClose="handleCarSeriesClose" @handleConfirm="handleConfirm" :dialogVisible="carDialogVisible"></selectCarDialog> <selectCarDialog v-if="carDialogVisible" :echoData="vehicleSeriesRequestList" @handleClose="handleCarSeriesClose"
<selectGoods v-if="goodsVisible" :routeInfo="routeInfo" :dialogVisible="goodsVisible" @handleGoodsConfirm="handleGoodsConfirm" @handleGoodsClose="handleGoodsClose"></selectGoods> @handleConfirm="handleConfirm" :dialogVisible="carDialogVisible"></selectCarDialog>
<selectMerchantDialog @confirmDialog="confirmDialog" @closeDialog="closeDialog" :goodsId="formObj.smartcarlifeInfoId" :selectedList="saleMerchantList" v-if="merchantDialogVisible" :isVisible="merchantDialogVisible"></selectMerchantDialog> <selectGoods v-if="goodsVisible" :routeInfo="routeInfo" :dialogVisible="goodsVisible"
@handleGoodsConfirm="handleGoodsConfirm" @handleGoodsClose="handleGoodsClose"></selectGoods>
<selectMerchantDialog @confirmDialog="confirmDialog" @closeDialog="closeDialog"
:goodsId="formObj.smartcarlifeInfoId" :selectedList="saleMerchantList"
v-if="merchantDialogVisible" :isVisible="merchantDialogVisible"></selectMerchantDialog>
<el-dialog class="image-dialog" :visible.sync="dialogVisibleImg" width="50%">
<img :src="dialogSrc" width="100%" v-if="dialogType == 'img'" />
<video width="100%" autoplay controls :src="dialogSrc" v-else></video>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
...@@ -90,7 +139,7 @@ const MerchantColumns = [ ...@@ -90,7 +139,7 @@ const MerchantColumns = [
width: 150, width: 150,
addHtml: 'retainagePriceSlot' addHtml: 'retainagePriceSlot'
} }
] ]
const notPriceColumns = [ const notPriceColumns = [
{ {
...@@ -111,6 +160,7 @@ import brandCascader from './components/brandCascader' ...@@ -111,6 +160,7 @@ import brandCascader from './components/brandCascader'
import selectGoods from './components/selectGoods' import selectGoods from './components/selectGoods'
import selectCarDialog from '@/views/store/components/selectCarDialog' import selectCarDialog from '@/views/store/components/selectCarDialog'
import selectMerchantDialog from './components/selectMerchantDialog' import selectMerchantDialog from './components/selectMerchantDialog'
export default { export default {
name: 'add', name: 'add',
components: { components: {
...@@ -120,12 +170,12 @@ export default { ...@@ -120,12 +170,12 @@ export default {
selectCarDialog, selectCarDialog,
selectMerchantDialog selectMerchantDialog
}, },
watch:{ watch: {
'formObj.paymentType':{ 'formObj.paymentType': {
handler(nVal, oVal){ handler(nVal, oVal) {
if(nVal==1) { if (nVal == 1) {
this.selectedtableParams.tableColumns = notPriceColumns this.selectedtableParams.tableColumns = notPriceColumns
}else{ } else {
this.selectedtableParams.tableColumns = MerchantColumns this.selectedtableParams.tableColumns = MerchantColumns
} }
}, },
...@@ -134,24 +184,26 @@ export default { ...@@ -134,24 +184,26 @@ export default {
}, },
data() { data() {
return { return {
dialogVisibleImg:false,
goodsVisible: false, goodsVisible: false,
carDialogVisible: false, carDialogVisible: false,
merchantDialogVisible: false, merchantDialogVisible: false,
disabled: false, disabled: false,
dialogSrc:'',
goodsInfo: {}, goodsInfo: {},
routeInfo: {}, routeInfo: {},
defaultProps:{ defaultProps: {
children: 'categoryName', children: 'categoryName',
label: 'childs' label: 'childs'
}, },
curCategoryInfo:{}, curCategoryInfo: {},
posterOptions: { posterOptions: {
width: '104px', width: '104px',
height: '104px', height: '104px',
key: 'posterImg', key: 'posterImg',
isClose: true isClose: true
}, },
goodsFormData:[ goodsFormData: [
{ {
label: '商品图', label: '商品图',
addHtml: 'uploadSlot', addHtml: 'uploadSlot',
...@@ -176,7 +228,7 @@ export default { ...@@ -176,7 +228,7 @@ export default {
type: 'showTxt' type: 'showTxt'
}, },
], ],
formObj:{ formObj: {
smartcarlifeInfoId: '', smartcarlifeInfoId: '',
goodsName: '', goodsName: '',
goodsType: '1', goodsType: '1',
...@@ -187,19 +239,20 @@ export default { ...@@ -187,19 +239,20 @@ export default {
paymentType: 1, paymentType: 1,
depositPrice: '', depositPrice: '',
vehicleSeriesType: 1, vehicleSeriesType: 1,
goodsVideo: '',
associationClassifyFirstId: '', associationClassifyFirstId: '',
associationClassifySecondId: '' associationClassifySecondId: ''
}, },
saleMerchantList:[], saleMerchantList: [],
vehicleSeriesRequestList: [], vehicleSeriesRequestList: [],
myRule: { myRule: {
selectGoodsName: [ selectGoodsName: [
{ {
required: true, required: true,
validator: (rule, value, callback) => { validator: (rule, value, callback) => {
if(!this.formObj.smartcarlifeInfoId){ if (!this.formObj.smartcarlifeInfoId) {
callback(new Error('请选择商品')) callback(new Error('请选择商品'))
}else{ } else {
callback() callback()
} }
}, },
...@@ -209,11 +262,11 @@ export default { ...@@ -209,11 +262,11 @@ export default {
goodsInfoName: [{ goodsInfoName: [{
required: true, required: true,
validator: (rule, value, callback) => { validator: (rule, value, callback) => {
if(!this.formObj.coverList && !this.formObj.coverList[0]){ if (!this.formObj.coverList && !this.formObj.coverList[0]) {
callback(new Error('请上传商品图')) callback(new Error('请上传商品图'))
}else if(!this.formObj.goodsName){ } else if (!this.formObj.goodsName) {
callback(new Error('请输入商品名称')) callback(new Error('请输入商品名称'))
}else{ } else {
callback() callback()
} }
}, },
...@@ -222,9 +275,9 @@ export default { ...@@ -222,9 +275,9 @@ export default {
paymentType: [{ paymentType: [{
required: true, required: true,
validator: (rule, value, callback) => { validator: (rule, value, callback) => {
if(this.formObj.paymentType == 2 && !this.formObj.depositPrice){ if (this.formObj.paymentType == 2 && !this.formObj.depositPrice) {
callback(new Error('请输入定金金额')) callback(new Error('请输入定金金额'))
}else{ } else {
callback() callback()
} }
this.validateField('saleStore') this.validateField('saleStore')
...@@ -246,15 +299,15 @@ export default { ...@@ -246,15 +299,15 @@ export default {
let minSellPrice = this.formObj.minSellPrice || 0 let minSellPrice = this.formObj.minSellPrice || 0
return (+activityPrice > +originalPrice || +originalPrice < minSellPrice) return (+activityPrice > +originalPrice || +originalPrice < minSellPrice)
}) })
if(!this.saleMerchantList.length){ if (!this.saleMerchantList.length) {
callback(new Error('请选择门店')) callback(new Error('请选择门店'))
}else if(target){ } else if (target) {
callback(new Error('门店活动价和原价不能为空')) callback(new Error('门店活动价和原价不能为空'))
}else if(this.formObj.paymentType == 2 && hasNegTarget){ } else if (this.formObj.paymentType == 2 && hasNegTarget) {
callback(new Error('活动价不能小于定金')) callback(new Error('活动价不能小于定金'))
}else if(hasTarget){ } else if (hasTarget) {
callback(new Error('原价不能小于最低售价和活动价')) callback(new Error('原价不能小于最低售价和活动价'))
}else{ } else {
callback() callback()
} }
}, },
...@@ -263,9 +316,9 @@ export default { ...@@ -263,9 +316,9 @@ export default {
carSeriesName: [{ carSeriesName: [{
required: true, required: true,
validator: (rule, value, callback) => { validator: (rule, value, callback) => {
if(this.formObj.vehicleSeriesType == 2 && !this.vehicleSeriesRequestList.length){ if (this.formObj.vehicleSeriesType == 2 && !this.vehicleSeriesRequestList.length) {
callback(new Error('请选择适用车系')) callback(new Error('请选择适用车系'))
}else{ } else {
callback() callback()
} }
}, },
...@@ -274,16 +327,16 @@ export default { ...@@ -274,16 +327,16 @@ export default {
categoryName: [{ categoryName: [{
required: true, required: true,
validator: (rule, value, callback) => { validator: (rule, value, callback) => {
if(!this.formObj.associationClassifyFirstId || !this.formObj.associationClassifySecondId){ if (!this.formObj.associationClassifyFirstId || !this.formObj.associationClassifySecondId) {
callback(new Error('请选择关联商品分类')) callback(new Error('请选择关联商品分类'))
}else{ } else {
callback() callback()
} }
}, },
trigger: 'change' trigger: 'change'
}], }],
}, },
formData:[ formData: [
{ {
label: '选择商品', label: '选择商品',
name: 'selectGoodsName', name: 'selectGoodsName',
...@@ -309,6 +362,42 @@ export default { ...@@ -309,6 +362,42 @@ export default {
addHtml: 'saleStoreSlot' addHtml: 'saleStoreSlot'
}, },
{ {
label: '产品视频',
name: 'productVideo',
addHtml: 'productVideoSlot'
},
// {
// label: '产品视频',
// name: 'activityVideoList',
// type: 'upload',
// uploadType: 'video',
// suffixSlot: 'activityVideos',
// // tips: '大图下可以展示视频,不上传则不显示',
// limitSize: 20,
// maxPhotoNum: 1,
// handleDelete: idx => {
// this.formObj.activityVideoList = ''
// },
// handleUpload: (e, file, targetItem) => {
// const imgFile = e.target.result
// const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1]
// const fileSuffix = file.name.split('.')[file.name.split('.').length - 1]
// if (fileSuffix.toLowerCase() != 'mp4') {
// this.$message.error('上传视频不是MP4的格式!')
// return true
// }
// this.loading = true
// this.$apis.common
// .uploadVideoApi({ file: base64 })
// .then(res => {
// this.formObj.activityVideoList = res
// })
// .finally(() => {
// this.loading = false
// })
// }
// },
{
label: '适用车系', label: '适用车系',
name: 'carSeriesName', name: 'carSeriesName',
addHtml: 'carSeriesSlot', addHtml: 'carSeriesSlot',
...@@ -328,68 +417,138 @@ export default { ...@@ -328,68 +417,138 @@ export default {
} }
} }
}, },
created(){ created() {
// this.getCategory() // this.getCategory()
const urlParam = this.$route.params const urlParam = this.$route.params
this.routeInfo = JSON.parse(decodeURIComponent(urlParam.id)) this.routeInfo = JSON.parse(decodeURIComponent(urlParam.id))
const { id, type } = this.routeInfo const {id, type} = this.routeInfo
if(type == 1) { if (type == 1) {
this.disabled = true this.disabled = true
this.posterOptions.isClose = false this.posterOptions.isClose = false
const _target = this.goodsFormData.find(item => item.name == 'goodsName') const _target = this.goodsFormData.find(item => item.name == 'goodsName')
_target.isDisabled = true _target.isDisabled = true
this.selectedtableParams.tableOption = null this.selectedtableParams.tableOption = null
} }
if(id){ if (id) {
this.getDetail() this.getDetail()
} }
}, },
methods:{ methods: {
validateField(field){ // 上传视频
if(Array.isArray(field)){ handleVideoChange(e) {
let file = e.srcElement.files[0]
var reader = new FileReader()
// 默认30MB
const limitSize = 20
const isLt = file.size / 1024 / 1024 < limitSize
if (!isLt) {
this.$message.error('上传视频大小不能超过' + limitSize + 'MB!')
this.loading = false
return
}
this.$notify({
title: '提示',
message: '视频上传中,请稍后'
})
document.querySelector('.upload-video').value = ''
reader.readAsDataURL(file)
reader.onload = e => {
const videoFile = e.target.result
const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + videoFile.split(',')[1]
this.$apis.common.uploadVideoApi({file: base64}).then(res => {
if (res) {
this.$notify({
title: '提示',
message: '视频上传成功',
type: 'success'
})
this.loading = false
this.formObj.goodsVideo = res
} else {
this.loading = false
}
})
}
},
// 预览图文
handleEnlarge(src, type) {
this.dialogVisibleImg = true
this.dialogSrc = src
this.dialogType = type ? type : 'img'
},
// 删除图片/视频
close(type, index) {
switch (type) {
case 'radio':
this.formObj.goodsVideo = ''
break
default:
this.formObj.goodsVideo = ''
}
},
validateField(field) {
if (Array.isArray(field)) {
field.forEach(item => { field.forEach(item => {
this.$refs.baseInfoRef.$refs.formRef.validateField(item) this.$refs.baseInfoRef.$refs.formRef.validateField(item)
}) })
}else{ } else {
this.$refs.baseInfoRef.$refs.formRef.validateField(field) this.$refs.baseInfoRef.$refs.formRef.validateField(field)
} }
}, }
retainagePriceFn(price){ ,
let depositPrice = this.formObj.paymentType==1 ? 0 : this.formObj.depositPrice retainagePriceFn(price) {
if(this.formObj.paymentType==1) return '--' let depositPrice = this.formObj.paymentType == 1 ? 0 : this.formObj.depositPrice
if(!price){ if (this.formObj.paymentType == 1) return '--'
if (!price) {
return '待计算' return '待计算'
}else{ } else {
return Number((price - depositPrice).toFixed(2)) return Number((price - depositPrice).toFixed(2))
} }
}, }
openGoodsDialog(){ ,
if(this.disabled) return openGoodsDialog() {
if (this.disabled) return
this.goodsVisible = true this.goodsVisible = true
}, }
handleGoodsClose(){ ,
handleGoodsClose() {
this.goodsVisible = false this.goodsVisible = false
}, }
handleGoodsConfirm(e){ ,
if(this.formObj.smartcarlifeInfoId!=e?.id) this.saleMerchantList = [] handleGoodsConfirm(e) {
let { id: smartcarlifeInfoId, goodsName, goodsImage, minSellPrice, retailPrice } = e || {}
minSellPrice = minSellPrice ? Number(Number(minSellPrice/100).toFixed(2)) : 0 if (this.formObj.smartcarlifeInfoId != e?.id) this.saleMerchantList = []
retailPrice = retailPrice ? Number(Number(retailPrice/100).toFixed(2)) : 0 let {id: smartcarlifeInfoId, goodsName, goodsImage, minSellPrice, retailPrice,goodsVideo} = e || {}
this.formObj = {...this.formObj, smartcarlifeInfoId, goodsName, goodsImage, coverList: [goodsImage], minSellPrice, retailPrice} minSellPrice = minSellPrice ? Number(Number(minSellPrice / 100).toFixed(2)) : 0
retailPrice = retailPrice ? Number(Number(retailPrice / 100).toFixed(2)) : 0
// 若选择的商品素材包含了视频,则带入对应的视频文件
if (goodsVideo) this.formObj.goodsVideo = goodsVideo
this.formObj = {
...this.formObj,
smartcarlifeInfoId,
goodsName,
goodsImage,
coverList: [goodsImage],
minSellPrice,
retailPrice
}
this.handleGoodsClose() this.handleGoodsClose()
this.validateField(['selectGoodsName','goodsInfoName']) this.validateField(['selectGoodsName', 'goodsInfoName'])
}, }
handleCarSeriesClose(){ ,
handleCarSeriesClose() {
this.carDialogVisible = !this.carDialogVisible this.carDialogVisible = !this.carDialogVisible
}, }
handleConfirm(e={}){ ,
handleConfirm(e = {}) {
let carList = [] let carList = []
for(const key in e){ for (const key in e) {
for(const sonKey in e[key]){ for (const sonKey in e[key]) {
carList = [...carList, ...e[key][sonKey]] carList = [...carList, ...e[key][sonKey]]
} }
} }
this.vehicleSeriesRequestList = carList.map(item =>{ this.vehicleSeriesRequestList = carList.map(item => {
const {id, name, parentId, parentName, rootId, rootName} = item const {id, name, parentId, parentName, rootId, rootName} = item
return { return {
brandId: rootId, brandId: rootId,
...@@ -402,85 +561,93 @@ export default { ...@@ -402,85 +561,93 @@ export default {
}) })
this.handleCarSeriesClose() this.handleCarSeriesClose()
this.validateField('carSeriesName') this.validateField('carSeriesName')
}, }
confirmDialog(e){ ,
confirmDialog(e) {
this.saleMerchantList = e || [] this.saleMerchantList = e || []
this.closeDialog() this.closeDialog()
this.validateField('saleStore') this.validateField('saleStore')
}, }
closeDialog(){ ,
if(!this.merchantDialogVisible && !this.formObj.smartcarlifeInfoId){ closeDialog() {
if (!this.merchantDialogVisible && !this.formObj.smartcarlifeInfoId) {
return this.$message.error('请先选择商品') return this.$message.error('请先选择商品')
} }
this.merchantDialogVisible = !this.merchantDialogVisible this.merchantDialogVisible = !this.merchantDialogVisible
}, }
,
handleDel(row) { handleDel(row) {
const idx = this.saleMerchantList.findIndex(item => item.merchantId == row.merchantId) const idx = this.saleMerchantList.findIndex(item => item.merchantId == row.merchantId)
if( idx>-1 )this.saleMerchantList.splice(idx, 1) if (idx > -1) this.saleMerchantList.splice(idx, 1)
}, }
selectCategory(e){ ,
selectCategory(e) {
this.formObj.associationClassifyFirstId = e?.parent?.id this.formObj.associationClassifyFirstId = e?.parent?.id
this.formObj.associationClassifySecondId = e?.data?.id this.formObj.associationClassifySecondId = e?.data?.id
this.validateField('categoryName') this.validateField('categoryName')
}, }
getParams(){ ,
getParams() {
let obj = JSON.parse(JSON.stringify(this.formObj)) let obj = JSON.parse(JSON.stringify(this.formObj))
obj.goodsImage = obj.coverList[0] obj.goodsImage = obj.coverList[0]
obj.depositPrice = obj.depositPrice ? Number(Number(obj.depositPrice*10*10).toFixed(0)) : 0 obj.depositPrice = obj.depositPrice ? Number(Number(obj.depositPrice * 10 * 10).toFixed(0)) : 0
if(obj.paymentType == 1) delete obj.depositPrice if (obj.paymentType == 1) delete obj.depositPrice
delete obj.minSellPrice delete obj.minSellPrice
delete obj.retailPrice delete obj.retailPrice
delete obj.coverList delete obj.coverList
let saleMerchantList = this.saleMerchantList.map(item => { let saleMerchantList = this.saleMerchantList.map(item => {
let { merchantId, merchantName, activityPrice, originalPrice } = item let {merchantId, merchantName, activityPrice, originalPrice} = item
let price = this.formObj.paymentType==1 ? 0 : this.formObj.depositPrice let price = this.formObj.paymentType == 1 ? 0 : this.formObj.depositPrice
let retainagePrice = activityPrice - price let retainagePrice = activityPrice - price
activityPrice = activityPrice ? Number(Number(activityPrice*10*10).toFixed(0)) : 0 activityPrice = activityPrice ? Number(Number(activityPrice * 10 * 10).toFixed(0)) : 0
retainagePrice = retainagePrice ? Number(Number(retainagePrice*10*10).toFixed(0)) : 0 retainagePrice = retainagePrice ? Number(Number(retainagePrice * 10 * 10).toFixed(0)) : 0
originalPrice = originalPrice ? Number(Number(originalPrice*10*10).toFixed(0)) : 0 originalPrice = originalPrice ? Number(Number(originalPrice * 10 * 10).toFixed(0)) : 0
if(obj.paymentType == 1) { if (obj.paymentType == 1) {
return {merchantId , merchantName,activityPrice, originalPrice } return {merchantId, merchantName, activityPrice, originalPrice}
}else{ } else {
return {merchantId , merchantName,activityPrice, retainagePrice, originalPrice } return {merchantId, merchantName, activityPrice, retainagePrice, originalPrice}
} }
}) })
const params = { const params = {
saleMerchantList: saleMerchantList, saleMerchantList: saleMerchantList,
vehicleSeriesRequestList :this.vehicleSeriesRequestList, vehicleSeriesRequestList: this.vehicleSeriesRequestList,
...obj ...obj
} }
if(this.routeInfo.id) params.id = this.routeInfo.id if (this.routeInfo.id) params.id = this.routeInfo.id
return params return params
}, }
handleSave(){ ,
handleSave() {
this.$refs.baseInfoRef.$refs.formRef.validate(valid => { this.$refs.baseInfoRef.$refs.formRef.validate(valid => {
if(valid){ if (valid) {
const params = this.getParams() const params = this.getParams()
this.$apis.goods.addGoodsApi(params).then(res =>{ this.$apis.goods.addGoodsApi(params).then(res => {
if(res) { if (res) {
this.$message.success('操作成功') this.$message.success('操作成功')
this.handleCancel() this.handleCancel()
} }
}) })
} }
}) })
}, }
handleCancel(){ ,
handleCancel() {
this.$router.back() this.$router.back()
}, }
getDetail(){ ,
getDetail() {
const params = { const params = {
id: this.routeInfo.id id: this.routeInfo.id
} }
if(this.routeInfo.merchantId) params.merchantId= this.routeInfo.merchantId if (this.routeInfo.merchantId) params.merchantId = this.routeInfo.merchantId
this.$apis.goods.getGoodsDetail(params).then(res => { this.$apis.goods.getGoodsDetail(params).then(res => {
if(res) { if (res) {
for(const key in this.formObj){ for (const key in this.formObj) {
const formatAttr = ['depositPrice', 'minSellPrice', 'retailPrice'] const formatAttr = ['depositPrice', 'minSellPrice', 'retailPrice']
if(formatAttr.includes(key)){ if (formatAttr.includes(key)) {
this.formObj[key] = res[key] ? Number(Number(res[key]/100).toFixed(2)) : 0 this.formObj[key] = res[key] ? Number(Number(res[key] / 100).toFixed(2)) : 0
}else{ } else {
this.formObj[key] = res[key] this.formObj[key] = res[key]
} }
} }
...@@ -491,13 +658,13 @@ export default { ...@@ -491,13 +658,13 @@ export default {
this.formObj.goodsType = '1' this.formObj.goodsType = '1'
this.formObj.coverList = [res.goodsImage] this.formObj.coverList = [res.goodsImage]
this.saleMerchantList = res.saleMerchantList?.map(item => { this.saleMerchantList = res.saleMerchantList?.map(item => {
let activityPrice = item.activityPrice ? Number(Number(item.activityPrice/100).toFixed(2)) : 0 let activityPrice = item.activityPrice ? Number(Number(item.activityPrice / 100).toFixed(2)) : 0
let originalPrice = item.originalPrice ? Number(Number(item.originalPrice/100).toFixed(2)) : 0 let originalPrice = item.originalPrice ? Number(Number(item.originalPrice / 100).toFixed(2)) : 0
return {...item, activityPrice, originalPrice} return {...item, activityPrice, originalPrice}
}) || [] }) || []
this.vehicleSeriesRequestList = res?.vehicleSeriesList?.map(item => { this.vehicleSeriesRequestList = res?.vehicleSeriesList?.map(item => {
const {brandId, brandName, childBrandId,childBrandName , vehicleSeriesId, vehicleSeriesName } = item const {brandId, brandName, childBrandId, childBrandName, vehicleSeriesId, vehicleSeriesName} = item
return {brandId, brandName, childBrandId,childBrandName , vehicleSeriesId, vehicleSeriesName } return {brandId, brandName, childBrandId, childBrandName, vehicleSeriesId, vehicleSeriesName}
}) || [] }) || []
} }
}) })
...@@ -506,27 +673,32 @@ export default { ...@@ -506,27 +673,32 @@ export default {
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.container{ .container {
.glsx-combi-form{ .glsx-combi-form {
/deep/ .el-radio-group{ /deep/ .el-radio-group {
.el-radio__label{ .el-radio__label {
padding-left: 8px; padding-left: 8px;
} }
} }
} }
background-color: #fff; background-color: #fff;
.disabled-class{
.disabled-class {
cursor: not-allowed; cursor: not-allowed;
color: #666666; color: #666666;
} }
.goods-wrap{
.goods-wrap {
padding: 20px 20px 1px; padding: 20px 20px 1px;
width: 1000px; width: 1000px;
background: #F9F9F9; background: #F9F9F9;
border-radius: 4px; border-radius: 4px;
.upload-calss{
.upload-calss {
display: flex; display: flex;
.tip{
.tip {
height: 20px; height: 20px;
line-height: 20px; line-height: 20px;
align-self: flex-end; align-self: flex-end;
...@@ -537,11 +709,13 @@ export default { ...@@ -537,11 +709,13 @@ export default {
} }
} }
} }
.category-class{
.category-class {
width: 432px; width: 432px;
} }
.money-wrap{
.label{ .money-wrap {
.label {
width: 92px; width: 92px;
height: 20px; height: 20px;
line-height: 20px; line-height: 20px;
...@@ -550,19 +724,23 @@ export default { ...@@ -550,19 +724,23 @@ export default {
color: #333333; color: #333333;
text-align: right; text-align: right;
} }
.el-input{
.el-input {
width: 432px; width: 432px;
} }
} }
.selected-table { .selected-table {
margin-top: 10px; margin-top: 10px;
width: 100%; width: 100%;
max-width: 1000px; max-width: 1000px;
.el-button--text{
.el-button--text {
padding: 0; padding: 0;
} }
} }
.car-series-wrap{
.car-series-wrap {
margin-top: 8px; margin-top: 8px;
width: 580px; width: 580px;
height: 80px; height: 80px;
...@@ -571,7 +749,8 @@ export default { ...@@ -571,7 +749,8 @@ export default {
border-radius: 4px; border-radius: 4px;
padding: 6px 8px; padding: 6px 8px;
overflow-y: auto; overflow-y: auto;
.car-series-item{
.car-series-item {
display: inline-block; display: inline-block;
padding: 0 8px; padding: 0 8px;
height: 24px; height: 24px;
...@@ -584,4 +763,90 @@ export default { ...@@ -584,4 +763,90 @@ export default {
} }
} }
} }
.upload-img {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 104px;
height: 104px;
background: rgba(0, 0, 0, 0.04);
border: 1px dashed rgba(0, 0, 0, 0.15);
border-radius: 4px;
input {
position: absolute;
// top: 0;
// left: 0;
width: 104px;
height: 104px;
}
}
.avatar-uploader-desc-word {
font-weight: 400;
font-size: 28 rpx;
color: #666666;
}
.video-box {
position: relative;
width: 104px;
height: 104px;
border-radius: 4px;
margin-right: 8px;
&:hover .mask {
opacity: 1;
}
.video {
position: absolute;
object-fit: fill;
}
.photo-activity {
position: absolute;
width: 104px;
height: 104px;
}
.mask {
display: flex;
align-items: center;
justify-content: center;
position: absolute;
background: rgba(0, 0, 0, 0.5);
color: #ffffff;
opacity: 0;
top: 0;
right: 0;
width: 104px;
height: 104px;
z-index: 999;
.video-pane-close {
width: 14px;
height: 14px;
cursor: pointer;
margin-right: 8px;
}
}
}
.activity-img-box {
display: flex;
}
.text-tip2 {
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 14 rpx;
color: #999999;
margin-bottom: -35px;
}
</style> </style>
<template> <template>
<div class="goods-ctnr"> <div class="goods-ctnr">
<div class="global-title">{{!routeInfo.id ? '新增': disabled ? '查看' : '编辑'}}商品</div> <div class="global-title">{{ !routeInfo.id ? '新增' : disabled ? '查看' : '编辑' }}商品</div>
<div class="container"> <div class="container">
<glsx-combi-form :isInline="false" class="glsx-combi-form" ref="baseInfoRef" labelWidth="154px" defaultWidth="432px" :formObj.sync="formObj" :formData="formData" :formRules="myRule"> <glsx-combi-form :isInline="false" class="glsx-combi-form" ref="baseInfoRef" labelWidth="154px"
defaultWidth="432px" :formObj.sync="formObj" :formData="formData" :formRules="myRule">
<div slot="selectBtnSlot"> <div slot="selectBtnSlot">
<el-button :class="['el-icon-plus', {'disabled-class':disabled}]" size="small" @click="openGoodsDialog">选择商品</el-button> <el-button :class="['el-icon-plus', {'disabled-class':disabled}]" size="small" @click="openGoodsDialog">
选择商品
</el-button>
</div> </div>
<div slot="goodsInfoSlot" class="goods-wrap"> <div slot="goodsInfoSlot" class="goods-wrap">
<glsx-combi-form :isInline="false" ref="goodsInfoRef" labelWidth="154px" defaultWidth="432px" :formObj.sync="formObj" :formData="goodsFormData" :formRules="goodsRule"> <glsx-combi-form :isInline="false" ref="goodsInfoRef" labelWidth="154px" defaultWidth="432px"
:formObj.sync="formObj" :formData="goodsFormData" :formRules="goodsRule">
<div slot="uploadSlot" class="upload-calss"> <div slot="uploadSlot" class="upload-calss">
<glsx-preview :picOptions="posterOptions" :imageUrlArr="formObj.coverList" @change="changeChannelImg"></glsx-preview> <glsx-preview :picOptions="posterOptions" :imageUrlArr="formObj.coverList"
@change="changeChannelImg"></glsx-preview>
<span class="tip">建议尺寸750*750,图片格式为jpg,jpeg,png,大小2M以内</span> <span class="tip">建议尺寸750*750,图片格式为jpg,jpeg,png,大小2M以内</span>
</div> </div>
</glsx-combi-form> </glsx-combi-form>
...@@ -17,15 +22,19 @@ ...@@ -17,15 +22,19 @@
<div slot="saleStoreSlot"> <div slot="saleStoreSlot">
<el-button v-if="!disabled" class="el-icon-plus" size="small" @click="closeDialog">选择门店</el-button> <el-button v-if="!disabled" class="el-icon-plus" size="small" @click="closeDialog">选择门店</el-button>
<template v-if="saleMerchantList && saleMerchantList.length"> <template v-if="saleMerchantList && saleMerchantList.length">
<GLTable class="selected-table" :hasPage="false" ref="selectedRef" :tableParams="selectedtableParams" :tableData="saleMerchantList"> <GLTable class="selected-table" :hasPage="false" ref="selectedRef" :tableParams="selectedtableParams"
:tableData="saleMerchantList">
<div slot="activityPriceSlot" slot-scope="scope"> <div slot="activityPriceSlot" slot-scope="scope">
<format-input :disabled="disabled" :intDigit="6" :precise="2" placeholder="请输入" v-model="scope.scope.activityPrice"></format-input> <format-input :disabled="disabled" :intDigit="6" :precise="2" placeholder="请输入"
v-model="scope.scope.activityPrice"></format-input>
</div> </div>
<div slot="originalPriceSlot" slot-scope="scope"> <div slot="originalPriceSlot" slot-scope="scope">
<format-input :disabled="disabled" :intDigit="6" :precise="2" placeholder="请输入" v-model="scope.scope.originalPrice"></format-input> <format-input :disabled="disabled" :intDigit="6" :precise="2" placeholder="请输入"
v-model="scope.scope.originalPrice"></format-input>
</div> </div>
<div slot="giveIntegralSlot" slot-scope="scope"> <div slot="giveIntegralSlot" slot-scope="scope">
<format-input :disabled="disabled" :intDigit="6" :precise="2" placeholder="请输入" v-model="scope.scope.giveIntegral"></format-input> <format-input :disabled="disabled" :intDigit="6" :precise="2" placeholder="请输入"
v-model="scope.scope.giveIntegral"></format-input>
</div> </div>
<div slot="auth-button" slot-scope="scope"> <div slot="auth-button" slot-scope="scope">
<el-button v-if="!disabled" type="text" @click="handleDel(scope.scope)">删除</el-button> <el-button v-if="!disabled" type="text" @click="handleDel(scope.scope)">删除</el-button>
...@@ -33,8 +42,37 @@ ...@@ -33,8 +42,37 @@
</GLTable> </GLTable>
</template> </template>
</div> </div>
<div slot="productVideoSlot">
<el-form-item label="">
<template v-if="!formObj.goodsVideo">
<div class="upload-img">
<i class="el-icon-plus avatar-uploader-desc-icon"></i>
<div class="avatar-uploader-desc-word">上传视频</div>
<input type="file" class="upload-video" style="opacity: 0" accept=".mp4"
@change="e => handleVideoChange(e)"/>
</div>
</template>
<template v-else>
<div class="video-box">
<video id="video" width="100%" height="100%" preload loop muted>
<source :src="formObj.goodsVideo" type="video/mp4"/>
</video>
<div class="mask">
<div class="video-pane-close" @click="handleEnlarge(formObj.goodsVideo, 'video')">
<img src="../../assets/channel/view.png" alt=""/>
</div>
<div class="video-pane-close" @click="close('radio')">
<img src="../../assets/channel/dele.png" alt=""/>
</div>
</div>
</div>
</template>
<div class="text-tip2">作为商品详情页顶部展示和详情展示,格式建议mp4,大小不超过20M</div>
</el-form-item>
</div>
<div slot="expressFeeSlot"> <div slot="expressFeeSlot">
<format-input class="expressFee-class" :disabled="disabled" :intDigit="4" :precise="2" v-model="formObj.expressFee"></format-input> <format-input class="expressFee-class" :disabled="disabled" :intDigit="4" :precise="2"
v-model="formObj.expressFee"></format-input>
</div> </div>
</glsx-combi-form> </glsx-combi-form>
</div> </div>
...@@ -42,8 +80,15 @@ ...@@ -42,8 +80,15 @@
<el-button @click="handleCancel">取消</el-button> <el-button @click="handleCancel">取消</el-button>
<el-button v-if="!disabled" type="primary" @click="handleSave">确定</el-button> <el-button v-if="!disabled" type="primary" @click="handleSave">确定</el-button>
</GLFooter> </GLFooter>
<selectGoods v-if="goodsVisible" :routeInfo="routeInfo" :dialogVisible="goodsVisible" :goodsInfo="formObj" @handleGoodsConfirm="handleGoodsConfirm" @handleGoodsClose="handleGoodsClose"></selectGoods> <selectGoods v-if="goodsVisible" :routeInfo="routeInfo" :dialogVisible="goodsVisible" :goodsInfo="formObj"
<selectMerchantDialog @confirmDialog="confirmDialog" @closeDialog="closeDialog" :goodsId="formObj.smartcarlifeInfoId" :selectedList="saleMerchantList" v-if="merchantDialogVisible" :isVisible="merchantDialogVisible"></selectMerchantDialog> @handleGoodsConfirm="handleGoodsConfirm" @handleGoodsClose="handleGoodsClose"></selectGoods>
<selectMerchantDialog @confirmDialog="confirmDialog" @closeDialog="closeDialog"
:goodsId="formObj.smartcarlifeInfoId" :selectedList="saleMerchantList"
v-if="merchantDialogVisible" :isVisible="merchantDialogVisible"></selectMerchantDialog>
<el-dialog class="image-dialog" :visible.sync="dialogVisibleImg" width="50%">
<img :src="dialogSrc" width="100%" v-if="dialogType == 'img'" />
<video width="100%" autoplay controls :src="dialogSrc" v-else></video>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
...@@ -66,10 +111,11 @@ const MerchantColumns = [ ...@@ -66,10 +111,11 @@ const MerchantColumns = [
width: 220, width: 220,
addHtml: 'giveIntegralSlot' addHtml: 'giveIntegralSlot'
} }
] ]
import glsxCombiForm from '@/components/glsx-combi-form' import glsxCombiForm from '@/components/glsx-combi-form'
import selectGoods from './components/selectGoods' import selectGoods from './components/selectGoods'
import selectMerchantDialog from './components/selectMerchantDialog' import selectMerchantDialog from './components/selectMerchantDialog'
export default { export default {
name: 'add', name: 'add',
components: { components: {
...@@ -79,9 +125,11 @@ export default { ...@@ -79,9 +125,11 @@ export default {
}, },
data() { data() {
return { return {
dialogVisibleImg:false,
goodsVisible: false, goodsVisible: false,
merchantDialogVisible: false, merchantDialogVisible: false,
disabled: false, disabled: false,
dialogSrc:'',
goodsInfo: {}, goodsInfo: {},
routeInfo: {}, routeInfo: {},
posterOptions: { posterOptions: {
...@@ -90,7 +138,7 @@ export default { ...@@ -90,7 +138,7 @@ export default {
key: 'posterImg', key: 'posterImg',
isClose: true isClose: true
}, },
goodsFormData:[ goodsFormData: [
{ {
label: '商品图', label: '商品图',
addHtml: 'uploadSlot', addHtml: 'uploadSlot',
...@@ -115,7 +163,7 @@ export default { ...@@ -115,7 +163,7 @@ export default {
type: 'showTxt' type: 'showTxt'
}, },
], ],
formObj:{ formObj: {
source: '2', source: '2',
method: '2', method: '2',
goodsType: '2', goodsType: '2',
...@@ -125,20 +173,21 @@ export default { ...@@ -125,20 +173,21 @@ export default {
goodsImage: '', goodsImage: '',
minSellPrice: '', minSellPrice: '',
retailPrice: '', retailPrice: '',
goodsVideo: '',
coverList: [], coverList: [],
associationClassifyFirstId: '', associationClassifyFirstId: '',
introduction: '' introduction: ''
}, },
saleMerchantList:[], saleMerchantList: [],
goodsList: [], goodsList: [],
myRule: { myRule: {
selectBtnSlot: [ selectBtnSlot: [
{ {
required: true, required: true,
validator: (rule, value, callback) => { validator: (rule, value, callback) => {
if(!this.formObj.smartcarlifeInfoId){ if (!this.formObj.smartcarlifeInfoId) {
callback(new Error('请选择商品')) callback(new Error('请选择商品'))
}else{ } else {
callback() callback()
} }
}, },
...@@ -148,11 +197,11 @@ export default { ...@@ -148,11 +197,11 @@ export default {
goodsInfoSlot: [{ goodsInfoSlot: [{
required: true, required: true,
validator: (rule, value, callback) => { validator: (rule, value, callback) => {
if(!this.formObj.coverList && !this.formObj.coverList[0]){ if (!this.formObj.coverList && !this.formObj.coverList[0]) {
callback(new Error('请上传商品图')) callback(new Error('请上传商品图'))
}else if(!this.formObj.goodsName){ } else if (!this.formObj.goodsName) {
callback(new Error('请输入商品名称')) callback(new Error('请输入商品名称'))
}else{ } else {
callback() callback()
} }
}, },
...@@ -169,15 +218,15 @@ export default { ...@@ -169,15 +218,15 @@ export default {
let minSellPrice = this.formObj.minSellPrice || 0 let minSellPrice = this.formObj.minSellPrice || 0
return (+activityPrice > +originalPrice || +originalPrice < minSellPrice) return (+activityPrice > +originalPrice || +originalPrice < minSellPrice)
}) })
if(!this.saleMerchantList.length){ if (!this.saleMerchantList.length) {
callback(new Error('请选择门店')) callback(new Error('请选择门店'))
}else if(_target){ } else if (_target) {
callback(new Error('门店活动价和原价不能为空')) callback(new Error('门店活动价和原价不能为空'))
}else if(hasTarget){ } else if (hasTarget) {
callback(new Error('原价不能小于最低售价和活动价')) callback(new Error('原价不能小于最低售价和活动价'))
}else if(_integralTarget){ } else if (_integralTarget) {
callback(new Error('请输入赠送积分')) callback(new Error('请输入赠送积分'))
}else{ } else {
callback() callback()
} }
}, },
...@@ -188,7 +237,7 @@ export default { ...@@ -188,7 +237,7 @@ export default {
method: [{required: true, message: '请选择配送方式', trigger: 'change'}], method: [{required: true, message: '请选择配送方式', trigger: 'change'}],
expressFee: [{required: true, message: '请输入运费', trigger: 'change'}], expressFee: [{required: true, message: '请输入运费', trigger: 'change'}],
}, },
formData:[ formData: [
{ {
label: '关联商品分类', label: '关联商品分类',
name: 'associationClassifyFirstId', name: 'associationClassifyFirstId',
...@@ -229,6 +278,11 @@ export default { ...@@ -229,6 +278,11 @@ export default {
isDisabled: false isDisabled: false
}, },
{ {
label: '产品视频',
name: 'productVideo',
addHtml: 'productVideoSlot'
},
{
label: '配送方式', label: '配送方式',
name: 'method', name: 'method',
type: 'radio', type: 'radio',
...@@ -264,12 +318,12 @@ export default { ...@@ -264,12 +318,12 @@ export default {
} }
} }
}, },
created(){ created() {
this.getCategory() this.getCategory()
const urlParam = this.$route.params const urlParam = this.$route.params
this.routeInfo = JSON.parse(decodeURIComponent(urlParam.id)) this.routeInfo = JSON.parse(decodeURIComponent(urlParam.id))
const { id, type } = this.routeInfo const {id, type} = this.routeInfo
if(type == 1) { if (type == 1) {
this.disabled = true this.disabled = true
this.posterOptions.isClose = false this.posterOptions.isClose = false
const _target = this.goodsFormData.find(item => item.name == 'goodsName') const _target = this.goodsFormData.find(item => item.name == 'goodsName')
...@@ -281,69 +335,131 @@ export default { ...@@ -281,69 +335,131 @@ export default {
}) })
this.selectedtableParams.tableOption = null this.selectedtableParams.tableOption = null
} }
if(id){ if (id) {
this.getDetail() this.getDetail()
} }
}, },
methods:{ methods: {
getCategory(){ // 上传视频
handleVideoChange(e) {
let file = e.srcElement.files[0]
var reader = new FileReader()
// 默认30MB
const limitSize = 20
const isLt = file.size / 1024 / 1024 < limitSize
if (!isLt) {
this.$message.error('上传视频大小不能超过' + limitSize + 'MB!')
this.loading = false
return
}
this.$notify({
title: '提示',
message: '视频上传中,请稍后'
})
document.querySelector('.upload-video').value = ''
reader.readAsDataURL(file)
reader.onload = e => {
const videoFile = e.target.result
const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + videoFile.split(',')[1]
this.$apis.common.uploadVideoApi({file: base64}).then(res => {
if (res) {
this.$notify({
title: '提示',
message: '视频上传成功',
type: 'success'
})
this.loading = false
this.formObj.goodsVideo = res
} else {
this.loading = false
}
})
}
},
// 预览图文
handleEnlarge(src, type) {
this.dialogVisibleImg = true
this.dialogSrc = src
this.dialogType = type ? type : 'img'
},
// 删除图片/视频
close(type, index) {
switch (type) {
case 'radio':
this.formObj.goodsVideo = ''
break
default:
this.formObj.goodsVideo = ''
}
},
getCategory() {
const params = { const params = {
pageSize: 10000, pageSize: 10000,
pageNum: 1, pageNum: 1,
categoryType: 2 categoryType: 2
} }
this.$apis.category.getCategoryListApi(params).then(res => { this.$apis.category.getCategoryListApi(params).then(res => {
if(res?.list?.length){ if (res?.list?.length) {
const _target = this.formData.find(item => item.name == 'associationClassifyFirstId') const _target = this.formData.find(item => item.name == 'associationClassifyFirstId')
_target.optionList = res.list _target.optionList = res.list
} }
}) })
}, },
validateField(field){ validateField(field) {
if(Array.isArray(field)){ if (Array.isArray(field)) {
field.forEach(item => { field.forEach(item => {
this.$refs.baseInfoRef.$refs.formRef.validateField(item) this.$refs.baseInfoRef.$refs.formRef.validateField(item)
}) })
}else{ } else {
this.$refs.baseInfoRef.$refs.formRef.validateField(field) this.$refs.baseInfoRef.$refs.formRef.validateField(field)
} }
}, },
openGoodsDialog(){ openGoodsDialog() {
if(this.disabled) return if (this.disabled) return
this.goodsVisible = true this.goodsVisible = true
}, },
handleGoodsClose(){ handleGoodsClose() {
this.goodsVisible = false this.goodsVisible = false
}, },
handleGoodsConfirm(e){ handleGoodsConfirm(e) {
if(this.formObj.smartcarlifeInfoId!=e?.id) this.saleMerchantList = [] if (this.formObj.smartcarlifeInfoId != e?.id) this.saleMerchantList = []
let { id: smartcarlifeInfoId, goodsName, goodsImage, minSellPrice, retailPrice } = e || {} let {id: smartcarlifeInfoId, goodsName, goodsImage, minSellPrice, retailPrice,goodsVideo} = e || {}
minSellPrice = minSellPrice ? Number(Number(minSellPrice/100).toFixed(2)) : 0 minSellPrice = minSellPrice ? Number(Number(minSellPrice / 100).toFixed(2)) : 0
retailPrice = retailPrice ? Number(Number(retailPrice/100).toFixed(2)) : 0 retailPrice = retailPrice ? Number(Number(retailPrice / 100).toFixed(2)) : 0
this.formObj = {...this.formObj, smartcarlifeInfoId, goodsName, goodsImage, coverList: [goodsImage], minSellPrice, retailPrice} // 若选择的商品素材包含了视频,则带入对应的视频文件
if (goodsVideo) this.formObj.goodsVideo = goodsVideo
this.formObj = {
...this.formObj,
smartcarlifeInfoId,
goodsName,
goodsImage,
coverList: [goodsImage],
minSellPrice,
retailPrice
}
this.handleGoodsClose() this.handleGoodsClose()
this.validateField(['selectBtnSlot','goodsInfoSlot']) this.validateField(['selectBtnSlot', 'goodsInfoSlot'])
}, },
confirmDialog(e){ confirmDialog(e) {
this.saleMerchantList = e || [] this.saleMerchantList = e || []
this.saleMerchantList.map(item => this.$set(item, 'giveIntegral', '')) this.saleMerchantList.map(item => this.$set(item, 'giveIntegral', ''))
this.validateField('saleStoreSlot') this.validateField('saleStoreSlot')
this.closeDialog() this.closeDialog()
}, },
closeDialog(){ closeDialog() {
if(!this.merchantDialogVisible && !this.formObj.smartcarlifeInfoId){ if (!this.merchantDialogVisible && !this.formObj.smartcarlifeInfoId) {
return this.$message.error('请先选择商品') return this.$message.error('请先选择商品')
} }
this.merchantDialogVisible = !this.merchantDialogVisible this.merchantDialogVisible = !this.merchantDialogVisible
}, },
handleDel(row) { handleDel(row) {
const idx = this.saleMerchantList.findIndex(item => item.merchantId == row.merchantId) const idx = this.saleMerchantList.findIndex(item => item.merchantId == row.merchantId)
if(idx>-1) this.saleMerchantList.splice(idx, 1) if (idx > -1) this.saleMerchantList.splice(idx, 1)
}, },
getParams(){ getParams() {
let obj = JSON.parse(JSON.stringify(this.formObj)) let obj = JSON.parse(JSON.stringify(this.formObj))
obj.goodsImage = obj.coverList[0] obj.goodsImage = obj.coverList[0]
obj.expressFee = obj.expressFee ? Number(Number(obj.expressFee*10*10).toFixed(0)) : 0 obj.expressFee = obj.expressFee ? Number(Number(obj.expressFee * 10 * 10).toFixed(0)) : 0
delete obj.minSellPrice delete obj.minSellPrice
delete obj.retailPrice delete obj.retailPrice
delete obj.coverList delete obj.coverList
...@@ -351,24 +467,24 @@ export default { ...@@ -351,24 +467,24 @@ export default {
delete obj.method delete obj.method
let saleMerchantList = this.saleMerchantList.map(item => { let saleMerchantList = this.saleMerchantList.map(item => {
let { merchantId, merchantName, activityPrice, giveIntegral, originalPrice } = item let {merchantId, merchantName, activityPrice, giveIntegral, originalPrice} = item
activityPrice = activityPrice ? Number(Number(activityPrice*10*10).toFixed(0)) : 0 activityPrice = activityPrice ? Number(Number(activityPrice * 10 * 10).toFixed(0)) : 0
originalPrice = originalPrice ? Number(Number(originalPrice*10*10).toFixed(0)) : 0 originalPrice = originalPrice ? Number(Number(originalPrice * 10 * 10).toFixed(0)) : 0
return {merchantId , merchantName, activityPrice, giveIntegral, originalPrice} return {merchantId, merchantName, activityPrice, giveIntegral, originalPrice}
}) })
const params = { const params = {
saleMerchantList: saleMerchantList, saleMerchantList: saleMerchantList,
...obj ...obj
} }
if(this.routeInfo.id) params.id = this.routeInfo.id if (this.routeInfo.id) params.id = this.routeInfo.id
return params return params
}, },
handleSave(){ handleSave() {
this.$refs.baseInfoRef.$refs.formRef.validate(valid => { this.$refs.baseInfoRef.$refs.formRef.validate(valid => {
if(valid){ if (valid) {
const params = this.getParams() const params = this.getParams()
this.$apis.goods.addGoodsApi(params).then(res =>{ this.$apis.goods.addGoodsApi(params).then(res => {
if(res) { if (res) {
this.$message.success('操作成功') this.$message.success('操作成功')
this.handleCancel() this.handleCancel()
} }
...@@ -376,21 +492,21 @@ export default { ...@@ -376,21 +492,21 @@ export default {
} }
}) })
}, },
handleCancel(){ handleCancel() {
this.$router.back() this.$router.back()
}, },
getDetail(){ getDetail() {
const params = { const params = {
id: this.routeInfo.id id: this.routeInfo.id
} }
if(this.routeInfo.merchantId) params.merchantId= this.routeInfo.merchantId if (this.routeInfo.merchantId) params.merchantId = this.routeInfo.merchantId
this.$apis.goods.getGoodsDetail(params).then(res => { this.$apis.goods.getGoodsDetail(params).then(res => {
if(res) { if (res) {
for(const key in this.formObj){ for (const key in this.formObj) {
const formatAttr = ['depositPrice', 'minSellPrice', 'retailPrice','expressFee'] const formatAttr = ['depositPrice', 'minSellPrice', 'retailPrice', 'expressFee']
if(formatAttr.includes(key)){ if (formatAttr.includes(key)) {
this.formObj[key] = res[key] ? Number(Number(res[key]/100).toFixed(2)) : 0 this.formObj[key] = res[key] ? Number(Number(res[key] / 100).toFixed(2)) : 0
}else{ } else {
this.formObj[key] = res[key] this.formObj[key] = res[key]
} }
} }
...@@ -403,8 +519,8 @@ export default { ...@@ -403,8 +519,8 @@ export default {
this.formObj.method = '2', this.formObj.method = '2',
this.formObj.coverList = [res.goodsImage] this.formObj.coverList = [res.goodsImage]
this.saleMerchantList = res.saleMerchantList?.map(item => { this.saleMerchantList = res.saleMerchantList?.map(item => {
let activityPrice = item.activityPrice ? Number(Number(item.activityPrice/100).toFixed(2)) : 0 let activityPrice = item.activityPrice ? Number(Number(item.activityPrice / 100).toFixed(2)) : 0
let originalPrice = item.originalPrice ? Number(Number(item.originalPrice/100).toFixed(2)) : 0 let originalPrice = item.originalPrice ? Number(Number(item.originalPrice / 100).toFixed(2)) : 0
return {...item, activityPrice, originalPrice} return {...item, activityPrice, originalPrice}
}) || [] }) || []
} }
...@@ -414,27 +530,32 @@ export default { ...@@ -414,27 +530,32 @@ export default {
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.container{ .container {
background-color: #fff; background-color: #fff;
.glsx-combi-form{
/deep/ .el-radio-group{ .glsx-combi-form {
.el-radio__label{ /deep/ .el-radio-group {
.el-radio__label {
padding-left: 2px; padding-left: 2px;
} }
} }
} }
.disabled-class{
.disabled-class {
cursor: not-allowed; cursor: not-allowed;
color: #666666; color: #666666;
} }
.goods-wrap{
.goods-wrap {
padding: 20px 20px 1px; padding: 20px 20px 1px;
width: 970px; width: 970px;
background: #F9F9F9; background: #F9F9F9;
border-radius: 4px; border-radius: 4px;
.upload-calss{
.upload-calss {
display: flex; display: flex;
.tip{
.tip {
height: 20px; height: 20px;
line-height: 20px; line-height: 20px;
align-self: flex-end; align-self: flex-end;
...@@ -445,21 +566,108 @@ export default { ...@@ -445,21 +566,108 @@ export default {
} }
} }
} }
.selected-table { .selected-table {
margin-top: 10px; margin-top: 10px;
width: 970px; width: 970px;
.el-button--text{
.el-button--text {
padding: 0; padding: 0;
} }
} }
.expressFee-class{
.expressFee-class {
width: 432px; width: 432px;
} }
/deep/ #introduction{
.el-textarea__inner{ /deep/ #introduction {
.el-textarea__inner {
width: 580px; width: 580px;
height: 80px; height: 80px;
} }
} }
} }
.upload-img {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 104px;
height: 104px;
background: rgba(0, 0, 0, 0.04);
border: 1px dashed rgba(0, 0, 0, 0.15);
border-radius: 4px;
input {
position: absolute;
// top: 0;
// left: 0;
width: 104px;
height: 104px;
}
}
.avatar-uploader-desc-word {
font-weight: 400;
font-size: 28 rpx;
color: #666666;
}
.video-box {
position: relative;
width: 104px;
height: 104px;
border-radius: 4px;
margin-right: 8px;
&:hover .mask {
opacity: 1;
}
.video {
position: absolute;
object-fit: fill;
}
.photo-activity {
position: absolute;
width: 104px;
height: 104px;
}
.mask {
display: flex;
align-items: center;
justify-content: center;
position: absolute;
background: rgba(0, 0, 0, 0.5);
color: #ffffff;
opacity: 0;
top: 0;
right: 0;
width: 104px;
height: 104px;
z-index: 999;
.video-pane-close {
width: 14px;
height: 14px;
cursor: pointer;
margin-right: 8px;
}
}
}
.activity-img-box {
display: flex;
}
.text-tip2 {
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 14 rpx;
color: #999999;
margin-bottom: -35px;
}
</style> </style>
<!-- 明细 -->
<template>
<div class="edit-share marketing edit-box">
<div class=" container1 edit-container">
<p class="edit-title">{{ routeInfo.activityName }}</p>
<div class="p-20">
<GLCombiForm
ref="showSearch"
:rowNumber="1"
:formObj="searchForm"
:formData="searchFormData"
@handleOk="handleSearch"
@handleRest="handleReset"
></GLCombiForm>
<div class="flex m-b-10 w-100-percent">
<div class="table-title">
已累计
<template v-if="routeInfo.type != 2">{{ decodeURI(routeInfo.name) }} </template>
<span>{{total || routeInfo.count }}</span>
{{ routeInfo.type == 2 ? '位访客' : '次' }}
</div>
<el-button
:size="size"
class="default-blue-btn"
type="default"
@click="handleExport"
>导出</el-button>
</div>
<!-- 表格区域 开始 -->
<GLTable
ref="browserRef"
:getListApi="getListApi"
:noDataImg="url"
:searchForm="searchForm"
:tableParams="tableParams"
:pageConf="pageConf"
:beforeSearchFn="beforeSearchFn"
@setTableFinishFun="setTableFinishFun"
>
<div
slot="customerName"
class="flex-align"
slot-scope="scope"
>
<template v-if="scope.scope.customerAvatar">
<el-popover
placement="top"
width="160"
trigger="hover"
popper-class="table-popover-block"
>
<img
class="table-popover-img"
:src="scope.scope.customerAvatar"
/>
<img
class="img-36 pointer"
slot="reference"
:src="scope.scope.customerAvatar"
/>
</el-popover>
</template>
<span class="m-l-10">{{ scope.scope.customerName }}</span>
</div>
<div
slot="shareName"
class="flex-align"
slot-scope="scope"
>
<template v-if="scope.scope.shareAvatar">
<el-popover
placement="top"
width="160"
trigger="hover"
popper-class="table-popover-block"
>
<img
class="table-popover-img"
:src="scope.scope.shareAvatar"
/>
<img
class="img-36 pointer"
slot="reference"
:src="scope.scope.shareAvatar"
/>
</el-popover>
</template>
<span class="m-l-10">{{ scope.scope.shareName }}</span>
<span class="m-l-10">{{ scope.scope.sharePhone }}</span>
</div>
<div
slot="isBuy"
slot-scope="scope"
>
<span :class="['table-circle', 'm-r-8', scope.scope.isBuy == 'Y' ? 'back-green' : 'back-grey']"></span>
<span>
{{
{
Y: '已付款',
N: '未付款'
}[scope.scope.isBuy] || '--'
}}
</span>
</div>
</GLTable>
<!-- 表格区域 end -->
</div>
</div>
<div
class="footer"
:style="{ left: footerLeft + 'px', width: footerWidth + 'px' }"
>
<el-button
type="default"
@click="handleJump"
>返回</el-button>
</div>
</div>
</template>
<script>
import * as dayjs from 'dayjs'
import url from '@/assets/empty.png'
import { exportFn } from '@/common/constant'
export default {
name: 'browseList',
data () {
return {
size: 'small',
url: url,
footerLeft: '0',
footerWidth: '0',
routeInfo: {
id: '',
activityName: ''
},
searchForm: {
customerName: '',
mobile: ''
},
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
// 搜索
searchFormData: [
{
label: '微信昵称',
name: 'customerName',
type: 'input',
maxlength: 50
},
{
label: '手机号',
name: 'mobile',
type: 'input',
maxlength: 11
},
{
label: '分享人',
name: 'shareName',
type: 'input',
maxlength: 50
}
],
// 表格
getListApi: null,
tableParams: {
listName: 'list',
tableColumns: [
{
label: '微信昵称',
prop: 'customerName',
addHtml: 'customerName'
},
{
label: '手机号',
prop: 'mobile'
},
{
label: '分享人',
prop: 'shareName',
addHtml: 'shareName',
width: 230
}
]
},
total: 0
}
},
created () {
console.log(this.$route.query)
const lastTableColumns = [
{
label: '浏览时长',
prop: 'browserTime'
},
{
label: '进入页面时间',
prop: 'operationDate',
width: '180'
},
{
label: '离开页面时间',
prop: 'leaveDate',
width: '180'
},
{
label: '订单状态',
prop: 'isBuy',
addHtml: 'isBuy'
}
],
{ query } = this.$route,
name = {
1: '浏览',
2: '访客',
3: '分享'
}[query.type],
[url] = window.location.href.split('%24title'),
apiName = this.$apis.goods[
{
1: 'getBrowseListApi',
2: 'getVisitorListApi',
3: 'getSharedListApi'
}[query.type]]
query.name = name
this.routeInfo = query
this.getListApi = apiName
if (query.type == 1) this.getTotal(apiName, query.id)
history.replaceState(null, null, `${url}&$title=${name}明细`)
// listName:
//1 浏览 2 访客 3 分享
if (query.type != 2) {
this.searchFormData.push({
label: '订单状态',
name: 'isBuy',
type: 'select',
width: '215px',
optionList: [
{
confId: '',
confName: '全部'
},
{
confId: 'Y',
confName: '已付款'
},
{
confId: 'N',
confName: '未付款'
}
],
optionId: 'confId',
optionLabel: 'confName'
})
if (query.type == 3)
this.tableParams.tableColumns.push({
label: '分享时间',
prop: 'sharedTime'
})
this.tableParams.tableColumns = [...this.tableParams.tableColumns, ...lastTableColumns]
} else
this.tableParams.tableColumns = [
...this.tableParams.tableColumns,
{
label: '浏览次数',
prop: 'browseCount'
},
{
label: '最后浏览时间',
prop: 'lastBrowseDate'
}
]
},
mounted () {
this.footerLeft = document.querySelector('.base-container-right').offsetLeft
this.footerWidth = document.documentElement.clientWidth - this.footerLeft
},
methods: {
beforeSearchFn () {
return new Promise(resolve => {
this.searchForm.id = this.routeInfo.id
resolve()
})
},
handleExport () {
var params = this.$common.utils.deepClone(this.searchForm)
let { type } = this.routeInfo
params.pageNum = 1
params.pageSize = 999999
this.$apis.goods.exportBrowseApi(params, type).then(res => {
exportFn(res)
})
},
handleJump (path, row = {}) {
// this.$router.push({
// path: '/gooods/crowdFundList'
// })
// this.$route.query.activeName= this.routeInfo.activeName;
this.$router.back()
},
setTableFinishFun () {
//接收到的数据为空
this.$refs.browserRef.data.length ? (this.$refs.browserRef.tableHeightValues = '') : this.$refs.browserRef.setTableHeightFun()
},
handleSearch () {
const { query } = this.$route
this.$refs.browserRef.refreshTable()
if (query.type == 1) this.getTotal(this.$apis.goods.getBrowseListApi, query.id)
},
handleReset () {
this.searchForm = {
id: this.routeInfo.id,
customerName: '',
mobile: ''
}
this.handleSearch()
},
async getTotal (apiName, id) {
const { customerName, mobile } = this.searchForm, { total } = await apiName({
pageSize: 10,
pageNum: 1,
id,
customerName,
mobile
})
this.total = total
}
}
}
</script>
<style scoped lang="scss">
.edit-container {
.table-title {
font-weight: 400;
font-size: 14px;
color: #333333;
line-height: 20px;
display: flex;
align-items: center;
span {
color: #5850ff;
}
}
}
.m-b-10{
margin-bottom: 10px;
}
.m-l-10{
margin-left: 10px;
}
.flex{
display:flex;
justify-content: space-between;
}
.flex-align{
display: flex;
align-items:center
}
.footer{
position: fixed;
bottom: 0;
width: 100%;
height: 64px;
text-align: center;
line-height: 64px;
background: #fff;
z-index: 999;
}
.marketing .edit-title{
font-size: 16px;
font-weight: 600;
height: 58px;
line-height: 58px;
border-bottom: 1px solid #e7eaec;
margin: 0 0;
padding: 0 0 0 20px;
}
.marketing .edit-container{
margin-bottom:30px;
}
.p-20{
padding: 20px;
}
.marketing .container1{
background: #fff;
}
</style>
...@@ -10,7 +10,11 @@ ...@@ -10,7 +10,11 @@
</GLCombiForm> </GLCombiForm>
<div class="operate-wrap"> <div class="operate-wrap">
<span class="table-title">发现商品列表</span> <span class="table-title">发现商品列表</span>
<div>
<el-button class="operate-btn" type="primary" size="small" @click="handleAdd">新增商品</el-button> <el-button class="operate-btn" type="primary" size="small" @click="handleAdd">新增商品</el-button>
<el-button size="small" @click="handleExport">导出</el-button>
</div>
</div> </div>
<GLTable ref="channelRef" :getListApi="getListApi" :noDataImg="url" :searchForm="searchForm" :beforeSearchFn="beforeSearchFn" :tableParams="tableParams" :pageConf="pageConf" @setTableFinishFun="setTableFinishFun"> <GLTable ref="channelRef" :getListApi="getListApi" :noDataImg="url" :searchForm="searchForm" :beforeSearchFn="beforeSearchFn" :tableParams="tableParams" :pageConf="pageConf" @setTableFinishFun="setTableFinishFun">
<div slot="imageSlot" class="table-image" slot-scope="scope"> <div slot="imageSlot" class="table-image" slot-scope="scope">
...@@ -41,6 +45,20 @@ ...@@ -41,6 +45,20 @@
<span v-else>{{ filterData(scope.scope).join('、') }}</span> <span v-else>{{ filterData(scope.scope).join('、') }}</span>
</template> </template>
</div> </div>
<div
slot="linkText"
slot-scope="scope"
>
<template v-if="scope.scope.incrementFlag == 'Y' || hideStatus">
{{ scope.scope[scope.prop] || 0 }}
</template>
<template v-else>
<p
class="cursor-pointer"
@click="handleDetail(scope)"
>{{ scope.scope[scope.prop] || 0 }}</p>
</template>
</div>
<div class="table-btns" slot="auth-button" slot-scope="scope"> <div class="table-btns" slot="auth-button" slot-scope="scope">
<GLTableButton :buttonList="buttonList" :buttonItem="scope" :buttonNum="4"></GLTableButton> <GLTableButton :buttonList="buttonList" :buttonItem="scope" :buttonNum="4"></GLTableButton>
</div> </div>
...@@ -53,6 +71,7 @@ ...@@ -53,6 +71,7 @@
import url from '@/assets/empty.png' import url from '@/assets/empty.png'
import brandCascader from './components/brandCascader' import brandCascader from './components/brandCascader'
import preferList from './preferList' import preferList from './preferList'
import { exportFn } from '@/common/constant'
export default { export default {
name: 'App', name: 'App',
components: { components: {
...@@ -60,8 +79,9 @@ ...@@ -60,8 +79,9 @@
preferList preferList
}, },
beforeRouteEnter(to, from, next) { beforeRouteEnter(to, from, next) {
console.log(from)
next(vm =>{ next(vm =>{
if(from.path.indexOf('/goods/addPrefer')==0) {vm.activeName='2'} if(from.path.indexOf('/goods/addPrefer')==0 || (from.path.indexOf('/goods/browseList')==0 && from.query.activeName== 2)) {vm.activeName='2'}
}) })
}, },
data() { data() {
...@@ -211,6 +231,26 @@ ...@@ -211,6 +231,26 @@
addHtml: 'merchantPriceSlot' addHtml: 'merchantPriceSlot'
}, },
{ {
label: '浏览量(次)',
prop: 'viewAmount',
addHtml: 'linkText',
width: 140
},
{
label: '访客',
prop: 'fansAmount',
addHtml: 'linkText'
},
{
label: '分享',
prop: 'shareAmount',
addHtml: 'linkText'
},
{
label: '销量',
prop: 'saleAmount'
},
{
label: '分类', label: '分类',
width: 150, width: 150,
formatter: cellValue => { formatter: cellValue => {
...@@ -244,6 +284,42 @@ ...@@ -244,6 +284,42 @@
created() {}, created() {},
mounted() {}, mounted() {},
methods: { methods: {
// 明细
handleDetail ({ prop, scope }) {
let data = {
viewAmount: {
type: 1,
count: scope.viewAmount
},
fansAmount: {
type: 2,
count: scope.fansAmount
},
shareAmount: {
type: 3,
count: scope.shareAmount
}
}[prop]
this.$router.push({
path: '/goods/browseList',
query: {
id: scope.id,
activityName: scope.goodsName,
type: data.type,
count: data.count,
activeName:this.activeName
}
})
},
handleExport () {
var params = this.$common.utils.deepClone(this.searchForm)
params.goodsType = 1
this.$apis.goods.exportGoodsApi(params).then(res => {
exportFn(res)
})
},
selectCategory(e){ selectCategory(e){
this.tableSearchForm.associationClassifyFirstId = e?.parent?.id this.tableSearchForm.associationClassifyFirstId = e?.parent?.id
this.tableSearchForm.associationClassifySecondId = e?.data?.id this.tableSearchForm.associationClassifySecondId = e?.data?.id
...@@ -382,5 +458,8 @@ ...@@ -382,5 +458,8 @@
} }
} }
} }
.cursor-pointer{
cursor:pointer;
color:#5850FF;
}
</style> </style>
\ No newline at end of file \ No newline at end of file
<template> <template>
<div class="prefer-list-cntr"> <div class="prefer-list-cntr">
<div class="table-wrap"> <div class="table-wrap">
<GLCombiForm ref="showSearch" class="search-wrap" :rowNumber="1" :formObj="tableSearchForm" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset"> <GLCombiForm ref="showSearch" class="search-wrap" :rowNumber="1" :formObj="tableSearchForm"
:formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset">
</GLCombiForm> </GLCombiForm>
<div class="operate-wrap"> <div class="operate-wrap">
<span class="table-title">车主优选商品列表</span> <span class="table-title">车主优选商品列表</span>
<div>
<el-button class="operate-btn" type="primary" size="small" @click="handleAdd">新增商品</el-button> <el-button class="operate-btn" type="primary" size="small" @click="handleAdd">新增商品</el-button>
<el-button size="small" @click="handleExport">导出</el-button>
</div> </div>
<GLTable ref="channelRef" :getListApi="getListApi" :noDataImg="url" :searchForm="searchForm" :beforeSearchFn="beforeSearchFn" :tableParams="tableParams" :pageConf="pageConf" @setTableFinishFun="setTableFinishFun"> </div>
<GLTable ref="channelRef" :getListApi="getListApi" :noDataImg="url" :searchForm="searchForm"
:beforeSearchFn="beforeSearchFn" :tableParams="tableParams" :pageConf="pageConf"
@setTableFinishFun="setTableFinishFun">
<div slot="imageSlot" class="table-image" slot-scope="scope"> <div slot="imageSlot" class="table-image" slot-scope="scope">
<el-popover placement="top" width="160" trigger="hover" popper-class="table-popover-block"> <el-popover placement="top" width="160" trigger="hover" popper-class="table-popover-block">
<img class="table-popover-img" :src="scope.scope.goodsImage" /> <img class="table-popover-img" :src="scope.scope.goodsImage"/>
<img class="img-36 pointer" slot="reference" :src="scope.scope.goodsImage" /> <img class="img-36 pointer" slot="reference" :src="scope.scope.goodsImage"/>
</el-popover> </el-popover>
</div> </div>
<div slot="statusSlot" slot-scope="scope"> <div slot="statusSlot" slot-scope="scope">
<span :class="['status', scope.scope.goodsStatus==1 ? 'success-status': 'error-status']"></span> <span :class="['status', scope.scope.goodsStatus==1 ? 'success-status': 'error-status']"></span>
<span>{{scope.scope.goodsStatus==1 ? '上架' : '下架' }}</span> <span>{{ scope.scope.goodsStatus == 1 ? '上架' : '下架' }}</span>
</div> </div>
<div slot="merchantPriceSlot" slot-scope="scope"> <div slot="merchantPriceSlot" slot-scope="scope">
<template v-if="scope.scope.saleMerchantList && scope.scope.saleMerchantList.length > 1"> <template v-if="scope.scope.saleMerchantList && scope.scope.saleMerchantList.length > 1">
...@@ -26,7 +32,7 @@ ...@@ -26,7 +32,7 @@
width="fit-content" width="fit-content"
trigger="hover"> trigger="hover">
<div v-for="(item,index) in filterData(scope.scope)" :key="index"> <div v-for="(item,index) in filterData(scope.scope)" :key="index">
{{item}} {{ item }}
</div> </div>
<span class="more-info" slot="reference">...[{{ scope.scope.saleMerchantList.length }}]</span> <span class="more-info" slot="reference">...[{{ scope.scope.saleMerchantList.length }}]</span>
</el-popover> </el-popover>
...@@ -36,22 +42,36 @@ ...@@ -36,22 +42,36 @@
<span v-else>{{ filterData(scope.scope).join('、') }}</span> <span v-else>{{ filterData(scope.scope).join('、') }}</span>
</template> </template>
</div> </div>
<div
slot="linkText"
slot-scope="scope"
>
<template v-if="scope.scope.incrementFlag == 'Y' || hideStatus">
{{ scope.scope[scope.prop] || 0 }}
</template>
<template v-else>
<p
class="cursor-pointer"
@click="handleDetail(scope)"
>{{ scope.scope[scope.prop] || 0 }}</p>
</template>
</div>
<div slot="giveIntegralSlot" slot-scope="scope"> <div slot="giveIntegralSlot" slot-scope="scope">
<template v-if="scope.scope.saleMerchantList && scope.scope.saleMerchantList.length > 1"> <template v-if="scope.scope.saleMerchantList && scope.scope.saleMerchantList.length > 1">
<span>{{ filterData(scope.scope,1).slice(0, 1).join('、') }}</span> <span>{{ filterData(scope.scope, 1).slice(0, 1).join('、') }}</span>
<el-popover <el-popover
placement="top" placement="top"
width="400" width="400"
trigger="hover"> trigger="hover">
<div v-for="(item,index) in filterData(scope.scope,1)" :key="index"> <div v-for="(item,index) in filterData(scope.scope,1)" :key="index">
{{item}} {{ item }}
</div> </div>
<span class="more-info" slot="reference">...({{ scope.scope.saleMerchantList.length }})</span> <span class="more-info" slot="reference">...({{ scope.scope.saleMerchantList.length }})</span>
</el-popover> </el-popover>
</template> </template>
<template v-else> <template v-else>
<span v-if="!scope.scope.saleMerchantList || !scope.scope.saleMerchantList.length">--</span> <span v-if="!scope.scope.saleMerchantList || !scope.scope.saleMerchantList.length">--</span>
<span v-else>{{ filterData(scope.scope,1).join('、') }}</span> <span v-else>{{ filterData(scope.scope, 1).join('、') }}</span>
</template> </template>
</div> </div>
<div class="table-btns" slot="auth-button" slot-scope="scope"> <div class="table-btns" slot="auth-button" slot-scope="scope">
...@@ -60,11 +80,12 @@ ...@@ -60,11 +80,12 @@
</GLTable> </GLTable>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import url from '@/assets/empty.png' import url from '@/assets/empty.png'
export default { import { exportFn } from '@/common/constant'
export default {
name: 'App', name: 'App',
data() { data() {
return { return {
...@@ -108,7 +129,7 @@ ...@@ -108,7 +129,7 @@
fn: '上架' fn: '上架'
}, },
condition: row => { condition: row => {
return row.scope.goodsStatus!=1 return row.scope.goodsStatus != 1
}, },
listeners: { listeners: {
click: row => this.shelfGoodsFn(row.scope, 1) click: row => this.shelfGoodsFn(row.scope, 1)
...@@ -122,7 +143,7 @@ ...@@ -122,7 +143,7 @@
fn: '下架' fn: '下架'
}, },
condition: row => { condition: row => {
return row.scope.goodsStatus==1 return row.scope.goodsStatus == 1
}, },
listeners: { listeners: {
click: row => this.shelfGoodsFn(row.scope, 0) click: row => this.shelfGoodsFn(row.scope, 0)
...@@ -136,7 +157,7 @@ ...@@ -136,7 +157,7 @@
fn: '删除' fn: '删除'
}, },
condition: row => { condition: row => {
return row.scope.goodsStatus!=1 return row.scope.goodsStatus != 1
}, },
listeners: { listeners: {
click: row => this.delGoodsFn(row.scope) click: row => this.delGoodsFn(row.scope)
...@@ -238,6 +259,26 @@ ...@@ -238,6 +259,26 @@
addHtml: 'merchantPriceSlot' addHtml: 'merchantPriceSlot'
}, },
{ {
label: '浏览量(次)',
prop: 'viewAmount',
addHtml: 'linkText',
width: 140
},
{
label: '访客',
prop: 'fansAmount',
addHtml: 'linkText'
},
{
label: '分享',
prop: 'shareAmount',
addHtml: 'linkText'
},
{
label: '销量',
prop: 'saleAmount'
},
{
label: '赠送积分', label: '赠送积分',
width: 200, width: 200,
addHtml: 'giveIntegralSlot' addHtml: 'giveIntegralSlot'
...@@ -267,36 +308,72 @@ ...@@ -267,36 +308,72 @@
}, },
] ]
}, },
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' } pageConf: {pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total'}
} }
}, },
created() { created() {
this.getCategory() this.getCategory()
}, },
mounted() {}, mounted() {
},
methods: { methods: {
getCategory(){ // 明细
handleDetail({prop, scope}) {
let data = {
viewAmount: {
type: 1,
count: scope.viewAmount
},
fansAmount: {
type: 2,
count: scope.fansAmount
},
shareAmount: {
type: 3,
count: scope.shareAmount
}
}[prop]
this.$router.push({
path: '/goods/browseList',
query: {
id: scope.id,
activityName: scope.goodsName,
type: data.type,
count: data.count,
activeName:'2'
}
})
},
handleExport () {
var params = this.$common.utils.deepClone(this.searchForm)
params.goodsType = 2
this.$apis.goods.exportGoodsApi(params).then(res => {
exportFn(res)
})
},
getCategory() {
const params = { const params = {
pageSize: 10000, pageSize: 10000,
pageNum: 1, pageNum: 1,
categoryType: 2 categoryType: 2
} }
this.$apis.category.getCategoryListApi(params).then(res => { this.$apis.category.getCategoryListApi(params).then(res => {
if(res?.list?.length){ if (res?.list?.length) {
const _target = this.searchFormData.find(item => item.name == 'associationClassifyFirstId') const _target = this.searchFormData.find(item => item.name == 'associationClassifyFirstId')
_target && (_target.optionList = res.list) _target && (_target.optionList = res.list)
console.log(this.searchFormData) console.log(this.searchFormData)
} }
}) })
}, },
selectCategory(e){ selectCategory(e) {
this.tableSearchForm.associationClassifyFirstId = e?.parent?.id this.tableSearchForm.associationClassifyFirstId = e?.parent?.id
this.tableSearchForm.associationClassifySecondId = e?.data?.id this.tableSearchForm.associationClassifySecondId = e?.data?.id
}, },
shelfGoodsFn(item, type){ shelfGoodsFn(item, type) {
if(type==1){ if (type == 1) {
this.updateStatus(item.id, type) this.updateStatus(item.id, type)
}else{ } else {
this.$confirm(`确定下架该商品吗`, '提示', { this.$confirm(`确定下架该商品吗`, '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
...@@ -309,15 +386,15 @@ ...@@ -309,15 +386,15 @@
}) })
} }
}, },
delGoodsFn(item){ delGoodsFn(item) {
this.$confirm(`确定删除该商品吗`, '提示', { this.$confirm(`确定删除该商品吗`, '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning', type: 'warning',
callback: action => { callback: action => {
if (action == 'confirm') { if (action == 'confirm') {
this.$apis.goods.delGoodsApi({id: item.id}).then(res =>{ this.$apis.goods.delGoodsApi({id: item.id}).then(res => {
if(res){ if (res) {
this.$message.success('删除成功') this.$message.success('删除成功')
this.handleSearch() this.handleSearch()
} }
...@@ -326,22 +403,22 @@ ...@@ -326,22 +403,22 @@
} }
}) })
}, },
updateStatus(id, goodsStatus){ updateStatus(id, goodsStatus) {
this.$apis.goods.updateGoodsStatusApi({id, goodsStatus}).then(res =>{ this.$apis.goods.updateGoodsStatusApi({id, goodsStatus}).then(res => {
if(res){ if (res) {
this.$message.success('操作成功') this.$message.success('操作成功')
this.handleSearch() this.handleSearch()
} }
}) })
}, },
filterData({saleMerchantList: list},notFormat){ filterData({saleMerchantList: list}, notFormat) {
if(notFormat){ if (notFormat) {
return list?.map(item => { return list?.map(item => {
return `${item.merchantName || '--'}:${item.giveIntegral || '0'}` return `${item.merchantName || '--'}:${item.giveIntegral || '0'}`
}) || [] }) || []
}else{ } else {
return list?.map(item => { return list?.map(item => {
let activityPrice = item.activityPrice ? Number((Number(item.activityPrice)/100).toFixed(2)) : 0 let activityPrice = item.activityPrice ? Number((Number(item.activityPrice) / 100).toFixed(2)) : 0
return `${item.merchantName || '--'}:${activityPrice || '0'}` return `${item.merchantName || '--'}:${activityPrice || '0'}`
}) || [] }) || []
} }
...@@ -380,31 +457,32 @@ ...@@ -380,31 +457,32 @@
//接收到的数据为空 //接收到的数据为空
this.$refs.channelRef.data.length ? (this.$refs.channelRef.tableHeightValues = '') : this.$refs.channelRef.setTableHeightFun() this.$refs.channelRef.data.length ? (this.$refs.channelRef.tableHeightValues = '') : this.$refs.channelRef.setTableHeightFun()
}, },
handleAdd(row={},type){ handleAdd(row = {}, type) {
const params = { const params = {
goodsType: '2' goodsType: '2'
} }
let title = '新增商品' let title = '新增商品'
if(type){ if (type) {
params.id = row.id params.id = row.id
params.type = type params.type = type
title = type == 1 ? '查看商品' : '编辑商品' title = type == 1 ? '查看商品' : '编辑商品'
} }
const queryStr = encodeURIComponent(JSON.stringify(params)) const queryStr = encodeURIComponent(JSON.stringify(params))
this.$router.push({ path: `/goods/addPrefer/`+queryStr,query: { $title: title }}) this.$router.push({path: `/goods/addPrefer/` + queryStr, query: {$title: title}})
}
} }
} }
</script> }
</script>
<style scoped lang="scss"> <style scoped lang="scss">
.prefer-list-cntr{ .prefer-list-cntr {
.table-wrap{ .table-wrap {
margin-top: 16px; margin-top: 16px;
padding: 20px; padding: 20px;
background-color: #fff; background-color: #fff;
.status{
.status {
width: 6px; width: 6px;
height: 6px; height: 6px;
border-radius: 50%; border-radius: 50%;
...@@ -412,18 +490,24 @@ ...@@ -412,18 +490,24 @@
vertical-align: middle; vertical-align: middle;
margin-right: 8px; margin-right: 8px;
} }
.success-status{
.success-status {
background-color: #37C67F; background-color: #37C67F;
} }
.error-status{
.error-status {
background-color: #999999; background-color: #999999;
} }
.more-info{
.more-info {
white-space: nowrap; white-space: nowrap;
color: #5850FF; color: #5850FF;
cursor: pointer; cursor: pointer;
} }
} }
} }
.cursor-pointer{
cursor:pointer;
color:#5850FF;
}
</style> </style>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!