Commit ce33d802 authored by xd's avatar xd

通讯录修改,精准营销修改

parent 2e4e1d65
......@@ -39,18 +39,19 @@
<el-input
size="small"
v-model="addForm.oyStallMemberId"
placeholder="门店会员id:"
placeholder="门店会员id"
style="width: 50%;"
/>
</el-form-item>
<el-form-item label="设置主管:" prop="clerkId" >
<el-cascader :props="props" v-model="deptId" :disabled="ifDisabled" :options="parentDeptList" :show-all-levels="false" filterable style="width: 30%;margin-right:15px;" @change="handleParentChange" ></el-cascader>
<el-select v-model="addForm.clerkId" filterable multiple placeholder="请选择" style="width: 30%;" clearble>
<el-select v-model="clerkId" filterable multiple placeholder="请选择" style="width: 30%;" clearble @change="handleMemberChange">
<el-option
v-for="item in peopleList"
:key="item.id"
:label="item.userName"
:value="item.id">
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
......@@ -96,7 +97,16 @@ export default {
callback();
}
}
const memberNumber = (rule, value, callback) => {
let idReg = /^\+?(0|[1-9][0-9]*)$/
if (!idReg.test(value) && value != '') {
callback(new Error("只可以输入正整数"))
} else {
callback();
}
}
return {
clerkId: [],
treeData: [],
group_name: "",
shop_code: "",
......@@ -115,7 +125,7 @@ export default {
oyStallName: '',
oyStallMemberId: '',
oyStallCode: '',
clerkId: []
clerkId: ''
},
detail: 2,
ifDisabled: false,
......@@ -131,7 +141,8 @@ export default {
],
parentId: [{ required: true, message: "请选择上级部门", trigger: "change" }],
oyStallCode: [{ required: true, validator: idNumber, trigger: "blur" }],
clerkId: [{ required: true, message: "主管不能为空", trigger: "blur" }]
oyStallMemberId: [{ required: false, validator: memberNumber, trigger: "blur" }],
clerkId: [{ required: true, message: "主管不能为空", trigger: "change" }]
},
deptOption: {
value: 'id',
......@@ -191,7 +202,7 @@ export default {
});
},
handleParentChange(val) {
this.addForm.clerkId = []
this.clerkId = []
this.getGroupMember(val)
},
......@@ -211,7 +222,7 @@ export default {
handleAddFinish(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
const clerkIds = this.addForm.clerkId + ""
const clerkIds = this.clerkId + ""
let data = Object.assign(this.addForm,{ clerkIds })
delete data.clerkId
addGroup(data).then(res => {
......@@ -241,6 +252,15 @@ export default {
this.peopleList = res.data
this.ifDisabled = false
})
},
handleMemberChange(val) {
console.log(val,'..');
if(val.length == 0) {
this.addForm.clerkId = ''
}else {
this.addForm.clerkId = '验证用'
}
}
}
};
......
......@@ -40,13 +40,13 @@
<el-input
size="small"
v-model="addForm.oyStallMemberId"
placeholder="门店会员id:"
placeholder="请输入门店会员id"
style="width: 50%;"
/>
</el-form-item>
<el-form-item label="设置主管:" prop="clerkId" >
<el-cascader :props="props" v-model="deptId" :options="parentDeptList" :disabled="ifDisabled" :show-all-levels="false" filterable style="width: 30%;margin-right:15px;" @change="handleParentChange" ></el-cascader>
<el-select v-model="addForm.clerkId" filterable multiple placeholder="请选择" style="width: 30%;" clearble>
<el-select v-model="clerkId" filterable multiple placeholder="请选择" style="width: 30%;" clearble @change="handleMemberChange" >
<el-option
v-for="item in peopleList"
:key="item.id"
......@@ -100,13 +100,21 @@ export default {
} else {
callback();
}
}
const memberNumber = (rule, value, callback) => {
let idReg = /^\+?(0|[1-9][0-9]*)$/
if (!idReg.test(value) && value != '') {
callback(new Error("只可以输入正整数"))
} else {
callback();
}
}
return {
treeData: [],
group_name: "",
shop_code: "",
showTree: false,
clerkId: [],
params: {
d_name: "",
d_parentId: "",
......@@ -120,7 +128,7 @@ export default {
oyStallName: '',
oyStallMemberId: '',
oyStallCode: '',
clerkId: []
clerkId: ''
},
detail: 2,
deptId: '',
......@@ -135,7 +143,7 @@ export default {
],
parentId: [{ required: true, message: "请选择上级部门", trigger: "change" }],
oyStallCode: [{ required: true, validator: idNumber, trigger: "blur" }],
clerkId: [{ required: true, message: "主管不能为空", trigger: "blur" }]
clerkId: [{ required: true, message: "主管不能为空", trigger: "change" }]
},
deptOption: {
value: 'id',
......@@ -190,14 +198,16 @@ export default {
this.formLoading = true
getDeptDetail({id:this.groupId}).then(res=> {
console.log(res,"详情")
this.addForm.clerkId = clerkId
// this.addForm.clerkId = clerkId
this.addForm = res.data.organization
const clerkId = []
res.data.supervisors.forEach(item => {
clerkId.push(item.id)
})
this.$set(this.addForm,'clerkId',clerkId)
this.addForm.clerkId = clerkId
this.clerkId = clerkId
this.addForm.clerkId = "验证用"
// this.addForm.clerkId = clerkId
this.getDeptList()
const deptId = ''
this.deptId = res.data.supervisors[0].departmentId
......@@ -214,7 +224,6 @@ export default {
}
getEditOrg(params).then(res => {
console.log(res,'数据111');
this.orgTree = [res.data]
})
},
......@@ -240,7 +249,7 @@ export default {
handleEditFinish(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
const clerkIds = this.addForm.clerkId+""
const clerkIds = this.clerkId+""
let data = Object.assign(this.addForm,{ clerkIds })
delete data.clerkId
editDept(data).then(res => {
......@@ -262,6 +271,13 @@ export default {
this.peopleList = res.data
this.ifDisabled = false
})
},
handleMemberChange(val) {
if(val.length == 0) {
this.addForm.clerkId = ''
}else {
this.addForm.clerkId = '验证用'
}
}
}
};
......
......@@ -6,7 +6,7 @@
<div class="button" @click="zReadyGetUserFromId">ReLoad</div>
</div>
</div> -->
<div v-for="item of zlist.voucher" :key="item.coupon_id" >
<div v-for="item of zlist.voucher" v-show="isShow" :key="item.coupon_id" >
<div class="content">
<div class="content-imgs">
<img class="imgs-img" :src="zcache.defaultImgUrl" alt />
......@@ -28,6 +28,7 @@
</div>
</div>
</div>
<!-- <div class="no" v-show="!isShow">暂无优惠券可发放...</div> -->
</div>
</div>
</template>
......@@ -84,7 +85,8 @@ export default {
]
}
},
dis: {}
dis: {},
isShow: true
};
},
created() {
......@@ -95,13 +97,14 @@ export default {
}
this.zReadyGetUserFromId();
this.getAgentAuth();
// this.zReadySetVoucherList()
// this.getVoucherList()
},
methods: {
// 获取店铺数据
zReadyGetUserFromId() {
let postData = {
userName: this.zcache.userId
// userName: this.zcache.userId
userName: 'ShanDian'
}
getUserInfoByUserId(postData)
.then(res => {
......@@ -109,8 +112,34 @@ export default {
alert('您当前没有绑定店铺')
}else {
// this.zcache.storeId = res.data[0].oyStallCode
res.data.forEach(item => {
this.zReadySetVoucherList(item.oyStallCode)
// let list = []
// res.data.forEach(item => {
// this.getVoucherList(item.oyStallCode).then(res => {
// console.log(res,'优惠券数据')
// this.zlist.voucher.push(...res)
// console.log(this.zlist.voucher,'this.zlist.voucher')
// })
// console.log(this.zlist.voucher,'111')
// })
let arr = res.data.map( item => {
return this.getVoucherList(item.oyStallCode)
})
console.log();
let promiseAll = Promise.all([
res.data.map( item => {
let obj = this.getVoucherList(item.oyStallCode)
return obj
})
])
console.log(promiseAll,'promiseAll');
promiseAll.then(res =>{
console.log(res,'sss');
})
}
......@@ -118,22 +147,40 @@ export default {
.catch(err => {})
},
// 获取优惠券列表
zReadySetVoucherList(mdid) {
// getVoucherList(mdid) {
// const postData = {
// appCode: "0696", // j接口编码
// mdid: mdid
// }
// getVoucherList(postData).then(res => {
// if(res.errCode == 0) {
// if(res.result.coupons.length != 0) {
// return(res.result.coupons)
// }
// }
// })
// .catch(err => {
// })
// },
getVoucherList(mdid) {
const postData = {
appCode: "0696", // j接口编码
mdid: mdid
}
return new Promise(function(resolve, reject) {
getVoucherList(postData).then(res => {
console.log(res,'优惠券列表');
if(res.errCode == 0) {
if(res.result.coupons.length != 0) {
this.zlist.voucher.push(...res.result.coupons)
resolve(res.result.coupons)
}
console.log(this.zlist.voucher,'this.zlist.voucher')
}
})
.catch(err => {
reject(err)
})
})
},
// 推送链接
handlePush(link) {
......@@ -154,100 +201,17 @@ export default {
}
}
)
},
// zVoucherPick(inActiveId, inVoucherId) {
// this.zcache.now.activeId = String(inActiveId)
// this.zcache.now.voucherId = String(inVoucherId)
// this.zlist.voucherUrl = "";
// const postData = {
// appCode: "0697",
// action_id: Number(inActiveId),
// coupon_id: Number(inVoucherId)
// }
// getVoucherWxUrl(postData).then(res => {
// console.log(res,'指向小程序的链接')
// this.zlist.voucherUrl = String(res.result.link);
// this.zpick('h5', String(inData))
// // this.zVoucherUrlSet(res.result.link)
// });
// },
// zpick(inMsgType, inUrl) {
// switch (inMsgType) {
// case "text":
// wx.invoke(
// "sendChatMessage",
// {
// msgtype: "text", //消息类型,必填
// text: {
// content: inUrl
// }
// },
// function(res) {
// if (res.err_msg == "sendChatMessage:ok") {
// // alert("--->discount.vue: zpick: text 分享成功!")
// } else if (res.err_msg != "sendChatMessage:ok") {
// // alert('分享失败')
// }
// }
// );
// break;
// case "h5":
// // alert(`--->discount.vue: zpick: H5: IN.`);
// // alert('zpick')
// wx.invoke(
// "sendChatMessage",
// {
// msgtype: "news", //消息类型,必填
// news: {
// link: `http://oysales.oywanhao.com/qrCode?Url=${inUrl}`, //H5消息页面url 必填
// title: "领取优惠券", //H5消息标题
// desc: inUrl, //H5消息摘要
// imgUrl: inUrl //H5消息封面图片URL
// }
// },
// function(res) {
// // alert('sendChatMessage')
// if (res.err_msg == "sendChatMessage:ok") {
// // alert("--->discount.vue: zpick: h5 分享成功!")
// } else if (res.err_msg != "sendChatMessage:ok") {
// // alert(`--->discount.vue: zpick: h5 分享失败.`)
// // alert(
// // `--->discount.vue: zpick: h5 分享失败: res =${res.err_msg}`
// // );
// }
// }
// );
// break;
// default:
// break;
// }
// },
// zVoucherUrlSet(inData) {
// this.zlist.voucherUrl = String(inData);
// this.zpick('h5', String(inData))
// },
// testEaPost() {
// let postData = {
// appCode: "0696",
// mdid: 1
// };
// ApiEaActiveList(postData).then(res => {
// // console.log(res);
// });
// },
// buttonSingleMarketingClick() {
// },
// buttonMainMarketingClick() {
// this.$router.push("MainSale");
// }
}
}
};
</script>
<style scoped>
.no {
font-size: 20px;
margin-top: 40px;
text-align: center;
}
.main {
background-color: white;
width: 100%;
......
<template>
<div class="main">
<div class="contents">
<div class="zListActive">
<!-- <div class="zListActive">
<div class="inputs">
<div class="button" @click="zReadySetVoucherList">ReLoad</div>
<div class="button" @click="zReadyGetUserFromId">ReLoad</div>
</div>
</div>
<div v-for="item of zlist.voucher" :key="item.coupon_id" >
</div> -->
<div v-for="item of zlist.voucher" v-show="isShow" :key="item.coupon_id" >
<div class="content">
<div class="content-imgs">
<img class="imgs-img" :src="zcache.defaultImgUrl" alt />
......@@ -18,7 +18,7 @@
<div class="main-money">{{item.coupon_title}}</div>
</div>
<div class="buttons">
<button class="button-send" @click="zVoucherPick(item.action_id, item.coupon_id)">推送</button>
<button class="button-send" @click="handlePush(item.coupon_link)">推送</button>
</div>
</div>
<div class="infos-tips">
......@@ -28,6 +28,7 @@
</div>
</div>
</div>
<!-- <div class="no" v-show="!isShow">暂无优惠券可发放...</div> -->
</div>
</div>
</template>
......@@ -84,7 +85,8 @@ export default {
]
}
},
dis: {}
dis: {},
isShow: true
};
},
created() {
......@@ -95,185 +97,99 @@ export default {
}
this.zReadyGetUserFromId();
this.getAgentAuth();
// this.zReadySetVoucherList()
},
mounted() {
// this.getVoucherList()
},
methods: {
// 测试-获取预授权码
zTestPreAuthCode() {
const basicInfo = {
head: "https://open.weixin.qq.com/connect/oauth2/authorize?",
// appId: "wwd1cdbca7b8b2b6c4",
appId: "ww4df265003b43fa0d",
redirectUrI: encodeURIComponent("oysales.oywanhao.com"),
responseType: "code",
scope: "snsapi_base",
state: "ztest",
tail: "#wechat_redirect"
};
let url =
basicInfo.head +
"appid=" +
basicInfo.appId +
"&redirect_uri=" +
basicInfo.redirectUrI +
"&response_type=" +
basicInfo.responseType +
"&scope=" +
basicInfo.scope +
"&state=" +
basicInfo.state +
basicInfo.tail;
zlog("%c--->zTestPreAuthCode: Url =", "background: orange", url);
// window.location.href = url
},
// 获取店铺数据
zReadyGetUserFromId() {
let postData = {
userName: this.zcache.userId
// userName: 'ShanDian'
}
getUserInfoByUserId(postData)
.then(res => {
// alert(`--->userInfoFromId: res = ${JSON.stringify(res.data)}`);
// this.zcache.userInfo = String(res.data[0].departmentId);
if(res.data[0].oyStallCode == '') {
if(res.data.length == 0) {
alert('您当前没有绑定店铺')
}else {
this.zcache.storeId = res.data[0].oyStallCode
// this.zcache.storeId = Number(res.data[0].stall);
this.zReadySetVoucherList()
res.data.forEach(item => {
this.getVoucherList(item.oyStallCode).then(res => {
console.log(res,'优惠券数据')
this.zlist.voucher.push(...res)
console.log(this.zlist.voucher,'this.zlist.voucher')
})
console.log(this.zlist.voucher,'111')
})
}
})
.catch(err => {})
},
// 获取优惠券列表
zReadySetVoucherList() {
this.zReadyDelVoucherList();
// getVoucherList(mdid) {
// const postData = {
// appCode: "0696", // j接口编码
// mdid: mdid
// }
// getVoucherList(postData).then(res => {
// if(res.errCode == 0) {
// if(res.result.coupons.length != 0) {
// return(res.result.coupons)
// }
// }
// })
// .catch(err => {
// })
// },
getVoucherList(mdid) {
const postData = {
appCode: "0696", // j接口编码
mdid: this.zcache.storeId
mdid: mdid
}
return new Promise(function(resolve, reject) {
getVoucherList(postData).then(res => {
if(res.result.coupons.length == 0) {
alert('当前店铺暂无优惠券可发放')
}else {
this.zVoucherSet(res.result.coupons)
if(res.errCode == 0) {
if(res.result.coupons.length != 0) {
resolve(res.result.coupons)
}
}
})
.catch(err => {
reject(err)
})
})
},
zReadyDelVoucherList() {
this.zVoucherDel()
this.zVoucherUrlDel()
},
zVoucherPick(inActiveId, inVoucherId) {
this.zcache.now.activeId = String(inActiveId)
this.zcache.now.voucherId = String(inVoucherId)
this.zVoucherUrlDel()
const postData = {
appCode: "0697",
action_id: Number(inActiveId),
coupon_id: Number(inVoucherId)
}
getVoucherWxUrl(postData).then(res => {
this.zVoucherUrlSet(res.result.link)
});
},
zpick(inMsgType, inUrl) {
switch (inMsgType) {
case "text":
wx.invoke(
"sendChatMessage",
{
msgtype: "text", //消息类型,必填
text: {
content: inUrl
}
},
function(res) {
if (res.err_msg == "sendChatMessage:ok") {
// alert("--->discount.vue: zpick: text 分享成功!")
} else if (res.err_msg != "sendChatMessage:ok") {
// alert('分享失败')
}
}
);
break;
case "h5":
// alert(`--->discount.vue: zpick: H5: IN.`);
// alert('zpick')
// 推送链接
handlePush(link) {
wx.invoke(
"sendChatMessage",
{
msgtype: "news", //消息类型,必填
news: {
link: `http://oysales.oywanhao.com/qrCode?Url=${inUrl}&activeId=${this.zcache.now.activeId}&voucherId=${this.zcache.now.voucherId}&unionId=1234`, //H5消息页面url 必填
link: `http://oysales.oywanhao.com/qrCode?Url=${link}`, //H5消息页面url 必填
title: "领取优惠券", //H5消息标题
desc: inUrl, //H5消息摘要
imgUrl: inUrl //H5消息封面图片URL
desc: '', //H5消息摘要
imgUrl: '' //H5消息封面图片URL
}
},
function(res) {
// alert('sendChatMessage')
if (res.err_msg == "sendChatMessage:ok") {
// alert("--->discount.vue: zpick: h5 分享成功!")
} else if (res.err_msg != "sendChatMessage:ok") {
// alert(`--->discount.vue: zpick: h5 分享失败.`)
// alert(
// `--->discount.vue: zpick: h5 分享失败: res =${res.err_msg}`
// );
}
}
);
break;
default:
break;
}
},
zVoucherSet(inArray) {
// alert('zVoucherSet')
this.zlist.voucher = inArray;
},
zVoucherDel() {
this.zlist.voucher = [];
},
zVoucherUrlSet(inData) {
this.zlist.voucherUrl = String(inData);
this.zpick('h5', String(inData))
},
zVoucherUrlDel() {
this.zlist.voucherUrl = "";
},
testEaPost() {
let postData = {
appCode: "0696",
mdid: 1
};
ApiEaActiveList(postData).then(res => {
// console.log(res);
});
},
buttonSingleMarketingClick() {
// this.$router.push("");
},
buttonMainMarketingClick() {
this.$router.push("MainSale");
)
}
}
};
</script>
<style scoped>
.no {
font-size: 20px;
margin-top: 40px;
text-align: center;
}
.main {
background-color: white;
width: 100%;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment