Commit 9af50360 by 前端

Merge branch 'zq_dev_v2.6.0' into 'v2.6.0'

Zq dev v2.6.0定向礼包开发

See merge request !217
2 parents eabc404e 6bd370cd
...@@ -130,4 +130,14 @@ const toVoidGift = params => { ...@@ -130,4 +130,14 @@ const toVoidGift = params => {
}) })
} }
export default { getFollowerStaffListApi, getListApi, giftExportApi, deleteGiftApi, getGiftInfoApi, getReceivedGiftInfoApi, exportGiftInfoApi, getDirectionalGiftListApi, insertGiftApi, templateModal, getghDirectionalGiftListApi, toVoidGift } const getQrcode = params => {
params.method = 'scrm.api.coupon.directional.gift.qr.code'
return http({
url: 'rop-scrm-coupon/router',
method: 'POST',
data: params,
sign: true
})
}
export default { getFollowerStaffListApi, getListApi, giftExportApi, deleteGiftApi, getGiftInfoApi, getReceivedGiftInfoApi, exportGiftInfoApi, getDirectionalGiftListApi, insertGiftApi, templateModal, getghDirectionalGiftListApi, toVoidGift, getQrcode }
...@@ -31,6 +31,27 @@ function limitPrice(newValue, oldValue, intergerDigit, pointDigit, minValue, max ...@@ -31,6 +31,27 @@ function limitPrice(newValue, oldValue, intergerDigit, pointDigit, minValue, max
} }
} }
function downloadIamge(imgsrc, name = new Date().getTime()) {
//下载图片地址和图片名
var image = new Image()
// 解决跨域 Canvas 污染问题
image.setAttribute('crossOrigin', 'anonymous')
image.onload = function() {
var canvas = document.createElement('canvas')
canvas.width = image.width
canvas.height = image.height
var context = canvas.getContext('2d')
context.drawImage(image, 0, 0, image.width, image.height)
var url = canvas.toDataURL('image/png') //得到图片的base64编码数据
var a = document.createElement('a') // 生成一个a元素
var event = new MouseEvent('click') // 创建一个单击事件
a.download = name || 'photo' // 设置图片名称
a.href = url // 将生成的URL设置为a.href属性
a.dispatchEvent(event) // 触发a的单击事件
}
image.src = imgsrc
}
function getExplorer() { function getExplorer() {
var ua = navigator.userAgent.toLocaleLowerCase() var ua = navigator.userAgent.toLocaleLowerCase()
var browserType = null var browserType = null
...@@ -204,4 +225,4 @@ const stateList = [ ...@@ -204,4 +225,4 @@ const stateList = [
} }
] ]
export { limitPrice, getExplorer, exportFn, aToExport, orderManageStatusList, afterSaleStatusList, orderSourceList, deliveryTypeList, statusList, serviceStatusList, memberTypeList, stateList, orderTypesList, orderStatusList } export { limitPrice, getExplorer, exportFn, aToExport, downloadIamge, orderManageStatusList, afterSaleStatusList, orderSourceList, deliveryTypeList, statusList, serviceStatusList, memberTypeList, stateList, orderTypesList, orderStatusList }
<template>
<div>
<el-input @blur.stop="formatPhone" type="textarea" v-model="phone" :placeholder="placeholder"></el-input>
<span v-if="isTip" class="approval-tip" style="margin-left:0;">{{ tip }}</span>
<div>
<div :class="['tel-item', !item.valid ? 'valid-tel' : receiveType == 1 ? 'realTel' : 'realNum']" v-for="(item, index) in phoneList" :key="index">
{{ item.tel }}
<i style="cursor:pointer" class="el-icon-close" @click="delPhone(item.tel)"></i>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'phone-area',
model: {
prop: 'newList',
event: 'changePhoneList'
},
props: {
receiveType: {
type: String,
require: true,
default: ''
},
placeholder: {
type: String,
default: ''
},
isTip: {
type: String,
default: ''
}
},
data() {
return {
phone: '',
phoneList: []
}
},
methods: {
delPhone(val) {
let phone = '\n' + this.phone + '\n'
phone = phone.replace(/[\n]/g, '\n\n')
phone = phone.replace(new RegExp('[\n]' + val + '[\n]', 'g'), '\n')
phone = phone.replace(/[\n]+/g, '\n')
phone = phone.replace(/^[\n]+/, '')
this.phone = phone
this.formatPhone()
},
formatPhone() {
let phoneList = this.phone.split('\n')
phoneList = [...new Set(phoneList)]
// let phoneList = this.phone.split(/[\n|\s|,|,]/)
let reg
if (this.receiveType == 1) {
reg = /^(13[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9]|14[0-9])[0-9]{8}$/
} else {
reg = /^[0-9a-zA-Z]{6}$/
}
let arr = []
phoneList.forEach(item => {
arr.push({
tel: item,
valid: reg.test(item)
})
})
this.phoneList = arr.filter(item => item.tel)
this.$emit('changePhoneList', this.phoneList)
}
}
}
</script>
<style scope lang="scss">
.tel-item {
height: 26px;
display: inline-block;
padding: 0 8px;
line-height: 26px;
background: #fafbfe;
border-radius: 4px;
border: 1px solid #e8e8ea;
color: #666666;
text-align: center;
margin-right: 4px;
box-sizing: border-box;
}
.valid-tel {
background: #fff1f0;
border: 1px solid #ffa39e;
color: #ff4d4f;
}
.realTel {
width: 130px;
}
.realNum {
width: 90px;
}
</style>
...@@ -40,17 +40,38 @@ ...@@ -40,17 +40,38 @@
</GLTable> </GLTable>
<!-- 表格区域 end --> <!-- 表格区域 end -->
</div> </div>
<glsx-dialog class="qr-dialog" width="720px" title="生成二维码" btnOkLabel="下载" :isVisible.sync="isQrcodeVisible" @confirmDialog="handleCancelConfirm" @closeDialog="handleCancelClose">
<div class="qrcode-body">
<p>可生成对应发放员工的小程序领取二维码</p>
<el-select v-model="curStaffId" @change="changeStaff" placeholder="请选择发放员工">
<el-option v-for="item in curStaffList" :key="item.staffUUID" :label="item.staffName" :value="item.staffUUID"></el-option>
</el-select>
<div class="img" v-loading="imgLoading">
<el-image :src="curQrcode" alt=""></el-image>
</div>
</div>
</glsx-dialog>
</div> </div>
</template> </template>
<script> <script>
import * as dayjs from 'dayjs' import * as dayjs from 'dayjs'
import url from '@/assets/empty.png' import url from '@/assets/empty.png'
import { aToExport } from '@/common/constant' import { aToExport,downloadIamge } from '@/common/constant'
import glsxDialog from '@/components/glsx-dialog'
export default { export default {
name: 'giftList', name: 'giftList',
components: {
glsxDialog
},
data() { data() {
return { return {
isQrcodeVisible: false,
curId: '',
curStaffId: '',
imgLoading: false,
curStaffList: [],
curQrcode: '',
attrToIcon: { attrToIcon: {
2: 'discount', 2: 'discount',
3: 'cash', 3: 'cash',
...@@ -83,6 +104,19 @@ export default { ...@@ -83,6 +104,19 @@ export default {
listeners: { listeners: {
click: row => this.handleDelete(row.scope) click: row => this.handleDelete(row.scope)
} }
},
{
type: 'GLButton',
name: row => {
return '生成二维码'
},
attrs: {
type: 'text',
fn: '生成二维码'
},
listeners: {
click: row => this.makeQrcode(row.scope)
}
} }
], ],
size: 'small', size: 'small',
...@@ -133,8 +167,8 @@ export default { ...@@ -133,8 +167,8 @@ export default {
tableParams: { tableParams: {
listName: 'list', listName: 'list',
tableOption: { tableOption: {
width:120, width: 200,
align:'center' align: 'center'
}, },
tableColumns: [ tableColumns: [
{ {
...@@ -172,7 +206,8 @@ export default { ...@@ -172,7 +206,8 @@ export default {
{ {
label: '发放员工', label: '发放员工',
prop: 'staffList', prop: 'staffList',
width: 150, width: 200,
line: 1,
formatter: cellValue => { formatter: cellValue => {
return cellValue.staffList.map(item => item.staffName).join(',') return cellValue.staffList.map(item => item.staffName).join(',')
} }
...@@ -260,6 +295,55 @@ export default { ...@@ -260,6 +295,55 @@ export default {
}, },
methods: { methods: {
getQrcode(staffId) {
// 正式版为:release,体验版为: trial 开发版为:develop
let merchantId = this.$globalState.session.merchantId
const appId = this.getAppId()
const params = {
appId,
path: 'packageEquity/pages/directional/directional',
envVersion: process.env.NODE_ENV === 'production' ? 'release':'trial',
scene: `id=${this.curId}&merchantId=${merchantId}&staffUUID=${staffId}`
}
this.imgLoading = true
this.$apis.giftBag.getQrcode(params).then(res => {
if (res) {
this.curQrcode = res
}
this.imgLoading = false
})
},
getAppId(){
const host = window.location.host
if(host.indexOf('beta')>-1){
return 'wx9f91c1ec493eb425'
}else if(host.indexOf('cgacar')>-1){
return 'wxfe82b8d65d07808f'
}else{
return 'wxe10067a63c1856ac'
}
},
changeStaff(e) {
this.getQrcode(e)
},
makeQrcode(row) {
this.curId = row.id
this.curStaffList = row.staffList
this.curStaffId = row.staffList[0].staffUUID
this.isQrcodeVisible = true
this.getQrcode(this.curStaffId)
},
handleCancelConfirm() {
downloadIamge(this.curQrcode)
this.handleCancelClose()
},
handleCancelClose() {
this.curId = ''
this.curStaffId = ''
this.curQrcode = ''
this.curStaffList = []
this.isQrcodeVisible = false
},
getParams() { getParams() {
var params = JSON.parse(JSON.stringify(this.searchForm)) var params = JSON.parse(JSON.stringify(this.searchForm))
if (this.searchForm.createDate.length) { if (this.searchForm.createDate.length) {
...@@ -398,7 +482,7 @@ export default { ...@@ -398,7 +482,7 @@ export default {
} }
</script> </script>
<style lang="scss"> <style lang="scss" scoped>
.p-b-12 { .p-b-12 {
margin-bottom: 14px; margin-bottom: 14px;
font-weight: 500; font-weight: 500;
...@@ -411,6 +495,42 @@ export default { ...@@ -411,6 +495,42 @@ export default {
margin-right: 8px; margin-right: 8px;
display: inline-block; display: inline-block;
} }
.qr-dialog {
/deep/.el-dialog__body {
padding: 20px;
.el-scrollbar__wrap {
overflow: hidden;
}
.qrcode-body {
display: flex;
flex-direction: column;
align-items: center;
p {
line-height: 28px;
margin-bottom: 16px;
}
.el-select {
.el-input__inner {
width: 360px;
height: 36px;
}
.el-input__icon {
line-height: 36px;
}
}
.img {
margin-top: 16px;
&,
img {
width: 160px;
height: 160px;
}
}
}
}
}
.gift-detail .gift-item { .gift-detail .gift-item {
margin-right: 80px; margin-right: 80px;
display: flex; display: flex;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!