clearing.html 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title></title>
  6. <meta name="Expires" content="0">
  7. <meta name="Cache-Control" content="no-store, no-cache, must-revalidate">
  8. <meta name="Cache-Control" content="post-check=0, pre-check=0">
  9. <meta name="Pragma" content="no-cache">
  10. <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
  11. <meta name="apple-mobile-web-app-capable" content="yes">
  12. <meta name="apple-mobile-web-app-status-bar-style" content="black">
  13. <link rel="stylesheet" type="text/css" href="css/mui.min.css" />
  14. <link rel="stylesheet" type="text/css" href="css/iconfont.css" />
  15. <link rel="stylesheet" type="text/css" href="css/style.css" />
  16. <link rel="stylesheet" type="text/css" href="css/clearing.css" />
  17. <script type="text/javascript">
  18. // 屏蔽分享
  19. window.hiddenAllWechatMenu = true;
  20. </script>
  21. </head>
  22. <body style="background: #fff">
  23. <div class="loading-bg">
  24. <div class="mui-loading">
  25. <div class="mui-spinner">
  26. </div>
  27. &nbsp;&nbsp;加载中...
  28. </div>
  29. </div>
  30. <div class="mui-content" style="padding-bottom: 50px !important;background: #FFF;">
  31. <div class="address-cantainner">
  32. <ul class="mui-table-view mui-table-view-striped my-grid-view-no mui-table-view-condensed">
  33. <li class="mui-table-view-cell">
  34. <div class="mui-table">
  35. <!--没有选地址时显示的div-->
  36. <div class="mui-table-cell mui-col-xs-12 table-middle btn-add-address">
  37. <div class="add-address"><span class="iconfont icon-jia"></span>添加收货地址</div>
  38. </div>
  39. <div class="mui-table-cell mui-col-xs-1 mui-text-right table-middle btn-add-address">
  40. <p><span class="mui-icon mui-icon-arrowright"></span></p>
  41. </div>
  42. <!--选择微信地址后显示的div-->
  43. <div id="user-address-div" style="display: none;">
  44. <!--<div class="mui-table-cell mui-col-xs-1 mui-text-left table-middle">
  45. <p><span class="iconfont icon-dingwei"></span></p>
  46. </div>
  47. <div class="mui-table-cell mui-col-xs-10 mui-text-left table-middle">
  48. <div>收货人:林笑笑 <span class="mui-pull-right">16899996678</span></div>
  49. <p>收货地址:广东省深圳市福田区莲花街道深圳特区 报业大厦12b</p>
  50. </div>-->
  51. </div>
  52. </div>
  53. </li>
  54. </ul>
  55. </div>
  56. <!--<ul class="mui-table-view more">-->
  57. <!--<li class="mui-table-view-cell line-color" style="padding:20px 10px;">-->
  58. <!--<div style="display: none;" id="user-address-div"></div>-->
  59. <!--<a class="check_address" id="open-wechat-addres-a">-->
  60. <!--<span>请选择收货地址!</span><span class="mui-icon mui-icon-forward icon-r-c"></span>-->
  61. <!--</a>-->
  62. <!--</li>-->
  63. <!--</ul>-->
  64. <ul class="mui-table-view mui-table-view-chevron my-grid-view-no" id="products-list-ul">
  65. <li class="mui-table-view-cell mui-media" id="load-li">
  66. &nbsp;&nbsp;加载产品信息中...
  67. </li>
  68. </ul>
  69. <ul class="mui-table-view my-yhq-tab">
  70. <li class="mui-table-view-cell forward" style="margin: 0">
  71. <a href="#forward" class="mui-navigate-right">
  72. <div class="mui-media-body">
  73. 我的优惠券<span class="yhq-right"><span class="cl-red" id="yhq_count">0</span>张可使用</span>
  74. </div>
  75. </a>
  76. </li>
  77. <div style="padding: 10px 15px 0 15px;display: none;">可用余额:<span class="cl-red" id="used_balance">¥0.00</span></div>
  78. <li class="mui-table-view-cell pay_ipt_box" style="padding: 0;display: none;">
  79. <div class="mui-input-group">
  80. <div class="mui-input-row">
  81. <label>输入使用金额:</label>
  82. <input id="pay_ipt" type="number" placeholder="(如699)">
  83. </div>
  84. </div>
  85. </li>
  86. <li class="mui-table-view-cell" style="padding: 0;margin: 0;">
  87. <div class="mui-input-group">
  88. <div class="mui-input-row">
  89. <label>订单备注:</label>
  90. <input style="font-size: 12px" type="text" placeholder="(选填:订单要求,可以在此备注)" id="textarea">
  91. </div>
  92. </div>
  93. </li>
  94. <li class="mui-table-view-cell" style="padding: 0;margin: 0;">
  95. <div class="mui-input-group">
  96. <div class="mui-input-row">
  97. <label>商品金额:</label>
  98. <input style="font-size: 12px;text-align: right;" type="text" readonly="readonly" placeholder="(选填:订单要求,可以在此备注)" id="total">
  99. </div>
  100. </div>
  101. </li>
  102. <li class="mui-table-view-cell" id="vipSub" style="display: none;">
  103. <div><span>VIP专享(1年滤芯套装)</span><span class="mui-pull-right"><span id="vip_price">- ¥0</span></span></div>
  104. </li>
  105. <li class="mui-table-view-cell" id="accSub">
  106. <div><span id="yhq_name"></span><span class="mui-pull-right"><span id="yhq_price"></span></span></div>
  107. <div>账户余额:<span class="mui-pull-right cl-red">- ¥<span id="used_buy">0</span></span></div>
  108. </li>
  109. <li class="mui-table-view-cell" id="user2000" style="display: none;">
  110. <div><span>全场购满2000元</span><span class="mui-pull-right"><span id="user_2000">赠Aiberle电动牙刷1支</span></span></div>
  111. </li>
  112. <li class="mui-table-view-cell" id="user3000" style="display: none;">
  113. <div><span>全场购满3000元</span><span class="mui-pull-right">- ¥<span id="user_3000">100</span></span></div>
  114. </li>
  115. </ul>
  116. <div class="clearing-count" style="text-align: right;">订单合计:<font class="cl-red">¥</font><span class="cl-red" id="user-pay-money-span">加载中...</span></div>
  117. <div class="pay_weixin">
  118. <button type="button" class="mui-btn mui-btn-success mui-btn-block btn-weixin-pay" id="btn-weixin-pay" style="border-radius: 0;background-color: #55c0dc;border-color: #55c0dc;">立即支付</button>
  119. </div>
  120. </div>
  121. <div id="forward" class="mui-popover mui-popover-action mui-popover-bottom">
  122. <div class="mui-input-group mui-table-view-radio my-popover ">
  123. </div>
  124. <ul class="mui-table-view">
  125. <li class="mui-table-view-cell">
  126. <a href="#forward"><b>确定</b></a>
  127. </li>
  128. </ul>
  129. </div>
  130. <div class="dhq-dalog">
  131. <div>
  132. <div class="titles">请选择免费兑换产品<p>(您有1张T1/T2滤芯兑换券)</p></div>
  133. <div>
  134. <form class="mui-input-group">
  135. <div class="mui-input-row mui-radio mui-left">
  136. <label>兑换T1滤芯</label>
  137. <input name="radio2" type="radio" value="7"/>
  138. </div>
  139. <div class="mui-input-row mui-radio mui-left">
  140. <label>兑换T2滤芯</label>
  141. <input name="radio2" type="radio" value="8"/>
  142. </div>
  143. </form>
  144. </div>
  145. <div class="btn-boxs">
  146. <button type="button" class="mui-btn nexts">下次兑换</button>
  147. <button type="button" class="mui-btn enter">确认兑换</button>
  148. </div>
  149. </div>
  150. </div>
  151. <script src="js/mui.min.js"></script>
  152. <script src="js/jquery-2.1.1.min.js"></script>
  153. <script src="js/main.js"></script>
  154. <script src="js/page/wechat-utils-1.0.js"></script>
  155. <script src="js/page/layer.js"></script>
  156. <script>
  157. var userIntegral = 0; // 用户可用积分
  158. var meonyProportion = 0; // 兑换比例:1个积分=?分钱
  159. var payTotal = 0.0; // 支付总金额
  160. var userInputIntegral = 0; // 抵扣积分
  161. var isPay = true; // 是否在请求支付,false表示正在请求,true可以请求
  162. var cartIdStr = ""; // 购物车ID
  163. var usePayMoney = 0;
  164. var ipt_balance = 0;
  165. var yhq_val = 0;
  166. var used_balance = 0;
  167. var yhq_type = 1;
  168. var showIs = false;
  169. var accVipSub=0;
  170. var exchangeColorId='';
  171. var t1=0,t2=0,all_t=0;
  172. var user38Interests=2;
  173. mui.ready(function() {
  174. var name,value;
  175. var str=location.href; //取得整个地址栏
  176. var num=str.indexOf("?")
  177. str=str.substr(num+1); //取得所有参数
  178. var $productListUl = $("#products-list-ul");
  179. $.ajax(base_path+'/order/payBefore?'+str, {
  180. dataType: 'json',
  181. type: 'POST',
  182. timeout: 15000,
  183. xhrFields: {
  184. withCredentials: true
  185. },
  186. crossDomain: true,
  187. success: function(dt) {
  188. if(dt.status == true) {
  189. // 购物项遍历
  190. //console.log(dt)
  191. var liNote = "";
  192. var cNum = 0;
  193. user38Interests=dt.data.user38Interests;
  194. if(dt.data.balance == 0) {
  195. $(".pay_ipt_box").hide();
  196. } else {
  197. used_balance = accDiv(dt.data.balance, 100);
  198. $('#used_balance').html("¥ " + accDiv(dt.data.balance, 100));
  199. }
  200. var yhq_str = "";
  201. if(dt.data.couponItems.length == 0 || !dt.data.disable) {
  202. $(".forward").hide();
  203. } else {
  204. $("#yhq_count").html(dt.data.couponItems.length);
  205. //如果购买商品只有饮水机滤芯,则不能使用优惠券
  206. var c=0,flag=false;
  207. var btnArray = ['否', '是'];
  208. mui(dt.data.couponItems).each(function(index) {
  209. if(this.couponId==10000){
  210. c++;
  211. }
  212. });
  213. mui(dt.data.cartItems).each(function(index) {
  214. if(this.cartColorId==7){
  215. t1+=this.cartNum;
  216. }else if(this.cartColorId==8){
  217. t2+=this.cartNum;
  218. }else{
  219. all_t++;
  220. }
  221. });
  222. if(c>0){
  223. if((t1==0 && t2==0) || all_t==0){
  224. $(".dhq-dalog").show();
  225. }else{
  226. flag=true;
  227. }
  228. $(document).on('tap', '.enter', function() {
  229. if($(".dhq-dalog input[type=radio]:checked").length>0){
  230. flag=true;
  231. exchangeColorId=$(".dhq-dalog input[type=radio]:checked").val();
  232. $.ajax(base_path + '/cart/get_exchange?dates=' + new Date().getTime(), {
  233. data: {
  234. "couponId": 10000
  235. },
  236. dataType: 'json',
  237. xhrFields: {
  238. withCredentials: true
  239. },
  240. crossDomain: true,
  241. type: 'post',
  242. async:false,
  243. timeout: 15000,
  244. success: function(dts) {
  245. console.log(dts);
  246. //if(dts.status==true){
  247. if (dt.isRedirect) {
  248. location.href = dt.redirectURL;
  249. } else {
  250. console.log("t1="+t1+",t2="+t2+",all_t="+all_t);
  251. mui(dts.data).each(function(index) {
  252. if(exchangeColorId==this.colorId){
  253. if((((exchangeColorId==7 && t1==0) || (exchangeColorId==8 && t2==0)) && (all_t<=1) && ((t1+all_t)<=1 || (t2+all_t)<=1)) || (t1+t2==0) && all_t>0 || (((t1+all_t)==0 && t2<2) || ((t2+all_t)==0 && t1<2))){
  254. $productListUl.append('<li class="mui-table-view-cell mui-media dhq-last-add"><a><span class="mui-media-object mui-pull-left wh-100"> <img src="'+this.colorProductPic+'"></span><div class="mui-media-body" style="padding: 5% 0;"><div class="wt-space gwc_tit">'+this.colorProductName+'</div><div><small class="mui-h6 mui-pull-right">'+this.colorName+'x1</small></div></div><div class="price_sp cl-gwc" price="'+this.colorDiscount+'">¥'+accDiv(this.colorDiscount,100)+'</div></a></li>');
  255. }else{
  256. yhq_val = $("#forward input[yhq_type=3]").val();
  257. console.log(yhq_val)
  258. if(yhq_val == undefined) {
  259. yhq_val = 0
  260. }else{
  261. $("#user-pay-money-span").html((usePayMoney - yhq_val - ipt_balance).toFixed(2));
  262. }
  263. }
  264. }
  265. });
  266. }
  267. //}
  268. },
  269. error: function(xhr, type, errorThrown) {
  270. console.log(xhr);
  271. }
  272. });
  273. $("#forward input[yhq_type=3]").prop('checked',true);
  274. yhq_val = $("input[name=radio1]:checked").val();
  275. yhq_type = $("input[name=radio1]:checked").attr("yhq_type");
  276. if(yhq_val == undefined) {
  277. yhq_val = 0
  278. } else {
  279. if(yhq_type == 3){
  280. if(yhq_val > (usePayMoney - ipt_balance)) {
  281. $("input[name=radio1]:checked").removeAttr("checked");
  282. yhq_val = 0;
  283. mui.alert(' ', '当前优惠券不可用', function() {});
  284. }
  285. $("#yhq_name").html($("input[name=radio1]:checked").prev().html());
  286. $("#yhq_price").html("免费兑换1支T1或T2滤芯");
  287. $("#accSub,#accSub>div:first-child").show();
  288. console.log(yhq_val)
  289. if($(".dhq-last-add").length>0){
  290. yhq_val = 0;
  291. }
  292. $("#user-pay-money-span").html((usePayMoney - yhq_val - ipt_balance).toFixed(2));
  293. }
  294. }
  295. $(".dhq-dalog").hide();
  296. }else{
  297. console.log("请选择要兑换的滤芯");
  298. }
  299. });
  300. //下次兑换
  301. $(document).on('tap', '.nexts', function() {
  302. $("#forward input[yhq_type=3]").removeAttr('checked').prop("disabled","disabled");
  303. $(".dhq-dalog").hide();
  304. flag=false;
  305. if(user38Interests==1){
  306. console.log(usePayMoney>=2000 && usePayMoney<3000)
  307. if(usePayMoney>=2000 && usePayMoney<3000){
  308. $("#user2000").show();
  309. $("#user-pay-money-span").html(usePayMoney + " 元");
  310. }else if(usePayMoney>=3000){
  311. $("#user-pay-money-span").html((usePayMoney-100) + " 元");
  312. $("#user2000,#user3000").show();
  313. }else{
  314. $("#user2000,#user3000").hide();
  315. $("#user-pay-money-span").html(usePayMoney + " 元");
  316. }
  317. }else{
  318. $("#user-pay-money-span").html(usePayMoney + " 元");
  319. }
  320. console.log("899")
  321. });
  322. }
  323. if (dt.data.disable) {
  324. mui(dt.data.couponItems).each(function(index) {
  325. var checked='';
  326. if(this.couponId==10000 && flag){
  327. checked='checked';
  328. }
  329. yhq_str += '<div class="mui-input-row mui-radio"><label>' + this.couponName + '</label><input name="radio1" value="' + accDiv(this.couponReduce, 100) + '" type="radio" id="' + this.couponItemId + '" yhq_type="' + this.couponType + '" '+checked+'/></div>';
  330. });
  331. $(".my-popover").html(yhq_str + '<div class="mui-input-row mui-radio"><label>不使用优惠券</label><input name="radio1" value="1" type="radio"></div>');
  332. }
  333. }
  334. for(var i = 0; i < dt.data.cartItems.length; i++) {
  335. // 购物车小计,分--元
  336. var total = dt.data.cartItems[i].cartNum * dt.data.cartItems[i].productPrice / 100;
  337. var pro_color = switchcolor(dt.data.cartItems[i].cartColorId);
  338. var colorImg = switchColorImg(dt.data.cartItems[i].cartColorId);
  339. total = total.toFixed(2); // 保留两位小数
  340. var productId = dt.data.cartItems[i].cartProductId;
  341. var colorId=dt.data.cartItems[i].cartColorId;
  342. var price = dt.data.cartItems[i].productPrice;
  343. var num = dt.data.cartItems[i].cartNum;
  344. if (dt.data.cartItems[i].productPrice / 100 == 3280) {
  345. liNote = liNote +
  346. "<li class='mui-table-view-cell mui-media'>" +
  347. "<a>" +
  348. "<span class='mui-media-object mui-pull-left wh-100'> <img src='" + dt.data.cartItems[i].colorImg + "'></span>" +
  349. "<div class='mui-media-body' style='padding: 5% 0;'>" +
  350. "<div class='wt-space gwc_tit'>" + dt.data.cartItems[i].productName + "</div>" +
  351. "<div><small class='mui-h6 mui-pull-right'>" + dt.data.cartItems[i].productColor + "x"+dt.data.cartItems[i].cartNum+"</small></div>"+
  352. "</div>" +
  353. "<div class='price_sp cl-gwc' id='product-" + productId + "' price='" + price + "'>¥" + total + "</div>"+
  354. "</a>" +
  355. "</li>";
  356. cNum = cNum + num ;
  357. showIs = true;
  358. } else {
  359. liNote = liNote +
  360. "<li class='mui-table-view-cell mui-media'>" +
  361. "<a>" +
  362. "<span class='mui-media-object mui-pull-left wh-100'> <img src='" + dt.data.cartItems[i].colorImg + "'></span>" +
  363. "<div class='mui-media-body' style='padding: 5% 0;'>" +
  364. "<div class='wt-space gwc_tit'>" + dt.data.cartItems[i].productName + "</div>" +
  365. "<div><small class='mui-h6 mui-pull-right'>" + dt.data.cartItems[i].productColor + "x"+dt.data.cartItems[i].cartNum+"</small></div>"+
  366. "</div>" +
  367. "<div class='price_sp cl-gwc' id='product-" + productId + "' price='" + price + "'>¥" + total + "</div>"+
  368. "</a>" +
  369. "</li>";
  370. }
  371. if(dt.data.cartItems[i].cartColorId==5 && dt.data.cartItems[i].cartProductId==38){
  372. accVipSub+=(100* dt.data.cartItems[i].cartNum);
  373. }
  374. }
  375. if (showIs){
  376. liNote = liNote +
  377. "<li class='mui-table-view-cell mui-media'>" +
  378. "<a>" +
  379. "<span class='mui-media-object mui-pull-left wh-100'> <img src='//w.iamberry.com/watero/common/images/uploadimages/image/20161202/2C83538AC3039E693358_20161202182946_8118.jpg'></span>" +
  380. "<div class='mui-media-body'>" +
  381. "<div class='wt-space gwc_tit'>" +
  382. '赠送' + "<span id='giveNum'>" + cNum + '</span>' + '套三年滤芯' +
  383. "<span class='price_sp cl-gwc mui-pull-right' id='product-39' price='39'>¥" + 0 + "</span></div>" +
  384. "<small class='gwc_pp'>颜色:" + '无' + "</small>" +
  385. "</div>" +
  386. "</a>" +
  387. "</li>"
  388. }
  389. $productListUl.empty();
  390. $productListUl.append(liNote);
  391. dt.data.userIntegral = dt.data.userIntegral - 1;
  392. // 保存数据
  393. meonyProportion = dt.data.meonyProportion; // 兑换比例
  394. payTotal = dt.data.payTotal; // 支付金额,单位分
  395. userIntegral = dt.data.userIntegral; // 用户可用积分
  396. cartIdStr = dt.data.cartId; // 购物车ID
  397. // 替换数据
  398. usePayMoney = accDiv(dt.data.payTotal, 100);
  399. $("#total").val(usePayMoney.toFixed(2) + " 元");
  400. $("#user-integral-span").html(dt.data.userIntegral);
  401. if(dt.data.userIsVip==2){
  402. $("#vip_price").text("- ¥"+(accVipSub).toFixed(2));
  403. $("#vipSub").show();
  404. usePayMoney-=accVipSub;
  405. }
  406. if(user38Interests==1){
  407. if(usePayMoney>=2000 && usePayMoney<3000){
  408. $("#user2000").show();
  409. $("#user3000").hide();
  410. $("#user-pay-money-span").html(usePayMoney + " 元");
  411. }else if(usePayMoney>=3000){
  412. $("#user-pay-money-span").html((usePayMoney-100) + " 元");
  413. $("#user2000,#user3000").show();
  414. }else{
  415. $("#user-pay-money-span").html(usePayMoney + " 元");
  416. $("#user2000,#user3000").hide();
  417. }
  418. }else{
  419. $("#user-pay-money-span").html(usePayMoney + " 元");
  420. }
  421. //默认自己拉出地址
  422. if(dt.data.addressInfo != undefined && dt.data.addressInfo != null) {
  423. $(".btn-add-address").hide();
  424. $("#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();
  425. //给微信参数赋值
  426. wechatAddr.status = true;
  427. wechatAddr.detailInfo = dt.data.addressInfo.salesAddressInfo;
  428. wechatAddr.userName = dt.data.addressInfo.salesAddressName;
  429. wechatAddr.userTel = dt.data.addressInfo.salesAddressTel;
  430. wechatAddr.postalCode = dt.data.addressInfo.salesAddressPostnum;
  431. }
  432. yhq_val = $("input[name=radio1]:checked").val();
  433. yhq_type = $("input[name=radio1]:checked").attr("yhq_type");
  434. if(yhq_val == undefined) {
  435. yhq_val = 0
  436. } else {
  437. if(yhq_type == 3){
  438. if(yhq_val > (usePayMoney - ipt_balance)) {
  439. $("input[name=radio1]:checked").removeAttr("checked");
  440. yhq_val = 0;
  441. mui.alert(' ', '当前优惠券不可用', function() {});
  442. }
  443. $("#yhq_name").html($("input[name=radio1]:checked").prev().html());
  444. $("#yhq_price").html("免费兑换1支T1或T2滤芯");
  445. $("#accSub,#accSub>div:first-child").show();
  446. console.log(yhq_val)
  447. if($(".dhq-last-add").length>0){
  448. yhq_val = 0;
  449. }
  450. console.log("998")
  451. if(user38Interests==1){
  452. if((usePayMoney - yhq_val - ipt_balance)>=2000 && (usePayMoney - yhq_val - ipt_balance)<3000){
  453. $("#user2000").show();
  454. $("#user3000").hide();
  455. $("#user-pay-money-span").html((usePayMoney - yhq_val - ipt_balance).toFixed(2) + " 元");
  456. }else if((usePayMoney - yhq_val - ipt_balance)>=3000){
  457. $("#user-pay-money-span").html((usePayMoney - yhq_val - ipt_balance-100).toFixed(2) + " 元");
  458. $("#user2000,#user3000").show();
  459. }else{
  460. $("#user-pay-money-span").html((usePayMoney - yhq_val - ipt_balance).toFixed(2) + " 元");
  461. $("#user2000,#user3000").hide();
  462. }
  463. }else{
  464. $("#user2000,#user3000").hide();
  465. $("#user-pay-money-span").html((usePayMoney - yhq_val - ipt_balance).toFixed(2) + " 元");
  466. }
  467. }
  468. }
  469. } else {
  470. mui.alert(dt.message);
  471. }
  472. },
  473. error: function(xhr, type, errorThrown) {
  474. errorfn(xhr);
  475. }
  476. });
  477. // 获取微信共享地址
  478. $(document).on('tap', '.btn-add-address,#user-address-div', function() {
  479. editAddrV1(
  480. function(res) {
  481. // 用户成功拉出地址
  482. var address = res.provinceName + "-" + res.cityName + "-" + res.countryName + "-" + res.detailInfo;
  483. wechatAddr.status = true;
  484. wechatAddr.detailInfo = address;
  485. wechatAddr.postalCode = res.postalCode;
  486. wechatAddr.userName = res.userName;
  487. wechatAddr.userTel = res.telNumber;
  488. wechatAddr.nationalCode = res.nationalCode;
  489. $(".btn-add-address").hide();
  490. $("#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();
  491. },
  492. function() {
  493. if($('#user-address-div').html() != null && $('#user-address-div').html() != '') {
  494. wechatAddr.status = true;
  495. } else {
  496. wechatAddr.status = false;
  497. // 用户取消拉出地址
  498. mui.alert("您没有选择收货地址!");
  499. }
  500. }
  501. );
  502. });
  503. // mui('body').on('tap', '#open-wechat-addres-a,#user-address-div', function() {
  504. // editAddrV1(
  505. // function(res) {
  506. // // 用户成功拉出地址
  507. // var address = res.provinceName + "-" + res.cityName + "-" + res.countryName + "-" + res.detailInfo;
  508. // wechatAddr.status = true;
  509. // wechatAddr.detailInfo = address;
  510. // wechatAddr.postalCode = res.postalCode;
  511. // wechatAddr.userName = res.userName;
  512. // wechatAddr.userTel = res.telNumber;
  513. // wechatAddr.nationalCode = res.nationalCode;
  514. //
  515. // $("#user-address-div").empty().append(
  516. // "收货人:" + wechatAddr.userName + "<span class='ml-5'>" + wechatAddr.userTel + "</span>" +
  517. // "<a>" +
  518. // "<p class='shipping_address wt-space'>" + wechatAddr.detailInfo + "<span class='mui-icon mui-icon-arrowright icon-r-c'></span></p>" +
  519. // "</a>");
  520. // $("#user-address-div").show();
  521. // $("#open-wechat-addres-a").hide();
  522. // },
  523. // function() {
  524. // if($('#user-address-div').html() != null && $('#user-address-div').html() != '') {
  525. // wechatAddr.status = true;
  526. // } else {
  527. // wechatAddr.status = false;
  528. // // 用户取消拉出地址
  529. // mui.alert("您没有选择收货地址!");
  530. // }
  531. // }
  532. // );
  533. //
  534. // });
  535. // 积分数量改变时
  536. mui('body').on('change', '#input-user-integral', function() {
  537. var inputUserIntegral = $("#input-user-integral").val();
  538. $.trim(inputUserIntegral);
  539. var r = /^[1-9]+\d*$/;
  540. if(!r.test(inputUserIntegral)) {
  541. $("#input-user-integral").val(userInputIntegral);
  542. return false;
  543. }
  544. inputUserIntegral = parseInt(inputUserIntegral);
  545. if(inputUserIntegral > userIntegral) {
  546. $("#input-user-integral").val(userInputIntegral);
  547. return false;
  548. }
  549. if((inputUserIntegral * meonyProportion) > payTotal) {
  550. $("#input-user-integral").val(userInputIntegral);
  551. return false;
  552. }
  553. // 置换数据
  554. userInputIntegral = inputUserIntegral;
  555. var temp = (userInputIntegral * meonyProportion / 100).toFixed(2);
  556. $("#integral-money-span").html(temp);
  557. temp = ((payTotal - (userInputIntegral * meonyProportion)) / 100).toFixed(2);
  558. $("#user-pay-money-span").html(temp);
  559. });
  560. // 去支付
  561. mui('body').on('tap', '.btn-weixin-pay', function() {
  562. //if($("#forward input[yhq_type=3]").prop("checked") && (((t1+all_t)==0 && t2<=2) || ((t2+all_t)==0 && t1<=2) || ((t1<=1 && t2==0) || (t1==0 && t2<=1)))){
  563. // if($(".dhq-last-add").is(":visible")){
  564. // console.log(exchangeColorId)
  565. // }
  566. // }
  567. var yhq_id = $("input[name=radio1]:checked").attr('id');
  568. if(yhq_id == undefined) {
  569. yhq_id = "";
  570. }
  571. var remark = $("#textarea").val();
  572. var pattern = new RegExp("[ `~!@#$^&*()=|{}':;'\\[\\]<>/?~!@#¥……&*()——|{}【】‘;:”“'、?]")
  573. if(remark != "") {
  574. $.trim(remark);
  575. if(pattern.test(remark)) {
  576. mui.alert("请不要输入中文、字母、数字以外的特殊字符!");
  577. return;
  578. }
  579. if(!(remark.length >= 0 && remark.length <= 100)) {
  580. mui.alert("备注字数长度在0-100之间!");
  581. return;
  582. }
  583. }
  584. if(wechatAddr.status) {
  585. if(isPay) {
  586. isPay = false; // 锁定请求按钮
  587. layer.open({
  588. type: 2,
  589. shadeClose: false,
  590. content: "正在请求加载订单信息..."
  591. }); // 调用加载弹出层
  592. /* 组装数据 */
  593. var dataArgs = {
  594. "orderAddressInfo": wechatAddr.detailInfo,
  595. "orderAddressPostNum": wechatAddr.postalCode,
  596. "orderAddressMoblie": wechatAddr.userTel,
  597. "orderAddressName": wechatAddr.userName,
  598. "cartIdStr": cartIdStr,
  599. "orderIntegralNum": userInputIntegral,
  600. "orderUserRemark": remark,
  601. "couponId": yhq_id,
  602. "balancePayAmount": accMul(ipt_balance, 100)
  603. };
  604. // if($("#forward input[yhq_type=3]").prop("checked") && (((t1+all_t)==0 && t2<=2) || ((t2+all_t)==0 && t1<=2) || ((t1<=1 && t2==0) || (t1==0 && t2<=1)))){
  605. if($(".dhq-last-add").is(":visible")){
  606. dataArgs["exchangeColorId"] = exchangeColorId;
  607. }
  608. // }
  609. $.ajax(base_path+'/order/pay', { // 提交订单,准备支付
  610. data: dataArgs,
  611. dataType: 'json',
  612. type: 'POST',
  613. timeout: 15000,
  614. xhrFields: {
  615. withCredentials: true
  616. },
  617. crossDomain: true,
  618. success: function(dt) {
  619. if (dt.isRedirect) {
  620. location.href = dt.redirectURL;
  621. } else {
  622. layer.closeAll();
  623. //mui.alert(dt.resultCode=="500");
  624. if(dt.resultCode == "500") {
  625. mui.alert(dt.message);
  626. isPay = true;
  627. return;
  628. };
  629. if(dt.data.info == "isOK") {
  630. mui.openWindow({
  631. url: domanUrl + base_path+"/order/paySuccess?orderId=" + dt.data.orderId + "&dates=" + new Date().getTime()
  632. });
  633. return;
  634. };
  635. if(dt.status) {
  636. var str = dt.data.info;
  637. var obj = JSON.parse("{" + str + "}");
  638. WeixinJSBridge.invoke('getBrandWCPayRequest', obj, function(res) {
  639. if(res.err_msg == 'get_brand_wcpay_request:ok') {
  640. var orderIds = {
  641. "orderId": dt.data.orderId
  642. };
  643. layer.open({
  644. type: 2,
  645. shadeClose: false,
  646. content: "正在请求加载订单信息..."
  647. }); // 调用加载弹出层
  648. var url = base_path+"/order/checkOrderPaySuccess";
  649. $.getJSON(url, {
  650. "s": new Date().getTime(),
  651. "orderId": dt.data.orderId
  652. }, function(data) {
  653. if(data.status == true) { // 支付成功
  654. window.location.href = base_path + "/order/paySuccess?orderId=" + orderIds.orderId + "&dates=" + new Date().getTime();
  655. } else {
  656. setTimeout("checkOrderStatus('" + dt.data.orderId + "')", 1000);
  657. }
  658. });
  659. } else {
  660. isPay = true;
  661. // mui.alert("对不起,支付失败!请稍后重试!" + dt.data.orderId + "支付失败!");
  662. window.location.href = "order_details.html?orderId=" + dt.data.orderId + "&dates=" + new Date().getTime(); // 前往订单详情
  663. }
  664. });
  665. } else {
  666. isPay = true;
  667. mui.alert(dt.message);
  668. window.location.href = "order_details.html?orderId=" + dt.data.orderId + "&dates=" + new Date().getTime(); // 前往订单详情
  669. }
  670. }
  671. },
  672. error: function(xhr, type, errorThrown) {
  673. isPay = true;
  674. layer.closeAll();
  675. mui.alert("您的网络异常,请刷新重试!");
  676. return;
  677. }
  678. });
  679. } else {
  680. mui.alert("正在请求支付中~~请稍后!");
  681. return;
  682. }
  683. } else {
  684. mui.alert("请选择收货地址!");
  685. return;
  686. }
  687. });
  688. //选择优惠券
  689. mui('body').on('tap', '.mui-popover-action li>a', function() {
  690. var a = this,
  691. parent;
  692. //根据点击按钮,反推当前是哪个actionsheet
  693. for(parent = a.parentNode; parent != document.body; parent = parent.parentNode) {
  694. if(parent.classList.contains('mui-popover-action')) {
  695. break;
  696. }
  697. }
  698. //关闭actionsheet
  699. mui('#' + parent.id).popover('toggle');
  700. yhq_val = $("input[name=radio1]:checked").val();
  701. yhq_type = $("input[name=radio1]:checked").attr("yhq_type");
  702. if(yhq_val == undefined) {
  703. yhq_val = 0
  704. } else {
  705. if(yhq_type == 1) {
  706. if(yhq_val > (usePayMoney - ipt_balance)) {
  707. $("input[name=radio1]:checked").removeAttr("checked");
  708. yhq_val = 0;
  709. mui.alert(' ', '当前优惠券不可用', function() {});
  710. }
  711. $("#yhq_name").html($("input[name=radio1]:checked").prev().html());
  712. $("#yhq_price").html("- ¥"+parseInt(yhq_val).toFixed(2));
  713. $("#accSub,#accSub>div:first-child").show();
  714. //$("#user-pay-money-span").html((usePayMoney -yhq_val- ipt_balance).toFixed(2));
  715. $(".dhq-last-add").hide();
  716. exchangeColorId='';
  717. }else if(yhq_type == 3){
  718. if(yhq_val > (usePayMoney - ipt_balance)) {
  719. $("input[name=radio1]:checked").removeAttr("checked");
  720. yhq_val = 0;
  721. mui.alert(' ', '当前优惠券不可用', function() {});
  722. }
  723. $("#yhq_name").html($("input[name=radio1]:checked").prev().html());
  724. $("#yhq_price").html("免费兑换1支T1或T2滤芯");
  725. $("#accSub,#accSub>div:first-child").show();
  726. $(".dhq-last-add").show();
  727. console.log(yhq_val)
  728. if($(".dhq-last-add").length>0){
  729. yhq_val = 0;
  730. }
  731. //$("#user-pay-money-span").html((usePayMoney -yhq_val- ipt_balance).toFixed(2));
  732. } else {
  733. yhq_val = accSub(usePayMoney, Math.floor(accMul($("input[name=radio1]:checked").val(), usePayMoney) * 100) / 100);
  734. $("#yhq_name").html($("input[name=radio1]:checked").prev().html());
  735. $("#yhq_price").html("- ¥"+yhq_val);
  736. $("#accSub,#accSub>div:first-child").show();
  737. //$("#user-pay-money-span").html((usePayMoney - yhq_val - ipt_balance).toFixed(2));
  738. $(".dhq-last-add").hide();
  739. exchangeColorId='';
  740. }
  741. if(user38Interests==1){
  742. if((usePayMoney - yhq_val - ipt_balance)>=2000 && (usePayMoney - yhq_val - ipt_balance)<3000){
  743. $("#user2000").show();
  744. $("#user3000").hide();
  745. $("#user-pay-money-span").html((usePayMoney - yhq_val - ipt_balance).toFixed(2) + " 元");
  746. }else if((usePayMoney - yhq_val - ipt_balance)>=3000){
  747. $("#user-pay-money-span").html((usePayMoney - yhq_val - ipt_balance-100).toFixed(2) + " 元");
  748. $("#user2000,#user3000").show();
  749. }else{
  750. $("#user2000,#user3000").hide();
  751. $("#user-pay-money-span").html((usePayMoney - yhq_val - ipt_balance).toFixed(2) + " 元");
  752. }
  753. }else{
  754. $("#user2000,#user3000").hide();
  755. $("#user-pay-money-span").html((usePayMoney - yhq_val - ipt_balance).toFixed(2) + " 元");
  756. }
  757. }
  758. });
  759. mui.os.ios ? listener_ipt() : keyup_fn();
  760. var reg = /^(([1-9]\d*))$/;
  761. function keyup_fn() {
  762. $('body').on('blur', '#pay_ipt', function(e) {
  763. ipt_balance = $(this).val();
  764. if(reg.test(ipt_balance)) {
  765. if(ipt_balance > (usePayMoney - yhq_val)) {
  766. ipt_balance = (usePayMoney - yhq_val).toFixed(2);
  767. if(ipt_balance < 0) {
  768. ipt_balance = 0;
  769. $(this).val("");
  770. } else {
  771. $(this).val((usePayMoney - yhq_val).toFixed(2));
  772. }
  773. }
  774. if(ipt_balance > used_balance) {
  775. ipt_balance = used_balance;
  776. $(this).val(used_balance);
  777. }
  778. $('#used_buy').html(ipt_balance);
  779. var money = (usePayMoney - yhq_val).toFixed(2);
  780. money <= 0 ? money = 0 : money;
  781. $("#accSub,#accSub>div:last-child").show();
  782. $("#user-pay-money-span").html((money - ipt_balance).toFixed(2) + " 元");
  783. } else {
  784. mui.alert(' ', '您输入的数字有误,请重新输入', function() {
  785. $(this).val("");
  786. ipt_balance = 0;
  787. $('#used_buy').html(ipt_balance);
  788. $("#user-pay-money-span").html((usePayMoney - yhq_val - ipt_balance).toFixed(2) + " 元");
  789. });
  790. }
  791. });
  792. }
  793. function listener_ipt() {
  794. document.getElementById('pay_ipt').onblur = function() {
  795. var th = this;
  796. ipt_balance = th.value;
  797. if(reg.test(ipt_balance)) {
  798. if(ipt_balance > (usePayMoney - yhq_val)) {
  799. ipt_balance = (usePayMoney - yhq_val).toFixed(2);
  800. if(ipt_balance < 0) {
  801. ipt_balance = 0;
  802. th.value = "";
  803. } else {
  804. th.value = (usePayMoney - yhq_val).toFixed(2);
  805. }
  806. }
  807. if(ipt_balance > used_balance) {
  808. th.value = used_balance;
  809. ipt_balance = used_balance;
  810. }
  811. $('#used_buy').html(ipt_balance);
  812. var money = (usePayMoney - yhq_val).toFixed(2);
  813. money <= 0 ? money = 0 : money;
  814. $("#accSub,#accSub>div:last-child").show();
  815. $("#user-pay-money-span").html((money - ipt_balance).toFixed(2) + " 元");
  816. } else {
  817. mui.alert(' ', '您输入的数字有误<br>请重新输入', function() {
  818. th.value = "";
  819. ipt_balance = 0;
  820. $('#used_buy').html(ipt_balance);
  821. $("#user-pay-money-span").html((usePayMoney - yhq_val - ipt_balance).toFixed(2) + " 元");
  822. });
  823. }
  824. }
  825. }
  826. document.querySelector('.loading-bg').style.display = 'none';
  827. });
  828. // 校验订单状态
  829. function checkOrderStatus(orderId) {
  830. var url = base_path + "/order/checkOrderPaySuccess";
  831. var order = {
  832. "s": new Date().getTime(),
  833. "orderId": orderId
  834. };
  835. $.getJSON(url, order, function(data) {
  836. if (dt.isRedirect) {
  837. location.href = dt.redirectURL;
  838. } else {
  839. if(data.status == true) { // 支付成功
  840. window.location.href = base_path + "/order/paySuccess?orderId=" + orderId + "&dates=" + new Date().getTime();
  841. } else {
  842. window.location.href = 'order_details.html?orderId=' + orderId + "&dates=" + new Date().getTime();;
  843. }
  844. }
  845. });
  846. }
  847. // 点击加号的事件
  848. function shoppAddEvent(productId,colorId) {
  849. $.ajax(base_path + '/cart/addCart', {
  850. data: {
  851. "productId": productId,
  852. "carNum": 1,
  853. "colorId":colorId
  854. },
  855. dataType: 'json',
  856. type: 'GET',
  857. timeout: 15000,
  858. xhrFields: {
  859. withCredentials: true
  860. },
  861. crossDomain: true,
  862. success: function(dt) {
  863. if (dt.isRedirect) {
  864. location.href = dt.redirectURL;
  865. } else {
  866. if(dt.status == true) {
  867. // 销售价
  868. var productObj = $("#product-" + productId);
  869. var price = parseInt(productObj.attr("price"));
  870. // total
  871. var total = payTotal + price;
  872. payTotal = total;
  873. // 修改数量
  874. var shoppNumObj = $("#shoppNum-" + productId);
  875. var num = parseInt(shoppNumObj.val());
  876. shoppNumObj.val(num + 1);
  877. /* $("#user-pay-money-span").html((payTotal / 100).toFixed(2)); */
  878. yhq_val = $("input[name=radio1]:checked").val();
  879. yhq_type = $("input[name=radio1]:checked").attr("yhq_type");
  880. usePayMoney = accDiv(payTotal, 100);
  881. if(yhq_val == undefined) {
  882. yhq_val = 0
  883. }
  884. if(yhq_type == 2) {
  885. yhq_val = accSub(usePayMoney, (Math.floor(accMul(yhq_val, usePayMoney) * 100) / 100));
  886. $("#yhq_price").html(accSub(usePayMoney, Math.floor(accMul($("input[name=radio1]:checked").val(), usePayMoney) * 100) / 100));
  887. }
  888. $("#user-pay-money-span").html((usePayMoney - yhq_val - ipt_balance).toFixed(2) + " 元");
  889. // 修改小计
  890. productObj.html("¥" + ((num + 1) * price / 100).toFixed(2));
  891. var temp = new Number($("#shoppNum-all").val());
  892. temp = temp + 3;
  893. $("#shoppNum-all").val(temp);
  894. if(showIs){
  895. var gNum = $("#giveNum").html();
  896. var rNum = parseInt(gNum) + 1;
  897. $("#giveNum").html(rNum);
  898. }
  899. } else {
  900. // 失败之后的事件
  901. mui.alert(dt.message);
  902. }
  903. }
  904. },
  905. error: function(xhr, type, errorThrown) {}
  906. });
  907. }
  908. // 购物车减
  909. function shoppSubEvent(productId,colorId) {
  910. var shoppNumObj = $("#shoppNum-" + productId);
  911. var num = parseInt(shoppNumObj.val());
  912. if(num <= 1) {
  913. mui.alert("不能继续减少了哦!");
  914. return;
  915. }
  916. $.ajax(base_path + '/cart/deleteCart', {
  917. data: {
  918. "productId": productId,
  919. "cartNum": 1,
  920. "colorId":colorId
  921. },
  922. dataType: 'json',
  923. type: 'GET',
  924. timeout: 15000,
  925. xhrFields: {
  926. withCredentials: true
  927. },
  928. crossDomain: true,
  929. success: function(dt) {
  930. if (dt.isRedirect) {
  931. location.href = dt.redirectURL;
  932. } else {
  933. if(dt.status == true) {
  934. // 销售价
  935. var productObj = $("#product-" + productId);
  936. var price = parseInt(productObj.attr("price"));
  937. // total
  938. var total = payTotal - price;
  939. payTotal = total;
  940. // 修改数量
  941. var shoppNumObj = $("#shoppNum-" + productId);
  942. var num = parseInt(shoppNumObj.val());
  943. shoppNumObj.val(num - 1);
  944. /*$("#user-pay-money-span").html((payTotal / 100).toFixed(2));*/
  945. yhq_val = $("input[name=radio1]:checked").val();
  946. yhq_type = $("input[name=radio1]:checked").attr("yhq_type");
  947. usePayMoney = accDiv(payTotal, 100);
  948. if(yhq_val == undefined) {
  949. yhq_val = 0
  950. }
  951. if(yhq_type == 2) {
  952. yhq_val = accSub(usePayMoney, Math.floor(accMul(yhq_val, usePayMoney) * 100) / 100);
  953. $("#yhq_price").html(accSub(usePayMoney, Math.floor(accMul($("input[name=radio1]:checked").val(), usePayMoney) * 100) / 100));
  954. if(ipt_balance > (usePayMoney - yhq_val)) {
  955. if((usePayMoney - yhq_val) <= 0) {
  956. ipt_balance = 0;
  957. $('#used_buy').html(ipt_balance);
  958. $('#pay_ipt').val("");
  959. } else {
  960. ipt_balance = (usePayMoney - yhq_val).toFixed(2);
  961. $('#used_buy').html(ipt_balance);
  962. $('#pay_ipt').val(ipt_balance);
  963. }
  964. }
  965. $("#user-pay-money-span").html((usePayMoney - yhq_val - ipt_balance).toFixed(2) + " 元");
  966. } else {
  967. if((usePayMoney - yhq_val) < ipt_balance) {
  968. if((usePayMoney - yhq_val) <= 0) {
  969. ipt_balance = 0;
  970. $('#used_buy').html(ipt_balance);
  971. $('#pay_ipt').val("");
  972. } else {
  973. ipt_balance = (usePayMoney - yhq_val).toFixed(2);
  974. $('#used_buy').html(ipt_balance);
  975. $('#pay_ipt').val(ipt_balance);
  976. }
  977. }
  978. if(yhq_val > (usePayMoney - ipt_balance)) {
  979. mui.alert(' ', '当前优惠券不可用', function() {
  980. $("input[name=radio1]:checked").removeAttr("checked");
  981. yhq_val = 0;
  982. $("#yhq_price").html(yhq_val);
  983. $("#user-pay-money-span").html((usePayMoney - yhq_val - ipt_balance).toFixed(2) + " 元");
  984. });
  985. }
  986. $("#user-pay-money-span").html((usePayMoney - yhq_val - ipt_balance).toFixed(2) + " 元");
  987. }
  988. var temp = new Number($("#shoppNum-all").val());
  989. temp = temp - 3;
  990. $("#shoppNum-all").val(temp+"")
  991. productObj.html("¥" + ((num - 1) * price / 100).toFixed(2));
  992. if(showIs){
  993. var gNum = $("#giveNum").html();
  994. var rNum = parseInt(gNum) - 1;
  995. $("#giveNum").html(rNum);
  996. }
  997. } else {
  998. mui.alert(dt.message);
  999. }
  1000. }
  1001. },
  1002. error: function(xhr, type, errorThrown) {
  1003. errorfn(xhr);
  1004. }
  1005. });
  1006. }
  1007. </script>
  1008. </body>
  1009. </html>