detail.js
2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import App from '../../../utils/api.js'
import util from '../../../utils/util.js'
Page({
data:{
hasmore:true,
},
onLoad(opt){
console.log(opt,'uuuu')
this.setData({
totalprice:opt.totalprice ? opt.totalprice : null
})
this.opt=opt;
this.getorderinfo();
},
getsellerinfo(){
App.Seller.GetSellerById({sellerid:this.opt.sellerid}).then((json)=>{
if(json.ret==200){
console.log(json.data.seller.seller_tel)
let telist=json.data.seller.seller_tel.indexOf(',')!=-1 ? json.data.seller.seller_tel.split(',') : [json.data.seller.seller_tel]
this.setData({
seller:json.data.seller,
telist:telist
})
}
})
},
getorderinfo(){
App.Orders.GetOrderById({orderid:this.opt.id}).then((json)=>{
console.log(json,'orderinfo')
if(json.ret==200){
if(json.data.order && json.data.order.sd_time){
let arr=json.data.order.sd_time.split('-');
console.log(arr[1])
console.log(util.unixtoTime(arr[1],'YYYY-MM-DD HH:II DAY'));
let sdate=util.unixtoTime(arr[0],'YYYY-MM-DD HH:II DAY');
let edate=util.unixtoTime(arr[1],'YYYY-MM-DD HH:II DAY')
json.data.order.showsendtime=(sdate.split(' ')[2] ? sdate.split(' ')[2] : sdate.split(' ')[1])+' '+sdate.split(' ')[1]+'-'+edate.split(' ')[1],
json.data.showdate=util.unixtoTime(json.data.cdate,'YYYY/MM/DD HH:II');
}
this.setData({
cartlist:json.data.cookBookList,
order:json.data.order,
totalprice:json.data.order.cookBookPrice ? json.data.order.cookBookPrice : json.data.order.price
})
this.getsellerinfo();
}
})
},
pay(){
console.log(this.data.order.id)
App.PayOnline.CombineTransactionsByRecharge({openid:util.cache('openid'),id:this.data.order.id}).then((json)=>{
console.log(json,'调起支付');
if(json.ret==200){
wx.requestPayment({
timeStamp: json.data.timeStamp + '',
nonceStr: json.data.nonceStr,
package: json.data.package,
signType: 'MD5',
paySign: json.data.paySign,
success:(res)=>{
console.log(res,'支付成功');
this.getorderinfo();
},
fail:(res)=>{
console.log(res,'支付失败');
}
})
}
})
},
showtel(){
// console.log(this.selectComponent('#tellist'))
this.selectComponent('#tellist').show();
},
showmore(){
this.setData({
hasmore:!this.data.hasmore
})
}
})