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
cc79079d
Commit
cc79079d
authored
Aug 09, 2024
by
石建新(贵阳日报)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
字典
parent
10bd6f5a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
72 additions
and
8 deletions
+72
-8
shop.js
src/api/assistingAgriculture/shop.js
+8
-0
index.vue
src/pages/assistingAgriculture/shop/index.vue
+63
-6
index.vue
src/pages/index/index.vue
+0
-1
signIn.js
src/utils/signIn.js
+1
-1
No files found.
src/api/assistingAgriculture/shop.js
View file @
cc79079d
...
...
@@ -16,3 +16,11 @@ export function searchProdPage(data) {
data
,
});
}
// 筑农首页-店铺购物车列表
export
function
sgyBasketlist
(
data
)
{
return
request
({
url
:
`/sgyrdd/sgyBasket/list`
,
method
:
'GET'
,
data
,
});
}
src/pages/assistingAgriculture/shop/index.vue
View file @
cc79079d
...
...
@@ -7,7 +7,7 @@
<view
class=
"top-bar"
>
<view
class=
"header"
>
分类
</view>
<view
class=
"search"
>
<wd-search
hide-cancel
placeholder=
"请输入要搜索的内容"
/>
<wd-search
@
search=
"searchFn"
hide-cancel
placeholder=
"请输入要搜索的内容"
/>
</view>
</view>
<view
class=
"content"
>
...
...
@@ -16,6 +16,7 @@
v-for=
"(v, i) in listOfDishCategories"
:key=
"i"
@
click=
"changeCate(v)"
@
clear=
"clearFn"
:class=
"
{ active: acitveNav == v.categoryId }"
>
{{
v
.
categoryName
}}
...
...
@@ -42,8 +43,6 @@
class=
"scroll-Y"
lower-threshold=
"50"
@
scrolltolower=
"scrolltolowerFn"
@
scrolltoupper=
"upper"
@
scroll=
"scroll"
>
<view
class=
"item"
v-for=
"(item, i) in prodList"
:key=
"i"
>
<view
class=
"image-wrap"
:class=
"
{ border: isPreSale }">
...
...
@@ -72,10 +71,11 @@
<span
class=
"unit"
>
/只
</span>
</view>
</view>
<view
class=
"add-shopping-cart"
>
<view
class=
"add-shopping-cart"
@
click=
"addShoppingCart(item)"
>
<img
src=
"/src/static/assistingAgriculture/shop/add.png"
alt=
""
/>
</view>
</view>
<wd-status-tip
v-if=
"prodList.length === 0"
image=
"content"
tip=
"暂无内容"
/>
</scroll-view>
</view>
</view>
...
...
@@ -83,7 +83,7 @@
</view>
<!-- 购物车悬浮按钮 -->
<view
class=
"cart-floating"
>
<wd-badge
modelValue=
"12
"
>
<wd-badge
:modelValue=
"addPurchase
"
>
<img
class=
"cart"
@
tap=
"toCart"
src=
"/static/assistingAgriculture/presale/cart.png"
/>
</wd-badge>
</view>
...
...
@@ -99,7 +99,8 @@
<
script
setup
>
import
{
ref
}
from
'vue'
;
import
{
shopCategoryByShop
,
searchProdPage
}
from
'@/api/assistingAgriculture/shop'
;
import
{
shopCategoryByShop
,
searchProdPage
,
sgyBasketlist
}
from
'@/api/assistingAgriculture/shop'
;
import
{
addOrder
}
from
'@/api/packageDetail'
;
const
format
=
ref
(
'DD-HH:mm:ss'
);
const
imgUrl
=
import
.
meta
.
env
.
VITE_APP_IMG_URL
;
const
currentShopId
=
ref
(
''
);
...
...
@@ -120,6 +121,7 @@ onLoad((options) => {
shopCategoryByShopFn
(
options
.
shopId
).
then
((
res
)
=>
{
searchProdPageFn
();
});
sgyBasketlistFn
();
});
const
shopCategoryByShopFn
=
(
shopId
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
...
...
@@ -134,8 +136,27 @@ const shopCategoryByShopFn = (shopId) => {
};
const
acitveNav
=
ref
(
1
);
const
searchFn
=
(
e
)
=>
{
const
{
value
}
=
e
;
params
.
value
.
prodName
=
value
;
refreshData
().
then
((
res
)
=>
{
searchProdPageFn
();
});
};
const
changeCate
=
(
item
)
=>
{
acitveNav
.
value
=
item
.
categoryId
;
params
.
value
.
shopCategoryId
=
item
.
categoryId
;
refreshData
().
then
((
res
)
=>
{
searchProdPageFn
();
});
};
const
refreshData
=
(
item
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
params
.
value
.
isEnd
=
false
;
params
.
value
.
current
=
1
;
prodList
.
value
=
[];
resolve
();
});
};
const
activeFilter
=
ref
(
false
);
function
toCart
()
{
...
...
@@ -144,10 +165,46 @@ function toCart() {
url
:
'/pages/assistingAgriculture/cart/cart'
,
});
}
const
sgyBasketlistFn
=
()
=>
{
const
query
=
{
shopId
:
currentShopId
.
value
,
shopType
:
'3'
,
};
sgyBasketlist
(
query
).
then
((
res
)
=>
{
if
(
res
.
code
===
0
)
{
res
.
data
.
forEach
((
shop
)
=>
{
addPurchase
.
value
+=
shop
.
prodInfos
.
length
;
});
}
});
};
const
scrolltolowerFn
=
()
=>
{
console
.
log
(
'触底了'
);
searchProdPageFn
();
};
function
clearFn
()
{
console
.
log
(
'111111111111111111111111'
);
params
.
value
.
prodName
=
''
;
searchProdPageFn
();
}
const
addPurchase
=
ref
(
0
);
const
addShoppingCart
=
(
item
)
=>
{
const
params
=
{
shopId
:
item
.
shopId
,
prodId
:
item
.
prodId
,
skuId
:
item
.
skuIds
,
shopType
:
'3'
,
basketCount
:
1
,
};
addOrder
(
params
).
then
((
res
)
=>
{
addPurchase
.
value
=
0
;
if
(
res
.
code
===
0
)
{
sgyBasketlistFn
();
}
});
};
const
searchProdPageFn
=
()
=>
{
if
(
params
.
value
.
isEnd
===
true
)
return
new
Promise
((
resolve
)
=>
{
...
...
src/pages/index/index.vue
View file @
cc79079d
...
...
@@ -242,7 +242,6 @@ onMounted(() => {
getCouponMainList
();
});
onPullDownRefresh
(()
=>
{
orderStatus
();
getClassification
();
rotatingBroadcast
();
nearbyFood
();
...
...
src/utils/signIn.js
View file @
cc79079d
...
...
@@ -28,7 +28,7 @@ export const signIn = () => {
export
const
orderStatus
=
()
=>
{
sgyOrderGetStatus
().
then
((
res
)
=>
{
if
(
res
.
code
===
0
)
{
setOrderDic
(
res
.
data
.
store
);
setOrderDic
(
res
.
data
);
}
});
};
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