285 lines
13 KiB
PHP
285 lines
13 KiB
PHP
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport"
|
|
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
|
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
<title><?= $_title ?></title>
|
|
<link rel="stylesheet" href="/css/h5/lichene/h5.css?v=1">
|
|
<script src="https://qs.liche.cn/web/javascript/jquery.3.4.1.min.js"></script>
|
|
<script type="text/javascript" src="https://qs.liche.cn/web/javascript/vue.2.6.10.min.js"></script>
|
|
<script type="text/javascript" src="https://qs.liche.cn/web/javascript/qs.js"></script>
|
|
<script type="text/javascript" src="https://qs.liche.cn/web/javascript/mDialog.js"></script>
|
|
<script src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
|
|
<script src="https://open.work.weixin.qq.com/wwopen/js/jwxwork-1.0.0.js"></script>
|
|
</head>
|
|
|
|
<body class="bg-f7">
|
|
<div id="app">
|
|
<div class="container">
|
|
<div class="inner30">
|
|
<div class="inner30 bg-fff ulib-r10">
|
|
<div class="relative">
|
|
<img class="block imgsize-90X90 ulib-r5" :src="userInfo.avatar" alt="#"/>
|
|
<div class="absolute pl100 box-middle font-30">
|
|
<span class="text-middle">{{userInfo.name}}</span>
|
|
<i class="text-middle iconfont icon-nanxing color-2b78f5" v-if="userInfo.gender==0"></i>
|
|
<i class="text-middle iconfont icon-nvshangjia color-fb3aab" v-if="userInfo.gender==1"></i>
|
|
<span class="text-middle color-36b229">{{userInfo.source}}</span>
|
|
</div>
|
|
<button :class="'absolute right-0 box-middle btn pt15 pb15 pl30 pr30 text-center font-30 color-fff ulib-r10 ' + [submitFlag?'bg-b5':'bg-3f91fd']"
|
|
:disabled="submitFlag" @click="postToBiz()">到店
|
|
</button>
|
|
</div>
|
|
<!-- <div class="bg-f7 mt30 pt20 pb20 pl30 pr30 font-30 color-2b78f5 ulib-r10">点击关联企业</div> -->
|
|
<div class="mt20 pl140 relative bbs-1-eee last-b-none">
|
|
<div class="absolute left-0 box-middle font-28 color-666">手机号</div>
|
|
<div v-if="userInfo.c_id" class="pt10 pb10 text-right font-28">{{userInfo.mobile}}</div>
|
|
<input v-else class="wp100 pl20 pr20 pt30 pb30 font-28 bds-1-ddd bds-none text-right" type="tel"
|
|
placeholder="请输入客户手机号" v-model="userInfo.mobile"/>
|
|
</div>
|
|
<div class="mt20 pl140 relative bbs-1-eee last-b-none">
|
|
<div class="absolute left-0 box-middle font-28 color-666">线索来源</div>
|
|
<div class="pt10 pb10 text-right">
|
|
<select :class="'bds-none font-28 bg-fff ' + [of_id == 0 ? 'color-ccc' : 'color-333']"
|
|
v-model="of_id" @change="changeOf1" id="id-of_id">
|
|
<option :value="0">请选择</option>
|
|
<option :value="item.id" v-for="item in sources">{{item.name}}</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="mt20 pl140 relative bbs-1-eee last-b-none"
|
|
v-if="of_id_index>-1&&sources[of_id_index].list.length>0">
|
|
<div class="absolute left-0 box-middle font-28 color-666">{{sources[of_id_index].name}}</div>
|
|
<div class="pt10 pb10 text-right">
|
|
<select :class="'bds-none font-28 bg-fff ' + [of2_id == 0 ? 'color-ccc' : 'color-333']"
|
|
v-model="of2_id" id="id-of2_id">
|
|
<option :value="0">请选择</option>
|
|
<option :value="item.id" v-for="item in sources[of_id_index].list">{{item.name}}</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="mt30 inner30 pb50 bg-fff ulib-r10">
|
|
<div class="mt20 font-36 text-center text-bold">客户画像</div>
|
|
<div class="relative mt40" v-for="(list,i) in taglList">
|
|
<div class="font-28">
|
|
<span class="text-middle">{{list.name}}</span>
|
|
<span class="text-middle font-24" v-if="list.type=='radio'">(单选)</span>
|
|
<span class="text-middle font-24" v-if="list.type=='checkbox'">(多选)</span>
|
|
</div>
|
|
<div class="fn-clear" v-if="list.type=='radio'">
|
|
<div v-for="(option,j) in list.list"
|
|
:class="'inline-block space-nowrap mt20 mr20 pt15 pb15 pl30 pr30 font-22 ulib-r10 ' + [option.checked ? 'bg-3f91fd color-fff' : 'bg-f6 color-666']"
|
|
@click="radioPicker(i,j)">{{option.name}}
|
|
</div>
|
|
</div>
|
|
<vdiv class="fn-clear" v-if="list.type=='checkbox'">
|
|
<div v-for="(option,j) in list.list"
|
|
:class="'inline-block space-nowrap mt20 mr20 pt15 pb15 pl30 pr30 font-22 ulib-r10 ' + [option.checked ? 'bg-3f91fd color-fff' : 'bg-f6 color-666']"
|
|
@click="checkPicker(i,j)">{{option.name}}
|
|
</div>
|
|
</vdiv>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="pt50 pb50 pl60 pr60">
|
|
<button :class="'wp100 btn pt30 pb30 text-center font-32 color-fff ulib-r750 ' + [submitFlag?'bg-b5':'bg-3f91fd']"
|
|
:disabled="submitFlag" @click="postUser()">确认保存
|
|
</button>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
var loading = mDialog.load({shade: false, text: "",});
|
|
let hostUrl = ''
|
|
var app = new Vue({
|
|
el: '#app',
|
|
data: {
|
|
submitFlag: false,
|
|
userInfo: {avatar: '/img/h5/avatar.png', c_id: 0},
|
|
taglList: [],
|
|
of_id_index: -1,
|
|
of_id: 0,
|
|
of2_id: 0,
|
|
sources: [],
|
|
},
|
|
created() {
|
|
|
|
},
|
|
computed: {},
|
|
mounted() {
|
|
},
|
|
methods: {
|
|
//选择一级线索来源
|
|
changeOf1() {
|
|
if (this.of_id > 0) {
|
|
this.sources.forEach((item, index) => {
|
|
if (item.id == this.of_id) {
|
|
this.of_id_index = index
|
|
this.of2_id = 0
|
|
}
|
|
})
|
|
} else {
|
|
this.of_id_index = -1;
|
|
}
|
|
},
|
|
//获取用户信息
|
|
getUser(external_userid) {
|
|
let that = this;
|
|
$.ajax({
|
|
url: '/h5/lichene/get_user',
|
|
type: 'get',
|
|
dataType: 'json',
|
|
data: {
|
|
external_userid: external_userid
|
|
},
|
|
beforeSend: function () {
|
|
},
|
|
success: function (re) {
|
|
if (re.code == 200) {
|
|
that.taglList = re.data['tagList'];
|
|
that.sources = re.data['sources'];
|
|
that.userInfo = re.data['userInfo'];
|
|
that.of_id = re.data['of_id'];
|
|
that.of2_id = re.data['of2_id'];
|
|
that.of_id_index = re.data['of_id_index'];
|
|
} else {
|
|
mDialog.msg({content: re.msg});
|
|
}
|
|
},
|
|
complete: function () {
|
|
loading && mDialog.close(loading); //关闭加载
|
|
}
|
|
});
|
|
},
|
|
//到店
|
|
postToBiz() {
|
|
let that = this;
|
|
if (!that.userInfo.mobile) {
|
|
mDialog.msg({content: "请输入手机号"});
|
|
return
|
|
}
|
|
var of_title = that.of_id ? $("#id-of_id").find("option:selected").text() : '';
|
|
var of2_title = that.of2_id ? $("#id-of2_id").find("option:selected").text() : '';
|
|
$.ajax({
|
|
url: '/h5/lichene/post_to_biz',
|
|
type: 'post',
|
|
dataType: 'json',
|
|
data: {
|
|
userInfo: that.userInfo,
|
|
taglList: that.taglList,
|
|
of_id: that.of_id,
|
|
of2_id: that.of2_id,
|
|
of_title: of_title,
|
|
of2_title: of2_title,
|
|
},
|
|
beforeSend: function () {
|
|
loading = mDialog.load({shade: false, text: "",});
|
|
that.submitFlag = true;
|
|
},
|
|
success: function (re) {
|
|
mDialog.msg({content: re.msg});
|
|
},
|
|
complete: function () {
|
|
loading && mDialog.close(loading); //关闭加载
|
|
that.submitFlag = false;
|
|
}
|
|
});
|
|
},
|
|
//保存
|
|
postUser() {
|
|
let that = this;
|
|
if (!that.userInfo.userid || !that.userInfo.external_userid) {
|
|
mDialog.msg({content: "保存失败"});
|
|
return
|
|
}
|
|
var of_title = that.of_id ? $("#id-of_id").find("option:selected").text() : '';
|
|
var of2_title = that.of2_id ? $("#id-of2_id").find("option:selected").text() : '';
|
|
$.ajax({
|
|
url: '/h5/lichene/post_user',
|
|
type: 'post',
|
|
dataType: 'json',
|
|
data: {
|
|
userInfo: that.userInfo,
|
|
taglList: that.taglList,
|
|
of_id: that.of_id,
|
|
of2_id: that.of2_id,
|
|
of_title: of_title,
|
|
of2_title: of2_title,
|
|
},
|
|
beforeSend: function () {
|
|
loading = mDialog.load({shade: false, text: "",});
|
|
that.submitFlag = true;
|
|
},
|
|
success: function (re) {
|
|
mDialog.msg({content: re.msg});
|
|
},
|
|
complete: function () {
|
|
loading && mDialog.close(loading); //关闭加载
|
|
that.submitFlag = false;
|
|
}
|
|
});
|
|
},
|
|
//单选
|
|
radioPicker(i, j) {
|
|
let taglList = this.taglList
|
|
taglList[i].list.forEach(item => {
|
|
item.checked = false
|
|
})
|
|
taglList[i].list[j].checked = true
|
|
this.taglList = taglList
|
|
},
|
|
//多选
|
|
checkPicker(i, j) {
|
|
this.taglList[i].list[j].checked = !this.taglList[i].list[j].checked
|
|
},
|
|
}
|
|
});
|
|
wx.config({
|
|
beta: true,// 必须这么写,否则wx.invoke调用形式的jsapi会有问题
|
|
debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
|
|
appId: "<?=$sign_package['appId']?>", // 必填,企业微信的corpID
|
|
timestamp: "<?=$sign_package['timestamp']?>", // 必填,生成签名的时间戳
|
|
nonceStr: "<?=$sign_package['nonceStr']?>", // 必填,生成签名的随机串
|
|
signature: "<?=$sign_package['signature']?>",// 必填,签名,见 附录-JS-SDK使用权限签名算法
|
|
jsApiList: ["agentConfig"] // 必填,需要使用的JS接口列表,凡是要调用的接口都需要传进来
|
|
});
|
|
wx.ready(function () {
|
|
wx.agentConfig({
|
|
corpid: "<?=$sign_package2['appId']?>",
|
|
agentid: "<?=$sign_package2['agentid']?>",
|
|
timestamp: "<?=$sign_package2['timestamp']?>",
|
|
nonceStr: "<?=$sign_package2['nonceStr']?>",
|
|
signature: "<?=$sign_package2['signature']?>",
|
|
jsApiList: ['getCurExternalContact', "invoke"],
|
|
success: function (res) {
|
|
wx.invoke('getCurExternalContact', {}, function (res) {
|
|
if (res.err_msg == "getCurExternalContact:ok") {
|
|
app.getUser(res.userId);//返回当前外部联系人userId
|
|
//mDialog.msg({content: "userId=" + userId});
|
|
} else {
|
|
loading && mDialog.close(loading); //关闭加载
|
|
}
|
|
});
|
|
},
|
|
fail: function (res) {
|
|
loading && mDialog.close(loading); //关闭加载
|
|
//var json = JSON.stringify(res);
|
|
//mDialog.msg({content: "agentConfig_fail=" + json});
|
|
if (res.errMsg.indexOf('function not exist') > -1) {
|
|
mDialog.msg({content: "版本过低请升级"});
|
|
}
|
|
}
|
|
});
|
|
});
|
|
wx.error(function (res) {
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|