Sanakey
2021-04-30 8724a444c8a1d09dc8f9efd005e8443aad8df1ab
提交 | 用户 | age
c09e73 1 const app = getApp<IAppOption>();
S 2 Page({
3   data: {
4     isShowDialog: false,
8724a4 5     avatar:'',
S 6     qrCodeImage:'',
c09e73 7   },
S 8   onLoad() {
9     console.log(app);
8724a4 10     wx.$utils.setGlobalData(this);
c09e73 11   },
3dd7c0 12   onShow(){
S 13     this.getOrderList()
27d5ae 14   },
S 15   async onPullDownRefresh() {
16     console.log(666);
17     console.log("正在下拉刷新");
18     this.onDialogClose();
19     await this.getOrderList();
20     wx.stopPullDownRefresh();
3dd7c0 21   },
S 22   async getOrderList(){
23     let [error,orderList] = await wx.$utils.to(
24       wx.$http.request({
701f60 25         url:'/shopping/panicBuyingOrder.do?m=getOrderListForMe'
3dd7c0 26       })
S 27     )
28     if (error) {
29       console.log(error);
30       return;
31     }
32     console.log(orderList);
27d5ae 33     this.setData({
f9ad6c 34       orderList:orderList.orderList,
S 35       draftList:orderList.draftList,
36       cancelList:orderList.cancelList,
27d5ae 37     })
3dd7c0 38   },
27d5ae 39   showDialog(event:any) {
S 40     let hasReview = event.currentTarget.dataset.hasReview;
a38dad 41     let qrcode = event.currentTarget.dataset.qrcode;
27d5ae 42     console.log(hasReview);
S 43     if (hasReview) return;
c09e73 44     this.setData({
S 45       isShowDialog:true
46     })
a38dad 47     this.getQrCode(qrcode);
c09e73 48   },
S 49   onDialogClose(){
50     this.setData({
51       isShowDialog: false
52     })
ff3df3 53   },
S 54   comebackEvent(e:any){
55     console.log('回来啦',e);
56     this.setData({
57       isShowDialog:e.detail.isShowDialog
58     })
701f60 59     this.getQrCode(e.detail.qrcode);
a38dad 60   },
S 61   async getQrCode(qrcode:string){
62     let [error, result] = await wx.$utils.to(
63       wx.$http.request({
64         url:`/shopping/panicBuyingOrder.do?m=getQrCode`,
65         data:{
66           qrcode
67         }
68       })
69     )
70     if (error){
71       console.log(error);
72       return;
73     }
74     console.log(result);
75     this.setData({
76       qrCodeImage:result.qrCodeImage
77     })
78   },
79
80   onClickDelete(event:any){
81     let doccode = event.currentTarget.dataset.doccode;
82     console.log('待删除的订单号。。。',doccode);
83     wx.pro.showModal({
84       title: '提示',
85       content: '确定要删除该订单吗?',
86     }).then((res:any) => {
87       // on close
88       console.log(res);
89       if (res.confirm){
90         console.log('确认');
91         this.deleteOrder(doccode)
92       }
93     });
94   },
95   async deleteOrder(doccode:string){
96     let [error, result] = await wx.$utils.to(
97       wx.$http.request({
98         url:`/shopping/panicBuyingOrder.do?m=deleteOrder`,
99         data:{
100           doccode
101         }
102       })
103     )
104     if (error){
105       console.log(error);
106       return;
107     }
108     console.log(result);
109     this.getOrderList()
110   },
c09e73 111 })
S 112 export {}