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
88dcf3d8
Commit
88dcf3d8
authored
Aug 06, 2024
by
彭佳妮(贵阳日报)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
订单
parent
d200caea
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
211 additions
and
52 deletions
+211
-52
pages.json
src/pages.json
+4
-2
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
detail.vue
src/pages/ticket/detail.vue
+29
-9
ticket.vue
src/pages/ticket/ticket.vue
+45
-7
No files found.
src/pages.json
View file @
88dcf3d8
...
...
@@ -29,7 +29,8 @@
{
"path"
:
"pages/order/order"
,
"style"
:
{
"navigationBarTitleText"
:
"订单列表"
"navigationBarTitleText"
:
"订单列表"
,
"enablePullDownRefresh"
:
true
}
},
{
...
...
@@ -59,7 +60,8 @@
{
"path"
:
"pages/ticket/ticket"
,
"style"
:
{
"navigationBarTitleText"
:
"我的券"
"navigationBarTitleText"
:
"我的券"
,
"enablePullDownRefresh"
:
true
}
},
{
...
...
src/pages/order/detail.vue
View file @
88dcf3d8
...
...
@@ -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 @
88dcf3d8
...
...
@@ -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 @
88dcf3d8
...
...
@@ -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/ticket/detail.vue
View file @
88dcf3d8
...
...
@@ -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 @
88dcf3d8
...
...
@@ -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