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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
| let $api = require('../../../utils/ajaxFn.js')
| let validator = require('../../../utils/validator.js')
| Page({
| data: {
| userStyle: {},
| info: {
| payAmt: ''
| },
| amtList: [
| { name: '商家到账', number: 0 },
| { name: '用户支付金额', number: 0 }
| ],
| rateList: [
| { name: '支付费率', rate: 0.38 }
| ]
| },
| // 页面加载
| onLoad() {
| var app = getApp()
| this.setData({
| userStyle: app.userStyle
| })
| },
| confirm(e) {
| let code = e.target.dataset.code,
| value = e.detail.value,
| obj = {};
| if (code == 1) {
| obj.payAmt = value
| } else if (code == 2) {
| obj.goodsName = value
| }
| this.setData({
| info: { ...this.data.info,...obj }
| })
| if(code == 1&&this.data.info.payAmt){
| this.getTaril()
| }
| if(code == 1&&!this.data.info.payAmt){
| this.setData({
| amtList:[
| { name: '商家到账', number: 0 },
| { name: '用户支付金额', number: 0 }
| ]
| })
| }
| },
| getTaril(){
| $api.ajax(
| '/sib/xcx/order/dmfTrial',
| 'POST',
| res=>{
| this.setData({
| amtList:[
| { name: '商家到账', number: res.data.body.merAmt },
| { name: '用户支付金额', number: res.data.body.repayAmt }
| ]
| })
| },
| err=>{},
| true,
| {
| amt:this.data.info.payAmt
| }
| )
| },
| toQRCode() {
| this.setData({
| 'info.payType': 2
| })
| // for (let key in this.data.info) {
| // if (!this.data.info[key]) {
| // my.showToast({
| // type: 'none',
| // content: '请输入商品金额',
| // duration: 2000,
| // });
| // return
| // }
| // }
| let info = this.data.info
| if (!validator.checkbdMoney(info.payAmt)||info.payAmt==0) {
| my.showToast({
| type: 'none',
| content: '请输入0.01-100000之间商品金额',
| duration: 2000,
| });
| return
| }
| my.scan({
| scanType: ['qrCode', 'barCode'],
| success: (res) => {
| console.log(res)
| // authCode: res.resultStr,
| $api.ajax(
| '/sib/xcx/order/createDmf',
| 'POST',
| (res) => {
| my.reLaunch({
| url: `/pages/order/shskOrder/shskOrder?orderId=${res.data.body.orderId}`,
| })
| },
| (err) => { },
| true,
| {
| ...this.data.info,
| authCode: res.resultStr
| }
| )
| },
| });
| },
| getQRCode() {
| this.setData({
| 'info.payType': 1
| })
| // for (let key in this.data.info) {
| // if (!this.data.info[key]) {
| // my.showToast({
| // type: 'none',
| // content: '请完整输入信息',
| // duration: 2000,
| // });
| // return
| // }
| // }
| let info = this.data.info
| if (!validator.checkbdMoney(info.payAmt)||info.payAmt==0) {
| my.showToast({
| type: 'none',
| content: '请输入0.01-100000之间商品金额',
| duration: 2000,
| });
| return
| }
| let str = JSON.stringify(this.data.info)
| console.log(this.data.info)
| my.navigateTo({
| url: `../qrCode/qrCode?info=${str}`
| });
| }
| });
|
|