add random tips on currentTicket card

This commit is contained in:
Dawn1Ocean
2024-03-14 23:30:48 +08:00
parent 9931b23337
commit 60f10eaa8f
8 changed files with 62 additions and 16 deletions
+9 -5
View File
@@ -2,10 +2,9 @@ import RepairPage from '@/pages/repair/repair';
import Taro from '@tarojs/taro';
import { TicketListItem } from '@/components/TicketListItem/TicketListItem';
import pt from '@/plain-text';
import DetailFramework from '@/components/DetailFramework/DetailFramework';
import { getUrl } from '.';
export function getCurrentTicket(that: RepairPage, middleButton, isInfoShow) {
export function getCurrentTicket(that: RepairPage) {
Taro.request({
url: getUrl('/user/mytickets'),
method: 'GET',
@@ -15,14 +14,19 @@ export function getCurrentTicket(that: RepairPage, middleButton, isInfoShow) {
})
.then((res) => {
const data = res.data.data;
let newIdList: Array<number> = [];
let newIdNameList: Array<Map<number, string>> = [];
data.list.map((ticket: TicketListItem) => {
if (ticket['status'] !== 5) {
newIdList.push(ticket.id);
newIdNameList.push(
new Map([
[ticket['id'], ticket['device'] + ' ' + ticket['deviceModel']],
]),
);
}
});
console.log(newIdNameList);
that.setState({
currentTicketsId: newIdList,
currentTicketsIdName: newIdNameList,
});
})
.catch((err) => {