作者 lihan

完成下单页面的逻辑和个人中心订单列表的渲染

... ... @@ -116,9 +116,11 @@ class OrderController extends HomeBaseController
$data['room'] = $post['room'];
$data['desc'] = $post['desc'];
$final_price = $this->getFinalPrice($data['activity_id'], $data['schedule_id'], $post['num'], $data['discount_coupon_id']);
$post['escort'] = substr($post['escort'], 0, strlen($post['escort']) - 1);
$this->checkOrder($data['schedule_id'], $data['payment'], $post['escort'], $post['num'], $final_price);
Db::startTrans();
if (Db::name('order_info')->insert($data)) {
//☆在这就要将优惠券变为已使用☆
$oid = Db::name('order_info')->getLastInsID();
$detail = [];
$explode_escort = explode(',', $post['escort']);
... ... @@ -195,6 +197,14 @@ class OrderController extends HomeBaseController
return $sum;
}
/**
* 订单校验
* @param $scheduleId
* @param int $payment
* @param $escort
* @param $num
* @param $finalPrice
*/
private function checkOrder($scheduleId, $payment = 0, $escort, $num, $finalPrice)
{
if($scheduleId == null) {
... ...
... ... @@ -202,12 +202,20 @@ class CenterController extends HomeBaseController
$order['order_sn'] = $request->param('order_sn');
$model = new OrderModel;
$list = $model->getOrderListByUserId($order['status'], $order['order_sn'], session('user.id'));
if (!empty($list)) {
echo json_encode(['order_list' => $list, 'code' => 20000]);
exit();
if ($request->isPost()) {
if (!empty($list)) {
echo json_encode(['order_list' => $list, 'code' => 20000]);
exit();
} else {
echo json_encode(['msg' => '暂无数据', 'code' => 40000]);
exit();
}
} else {
echo json_encode(['msg' => '暂无数据', 'code' => 40000]);
exit();
return $this->fetch(':order_list', [
'order_sn' => $order['order_sn'],
'status' => $order['status'],
'data' => $list
]);
}
}
... ...
... ... @@ -94,6 +94,14 @@
right: 0;
top:0;
}
.dai {
position: absolute;
top: 0.15rem;
left: 0.52rem;
display: flex;
justify-content: space-between;
align-items: center;
}
</style>
</head>
... ... @@ -182,7 +190,7 @@
</div>
</div>
<div class="t chengke1">
<i class="iconfont icon-weixuanzhong1"></i>
<i class="iconfont icon-xuanzhong3"></i>
<span class="comx">我已同意购买<a href="agreement.html" class="aaa">协议和合同协议</a></span>
</div>
</div>
... ... @@ -299,7 +307,7 @@
<div class="money" data-id="{$vo.schedule_id}">
<div class="year_change">
<if condition="$vo['schedule_id'] eq $data['choose']['schedule_id']">
<img src="__TMPL__/static/images/circle1.png"/>
<img class="imgNow" src="__TMPL__/static/images/circle1.png"/>
<else/>
<img src="__TMPL__/static/images/circle.png"/>
</if>
... ... @@ -335,7 +343,7 @@
<div class="gli">
<!--<div>-->
<div class="circle circle_chu">
<i class="iconfont icon-duigou"></i>
<i class="iconfont icon-duigou "></i>
</div>
<!--</div>-->
<!--<i class="iconfont icon-yuancircle46"></i>-->
... ... @@ -415,12 +423,13 @@
</div>
<div class="quanxuan chooseall">
<div class="check">
<div class="circle circle_chu" id="selectAll">
<i class="iconfont icon-duigou"></i>
<div class="circle circle_chu " id="selectAll">
<i class="iconfont icon-duigou icon1"></i>
</div>
<span>全选</span>
</div>
<button class="agree" onclick="agreeFun()">
<button class="agree">
确定
</button>
</div>
... ... @@ -430,48 +439,55 @@
</div>
<!--选择优惠券=============================================-->
<div class="choose_waitquan">
<!--<div class="out">-->
<!--<div class="use">-->
<!--<span id="nouse" class="active" style="color: rgb(254, 10, 1);">待使用</span>-->
<!--<span id="outdata" style="color: rgb(37, 39, 41);">已过期</span>-->
<!--<span id="used" style="color: rgb(37, 39, 41);">已使用</span>-->
<!--</div>-->
<!--</div>-->
<!--待使用优惠券-->
<div class="wai1" id="wai1">
<div class="wai" data-id="1">
<div class="youhui">
<div class="circle1">
<i class="iconfont icon-duigou"></i>
</div>
<div class="quan">
<img src="__TMPL__/static/images/f2.png" alt="" />
<div class="dai">
<div class="money"><span class="money_five">20</span></div>
<div class="date">
<span>代金券</span>
<span class="you">有效期:2018.08.06-2018.08.08</span>
</div>
</div>
</div>
</div>
</div>
<div class="wai">
<div>
<div class="youhui">
<div class="circle1">
<i class="iconfont icon-duigou "></i>
</div>
<div class="quan">
<img src="__TMPL__/static/images/f2.png" alt="" />
<div class="dai">
<div class="money"><span class="money_five">6</span></div>
<div class="date">
<span>代金券</span>
<span class="you">有效期:2018.08.06-2018.08.08</span>
</div>
</div>
</div>
</div>
<div>
</div>
</div>
</div>
<!--<div class="wai" data-id="1">-->
<!--<div class="youhui">-->
<!--<div class="circle1">-->
<!--<i class="iconfont icon-duigou"></i>-->
<!--</div>-->
<!--<div class="quan">-->
<!--<img src="__TMPL__/static/images/f2.png" alt="" />-->
<!--<div class="dai">-->
<!--<div class="money">¥<span class="money_five">20</span></div>-->
<!--<div class="date">-->
<!--<span>代金券</span>-->
<!--<span class="you">有效期:2018.08.06-2018.08.08</span>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!--<div class="wai">-->
<!--<div>-->
<!--<div class="youhui">-->
<!--<div class="circle1">-->
<!--<i class="iconfont icon-duigou "></i>-->
<!--</div>-->
<!--<div class="quan">-->
<!--<img src="__TMPL__/static/images/f2.png" alt="" />-->
<!--<div class="dai">-->
<!--<div class="money">¥<span class="money_five">6</span></div>-->
<!--<div class="date">-->
<!--<span>代金券</span>-->
<!--<span class="you">有效期:2018.08.06-2018.08.08</span>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!--<div>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
</div>
<!--已过期代金券-->
<div id="wai2">
... ... @@ -542,39 +558,39 @@
</div>
</div>
</div>
<div class="agree3 ok" onclick="agreeFun3()">确定使用</div>
<div class="agree3 ok" id="agreeFun3">确定使用</div>
</div>
<!--添加出行人-->
<div class="jia_travel" style='display: none;'>
<ul class="list">
<li>
<span class="real ">真实姓名</span>
<input class="add name_1 chu" placeholder="请填写真实姓名"/>
<input class="add name_1 chu" id="name" placeholder="请填写真实姓名"/>
</li>
<li>
<span class="real">性别</span>
<div class="xuanze_sex">
<div class="sex se">
<img src="__TMPL__/static/images/circle.png" class="yuan yu"><span></span>
<img src="__TMPL__/static/images/circle.png" class="yuan yu sexId"><span></span>
</div>
<div class="sex">
<img src="__TMPL__/static/images/circle1.png" class="yuan yu1"><span></span>
<img src="__TMPL__/static/images/circle1.png" class="yuan yu1 sexId"><span></span>
</div>
</div>
</li>
<li>
<span class="real">手机号</span>
<input class="add phone chu" placeholder="请填写手机号码" />
<input class="add phone chu" id="phone" placeholder="请填写手机号码" />
</li>
<li>
<span class="real">微信号码</span>
<input class="add chu wei " placeholder="请填写微信号码"/>
<input class="add chu wei " id="wxNum" placeholder="请填写微信号码"/>
</li>
<li>
<span class="real ">身份证号</span>
<input class="add confirm chu zfzid" placeholder="请填写身份证号"/>
<input class="add confirm chu zfzid" id="sfzNum" placeholder="请填写身份证号"/>
</li>
</ul>
<!--====底部=====-->
... ... @@ -597,17 +613,21 @@
<script type="text/javascript" src="__TMPL__/static/index.js"></script>
<script type="text/javascript" src="__TMPL__/static/assets/js/common.js"></script>
<script type='text/javascript' src='__TMPL__/static/assets/js/Augly_Verification.js'></script>
<script type="text/javascript" src="__TMPL__/static/assets/js/sami_until.js"></script>
<script>
var total; // 活动总价;
var down_price; // 活动定金;
$('.xuandan').click(function(){
$('.move').css('display','block');
})
var schedule_id='{$data.choose.schedule_id}';
var activity_id='{$data.activity.activity_id}';
var max = '{$data.choose.allowMaximum}';
var schedule_id = '{$data.choose.schedule_id}';// 上一页选中的批次id
var activity_id = '{$data.activity.activity_id}';//上一页选中的活动id
var max = '{$data.choose.allowMaximum}';//购买数量
var is_first='{$data.is_first}';
$(function() {
//获取选择出行人页面的数据
var name = decodeURI(getQueryString('name')).replace(/,/g, ' ');
if(!name) {
$('.xuanze').html('请选择出行人');
... ... @@ -626,7 +646,9 @@
$('.money').click(function(event) {
$(this).find('img').attr("src", "/themes/simpleboot3/static/images/circle1.png");
$(this).find('img').addClass("imgNow");
$(this).siblings().find('img').attr("src", "/themes/simpleboot3/static/images/circle.png");
$(this).siblings().find('img').removeClass("imgNow");
schedule_id = $(this).attr('data-id');
});
//获取选择选择代金券的数据
... ... @@ -660,8 +682,6 @@
$('.move3').click(function() {
$(this).hide();
})
//点击增加
$("#add").click(function() {
var num = parseInt($("#quantity").html());
... ... @@ -681,8 +701,11 @@
dataType:"JSON",
success: function (data) {
console.log(data);
$("#down_price").html(data.data.down_price);
$("#total").html(data.data.total);
total = data.data.total;
down_price = data.data.down_price;
}
})
}
... ... @@ -708,21 +731,7 @@
/*商品数量+1*/
function numAdd() {
var num_add = parseInt($("#quantity").html()) + 1;
$("#quantity").html(num_add);
}
/*商品数量-1*/
function numDec() {
if($("#quantity").html() <= 1) {
return false;
}
var num_dec = parseInt($("#quantity").html()) - 1;
$("#quantity").html(num_dec);
}
//我已同意购买协议和合同协议
$(".danxuan").click(function() {
... ... @@ -740,7 +749,6 @@
}
})
$(".agreepay").click(function () {
$.ajax({
url:"{:url('order/Order/done')}",
... ... @@ -748,9 +756,9 @@
activity_id:activity_id,
schedule_id:schedule_id,
num:$("#quantity").html(),
escort:'9,10',
escort:escort_id,
payment:1,
discount_coupon_id:'',
discount_coupon_id:money_id,
desc:$('.dian_text').val(),
room:$('.xuandan').html()
},
... ... @@ -820,18 +828,158 @@
})
// 获取优惠券
getCards(1,schedule_id);
/*商品数量+1*/
function numAdd() {
money_id = "";
var num_add = parseInt($("#quantity").html()) + 1;
$("#quantity").html(num_add);
getCards(num_add,schedule_id);
}
/*商品数量-1*/
function numDec() {
money_id = "";
if($("#quantity").html() <= 1) {
return false;
}
var num_dec = parseInt($("#quantity").html()) - 1;
$("#quantity").html(num_dec);
getCards(num_dec,schedule_id);
$(".xuanze1").html('请选择代金券');
}
getpeople(num);
})
$('.pelpe').click(function() {
$('.mold_out').css('display', 'block');
$('.bottom_button').click(function(){
var imgId = $(".imgNow");
schedule_id = imgId.parents(".money").data("id");
console.log(schedule_id);
console.log(num);
getCards(1,schedule_id);
})
function getCards(num,id){
$.ajax({
url: "/order/Order/confirm",
type: "post",
dataType: "json",
data: {
activity_id: activity_id,
schedule_id: id,
num:num
},
success: function (data) {
console.log(data);
total = data.data.total;
down_price = data.data.down_price;
var html='';
if(data.data.coupons !=null){
for(var i=0;i< data.data.coupons.length;i++){
html +='<div class="wai" data-id="'+data.data.coupons[i].discount_coupon_id+'" data-type="'+data.data.activity.type+'">' +
' <div class="youhui">' +
' <div class="circle1" onclick="circles(this)" >' + '<i class="iconfont icon-duigou "></i>' +
' </div>'+
' <div class="quan">'+
' <img src="/themes/simpleboot3/static/images/f2.png" alt="">' +
' <div class="dai">' +
' <div class="money">¥<span class="money_five">'+data.data.coupons[i].reduce+'</span></div>' +
' <div class="date">' +
' <span>代金券</span>' +
' <span class="you">'+data.data.coupons[i].discount_coupon_name+'</span>' +
' </div>' +
' </div>' +
' </div>' +
' </div>' +
' </div>'
}
}else{
html +='<div>暂无数据</div>'
}
var index = 0;
var num = 0;
$('.wai1').html('');
$('.wai1').append(html);
},
complete: function (data) {
// console.log(data)
}
})
}
//=========================================================================
//选择出行人
function getpeople(num){
$.ajax({
url: "/escort/Escort/_list",
type: "post",
dataType: "json",
// data: {
// activity_id:activity_id,
// schedule_id:schedule_id,
// num:num
// },
success: function (data) {
var html='';
if(data.code==20000){
for(var i=0;i<data.data.length;i++) {
html +='<li class="userInfo" data-id="'+data.data[i].id+'">' +
' <div class="guo">' +
' <div class="gli">' +
' <!--<div>-->' +
' <div class="circle circle_chu" onclick="circlepeople(this)">' +
' <i class="iconfont icon-duigou icon1"></i>' +
' </div>' +
' <!--</div>-->' +
' <!--<i class="iconfont icon-yuancircle46"></i>-->' +
' <div class="xin">' +
'<span class="guoxin">' +
'<span class="name">'+data.data[i].name+'</span>&nbsp;&nbsp;&nbsp; &nbsp;'+ data.data[i].tel+'</span>' +
' <span>身份证:'+data.data[i].identity+'</span>' +
' </div>' +
' </div>' +
' <div class="bian">' +
'' +
' <div class="bianji" onclick="bianji(this)">' +
' <i class="iconfont icon-bianji"></i>编辑' +
' </div>'+
' <div class="delete" onclick="deletes(this)">' +
' <i class="iconfont icon-shanchu"></i> 删除' +
' </div>' +
' </div>' +
' </div>' +
' </li>'
}
}else if(data.code==40000){
html +='<div class="nodata">暂无数据</div>'
$('.nodata').className='nodata';
}
$('.people').html('');
$('.people').append(html);
},
complete: function (data) {
// console.log(data)
}
})
}
$('.pelpe').click(function() {
$('.mold_out').css('display', 'block');
})
var index = 0;
var num = 0;
$('.bottom_button').click(function() {
money_id = "";
var inputLength = $('.mold_center').find('img').length;
for(var i = 0; i < inputLength; i++) {
if($('.mold_center').find('img').eq(i).attr("src") =="__TMPL__/static/images/circle1.png") {
... ... @@ -854,6 +1002,8 @@
success: function (data) {
$(".showcang").html(data.data.choose.time_text);
// $(".price").html()-$('xuanze1').
$("#down_price").html(data.data.down_price);
$("#total").html(data.data.total);
max = data.data.choose.allowMaximum;
... ... @@ -863,6 +1013,7 @@
$('.showcang').html($('.mold_center').find('span').eq(index).html());
$('.mold_out').css('display', 'none');
}
})
$('.shan1').click(function() {
$(this).find('i').attr('class', 'iconfont icon-xuanzhong2');
... ... @@ -889,53 +1040,73 @@
// 选择出行人
$('.delete').click(function(){
$(this).parents('.userInfo').remove();
})
// function deletes(obj){
// $(obj).parents('.userInfo').remove();
// }
var num= $('.people li').length;
var count = 0;
var circle=$('.circle');
var circle=$('.people');
var nameArr = [];
circle.click(function(){
if($(this).find('.icon-duigou').hasClass("now")){
$(this).find('.icon-duigou').removeClass("now");
$(this).find('.icon-duigou').css('color','rgba(255, 255, 255)');
$(this).css('border','0.02rem solid #999');
}else {
var numcircle=0;
$(this).find('.icon-duigou').addClass("now");
$(this).find('.icon-duigou').css('color','rgb(254, 10, 1)');
$(this).css('border','0.02rem solid rgb(254, 10, 1)');
var numd=0;
function circlepeople(obj){
var num_xuan=$('.val').html();
if($(obj).find('.icon-duigou').hasClass("now")){
--numcircle;
$(obj).find('.icon-duigou').removeClass("now");
$(obj).find('.icon-duigou').css('color','rgba(255, 255, 255)');
$(obj).css('border','0.02rem solid #999');
}else{
if(numcircle<num_xuan){
// toast(1)
++numcircle;
$(obj).find('.icon-duigou').addClass("now");
$(obj).find('.icon-duigou').css('color','rgb(254, 10, 1)');
$(obj).css('border','0.02rem solid rgb(254, 10, 1)');
// console.log(numcircle);
}else if(numcircle>=num_xuan){
toast('选择:'+num_xuan +' 人');
}
}
var len=$(".people").find('.icon-duigou.now').length;
console.log(len);
// console.log(len);
// console.log(num);
if(num == len) {
$("#selectAll").css('border','0.02rem solid rgb(254, 10, 1)');
$("#selectAll").find('.icon-duigou').css('color','rgba(254, 10, 1)');
}else{
$("#selectAll").css('border','0.02rem solid rgb(153, 153, 153)');
$("#selectAll").find('.icon-duigou').css('color','rgb(255, 255, 255)');
}
})
}
//全选反选
$("#selectAll").click(function(){
if(circle.find('.icon-duigou').css('color')=='rgb(255, 255, 255)'){
circle.find('.icon-duigou').css('color','rgb(254, 10, 1)');
circle.css('border','0.02rem solid rgb(254, 10, 1)');
if( $(this).find('.icon-duigou').css('color')=='rgb(255, 255, 255)'){
var num_jia=$('.val').html();
console.log(num_jia);
if(num_jia<$('.people li').length){
console.log($('.people li').length);
toast('选择:'+num_jia +' 人');
}else{
$(this).css('border','0.02rem solid rgb(254, 10, 1)');
$(this).find('.icon-duigou').css('color','rgb(254, 10, 1)');
circle.find(".circle").css('border','0.02rem solid rgb(254, 10, 1)');
circle.find(".icon-duigou").css('color','rgb(254, 10, 1)');
}
}else{
circle.find('.icon-duigou').css('color','rgb(255, 255, 255)');
circle.css('border','0.02rem solid #999');
$(this).find('.icon-duigou').css('color','rgb(255, 255, 255)');
$(this).css("border","0.02rem solid #999");
circle.find(".icon-duigou").css('color','rgb(255, 255, 255)');
circle.find(".circle").css("border","0.02rem solid #999");
}
})
var arr=[];
... ... @@ -945,40 +1116,31 @@
$('.xuan').click(function(){
$('.outtravel').css('display','block');
})
var escort = new Array();
var names='';
var escort_id = '';
// 点击确定时,出行人名字添加到数组,回显到订单提交页面;
function agreeFun() {
var nameArr = [];
$(".agree").click(function () {
names='';
escort_id='';
escort=new Array();
for (var i = 0; i < $(".userInfo").length; i++ ) {
if($(".userInfo").eq(i).find(".icon-duigou").hasClass("now")) {
var name = $(".userInfo").find(".name").html();
if(nameArr.length >= 2) {
break;
}else {
nameArr.push(name);
}
names+= $(".userInfo").eq(i).find(".name").html()+' ';
escort.push($(".userInfo").eq(i).data('id'));
escort_id+=$(".userInfo").eq(i).data('id')+',';
}
}
console.log(nameArr)
console.log(nameArr[0])
if(nameArr[0]!=undefined&&nameArr[1]==undefined){
$('.xuanze').html(nameArr[0]);
}else if(nameArr[0]!=undefined&&nameArr[1]!=undefined){
$('.xuanze').html(nameArr[0]+' '+nameArr[1]);
console.log(escort_id);
console.log(escort);
console.log(names);
if(names!=''){
$('.xuanze').html(names);
}else {
$('.xuanze').html('请选择出行人');
}
})
// var name=encodeURI(encodeURI(nameArr));
// var url="orders_submitted.html?name="+name;
// window.location.href = url;
}
// 添加出行人
function getQueryString(name) {
var reg = new RegExp("(^|&)" +
... ... @@ -1025,19 +1187,36 @@
used.css('color', '#FE0A01');
})
var circle1 = $('.wai1 .youhui .circle1');
circle1.click(function() {
if($(this).find('.icon-duigou').css('color') == 'rgb(255, 255, 255)') {
// alert(1)
$(this).find('.icon-duigou').css('color', 'rgb(254, 10, 1)');
$(this).css('border', '0.02rem solid rgb(254, 10, 1)');
$(this).parents('.wai').siblings().find('.icon-duigou').css('color', 'rgb(255, 255, 255)');
$(this).parents('.wai').siblings().find('.circle1').css('border', '0.02rem solid #999');
// circle1.click(function(){
// if($(this).find('.icon-duigou').css('color') == 'rgb(255, 255, 255)') {
// // alert(1)
// $(this).find('.icon-duigou').css('color', 'rgb(254, 10, 1)');
// $(this).css('border', '0.02rem solid rgb(254, 10, 1)');
// $(this).parents('.wai').siblings().find('.icon-duigou').css('color', 'rgb(255, 255, 255)');
// $(this).parents('.wai').siblings().find('.circle1').css('border', '0.02rem solid #999');
// } else {
// // alert(2)
// $(this).find('.icon-duigou').css('color', 'rgb(255, 255, 255)');
// $(this).css('border', '0.02rem solid #999');
// }
// })
//优惠券选择
function circles(obj){
if($(obj).find('.icon-duigou').css('color') == 'rgb(255, 255, 255)'){
// 选中
$(obj).find('.icon-duigou').css('color', 'rgb(254, 10, 1)');
$(obj).css('border', '0.02rem solid rgb(254, 10, 1)');
$(obj).parents('.wai').siblings().find('.icon-duigou').css('color', 'rgb(255, 255, 255)');
$(obj).parents('.wai').siblings().find('.circle1').css('border', '0.02rem solid #999');
} else {
// alert(2)
$(this).find('.icon-duigou').css('color', 'rgb(255, 255, 255)');
$(this).css('border', '0.02rem solid #999');
$(obj).find('.icon-duigou').css('color', 'rgb(255, 255, 255)');
$(obj).css('border', '0.02rem solid #999');
}
})
}
$('.xuan3').click(function(){
$.ajax({
url:"{:url('order/Order/confirm')}",
... ... @@ -1050,46 +1229,42 @@
dataType:"JSON",
success: function (data) {
console.log(data.data.coupons);
$('.choose_waitquan').css('display','block');
}
})
})
// // 点击确定时,出行人名字添加到数组,回显到订单提交页面;
function agreeFun3() {
var arr = []
var money_id;
var activity_type;
$("#agreeFun3").click(function () {
var arr = [];
var money;
for(var i = 0; i < $(".wai1 .wai").length; i++) {
if($(".wai1 .wai").eq(i).find('.icon-duigou').css('color') == 'rgb(254, 10, 1)') {
var price = $(".wai1 .wai").eq(i).find('.money_five').html();
money_id = $(".wai1 .wai").eq(i).data("id");
arr.push(price);
activity_type = $(".wai1 .wai").eq(i).data("type");
money = $(".wai1 .wai").eq(i).find('.money_five').html();
}
}
$('.choose_waitquan').css('display','none');
$('.xuanze1').html('¥'+arr[0]+'代金券');
if(arr[0]==undefined){
$('.xuanze1').html('请选择代金券');
}else{
$('.xuanze1').html('¥'+arr[0]+'代金券');
}
if(activity_type == 0) {
console.log(money)
var totalYh = total - money;
$("#total").html(totalYh);
// console.log(totalYh)
}else if(activity_type == 1) {
var downYh = down_price - money;
$("#down_price").html(downYh);
}
})
}
$('.ok_chu').click(function() {
if($('.name_1').val() == '') {
toast('请填入您的姓名');
} else if($('.phone').val() == '') {
toast('请输入电话号码');
} else if(!AuglyTest_phone.test($('.phone').val())) {
toast('电话号码格式不正确');
} else if($('.wei').val() == '') {
toast('请输入微信号码');
} else if($('.zfzid').val() == '') {
toast('请输入身份证号');
} else if(!AuglyTest_ID.test($('.zfzid').val())) {
toast('身份证号输入不正确');
} else {
toast('验证通过');
$('.jia_travel').css('display','none');
}}
)
$('.ok_xing').click(function(){
$('.jia_travel').css('display','block')
... ... @@ -1142,13 +1317,139 @@
})
var id_bianji='';
function bianji(obj){
id_bianji = $(obj).parents(".userInfo").data("id");
// console.log(id_bianji);
$.ajax({
url:"/escort/Escort/edit",
type: "get",
dataType: "json",
data: {
id: id_bianji,
},
success: function (data) {
console.log(data);
if(data.data.sex == 0) {
$(".sex .yu1").attr("src","/themes/simpleboot3/static/images/circle.png");
$(".sex .yu").attr("src","/themes/simpleboot3/static/images/circle1.png");
}else if (data.data.sex == 1) {
$(".sex .yu1").attr("src","/themes/simpleboot3/static/images/circle1.png");
$(".sex .yu").attr("src","/themes/simpleboot3/static/images/circle.png");
};
$("#name").val(data.data.name);
$("#phone").val(data.data.tel);
$("#wxNum").val(data.data.wechat);
$("#sfzNum").val(data.data.identity);
$('.bianji').click(function(){
}
})
$('.jia_travel').css('display','block');
}
$('.ok_chu').click(function() {
var sexId;
if ($(".sex .yu1").attr('src') == '__TMPL__/static/images/circle1.png') {
sexId = 1;
} else if ($(".sex .yu").attr('src') == '__TMPL__/static/images/circle1.png'){
sexId = 0;
}
console.log(id_bianji)
var data = {};
data.id = id_bianji;
data.name = $("#name").val();
data.sex = sexId;
data.tel = $("#phone").val();
data.identity = $("#sfzNum").val();
data.wechat=$("#wxNum").val();
var adddata={};
adddata.name = $("#name").val();
adddata.sex = sexId;
adddata.tel = $("#phone").val();
adddata.identity = $("#sfzNum").val();
adddata.wechat=$("#wxNum").val();
if(data.name == '') {
toast('请填入您的姓名');
}else if(data.tel == '') {
toast('请输入电话号码');
}else if(!AuglyTest_phone.test(data.tel)) {
toast('电话号码格式不正确');
}else if( data.wechat == '') {
toast('请输入微信号码');
}else if(data.identity == '') {
toast('请输入身份证号');
}else if(!AuglyTest_ID.test( data.identity)) {
toast('身份证号输入不正确');
}else{
if(id_bianji !=''){
console.log('bianji');
$.ajax({
url:"/escort/Escort/edit",
type:"post",
data:data,
dataType:"JSON",
success:function(data){
console.log(data);
toast("保存成功");
getpeople(num);
id_bianji='';
$('.jia_travel').css('display','none');
$("#name").val('');
$("#phone").val('');
$("#wxNum").val('');
$("#sfzNum").val('');
}
})
}else{
console.log('add');
$.ajax({
url:"/escort/Escort/add",
type:"post",
data:adddata,
dataType:"JSON",
success:function(data){
console.log(data);
toast("保存成功");
getpeople(num);
id_bianji='';
$('.jia_travel').css('display','none');
}
})
}
}
})
function deletes(obj){
console.log(1);
id_bianji = $(obj).parents(".userInfo").data("id");
$.ajax({
url:"/escort/Escort/del",
type:"post",
data:{
id: id_bianji,
},
dataType:"JSON",
success:function(data){
// console.log(data);
if(data.code == 20000){
$(obj).parents('.userInfo').remove();
}
getpeople(num);
toast('删除成功');
$('.jia_travel').css('display','none');
}
})
}
//================================================================
$('.agreed').click(function () {
$.ajax({
url:"{:url('portal/Index/bindMobile')}",
data:{
... ... @@ -1156,14 +1457,15 @@
},
type:"POST",
dataType:"JSON",
success: function () {
is_first=0;
}
})
})
</script>
</body>
</html>
\ No newline at end of file
... ...
//ajax封装
(function ($) {
$.extend({
ajaxSend: function (urlSuffix,params) {
console.log(params);
var prefixUrl = "http://192.168.1.21/";//仅为测试使用
// $("head").append('<script src="'+prefixUrl + urlSuffix+'&"></script>');
return $.ajax({
url: prefixUrl + urlSuffix,
type: 'post',
dataType: 'jsonp',
async: true,
//contentType: 'application/json;charset=UTF-8',
data:params,
beforeSend: function () {
}
}).done(function (data) {
console.log(data);
}).fail(function (data) {
}).always(function () {
});
},
getCookie: function (name) {
var cookieName = encodeURIComponent(name) + "=";
var cookieStart = document.cookie.indexOf(cookieName);
var cookieValue = null;
if (cookieStart > -1) {
var cookieEnd = document.cookie.indexOf(";", cookieStart);
if (cookieEnd == -1) {
cookieEnd = document.cookie.length;
}
cookieValue = encodeURIComponent(document.cookie.substring(cookieStart + cookieName.length, cookieEnd));
}
return decodeURIComponent(decodeURIComponent(cookieValue));
},
setCookie: function (name, value, days, path, domain, secure) {
var cookieText = encodeURIComponent(name) + "=" + encodeURIComponent(value);
if (days>0) {
var expires = new Date();
expires.setTime(expires.getTime() + days * 3600000 * 24);
//expires.setTime(expires.getTime() + days * 120000);
var _expires = (typeof days) == "string" ? "" : ";expires=" + expires.toUTCString();
cookieText = encodeURIComponent(name) + "=" + encodeURIComponent(value)+ _expires + path;
}
if (path) {
cookieText += "; path=" + path;
}
if (domain) {
cookieText += "; domain=" + domain;
}
if (secure) {
cookieText += "; secure"
}
document.cookie = cookieText;
},
unsetCookie: function (name,days, path, domain, secure) {
this.setCookie(name, "", days, path, domain, secure);
}
})
})(jQuery);
\ No newline at end of file
... ...
... ... @@ -154,7 +154,7 @@ ul{list-style: none;}
height: 1rem;
width: 100%;
margin-top: 0.15rem;
border-bottom: 0.01rem solid #EBEBEB;
/*border-bottom: 0.01rem solid #EBEBEB;*/
padding-bottom: 0.1rem;
}
.btnlist .can{
... ...
... ... @@ -42,7 +42,7 @@
</div>
</a>
<a href="myOrder.html">
<a href="{:url('user/Center/orderList')}">
<div class="wallet wall">
<div class="wallet_main">
<i class="iconfont icon-yiwanchengdingdan"></i>
... ...
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>我的订单</title>
<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
<script type="text/javascript" src="__TMPL__/static/js/base.js"></script>
<link rel="stylesheet" type="text/css" href="__TMPL__/static/assets/css/weui.min.css" />
<link rel="stylesheet" type="text/css" href="__TMPL__/static/assets/css/swiper-3.4.2.min.css" />
<!--<link rel="stylesheet" type="text/css" href="__TMPL__/static/css/swiper-3.4.2.min.css" />-->
<link rel="stylesheet" type="text/css" href="http://at.alicdn.com/t/font_773803_6y9erxzbkn2.css" />
<link rel="stylesheet" href="__TMPL__/static/css/common.css" />
<script type="text/javascript" src="__TMPL__/static/assets/font/iconfont.js">
</script>
<link rel="stylesheet" href="__TMPL__/static/css/myOrder.css" />
<style type="text/css">
.inputStyle {
width: 6.86rem;
height: 0.8rem;
font-size: 0.32rem;
border: 1px solid rgba(235, 235, 235, 1);
border-radius: 0.4rem;
margin: 0.2rem auto;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
color: #999;
background: #fff;
z-index: 99;
}
.icon-sousuo {
font-size: 0.3rem;
/*color: #ccc;*/
margin-right: 0.2rem;
margin-top: -0.09rem;
font-size: 0.4rem;
}
.inputItem {
padding-top: 0.06rem;
outline: none;
border: none;
color: #777;
width: 73%;
height: 100%;
/* padding-left: 2rem; */
text-align: left;
overflow: hidden;
}
.head {
padding-bottom: 0.2rem;
position: fixed;
top: 0;
background: #fff;
justify-content: center;
display: flex;
width: 100%;
z-index: 100;
height: 1rem;
}
</style>
</head>
<body>
<div class="head">
<form action="{:url('user/Center/orderList')}" method="get">
<div id="" class="inputStyle" onclick="">
<i class="iconfont icon-sousuo"></i>
<input class="inputItem" type="text" name="order_sn" value="{$order_sn}" placeholder="搜索订单号" />
<input type="hidden" name="status" value="{$status}">
<label for="S"><span class="sou_right">搜索</span></label>
</div>
<input type="submit" id="S" style="display: none">
</form>
</div>
<!-- 待付定金-->
<div class="choice" id="topNav">
<div class="swiper-wrapper">
<div <if condition="$status eq ''">class="swiper-slide active_top"<else/>class="swiper-slide"</if> data-url="{:url('user/Center/orderList')}">
<span>全部</span>
</div>
<div <if condition="$status eq '1'">class="swiper-slide active_top"<else/>class="swiper-slide"</if> data-url="{:url('user/Center/orderList',['status'=>1])}">
待付定金
</div>
<div <if condition="$status eq '2'">class="swiper-slide active_top"<else/>class="swiper-slide"</if> data-url="{:url('user/Center/orderList',['status'=>2])}">
已付定金
</div>
<div <if condition="$status eq '3'">class="swiper-slide active_top"<else/>class="swiper-slide"</if> data-url="{:url('user/Center/orderList',['status'=>3])}">
待付尾款
</div>
<div <if condition="$status eq '4'">class="swiper-slide active_top"<else/>class="swiper-slide"</if> data-url="{:url('user/Center/orderList',['status'=>4])}">
已付尾款
</div>
<div <if condition="$status eq '5'">class="swiper-slide active_top"<else/>class="swiper-slide"</if> data-url="{:url('user/Center/orderList',['status'=>5])}">
待评价
</div>
<div <if condition="$status eq '6'">class="swiper-slide active_top"<else/>class="swiper-slide"</if> data-url="{:url('user/Center/orderList',['status'=>6])}">
已完成
</div>
</div>
</div>
<volist name="data" id="vo">
<div class="good_out_stay" data-id="{$vo.oid}">
<div class="good">
<span>订单号:{$vo.order_sn}</span>
<span class="confirmed">{$vo.status_text}</span>
</div>
<div class="goods">
<div class="pic_row">
<span class="rock">
<span class="pic">
<img src="{$vo.thumb}" alt="" style="width: 2.04rem; height: 0.98rem"/>
</span>
<span class="two">
<span>{$vo.name}</span>
<span class="price">
<span>定金 ¥{$vo.down_price}</span>
<span>价格 ¥{$vo.price}</span>
</span>
</span>
</span>
</div>
<span class="five">
x{$vo.count}
</span>
</div>
<if condition="$vo['status'] eq '1'">
<div class="btnlist">
<div class="btnleft can">取消</div>
<div class="btnright ">付款</div>
</div>
</if>
<if condition="$vo['status'] eq '3'">
<div class="btnlist">
<div class="btnright ">付款</div>
</div>
</if>
<if condition="$vo['status'] eq '5'">
<div class="btnlist">
<div class="pingjia">评价</div>
</div>
</if>
</div>
</volist>
<!--确认取消弹出框-->
<div class="confirm_cancel">
<div class="confirm_main">
<div class="hint">
确认取消?
</div>
<div class="true">确定取消订单吗?</div>
<div class="choose">
<span class="confirm_yes">取消</span>
<span class="confirm_no">确定</span>
</div>
</div>
</div>
<!--toast-->
<div id="toast" style='display: none;'>
<div class="weui-mask_transparent"></div>
<div class="weui-toast">
<!--<i class="weui-icon-success-no-circle weui-icon_toast"></i>-->
<p class="weui-toast__content">已完成</p>
</div>
</div>
<script type="text/javascript" src="__TMPL__/static/assets/js/jquery-2.1.0.js"></script>
<script type="text/javascript" src="__TMPL__/static/js/swiper-3.4.2.jquery.min.js"></script>
<script>
//初始化
var mySwiper = new Swiper('#topNav', {
freeMode: true,
freeModeMomentumRatio: 0.5,
slidesPerView: 'auto',
// loop:true,
slideToClickedSlide: true,
observer: true,
observeParents: true,
});
</script>
</body>
</html>
<script type="text/javascript" src="__TMPL__/static/assets/js/common.js"></script>
<script type="text/javascript" src="__TMPL__/static/assets/js/jquery-2.1.0.js"></script>
<script type="text/javascript" src="__TMPL__/static/js/swiper-3.4.2.jquery.min.js"></script>
<script>
//确认取消弹出框
$('.can').click(function() {
var id = $(this).parents('.good_out').data("id");
console.log(id);
$('.confirm_cancel').css('display', 'block');
$('.confirm_yes').click(function() {
console.log("点击确定按钮获取整个li的id为:" + id);
$('.confirm_cancel').css('display', 'none');
})
$('.confirm_no').click(function() {
$('.confirm_cancel').css('display', 'none');
})
$('.confirm_main').click(function() {
event.stopPropagation();
// $(this).css('display','none');
})
})
//确认取消弹出框
$('.btnright').click(function() {
var id = $(this).parents('.good_out').data("id");
console.log(id);
$('.confirm_cancel').css('display', 'block');
$('.confirm_yes').click(function() {
console.log("点击确定按钮获取整个li的id为:" + id);
$('.confirm_cancel').css('display', 'none');
})
$('.confirm_no').click(function() {
$('.confirm_cancel').css('display', 'none');
})
$('.confirm_main').click(function() {
event.stopPropagation();
// $(this).css('display','none');
})
})
//阻止按钮的点击冒泡
$('.btnlist').click(function(event) {
event.stopPropagation();
});
$('.choice .swiper-slide').click(function() {
$(this).addClass("active_top").siblings().removeClass("active_top");
})
</script>
<script>
$('.sou_right').click(function() {
var val = $('.inputItem').val();
var patrn = /^[0-9]*$/;
if(!patrn.test(val)) {
toast('请输入数字');
}
})
</script>
<script>
$(".swiper-slide").click(function () {
window.location.href=$(this).attr('data-url');
})
</script>
\ No newline at end of file
... ...