...
|
...
|
@@ -66,107 +66,91 @@ |
|
|
<script src="__CDN__/assets/advertising/mui/mui.picker.min.js"></script>
|
|
|
<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
|
|
|
<script>
|
|
|
var picker = new mui.PopPicker();
|
|
|
picker.setData([{
|
|
|
value: '1',
|
|
|
text: '男'
|
|
|
}, {
|
|
|
value: '2',
|
|
|
text: '女'
|
|
|
}]);
|
|
|
$("#sexPicker").click(function() {
|
|
|
var sex = $(".sex_input").val();
|
|
|
if (!sex) {
|
|
|
picker.show(function(selectItems) {
|
|
|
$(".sex_input").val(selectItems[0].text)
|
|
|
})
|
|
|
}
|
|
|
|
|
|
});
|
|
|
$(function(){
|
|
|
var picker = new mui.PopPicker();
|
|
|
picker.setData([{
|
|
|
value: '1',
|
|
|
text: '男'
|
|
|
}, {
|
|
|
value: '2',
|
|
|
text: '女'
|
|
|
}]);
|
|
|
$("#sexPicker").click(function() {
|
|
|
var sex = $(".sex_input").val();
|
|
|
if (!sex) {
|
|
|
picker.show(function(selectItems) {
|
|
|
$(".sex_input").val(selectItems[0].text)
|
|
|
})
|
|
|
}
|
|
|
|
|
|
// 年
|
|
|
var dtPicker = new mui.DtPicker({
|
|
|
type: "year",
|
|
|
beginDate: new Date(1815, 04, 25), //设置开始日期
|
|
|
endDate: new Date(2119, 04, 25), //设置结束日期
|
|
|
});
|
|
|
$("#agePicker").click(function() {
|
|
|
var year = $(".age_input").val();
|
|
|
if (!year) {
|
|
|
dtPicker.show(function(e) {
|
|
|
$(".age_input").val(e.y.text);
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
|
|
|
});
|
|
|
// 年
|
|
|
var dtPicker = new mui.DtPicker({
|
|
|
type: "year",
|
|
|
beginDate: new Date(1815, 04, 25), //设置开始日期
|
|
|
endDate: new Date(2119, 04, 25), //设置结束日期
|
|
|
});
|
|
|
$("#agePicker").click(function() {
|
|
|
var year = $(".age_input").val();
|
|
|
if (!year) {
|
|
|
dtPicker.show(function(e) {
|
|
|
$(".age_input").val(e.y.text);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// 月日
|
|
|
var dtPicker1 = new mui.DtPicker({
|
|
|
type: "day",
|
|
|
});
|
|
|
$("#datePicker").click(function() {
|
|
|
var date = $(".date_input").val();
|
|
|
if (!date) {
|
|
|
dtPicker1.show(function(e) {
|
|
|
$(".date_input").val(e.value)
|
|
|
})
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
wx.config(
|
|
|
{$jssdk}
|
|
|
);
|
|
|
wx.ready(function () {
|
|
|
wx.getLocation({
|
|
|
success: function (res) {
|
|
|
success(res);
|
|
|
},
|
|
|
cancel: function (res) {
|
|
|
alert('必须同意授权获取地理位置才能获得奖励哦');
|
|
|
// 月日
|
|
|
var dtPicker1 = new mui.DtPicker({
|
|
|
type: "day",
|
|
|
});
|
|
|
$("#datePicker").click(function() {
|
|
|
var date = $(".date_input").val();
|
|
|
if (!date) {
|
|
|
dtPicker1.show(function(e) {
|
|
|
$(".date_input").val(e.value)
|
|
|
})
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
function success(data) {
|
|
|
lat = data.latitude; //经度
|
|
|
lng = data.longitude; //纬度
|
|
|
//保存到用户表
|
|
|
$.ajax({
|
|
|
url:"{:url('home/user/location')}",
|
|
|
type:"POST",
|
|
|
data:{'user_id':user_id,'longitude':lng,'latitude':lat},
|
|
|
success:function(res){
|
|
|
if(res.code == 1){
|
|
|
toast('定位成功');
|
|
|
}else{
|
|
|
toast('定位失败');
|
|
|
var user_id = "{$user.id}";
|
|
|
var lat = '';
|
|
|
var lng = '';
|
|
|
wx.config(
|
|
|
{$jssdk}
|
|
|
);
|
|
|
wx.ready(function () {
|
|
|
wx.getLocation({
|
|
|
success: function (res) {
|
|
|
console.log(res);
|
|
|
success(res);
|
|
|
},
|
|
|
cancel: function (res) {
|
|
|
alert('必须同意授权获取地理位置才能获得奖励哦');
|
|
|
}
|
|
|
},
|
|
|
error:function(res){
|
|
|
toast('与服务器断开连接')
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
//判断商户条件是否满足
|
|
|
$.ajax({
|
|
|
url:"{:url('home/index/distance_where')}",
|
|
|
type:"POST",
|
|
|
data:{'user_id':user_id,'longitude':lng,'latitude':lat,'goods_id':goods_id},
|
|
|
success:function(res){
|
|
|
if(res.code == 1){
|
|
|
is_where_satisfy = res.data.is_where_satisfy;
|
|
|
if (is_satisfy == '1' && is_where_satisfy == '1') {
|
|
|
init();
|
|
|
function success(data) {
|
|
|
lat = data.latitude; //经度
|
|
|
lng = data.longitude; //纬度
|
|
|
//保存到用户表
|
|
|
$.ajax({
|
|
|
url:"{:url('home/user/location')}",
|
|
|
type:"POST",
|
|
|
data:{'user_id':user_id,'longitude':lng,'latitude':lat},
|
|
|
success:function(res){
|
|
|
if(res.code == 1){
|
|
|
toast('定位成功');
|
|
|
}else{
|
|
|
$(".quest_condition").show();
|
|
|
toast('定位失败');
|
|
|
}
|
|
|
}else{
|
|
|
},
|
|
|
error:function(res){
|
|
|
toast('与服务器断开连接')
|
|
|
}
|
|
|
},
|
|
|
error:function(){
|
|
|
toast('与服务器断开连接');
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
</script>
|
|
|
</body>
|
|
|
|
...
|
...
|
|