lanan-repair-app/pages-order/orderList/orderList.vue

301 lines
7.3 KiB
Vue
Raw Normal View History

2024-10-09 13:34:36 +08:00
<template>
<view class="container">
2024-10-13 23:24:23 +08:00
<view class="header">
<view class="searchBox">
<input class="searchInput" type="text" placeholder="车牌号查询工单" placeholder-style="font-size: 28rpx">
<text class="searchBtn">搜索</text>
</view>
</view>
2024-10-09 13:34:36 +08:00
<view class="body">
<view class="tabList">
2024-10-13 23:24:23 +08:00
<view v-for="(item, index) in tabList" :key="index" :class="{actived: item.id === activeKey}" class="tabItem"
@click="changeTabFun(item.id)">
2024-10-09 13:34:36 +08:00
{{ item.title }}
<view v-if="activeKey === item.id" class="activeLine"></view>
</view>
</view>
<view class="orderList">
<view v-for="(item, index) in orderList" :key="index" class="orderItem">
2024-10-13 23:24:23 +08:00
<order-card :order="item"></order-card>
2024-10-09 13:34:36 +08:00
</view>
</view>
</view>
<tabBarVue msg="2"></tabBarVue>
</view>
</template>
<script>
import request from '../../utils/request';
import VNavigationBar from '@/components/VNavigationBar.vue'
import tabBarVue from '@/components/tabBar/tabBar.vue'
2024-10-13 23:24:23 +08:00
import OrderCard from "@/components/orderCard.vue";
2024-10-09 13:34:36 +08:00
export default {
components: {
2024-10-13 23:24:23 +08:00
OrderCard,
2024-10-09 13:34:36 +08:00
tabBarVue,
VNavigationBar
},
data() {
return {
payShow: false,
activeKey: 0,
pageNum: 1,
totalPages: 0,
imageUrl: '',
2024-10-13 23:24:23 +08:00
tabList: [
{
id: 0,
title: '待处理'
},
2024-10-09 13:34:36 +08:00
{
id: 1,
2024-10-13 23:24:23 +08:00
title: '已完成'
2024-10-09 13:34:36 +08:00
},
2024-10-13 23:24:23 +08:00
],
orderList: [
2024-10-09 13:34:36 +08:00
{
2024-10-13 23:24:23 +08:00
orderNo: '1209840149750105501',
flag: 1, flagStr: '待处理', carNum: '川A 184AO1',
carModel: '一汽奥迪 2024款 A6L',
projectList: [
{ name: '清洗内饰', id: 1 },
{ name: '内饰精洗除臭', id: 2 },
{ name: '烘干底板胶及脚垫', id: 3 }
],
userName: '张三',
userPhone: '157****6879',
appointDate: '2024-10-20 12:00',
counselorName: '李相东'
2024-10-09 13:34:36 +08:00
},
2024-10-13 23:24:23 +08:00
{
orderNo: '1209840149750105501',
flag: 2, flagStr: '已完成', carNum: '川A 184AO1',
carModel: '一汽奥迪 2024款 A6L',
projectList: [
{ name: '清洗内饰', id: 1 },
{ name: '内饰精洗除臭', id: 2 },
{ name: '烘干底板胶及脚垫', id: 3 }
],
userName: '张三',
userPhone: '157****6879',
appointDate: '2024-10-20 12:00',
counselorName: '李相东'
}
2024-10-09 13:34:36 +08:00
],
changeActive: false
}
},
onShow() {
2024-10-13 23:24:23 +08:00
// this.orderList = []
// this.getList()
2024-10-09 13:34:36 +08:00
},
onReachBottom() {
if (this.pageNum >= this.totalPages) {
uni.showToast({
title: '没有下一页数据',
icon: 'none'
})
} else {
this.pageNum++
this.getList()
}
},
methods: {
async getList() {
let data = {
pageSize: 20,
pageNo: this.pageNum
}
switch (this.activeKey) {
case 0:
break;
case 1:
data.status = "06"
break;
case 2:
data.status = '00'
break
default:
break
}
2024-10-13 23:24:23 +08:00
if (this.changeActive) {
2024-10-09 13:34:36 +08:00
this.orderList = []
}
this.changeActive = false
await request({
url: '/userClient/order/page',
method: 'get',
params: data
}).then((res) => {
if (res.code === 200) {
this.orderList = this.orderList.concat(res.rows)
let total = res.total
this.totalPages = Math.ceil(total / this.pageSize);
}
})
},
changeTabFun(id) {
this.activeKey = id
this.changeActive = true
this.getList()
},
getStatus(status) {
switch (status) {
case '0':
return '待支付'
case '1':
return '已支付'
default:
break;
}
},
async goPay(data) {
let that = this
await request({
url: '/userClient/pay/toPay',
method: 'get',
params: {orderId: data.id}
}).then((ress) => {
2024-10-13 23:24:23 +08:00
wx.requestPayment({
timeStamp: ress.data.timeStamp, // 时间戳从1970年1月1日00:00:00至今的秒数即当前的时间
nonceStr: ress.data.nonceStr, // 随机字符串长度为32个字符以下。
package: ress.data.package, // 统一下单接口返回的 prepay_id 参数值格式如“prepay_id=*”
signType: ress.data.signType, // 签名算法类型,默认为 MD5支持RSA等其他加密算法
paySign: ress.data.paySign, // 签名,详见签名生成算法
success: function (res) {
console.log('成功', res);
if (res.errMsg = 'requestPayment:ok') {
uni.showToast({
title: '支付成功'
})
this.getList()
}
// 支付成功后的回调函数, res.errMsg = 'requestPayment:ok'
},
2024-10-09 13:34:36 +08:00
2024-10-13 23:24:23 +08:00
})
2024-10-09 13:34:36 +08:00
})
},
convertToImage() {
uni.canvasToTempFilePath({
canvasId: 'myQrcode',
success: function (res) {
// 在H5平台下tempFilePath 为 base64
// this.imageUrl = res.tempFilePath.replace(/[\r\n]/g, "")
document.getElementById("dl-pay-img").setAttribute("src", res.tempFilePath.replace(/[\r\n]/g, ""))
this.$forceUpdate()
console.log(this.imageUrl, 200);
}
})
},
popupChange({show}) {
if (show) {
}
},
gotoDetail(row) {
2024-10-13 23:24:23 +08:00
if (row.goodsType === '2') {
2024-10-09 13:34:36 +08:00
uni.navigateTo({
url: '/pages-order/orderDetail/orderDetail?ticketsId=' + row.goodsId
})
2024-10-13 23:24:23 +08:00
} else {
2024-10-09 13:34:36 +08:00
uni.navigateTo({
url: '/pages-order/orderDetail/orderDetail'
})
}
},
gotoEvaluate(row) {
uni.navigateTo({
url: '/pages-order/orderDetail/evaluate?info=' + encodeURIComponent(JSON.stringify(row))
})
}
}
}
</script>
2024-10-13 23:24:23 +08:00
<style lang="less" scoped>
2024-10-09 13:34:36 +08:00
.container {
height: 100%;
background: #F3F5F7;
display: flex;
flex-direction: column;
color: #333333;
2024-10-13 23:24:23 +08:00
.header {
padding: 40rpx 32rpx 20rpx;
background-color: #fff;
.searchBox {
background: #F3F5F7;
padding: 20rpx 32rpx;
border-radius: 12rpx 12rpx 12rpx 12rpx;
display: flex;
align-items: center;
column-gap: 12rpx;
.searchInput {
flex: 1;
width: 0;
}
.searchBtn {
font-weight: 500;
font-size: 28rpx;
color: #0174F6;
}
}
}
2024-10-09 13:34:36 +08:00
.body {
flex: 1;
height: 0;
padding: 24rpx 32rpx;
overflow: auto;
}
.tabList {
background: #FFFFFF;
border-radius: 12rpx 12rpx 12rpx 12rpx;
display: flex;
align-items: center;
padding: 0 40rpx;
.tabItem {
padding: 30rpx;
flex: 1;
text-align: center;
position: relative;
font-size: 24rpx;
&.actived {
color: #0174F6;
}
.activeLine {
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
width: 96rpx;
height: 6rpx;
background: #0174F6;
border-radius: 4rpx 4rpx 0rpx 0rpx;
}
}
}
.orderList {
padding: 30rpx 0;
display: flex;
flex-direction: column;
row-gap: 20rpx;
.orderItem {
}
}
}
</style>