合并冲突

master
十七 3 years ago
commit e4920e221a

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

@ -0,0 +1,52 @@
import {
service
} from "../../utils/service";
import {
localPath
} from "../api.js";
// 获取微信公众号access_token
export function getAccessToken() {
return service({
url: "/weixinApi" + "/cgi-bin/token?grant_type=client_credential&appid=wx3c108aae98b1433c&secret=9ed5097e93b5a0e909dbe2b347d068ac",
method: "get",
});
}
// 根据微信公众号access_token获取ticket
export function getTicket(accessToken, data) {
return service({
url: "/weixinApi" + "/cgi-bin/qrcode/create?access_token=" + accessToken,
method: "post",
data
});
}
// 通过ticket换取二维码
export function getQrCode(data) {
return service({
url: "/weixinMp" + "/cgi-bin/showqrcode?ticket=" + data,
method: "get",
responseType: "blob"
});
}
// 通过后台过去公众号图片
export function getJavaQrCode(data) {
return service({
url: "/api" + "/platformCoupon/thePublic",
method: "post",
responseType: "blob"
});
}
// 通过后台获取用户扫描的openid
export function getJavaOpenid(data) {
return service({
url: "/api" + "/platformCoupon/openid",
method: "post",
});
}
// 清除后台获取的openid
export function doDeleteJavaOpenid(data) {
return service({
url: "/api" + "/platformCoupon/gcopenid",
method: "post",
});
}

@ -0,0 +1,37 @@
<template>
<div>
<iframe src="https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx3c108aae98b1433c&redirect_uri=www.decaisoft.com&response_type=code&scope=snsapi_userinfo&connect_redirect=1#wechat_redirect" id="mobsf" scrolling="no" frameborder="0" style="border: 1px solid #ccc"></iframe>
</div>
</template>
<script>
export default {
data() {
return {
};
},
mounted() {
/**
* iframe-宽高自适应显示
*/
function changeMobsfIframe() {
const mobsf = document.getElementById('mobsf');
const deviceWidth = document.body.clientWidth;
const deviceHeight = document.body.clientHeight;
// mobsf.style.width = (Number(deviceWidth) - 240) + 'px'; //
// mobsf.style.height = (Number(deviceHeight) - 64) + 'px'; //
mobsf.style.width = '150px'; //
mobsf.style.height = '150px'; //
}
changeMobsfIframe()
window.onresize = function () {
changeMobsfIframe()
}
},
methods: {
},
}
</script>
<style scoped>
</style>

