Commit b32242a9 by cwq0219

分享

1 parent ca9bd294
import { http } from '@/main'
const defaultPath = 'scrm.api.shopmall.'
const defaultPath = 'scrm.api.shopmall.goods.'
const getListApi = params => {
params.method = `${defaultPath}goods.page.curMerchant`
params.method = `${defaultPath}page.curMerchant`
return http({
url: 'rop-scrm-shopmall/router',
method: 'GET',
data: params,
sign: true
})
}
const getProShareApi = params => {
params.method = `${defaultPath}get.shared`
return http({
url: 'rop-scrm-shopmall/router',
method: 'GET',
......@@ -13,7 +23,7 @@ const getListApi = params => {
}
const topProApi = params => {
params.method = `${defaultPath}goods.updateToTop`
params.method = `${defaultPath}updateToTop`
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
......@@ -24,7 +34,7 @@ const topProApi = params => {
}
const updateStatusProApi = params => {
params.method = `${defaultPath}goods.updateStatus`
params.method = `${defaultPath}updateStatus`
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
......@@ -34,4 +44,4 @@ const updateStatusProApi = params => {
})
}
export default { getListApi, topProApi, updateStatusProApi }
export default { getListApi, getProShareApi, topProApi, updateStatusProApi }
<!-- 分享弹窗 -->
<template>
<glsx-dialog title="分享" width="806px" :noCancel="true" btnOkLabel="关闭" :isVisible="isShareVisible" @closeDialog="handleShareClose" @confirmDialog="handleShareClose">
<div class="share-dialog">
<div class="flex">
<div class="flex box poster">
<div>
<p class="share-txt">海报</p>
<!-- <p>小程序码不带参数</p> -->
<el-button :size="size" type="primary" @click="handleSaveImg(shareForm.posterUrl)">保存图片</el-button>
</div>
<img :src="shareForm.posterUrl" />
</div>
<div class="flex box poster">
<div>
<p class="share-txt">小程序码</p>
<!-- <p>小程序码不带参数</p> -->
<el-button :size="size" type="primary" @click="handleSaveImg(shareForm.qrCodeUrl)">保存图片</el-button>
</div>
<img style="width: 180px; height: 180px" :src="shareForm.qrCodeUrl" />
</div>
</div>
<div class="box page-route">
<div>
<p class="route-txt">短链</p>
<div class="flex">
<p style="width: 426px;">{{ shareForm.linkUrl }}</p>
<el-button :size="size" type="primary" @click="handleSaveTxt(shareForm.linkUrl)">复制链接</el-button>
<!-- <p>链接是直播间原始页面路径,如需加入参数,详见使用方法</p> -->
</div>
</div>
</div>
</div>
</glsx-dialog>
</template>
<script>
export default {
name: 'share',
data() {
return {
}
},
props: {
isShareVisible: {
type: Boolean,
default: false
},
shareForm: {
type: Object,
default: () => {}
}
},
mounted() {},
methods: {
handleSaveImg(url) {
var alink = document.createElement("a")
alink.href = url
alink.setAttribute('target', '_blank')
alink.download = '海报'
alink.click()
alink.remove()
},
handleSaveTxt(txt) {
const input = document.createElement('input')
document.body.appendChild(input)
input.setAttribute('value', txt)
input.select()
document.execCommand('Copy')
document.body.removeChild(input)
this.$message({
message: '复制成功',
type: 'success'
})
},
handleShareClose() {
this.$emit('handleShareClose')
}
}
}
</script>
<style scoped>
.share-dialog .box {
background: #f7f7f7;
border-radius: 6px;
padding: 30px;
}
.share-dialog .poster img {
width: 180px;
height: 297px;
margin-left: 45px;
}
.share-dialog .page-route {
margin-top: 16px;
}
.share-dialog .page-route .route-txt {
font-weight: bold;
padding-bottom: 10px;
}
.share-dialog .share-txt {
font-weight: bold;
margin-bottom: 50px;
}
</style>
......@@ -29,6 +29,7 @@
</GLTable>
<!-- 表格区域 end -->
</div>
<!-- 下架 -->
<glsx-dialog title="下架" :isVisible.sync="isDownVisible" @confirmDialog="handleDownConfirm" @closeDialog="handleDownClose">
<el-form ref="downRef" label-width="100px" :rules="downRules" :model="downForm">
<el-form-item label="下架备注" prop="offReason">
......@@ -36,15 +37,19 @@
</el-form-item>
</el-form>
</glsx-dialog>
<!-- 分享 -->
<share-dialog :isShareVisible="isShareVisible" :shareForm="shareForm" @handleShareClose="handleShareClose"></share-dialog>
</div>
</template>
<script>
import shareDialog from './components/shareDialog'
export default {
name: 'productGroup',
data() {
return {
size: 'small',
// 下架
isDownVisible: false,
downForm: {
id: '',
......@@ -54,6 +59,10 @@ export default {
downRules: {
offReason: [{ required: true, message: '请输入下架备注', trigger: 'change' }]
},
// 分享
isShareVisible: false,
shareForm: {},
// 表格
searchForm: {
goodsName: '',
createDate: [],
......@@ -159,6 +168,10 @@ export default {
}
},
components: {
shareDialog
},
mounted() {
this.getOptionsList('searchFormData')
},
......@@ -249,7 +262,14 @@ export default {
},
handleShare(row) {
// this.secondConfirm('删除', '是否确认删除该晒单?', 'proManage', 'deleteShareRecordApi', { id: row.id })
this.$apis.proManage.getProShareApi({ id: row.id }).then(res => {
this.shareForm = res
this.handleShareClose()
})
},
handleShareClose() {
this.isShareVisible = !this.isShareVisible
},
getOptionsList(formName, hasAll = true, refreshSigle) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!