qihanjiao 6 years ago
parent
commit
497049e6a0

+ 1 - 1
watero-wechat-web/src/main/webapp/WEB-INF/views/wechat/free_collection.html

@@ -166,7 +166,7 @@
 													}
 													$('#btn-confirm').removeAttr("disabled").addClass("active");
 												} else {
-													mui.alert(dt.resultMsg);
+													mui.alert(dt.message);
 												}
 											}
 										},

+ 405 - 75
watero-wechat-web/src/main/webapp/WEB-INF/views/wechat/vip_center.html

@@ -11,6 +11,7 @@
 	<link rel="stylesheet" type="text/css" href="//css.iamberry.com/watero/css/style.css?v=2016111001" />
 	<link rel="stylesheet" type="text/css" href="//css.iamberry.com/watero/css/vip_center.css?v=2016111001" />
 	<style>
+		body,.mui-content{background: #fff;}
 		.my-view-order .mui-media-body {
 			padding-top: 0;
 		}
@@ -74,6 +75,12 @@
 			left: 90px;
 			top: 50%;
 			-webkit-transform: translateY(-50%);}
+		.vip-tt{background: #fff;}
+		.nikname{color: #333;left: 7.5em;}
+		#menu-order .iconfont{color: #24cae9;}
+		#menu-order .mui-control-item{font-size: 14px;}
+		.tx{padding: 0;left: 2em;}
+		.see-rights{color:#8f8f94;background: #fff;border-radius: 6px;padding: 3px 10px;float: right;margin-right: 10px;font-size: 13px;}
 	</style>
 	<script>
         // 屏蔽分享
@@ -116,9 +123,10 @@
 			<div>
 				<span id="userNickname">水时代</span>
 			</div>
-			<div>
-				<span class="go_daili_2wm"  id="2WM"  style="display:none">立即分享二维码 ></span>
-				<!-- <span class="btn_share to-up-img" id="toShare"  style="display:none">我要分享</span> -->
+			<div >
+				<span id="vipName">普通用户</span>
+				<!--<span class="go_daili_2wm"  id="2WM"  style="display:none">立即分享二维码 ></span>-->
+				<span class="see-rights">查看权益<span class="mui-icon mui-icon-arrowright" style="font-size: 18px;"></span></span>
 			</div>
 		</div>
 	</div>
@@ -142,30 +150,30 @@
                         </a>
                     </div>
                 </div> -->
-	<div style="padding:0;background: #fff;margin-bottom: 8px;">
-		<div id="menu-nav" class="mui-segmented-control">
-			<a class="mui-control-item go_cash_log">
-				<div class="iconfont icon-orderjiangli"></div>
-				奖励记录
-			</a>
-			<a class="mui-control-item">
-				<div class="iconfont icon-orderyue"></div>
-				余额  <span class="cl-red">0.00</span>
-			</a>
-			<a class="mui-control-item" href="/watero/view/coupon_bag.html">
-				<div class="iconfont icon-wodequanbao"></div>
-				我的券包
-			</a>
-		</div>
-	</div>
-	<ul class="mui-table-view my-view-order">
-		<li class="mui-table-view-cell">
-			<a class="mui-navigate-right go_pay_count">
-				我的订单
-			</a>
-		</li>
-	</ul>
-	<div style="padding:0;background: #fff;margin-bottom: 8px;">
+	<!--<div style="padding:0;background: #fff;margin-bottom: 8px;">-->
+		<!--<div id="menu-nav" class="mui-segmented-control">-->
+			<!--<a class="mui-control-item go_cash_log">-->
+				<!--<div class="iconfont icon-orderjiangli"></div>-->
+				<!--奖励记录-->
+			<!--</a>-->
+			<!--<a class="mui-control-item">-->
+				<!--<div class="iconfont icon-orderyue"></div>-->
+				<!--余额  <span class="cl-red">0.00</span>-->
+			<!--</a>-->
+			<!--<a class="mui-control-item" href="/watero/view/coupon_bag.html">-->
+				<!--<div class="iconfont icon-wodequanbao"></div>-->
+				<!--我的券包-->
+			<!--</a>-->
+		<!--</div>-->
+	<!--</div>-->
+	<!--<ul class="mui-table-view my-view-order">-->
+		<!--<li class="mui-table-view-cell">-->
+			<!--<a class="mui-navigate-right go_pay_count">-->
+				<!--我的订单-->
+			<!--</a>-->
+		<!--</li>-->
+	<!--</ul>-->
+	<div style="padding:10px 0 30px 0;background: #fff;">
 		<div id="menu-order" class="mui-segmented-control">
 			<a class="mui-control-item go_pay_count">
 				<div class="iconfont icon-daifukuan"></div>
@@ -185,56 +193,98 @@
 			</a>
 		</div>
 	</div>
-	<ul class="mui-table-view my-view-order">
-		<li class="mui-table-view-cell">
-			设备租赁
+	<!--<ul class="mui-table-view my-view-order">-->
+		<!--<li class="mui-table-view-cell">-->
+			<!--设备租赁-->
+		<!--</li>-->
+	<!--</ul>-->
+	<!--<div style="padding:0;background: #fff;margin-bottom: 8px;">-->
+		<!--<div id="menu-lease-order" class="mui-segmented-control">-->
+			<!--<a class="mui-control-item">-->
+				<!--<div class="iconfont icon-daifahuo1" id="rent_wait_deliver"></div>-->
+				<!--全部订单-->
+			<!--</a>-->
+			<!--<a class="mui-control-item">-->
+				<!--<div class="iconfont icon-yifahuo" id="rent_already_deliver"></div>-->
+				<!--已发货-->
+			<!--</a>-->
+			<!--<a class="mui-control-item">-->
+				<!--<div class="iconfont icon-shebeiliebiao"></div>-->
+				<!--设备列表-->
+			<!--</a>-->
+			<!--<a class="mui-control-item">-->
+				<!--<div class="iconfont icon-zulinxieyi" id="xieyi-dalog"></div>-->
+				<!--租赁协议-->
+			<!--</a>-->
+		<!--</div>-->
+	<!--</div>-->
+	<!--<ul class="mui-table-view my-view-order">-->
+		<!--<li class="mui-table-view-cell">-->
+			<!--服务-->
+		<!--</li>-->
+	<!--</ul>-->
+	<!--<div style="padding:0;background: #fff;margin-bottom: 8px;">-->
+		<!--<div id="menu-lease-other" class="mui-segmented-control">-->
+			<!--<a class="mui-control-item">-->
+				<!--<div class="iconfont icon-xiaxian"></div>-->
+				<!--我的好友-->
+			<!--</a>-->
+			<!--<a class="mui-control-item">-->
+				<!--<div class="iconfont icon-shouhou"></div>-->
+				<!--售后服务-->
+			<!--</a>-->
+			<!--<a class="mui-control-item">-->
+				<!--<div class="iconfont icon-kefu"></div>-->
+				<!--客服电话-->
+			<!--</a>-->
+			<!--<a class="mui-control-item">-->
+				<!--<div class="iconfont icon-order"></div>-->
+				<!--常见问答-->
+			<!--</a>-->
+		<!--</div>-->
+	<!--</div>-->
+	<ul class="mui-table-view mui-table-view-striped mui-table-view-condensed my-center-no" id="center-menu" >
+		<li class="mui-table-view-cell" href="/watero/view/coupon_bag.html">
+			<div class="mui-table">
+				<div class="mui-table-cell mui-col-xs-5 table-middle">
+					我的券包
+				</div>
+				<div class="mui-table-cell mui-col-xs-5 mui-text-right">
+					<span class="mui-icon mui-icon-arrowright"></span>
+				</div>
+			</div>
 		</li>
-	</ul>
-	<div style="padding:0;background: #fff;margin-bottom: 8px;">
-		<div id="menu-lease-order" class="mui-segmented-control">
-			<a class="mui-control-item">
-				<div class="iconfont icon-daifahuo1" id="rent_wait_deliver"></div>
-				全部订单
-			</a>
-			<a class="mui-control-item">
-				<div class="iconfont icon-yifahuo" id="rent_already_deliver"></div>
-				已发货
-			</a>
-			<a class="mui-control-item">
-				<div class="iconfont icon-shebeiliebiao"></div>
-				设备列表
-			</a>
-			<a class="mui-control-item">
-				<div class="iconfont icon-zulinxieyi" id="xieyi-dalog"></div>
-				租赁协议
-			</a>
-		</div>
-	</div>
-	<ul class="mui-table-view my-view-order">
-		<li class="mui-table-view-cell">
-			服务
+		<li class="mui-table-view-cell" href="//w.iamberry.com/watero/view/faq.html">
+			<div class="mui-table">
+				<div class="mui-table-cell mui-col-xs-5">
+					常见问答
+				</div>
+				<div class="mui-table-cell mui-col-xs-5 mui-text-right">
+					<span class="mui-icon mui-icon-arrowright"></span>
+				</div>
+			</div>
+		</li>
+		<li class="mui-table-view-cell" href="//www.aiberletech.com/iamberry_wechat/after_service_watero.html">
+			<div class="mui-table">
+				<div class="mui-table-cell mui-col-xs-5">
+					售后服务
+				</div>
+				<div class="mui-table-cell mui-col-xs-5 mui-text-right">
+					<span class="mui-icon mui-icon-arrowright"></span>
+				</div>
+			</div>
+		</li>
+		<li class="mui-table-view-cell" href="tel:4001234123">
+			<div class="mui-table">
+				<div class="mui-table-cell mui-col-xs-5">
+					客服电话
+				</div>
+				<div class="mui-table-cell mui-col-xs-5 mui-text-right">
+					<span class="mui-h5" style="position: absolute;width: 100px;right: 25px;top: 3px;">400-8006692</span><span class="mui-icon mui-icon-arrowright"></span>
+				</div>
+			</div>
 		</li>
 	</ul>
-	<div style="padding:0;background: #fff;margin-bottom: 8px;">
-		<div id="menu-lease-other" class="mui-segmented-control">
-			<a class="mui-control-item">
-				<div class="iconfont icon-xiaxian"></div>
-				我的好友
-			</a>
-			<a class="mui-control-item">
-				<div class="iconfont icon-shouhou"></div>
-				售后服务
-			</a>
-			<a class="mui-control-item">
-				<div class="iconfont icon-kefu"></div>
-				客服电话
-			</a>
-			<a class="mui-control-item">
-				<div class="iconfont icon-order"></div>
-				常见问答
-			</a>
-		</div>
-	</div>
 	<!-- <ul class="mui-table-view mui-grid-view mui-grid-9" id="my-grid-8">
             <li class="mui-table-view-cell mui-media mui-col-xs-3 mui-col-sm-3"><a>
                     <span class="iconfont icon-xiaxian"></span>
@@ -272,6 +322,286 @@
 <script src="//s.iamberry.com/watero/js/jquery-2.1.1.min.js"></script>
 <script src="//s.iamberry.com/watero/js/shop/main.js?v=2016111701"></script>
 <script src="//s.iamberry.com/watero/js/shop/wechat-utils-1.0.js"></script>
-<script src="//s.iamberry.com/watero/js/shop/vip_center.js?v=2017040701"></script>
+<!--<script src="//s.iamberry.com/watero/js/shop/vip_center.js?v=2017040701"></script>-->
+<script>
+    mui.ready(function() {
+        marquee_Show();
+        getCartNum();
+        mui.each(document.querySelectorAll('#menu-lease-other .mui-control-item'), function(index, el) {
+            el.addEventListener('tap', function() {
+                switch(index) {
+                    case 0:
+                        mui.openWindow({
+                            url: base_path + '/agentWechat/agentNext'
+                        });
+                        break;
+                    case 1:
+                        mui.openWindow({
+                            url: '//www.iamberry.com/iamberry_wechat/after_service_watero.html'
+                        });
+                        break;
+                    case 2:
+                        mui.confirm('服务时间:工作日9:00-18:00', '客服电话:<a>400-8006692</a>', ['取消', '拨打'], function(e) {
+                            if(e.index == 1) {
+                                location.href = 'tel:4008006692'
+                            }
+                        });
+                        break;
+                    case 3:
+                        mui.openWindow({
+                            url: '//w.iamberry.com/watero/view/faq.html'
+                        });
+                        break;
+                    default:
+                        break
+                }
+            }, false)
+        });
+        mui.each(document.querySelectorAll('#menu-nav .mui-control-item'), function(index, el) {
+            var th=this;
+            el.addEventListener('tap', function() {
+                mui.openWindow({
+                    url: th.getAttribute("href")
+                });
+            }, false)
+        });
+        mui.ajax(base_path + '/agent/member?dates=' + new Date().getTime(), {
+            dataType: 'json',
+            type: 'post',
+            timeout: 15000,
+            success: function(dt) {
+                var data = dt.data;
+                if(dt.status) {
+                    if(data.userHead != null && typeof(data.userHead) != "undefined" && data.userHead != '') {
+                        var imgObj = $("<img src='" + data.userHead + "?" + new Date().getTime() + "'/>");
+                        $("#headDiv").empty().append(imgObj)
+                    }
+                    if(data.userNickname != null && typeof(data.userNickname) != "undefined" && data.userNickname != '') {
+                        $("#userNickname").html(decodeURI(data.userNickname))
+                    }
+                    var userNickname = $("#userNickname").html();
+                    if(data.shareType != null && typeof(data.shareType) != "undefined" && data.shareType == 2) {
+                        //$("#2WM").show();
+                        if(userNickname != "") {
+                            $("#userNickname").html(userNickname )
+							$("#vipName").html('<span class="mui-h6">VIP用户</span>');
+                        }
+                    } else {
+                        if(userNickname != "") {
+                            $("#userNickname").html(userNickname)
+                            $("#vipName").html('<span class="mui-h6">普通用户</span>');
+                        }
+                    }
+                    $.ajax({
+                        type: 'post',
+                        url: base_path + '/probationOrder/membersProbationOrder',
+                        data: {},
+                        dataType: 'json',
+                        timeout: 15000,
+                        success: function(dts) {
+                            if(dts.status) {
+                                var str = '';
+                                if(dts.data.probationOrderDtoList.length == 0) {
+                                    $("#try_order_list").hide()
+                                }
+                                mui(dts.data.probationOrderDtoList).each(function(index) {
+                                    switch(this.probationStatus) {
+                                        case 1:
+                                            str = "待派送";
+                                            break;
+                                        case 2:
+                                            str = "派送中";
+                                            break;
+                                        case 3:
+                                            str = "待支付";
+                                            break;
+                                        case 4:
+                                            str = "暂停试用";
+                                            break;
+                                        case 5:
+                                            str = "支付完成";
+                                            break;
+                                        default:
+                                            str = "订单关闭";
+                                            break
+                                    }
+                                    var str1 = '',
+                                        str2 = '';
+                                    if(str == "待支付") {
+                                        str1 = '<a data-loading-icon="mui-spinner mui-spinner-custom" data-loading-text="正在支付" class="mui-btn try-btn-pay mui-pull-right" style="margin-right: 12px;" proid="' + this.probationOrderid + '">立即支付</a>';
+                                        str2 = '<div>试用剩余时间:<span id="time_out' + (index + 1) + '"></span></div>'
+                                    }
+                                    $("#try_order_list").append('<li class="mui-table-view-cell mui-media"><a class="go_try_order" proid="' + this.probationOrderid + '" style="margin-left: -20px;"><span class="mui-media-object mui-pull-left wh-80"><img src="' + this.productIntroduceImg + '"></span><div class="mui-media-body center-middle"><div>' + str + '</div><div>订单号:' + this.probationOrderid + '</div>' + str2 + '</div></a><div class="btn-box">' + str1 + '</div></li>');
+                                    if(str == "待支付") {
+                                        addTimer('time_out' + (index + 1), this.probationRemainingTime / 1000)
+                                    }
+                                })
+                            } else {
+                                mui.alert(dts.data.message)
+                            }
+                        },
+                        error: function(xhr, type, errorThrown) {
+                            console.log(xhr);
+                            mui.alert("请检查网络或刷新页面重试!")
+                        }
+                    });
+                    document.querySelector('.loading-bg').style.display = 'none'
+                } else {
+                    var btnArray = ['否', '是'];
+                    mui.confirm(dt.message, '提示', btnArray, function(e) {
+                        if(e.index == 1) {
+                            location.reload(true)
+                        }
+                    })
+                }
+            },
+            error: function(xhr, type, errorThrown) {
+                console.log(xhr)
+            }
+        });
+        if(marquee != '') {
+            $('body').append('<div class="marquee-show"><div></div></div>')
+        }
+    });
+    mui('body').on('tap', '#rent_wait_deliver', function() {
+        mui.openWindow({
+            url: '/watero/view/rent/lease_order_details.html?rentStatus=-1'
+        })
+    });
+    mui('body').on('tap', '#rent_already_deliver', function() {
+        mui.openWindow({
+            url: '/watero/view/rent/lease_order_details.html?rentStatus=5'
+        })
+    });
+    mui('body').on('tap', '.icon-shebeiliebiao', function() {
+        mui.openWindow({
+            url: '/watero/view/rent/my_equipment.html'
+        })
+    });
+    mui('body').on('tap', '#xieyi-dalog', function() {
+        mui.openWindow({
+            url: '/watero/view/rent/try_xieyi.html'
+        });
+    });
+    mui('body').on('tap', '.go_try_order', function() {
+        mui.openWindow({
+            url: base_path + '/probation/try_order?orderId=' + this.getAttribute("proid")
+        })
+    });
+    var isPay = true;
+    mui('body').on('tap', '.try-btn-pay', function() {
+        var th = this;
+        if(isPay) {
+            mui(this).button('loading');
+            isPay = false;
+            $.ajax({
+                type: 'post',
+                url: base_path + '/probation/pay',
+                data: {
+                    "orderId": th.getAttribute("proid")
+                },
+                dataType: 'json',
+                timeout: 15000,
+                success: function(dt) {
+                    if(dt.status) {
+                        var obj = JSON.parse("{" + dt.data.info + "}");
+                        WeixinJSBridge.invoke('getBrandWCPayRequest', obj, function(res) {
+                            if(res.err_msg == 'get_brand_wcpay_request:ok') {
+                                $.ajax({
+                                    type: 'post',
+                                    url: base_path + '/probation/check_probation_pay_success',
+                                    data: {
+                                        "orderId": th.getAttribute("proid")
+                                    },
+                                    dataType: 'json',
+                                    timeout: 15000,
+                                    success: function(data) {
+                                        if(data.status) {
+                                            if(data.data == 5) {
+                                                mui.alert("支付成功", '', function() {
+                                                    mui.openWindow({
+                                                        url: base_path + '/probation/try_order?orderId=' + th.getAttribute("proid")
+                                                    })
+                                                })
+                                            } else {
+                                                mui.alert(data.message, '', function() {
+                                                    mui(th).button('reset')
+                                                })
+                                            }
+                                        } else {
+                                            mui(th).button('reset');
+                                            mui.alert(data.message)
+                                        }
+                                    },
+                                    error: function(xhr, type, errorThrown) {
+                                        isPay = true;
+                                        console.log(xhr);
+                                        mui(th).button('reset');
+                                        mui.alert("请检查网络或刷新页面重试!")
+                                    }
+                                })
+                            } else {
+                                isPay = true;
+                                mui(th).button('reset');
+                                mui.alert("对不起,支付失败!请稍后重试!")
+                            }
+                        })
+                    } else {
+                        mui(th).button('reset');
+                        mui.alert(dt.message)
+                    }
+                },
+                error: function(xhr, type, errorThrown) {
+                    isPay = true;
+                    console.log(xhr);
+                    mui(th).button('reset');
+                    mui.alert("请检查网络或刷新页面重试!")
+                }
+            })
+        } else {
+            mui.alert("正在请求支付中~~请稍后!");
+            return
+        }
+    });
+    var addTimer = function() {
+        var list = [],
+            interval;
+        return function(id, time) {
+            if(!interval) {
+                interval = setInterval(go, 1000)
+            }
+            list.push({
+                ele: document.getElementById(id),
+                time: time
+            })
+        };
+
+        function go() {
+            for(var i = 0; i < list.length; i += 1) {
+                list[i].ele.innerHTML = getTimerString(list[i].time ? list[i].time -= 1 : 0);
+                if(!list[i].time) {
+                    list.splice(i--, 1)
+                }
+            }
+        }
+
+        function getTimerString(time) {
+            d = Math.floor(time / 86400), h = Math.floor((time % 86400) / 3600), m = Math.floor(((time % 86400) % 3600) / 60), s = Math.floor(((time % 86400) % 3600) % 60);
+            if(time > 0) {
+                return d + "天" + h + "时" + m + "分" + s + "秒"
+            } else {
+                return "试用已结束"
+            }
+        }
+    }();
+	$(document).on('tap', '#center-menu>li', function() {
+		var href = $(this).attr("href");
+		location.href =href;
+	});
+    $(document).on('tap', '.see-rights', function() {
+        location.href ='//w.iamberry.com/watero/view/faq.html';
+    });
+
+</script>
 </body>
 </html>