Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
groupPurchase-miniapp
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
彭佳妮(贵阳日报)
groupPurchase-miniapp
Commits
20e8a156
Commit
20e8a156
authored
Aug 09, 2024
by
张娇(东信)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
预售商品
parent
07fcc92b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
83 deletions
+20
-83
presale.vue
src/pages/assistingAgriculture/index/presale.vue
+20
-83
No files found.
src/pages/assistingAgriculture/index/presale.vue
View file @
20e8a156
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
<view
style=
"display: flex; flex-direction: row"
>
<view
style=
"display: flex; flex-direction: row"
>
<view
<view
class=
"borderClass"
class=
"borderClass"
@
tap=
"chooseTab(item.categoryId)"
@
tap=
"chooseTab(i
ndex, i
tem.categoryId)"
v-for=
"(item, index) in sortList"
v-for=
"(item, index) in sortList"
:key=
"index"
:key=
"index"
>
>
...
@@ -37,7 +37,7 @@
...
@@ -37,7 +37,7 @@
<view>
<view>
<scroll-view
class=
"tabs"
show-scrollbar=
"false"
scroll-x
:scroll-with-animation=
"true"
>
<scroll-view
class=
"tabs"
show-scrollbar=
"false"
scroll-x
:scroll-with-animation=
"true"
>
<text
<text
@
tap=
"cho
ice
(index, item.categoryId)"
@
tap=
"cho
oseBTab
(index, item.categoryId)"
v-for=
"(item, index) in tabsData"
v-for=
"(item, index) in tabsData"
:key=
"index"
:key=
"index"
class=
"text"
class=
"text"
...
@@ -138,62 +138,7 @@ const light = ref(0);
...
@@ -138,62 +138,7 @@ const light = ref(0);
const
sortList
=
ref
([]);
const
sortList
=
ref
([]);
const
tabsData
=
ref
([]);
const
tabsData
=
ref
([]);
const
buyList
=
ref
([]);
const
buyList
=
ref
([]);
const
sortDataList
=
ref
([]);
const
shopList
=
ref
([
{
img
:
'/static/assistingAgriculture/presale/img7.png'
,
price
:
'29.9'
,
text
:
'应季好物'
},
{
img
:
'/static/assistingAgriculture/presale/img7.png'
,
price
:
'29.9'
,
text
:
'应季好物'
},
{
img
:
'/static/assistingAgriculture/presale/img7.png'
,
price
:
'29.9'
,
text
:
'应季好物'
},
{
img
:
'/static/assistingAgriculture/presale/img7.png'
,
price
:
'29.9'
,
text
:
'应季好物'
},
{
img
:
'/static/assistingAgriculture/presale/img7.png'
,
price
:
'29.9'
,
text
:
'应季好物'
},
{
img
:
'/static/assistingAgriculture/presale/img7.png'
,
price
:
'29.9'
,
text
:
'应季好物'
},
]);
// 声明需要的数据
const
data
=
reactive
({
leftList
:
[],
// 左边列图片
rightList
:
[],
// 右边列图片
leftHeight
:
0
,
// 左边列高度
rightHeight
:
0
,
// 右边列高度
columnWidth
:
0
,
// 列宽度
});
// 总商品数据列表
// 总商品数据列表
const
goodList
=
ref
([
{
id
:
1
,
name
:
'这是一个商品'
,
image
:
'/static/assistingAgriculture/presale/buy.png'
,
introduction
:
'商品简介商品简介'
,
price
:
69.9
,
},
{
id
:
2
,
name
:
'商品二'
,
image
:
'/static/assistingAgriculture/presale/img7.png'
,
introduction
:
'商品简介商品简介'
,
price
:
69.9
,
},
{
id
:
3
,
name
:
'商品三'
,
image
:
'/static/assistingAgriculture/assets/fruit.png'
,
introduction
:
'商品简介商品简介'
,
price
:
69.9
,
},
{
id
:
4
,
name
:
'商品四'
,
image
:
'/static/assistingAgriculture/presale/buy.png'
,
introduction
:
'商品简介商品简介'
,
price
:
69.9
,
},
{
id
:
5
,
name
:
'商品五'
,
image
:
'/static/assistingAgriculture/presale/buy.png'
,
introduction
:
'商品简介商品简介'
,
price
:
69.9
,
},
]);
const
router
=
useRoute
();
const
router
=
useRoute
();
const
params
=
{
const
params
=
{
current
:
1
,
current
:
1
,
...
@@ -203,9 +148,8 @@ const params = {
...
@@ -203,9 +148,8 @@ const params = {
const
tabsList
=
ref
([]);
const
tabsList
=
ref
([]);
onMounted
(
async
()
=>
{
onMounted
(
async
()
=>
{
getPresale
();
getPresale
();
getPresaleProd
();
//
getPresaleProd();
presaleSortList
();
presaleSortList
();
chooseTab
(
'3287'
);
});
});
// 预售板块轮播图
// 预售板块轮播图
const
getPresale
=
()
=>
{
const
getPresale
=
()
=>
{
...
@@ -230,28 +174,38 @@ const presaleSortList = () => {
...
@@ -230,28 +174,38 @@ const presaleSortList = () => {
sortList
.
value
=
res
.
data
.
map
((
item
)
=>
{
sortList
.
value
=
res
.
data
.
map
((
item
)
=>
{
return
item
.
imgUrl
;
return
item
.
imgUrl
;
});
});
console
.
log
(
res
.
data
,
111
);
sortList
.
value
=
res
.
data
;
sortList
.
value
=
res
.
data
;
chooseTab
(
0
,
sortList
.
value
[
0
].
categoryId
);
});
});
};
};
const
chooseTab
=
(
index
)
=>
{
const
chooseTab
=
(
index
,
categoryId
)
=>
{
getStrictSelection
({
parentId
:
index
}).
then
((
res
)
=>
{
getStrictSelection
({
parentId
:
categoryId
}).
then
((
res
)
=>
{
res
.
data
.
forEach
((
item
,
index
)
=>
{
res
.
data
.
forEach
((
item
,
index
)
=>
{
item
.
imgUrl
=
import
.
meta
.
env
.
VITE_APP_IMG_URL
+
item
.
pic
;
item
.
imgUrl
=
import
.
meta
.
env
.
VITE_APP_IMG_URL
+
item
.
pic
;
});
});
tabsData
.
value
=
res
.
data
;
tabsData
.
value
=
res
.
data
;
chooseBTab
(
0
,
tabsData
.
value
[
0
].
categoryId
);
});
});
};
};
const
chooseBTab
=
(
index
,
categoryId
)
=>
{
// 筑农首页-分类查询商品列表
getPresaleProdList
({
current
:
1
,
size
:
10
,
categoryId
}).
then
((
res
)
=>
{
const
getPresaleProd
=
()
=>
{
getPresaleProdList
(
params
).
then
((
res
)
=>
{
res
.
data
.
records
.
forEach
((
item
)
=>
{
res
.
data
.
records
.
forEach
((
item
)
=>
{
item
.
img
=
import
.
meta
.
env
.
VITE_APP_IMG_URL
+
item
.
pic
;
item
.
img
=
import
.
meta
.
env
.
VITE_APP_IMG_URL
+
item
.
pic
;
});
});
buyList
.
value
=
res
.
data
.
records
;
buyList
.
value
=
res
.
data
.
records
;
});
});
light
.
value
=
index
;
};
};
// 筑农首页-分类查询商品列表
// const getPresaleProd = () => {
// getPresaleProdList(params).then((res) => {
// res.data.records.forEach((item) => {
// item.img = import.meta.env.VITE_APP_IMG_URL + item.pic;
// });
// buyList.value = res.data.records;
// });
// };
// 二级分类点击事件
// 二级分类点击事件
const
choice
=
(
index
,
categoryId
)
=>
{
const
choice
=
(
index
,
categoryId
)
=>
{
getPresaleProdList
({
current
:
1
,
size
:
10
,
categoryId
}).
then
((
res
)
=>
{
getPresaleProdList
({
current
:
1
,
size
:
10
,
categoryId
}).
then
((
res
)
=>
{
...
@@ -259,26 +213,9 @@ const choice = (index, categoryId) => {
...
@@ -259,26 +213,9 @@ const choice = (index, categoryId) => {
item
.
img
=
import
.
meta
.
env
.
VITE_APP_IMG_URL
+
item
.
pic
;
item
.
img
=
import
.
meta
.
env
.
VITE_APP_IMG_URL
+
item
.
pic
;
});
});
buyList
.
value
=
res
.
data
.
records
;
buyList
.
value
=
res
.
data
.
records
;
if
(
index
===
0
)
{
chooseTab
(
'3287'
);
choice
(
0
,
'3273'
);
}
});
});
light
.
value
=
index
;
light
.
value
=
index
;
};
};
// 左侧数据列表
const
LeftList
=
ref
([]);
// 右侧数据列表
const
RightList
=
ref
([]);
// 将商品信息列表分为左侧右侧两个部分
for
(
let
i
=
0
;
i
<
goodList
.
value
.
length
;
i
++
)
{
if
(
i
%
2
===
0
)
{
LeftList
.
value
.
push
(
goodList
.
value
[
i
]);
}
else
{
RightList
.
value
.
push
(
goodList
.
value
[
i
]);
}
}
// 点击商品 跳转详情
// 点击商品 跳转详情
function
ToDetail
(
id
)
{
function
ToDetail
(
id
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment