You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
789 B
49 lines
789 B
![]()
1 year ago
|
# common-pay
|
||
|
|
||
|
## 支付流程:
|
||
|
|
||
|
1. 前端提交,后台生成待支付的订单
|
||
|
2. 订单生成后,跳转到前端收银台页面
|
||
|
3. 客户选择支付方式后,调后台接口生成orderInfo
|
||
|
|
||
|
### 移植到项目:
|
||
|
|
||
|
1. 复制 `common-pay`到自己的项目里
|
||
|
2. 复制 `common-pay`里的`pages_init`到自己项目里的`page.json`
|
||
|
|
||
|
### 配置支付方式:
|
||
|
|
||
|
`pay.vue `
|
||
|
|
||
|
修改属性:`use:[]`
|
||
|
|
||
|
### 跳转支付:
|
||
|
|
||
|
`pay.js `,调用`pay`方法
|
||
|
|
||
|
```
|
||
|
import {
|
||
|
pay
|
||
|
} from '../../uni_modules/common-pay/utils/pay.js'
|
||
|
|
||
|
// 请按照格式去传参
|
||
|
let o = {
|
||
|
price: '10.00',
|
||
|
goods: '测试商品'
|
||
|
...
|
||
|
}
|
||
|
|
||
|
pay(o);
|
||
|
```
|
||
|
|
||
|
### 接参:
|
||
|
|
||
|
|
||
|
```
|
||
|
try {
|
||
|
// 跳转携带数据
|
||
|
this.data = JSON.parse(options.data)
|
||
|
} catch (e) {
|
||
|
this.data = JSON.parse(decodeURIComponent(options.data))
|
||
|
}
|
||
|
```
|