Commit 1a106683 by 胡悦
2 parents 7ae1b7a8 1f969efe
......@@ -26,8 +26,8 @@ const getMoreMerchant = params => {
}
//获取上方卡片的相关信息
const getCardContent = params => {
params.method = `scrm.api.equity.card.get.by.merchant.id`
// scrm.api.equity.card.get.by.merchant.id旧版的
params.method = `scrm.api.equity.open.card.price.get.by.merchantid`
return http({
url: 'rop-scrm-equity/router',
......
......@@ -62,7 +62,7 @@
<div v-if="!item.isDisabled" :style="{ width: item.width || defaultWidth }">
<div v-if="Array.isArray(formObj[item.name]) ? formObj[item.name].length < item.maxPhotoNum : !formObj[item.name]" class="activity-img img-w-h">
<div class="add" :style="{ top: item.maxPhotoNum == 1 ? '50%' : '40%' }">+</div>
<span v-show="item.maxPhotoNum > 1" class="number">{{ formObj[item.name].length }} / {{ item.maxPhotoNum }}</span>
<span v-if="item.maxPhotoNum > 1" class="number">{{ formObj[item.name].length }} / {{ item.maxPhotoNum }}</span>
<input v-if="item.uploadType == 'video'" type="file" style="opacity: 0;" :id="item.name + 'file'" ref="file" class="activity-img img-w-h" accept="video/mp4" @change="e => handleUploadChange(e, item)" />
<input v-else type="file" style="opacity: 0;" :id="item.name + 'file'" ref="file" class="activity-img img-w-h" accept="image/png, image/jpeg, image/gif, image/jpg" @change="e => handleUploadChange(e, item)" />
</div>
......@@ -99,11 +99,13 @@
</template>
<slot name="footer"></slot>
</el-form>
<el-dialog v-if="isImgVisible" :visible.sync="isImgVisible" class="dialog-look">
<video v-if="dialogObj.uploadType == 'video'" class="dialog-video" controls>
<source :src="dialogObj.url" type="video/mp4">
</video>
<img v-else class="dialog-img" width="100%" :src="dialogObj.url" alt="" />
<el-dialog v-if="isImgVisible" title="查看" :visible.sync="isImgVisible">
<div class="dialog-look">
<video v-if="dialogObj.uploadType == 'video'" class="dialog-video" controls>
<source :src="dialogObj.url" type="video/mp4">
</video>
<img v-else class="dialog-img" width="100%" :src="dialogObj.url" alt="" />
</div>
</el-dialog>
</div>
</template>
......@@ -203,16 +205,19 @@ export default {
const maxPhotoNum = targetItem.maxPhotoNum || 1
const wdithLt = targetItem.wdithLt || 300
const heightLt = targetItem.heightLt || 300
if (maxPhotoNum == this.formObj[targetItem.name].length) {
if (Array.isArray(this.formObj[targetItem.name]) && maxPhotoNum == this.formObj[targetItem.name].length) {
this.$message.error('只能上传' + maxPhotoNum + (uploadType == 'img' ? '张图片' : '个视频'))
document.getElementById(targetItem.name + 'file').value = ''
return true
}
if (!isType) {
this.$message.error(uploadType == 'img' ? '上传图片不是jpg、jpeg或png的格式!' : '上传视频不是MP4的格式!')
document.getElementById(targetItem.name + 'file').value = ''
return true
}
if (!isLt) {
this.$message.error('上传' + (uploadType == 'img' ? '图片' : '视频') + '大小不能超过' + limitSize + 'MB!')
document.getElementById(targetItem.name + 'file').value = ''
return true
}
reader.readAsDataURL(file)
......@@ -233,6 +238,7 @@ export default {
targetItem.handleUpload(e, file, targetItem)
}
}
document.getElementById(targetItem.name + 'file').value = ''
},
// 图片删除
handleImgDelete(targetItem, subIndex = -1) {
......@@ -433,10 +439,10 @@ export default {
.glsx-combi-form .el-tag.el-tag--info {
border-color: #5850ff;
}
.el-tag--plain.el-tag--info .el-tag__close:hover {
.glsx-combi-form .el-tag--plain.el-tag--info .el-tag__close:hover {
background-color: #E8E8EA;
}
.el-tag.el-tag--info .el-tag__close:hover {
.glsx-combi-form .el-tag.el-tag--info .el-tag__close:hover {
background-color: #E8E8EA;
}
</style>
......@@ -7,7 +7,7 @@
<div slot="selectProBtn" slot-scope="scope" class="select-pro">
<el-button type="default" @click="handleMutiProClose(scope)">{{ editForm.goodsRefList.length ? '更换商品' : '+选择商品' }}</el-button>
</div>
<div slot="proTable" class="select-pro">
<div slot="proTable" class="select-pro" style="padding-left: 20px;">
<GLTable v-show="editForm.goodsRefList.length" :hasPage="false" :tableParams="tableParams" :tableData="editForm.goodsRefList">
<template slot="goodsImage" slot-scope="scope">
<img class="img-60" :src="scope.scope.goodsImage"/>
......
......@@ -73,8 +73,8 @@
</template>
<!-- 新增时并且为指定商品时显示,编辑或者查看时也显示 -->
<div slot="proTable" class="select-pro">
<div style="height:70px" v-if="editForm.goodsRefList.length"></div>
<GLTable v-show="editForm.goodsRefList.length" :hasPage="false" :tableParams="tableParams" :tableData="editForm.goodsRefList" style="padding-left:10px;padding-right:10px">
<!-- <div style="height:70px" v-if="editForm.goodsRefList.length"></div> -->
<GLTable v-show="editForm.goodsRefList.length" :hasPage="false" :tableParams="tableParams" :tableData="editForm.goodsRefList" style="padding-left:10px;width:70vw;max-height:350px;overflow: auto;">
<template slot="goodsImage" slot-scope="scope">
<img class="img-60" :src="scope.scope.goodsImage" />
</template>
......@@ -199,17 +199,6 @@ export default {
addHtml: 'useBarriersHtml'
},
{
label: '面值',
name: 'denomination',
addHtml: 'denominationHtml'
},
{
label: '库存',
name: 'stock',
width: '150px',
type: 'input'
},
{
label: '适用商品',
name: 'goods',
addHtml: 'goodsHtml',
......@@ -222,6 +211,17 @@ export default {
isHide: true
},
{
label: '面值',
name: 'denomination',
addHtml: 'denominationHtml'
},
{
label: '库存',
name: 'stock',
width: '150px',
type: 'input'
},
{
label: '使用说明',
name: 'useDescription',
addHtml: 'useDescriptionHtml'
......@@ -282,27 +282,27 @@ export default {
},
'editForm.useChannel'(newValue, oldValue) {
if (newValue == 1) {
this.editFormData[6].isHide = false
this.editFormData[4].isHide = false
if (this.editForm.goodsRefList.length) {
this.editFormData[7].isHide = false
this.editFormData[5].isHide = false
}
} else {
this.editForm.useBarriers = '1'
this.editForm.full = ''
this.editFormData[6].isHide = true
this.editFormData[7].isHide = true
this.editFormData[4].isHide = true
this.editFormData[5].isHide = true
}
},
'editForm.goods'(newValue, oldValue) {
if (newValue == 1) {
//全部商品
this.minPirce = this.minPirceForAll
this.editFormData[7].isHide = true
this.editFormData[5].isHide = true
} else {
//指定商品
this.minPirce = this.minPirceForPart
if (this.editForm.goodsRefList.length) {
this.editFormData[7].isHide = false
this.editFormData[5].isHide = false
}
}
if (this.editForm.denomination && this.minPirce && this.editForm.denomination * 100 > this.minPirce) {
......@@ -314,9 +314,9 @@ export default {
'editForm.goodsRefList'(newValue, oldValue) {
if (newValue.length) {
this.editFormData[7].isHide = false
this.editFormData[5].isHide = false
} else {
this.editFormData[7].isHide = true
this.editFormData[5].isHide = true
}
},
......
......@@ -191,7 +191,7 @@ export default {
image.onload = () => {
console.log(file, targetItem)
const imgFile = e.target.result
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1]
this.$apis.common.pictureUpload({ file: base64 }).then(res => {
if (res) {
let len = this.previewList.length - 1
......@@ -220,7 +220,7 @@ export default {
reader.readAsDataURL(file)
reader.onload = e => {
const imgFile = e.target.result
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1]
this.$apis.common.pictureUpload({ file: base64 }).then(res => {
if (res) {
console.log(res)
......
......@@ -425,7 +425,7 @@ export default {
reader.readAsDataURL(file)
reader.onload = e => {
const imgFile = e.target.result
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1]
this.$apis.common.uploadImgApi({ file: base64, fileType: 'image' }).then(res => {
this.editForm.bannerList[idx].bannerImg = res
})
......@@ -465,7 +465,7 @@ export default {
reader.readAsDataURL(file)
reader.onload = e => {
const imgFile = e.target.result
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1]
this.$apis.common.uploadImgApi({ file: base64, fileType: 'image' }).then(res => {
this.editForm.bannerList[this.curBanner.idx].imgLinkUrl = res
})
......@@ -490,7 +490,7 @@ export default {
reader.readAsDataURL(file)
reader.onload = e => {
const imgFile = e.target.result
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1]
this.$apis.common.uploadVideoApi({ file: base64 }).then(res => {
this.editForm.bannerList[this.curBanner.idx].videoLinkUrl = res
})
......
......@@ -306,15 +306,14 @@ mounted () {
},
getCardContentFun() {
getCardContent({ merchantId: this.merchantId }).then(res => {
if(!(res && res.length)){
return
if(!res){
return
}
this.ruleForm.equityId = res[0].id
this.ruleForm.cardName = res[0].cardClassName
this.ruleForm.price = res[0].price
this.ruleForm.marketPrice = res[0].marketPrice
this.ruleForm.linkUrl = res[0].url
this.ruleForm.tryAble = res[0].tryAble
this.ruleForm.equityId = res.equityClassId
this.ruleForm.cardName = res.equityName
this.ruleForm.price = res.goodPrice
this.ruleForm.marketPrice = res.marketPrice
this.ruleForm.linkUrl = res.freeUrl
})
},
openEditWrap() {
......
......@@ -69,7 +69,7 @@ export default {
maxPhotoNum: 1,
handleUpload: (e, file, targetItem) => {
const imgFile = e.target.result
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1]
this.$apis.common.uploadVideoApi({ file: base64 }).then(res => {
this.editForm[targetItem.name] = res
this.$refs.editFormRef.$refs[this.editChildRef].validateField(targetItem.name)
......@@ -84,7 +84,7 @@ export default {
maxPhotoNum: 8,
handleUpload: (e, file, targetItem) => {
const imgFile = e.target.result
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1]
this.$apis.common.uploadImgApi({ file: base64, fileType: 'image' }).then(res => {
this.editForm[targetItem.name].push(res)
this.$refs.editFormRef.$refs[this.editChildRef].validateField(targetItem.name)
......
......@@ -522,7 +522,7 @@ export default {
isDisabled: false,
handleUpload: (e, file, targetItem) => {
const imgFile = e.target.result
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1]
this.$apis.common.uploadImgApi({ file: base64, fileType: 'image' }).then(res => {
this.editForm[targetItem.name] = res
this.$refs.editFormRef[0].$refs.editProRef0.validateField(targetItem.name)
......@@ -540,7 +540,7 @@ export default {
isDisabled: false,
handleUpload: (e, file, targetItem) => {
const imgFile = e.target.result
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1]
this.$apis.common.uploadImgApi({ file: base64, fileType: 'image' }).then(res => {
this.editForm[targetItem.name].push({
content: res,
......@@ -563,7 +563,7 @@ export default {
isDisabled: false,
handleUpload: (e, file, targetItem) => {
const imgFile = e.target.result
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1]
this.$apis.common.uploadVideoApi({ file: base64 }).then(res => {
this.editForm[targetItem.name] = res
this.getWechatImgList()
......@@ -1214,7 +1214,7 @@ export default {
reader.readAsDataURL(file)
reader.onload = e => {
const imgFile = e.target.result
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1]
this.$apis.common.uploadImgApi({ file: base64, fileType: 'image' }).then(res => {
this.editForm.descImgList[idx].content = res
})
......
......@@ -175,9 +175,9 @@ export default {
maxPhotoNum: 1,
handleUpload: (e, file, targetItem) => {
const imgFile = e.target.result
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1]
this.$apis.common.uploadImgApi({ file: base64, fileType: 'image' }).then(res => {
console.log(res)
// console.log(res)
this.editForm[targetItem.name] = res
this.$refs.editFormRef.$refs[this.editChildRef].validateField(targetItem.name)
})
......
......@@ -60,7 +60,7 @@ export default {
maxPhotoNum: 1,
handleUpload: (e, file, targetItem) => {
const imgFile = e.target.result
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1]
this.$apis.common.uploadImgApi({ file: base64, fileType: 'image' }).then(res => {
this.editForm[targetItem.name] = res
this.$refs.editFormRef.$refs[this.editChildRef].validateField(targetItem.name)
......
......@@ -86,7 +86,7 @@ export default {
maxPhotoNum: 1,
handleUpload: (e, file, targetItem) => {
const imgFile = e.target.result
const base64 = file.name.split('.')[1] + '@' + imgFile.split(',')[1]
const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1]
this.$apis.common.uploadImgApi({ file: base64, fileType: 'image' }).then(res => {
this.editForm[targetItem.name] = res
this.$refs.editFormRef.$refs[this.editChildRef].validateField(targetItem.name)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!