Commit a0e61ecb by 王志慧

权益商品优惠券可生成领取链接进行领取

1 parent 826fb8d5
......@@ -130,8 +130,8 @@ const saveCouponInfo = params => {
// 获取模板下的优惠券列表
const getCouponById = params => {
if(!params.templateId) {
return new Promise((resolve, reject)=>{
if (!params.templateId) {
return new Promise((resolve, reject) => {
reject()
})
};
......@@ -164,7 +164,19 @@ const delTemplateById = params => {
})
}
// 获取领取优惠券的短链
const getUrlLink = params => {
params.method = `${defaultPath}urlLink.get`
return other_http({
url,
method: 'POST',
data: params,
sign: true
})
}
export default {
getUrlLink,
getCouponsList,
createCoupons,
getExportApi,
......
......@@ -24,6 +24,9 @@
<GLTableButton :buttonList="buttonList" :buttonItem="scope" :buttonNum="3"></GLTableButton>
</div>
</GLTable>
<GLDialog class="codeDialog" mode="small" title="领取链接" @onOk="handleCopyLink" okText="复制" cancelText="取消" :before-close="closeLinkDialog" @onCancel="closeLinkDialog" :visible.sync="dialogShow">
<div class="link-wrap">{{ urlLink }}</div>
</GLDialog>
</div>
</template>
......@@ -32,6 +35,7 @@ export default {
name: 'index',
data() {
return {
dialogShow: false,
getListApi: this.$apis.goodsCouponApi.getCouponsList,
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
searchForm: {
......@@ -99,6 +103,19 @@ export default {
listeners: {
click: row => this.goDetailPage(row)
}
},
{
type: 'el-button',
name: row => {
return '领取链接'
},
attrs: {
type: 'text',
fn: '领取链接'
},
listeners: {
click: row => this.goLink(row.scope)
}
}
],
tableParams: {
......@@ -214,13 +231,41 @@ export default {
optionLabel: 'label',
isClear: true
}
]
],
urlLink:'',
}
},
created() {
this.getAllBrandList()
},
methods: {
goLink(row) {
this.$apis.goodsCouponApi.getUrlLink({
couponId:row.id
}).then(res=>{
console.log(res)
this.urlLink =res.data
this.dialogShow = true
})
},
handleCopyLink() {
this.$message({
message: '复制成功',
type: 'success',
customClass: 'message-Z-zinde'
})
const input = document.createElement('input')
document.body.appendChild(input)
input.setAttribute('value', this.urlLink)
input.select()
document.execCommand('Copy')
document.body.removeChild(input)
},
closeLinkDialog() {
this.dialogShow = !this.dialogShow
this.urlLink=''
},
handleOk() {
this.$refs.tableRef.refreshTable()
},
......@@ -326,4 +371,11 @@ export default {
}
}
}
.link-wrap {
background: #f8f8f8;
border-radius: 2px;
padding: 20px;
position: relative;
margin-top: 20px;
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!