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
88382beb
Commit
88382beb
authored
Aug 06, 2024
by
陈宗胤(贵阳日报)
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gitlab.platform.xinhuaapp.com/pengjiani/groupPurchase-miniapp
parents
c1cf916e
d3e58237
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
455 additions
and
111 deletions
+455
-111
order.js
src/api/order.js
+8
-1
pages.json
src/pages.json
+11
-13
foodClassification.vue
src/pages/index/foodClassification.vue
+11
-7
detail.vue
src/pages/order/detail.vue
+34
-14
order.vue
src/pages/order/order.vue
+67
-16
refund.vue
src/pages/order/refund.vue
+32
-4
remark.vue
src/pages/order/remark.vue
+110
-37
detail.vue
src/pages/storeEntry/detail.vue
+108
-3
detail.vue
src/pages/ticket/detail.vue
+29
-9
ticket.vue
src/pages/ticket/ticket.vue
+45
-7
No files found.
src/api/order.js
View file @
88382beb
...
...
@@ -79,7 +79,14 @@ export function applyForARefundApi(data) {
data
,
});
}
// 新增订单评价
export
function
evaluation
(
data
)
{
return
request
({
url
:
'/sgyrdd/evaluation/eval'
,
method
:
'post'
,
data
,
});
}
export
function
afterSale
(
data
)
{
return
request
({
url
:
'/sgyrdd/sgyOrder/afterSales/getInfo'
,
...
...
src/pages.json
View file @
88382beb
...
...
@@ -30,13 +30,15 @@
{
"path"
:
"pages/index/foodClassification"
,
"style"
:
{
"navigationBarTitleText"
:
""
"navigationBarTitleText"
:
""
,
"enablePullDownRefresh"
:
true
}
},
{
"path"
:
"pages/order/order"
,
"style"
:
{
"navigationBarTitleText"
:
"订单列表"
"navigationBarTitleText"
:
"订单列表"
,
"enablePullDownRefresh"
:
true
}
},
{
...
...
@@ -66,7 +68,8 @@
{
"path"
:
"pages/ticket/ticket"
,
"style"
:
{
"navigationBarTitleText"
:
"我的券"
"navigationBarTitleText"
:
"我的券"
,
"enablePullDownRefresh"
:
true
}
},
{
...
...
@@ -92,37 +95,32 @@
"style"
:
{
"navigationBarTitleText"
:
"美食评论"
}
}
,
},
{
"path"
:
"pages/order/refund"
,
"style"
:
{
"navigationBarTitleText"
:
"申请退款"
}
}
,
},
{
"path"
:
"pages/index/coupon"
,
"style"
:
{
"navigationBarTitleText"
:
"优惠券详情"
,
"enablePullDownRefresh"
:
true
}
}
,
},
{
"path"
:
"pages/storeEntry/index"
,
"style"
:
{
"navigationBarTitleText"
:
"我的店铺"
}
}
,
},
{
"path"
:
"pages/storeEntry/detail"
,
"style"
:
{
"navigationBarTitleText"
:
"商家入驻"
}
}
,
},
{
"path"
:
"pages/order/afterSales"
,
"style"
:
{
...
...
src/pages/index/foodClassification.vue
View file @
88382beb
...
...
@@ -129,8 +129,8 @@ const params = ref({
size
:
15
,
// lon,
// lat,
lon
:
106.68650025025502
,
lat
:
26.567192352601154
,
lon
:
''
,
lat
:
''
,
isEnd
:
false
,
});
const
pics
=
ref
(
null
);
...
...
@@ -221,6 +221,13 @@ function refresh() {
resolve
();
});
}
onPullDownRefresh
(()
=>
{
refresh
().
then
(()
=>
{
getMerchantList
().
then
(()
=>
{
xma
.
stopPullDownRefresh
();
});
});
});
// 根据父级分类id查询子分类列表
const
query
=
(
parentId
)
=>
{
getByParentId
(
parentId
).
then
((
res
)
=>
{
...
...
@@ -237,6 +244,7 @@ function jumpProductDetails(prodId) {
}
const
prodSpecialFn
=
()
=>
{
prodSpecial
({
categoryId
:
categoryId
.
value
}).
then
((
res
)
=>
{
if
(
res
.
data
.
data
)
{
res
.
data
.
data
=
res
.
data
.
data
.
map
((
el
)
=>
{
if
(
el
.
labels
&&
el
.
labels
!==
''
)
{
el
.
labels
=
el
.
labels
.
split
(
','
);
...
...
@@ -244,6 +252,7 @@ const prodSpecialFn = () => {
return
el
;
});
topDiscountedProducts
.
value
=
res
.
data
.
data
;
}
});
};
const
choice
=
(
index
)
=>
{
...
...
@@ -295,13 +304,8 @@ const getMerchantList = () => {
item
.
labels
=
item
.
labels
.
split
(
','
);
}
});
return
new
Promise
((
resolve
)
=>
{
cardData
.
value
=
cardData
.
value
.
concat
(
res
.
data
.
content
);
xma
.
hideLoading
();
setTimeout
(()
=>
{
resolve
();
},
500
);
});
});
};
function
getLocationFn
()
{
...
...
src/pages/order/detail.vue
View file @
88382beb
...
...
@@ -19,7 +19,7 @@
></wd-icon>
<view
class=
"status-text"
>
{{
statusList
[
orderDetail
.
orderStore
.
status
]
}}
</view>
</view>
<view
class=
"detail"
v-if=
"orderDetail.orderStore.s
ubS
tatus == 3"
>
<view
class=
"detail"
v-if=
"orderDetail.orderStore.status == 3"
>
请在
{{
orderDetail
.
orderStore
.
receiverTime
.
slice
(
0
,
4
)
}}
年
{{
orderDetail
.
orderStore
.
receiverTime
.
slice
(
5
,
7
)
}}
月
{{
orderDetail
.
orderStore
.
receiverTime
.
slice
(
8
,
10
)
}}
前到店消费
...
...
@@ -54,7 +54,7 @@
<view
class=
"info-box"
>
<view
class=
"between"
v-if=
"orderDetail.orderStore.s
ubStatus == 2 || orderDetail.orderStore.subS
tatus == 3"
v-if=
"orderDetail.orderStore.s
tatus == 2 || orderDetail.orderStore.s
tatus == 3"
>
<view
class=
"column"
>
<text
class=
"title"
>
券码信息(1张可用)
</text>
...
...
@@ -68,17 +68,15 @@
<view
class=
"column"
>
<text
class=
"title1"
v-if=
"
orderDetail.orderStore.subStatus != 2 || orderDetail.orderStore.subStatus != 3
"
v-if=
"orderDetail.orderStore.status != 2 || orderDetail.orderStore.status != 3"
>
券码信息
</text>
<text
:class=
"
orderDetail.orderStore.s
ubS
tatus == 5 ||
orderDetail.orderStore.s
ubS
tatus == 6 ||
orderDetail.orderStore.s
ubS
tatus == 7
orderDetail.orderStore.status == 5 ||
orderDetail.orderStore.status == 6 ||
orderDetail.orderStore.status == 7
? 'linethrough'
: 'phone'
"
...
...
@@ -235,8 +233,8 @@ import { getOrderDetail, getShopDetail, getProdDetail } from '@/api/order';
import
{
getDistance
}
from
'@/utils/common'
;
onShow
(()
=>
{
// 获取位置
getLocationFn
();
// 获取位置
并计算距离
calculateDistance
();
});
// 当前位置的经纬度
...
...
@@ -313,6 +311,8 @@ const shopDetail = ref();
const
getShopMailDetail
=
async
(
id
)
=>
{
const
res
=
await
getShopDetail
({
shopId
:
id
});
shopDetail
.
value
=
res
.
data
.
shop
;
// 获取位置并计算距离
calculateDistance
();
};
const
maskPhoneNumber
=
(
phone
)
=>
{
...
...
@@ -320,18 +320,38 @@ const maskPhoneNumber = (phone) => {
};
function
getLocationFn
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
xma
.
getLocation
({
type
:
'wgs84'
,
isHighAccuracy
:
true
,
success
:
function
(
res
)
{
const
myLatitude
=
currentLatitudeAndLongitude
.
value
.
latitude
;
const
myLongitude
=
currentLatitudeAndLongitude
.
value
.
longitude
;
const
distance
=
getDistance
(
res
.
latitude
,
res
.
longitude
,
myLatitude
,
myLongitude
,
1
);
shopDetail
.
value
.
distance
=
distance
;
// 经纬度
console
.
log
(
'res.latitude, res.longitude'
,
res
.
latitude
,
res
.
longitude
);
resolve
({
lat
:
res
.
latitude
,
lon
:
res
.
longitude
});
},
fail
:
function
(
err
)
{
return
err
;
},
});
});
}
// 计算距离的函数封装
async
function
calculateDistance
()
{
try
{
const
res
=
await
getLocationFn
();
const
distance
=
getDistance
(
res
.
lat
,
res
.
lon
,
shopDetail
.
value
.
shopLat
,
shopDetail
.
value
.
shopLng
,
1
,
);
shopDetail
.
value
.
distance
=
distance
;
console
.
log
(
'distance'
,
distance
,
shopDetail
.
value
.
shopLat
,
shopDetail
.
value
.
shopLng
);
}
catch
(
error
)
{
console
.
error
(
'Error calculating distance:'
,
error
);
}
}
/**
...
...
src/pages/order/order.vue
View file @
88382beb
...
...
@@ -98,7 +98,19 @@
</view>
</view>
<wd-loadmore
:state=
"state"
@
reload=
"getList"
/>
<!--
<wd-loadmore
:state=
"state"
@
reload=
"getList"
/>
-->
<view
style=
"
width: 100%;
text-align: center;
font-size: 24rpx;
margin-top: 10rpx;
color: #888989;
"
v-if=
"isEnd"
>
没有更多啦~
</view>
</view>
<wd-status-tip
image=
"content"
tip=
"暂无内容"
v-else
/>
</wd-tab>
...
...
@@ -194,10 +206,18 @@ onShow(() => {
}
});
onPullDownRefresh
(()
=>
{
initDataList
().
then
(()
=>
{
getList
();
xma
.
stopPullDownRefresh
();
});
});
// 触底函数
onReachBottom
(()
=>
{
if
(
dataList
.
value
.
length
>=
total
.
value
)
{
state
.
value
=
'finished'
;
isEnd
.
value
=
true
;
// state.value = 'finished';
}
else
{
getList
();
}
...
...
@@ -208,7 +228,8 @@ onReachBottom(() => {
*/
const
total
=
ref
(
0
);
const
dataList
=
ref
([]);
const
state
=
ref
(
'loading'
);
// const state = ref('loading');
const
isEnd
=
ref
(
false
);
const
catalog
=
reactive
({
current
:
0
,
size
:
10
,
...
...
@@ -219,13 +240,21 @@ const catalog = reactive({
orderType
:
'store'
,
// 团购到店-store,外卖订单-takeaway,筑农物流logistics
});
const
getList
=
async
()
=>
{
if
(
isEnd
.
value
)
return
;
catalog
.
status
=
tab
.
value
;
if
(
tab
.
value
===
'all'
)
{
catalog
.
status
=
''
;
}
catalog
.
current
++
;
state
.
value
=
'loading'
;
// state.value = 'loading';
xma
.
showLoading
({
title
:
'加载中...'
,
mask
:
true
,
});
const
res
=
await
getOrderList
(
catalog
);
if
(
res
.
data
.
records
.
length
<
catalog
.
size
)
{
isEnd
.
value
=
true
;
}
if
(
res
.
data
.
records
.
length
>
0
)
{
res
.
data
.
records
.
forEach
((
item
)
=>
{
// 待付款倒计时计算
...
...
@@ -236,7 +265,8 @@ const getList = async () => {
dataList
.
value
.
push
(...
res
.
data
.
records
);
total
.
value
=
res
.
data
.
total
;
}
state
.
value
=
'finished'
;
// state.value = 'finished';
xma
.
hideLoading
();
};
/**
...
...
@@ -244,17 +274,22 @@ const getList = async () => {
*/
const
handleChange
=
(
e
)
=>
{
tab
.
value
=
e
.
name
;
initDataList
();
initDataList
().
then
(()
=>
{
getList
();
});
};
/**
* 刷新订单列表
*/
const
initDataList
=
()
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
dataList
.
value
=
[];
total
.
value
=
0
;
catalog
.
current
=
0
;
getList
();
isEnd
.
value
=
false
;
resolve
();
});
};
/**
...
...
@@ -262,17 +297,24 @@ const initDataList = () => {
* @param {*} orderNumber
*/
const
handleDelete
=
(
orderNumber
)
=>
{
uni
.
showModal
({
xma
.
showModal
({
title
:
'提示'
,
content
:
'确定要删除订单吗?'
,
success
:
async
(
res
)
=>
{
if
(
res
.
confirm
)
{
const
res
=
await
deleteOrderApi
(
orderNumber
);
uni
.
showToast
({
xma
.
showLoading
({
title
:
'删除中...'
,
mask
:
true
,
});
await
deleteOrderApi
(
orderNumber
);
xma
.
hideLoading
();
xma
.
showToast
({
title
:
'删除成功'
,
icon
:
'success'
,
});
initDataList
();
initDataList
().
then
(()
=>
{
getList
();
});
}
},
});
...
...
@@ -283,17 +325,24 @@ const handleDelete = (orderNumber) => {
* @param {*} orderNumber
*/
const
handleCancel
=
(
orderNumber
)
=>
{
uni
.
showModal
({
xma
.
showModal
({
title
:
'提示'
,
content
:
'确定要取消订单吗?'
,
success
:
async
(
res
)
=>
{
if
(
res
.
confirm
)
{
const
res
=
await
cancelOrderApi
({
orderNumber
});
uni
.
showToast
({
xma
.
showLoading
({
title
:
'取消中...'
,
mask
:
true
,
});
await
cancelOrderApi
({
orderNumber
});
xma
.
hideLoading
();
xma
.
showToast
({
title
:
'取消成功'
,
icon
:
'success'
,
});
initDataList
();
initDataList
().
then
(()
=>
{
getList
();
});
}
},
});
...
...
@@ -348,7 +397,9 @@ const calculateCountdown = (item) => {
*/
const
onFinish
=
async
(
orderNumber
)
=>
{
await
cancelOrderApi
({
orderNumber
});
initDataList
();
initDataList
().
then
(()
=>
{
getList
();
});
};
const
handleDetail
=
(
id
)
=>
{
...
...
src/pages/order/refund.vue
View file @
88382beb
...
...
@@ -42,6 +42,8 @@
image-mode=
"aspectFill"
:action=
"action"
@
change=
"handleChange"
:header=
"headers"
accept=
"image"
></wd-upload>
</view>
<view
class=
"content-between"
@
tap=
"showPop = true"
>
...
...
@@ -97,11 +99,18 @@
<
script
setup
>
import
Header
from
'@/pages/order/components/Header/index.vue'
;
import
{
applyForARefundApi
,
getOrderDetail
}
from
'@/api/order'
;
import
{
getToken
}
from
'@/utils/auth'
;
const
fileDomain
=
import
.
meta
.
env
.
VITE_APP_IMG_URL
;
const
token
=
getToken
();
// 上传图片地址
const
action
=
ref
(
import
.
meta
.
env
.
VITE_APP_BASE_URL
+
'/sgyrdd/file/update'
);
const
headers
=
ref
(
''
);
// 订单号
const
orderNumber
=
ref
(
''
);
onLoad
((
options
)
=>
{
orderNumber
.
value
=
options
.
orderNumber
;
headers
.
value
=
{
Authorization
:
'Bearer '
+
token
};
getDetail
();
});
...
...
@@ -114,11 +123,14 @@ const getDetail = async () => {
orderDetail
.
value
=
res
.
data
;
};
/**
* 获取图片列表
*/
// 上传文件地址
const
fileList
=
ref
([]);
const
action
=
ref
(
''
);
function
handleChange
({
fileList
:
files
})
{
console
.
log
(
files
);
fileList
.
value
=
files
;
console
.
log
(
fileList
.
value
);
}
const
showPop
=
ref
(
false
);
...
...
@@ -151,6 +163,9 @@ function radioChange(evt) {
selectType
.
value
=
value
;
}
/**
* 提交申请
*/
const
submit
=
async
()
=>
{
if
(
!
selectType
.
value
)
{
return
xma
.
showToast
({
...
...
@@ -171,8 +186,8 @@ const submit = async () => {
await
applyForARefundApi
({
orderNumber
:
orderNumber
.
value
,
refundMemo
:
selectType
.
value
===
4
?
otherReason
.
value
:
reasonList
.
value
[
selectType
.
value
].
name
,
imgs
:
fileList
.
value
.
map
((
item
)
=>
item
.
url
),
selectType
.
value
===
'4'
?
otherReason
.
value
:
reasonList
.
value
[
selectType
.
value
].
name
,
imgs
:
processingImageAddresses
(
),
});
setTimeout
(()
=>
{
xma
.
hideLoading
();
...
...
@@ -188,6 +203,19 @@ const submit = async () => {
},
1500
);
};
/**
* 图片地址处理
*/
const
processingImageAddresses
=
()
=>
{
const
data
=
fileList
.
value
.
map
((
item
)
=>
{
return
JSON
.
parse
(
item
.
response
).
data
.
url
;
});
return
data
.
join
(
','
);
};
/**
* 提交申请
*/
const
chooseReason
=
()
=>
{
if
(
!
selectType
.
value
)
{
return
xma
.
showToast
({
...
...
src/pages/order/remark.vue
View file @
88382beb
...
...
@@ -2,76 +2,132 @@
<view
class=
"container"
>
<Header
title=
"评论"
></Header>
<view
class=
"content"
>
<wd-form
ref=
"form"
:model=
"
model
"
:rules=
"rules"
class=
"remake"
>
<text
class=
"textarea"
>
老凯里酸汤鱼
</text>
<wd-form
ref=
"form"
:model=
"
formdata
"
:rules=
"rules"
class=
"remake"
>
<text
class=
"textarea"
>
{{
shopname
}}
</text>
<view
class=
"itemPicker"
>
<view
class=
"item01"
>
<text
class=
"label"
>
评分
</text>
<wd-rate
v-model=
"pinfen"
active-color=
"#ff0000"
size=
"50rpx"
space=
"10px"
/>
<wd-rate
prop=
"merchantServices"
v-model=
"formdata.merchantServices"
active-color=
"#ff0000"
size=
"50rpx"
space=
"10px"
@
change=
"handlemerchant"
/>
</view>
<view
class=
"item02"
>
<text>
非常满意
</text>
<text>
{{
merList
[
formdata
.
merchantServices
]
}}
</text>
</view>
</view>
<wd-textarea
v-model=
"pingjia"
placeholder=
"亲,分享您的看法,给其他人一个参考哦!"
/>
<wd-textarea
prop=
"evaluation"
v-model=
"formdata.evaluation"
placeholder=
"亲,分享您的看法,给其他人一个参考哦!"
:rules=
"[
{ required: true, message: '请填写你的评价' }]"
/>
<text
class=
"textarea"
>
上传图片/视频
</text>
<wd-upload
class=
"wdUpload"
accept=
"media"
multiple
:file-list=
"fileList"
:action=
"action"
@
change=
"handleChange"
:action=
"fileUPload"
@
change=
"handleFile"
></wd-upload>
<view
class=
"tuijian"
>
<!--
<view
class=
"tuijian"
v-if=
"show"
>
<view
class=
"tjTitle"
>
<text
class=
"textarea"
>
我要推荐菜
</text>
<text
class=
"textRight"
>
查看全部(30)
<i></i
>
<wd-icon
name=
"arrow-right"
></wd-icon
>
</text>
</view>
<view
class=
"itemtuijianList"
>
<wd-button
type=
"success"
plain
classPrefix=
"fish"
icon=
"kehuishouwu"
>
主要按钮
</wd-button>
</view>
</view>
<wd-cell
title=
"开启折扣"
title-width=
"100px"
prop=
"switchVal"
center
>
<view
style=
"text-align: left"
>
<wd-switch
v-model=
"mode.switchVal"
/>
<wd-checkbox-group
shape=
"button"
>
<wd-checkbox
modelValue=
"jingmai"
checked-color=
"#f00"
shape=
"button"
></wd-checkbox>
<wd-checkbox
modelValue=
"asd"
shape=
"button"
>
沃特
</wd-checkbox>
</wd-checkbox-group>
</view>
</view>
-->
<wd-cell
title=
"匿名评价"
prop=
"isAnonymous"
class=
"itemSwichval"
>
<wd-switch
size=
"48rpx"
active-color=
"#EC1B1B"
v-model=
"formdata.isAnonymous"
active-value=
"1"
inactive-value=
"0"
/>
</wd-cell>
</wd-form>
<wd-button
type=
"error"
block
>
发布
</wd-button>
<wd-button
type=
"error"
block
@
click=
"handleSubmit"
>
发布
</wd-button>
</view>
</view>
</
template
>
<
script
setup
lang=
"ts"
>
import
Header
from
'./components/Header/index.vue'
;
import
{
evaluation
}
from
'@/api/order'
;
const
form
=
ref
();
/**
* options
*/
const
shopname
=
ref
<
string
>
(
''
);
onLoad
((
options
)
=>
{
shopname
.
value
=
options
?.
shopName
;
formdata
.
orderNumber
=
options
?.
orderNumber
;
});
const
pinfen
=
ref
<
number
>
(
0
);
function
changeValue
({
pinfen
})
{
console
.
log
(
pinfen
);
}
const
pingjia
=
ref
<
string
>
(
''
);
const
formdata
=
reactive
<
{
orderNumber
:
string
;
evaluation
:
string
;
images
:
string
[];
isAnonymous
:
number
;
descriptionMatches
:
number
;
merchantServices
:
number
;
}
>
({
orderNumber
:
''
,
evaluation
:
''
,
images
:
[],
isAnonymous
:
0
,
descriptionMatches
:
0
,
merchantServices
:
0
,
});
const
action
=
ref
<
string
>
(
'/zhTuw2P8c29bc981a741931bdd86eb04dc1e8fd64865cb5/upload'
);
const
rules
=
{};
/**
* 显示推荐菜
*/
const
show
=
ref
<
boolean
>
(
false
);
/**
* 评分
*/
const
merchantServices
=
ref
<
number
>
(
0
);
const
merList
=
ref
({
1
:
'非常差'
,
2
:
'差'
,
3
:
'一般'
,
4
:
'好'
,
5
:
'非常好'
,
});
const
handlemerchant
=
(
e
)
=>
{
merchantServices
.
value
=
e
.
value
;
};
const
fileList
=
ref
([]);
/**
* 图片上传
*/
const
fileUPload
=
ref
<
string
>
(
'/'
);
function
handleChange
({
files
})
{
fileList
.
value
=
files
;
}
const
mode
=
reactive
<
{
switchVal
:
boolean
;
}
>
({
switchVal
:
true
,
});
function
handleFile
({
files
})
{}
const
handleSubmit
=
async
()
=>
{
const
res
=
await
evaluation
();
console
.
log
(
formdata
);
};
</
script
>
<
style
lang=
"scss"
scoped
>
.container
{
...
...
@@ -141,15 +197,32 @@ const mode = reactive<{
.tuijian
{
margin-top
:
72rpx
;
.tjTitle
{
display
:
flex
;
justify-content
:
space-between
;
align-items
:
center
;
margin-bottom
:
40rpx
;
.textRight
{
font-size
:
24rpx
;
}
}
}
.itemSwichval
{
width
:
auto
;
padding
:
0
;
margin-top
:
72rpx
;
:deep
(
.wd-cell__wrapper
)
{
padding
:
0
;
align-items
:
center
;
}
}
}
.wd-cel
{
--wot-size-side-padding
:
0px
;
}
</
style
>
src/pages/storeEntry/detail.vue
View file @
88382beb
...
...
@@ -96,17 +96,61 @@
class=
"img1"
></wd-upload>
</view>
<view
class=
"flex"
>
<view
class=
"logo"
>
店铺分类
</view>
<view
class=
"text"
@
click=
"showclass"
>
请选择
</view>
</view>
<wd-textarea
placeholder=
"请填写评价"
label=
"店铺介绍"
label-width=
"100px"
v-model=
"formData.szdq"
prop=
"szdq"
:no-border=
"false"
/>
<button
type=
"primary"
style=
"width: 80%"
>
提交
</button>
</wd-cell-group>
<wd-popup
v-model=
"show"
position=
"bottom"
custom-style=
"height:300px;overflow:auto;"
@
close=
"handleClose"
>
<view
class=
"hcontent"
>
<view
class=
"flex1"
>
<view
class=
"text"
>
取消
</view>
<view
class=
"text"
>
请选择
</view>
<view
class=
"text"
>
确定
</view>
</view>
<view
class=
"nr"
>
<view
class=
"left"
>
<view
class=
"name"
>
周边美食
</view>
<view
class=
"name"
>
周边美食
</view>
<view
class=
"name"
>
周边美食
</view>
<view
class=
"name"
>
周边美食
</view>
<view
class=
"name"
>
周边美食
</view>
<view
class=
"name"
>
周边美食
</view>
<view
class=
"name"
>
周边美食
</view>
<view
class=
"name"
>
周边美食
</view>
<view
class=
"name"
>
周边美食
</view>
<view
class=
"name"
>
周边美食
</view>
<view
class=
"name"
>
周边美食
</view>
<view
class=
"name"
>
周边美食
</view>
</view>
<view
class=
"right"
>
<view
class=
"item"
>
<view
class=
"hname"
>
生活用品
</view>
<view
class=
"hnr"
>
<wd-tag
round
>
标签
</wd-tag>
<wd-tag
round
>
标签
</wd-tag>
<wd-tag
round
>
标签
</wd-tag>
<wd-tag
round
>
标签
</wd-tag>
</view>
</view>
</view>
</view>
</view>
</wd-popup>
</wd-form>
</view>
</view>
...
...
@@ -125,11 +169,15 @@ const promotionlist = ref([
label
:
'连锁加盟'
,
},
]);
const
show
=
ref
(
false
);
const
fileList
=
ref
([
{
url
:
'1'
,
},
]);
const
showclass
=
()
=>
{
show
.
value
=
true
;
};
function
chooseImage
({
fileList
:
files
})
{
xma
.
chooseImage
({
...
...
@@ -175,8 +223,59 @@ const getLocationFn = () => {
<
style
lang=
"scss"
scoped
>
page
{
background
:
#f3f3f3
;
background
:
#fff
;
}
.uni-textarea-placeholder
,
.uni-textarea-line
,
.uni-textarea-compute
,
.uni-textarea-textarea
{
width
:
400rpx
;
height
:
220rpx
;
border
:
1px
solid
#d5d1d1
;
}
.wd-tag
{
margin-left
:
15rpx
;
}
.hcontent
{
height
:
100%
;
.flex1
{
padding
:
10px
;
display
:
flex
;
position
:
fixed
;
width
:
100%
;
justify-content
:
space-between
;
box-sizing
:
border-box
;
border-bottom
:
1px
solid
#ccc
;
background
:
#fff
;
z-index
:
6
;
}
.nr
{
padding-top
:
42px
;
display
:
flex
;
.left
{
background
:
#ebe7e7
;
width
:
33%
;
height
:
100%
;
overflow-y
:
auto
;
.name
{
text-align
:
center
;
height
:
40px
;
line-height
:
40px
;
}
}
.right
{
background
:
#fff
;
width
:
67%
;
.hname
{
font-size
:
14px
;
margin
:
15rpx
;
padding-bottom
:
10px
;
border-bottom
:
1px
solid
#ccc
;
}
}
}
}
.container
{
width
:
375
*
2rpx
;
margin
:
0
auto
;
...
...
@@ -196,6 +295,12 @@ page {
padding
:
var
(
--
wot-input-cell-padding
,
10px
)
var
(
--
wot-input-padding
,
var
(
--
wot-size-side-padding
,
15px
));
background-color
:
var
(
--
wot-input-cell-bg
,
var
(
--
wot-color-white
,
rgb
(
255
,
255
,
255
)));
.text
{
margin-left
:
16px
;
width
:
60%
;
font-size
:
var
(
--
wot-input-fs
,
var
(
--
wot-cell-title-fs
,
14px
));
color
:
var
(
--
wot-input-placeholder-color
,
#bfbfbf
);
}
.logo
{
position
:
relative
;
padding-left
:
12px
;
...
...
src/pages/ticket/detail.vue
View file @
88382beb
...
...
@@ -138,8 +138,8 @@ import Header from '@/pages/order/components/Header/index.vue';
const
fileDomain
=
import
.
meta
.
env
.
VITE_APP_IMG_URL
;
onShow
(()
=>
{
// 获取位置
getLocationFn
();
// 获取位置
并计算距离
calculateDistance
();
});
const
shopId
=
ref
();
...
...
@@ -224,6 +224,8 @@ const getShopMailDetail = async () => {
const
res
=
await
getShopDetail
({
shopId
:
shopId
.
value
});
if
(
res
.
code
===
0
)
{
shopDetail
.
value
=
res
.
data
.
shop
;
// 获取位置并计算距离
calculateDistance
();
}
};
...
...
@@ -248,22 +250,40 @@ function callShopPhone(phoneNumber) {
});
}
/**
* 获取定位
*/
// 获取定位
function
getLocationFn
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
xma
.
getLocation
({
type
:
'wgs84'
,
isHighAccuracy
:
true
,
success
:
function
(
res
)
{
const
myLatitude
=
shopDetail
.
value
.
shopLat
;
const
myLongitude
=
shopDetail
.
value
.
shopLng
;
const
distance
=
getDistance
(
res
.
latitude
,
res
.
longitude
,
myLatitude
,
myLongitude
,
1
);
shopDetail
.
value
.
distance
=
distance
;
// 经纬度
console
.
log
(
'res.latitude, res.longitude'
,
res
.
latitude
,
res
.
longitude
);
resolve
({
lat
:
res
.
latitude
,
lon
:
res
.
longitude
});
},
fail
:
function
(
err
)
{
return
err
;
},
});
});
}
// 计算距离的函数封装
async
function
calculateDistance
()
{
try
{
const
res
=
await
getLocationFn
();
const
distance
=
getDistance
(
res
.
lat
,
res
.
lon
,
shopDetail
.
value
.
shopLat
,
shopDetail
.
value
.
shopLng
,
1
,
);
shopDetail
.
value
.
distance
=
distance
;
console
.
log
(
'distance'
,
distance
,
shopDetail
.
value
.
shopLat
,
shopDetail
.
value
.
shopLng
);
}
catch
(
error
)
{
console
.
error
(
'Error calculating distance:'
,
error
);
}
}
/**
...
...
src/pages/ticket/ticket.vue
View file @
88382beb
...
...
@@ -99,7 +99,19 @@
</view>
</view>
</view>
<wd-loadmore
:state=
"state"
@
reload=
"getCouponList"
/>
<!--
<wd-loadmore
:state=
"state"
@
reload=
"getCouponList"
/>
-->
<view
style=
"
width: 100%;
text-align: center;
font-size: 24rpx;
margin-top: 10rpx;
color: #888989;
"
v-if=
"isEnd"
>
没有更多啦~
</view>
</view>
<wd-status-tip
image=
"content"
tip=
"暂无优惠券"
v-else
/>
</view>
...
...
@@ -125,8 +137,10 @@ const currentTab = ref(0);
const
changeTab
=
(
index
)
=>
{
if
(
currentTab
.
value
!==
index
)
{
currentTab
.
value
=
parseInt
(
index
);
initCouponList
().
then
(()
=>
{
getStatistics
();
initCouponList
();
getCouponList
();
});
}
};
...
...
@@ -137,8 +151,10 @@ const currenStatus = ref(0);
const
changeStatus
=
(
index
)
=>
{
if
(
currenStatus
.
value
!==
index
)
{
currenStatus
.
value
=
index
;
initCouponList
().
then
(()
=>
{
getStatistics
();
initCouponList
();
getCouponList
();
});
}
};
...
...
@@ -161,6 +177,7 @@ getStatistics();
/**
* 获取用户优惠券列表
*/
const
isEnd
=
ref
(
false
);
const
state
=
ref
(
'loading'
);
const
total
=
ref
(
0
);
const
couponData
=
ref
([]);
...
...
@@ -171,12 +188,20 @@ const catalog = reactive({
statuSon
:
0
,
});
const
getCouponList
=
async
()
=>
{
// if (isEnd.value) return;
catalog
.
current
++
;
state
.
value
=
'loading'
;
catalog
.
statuMain
=
currentTab
.
value
;
catalog
.
statuSon
=
currenStatus
.
value
;
console
.
log
(
catalog
);
xma
.
showLoading
({
title
:
'加载中...'
,
mask
:
true
,
});
const
res
=
await
myCouponListApi
(
catalog
);
if
(
res
.
data
.
records
.
length
<
catalog
.
size
)
{
isEnd
.
value
=
true
;
}
if
(
res
.
data
.
records
.
length
>
0
)
{
res
.
data
.
records
.
forEach
((
item
)
=>
{
item
.
showDetail
=
false
;
...
...
@@ -184,24 +209,37 @@ const getCouponList = async () => {
couponData
.
value
.
push
(...
res
.
data
.
records
);
total
.
value
=
res
.
data
.
total
;
}
state
.
value
=
'finished'
;
// state.value = 'finished';
xma
.
hideLoading
();
};
getCouponList
();
// 下拉刷新
onPullDownRefresh
(()
=>
{
getStatistics
();
initCouponList
().
then
(()
=>
{
getCouponList
();
xma
.
stopPullDownRefresh
();
});
});
// 触底函数
onReachBottom
(()
=>
{
if
(
couponData
.
value
.
length
>=
total
.
value
)
{
state
.
value
=
'finished'
;
isEnd
.
value
=
true
;
// state.value = 'finished';
}
else
{
getCouponList
();
}
});
const
initCouponList
=
()
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
couponData
.
value
=
[];
total
.
value
=
0
;
catalog
.
current
=
0
;
getCouponList
();
resolve
();
});
};
/**
...
...
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