|
@@ -1,7 +1,7 @@
|
|
|
var productList = new Vue({
|
|
|
el: "#productList",
|
|
|
data: {
|
|
|
- searchFlag: false,
|
|
|
+ // searchFlag: false,
|
|
|
listLoading: true,
|
|
|
requestFlag: true,
|
|
|
noMore: false,
|
|
@@ -11,9 +11,9 @@ var productList = new Vue({
|
|
|
keyword: "",
|
|
|
sortField: "",
|
|
|
sortType: 1, // 1降序,其他升序
|
|
|
- bid: "",
|
|
|
- sid: "",
|
|
|
- tid: ""
|
|
|
+ // bid: "",
|
|
|
+ // sid: "",
|
|
|
+ // tid: ""
|
|
|
},
|
|
|
classify: [],
|
|
|
listData: [], //priceflag 0公开价格 1不公开价格 2仅对会员机构公开,//userIdentity: 2-会员机构, 4-普通机构
|
|
@@ -103,37 +103,37 @@ var productList = new Vue({
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- getListByCategory: function (path, categoryId) {
|
|
|
- var _self = this;
|
|
|
- $.getJSON(spiServer+"/search/query/product/"+ path ,{
|
|
|
- id: categoryId,
|
|
|
- identity: GLOBAL_USER_IDENTITY,
|
|
|
- pageSize: this.params.size,
|
|
|
- pageNum: this.params.num,
|
|
|
- sortField: this.params.sortField,
|
|
|
- sortType: this.params.sortType
|
|
|
- }, function (r) {
|
|
|
- if (r.code === 0 && r.data) {
|
|
|
- var result = JSON.parse(r.data);
|
|
|
- _self.listRecord = result.total;
|
|
|
- var resultData = setSearchProductList(result.items, _self.userId, function(){
|
|
|
- _self.$forceUpdate();
|
|
|
- setTimeout(function(){
|
|
|
- // 图片懒加载
|
|
|
- $("img[data-original]").lazyload();
|
|
|
- },500);
|
|
|
- });
|
|
|
- if(isPC){
|
|
|
- _self.listData = resultData;
|
|
|
- }else{
|
|
|
- _self.listData = _self.listData.concat(resultData);
|
|
|
- }
|
|
|
- console.log(_self.listData)
|
|
|
- }
|
|
|
- _self.listLoading = false;
|
|
|
- _self.requestFlag = true;
|
|
|
- })
|
|
|
- }
|
|
|
+ // getListByCategory: function (path, categoryId) {
|
|
|
+ // var _self = this;
|
|
|
+ // $.getJSON(spiServer+"/search/query/product/"+ path ,{
|
|
|
+ // id: categoryId,
|
|
|
+ // identity: GLOBAL_USER_IDENTITY,
|
|
|
+ // pageSize: this.params.size,
|
|
|
+ // pageNum: this.params.num,
|
|
|
+ // sortField: this.params.sortField,
|
|
|
+ // sortType: this.params.sortType
|
|
|
+ // }, function (r) {
|
|
|
+ // if (r.code === 0 && r.data) {
|
|
|
+ // var result = JSON.parse(r.data);
|
|
|
+ // _self.listRecord = result.total;
|
|
|
+ // var resultData = setSearchProductList(result.items, _self.userId, function(){
|
|
|
+ // _self.$forceUpdate();
|
|
|
+ // setTimeout(function(){
|
|
|
+ // // 图片懒加载
|
|
|
+ // $("img[data-original]").lazyload();
|
|
|
+ // },500);
|
|
|
+ // });
|
|
|
+ // if(isPC){
|
|
|
+ // _self.listData = resultData;
|
|
|
+ // }else{
|
|
|
+ // _self.listData = _self.listData.concat(resultData);
|
|
|
+ // }
|
|
|
+ // console.log(_self.listData)
|
|
|
+ // }
|
|
|
+ // _self.listLoading = false;
|
|
|
+ // _self.requestFlag = true;
|
|
|
+ // })
|
|
|
+ // }
|
|
|
},
|
|
|
created: function () {
|
|
|
if(isPC){
|
|
@@ -150,7 +150,7 @@ var productList = new Vue({
|
|
|
$('#topSearch').find('.keyword').val(getUrlParam("keyword"));
|
|
|
this.params.sortField = getUrlParam("sortField") ? getUrlParam("sortField") : "";
|
|
|
this.params.sortType = getUrlParam("sortType") ? getUrlParam("sortType") * 1 : 1;
|
|
|
- this.searchFlag = (this.params.keyword !== "");
|
|
|
+ // this.searchFlag = (this.params.keyword !== "");
|
|
|
if(globalUserData){
|
|
|
this.userId = globalUserData.userId;
|
|
|
this.userIdentity = globalUserData.identity;
|
|
@@ -161,32 +161,35 @@ var productList = new Vue({
|
|
|
this.userId = JSON.parse(userInfo).userId;
|
|
|
this.shopID = JSON.parse(userInfo).shopId;
|
|
|
}
|
|
|
- if (this.searchFlag) {
|
|
|
- // 获取列表数据
|
|
|
- this.getListByKeyword();
|
|
|
- } else {
|
|
|
- // category=1000-1001-1005
|
|
|
- if (!getUrlParam("category")) {
|
|
|
- this.listLoading = false;
|
|
|
- return false;
|
|
|
- }
|
|
|
- var category = getUrlParam("category").split("-");
|
|
|
- this.params.bid = category[0];
|
|
|
- this.params.sid = category[1];
|
|
|
- this.params.tid = category[2];
|
|
|
- // 根据分类获取数据
|
|
|
- if (this.params.tid && this.params.tid>0) {
|
|
|
- this.getListByCategory("tinyType", this.params.tid);
|
|
|
- } else if (this.params.sid && this.params.sid>0){
|
|
|
- this.getListByCategory("smallType", this.params.sid);
|
|
|
- } else if (this.params.bid && this.params.bid>0) {
|
|
|
- this.getListByCategory("bigType", this.params.bid);
|
|
|
- } else {
|
|
|
- alertInfo("URL参数异常!", function(){
|
|
|
- window.location.href = "/";
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
+ // 获取列表数据
|
|
|
+ this.getListByKeyword();
|
|
|
+
|
|
|
+ // if (this.searchFlag) {
|
|
|
+ // // 获取列表数据
|
|
|
+ // this.getListByKeyword();
|
|
|
+ // } else {
|
|
|
+ // // category=1000-1001-1005
|
|
|
+ // if (!getUrlParam("category")) {
|
|
|
+ // this.listLoading = false;
|
|
|
+ // return false;
|
|
|
+ // }
|
|
|
+ // var category = getUrlParam("category").split("-");
|
|
|
+ // this.params.bid = category[0];
|
|
|
+ // this.params.sid = category[1];
|
|
|
+ // this.params.tid = category[2];
|
|
|
+ // // 根据分类获取数据
|
|
|
+ // if (this.params.tid && this.params.tid>0) {
|
|
|
+ // this.getListByCategory("tinyType", this.params.tid);
|
|
|
+ // } else if (this.params.sid && this.params.sid>0){
|
|
|
+ // this.getListByCategory("smallType", this.params.sid);
|
|
|
+ // } else if (this.params.bid && this.params.bid>0) {
|
|
|
+ // this.getListByCategory("bigType", this.params.bid);
|
|
|
+ // } else {
|
|
|
+ // alertInfo("URL参数异常!", function(){
|
|
|
+ // window.location.href = "/";
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // }
|
|
|
},
|
|
|
mounted: function () {
|
|
|
var _self = this;
|
|
@@ -204,19 +207,21 @@ var productList = new Vue({
|
|
|
if(next <= totalPage){
|
|
|
if (_self.requestFlag){
|
|
|
_self.params.num = next;
|
|
|
- if (_self.searchFlag) {
|
|
|
- // 获取列表数据
|
|
|
- _self.getListByKeyword();
|
|
|
- } else {
|
|
|
- // 根据分类获取数据
|
|
|
- if (_self.params.tid && _self.params.tid>0) {
|
|
|
- _self.getListByCategory("tinyType", _self.params.tid);
|
|
|
- } else if (_self.params.sid && _self.params.sid>0){
|
|
|
- _self.getListByCategory("smallType", _self.params.sid);
|
|
|
- } else if (_self.params.bid && _self.params.bid>0) {
|
|
|
- _self.getListByCategory("bigType", _self.params.bid);
|
|
|
- }
|
|
|
- }
|
|
|
+ // 获取列表数据
|
|
|
+ _self.getListByKeyword();
|
|
|
+ // if (_self.searchFlag) {
|
|
|
+ // // 获取列表数据
|
|
|
+ // _self.getListByKeyword();
|
|
|
+ // } else {
|
|
|
+ // // 根据分类获取数据
|
|
|
+ // if (_self.params.tid && _self.params.tid>0) {
|
|
|
+ // _self.getListByCategory("tinyType", _self.params.tid);
|
|
|
+ // } else if (_self.params.sid && _self.params.sid>0){
|
|
|
+ // _self.getListByCategory("smallType", _self.params.sid);
|
|
|
+ // } else if (_self.params.bid && _self.params.bid>0) {
|
|
|
+ // _self.getListByCategory("bigType", _self.params.bid);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
}
|
|
|
_self.requestFlag = false;
|
|
|
}else{
|