clearing.html 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
  6. <meta name="apple-mobile-web-app-capable" content="yes">
  7. <meta name="apple-mobile-web-app-status-bar-style" content="black">
  8. <title>结算</title>
  9. <link rel="stylesheet" type="text/css" href="css/mui.min.css" />
  10. <link rel="stylesheet" type="text/css" href="css/iconfont.css" />
  11. <link rel="stylesheet" type="text/css" href="css/main.css" />
  12. <script type="text/javascript">
  13. // 屏蔽分享
  14. window.hiddenAllWechatMenu = true;
  15. </script>
  16. </head>
  17. <body>
  18. <div class="mui-content" style="padding-bottom: 56px;">
  19. <div class="address-cantainner">
  20. <ul class="mui-table-view mui-table-view-striped my-grid-view-no mui-table-view-condensed">
  21. <li class="mui-table-view-cell">
  22. <div class="mui-table">
  23. <!--没有选地址时显示的div-->
  24. <div class="mui-table-cell mui-col-xs-12 table-middle btn-add-address">
  25. <div class="add-address"><span class="iconfont icon-jia"></span>添加收货地址</div>
  26. </div>
  27. <!--选择微信地址后显示的div-->
  28. <div id="user-address-div" style="display: none;">
  29. <!--<div class="mui-table-cell mui-col-xs-1 mui-text-left table-middle">
  30. <p><span class="iconfont icon-dingwei"></span></p>
  31. </div>
  32. <div class="mui-table-cell mui-col-xs-10 mui-text-left table-middle">
  33. <div>收货人:林笑笑 <span class="mui-pull-right">16899996678</span></div>
  34. <p>收货地址:广东省深圳市福田区莲花街道深圳特区 报业大厦12b</p>
  35. </div>
  36. <div class="mui-table-cell mui-col-xs-1 mui-text-right table-middle">
  37. <p><span class="mui-icon mui-icon-arrowright"></span></p>
  38. </div>-->
  39. </div>
  40. </div>
  41. </li>
  42. </ul>
  43. </div>
  44. <div class="clearing-box">
  45. <ul class="mui-table-view mui-table-view-striped my-grid-view-no mui-table-view-condensed shopping-cart-list">
  46. </ul>
  47. <ul class="mui-table-view">
  48. <li class="mui-table-view-cell" id="ul-youhuiquan" style="padding-left:7px;display: none;">
  49. <a class="mui-navigate-right btn-youhuiquan">
  50. 优惠券<span class="mui-pull-right cl-red">未选择优惠券</span>
  51. </a>
  52. </li>
  53. <li>
  54. <div class="mui-input-row">
  55. <label class="lbl-remarks">订单备注</label>
  56. <input class="ipt-remarks" id="textarea" type="text" placeholder="选填:您对订单有特殊要求,可以在此备注">
  57. </div>
  58. </li>
  59. </ul>
  60. <div class="mui-content-padded mui-text-right">合计:<span class="pro-price">¥<span class="count_price">0.0</span></span>
  61. </div>
  62. </div>
  63. <div class="buy-footer1">
  64. <table class="tb-clearing">
  65. <tr>
  66. <td class="quanxuan">
  67. 共<span id="pro-count" class="cl-red">0</span>件商品
  68. </td>
  69. <td class="mui-text-center">需支付:<span class="count_price_box">¥<span class="pay_price">0.0</span></span>
  70. </td>
  71. <td>
  72. <a id="go-pay" class="mui-btn mui-pull-right add_gwc go-clearing">立即支付</a>
  73. </td>
  74. </tr>
  75. </table>
  76. </div>
  77. </div>
  78. <!-- 加载ing begin-->
  79. <div class="loading covers">
  80. <div class="loading-bj"></div>
  81. <p>正在加载...</p>
  82. </div>
  83. <!-- 加载ing end -->
  84. <script src="js/mui.min.js"></script>
  85. <script src="js/jquery-2.1.1.min.js"></script>
  86. <script src="js/main.js"></script>
  87. <script src="js/wechat-utils-1.0.js"></script>
  88. <script>
  89. window.addEventListener('pageshow', function(e) {
  90. // 通过persisted属性判断是否存在 BF Cache
  91. if(e.persisted) {
  92. location.reload();
  93. }
  94. });
  95. var userIntegral = 0; // 用户可用积分
  96. var meonyProportion = 0; // 兑换比例:1个积分=?分钱
  97. var payTotal = 0.0; // 支付总金额
  98. var userInputIntegral = 0; // 抵扣积分
  99. var isPay = true; // 是否在请求支付,false表示正在请求,true可以请求
  100. var cartIdStr = ""; // 购物车ID
  101. var usePayMoney = 0;
  102. var ipt_balance = 0;
  103. var yhq_val = 0;
  104. var used_balance = 0;
  105. var yhq_type = 1;
  106. var yhq_id = '';
  107. var orderItem; //获取订单项信息
  108. var couponMoney = 0; //新人卷 - 优惠金额
  109. var channelType = getParam("channelType"); //渠道类型
  110. var channelId = getParam("channelId"); //渠道id
  111. if(channelType == null || channelId == null ){
  112. channelType = 0;
  113. channelId=0;
  114. }
  115. if(channelType > 0 || channelId>0){
  116. location.href = 'channel-clearing.html?channelType='+channelType+'&channelId='+channelId; //跳转结算页面
  117. }
  118. //var wechatAddr = new Object();
  119. mui.ready(function() {
  120. var parameter = {}; //ajax参数json集合
  121. var cartidList = '';
  122. if(!window.sessionStorage) {
  123. mui.alert("您的浏览器不支持sessionStorage");
  124. } else {
  125. //读取上一个页面带过来的sessionStorage
  126. pay_data = JSON.parse(sessionStorage.getItem('pay_data'));
  127. if(pay_data != null) {
  128. cartidList = pay_data.text[0]; //购物项id集合
  129. parameter["cartIds"] = cartidList;
  130. parameter["isCustomize"] = 1;
  131. parameter["channelType"] = channelType;
  132. parameter["channelId"] = channelId;
  133. $.ajax(base_path + '/wechat/order/payBefore', {
  134. data: parameter,
  135. dataType: 'json',
  136. type: 'get',
  137. xhrFields: {
  138. withCredentials: true
  139. },
  140. crossDomain: true,
  141. timeout: 15000,
  142. success: function(dt) {
  143. if(dt.isRedirect) {
  144. location.href = dt.redirectURL;
  145. } else {
  146. if(dt.status == true) {
  147. // 购物项遍历
  148. console.log(dt);
  149. orderItem = dt.data.cartItems; //订单项信息
  150. mui.each(dt.data.cartItems, function(index) {
  151. if(this.productType == 101){ //刷头类
  152. var brPrice = this.productPrice; //优惠券金额
  153. if(couponMoney == 0 || couponMoney < brPrice){
  154. couponMoney = brPrice;
  155. }
  156. }
  157. })
  158. var liNote = "";
  159. var yhq_str = "";
  160. if(dt.data.couponItems!=null && typeof(dt.data.couponItems)!=undefined &&
  161. dt.data.couponItems.length > 0 && channelType==0 && channelId ==0) {
  162. $("#ul-youhuiquan").show();
  163. var str = '';
  164. mui.each(dt.data.couponItems, function() {
  165. var couponReduce = this.couponReduce,val='';
  166. //if(this.couponIsNewPeople == 1){ //新人卷
  167. // couponReduce = couponMoney;
  168. //}
  169. if(this.couponType==2){
  170. val=(couponReduce/10).toFixed(1)+"折";
  171. }else{
  172. val='¥' + ((couponReduce) / 100).toFixed(2);
  173. }
  174. str += '<li class="my-table-view-cell" style="opacity:.5;margin:20px 0;"><div class="mui-table"><div class="mui-table-cell table-middle mui-col-xs-11">'+ this.couponName +':'+val+'<h6>有效期至:' + this.couponUseEndDate + '</h6></div><div class="mui-table-cell table-middle mui-col-xs-1"><input name="radio" type="radio" class="mui-pull-left" val="' + (this.couponReduce / 100).toFixed(2) + '" couponid="' + this.couponItemId + '" couponType="' + this.couponId + '" zhekou="'+this.couponType+'" couponIsNewPeople="'+ this.couponIsNewPeople +'"/></div></div></li>';
  175. });
  176. str += '<li class="my-table-view-cell" style="opacity:.5;margin:20px 0;"><div class="mui-table"><div class="mui-table-cell table-middle mui-col-xs-11">不使用优惠券<h6></h6></div><div class="mui-table-cell table-middle mui-col-xs-1"><input name="radio" type="radio" class="mui-pull-left"/></div></div></li>';
  177. $("body").append('<div class="my-picker"><ul class="mui-table-view mui-table-view-striped mui-table-view-condensed my-grid-view-no" style="padding: 25px 15px; overflow: scroll;max-height: 420px;">' + str + '</ul><button class="mui-btn my-btn-block my-btn-user-know" disabled="disabled">确认</button><span class="iconfont icon-guanbi"></span></div>');
  178. }
  179. var proCount = 0;
  180. mui.each(dt.data.cartItems, function(index) {
  181. if(this.productType == 101){ //刷头类
  182. var brPrice = this.productPrice; //优惠券金额
  183. if(couponMoney == 0 || couponMoney < brPrice){
  184. couponMoney = brPrice;
  185. }
  186. }
  187. var num = this.cartNum;
  188. proCount += num;
  189. var total = (num * this.productPrice / 100).toFixed(2); //购物车小计,单位分,保留两位小数
  190. var productId = this.cartProductId;
  191. liNote += '<div class="mui-table"><div class="mui-table-cell mui-col-xs-5"><img class="mui-media-object wh-100" src="' + this.productIntroduceImg + '"></div><div class="mui-table-cell table-middle mui-col-xs-7" style="line-height:2.5">' + this.productName + '<h6>颜色:' + this.productColor + '<span class="center">数量:' + num + '</span></h6><div>单价¥' + (this.productPrice / 100).toFixed(2) + '</div></div></div>';
  192. });
  193. var $productListUl = $(".shopping-cart-list");
  194. $productListUl.empty();
  195. $productListUl.append(liNote);
  196. // 保存数据
  197. payTotal = dt.data.payTotal; // 支付金额,单位分
  198. cartIdStr = dt.data.cartId; // 购物车ID
  199. //默认自己拉出地址
  200. if(dt.data.addressInfo != undefined && dt.data.addressInfo != null) {
  201. $(".btn-add-address").hide();
  202. $("#user-address-div").html('<div class="mui-table"><div class="mui-table-cell mui-col-xs-1 mui-text-left table-middle"><p><span class="iconfont icon-dingwei"></span></p></div><div class="mui-table-cell mui-col-xs-10 mui-text-left table-middle"><div>收货人:' + dt.data.addressInfo.salesAddressName + ' <span class="mui-pull-right">' + dt.data.addressInfo.salesAddressTel + '</span></div><p>收货地址:' + dt.data.addressInfo.salesAddressInfo + '</p></div><div class="mui-table-cell mui-col-xs-1 mui-text-right table-middle"><p><span class="mui-icon mui-icon-arrowright"></span></p></div></div>').show();
  203. //给微信参数赋值
  204. wechatAddr.status = true;
  205. wechatAddr.detailInfo = dt.data.addressInfo.salesAddressInfo;
  206. wechatAddr.userName = dt.data.addressInfo.salesAddressName;
  207. wechatAddr.userTel = dt.data.addressInfo.salesAddressTel;
  208. wechatAddr.postalCode = dt.data.addressInfo.salesAddressPostnum;
  209. }else{
  210. wechatAddr.status = false;
  211. }
  212. $(".count_price,.pay_price").text((dt.data.payTotal / 100).toFixed(2));
  213. $("#pro-count").text(proCount);
  214. $(".loading").hide().css("opacity", "0"); //隐藏(正在加载...)
  215. } else {
  216. mui.alert("获取数据失败!", function() {
  217. location.href = "shopping-cart.html";
  218. });
  219. }
  220. }
  221. },
  222. error: function(xhr, type, errorThrown) {
  223. console.log(xhr);
  224. mui.alert("获取数据失败,网络错误!")
  225. }
  226. });
  227. } else {
  228. mui.alert("sessionStorage异常!", function() {
  229. location.href = "index.html";
  230. })
  231. }
  232. }
  233. // var str = "";
  234. // for(i = 0; i < 3; i++) {
  235. // str += '<div class="mui-table"><div class="mui-table-cell mui-col-xs-5"><img class="mui-media-object wh-100" src="images/pro-bai.png"></div><div class="mui-table-cell table-middle mui-col-xs-7" style="line-height:2.5">柔性声波牙刷<h6>颜色:极光白<span class="center">数量:2</span></h6><div>¥2999.00</div></div></div>';
  236. // }
  237. // document.querySelector('.shopping-cart-list').innerHTML = str;
  238. });
  239. //callback为用户点击蒙版时自动执行的回调;
  240. var mask = mui.createMask(function() {
  241. $(".my-picker").removeClass("active"); //隐藏弹窗
  242. });
  243. //现金券弹窗
  244. $(document).on('tap', '.btn-youhuiquan', function() {
  245. mask.show();
  246. // if($(".my-picker").length==0){
  247. // var li = '<li class="my-table-view-cell" style="opacity:.5;margin:20px 0;"><div class="mui-table"><div class="mui-table-cell table-middle mui-col-xs-11">现金券:¥99.9<h6>有效期至:2017-12-12</h6></div><div class="mui-table-cell table-middle mui-col-xs-1"><input name="radio" type="radio" class="mui-pull-left" /></div></div></li>';
  248. // var str = '';
  249. // for(i = 0; i < 17; i++) {
  250. // str += li;
  251. // }
  252. // $("body").append('<div class="my-picker"><ul class="mui-table-view mui-table-view-striped mui-table-view-condensed my-grid-view-no" style="padding: 25px 15px; overflow: scroll;max-height: 420px;">' + str + '</ul><button class="mui-btn my-btn-block my-btn-user-know" disabled="disabled">确认使用</button><span class="iconfont icon-guanbi"></span></div>');
  253. // }
  254. // setTimeout(function() {
  255. if($(".my-picker").length > 0) {
  256. $(".my-picker").addClass("active");
  257. }
  258. // }, 500);
  259. });
  260. //确认使用
  261. $(document).on('tap', '.my-btn-user-know', function() {
  262. //console.log("确认使用");
  263. if(typeof($(".my-picker input[name=radio]:checked").attr("couponid")) != "undefined") {
  264. $(".btn-youhuiquan").attr("couponid", $(".my-picker input[name=radio]:checked").attr("couponid"));
  265. yhq_id = $(".my-picker input[name=radio]:checked").attr("couponid");
  266. $(".btn-youhuiquan span").text("-¥" + $(".my-picker input[name=radio]:checked").attr("val"));
  267. var couponIsNewPeople = $(".my-picker input[name=radio]:checked").attr("couponIsNewPeople");
  268. var couponType = $(".my-picker input[name=radio]:checked").attr("couponType");
  269. var price = 0;
  270. /*只减去刷头的钱*/
  271. if(couponIsNewPeople == 1){ //标识为新人卷
  272. if(couponType == 20000){
  273. var brushCouponPrice = 0; //刷头优惠总金额
  274. var otherPrice = 0;//其他商品总金额
  275. var couponPrice = $(".my-picker input[name=radio]:checked").attr("val"); //优惠券金额
  276. mui.each(orderItem,function(index){
  277. if(this.productType == 101){ //刷头类
  278. var brPrice = this.productPrice; //优惠券金额
  279. if(brushCouponPrice == 0 || brushCouponPrice < brPrice){
  280. brushCouponPrice = brPrice;
  281. }
  282. }
  283. });
  284. brushCouponPrice = accDiv(brushCouponPrice,100);
  285. price = accSub($(".count_price").text(),brushCouponPrice); //刷头减去优惠券
  286. $(".btn-youhuiquan span").text("-¥" + brushCouponPrice); //减去优惠金额赋值
  287. }else if(couponType == 40000){
  288. var brushPrice = 0; //刷头总金额
  289. var otherPrice = 0;//其他商品总金额
  290. var couponPrice = $(".my-picker input[name=radio]:checked").attr("val"); //优惠券金额
  291. mui.each(orderItem,function(index){
  292. if(this.productType == 101){
  293. brushPrice = accAdd(brushPrice,this.productPrice*this.cartNum);
  294. }else{
  295. otherPrice = accAdd(otherPrice,this.productPrice*this.cartNum);
  296. }
  297. });
  298. brushPrice = accDiv(brushPrice,100);
  299. otherPrice = accDiv(otherPrice,100);
  300. brushPrice = accSub(brushPrice,couponPrice); //刷头减去优惠券
  301. if(brushPrice <= 0){
  302. brushPrice = 0;
  303. }
  304. price = accAdd(brushPrice,otherPrice);
  305. }
  306. }else{
  307. if($(".my-picker input[name=radio]:checked").attr("zhekou")==2){
  308. price = accMul($(".count_price").text(),$(".my-picker input[name=radio]:checked").attr("val"));
  309. // price =parseInt($(".count_price").text()*$(".my-picker input[name=radio]:checked").attr("val"));
  310. $(".btn-youhuiquan span").text("-¥"+accSub($(".count_price").text(),price)); //减去折扣优惠金额赋值
  311. }else{
  312. price = accSub($(".count_price").text(),$(".my-picker input[name=radio]:checked").attr("val"));
  313. }
  314. }
  315. if(price <= 0) {
  316. price = 0.0; //判断商品价格减去现金券价格若<0 则显示0
  317. }
  318. $(".pay_price").text(price);
  319. } else {
  320. yhq_id = '';
  321. $(".btn-youhuiquan").removeAttr("couponid");
  322. $(".btn-youhuiquan span").text("不使用现金券");
  323. $(".pay_price").text($(".count_price").text());
  324. }
  325. $(".my-picker").removeClass("active"); //隐藏弹窗
  326. $(".mui-backdrop").remove(); //移除遮罩层
  327. });
  328. //单选事件
  329. $(document).on('tap', '.my-picker .my-table-view-cell', function() {
  330. $(this).find("input[name=radio]").prop("checked", true);
  331. $(this).css("opacity", "1");
  332. $(this).siblings().css("opacity", ".5");
  333. $(".my-btn-user-know").removeAttr("disabled").addClass("active");
  334. });
  335. //关闭弹窗
  336. $(document).on('tap', '.icon-guanbi', function() {
  337. $(".mui-backdrop").remove(); //移除遮罩层
  338. $(".my-picker").removeClass("active"); //隐藏弹窗
  339. });
  340. // 获取微信共享地址
  341. $(document).on('tap', '.btn-add-address,#user-address-div', function() {
  342. editAddrV1(
  343. function(res) {
  344. // 用户成功拉出地址
  345. var address = res.provinceName + "-" + res.cityName + "-" + res.countryName + "-" + res.detailInfo;
  346. wechatAddr.status = true;
  347. wechatAddr.detailInfo = address;
  348. wechatAddr.postalCode = res.postalCode;
  349. wechatAddr.userName = res.userName;
  350. wechatAddr.userTel = res.telNumber;
  351. wechatAddr.nationalCode = res.nationalCode;
  352. $(".btn-add-address").hide();
  353. $("#user-address-div").html('<div class="mui-table"><div class="mui-table-cell mui-col-xs-1 mui-text-left table-middle"><p><span class="iconfont icon-dingwei"></span></p></div><div class="mui-table-cell mui-col-xs-10 mui-text-left table-middle"><div>收货人:' + wechatAddr.userName + ' <span class="mui-pull-right">' + wechatAddr.userTel + '</span></div><p>收货地址:' + wechatAddr.detailInfo + '</p></div><div class="mui-table-cell mui-col-xs-1 mui-text-right table-middle"><p><span class="mui-icon mui-icon-arrowright"></span></p></div></div>').show();
  354. },
  355. function() {
  356. if($('#user-address-div').html() != null && $('#user-address-div').html() != '') {
  357. wechatAddr.status = true;
  358. } else {
  359. wechatAddr.status = false;
  360. // 用户取消拉出地址
  361. mui.alert("您没有选择收货地址!");
  362. }
  363. }
  364. );
  365. });
  366. // 去支付
  367. $(document).on('tap', '#go-pay', function() {
  368. var remark = $("#textarea").val();
  369. var ch_en_num = /^[A-Za-z0-9 _\[\]\【\】\{\}\{\}\(\)\(\)\《\》\<\>\,\,\.\。\、\!\!\~\·\@\#\¥\$\%\^\…\&\—\:\:\;\;\‘\’\'\'\"\"\“\”\?\?\-\=\|\*\+\-\u4e00-\u9fa5]{0,100}$/;
  370. if(ch_en_num.test(remark)) {
  371. //console.log("备注验证通过")
  372. } else {
  373. mui.alert("备注格式错误!仅支持中/英文,数字,普通符号");
  374. return false;
  375. }
  376. if(wechatAddr.status) {
  377. if($('#user-address-div').html() == null || $('#user-address-div').html() == '') {
  378. wechatAddr.status = false;
  379. mui.toast("请选择收货信息!");
  380. return ;
  381. }
  382. if(isPay) {
  383. isPay = false; // 锁定请求按钮
  384. /* 组装数据 */
  385. var dataArgs = {
  386. "orderAddressInfo": wechatAddr.detailInfo,
  387. "orderAddressPostNum": wechatAddr.postalCode,
  388. "orderAddressMoblie": wechatAddr.userTel,
  389. "orderAddressName": wechatAddr.userName,
  390. "cartIdStr": cartIdStr
  391. };
  392. if(yhq_id != '') {
  393. dataArgs["couponId"] = yhq_id;
  394. }
  395. if(remark != '') {
  396. dataArgs["orderUserRemark"] = remark;
  397. }
  398. dataArgs["isCustomize"] = 1;
  399. dataArgs["channelType"] = channelType;
  400. dataArgs["channelId"] = channelId;
  401. $.ajax(base_path + '/wechat/order/pay', { // 提交订单,准备支付
  402. data: dataArgs,
  403. dataType: 'json',
  404. type: 'post',
  405. xhrFields: {
  406. withCredentials: true
  407. },
  408. crossDomain: true,
  409. timeout: 15000,
  410. success: function(dt) {
  411. // layer.closeAll();
  412. //mui.alert(dt.resultCode=="500");
  413. if(dt.resultCode == "500") {
  414. mui.alert(dt.message);
  415. isPay = true;
  416. return;
  417. };
  418. if(dt.data.info == "isOK") {
  419. location.href = 'pay-win.html?orderId=' + dt.data.orderId + "&dates=" + new Date().getTime()
  420. return;
  421. };
  422. if(dt.status) {
  423. var str = dt.data.info;
  424. var obj = JSON.parse("{" + str + "}");
  425. WeixinJSBridge.invoke('getBrandWCPayRequest', obj, function(res) {
  426. if(res.err_msg == 'get_brand_wcpay_request:ok') {
  427. $.ajax(base_path + '/wechat/order/checkOrderPaySuccess?dates=' + new Date().getTime(), {
  428. data: {
  429. "orderId": dt.data.orderId
  430. },
  431. dataType: 'json',
  432. xhrFields: {
  433. withCredentials: true
  434. },
  435. crossDomain: true,
  436. type: 'get',
  437. timeout: 15000,
  438. success: function(dataobj) {
  439. if(dataobj.isRedirect) {
  440. location.href = dataobj.redirectURL;
  441. } else {
  442. if(dataobj.status == true) { // 支付成功
  443. location.href = "pay-win.html?orderId=" + dataobj.data + "&dates=" + new Date().getTime();
  444. } else {
  445. location.href = "order-details.html?orderId=" + dataobj.data + "&dates=" + new Date().getTime(); // 前往订单详情
  446. }
  447. }
  448. },
  449. error: function(xhr, type, errorThrown) {
  450. console.log(xhr);
  451. }
  452. });
  453. } else {
  454. isPay = true;
  455. mui.alert("对不起,支付失败!请稍后重试!" + dt.data.orderId + "支付失败!", function() {
  456. location.href = "order-details.html?orderId=" + dt.data.orderId + "&dates=" + new Date().getTime(); // 前往订单详情
  457. });
  458. }
  459. });
  460. } else {
  461. isPay = true;
  462. mui.alert(dt.message);
  463. location.href = "order-details.html?orderId=" + dt.data.orderId + "&dates=" + new Date().getTime(); // 前往订单详情
  464. }
  465. },
  466. error: function(xhr, type, errorThrown) {
  467. isPay = true;
  468. // layer.closeAll();
  469. mui.alert("您的网络异常,请刷新重试!");
  470. return;
  471. }
  472. });
  473. } else {
  474. mui.alert("正在请求支付中~~请稍后!");
  475. return;
  476. }
  477. } else {
  478. mui.alert("请选择收货地址!");
  479. return;
  480. }
  481. });
  482. </script>
  483. </body>
  484. </html>