建材商城系统20241014
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.

56 lines
1.3 KiB

7 months ago
  1. import Vue from 'vue'
  2. import util from './utils.js'
  3. import time from './timeUtils.js'
  4. import 'dayjs/locale/zh-cn'
  5. import dayjs from 'dayjs'
  6. import md5 from './lib/md5.js'
  7. // #ifdef H5
  8. import jWeixin from './lib/jweixin-module.js'
  9. import { wxPay } from './pay.js'
  10. Vue.prototype.$jWeixin = jWeixin
  11. Vue.prototype.$wxPay = wxPay
  12. // #endif
  13. dayjs.locale('zh-cn')
  14. import Oss from '@/utils/oss-upload/oss/index.js'
  15. import { handleTree } from './tree.js'
  16. Vue.prototype.$handleTree = handleTree
  17. Vue.prototype.$Oss = Oss
  18. Vue.prototype.$dayjs = dayjs
  19. Vue.prototype.$timeUtils = time
  20. Vue.prototype.$utils = util
  21. Vue.prototype.$md5 = md5
  22. // 封装微信支付
  23. uni.requestPaymentWxPay = function(res){
  24. return new Promise((success, error) => {
  25. uni.requestPayment({
  26. provider: 'wxpay', // 服务提提供商
  27. timeStamp: res.result.timeStamp, // 时间戳
  28. nonceStr: res.result.nonceStr, // 随机字符串
  29. package: res.result.packageValue,
  30. signType: res.result.signType, // 签名算法
  31. paySign: res.result.paySign, // 签名
  32. success: function (res) {
  33. console.log('支付成功',res);
  34. success(res)
  35. },
  36. fail: function (err) {
  37. console.log('支付失败',err);
  38. error(err)
  39. uni.showToast({
  40. icon:'none',
  41. title:"支付失败"
  42. })
  43. }
  44. });
  45. })
  46. }