@ -101,17 +101,21 @@
</el-row>
<Store ref="Store" @call-back-store="callBackStore"></Store>
<Project ref="Project" @call-back-project="callBackProject"></Project>
<!-- <QrCode ref="QrCode"></QrCode> -->
</div>
</template>
<script>
import ActiveImg from './activeImg'
import Tencent from './Tencent'
import Store from '@/components/mulStore/index'
import Project from '@/components/mulProject/index'
import { partten } from "@/utils/partten/index.js";
import QrCode from "./qrCode";
export default {
name: 'Form',
components: { ActiveImg, Store, Project },
components: { ActiveImg, Tencent, Store, Project, QrCode },
data() {
return {
form: {
@ -119,6 +123,7 @@ export default {
useStoreList: [],
projectList: [],
},
qrCode: null,
rules: {
couponName: [
{ required: true, message: '请输入优惠券名称', trigger: 'blur' },
@ -176,13 +181,19 @@ export default {
],
imageUrl: [{ required: true, message: '请上传活动图片', trigger: ['blur', 'change'] }],
guaranteeMoney: [{ required: true, message: '请输入保证金', trigger: ['blur', 'change'] }],
qrCode: [{ required: true, message: '请关注公众号', trigger: ['blur', 'change'] }],
},
}
},
created() {
// this.fetchAccessToken()
},
methods: {
// ============================== ============================== //
//
handleData(row) {
console.log('row', row);
// idid
if (row.id) {
// useStoreListprojectListuseStoresuseProjects2useStoreListprojectList
@ -192,6 +203,9 @@ export default {
row.imageUrl = row.imageUrl ? row.imageUrl : partten.imagePath + row.fileLists[0].filePath + '/' + row.fileLists[0].fileName
// elementfixDate
row.fixDate = Array.from([row.startDate, row.endDate]);
}
if (row.imageUrl) {
// 使this.$refsthis.$nextTick
this.$nextTick(function () {
this.$refs.activeImg.show(row.imageUrl)

@ -0,0 +1,126 @@
<template>
<el-dialog title="公众号二维码" :visible.sync="dialogFormVisible" :close-on-click-modal="false" width="400px" @close="close" v-dialogDrag>
<div class="box" style="width: 400px; height: 400px; background-color: #FFF;">
<el-image style="width: 100%; height: 100%" :src="qrCode" fit="fill" v-if="codeNumber===1"></el-image>
<div class="img" v-if="codeNumber===2||codeNumber===3">
<img style="width:100px; height: 100px;" src="../../../../../image/check.png" fit="fill" v-if="codeNumber===2&&openid"></img>
<img style="width:100px; height: 100px;" src="../../../../../image/close.png" fit="fill" v-if="codeNumber===3"></img>
<div class="title">{{codeNumber===2?'扫码关注成功':'二维码失效'}}</div>
</div>
</div>
</el-dialog>
</template>
<script>
var getOpenid = null;
import { getAccessToken, getTicket, getQrCode, getJavaQrCode, getJavaOpenid, doDeleteJavaOpenid } from "@/api/weixin/index.js";
export default {
name: 'qrCode',
data() {
return {
qrCode: '',
openid: '',
dialogFormVisible: false,
codeNumber: 1//12/3
}
},
created() {
// this.fetchJavaQrCode()
},
methods: {
// ============================ ============================ //
show(row) {
let that = this
this.codeNumber = 1
this.openid = ''
this.dialogFormVisible = true
this.handleDeleteJavaOpenid()
setTimeout(() => {
that.codeNumber = 3
}, 600000);
},
close() {
this.qrCode = ''
this.openid = ''
this.dialogFormVisible = false
},
// ============================== ============================== //
//
fetchJavaQrCode() {
let that = this
getJavaQrCode().then(res => {
this.qrCode = window.URL.createObjectURL(res)
getOpenid = setInterval(() => {
that.fetchJavaOpenid()
}, 5000);
})
},
// openid
fetchJavaOpenid() {
getJavaOpenid().then(res => {
if (res.data[0]) {
this.codeNumber = 2
this.openid = res.data[0]
this.$emit('call-back-qrCode', res.data[0]);
clearInterval(getOpenid)
}
})
},
// openid
handleDeleteJavaOpenid() {
doDeleteJavaOpenid().then(res => {
if (res.code == '000000') {
this.fetchJavaQrCode()
}
})
},
// access_token
// fetchAccessToken() {
// getAccessToken().then(res => {
// if (res.expires_in == 7200) {
// this.fetchTicket(res.access_token)
// }
// })
// },
// access_tokenticket
// fetchTicket(data) {
// getTicket(data, { "expire_seconds": 1800, "action_name": "QR_SCENE", "action_info": { "scene": { "scene_id": 1800 } } }).then(res => {
// this.fetchQrCode(res.ticket)
// })
// },
// ticket
// fetchQrCode(data) {
// getQrCode(data).then(res => {
// this.qrCode = window.URL.createObjectURL(res)
// })
// },
},
}
</script>
<style>
.el-dialog .el-dialog__body {
padding: 0 !important;
}
</style>
<style scoped>
.box {
position: relative;
}
.img {
position: absolute;
top: 27px;
left: 27px;
width: 346px;
height: 346px;
background-color: #808080;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
.title {
font-size: 28px;
color: #fff;
margin-top: 30px;
}
</style>

@ -25,6 +25,7 @@
/* margin-bottom: 30px; */
padding: 13px;
background-color: #f8f8f8;
overflow-y: auto;
}
.container .box .box-item > .item .image {
height: 250px;
@ -61,11 +62,41 @@
margin-bottom: 10px;
}
.container .box .box-item > .item .tips .tips_msg .tips_msg_item {
color: #000;
line-height: 18px;
line-height: 20px;
display: flex;
}
.container .box .box-item > .item .tips .tips_msg .tips_msg_item .bot {
.container
.box
.box-item
> .item
.tips
.tips_msg
.tips_msg_item
.tips_msg_item_title {
width: 64px;
color: #666;
}
.container
.box
.box-item
> .item
.tips
.tips_msg
.tips_msg_item
.tips_msg_item_content {
width: 210px;
}
.tips .tips_msg .tips_msg_item .tips_msg_item_titles {
width: 30px;
}
.tips .tips_msg .tips_msg_item .tips_msg_item_titles .bot {
width: 8px;
height: 8px;
background-color: #fc9c24;
margin-top: 6px;
border-radius: 50%;
}
/* .container .box .box-item > .item .tips .tips_msg .tips_msg_item .bot {
width: 25px;
padding-top: 6px;
}
@ -75,4 +106,4 @@
border-radius: 50%;
background-color: #fc9c24;
line-height: 18px;
}
} */

@ -14,13 +14,67 @@
<div class="item">分享</div>
</div>
<div class="tips">
<div class="tips_title">风险提示</div>
<div class="tips_title">优惠规则</div>
<div class="tips_msg">
<!-- 优惠金额 -->
<div class="tips_msg_item">
<div class="bot">
<div></div>
<div class="tips_msg_item_title">优惠金额</div>
<div class="tips_msg_item_content" v-if="form.couponType===0">
{{form.serviceConditions===0?`${form.fullReductionMoney}元减${form.fullKimsMoney}`:`${form.fullKimsMoney}元无门槛代金券`}}
</div>
<div class="tips_msg_item_content" v-if="form.couponType===1">
{{form.serviceConditions===0?`消费单据满${form.fullReductionMoney}元打${form.fullDiscountMoney}%折扣`:`${form.fullDiscountMoney}无门槛折扣券`}}
</div>
<div class="tips_msg_item_content" v-if="form.couponType===2"></div>
</div>
<!-- 分润金额 -->
<div class="tips_msg_item">
<div class="tips_msg_item_title">分润金额</div>
<div class="tips_msg_item_content" v-if="form.shareCommissionRules===0">
每一位领取人消费后可获得{{form.fixedAmount}}元分润可提现至微信</div>
<div class="tips_msg_item_content" v-if="form.shareCommissionRules===1">
每一位领取人消费后可获得消费单据的{{form.orderCommission}}%分润可提现至微信</div>
</div>
<!-- 有效日期 -->
<div class="tips_msg_item">
<div class="tips_msg_item_title">有效日期</div>
<div class="tips_msg_item_content" v-if="form.indateType===1">
{{date.startDate}} {{date.endDate}}
</div>
<div class="tips_msg_item_content" v-if="form.indateType===0">
领取后{{form.startDay}}天生效,生效后{{form.endDay}}天内有效</div>
</div>
<!-- 适用门店 -->
<div class="tips_msg_item">
<div class="tips_msg_item_title">适用门店</div>
<div class="tips_msg_item_content">{{form.suitableStore===0?'所有门店':storeList}}
</div>
</div>
<!-- 适用项目 -->
<div class="tips_msg_item">
<div class="tips_msg_item_title">适用项目</div>
<div class="tips_msg_item_content">{{form.suitableProject===0?'所有项目':projectList}}
</div>
<div class="tips_msg_item_content">请先点击领取优惠券后再分享否则分享出去的优惠券领取人消费后的分润不属于您</div>
</div>
</div>
</div>
<div class="tips">
<div class="tips_title">风险提示</div>
<div class="tips_msg">
<div class="tips_msg_item">
<div class="tips_msg_item_titles">
<div class="bot"></div>
</div>
<div class="tips_msg_item_contents" v-if="form.shareCommissionRules===0">
分享被领取后且优惠券被领取人消费了即可获得{{form.fixedAmount}}元分润金额并且可提现到微信</div>
<div class="tips_msg_item_contents" v-if="form.shareCommissionRules===1">
分享被领取后且优惠券被领取人消费了即可获得消费单据的{{form.orderCommission}}%分润金额并且可提现到微信</div>
</div>
<div class="tips_msg_item">
<div class="tips_msg_item_titles">
<div class="bot"></div>
</div>
<div class="tips_msg_item_contents">需要先领取优惠券后再分享这样其他扔领取了您分享的优惠券并消费后才会获得分润否则无法获得分润</div>
</div>
</div>
</div>
@ -37,23 +91,37 @@
</div>
</el-col>
</el-row>
<QrCode ref="QrCode" @call-back-qrCode="callBackQrCode"></QrCode>
</div>
</template>
<script>
import { doAdd, doEdit } from "@/api/discount-coupon/management.js";
import Bus from "../../../bus";
import QrCode from "./qrCode";
export default {
components: { QrCode },
data() {
return {
imageUrl: '',
form: {}
form: {},
date: {},
storeList: [],
projectList: [],
}
},
methods: {
//
handleData(form) {
console.log('form', form);
this.imageUrl = form.imageUrl
this.date.startDate = this.$parseTime(form.startDate, '{y}-{m}-{d}')
this.date.endDate = this.$parseTime(form.endDate, '{y}-{m}-{d}')
if (form.suitableStore === 1) {
this.storeList = form.useStoreList.map(item => item.storeName).toString()
console.log('useStoreList', this.useStoreList);
}
if (form.suitableProject === 1) {
this.projectList = form.projectList.map(item => item.projectName).toString()
}
this.form = Object.assign({}, form);
},
//
@ -62,6 +130,7 @@ export default {
},
//
async handleSubmit() {
if (this.form.openId) {
let form = Object.assign({}, this.form);
for (let key in form) {
// formatnullnullnull
@ -74,8 +143,12 @@ export default {
}
}
// IDmapstoreNumprojectId
if (form.suitableStore === 1) {
form.useStoreList = form.useStoreList.map(item => item.storeNum);
}
if (form.suitableProject === 1) {
form.projectList = form.projectList.map(item => item.projectId);
}
//
let format = new FormData()
//
@ -91,6 +164,9 @@ export default {
let { code, message } = await doAdd(format)
this.callBack(code, message)
}
} else {
this.$refs.QrCode.show()
}
},
callBack(code, message) {
if (code == '000000') {
@ -107,6 +183,12 @@ export default {
type: 'error'
});
}
},
// ================================== openid ================================== //
callBackQrCode(openid) {
let form = Object.assign({}, this.form);
form.openId = openid
this.form = Object.assign({}, form);
}
},
}

@ -32,20 +32,21 @@ export default {
}
},
created() {
if (this.$route.params.id) {
this.active = 1
this.$nextTick(function () {
this.$refs.edit.handleData(this.$route.params)
});
} else {
this.$nextTick(function () {
this.$refs.edit.handleData({
couponNumber: 1,
useStoreList: [],
projectList: [],
})
});
}
// this.getAuthorize();
// if (this.$route.params.id) {
// this.active = 1
// this.$nextTick(function () {
// this.$refs.edit.handleData(this.$route.params)
// });
// } else {
// this.$nextTick(function () {
// this.$refs.edit.handleData({
// couponNumber: 1,
// useStoreList: [],
// projectList: [],
// })
// });
// }
},
watch: {
$route(to, from) {
@ -87,6 +88,53 @@ export default {
});
}
},
// =================================== code =================================== //
getAuthorize() {
//
// const isWechat = () => {
// let ua = window.navigator.userAgent.toLowerCase();
// return ua.match(/MicroMessenger/i) == 'micromessenger';
// }
//
// if(isWechat){
//(code--)
var str = this.getUrlParam("code"); //使historyhashthis.getUrlParam()
console.log('获取到了 ', str);
if (str) {
// (codecodeopenID)
// console.log('str',str);
// code openid
axios.get('你的url' + "/api/code",
{
params: {
code: str,
state: '123'
},
}
).then(response => {
console.log('response', response.data);
localStorage.setItem("openid", response.data.openid);// openid
})
} else {
var appid = 'wx3c108aae98b1433c' //appid;
var redirect_uri = window.location.href //code ;
var newRedirect = encodeURIComponent(redirect_uri); // 使
window.location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + appid + "&redirect_uri=" + newRedirect + "&response_type=code&scope=snsapi_userinfo&state=123#wechat_redirect";
}
// }
},
//url
getUrlParam(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //
var r = window.location.search.substr(1).match(reg); //
if (r != null) {
return unescape(r[2]);
}
return null; //
},
},
}
</script>

@ -27,6 +27,13 @@
<el-tag effect="dark" type="warning" v-if="row.state===4"></el-tag>
<el-tag effect="dark" type="danger" v-if="row.state===11"></el-tag>
<el-tag effect="dark" type="danger" v-if="row.state===12">退</el-tag>
<el-tag effect="dark" type="success" v-if="row.state===5"></el-tag>
<el-tag effect="dark" type="success" v-if="row.state===6"></el-tag>
<el-tag effect="dark" type="danger" v-if="row.state===11"></el-tag>
<el-tag type="danger" v-if="row.state===7"></el-tag>
<el-tag effect="dark" type="success" v-if="row.state===8"></el-tag>
<el-tag effect="dark" type="warning" v-if="row.state===9"></el-tag>
<el-tag effect="dark" type="success" v-if="row.state===10"></el-tag>
</template>
</el-table-column>
<el-table-column show-overflow-tooltip align="center" min-width="130" prop="couponName" label="优惠券名称"></el-table-column>

Loading…
Cancel
Save