分类到商品页面修改-0714
parent
b7162acc09
commit
258c8f1f74
|
@ -106,9 +106,6 @@
|
||||||
methods: {
|
methods: {
|
||||||
// 获取用户信息
|
// 获取用户信息
|
||||||
getUserInfo(){
|
getUserInfo(){
|
||||||
uni.showLoading({
|
|
||||||
title: '加载中'
|
|
||||||
});
|
|
||||||
this.$requst.get('/api/user/info').then(res=>{
|
this.$requst.get('/api/user/info').then(res=>{
|
||||||
if(res.code==0) {
|
if(res.code==0) {
|
||||||
this.businessId = res.data.business_id;
|
this.businessId = res.data.business_id;
|
||||||
|
@ -149,6 +146,7 @@
|
||||||
this.$requst.get('/api/spu/business',{business_id:business_id}).then(res=>{
|
this.$requst.get('/api/spu/business',{business_id:business_id}).then(res=>{
|
||||||
if(res.code==0) {
|
if(res.code==0) {
|
||||||
this.companyList = res.data; //商户列表
|
this.companyList = res.data; //商户列表
|
||||||
|
console.log(this.companyList,11111)
|
||||||
// 查询一级分类
|
// 查询一级分类
|
||||||
if(this.companyList.length>0){
|
if(this.companyList.length>0){
|
||||||
this.getCateList(this.companyList[0].id);
|
this.getCateList(this.companyList[0].id);
|
||||||
|
@ -161,9 +159,12 @@
|
||||||
},
|
},
|
||||||
// 查询一级分类
|
// 查询一级分类
|
||||||
getCateList(pid){
|
getCateList(pid){
|
||||||
|
uni.showLoading({
|
||||||
|
title: '加载中'
|
||||||
|
});
|
||||||
this.$requst.get('/api/spu/category',{business_id:pid}).then(res=>{
|
this.$requst.get('/api/spu/category',{business_id:pid}).then(res=>{
|
||||||
if(res.code==0) {
|
if(res.code==0) {
|
||||||
uni.setStorageSync('businessId',this.businessId); //工厂id
|
// uni.setStorageSync('businessId',this.businessId); //工厂id
|
||||||
this.cateIndex = 0;
|
this.cateIndex = 0;
|
||||||
this.cateList = [];
|
this.cateList = [];
|
||||||
this.cateList = res.data; //一级分类
|
this.cateList = res.data; //一级分类
|
||||||
|
@ -183,7 +184,6 @@
|
||||||
// this.businessId = uni.getStorageSync('businessId'); //还原工厂id
|
// this.businessId = uni.getStorageSync('businessId'); //还原工厂id
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
uni.hideLoading();
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 查询二级分类
|
// 查询二级分类
|
||||||
|
@ -196,11 +196,12 @@
|
||||||
this.isTips = true;
|
this.isTips = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
uni.hideLoading();
|
||||||
},
|
},
|
||||||
// 跳转详情页
|
// 跳转详情页
|
||||||
toShop(id) {
|
toShop(id) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url:`/pagesA/shop/shop?category_id=${id}&business_id=${this.businessId}`
|
url:`/pagesA/shop/shop?category_id=${id}&company_id=${this.companyList[this.companyIndex].id}`
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -205,6 +205,8 @@
|
||||||
if(this.currentIndex !== index){
|
if(this.currentIndex !== index){
|
||||||
this.articleList = [];
|
this.articleList = [];
|
||||||
this.page = 1;
|
this.page = 1;
|
||||||
|
this.total = 0;
|
||||||
|
this.totalAll = -1;
|
||||||
this.currentIndex = index;
|
this.currentIndex = index;
|
||||||
this.articleNavId = id;
|
this.articleNavId = id;
|
||||||
// 获取文章列表
|
// 获取文章列表
|
||||||
|
|
|
@ -8,9 +8,9 @@
|
||||||
<text>{{sortList[sortIndex].name}}</text>
|
<text>{{sortList[sortIndex].name}}</text>
|
||||||
<image src="/static/public/icon-shop.png" mode="widthFix"></image>
|
<image src="/static/public/icon-shop.png" mode="widthFix"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="shop-cate flex" @tap.stop="openCate()">
|
<view class="shop-cate flex" @tap.stop="openCate()" v-if="cateList.length>0">
|
||||||
<text>{{cateList[cateIndex].title}}</text>
|
<text>{{cateList[cateIndex].title}}</text>
|
||||||
<image src="/static/public/icon-shop.png" mode=""></image>
|
<image src="/static/public/icon-shop.png" mode="widthFix"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="shop-sort-list flex" v-if="sortShow">
|
<view class="shop-sort-list flex" v-if="sortShow">
|
||||||
<view class="shop-sort-item" :class="sortIndex == index?'cur':''" @tap.stop="checkSort(index)" v-for="(item,index) in sortList" :key="index">{{item.name}}</view>
|
<view class="shop-sort-item" :class="sortIndex == index?'cur':''" @tap.stop="checkSort(index)" v-for="(item,index) in sortList" :key="index">{{item.name}}</view>
|
||||||
|
@ -57,7 +57,7 @@
|
||||||
flag:true,
|
flag:true,
|
||||||
ifLoading:false,
|
ifLoading:false,
|
||||||
category_id:'', //分类id
|
category_id:'', //分类id
|
||||||
business_id:'', //商户id
|
company_id:'', //商户id
|
||||||
sort:'new' ,//排序
|
sort:'new' ,//排序
|
||||||
page:1, //页数
|
page:1, //页数
|
||||||
size:10, //数量
|
size:10, //数量
|
||||||
|
@ -72,7 +72,7 @@
|
||||||
},
|
},
|
||||||
onLoad(op) {
|
onLoad(op) {
|
||||||
this.category_id = op.category_id;
|
this.category_id = op.category_id;
|
||||||
this.business_id = op.business_id;
|
this.company_id = op.company_id;
|
||||||
if(op.business_id){
|
if(op.business_id){
|
||||||
this.$requst.post('/api/index/change-business',{business_id:op.business_id}).then(res=>{
|
this.$requst.post('/api/index/change-business',{business_id:op.business_id}).then(res=>{
|
||||||
if(res.code == 0){
|
if(res.code == 0){
|
||||||
|
@ -148,15 +148,17 @@
|
||||||
getShopScreen(){
|
getShopScreen(){
|
||||||
let params = {
|
let params = {
|
||||||
category_id:this.category_id,
|
category_id:this.category_id,
|
||||||
business_id:this.business_id
|
business_id:this.company_id
|
||||||
}
|
}
|
||||||
this.$requst.post('/api/spu/condition',params).then(res=>{
|
this.$requst.post('/api/spu/condition',params).then(res=>{
|
||||||
if(res.code==0) {
|
if(res.code==0) {
|
||||||
this.sortList = res.data[0].children; //排序
|
this.sortList = res.data[0].children; //排序
|
||||||
this.cateList = res.data[1].children; //分类
|
this.cateList = res.data[1].children; //分类
|
||||||
for(let key in this.cateList){
|
if(this.cateList.length>0){
|
||||||
if(this.cateList[key].value == this.category_id){
|
for(let key in this.cateList){
|
||||||
this.cateIndex = key;
|
if(this.cateList[key].value == this.category_id){
|
||||||
|
this.cateIndex = key;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//查询商品列表
|
//查询商品列表
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -264,9 +264,6 @@ var _default = {
|
||||||
methods: {
|
methods: {
|
||||||
// 获取用户信息
|
// 获取用户信息
|
||||||
getUserInfo: function getUserInfo() {var _this2 = this;
|
getUserInfo: function getUserInfo() {var _this2 = this;
|
||||||
uni.showLoading({
|
|
||||||
title: '加载中' });
|
|
||||||
|
|
||||||
this.$requst.get('/api/user/info').then(function (res) {
|
this.$requst.get('/api/user/info').then(function (res) {
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
_this2.businessId = res.data.business_id;
|
_this2.businessId = res.data.business_id;
|
||||||
|
@ -307,6 +304,7 @@ var _default = {
|
||||||
this.$requst.get('/api/spu/business', { business_id: business_id }).then(function (res) {
|
this.$requst.get('/api/spu/business', { business_id: business_id }).then(function (res) {
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
_this3.companyList = res.data; //商户列表
|
_this3.companyList = res.data; //商户列表
|
||||||
|
console.log(_this3.companyList, 11111);
|
||||||
// 查询一级分类
|
// 查询一级分类
|
||||||
if (_this3.companyList.length > 0) {
|
if (_this3.companyList.length > 0) {
|
||||||
_this3.getCateList(_this3.companyList[0].id);
|
_this3.getCateList(_this3.companyList[0].id);
|
||||||
|
@ -319,9 +317,12 @@ var _default = {
|
||||||
},
|
},
|
||||||
// 查询一级分类
|
// 查询一级分类
|
||||||
getCateList: function getCateList(pid) {var _this4 = this;
|
getCateList: function getCateList(pid) {var _this4 = this;
|
||||||
|
uni.showLoading({
|
||||||
|
title: '加载中' });
|
||||||
|
|
||||||
this.$requst.get('/api/spu/category', { business_id: pid }).then(function (res) {
|
this.$requst.get('/api/spu/category', { business_id: pid }).then(function (res) {
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
uni.setStorageSync('businessId', _this4.businessId); //工厂id
|
// uni.setStorageSync('businessId',this.businessId); //工厂id
|
||||||
_this4.cateIndex = 0;
|
_this4.cateIndex = 0;
|
||||||
_this4.cateList = [];
|
_this4.cateList = [];
|
||||||
_this4.cateList = res.data; //一级分类
|
_this4.cateList = res.data; //一级分类
|
||||||
|
@ -341,7 +342,6 @@ var _default = {
|
||||||
// this.businessId = uni.getStorageSync('businessId'); //还原工厂id
|
// this.businessId = uni.getStorageSync('businessId'); //还原工厂id
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
uni.hideLoading();
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 查询二级分类
|
// 查询二级分类
|
||||||
|
@ -354,11 +354,12 @@ var _default = {
|
||||||
this.isTips = true;
|
this.isTips = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
uni.hideLoading();
|
||||||
},
|
},
|
||||||
// 跳转详情页
|
// 跳转详情页
|
||||||
toShop: function toShop(id) {
|
toShop: function toShop(id) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: "/pagesA/shop/shop?category_id=".concat(id, "&business_id=").concat(this.businessId) });
|
url: "/pagesA/shop/shop?category_id=".concat(id, "&company_id=").concat(this.companyList[this.companyIndex].id) });
|
||||||
|
|
||||||
} } };exports.default = _default;
|
} } };exports.default = _default;
|
||||||
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["default"]))
|
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["default"]))
|
||||||
|
|
|
@ -372,6 +372,8 @@ var _default = {
|
||||||
if (this.currentIndex !== index) {
|
if (this.currentIndex !== index) {
|
||||||
this.articleList = [];
|
this.articleList = [];
|
||||||
this.page = 1;
|
this.page = 1;
|
||||||
|
this.total = 0;
|
||||||
|
this.totalAll = -1;
|
||||||
this.currentIndex = index;
|
this.currentIndex = index;
|
||||||
this.articleNavId = id;
|
this.articleNavId = id;
|
||||||
// 获取文章列表
|
// 获取文章列表
|
||||||
|
|
|
@ -110,7 +110,7 @@ var _default = {
|
||||||
flag: true,
|
flag: true,
|
||||||
ifLoading: false,
|
ifLoading: false,
|
||||||
category_id: '', //分类id
|
category_id: '', //分类id
|
||||||
business_id: '', //商户id
|
company_id: '', //商户id
|
||||||
sort: 'new', //排序
|
sort: 'new', //排序
|
||||||
page: 1, //页数
|
page: 1, //页数
|
||||||
size: 10 }, _defineProperty(_ref, "total",
|
size: 10 }, _defineProperty(_ref, "total",
|
||||||
|
@ -125,7 +125,7 @@ var _default = {
|
||||||
|
|
||||||
onLoad: function onLoad(op) {var _this = this;
|
onLoad: function onLoad(op) {var _this = this;
|
||||||
this.category_id = op.category_id;
|
this.category_id = op.category_id;
|
||||||
this.business_id = op.business_id;
|
this.company_id = op.company_id;
|
||||||
if (op.business_id) {
|
if (op.business_id) {
|
||||||
this.$requst.post('/api/index/change-business', { business_id: op.business_id }).then(function (res) {
|
this.$requst.post('/api/index/change-business', { business_id: op.business_id }).then(function (res) {
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
|
@ -201,15 +201,17 @@ var _default = {
|
||||||
getShopScreen: function getShopScreen() {var _this2 = this;
|
getShopScreen: function getShopScreen() {var _this2 = this;
|
||||||
var params = {
|
var params = {
|
||||||
category_id: this.category_id,
|
category_id: this.category_id,
|
||||||
business_id: this.business_id };
|
business_id: this.company_id };
|
||||||
|
|
||||||
this.$requst.post('/api/spu/condition', params).then(function (res) {
|
this.$requst.post('/api/spu/condition', params).then(function (res) {
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
_this2.sortList = res.data[0].children; //排序
|
_this2.sortList = res.data[0].children; //排序
|
||||||
_this2.cateList = res.data[1].children; //分类
|
_this2.cateList = res.data[1].children; //分类
|
||||||
for (var key in _this2.cateList) {
|
if (_this2.cateList.length > 0) {
|
||||||
if (_this2.cateList[key].value == _this2.category_id) {
|
for (var key in _this2.cateList) {
|
||||||
_this2.cateIndex = key;
|
if (_this2.cateList[key].value == _this2.category_id) {
|
||||||
|
_this2.cateIndex = key;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//查询商品列表
|
//查询商品列表
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
<view><status-nav vue-id="637e050a-1" ifReturn="{{true}}" navBarTitle="商品列表" marginBottom="{{0}}" bind:__l="__l"></status-nav><block wx:if="{{sortShow||cateShow}}"><view data-event-opts="{{[['tap',[['closePullBg',['$event']]]]]}}" class="pull-all-bg" bindtap="__e"></view></block><view class="shop-nav flex" style="{{'top:'+(topHieght+'px')+';'}}"><view data-event-opts="{{[['tap',[['openSort']]]]}}" class="shop-sort flex" catchtap="__e"><text>{{sortList[sortIndex].name}}</text><image src="/static/public/icon-shop.png" mode="widthFix"></image></view><view data-event-opts="{{[['tap',[['openCate']]]]}}" class="shop-cate flex" catchtap="__e"><text>{{cateList[cateIndex].title}}</text><image src="/static/public/icon-shop.png" mode></image></view><block wx:if="{{sortShow}}"><view class="shop-sort-list flex"><block wx:for="{{sortList}}" wx:for-item="item" wx:for-index="index" wx:key="index"><view data-event-opts="{{[['tap',[['checkSort',[index]]]]]}}" class="{{['shop-sort-item',sortIndex==index?'cur':'']}}" catchtap="__e">{{item.name}}</view></block></view></block><block wx:if="{{cateShow}}"><view class="shop-cate-list flex"><block wx:for="{{cateList}}" wx:for-item="item" wx:for-index="index" wx:key="index"><view data-event-opts="{{[['tap',[['checkCate',[index]]]]]}}" class="{{['shop-cate-item',cateIndex==index?'cur':'']}}" catchtap="__e">{{item.title}}</view></block></view></block></view><scroll-view class="shop-bg" scroll-y="{{true}}"><view class="shop-ul flex"><block wx:for="{{shopList}}" wx:for-item="item" wx:for-index="index" wx:key="index"><view data-event-opts="{{[['tap',[['toDetail',['$0'],[[['shopList','',index,'id']]]]]]]}}" class="shop-li" bindtap="__e"><view class="img"><image src="{{item.imgsrc}}" mode="widthFix"></image></view><view class="txt clips2">{{item.title}}</view></view></block></view></scroll-view><block wx:if="{{totalAll==total}}"><view class="more-txt" style="padding-bottom:40rpx;">暂无更多内容</view></block></view>
|
<view><status-nav vue-id="637e050a-1" ifReturn="{{true}}" navBarTitle="商品列表" marginBottom="{{0}}" bind:__l="__l"></status-nav><block wx:if="{{sortShow||cateShow}}"><view data-event-opts="{{[['tap',[['closePullBg',['$event']]]]]}}" class="pull-all-bg" bindtap="__e"></view></block><view class="shop-nav flex" style="{{'top:'+(topHieght+'px')+';'}}"><view data-event-opts="{{[['tap',[['openSort']]]]}}" class="shop-sort flex" catchtap="__e"><text>{{sortList[sortIndex].name}}</text><image src="/static/public/icon-shop.png" mode="widthFix"></image></view><block wx:if="{{cateList.length>0}}"><view data-event-opts="{{[['tap',[['openCate']]]]}}" class="shop-cate flex" catchtap="__e"><text>{{cateList[cateIndex].title}}</text><image src="/static/public/icon-shop.png" mode="widthFix"></image></view></block><block wx:if="{{sortShow}}"><view class="shop-sort-list flex"><block wx:for="{{sortList}}" wx:for-item="item" wx:for-index="index" wx:key="index"><view data-event-opts="{{[['tap',[['checkSort',[index]]]]]}}" class="{{['shop-sort-item',sortIndex==index?'cur':'']}}" catchtap="__e">{{item.name}}</view></block></view></block><block wx:if="{{cateShow}}"><view class="shop-cate-list flex"><block wx:for="{{cateList}}" wx:for-item="item" wx:for-index="index" wx:key="index"><view data-event-opts="{{[['tap',[['checkCate',[index]]]]]}}" class="{{['shop-cate-item',cateIndex==index?'cur':'']}}" catchtap="__e">{{item.title}}</view></block></view></block></view><scroll-view class="shop-bg" scroll-y="{{true}}"><view class="shop-ul flex"><block wx:for="{{shopList}}" wx:for-item="item" wx:for-index="index" wx:key="index"><view data-event-opts="{{[['tap',[['toDetail',['$0'],[[['shopList','',index,'id']]]]]]]}}" class="shop-li" bindtap="__e"><view class="img"><image src="{{item.imgsrc}}" mode="widthFix"></image></view><view class="txt clips2">{{item.title}}</view></view></block></view></scroll-view><block wx:if="{{totalAll==total}}"><view class="more-txt" style="padding-bottom:40rpx;">暂无更多内容</view></block></view>
|
|
@ -35,7 +35,7 @@
|
||||||
},
|
},
|
||||||
"compileType": "miniprogram",
|
"compileType": "miniprogram",
|
||||||
"libVersion": "2.24.7",
|
"libVersion": "2.24.7",
|
||||||
"appid": "wxa02e44170bc722cd",
|
"appid": "wx2128cb0ee735d71a",
|
||||||
"projectname": "app适配微信小程序",
|
"projectname": "app适配微信小程序",
|
||||||
"condition": {
|
"condition": {
|
||||||
"search": {
|
"search": {
|
||||||
|
|
Loading…
Reference in New Issue