Commit 38b60c08 by 施宇

111

parent 3c2e6093
......@@ -48,7 +48,7 @@
<div class="search_div clr">
<div class="input_div fl">
<span class="icon iconfont iconjuxing"></span>
<input type="text" placeholder="请输入要搜索的内容">
<input type="text" placeholder="请输入要搜索的内容" class="search-input">
</div>
<div class="btn fl btn_60 btn_fz_18 input_btn bold btn_blue">
搜索
......
......@@ -15,7 +15,7 @@
<div class="search_div clr">
<div class="input_div fl">
<span class="icon iconfont iconjuxing"></span>
<input type="text" placeholder="请输入要搜索的内容">
<input type="text" placeholder="请输入要搜索的内容" class="input-search">
</div>
<div class="input_btn fl btn_48 btn bold btn_blue">
搜索
......@@ -33,19 +33,19 @@
<div class="zz condition_content">
<span class="bold">时间:</span>
<div class="condition_right_content clr">
<div class="fl active">今天</div>
<div class="fl">三天之内</div>
<div class="fl">本周</div>
<div class="fl jt">今天</div>
<div class="fl st">三天之内</div>
<div class="fl qt">七天之内</div>
</div>
</div>
<div class="fz condition_content ">
<!-- <div class="fz condition_content ">
<span class="bold">封装:</span>
<div class="condition_right_content clr">
<div class="fl">贸易商</div>
<div class="fl">贸易商</div>
<div class="fl">贸易商</div>
</div>
</div>
</div> -->
</div>
<div class="goods_data_list search_data_list">
</div>
......
......@@ -101,7 +101,7 @@
<div class="time fr ellipsis boxsiz">{{layui.util.toDateString(item.update_time * 1000)}}</div>
</div>
<a class="icon iconfont iconjuxing2 fr"></a>
{{# if(item['status/eq'] !== 1){ }}
{{# if(item['status'] == 1){ }}
{{# if(item['audit_status'] == 1){ }}
<a class="xj xj_status fr">下架</a>
{{# } else { }}
......
......@@ -13,7 +13,7 @@
<include file="public/top" />
<div class="right_content release_inquiry_content">
<div class="content">
<div class="nav_title">商品管理 > 发布商品 > 上传商品</div>
<div class="nav_title">询报价 > 发布询价</div>
<div class="inquiry_form">
<div class="top_title clr">
<h3 class="bold fl">发布询价</h3>
......
......@@ -17,7 +17,7 @@
<div class="search_div clr">
<div class="input_div fl">
<span class="icon iconfont iconjuxing"></span>
<input type="text" placeholder="请输入要搜索的内容">
<input type="text" placeholder="请输入要搜索的内容" class="input-search">
</div>
<div class="input_btn fl btn_48 btn bold btn_blue">
搜索
......@@ -29,25 +29,25 @@
</div>
<div class="search_condition">
<ul class="search_nav clr">
<li class="search_sp fl active">商品</li>
<li class="search_sp fl">商品</li>
<li class="search_xj fl">询价</li>
</ul>
<div class="zz condition_content">
<span class="bold">时间:</span>
<div class="condition_right_content clr">
<div class="fl active">今天 </div>
<div class="fl">三天之内</div>
<div class="fl">本周</div>
<div class="fl jt">今天 </div>
<div class="fl st">三天之内</div>
<div class="fl qt">七天之内</div>
</div>
</div>
<div class="fz condition_content ">
<!-- <div class="fz condition_content ">
<span class="bold">封装:</span>
<div class="condition_right_content clr">
<div class="fl">贸易商</div>
<div class="fl">贸易商</div>
<div class="fl">贸易商</div>
</div>
</div>
</div> -->
</div>
<div class="goods_data_list">
</div>
......
......@@ -550,6 +550,9 @@ body {
display: none;
}
}
.layui-icon {
display: none !important;
}
@font-face {
font-family: "iconfont";
src: url('../../fonts/iconfont.eot?t=1561691322757');
......@@ -846,4 +849,3 @@ body {
color: #ADB6BF;
cursor: pointer;
}
/*# sourceMappingURL=base.css.map */
\ No newline at end of file
......@@ -684,6 +684,9 @@ body {
display: none;
}
}
.layui-icon{
display: none !important;
}
// 字体样式
@import "./fonts.less";
......
......@@ -108,7 +108,7 @@
/***
* 询价上下架
*/
inquirysave: offer_url + "/inquiry/save",
inquirstatusysave: offer_url + "/inquiry/status/save",
/***
* 询价统计
*/
......
!function () {
! function () {
window.IcController = {
init: function () {
this.created(this).mounted(this).handleBind(this);
},
getData: function (url, type, param, callback, isload, isheader) {
//是否启动loadin效果
if (isload == undefined) {
var index = layer.load(1, {
offset: ['50%', "50%"],
shade: false
});
}
var platform = {
source: 2
};
var params = $.extend({}, platform, param);
//跨域模式切换 兼容
var dataTypeXpx = "json";
if ((navigator.userAgent.indexOf('MSIE') >= 0) && (navigator.userAgent.indexOf('Opera') < 0)) {
......@@ -33,7 +33,7 @@
},
});
}
$.ajax({
type: type,
url: url,
......@@ -43,136 +43,144 @@
withCredentials: true
},
success: function (data) {
//处理token失效的情况
if (data.errcode === 501 || data.err_code === 501) {
layer.msg('登录已失效,请重新登录', {time: 600}, function () {
layer.msg('登录已失效,请重新登录', {
time: 600
}, function () {
window.location.href = passport_url + '/login';
});
} else {
typeof callback == 'function' && callback(data);
layer.close(index);
}
return false;
},
error: function () {
layer.close(index);
layer.msg('网络出现问题,请重试!');
return false;
}
});
},
created: function (opt) {
if ($('#head_pic').length > 0) {
//获取用户信息
this.getData(apis.userInfo, 'GET', {token: Util.getCookie('token') || ''}, function (res) {
this.getData(apis.userInfo, 'GET', {
token: Util.getCookie('token') || ''
}, function (res) {
if (res.errcode === 0) {
//消息数量
$("#count_num").empty().html(res.data['msg_notification']);
//设置头像
if (res.data.avatar) {
$("#head_pic").find('img').attr('src', res.data['avatar']);
}
//首页
if ($(".user_home").length > 0) {
$(".user_home").find(".company").empty().html(res.data['company_name']);
$(".user_home").find(".tel").empty().html(res.data['mobile']);
$(".user_home").find(".last_login_time").empty().html(res.data['last_login_time']);
$(".user_home").find(".info_desc").children('p').empty().html('Hi,'+Util.getTimeState());
$(".user_home").find(".info_desc").children('p').empty().html('Hi,' + Util.getTimeState());
}
}
});
}
return this;
},
mounted: function (opt) {
//导航栏
var isShow = $('.xbj_li').find('dl').css('display');
if (isShow == 'none') {
$('.xbj_li').find('.li_right').removeClass('iconjuxing15').addClass('iconjuxing12');
} else {
$('.xbj_li').find('.li_right').removeClass('iconjuxing12').addClass('iconjuxing15');
}
return this;
},
handleBind: function (opt) {
//导航栏
$('.xbj_li').on('click', function () {
var isShow = $(this).find('dl').css('display');
if (isShow == 'none') {
$(this).find('dl').slideDown();
$('.xbj_li').find('.li_right').removeClass('iconjuxing12').addClass('iconjuxing15');
} else {
$(this).find('dl').slideUp();
$('.xbj_li').find('.li_right').removeClass('iconjuxing15').addClass('iconjuxing12');
}
});
//退出
$(".nav_end").on('click', function () {
layer.confirm('您确定退出系统嘛', {icon: 3, title: '提示', move: false}, function (index) {
layer.confirm('您确定退出系统嘛', {
icon: 3,
title: '提示',
move: false
}, function (index) {
opt.getData(apis.authLogout, 'POST', null, function (res) {
if (res.err_code === 0) {
Util.delCookie('token', cookieHostname);
window.location.href = index_url;
} else {
layer.msg(res.err_msg);
}
}, undefined, true);
layer.close(index);
})
});
return this;
},
}, $(function () {
......@@ -192,17 +200,17 @@
* @returns {boolean}
*/
setCookie: function (name, value, time, domain) {
domain = domain ? ";domain=" + domain : "";
var Days = time;
var exp = new Date();
exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000);
document.cookie = name + "=" + value + ";expires=" + exp.toGMTString() + ";path=/" + domain;
return true;
},
/**
......@@ -211,19 +219,19 @@
* @returns {*}
*/
getCookie: function (name) {
var strCookie = document.cookie;
var arrCookie = strCookie.split("; ");
for (var i = 0; i < arrCookie.length; i++) {
var arr = arrCookie[i].split("=");
if (name == arr[0]) {
return arr[1];
}
}
return "";
......@@ -233,17 +241,17 @@
* @param name
*/
delCookie: function (name, domain) {
domain = domain ? ";domain=" + domain : "";
var exp = new Date();
exp.setTime(exp.getTime() - 10000);
document.cookie = name + "=" + '' + ";expires=" + exp.toGMTString() + ";path=/" + domain;
return true;
},
/**
* 获取参数
......@@ -251,28 +259,28 @@
* @returns {*}
*/
getRequest: function (value) {
if (window.location.pathname == "/s/") {
var url = unescape(location.search);
} else {
var url = decodeURI(location.search);
}
var object = {};
if (url.indexOf("?") != -1) {
var str = url.substr(1);
var strs = str.split("&");
for (var i = 0; i < strs.length; i++) {
object[strs[i].split("=")[0]] = strs[i].split("=")[1];
}
}
return object[value];
......@@ -283,91 +291,128 @@
* @returns {string}
*/
getDateStr: function (val) {
var dd = new Date();
dd.setDate(dd.getDate() + val);
var y = dd.getFullYear();
var m = (dd.getMonth() + 1) < 10 ? "0" + (dd.getMonth() + 1) : (dd.getMonth() + 1);
var d = dd.getDate() < 10 ? "0" + dd.getDate() : dd.getDate();
return y + "-" + m + "-" + d;
},
/**
* 时间问候语
*/
getTimeState: function () {
var timeNow = new Date();
// 获取当前小时
var hours = timeNow.getHours();
// 设置默认文字
var text = '';
// 判断当前时间段
if (hours >= 0 && hours <= 10) {
text = '早上好';
} else if (hours > 10 && hours <= 14) {
text = '中午好';
} else if (hours > 14 && hours <= 18) {
text = '下午好';
} else if (hours > 18 && hours <= 24) {
text = '晚上好';
}
return text;
},
/**获取前几天的日期 */
getDay: function (day) {
var today = new Date();
var targetday_milliseconds = today.getTime() + 1000 * 60 * 60 * 24 * day;
today.setTime(targetday_milliseconds); //注意,这行是关键代码
var tYear = today.getFullYear();
var tMonth = today.getMonth();
var tDate = today.getDate();
tMonth = this.doHandleMonth(tMonth + 1);
tDate = this.doHandleMonth(tDate);
return tYear + "-" + tMonth + "-" + tDate + ' 00:00:00';
},
/**对月份进行处理 */
doHandleMonth: function (month) {
var m = month;
if (month.toString().length == 1) {
m = "0" + month;
52
}
return m;
}
};
if (typeof define === "function" && define.amd) {
return Util;
} else {
window.Util = Util;
}
})(window);
//form序列化json
$.fn.serializeJson = function () {
var serializeObj = {};
var array = this.serializeArray();
var str = this.serialize();
$(array).each(function () {
if (serializeObj[this.name]) {
if ($.isArray(serializeObj[this.name])) {
serializeObj[this.name].push(this.value);
} else {
serializeObj[this.name] = [serializeObj[this.name], this.value];
}
} else {
serializeObj[this.name] = this.value;
}
});
return serializeObj;
......
......@@ -72,7 +72,14 @@ $(function () {
$(this).addClass('active').siblings().removeClass('active')
});
$('.input_btn').click(function () {
window.location.href = "/search"
var key = $('.search-input').val();
if(key){
window.location.href = "/search?key="+key;
}else{
window.location.href = "/search"
}
});
$('.home_content').on('click', '.newXjIcon', function () {
window.location.href = "/roborder"
......
// $(function () {
// var indexSearch = {
// init: function () {
// this.bindFun();
// $('.search_sp').click();
// },
// getData: function (type) {
// var url = type==1?apis.goodsSearch:apis.inquirySearch;
// IcController.getData(url, 'GET', {
// "offset": 8,
// "p": 1,
// }, function (res) {
// var getTpl = "";
// if(type == 1){
// getTpl = sphtml.innerHTML
// }else{
// getTpl = xjhtml.innerHTML
// }
// if (res.errcode == 0) {
// $('.nav_title').find('span').text(res.total);
// var list = [];
// if(type == 1){
// list = res.goods_list
// }else{
// list = res.inquiry_list
// }
// layui.laytpl(getTpl).render(list, function (html) {
// $(".search_data_list").html(html);
// });
// } else if (res.errcode == 105001) {
// $('.nav_title').find('span').text(0)
// layui.laytpl(getTpl).render([], function (html) {
// $(".search_data_list").html(html);
// });
// }
// })
// },
// bindFun:function(){
// var self = this;
// $('.search_nav li').on('click',function(){
// var index = $(this).index();
// $(this).addClass('active').siblings().removeClass('active');
// $(".search_data_list").empty();
// $('.nav_title').find('span').text(0)
// if(index == 0){//商品
// self.getData(1)
// }else{//询价
// self.getData(2)
// }
// })
// }
// };
// indexSearch.init();
// })
$(function () {
var indexSearch = {
key: Util.getRequest('key') || "",
init: function () {
$('.input-search').val(this.key);
this.bindFun();
$('.search_sp').click();
$('.input_btn').click();
},
getData: function (type) {
var url = type==1?apis.goodsSearch:apis.inquirySearch;
getData: function (type, time) {
var self = this;
var url = type == 1 ? apis.goodsSearch : apis.inquirySearch;
IcController.getData(url, 'GET', {
"offset": 8,
"p": 1,
"goods_name/like": self.key,
"start_time": time
}, function (res) {
var getTpl = "";
if(type == 1){
if (type == 1) {
getTpl = sphtml.innerHTML
}else{
} else {
getTpl = xjhtml.innerHTML
}
if (res.errcode == 0) {
$('.nav_title').find('span').text(res.total);
$('.nav_title').find('span').text(res.total)
var list = [];
if(type == 1){
if (type == 1) {
list = res.goods_list
}else{
} else {
list = res.inquiry_list
}
layui.laytpl(getTpl).render(list, function (html) {
$(".search_data_list").html(html);
$(".goods_data_list").html(html);
});
} else if (res.errcode == 105001) {
} else if (res.errcode == type == 1 ? 105013 : 105001) {
$('.nav_title').find('span').text(0)
layui.laytpl(getTpl).render([], function (html) {
$(".search_data_list").html(html);
$(".goods_data_list").html(html);
});
}
})
},
bindFun:function(){
bindFun: function () {
var self = this;
$('.search_nav li').on('click',function(){
var index = $(this).index();
$('.search_nav li').on('click', function () {
$(this).addClass('active').siblings().removeClass('active');
$(".search_data_list").empty();
$('.nav_title').find('span').text(0)
if(index == 0){//商品
self.getData(1)
}else{//询价
self.getData(2)
$(".goods_data_list").empty();
$('.nav_title').find('span').text(0);
$('.jt').click();
});
$('.input_btn').on('click', function () {
self.key = $('.input-search').val();
$('.search_sp').click();
});
$('.zz').on('click', '.fl', function () {
var index = $(this).index();
var spOrXj = 1;
var time = new Date(Util.getDay(0));
$(this).addClass('active').siblings().removeClass('active');
if ($('.search_xj').hasClass('active')) {
spOrXj = 2
}
if (index == 0) {
self.getData(spOrXj, time.getTime() / 1000)
} else if (index == 1) {
time = new Date(Util.getDay(-3));
self.getData(spOrXj, time.getTime() / 1000)
} else {
time = new Date(Util.getDay(-7));
self.getData(spOrXj, time.getTime() / 1000)
}
})
}
......
......@@ -46,6 +46,7 @@ $(function () {
count: res.total,
limit: 7,
curr: page,
layout:['prev', 'page', 'next','refresh'],
jump: function (obj, first) {
if (!first) {
//分页回调调用
......@@ -97,7 +98,8 @@ $(function () {
},
sxj: function (id, type) {
//上下架 1上架 2下架
IcController.getData(apis.inquirysave, 'GET', {
var self = this;
IcController.getData(apis.inquirstatusysave, 'GET', {
"token": Util.getCookie('token') || "",
"inquiry_items_id": id,
"status": type
......@@ -106,7 +108,8 @@ $(function () {
layer.msg('操作成功', {
time: 600
}, function () {
console.log('操作成功')
self.getCount();
$('.layui-icon-refresh').click();
});
} else {
layer.msg('操作失败')
......@@ -158,7 +161,7 @@ $(function () {
inquiry.getData(inquiry.params, 1);
});
//上架
$('.inquiry_data').on('click', '.sj', function (e) {
$('.inquiry_data').on('click', '.fb', function (e) {
e.stopPropagation();
var userId = $(this).parent('.data_item').attr('userid');
if ($(this).hasClass('disabled')) {
......
$(function () {
var roborderObj = {
init: function () {
this.getData(1, 1);
this.bindFun();
},
getData: function (type, p) {
var self = this;
var params = {
"offset": 10,
"p": p,
};
if (type == 1) { //最新询价
params["add_time/order"] = "desc";
} else if (type == 2) { //今日询价
params["today"] = "1";
} else { //0回复询价
params["offer_num/eq"] = 0;
}
IcController.getData(apis.inquirySearch, 'GET', params,
function (res) {
var getTpl = zqTpl.innerHTML;
if (res.errcode === 0) {
$('#pagination').show();
layui.laytpl(getTpl).render(res.inquiry_list, function (html) {
$(".goods_data_list").empty().html(html);
layui.laypage.render({
elem: 'pagination',
theme: '#1080d0',
count: res.total,
limit: 10,
curr: p,
jump: function (obj, first) {
if (!first) {
//分页回调调用
self.getData(type, obj.curr)
}
}
});
});
} else {
layui.laytpl(getTpl).render([], function (html) {
$(".goods_data_list").empty().html(html);
$('#pagination').hide();
});
}
})
},
bindFun:function(){
var self = this;
$('.condition_content').find('.filter_span').on('click',function(){
var index = $(this).index();
$(this).addClass('active').siblings().removeClass('active');
$(".goods_data_list").empty();
$('#pagination').hide();
self.getData(index,1)
});
$('.roborder_content').on('click','.my_xj_item',function(){
var userid = $(this).attr('userid');
window.location.href = "/quotedetail?id=" + userid
});
//编辑
$('.edit_div').click(function () {
window.location.href = "/releaseinquiry"
});
}
};
roborderObj.init();
})
\ No newline at end of file
$(function () {
var search = {
key: Util.getRequest('key') || "",
init: function () {
$('.input-search').val(this.key);
this.bindFun();
$('.search_sp').click();
$('.input_btn').click();
},
getData: function (type, p) {
getData: function (type, p, time) {
var self = this;
var url = type == 1 ? apis.goodsSearch : apis.inquirySearch;
IcController.getData(url, 'GET', {
"offset": 10,
"p": p,
"goods_name/like": self.key,
"start_time": time
}, function (res) {
var getTpl = "";
if(type == 1){
if (type == 1) {
getTpl = sphtml.innerHTML
}else{
} else {
getTpl = xjhtml.innerHTML
}
if (res.errcode == 0) {
$('#pagination').show();
$('.nav_title').find('span').text(res.total)
var list = [];
if(type == 1){
if (type == 1) {
list = res.goods_list
}else{
} else {
list = res.inquiry_list
}
layui.laytpl(getTpl).render(list, function (html) {
......@@ -37,12 +41,12 @@ $(function () {
jump: function (obj, first) {
if (!first) {
//分页回调调用
self.getData(type, obj.curr)
self.getData(type, obj.curr, self.key, time)
}
}
});
});
} else if (res.errcode == 105001) {
} else if (res.errcode == type == 1 ? 105013 : 105001) {
$('.nav_title').find('span').text(0)
layui.laytpl(getTpl).render([], function (html) {
$(".goods_data_list").html(html);
......@@ -55,15 +59,32 @@ $(function () {
bindFun: function () {
var self = this;
$('.search_nav li').on('click', function () {
var index = $(this).index();
$(this).addClass('active').siblings().removeClass('active');
$(".goods_data_list").empty();
$('.nav_title').find('span').text(0);
$('#pagination').hide();
if (index == 0) { //商品
self.getData(1, 1)
} else { //询价
self.getData(2, 1)
$('.jt').click();
});
$('.input_btn').on('click', function () {
self.key = $('.input-search').val();
$('.search_sp').click();
});
$('.zz').on('click', '.fl', function () {
var index = $(this).index();
var spOrXj = 1;
var time = new Date(Util.getDay(0));
$(this).addClass('active').siblings().removeClass('active');
if ($('.search_xj').hasClass('active')) {
spOrXj = 2
}
if (index == 0) {
self.getData(spOrXj, 1,time.getTime() / 1000)
} else if (index == 1) {
time = new Date(Util.getDay(-3));
self.getData(spOrXj, 1,time.getTime() / 1000)
} else {
time = new Date(Util.getDay(-7));
self.getData(spOrXj, 1,time.getTime() / 1000)
}
})
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment