瑶都万能墙
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.

73 lines
1.5 KiB

4 months ago
4 months ago
4 months ago
3 months ago
4 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. Vue.prototype.previewImage = (urls, current) => {
  23. uni.previewImage({
  24. urls,
  25. current,
  26. })
  27. }
  28. Vue.prototype.openLocation = (latitude, longitude) => {
  29. if(!latitude || !longitude){
  30. return
  31. }
  32. uni.openLocation({
  33. latitude : Number(latitude),
  34. longitude : Number(longitude),
  35. })
  36. }
  37. // 封装微信支付
  38. uni.requestPaymentWxPay = function(res){
  39. return new Promise((success, error) => {
  40. uni.requestPayment({
  41. provider: 'wxpay', // 服务提提供商
  42. timeStamp: res.result.timeStamp, // 时间戳
  43. nonceStr: res.result.nonceStr, // 随机字符串
  44. package: res.result.packageValue,
  45. signType: res.result.signType, // 签名算法
  46. paySign: res.result.paySign, // 签名
  47. success: function (res) {
  48. console.log('支付成功',res);
  49. success(res)
  50. },
  51. fail: function (err) {
  52. console.log('支付失败',err);
  53. error(err)
  54. uni.showToast({
  55. icon:'none',
  56. title:"支付失败"
  57. })
  58. }
  59. });
  60. })
  61. }