assist_bargain_coupon.html 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771
  1. <extend name="Public:pinduoduobase" />
  2. <block name="content">
  3. <link rel="stylesheet" href="__PUBLIC__/pin/assets/css/react_boot_30305e74e4b4d863454d94cab029e844.css">
  4. <link rel="stylesheet" href="__PUBLIC__/pin/assets/css/react_common_e1852e5ddc660dd79bef5eb49d18af1d.css">
  5. <link rel="stylesheet" href="__PUBLIC__/pin/assets/css/react_commercial_bargain_list_1e198f619d9fd08875d2f633992f363b.css">
  6. <script type="text/javascript" src="__PUBLIC__/js/scroll.js"></script>
  7. <style>
  8. .cb-banner{height:auto;}
  9. .cb-goods-list .cb-goods-item .goods-right button{
  10. background-color: #ff6699;
  11. }
  12. .cb-goods-list .cb-goods-item .goods-right .detail .goods-price{
  13. color:#ff6699;
  14. }
  15. #ws-for-push{display:none;}
  16. </style>
  17. <div id="main">
  18. <section data-reactroot="" class="main-view container bg-white">
  19. <div id="bargain-goods-list" style="">
  20. <img class="cb-banner" <?php if(empty($free_ad_list['image'])){ ?> src="" <?php }else{?> src="/Uploads/image/<?php echo $free_ad_list['image'];?>"<?php } ?> alt="banner" />
  21. <?php if(!empty($success_order_list)){ ?>
  22. <div class="bargain-rolling-msg" style="">
  23. <ul>
  24. <?php $j=1;$i=0; foreach($success_order_list as $val){?>
  25. <li class="content stop-1<?php echo $i; ?>">
  26. <img class="avatar" src="<?php echo $val['avatar']; ?>" />
  27. <p class="label"><?php echo $val['uname']; ?>砍价成功啦,0元拿了<?php echo $val['goods_name']; ?></p>
  28. </li>
  29. <?php $j++;$i++;if($i>1)$i=1;} ?>
  30. </ul>
  31. </div>
  32. <style>
  33. .bargain-rolling-msg{height:40px;}
  34. .bargain-rolling-msg .content{position:relative}
  35. .bargain-rolling-msg .content{
  36. width:100%;
  37. height:40px;padding:11px 0 0 12px;
  38. overflow:hidden;
  39. white-space:nowrap;left:0}
  40. </style>
  41. <script>
  42. $(function(){
  43. $('.bargain-rolling-msg').myScroll({
  44. speed: 2000, //数值越大,速度越慢
  45. rowHeight: 40 //li的高度
  46. });
  47. });
  48. </script>
  49. <?php } ?>
  50. <ul class="cb-goods-list" id="tuan_list">
  51. <?php foreach($list as $goods){ ?>
  52. <li class="cb-goods-item item-0" >
  53. <img class="scrollLoading" src="{$fan_ly_image}" data-echo="__UPLOAD__/<?php echo $goods['image']; ?>" alt="goods" />
  54. <div class="goods-right">
  55. <p class="goods-name"><?php echo $goods['name']; ?> </p>
  56. <div class="detail">
  57. <p class="sold-quantity"><?php echo $goods['seller_count']; ?>人已0元拿</p>
  58. <div class="goods-price">
  59. 原价
  60. <i><?php echo $goods['price']; ?></i>元
  61. </div>
  62. </div>
  63. <button class="button" onclick="get_free_coup(this)" data-goods-id="<?php echo $goods['goods_id']; ?>">砍价0元得</button>
  64. </div>
  65. </li>
  66. <?php } ?>
  67. </ul>
  68. <section class="sku-selector-bg" id="sku_selector" style="display:none;">
  69. <div class="sku-selector-main-spec sku-selector-main sku-selector-main-show" id="sku_selector_html">
  70. <div class="sku-selector-container" style="display:none;">
  71. <div class="sku-selector-head">
  72. <img src="http://omsproductionimg.yangkeduo.com/images/2018-01-10/07b3a25e8155489dea7c1f0be3e3b603.jpeg@750w_1l_50Q">
  73. <div class="sku-selector-head-content">
  74. <div class="sku-selector-price">¥0 <span class="sku-selector-normal">¥339</span></div>
  75. <div class="sku-selector-desc">请选择 颜色 尺寸</div>
  76. </div>
  77. <div class="sku-selector-close-btn"></div>
  78. </div>
  79. <div id="sku-selector-body" style="overflow: hidden;">
  80. <div class="sku-specs">
  81. <span class="sku-specs-key">颜色</span>
  82. <div class="sku-spec-value-list">
  83. <span class="sku-spec-value">浪漫粉【终身保修】</span>
  84. <span class="sku-spec-value">淡雅蓝【终身保修】</span>
  85. <span class="sku-spec-value" >玫瑰金【终身保修】</span>
  86. <span class="sku-spec-value" >薄荷绿【终身保修】</span>
  87. <span class="sku-spec-value" >香槟色【终身保修】</span>
  88. <span class="sku-spec-value" >玫红色【终身保修】</span>
  89. <span class="sku-spec-value" >奢华银【终身保修】</span>
  90. </div>
  91. </div>
  92. <div class="sku-specs">
  93. <span class="sku-specs-key">尺寸</span>
  94. <div class="sku-spec-value-list">
  95. <span class="sku-spec-value" >20寸【扩展15%容量】</span>
  96. </div>
  97. </div>
  98. </div>
  99. <div class="sku-selector-bottom">确定</div>
  100. </div>
  101. </div>
  102. </section>
  103. </div>
  104. <div class="cb-tab">
  105. <div class="tab-item">
  106. <span class="icon-bargain active">砍价商品</span>
  107. </div>
  108. <div class="tab-item">
  109. <span class="icon-bargain-group " onclick="location.href='{:U('Subject/assist_bargain_coupon_me')}';">我的砍价</span>
  110. </div>
  111. <div class="tab-split"></div>
  112. </div>
  113. </section>
  114. </div>
  115. <div class="center" id="center_pullup" style="display:none;">
  116. <span><img class="img_rotate" src="__PUBLIC__/pin/assets/img/pull_loading_8eba142.png"/>
  117. </span><span class="orders_text"></span>
  118. </div>
  119. <div class="address-popup" id="address-popup" style="display:none;">
  120. <div class="address-popup-mask"></div>
  121. <div class="address-popup-content" id="address-popup-content" >
  122. <div class="address-popup-title">选择收货地址<i class="address-popup-title-close"></i></div>
  123. <ul class="address-popup-list" id="address-popup-list">
  124. </ul>
  125. </div>
  126. </div>
  127. <div id="m-addr-mask" avalonctrl="edit_address" style="display:none;">
  128. <div class="m-addr-main">
  129. <div class="m-addr-title">添加新收货地址</div>
  130. <div class="m-address-receiver">
  131. <input class="m-addr-name" id="name" placeholder="名字" type="text">
  132. <input class="m-addr-mobile" id="telephone" placeholder="电话" type="tel">
  133. </div>
  134. <div class="m-addr-region">
  135. <div class="m-addr-province">
  136. <select class="m-addr-select" id="areaprovince" data-duplex-changed="onProvinceEdited">
  137. <option value="0">选择省份</option>
  138. </select>
  139. </div>
  140. <div class="m-addr-city">
  141. <select class="m-addr-select" id="areacity" data-duplex-changed="onCityEdited">
  142. <option value="0">选择城市</option>
  143. <!--repeat757947232574--><!--repeat757947232574:end-->
  144. </select>
  145. </div>
  146. <div class="m-addr-district">
  147. <select class="m-addr-select" id="areadistrict" data-duplex-changed="onDistrictEdited">
  148. <option value="0">选择地区</option>
  149. <!--repeat749156095088--><!--repeat749156095088:end-->
  150. </select>
  151. </div>
  152. </div>
  153. <div class="m-addr-address">
  154. <input placeholder="请填写详细街道地址" id="addr_address" type="text">
  155. <input type="hidden" name="sub_address_id" id="sub_address_id" />
  156. </div>
  157. <div class="m-addr-save">保存</div>
  158. <div class="m-addr-close">
  159. <div class="ms-addr-close-icon"></div>
  160. </div>
  161. <!--ms-if-->
  162. </div>
  163. </div>
  164. <div class="">
  165. <style>
  166. .pin-spinner-2 {
  167. display: none;
  168. position: fixed;
  169. width: .66rem;
  170. height: .66rem;
  171. top: 35%;
  172. margin: 0 auto;
  173. left: 0;
  174. right: 0;
  175. z-index: 999999999;
  176. }
  177. .ps-inner-box {
  178. width: 100%;
  179. height: 100%;
  180. }
  181. .ps-rotate-img {
  182. width: .25rem;
  183. height: .25rem;
  184. margin: auto;
  185. left: 0;
  186. right: 0;
  187. top: 0;
  188. bottom: 0;
  189. animation: rotateImg 2.5s linear infinite;
  190. -webkit-animation: rotateImg 2.5s linear infinite;
  191. z-index: 9999999999;
  192. position: absolute;
  193. }
  194. .ps-rotate-msg {
  195. width: 100%;
  196. font-size: .15rem;
  197. text-align: center;
  198. /*height: 11px;*/
  199. color: #ffffff;
  200. position: relative;
  201. bottom: .12rem;
  202. }
  203. .spinner-background {
  204. width: 100%;
  205. height: 100%;
  206. position: fixed;
  207. top: 0;
  208. bottom: 0;
  209. left: 0;
  210. right: 0;
  211. z-index: 9999999999;
  212. }
  213. #ps-background {
  214. display: none;
  215. position: absolute;
  216. width: 100%;
  217. height: 100%;
  218. opacity: 0.8;
  219. background-color: #000;
  220. border-radius: .06rem;
  221. }
  222. .pin-spinner-wrapper-no-message {
  223. display: block;
  224. top: 50%;
  225. margin-top: -.65rem;
  226. width: .66rem;
  227. height: .66rem;
  228. }
  229. .pin-spinner-wrapper-no-message .ps-rotate-msg {
  230. display: none;
  231. bottom: 0;
  232. }
  233. .pin-spinner-wrapper-no-message .ps-rotate-img {
  234. width: .25rem;
  235. height: .25rem;
  236. bottom: 0;
  237. top: 0;
  238. }
  239. .pin-spinner-wrapper-message {
  240. display: block;
  241. top: 50%;
  242. margin-top: -.82rem;
  243. width: 1rem;
  244. height: 1rem;
  245. }
  246. .pin-spinner-wrapper-message .ps-rotate-msg {
  247. display: block;
  248. bottom: .32rem;
  249. }
  250. .pin-spinner-wrapper-message .ps-rotate-img {
  251. width: .39rem;
  252. height: .39rem;
  253. bottom: .43rem;
  254. top: .18rem;
  255. }
  256. @media only screen and (device-width: 375px) and (device-height: 812px) and (-webkit-device-pixel-ratio: 3) {
  257. .pin-spinner-wrapper-no-message {
  258. margin-top: -.82rem;
  259. }
  260. .pin-spinner-wrapper-message {
  261. margin-top: -.99rem;
  262. }
  263. }
  264. @keyframes rotateImg {
  265. 0% {
  266. transform: rotateZ(0deg);
  267. }
  268. 50% {
  269. transform: rotateZ(180deg);
  270. }
  271. 100% {
  272. transform: rotateZ(360deg);
  273. }
  274. }
  275. @-webkit-keyframes rotateImg {
  276. 0% {
  277. -webkit-transform: rotateZ(0deg);
  278. }
  279. 50% {
  280. -webkit-transform: rotateZ(180deg);
  281. }
  282. 100% {
  283. -webkit-transform: rotateZ(360deg);
  284. }
  285. }
  286. </style>
  287. <div id="pin-spinner" class="pin-spinner-2">
  288. <div id="ps-background"></div>
  289. <div class="ps-inner-box">
  290. <img id="imgInit" class="ps-rotate-img" src="data:image/png;base64,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">
  291. </div>
  292. <div id="msgInit" class="ps-rotate-msg"></div>
  293. </div>
  294. </div>
  295. <include file="Widget:pin_notify" />
  296. <include file="Public:foot_lazy" />
  297. <include file="Widget:pin_toast" />
  298. {~W('Share/common_bargain_index_share')}
  299. <style>
  300. .qrcode-share-title-0{
  301. line-height:36px;
  302. }
  303. .center {
  304. width: 170px;
  305. margin: 0 auto;
  306. text-align: center;
  307. }
  308. .img_rotate {
  309. width: 30px;
  310. height: 30px;
  311. margin-top: 7px;
  312. margin-right: 5px;
  313. -webkit-animation: loading 1s linear 0s infinite;
  314. }
  315. @-webkit-keyframes loading {
  316. 0% {
  317. -webkit-transform: rotate(0);
  318. }
  319. 100% {
  320. -webkit-transform: rotate(360deg);
  321. }
  322. }
  323. .orders_text {
  324. line-height: 45px;
  325. font-weight: 700;
  326. font-size: 15px;
  327. }
  328. .m-addr-main .m-addr-close:before{
  329. position: absolute;
  330. top: 3px;
  331. left: 10px;
  332. }
  333. </style>
  334. <script>
  335. var offset = 0;
  336. var _pa = 2;
  337. var is_can_next = 1;
  338. var cur_url = "{:U('Subject/assist_bargain_coupon')}";
  339. var req_step = 1;
  340. var goods_id = 0;
  341. var sku_arr_str = '';
  342. var address_id = 0;
  343. var need_optionc = [];
  344. var mult_sku_option = new Array();
  345. //$('.sku-specs').length
  346. var ajaxarea_url='{:U("/c_getarea")}';
  347. $(function(){
  348. //sku-spec-value-selected
  349. $('.sku-spec-value').on('click',function(){
  350. console.log(32);
  351. });
  352. $('.address-popup-title-close').click(function(){
  353. $('#address-popup').hide();
  354. })
  355. $('.add-btn').click(function(){
  356. })
  357. $("#areaprovince").change(function(){
  358. var areaId = $(this).val();
  359. if(areaId == 0){
  360. $('#areacity').html('<option value="0">选择城市</option>');
  361. $('#areadistrict').html('<option value="0">选择地区</option>')
  362. } else {
  363. $.post(ajaxarea_url,{'areaId':areaId},function(data){
  364. $('#areacity').html('<option value="0">选择城市</option>');
  365. $.each(data,function(no,items){
  366. $('#areacity').append('<option value="'+items.area_id+'">'+items.area_name+'</option>');
  367. });
  368. $('#areadistrict').html('<option value="0">选择地区</option>');
  369. });
  370. }
  371. })
  372. $("#areacity").change(function(){
  373. var areaId = $(this).val();
  374. if(areaId == 0){
  375. $('#areadistrict').html('<option value="0">选择地区</option>')
  376. } else {
  377. $.post(ajaxarea_url,{'areaId':areaId},function(data){
  378. $('#areadistrict').html('<option value="0">选择地区</option>');
  379. $.each(data,function(no,items){
  380. $('#areadistrict').append('<option value="'+items.area_id+'">'+items.area_name+'</option>');
  381. });
  382. });
  383. }
  384. })
  385. $('.m-addr-save').on('click',function(){
  386. var name = $('#name').val();
  387. var m_addr_mobile = $('.m-addr-mobile').val();
  388. var areaprovince = $('#areaprovince').val();
  389. var areaprovince_html = $('#areaprovince').find("option:selected").text();
  390. var areacity = $('#areacity').val();
  391. var areacity_html = $('#areacity').find("option:selected").text();
  392. var areadistrict = $('#areadistrict').val();
  393. var areadistrict_html = $('#areadistrict').find("option:selected").text();
  394. var addr_address = $('#addr_address').val();
  395. if($.trim(name) == ''){
  396. showTip('请填写姓名');
  397. return false;
  398. }
  399. if($.trim(m_addr_mobile) == ''){
  400. showTip('请填写手机');
  401. return false;
  402. }
  403. if(!m_addr_mobile.match('^1[3|5|8|7][0-9]{9}$')){
  404. showTip('请输入正确的手机号码');
  405. return false;
  406. }
  407. if(areaprovince <= 0)
  408. {
  409. showTip('请选择省份');
  410. return false;
  411. }
  412. if(areacity <= 0)
  413. {
  414. showTip('请选择城市');
  415. return false;
  416. }
  417. if(areadistrict <= 0)
  418. {
  419. showTip('请选择地区');
  420. return false;
  421. }
  422. if($.trim(addr_address) == ''){
  423. showTip('请填写详细街道地址');
  424. return false;
  425. }
  426. var sub_address_id = $('#sub_address_id').val();
  427. var data_obj = {name:name,telephone:m_addr_mobile,is_default:0,province_id:areaprovince,city_id:areacity,country_id:areadistrict,address:addr_address};
  428. var edit_url = "{:U('User/edit_address')}";
  429. var add_url = "{:U('User/add_address')}";
  430. if(sub_address_id != '') {
  431. var ajaxaddress_add_url = edit_url;
  432. data_obj.address_id = sub_address_id;
  433. } else {
  434. var ajaxaddress_add_url = add_url;
  435. }
  436. $.ajax({
  437. url:ajaxaddress_add_url,
  438. type:'post',
  439. data:data_obj,
  440. dataType:'json',
  441. success:function(json){
  442. if(json.code == 1) {
  443. address_id = json.address_id;
  444. $('#m-addr-mask').hide();
  445. get_share_goods_qrcode();
  446. return false;
  447. } else {
  448. showTip(json.msg);
  449. return false;
  450. }
  451. }
  452. })
  453. })
  454. $('.m-addr-close').click(function(){
  455. $('#m-addr-mask').hide();
  456. })
  457. $('.afc-rules-button').click(function(){
  458. $('#jsalert-assist_free_coupon_rules1516799938453').show();
  459. })
  460. $('#assist-free-coupon-rules-alert').click(function(){
  461. $('#jsalert-assist_free_coupon_rules1516799938453').hide();
  462. })
  463. $('#qrcode-share').click(function(){
  464. $('#qrcode-share').hide();
  465. });
  466. $("#qrcode_share_img").click(function(event){
  467. event.stopPropagation();
  468. });
  469. $('#sku_selector').on('click', function(){
  470. $('#sku_selector').hide();
  471. })
  472. $('#sku_selector_html').on('click', function(){
  473. event.stopPropagation();
  474. })
  475. })
  476. function chose_address_detai(addr_id)
  477. {
  478. address_id = addr_id;
  479. $('#address-popup').hide();
  480. //获取二维码开始
  481. get_share_goods_qrcode();
  482. }
  483. ////获取二维码开始
  484. function get_share_goods_qrcode()
  485. {
  486. $('#pin-spinner').show();
  487. $.ajax({
  488. url:"{:U('Subject/get_user_goods_bargain')}",
  489. type:'post',
  490. data:{address_id:address_id,goods_id:goods_id,need_optionc:need_optionc},
  491. dataType:'json',
  492. success:function(ret)
  493. {
  494. console.log(ret);
  495. $('#pin-spinner').hide();
  496. if(ret.code ==0)
  497. {
  498. //location.href ="";
  499. //subject/assist_bargain_coupon_detail/id/5.html
  500. location.href = ret.gourl;
  501. return false;
  502. } else{
  503. showTip('当前有未完成的团');
  504. return false;
  505. }
  506. }
  507. })
  508. }
  509. function add_address()
  510. {
  511. $('#sub_address_id').val('');
  512. $('#address-popup').hide();
  513. $('.m-addr-title').html('添加收货地址');
  514. var areaId=0;
  515. $.post(ajaxarea_url,{'areaId':areaId},function(data){
  516. $('#areaprovince').html('<option value="0">选择省份</option>');
  517. $.each(data,function(no,items){
  518. $('#areaprovince').append('<option value="'+items.area_id+'">'+items.area_name+'</option>');
  519. });
  520. $('#m-addr-mask').show();
  521. });
  522. }
  523. function chose_sku_option(obj)
  524. {
  525. //console.log(obj);
  526. $(obj).siblings().removeClass('sku-spec-value-selected');
  527. $(obj).addClass('sku-spec-value-selected');
  528. var selected_sku_count = $('.sku-spec-value-selected').length;
  529. var total_sku_count = $('.sku-specs').length;
  530. if(selected_sku_count == total_sku_count)
  531. {
  532. var sku_arr = [];
  533. var sku_html_arr = [];
  534. var optionc = [];
  535. need_optionc = [];
  536. $('.sku-spec-value-selected').each(function(){
  537. sku_arr.push( $(this).attr('option_value_id') );
  538. sku_html_arr.push( $(this).html() );
  539. var tp_goods_option_id = $(this).attr('relgoods_option_id');
  540. var tp_relgoods_option_value_id = $(this).attr('relgoods_option_value_id');
  541. var s_gvi = tp_goods_option_id + '_' +tp_relgoods_option_value_id;
  542. optionc.push(s_gvi)
  543. })
  544. need_optionc = optionc;
  545. sku_arr_str = sku_arr.join('_');
  546. $('#sku-msg').html('已选择:'+ sku_html_arr.join('、'));
  547. $.ajax({
  548. url:"{:U('Subject/get_mult_sku')}",
  549. type:'get',
  550. data:{goods_id:goods_id,sku_arr_str:sku_arr_str},
  551. dataType:'json',
  552. success:function(ret){
  553. //console.log(ret);
  554. //array('code' => 0 , 'data' => $goods_option_mult_value_info)
  555. $('#sku-image').attr('src', ret.data.image);
  556. }
  557. })
  558. }
  559. }
  560. /**
  561. 下单,选择地址
  562. **/
  563. function chose_sku()
  564. {
  565. var selected_sku_count = $('.sku-spec-value-selected').length;
  566. var total_sku_count = $('.sku-specs').length;
  567. if(selected_sku_count != total_sku_count)
  568. {
  569. showTip('请选择规格');
  570. }else {
  571. $('#sku_selector').hide();
  572. chose_address();
  573. }
  574. }
  575. function chose_address()
  576. {
  577. $.ajax({
  578. url:"{:U('Subject/get_user_addresslist')}",
  579. type:'get',
  580. dataType:'json',
  581. success:function(ret){
  582. $('#address-popup-list').html(ret.html);
  583. $('#address-popup').show();
  584. }
  585. })
  586. }
  587. function close_sku()
  588. {
  589. $('#sku_selector').hide();
  590. }
  591. function get_free_coup(obj)
  592. {
  593. goods_id = $(obj).attr('data-goods-id');
  594. //get sku
  595. $.ajax({
  596. url:"{:U('Subject/get_option_sku')}",
  597. type:'get',
  598. data:{goods_id:goods_id},
  599. dataType:'json',
  600. success:function(res){
  601. console.log(res);
  602. if(res.code == 1)
  603. {
  604. //show option_html
  605. $('#sku_selector_html').html(res.html);
  606. $('#sku_selector').show();
  607. }else if(res.code ==0)
  608. {
  609. //show address
  610. sku_arr_str = '';
  611. chose_address();
  612. }
  613. else if(res.code == 3)
  614. {
  615. //img 当前有未完成的团
  616. showTip('当前有未完成的团');
  617. return false;
  618. }
  619. }
  620. })
  621. console.log(goods_id);
  622. }
  623. function loaddata()
  624. {
  625. var totalheight = parseFloat($(window).height()) + parseFloat($(window).scrollTop()); //浏览器的高度加上滚动条的高度
  626. if ($(document).height() <= totalheight+200) //当文档的高度小于或者等于总的高度的时候,开始动态加载数据
  627. {
  628. if(is_can_next == 1)//加载数据
  629. {
  630. is_can_next = 0;
  631. nextpage();
  632. }
  633. }
  634. }
  635. function nextpage()
  636. {
  637. $('#center_pullup').show();
  638. $.ajax(
  639. {
  640. url: cur_url,
  641. type:'post',
  642. data:{page:_pa},
  643. dataType: 'json',
  644. success: function(result){
  645. if(result.code == 1)
  646. {
  647. $('#tuan_list').append(result.html);
  648. $('#center_pullup').hide();
  649. _pa++;
  650. is_can_next = 1;
  651. bindImgEvent();
  652. } else if(result.code == 0) {
  653. $('#center_pullup').remove();
  654. }
  655. }
  656. }
  657. );
  658. }
  659. $(function(){
  660. $(window).scroll( function() {
  661. loaddata();
  662. });
  663. })
  664. </script>
  665. </block>