|
@@ -1,50 +1,58 @@
|
|
|
import PageContainerBehavior from "../../../../core/behavior/page-container.behavior";
|
|
import PageContainerBehavior from "../../../../core/behavior/page-container.behavior";
|
|
|
import tickleBehavior, { getTickleContext } from "../../../../core/behavior/tickle.behavior";
|
|
import tickleBehavior, { getTickleContext } from "../../../../core/behavior/tickle.behavior";
|
|
|
-import { getDietMethod } from "../../request";
|
|
|
|
|
|
|
+import { getOrderDetailMethod, orderConfirmMethod } from "../../request";
|
|
|
// module/diet/pages/delivery-address/delivery-address.ts
|
|
// module/diet/pages/delivery-address/delivery-address.ts
|
|
|
-Component({
|
|
|
|
|
|
|
+Page({
|
|
|
behaviors: [
|
|
behaviors: [
|
|
|
PageContainerBehavior,
|
|
PageContainerBehavior,
|
|
|
tickleBehavior,
|
|
tickleBehavior,
|
|
|
],
|
|
],
|
|
|
- lifetimes: {
|
|
|
|
|
- attached() {
|
|
|
|
|
|
|
+ async onLoad(options:any) {
|
|
|
|
|
+ console.log("onLoad",options)
|
|
|
|
|
+ if(options.orderId){
|
|
|
|
|
+ this.setData({ id: options.orderId });
|
|
|
|
|
+ await this.load(options.orderId);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
},
|
|
},
|
|
|
properties: {
|
|
properties: {
|
|
|
},
|
|
},
|
|
|
data: {
|
|
data: {
|
|
|
|
|
+ id: '',
|
|
|
goodsList: [
|
|
goodsList: [
|
|
|
- {
|
|
|
|
|
- id: 1,
|
|
|
|
|
- img: 'https://pic.nximg.cn/file/20190718/28170468_214109363000_2.jpg',
|
|
|
|
|
- name: '元气茶',
|
|
|
|
|
- count: 3,
|
|
|
|
|
- expressNo: '00385322232830'
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- id: 2,
|
|
|
|
|
- img: 'https://pic.nximg.cn/file/20190718/28170468_214109363000_2.jpg',
|
|
|
|
|
- name: '芡实米仁燕麦粥',
|
|
|
|
|
- count: 21,
|
|
|
|
|
- expressNo: '00385322290821'
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // {
|
|
|
|
|
+ // id: 1,
|
|
|
|
|
+ // img: 'https://pic.nximg.cn/file/20190718/28170468_214109363000_2.jpg',
|
|
|
|
|
+ // name: '元气茶',
|
|
|
|
|
+ // count: 3,
|
|
|
|
|
+ // expressNo: '00385322232830'
|
|
|
|
|
+ // },
|
|
|
|
|
+ // {
|
|
|
|
|
+ // id: 2,
|
|
|
|
|
+ // img: 'https://pic.nximg.cn/file/20190718/28170468_214109363000_2.jpg',
|
|
|
|
|
+ // name: '芡实米仁燕麦粥',
|
|
|
|
|
+ // count: 21,
|
|
|
|
|
+ // expressNo: '00385322290821'
|
|
|
|
|
+ // }
|
|
|
]
|
|
]
|
|
|
},
|
|
},
|
|
|
- methods: {
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- async load() {
|
|
|
|
|
|
|
+ async load(id:string) {
|
|
|
wx.showLoading({ title: '加载中' });
|
|
wx.showLoading({ title: '加载中' });
|
|
|
try {
|
|
try {
|
|
|
- const dataset = await getDietMethod(this.data.id);
|
|
|
|
|
- this.setData({ dataset, title: dataset.name });
|
|
|
|
|
- } catch (error) {
|
|
|
|
|
|
|
+ const res = await getOrderDetailMethod(id);
|
|
|
|
|
+ console.log("res",res)
|
|
|
|
|
+ if(res && res.data && res.data.items && res.data.items.length > 0){
|
|
|
|
|
+ this.setData({ goodsList: res.data.items });
|
|
|
|
|
+ }else{
|
|
|
|
|
+ this.setData({ goodsList: [] });
|
|
|
|
|
+ }
|
|
|
|
|
+ console.log("goodsList",this.data.goodsList)
|
|
|
|
|
+ } catch (error:any) {
|
|
|
getTickleContext.call(this).showWarnMessage(error.errMsg);
|
|
getTickleContext.call(this).showWarnMessage(error.errMsg);
|
|
|
}
|
|
}
|
|
|
wx.hideLoading();
|
|
wx.hideLoading();
|
|
|
},
|
|
},
|
|
|
- copyExpressNo(e) {
|
|
|
|
|
|
|
+ copyExpressNo(e:any) {
|
|
|
wx.setClipboardData({
|
|
wx.setClipboardData({
|
|
|
data: e.currentTarget.dataset.no,
|
|
data: e.currentTarget.dataset.no,
|
|
|
success: () => wx.showToast({ title: '已复制', icon: 'none' })
|
|
success: () => wx.showToast({ title: '已复制', icon: 'none' })
|
|
@@ -55,9 +63,15 @@ Component({
|
|
|
wx.navigateBack();
|
|
wx.navigateBack();
|
|
|
},
|
|
},
|
|
|
// 确认收货逻辑
|
|
// 确认收货逻辑
|
|
|
- onConfirmReceiving() {
|
|
|
|
|
- // 确认收货逻辑
|
|
|
|
|
- wx.showToast({ title: '确认收货成功', icon: 'success' });
|
|
|
|
|
|
|
+ async onConfirmReceiving() {
|
|
|
|
|
+ try {
|
|
|
|
|
+ await orderConfirmMethod(this.data.id);
|
|
|
|
|
+ wx.showToast({ title: '确认收货成功', icon: 'success' });
|
|
|
|
|
+ wx.navigateTo({
|
|
|
|
|
+ url: "/module/article/pages/success-page/success-page?title=确认收货成功",
|
|
|
|
|
+ });
|
|
|
|
|
+ } catch (error:any) {
|
|
|
|
|
+ getTickleContext.call(this).showWarnMessage(error.errMsg);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
})
|
|
})
|