123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- var qs = parseQueryString(location.href),id,source;
- $().ready(function(){
- if(qs.id){id = qs.id}
- if(qs.source){source = qs.source}
- getProductListByCatId();
- })
- function getProductListByCatId () {
- $(".loading").show();
- $.ajax({
- url:'/user/product/getProductListByCatId',
- type:'post',
- dataType:'json',
- data:{
- id:id,
- source:source
- },
- success:function (res) {
- $(".loading").hide();
- if(res&&res.errno == 0){
- var listHtml = '',status = '';
- res.rst.data.forEach(function (item,index) {
- if(item.prod_title){
- status = '<div class="status">' + item.prod_title + '</div>'
- }
- listHtml += '<li class="shopListLi" data-link="' + item.link + '"><div class="shop_detail_01"><div class="left"><img src="' + item.icon + '"/><div class="shop_detail_left_con"><div class="name"><p>' + item.name + '</p>' + status + '</div><p class="shop_detail_left_con_hine">' + item.description + '</p></div></div><img class="arrow" src="./img/arrow.png"/></div><div class="shop_detail_02"><div><p>额度(元)</p><span>' + item.upper_amount + '-' + item.lower_amount + '</span></div><div><p>期限</p><span>' + item.term + '</span></div><p>' + item.applicants_ch + '人申请成功</p></div></li>'
- });
- $(".shopList").html(listHtml)
- $(".shopListLi").on('click',function () {
- window.location.href = $(this).attr('data-link')
- })
- }else{
- showMsg(res.err)
- }
- },
- error:function (err){
- console.log(err)
- $(".loading").hide();
- showMsg('请稍后再试!')
- }
- })
- }
- // 展示错误提示信息
- function showMsg(msg) {
- $(".alert-info").show();
- $(".alert-info p").text(msg);
- setTimeout(function() {
- $(".alert-info").hide();
- }, 1000);
- }
- //获取地址栏参数
- function parseQueryString(url) {
- var urlObj = {};
- var reg = /([^?=&]+)=([^?=&]+)/g;
- url.replace(reg, function($0, $1, $2) {
- urlObj[$1] = decodeURIComponent($2);
- })
- return urlObj;
- }
|