jiaqingjiayi-xiaochengxu/甲情_甲意/miniprogram/pages/wodedingdan/wodedingdan.js

120 lines
2.8 KiB
JavaScript
Raw Normal View History

2024-12-01 11:56:54 +00:00
import { url } from '../request';
2024-11-10 07:01:22 +00:00
Page({
2024-12-01 11:56:54 +00:00
data: {
current: 0,
items: [
{
title: '全部',
},
{
title: '待支付',
},
{
title: '待使用',
},
{
title: '已完成',
},
{
title: '已取消',
},
{
title: '退款',
},
],
dingdan:[],
// dingdan:[
// {
// number:'晓得美甲店',
// name:'半贴短甲彩绘',
// interpretation:'到店服务',
// dingdannumber:'2024-12-01',
// image:'https://th.bing.com/th/id/R.325f6147c21a518cbb7bb0b5f9f73c51?rik=I4jbDvbv9vOsfQ&riu=http%3a%2f%2fwww.guangyuanol.cn%2fuploads%2fallimg%2f200806%2f1505123236-7.jpg&ehk=vpA2a11wMlcWSGrdKXF93H0nahTK2ptXlnbudoulA9Y%3d&risl=&pid=ImgRaw&r=0',
// adress:' 思明区湖苑里24号',
// price:'100',
// state:'待确认',
// },
// ]
},
onShow(){
my.getStorage({
key: 'userInfo',
success: (res) => {
const userInfo = res.data;
this.setData({
id: userInfo.id, // 获取 id
});
if (userInfo && userInfo.cookie) {
my.request({
url: url + '/api/orders/my/page',
method: 'POST',
data: {
claimStatus: 0,
current: 0,
endTime: "",
id: this.id,
pageSize: 1000,
paymentStatus: 0,
sortField: "",
sortOrder: "",
startTime: ""
},
headers: {
'content-type': 'application/json',
'Cookie': userInfo.cookie,
},
dataType: 'json',
success: (res) => {
if(res.data&&res.data.data){
this.setData({
dingdan:res.data.data
})
}
console.log(this.data.dingdan);
},
fail: (error) => {
console.error('请求失败: ', JSON.stringify(error));
my.alert({ content: '请求失败,请稍后重试' });
},
});
} else {
my.alert({
content: '您未登录,请先登录。',
success: () => {
my.navigateTo({
url: '/pages/denglu/denglu',
});
},
});
}
},
});
},
onSwipeChange(e) {
this.setData({
current: e.detail.current,
});
},
onChange(current) {
this.setData({
current,
});
},
handleChange(current) {
this.setData({
current,
});
},
onPlus() {
this.alert('plus');
},
alert(content) {
my.alert({
title: content,
});
},
2024-11-10 07:01:22 +00:00
});
2024-12-01 11:56:54 +00:00