pay.js 670 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import toast from '../utils/tool/toast';
  2. export default {
  3. methods:{
  4. /* 支付
  5. * mode 状态
  6. * confirmOrder
  7. *
  8. * */
  9. wxPay:function (data,callback,msg = false) {
  10. return uni.requestPayment({
  11. 'timeStamp': data.timeStamp,
  12. 'nonceStr': data.nonceStr,
  13. 'package': data.package,
  14. 'signType': data.signType,
  15. 'paySign': data.paySign,
  16. 'complete': (res)=>{
  17. let status = res.errMsg === 'requestPayment:ok';
  18. if (msg && !status) {
  19. toast.info('支付取消');
  20. }
  21. return callback && callback(status);
  22. },
  23. 'success':(res) => {
  24. if (msg) {
  25. toast.success('支付成功');
  26. }
  27. }
  28. });
  29. }
  30. }
  31. }