123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- import { routers, viewImage, sharePage, isFn, getGlobalVal, formatDateTime, formateNumber } from '../../utils/util.js'
- import { UntieDerver, BindConch} from '../../utils/api.js'
- const { navigateTo, redirectTo, navigateBack } = routers()
- const { globalData } = getApp()
- const { baseImgUrl, thumbnail } = globalData
- const app = getApp()
- Page({
-
- data: {
- baseImgUrl,
- thumbnail,
- },
-
- onLoad: function (options) {
- console.log(options)
- this.setData(options);
- },
-
- onReady: function () {
- const obj = { navigateTo, redirectTo, navigateBack, viewImage }
- for (const i in obj) {
- this[i] = obj[i]
- }
- },
-
- onShow: function () {
- },
-
- onHide: function () {
- },
-
- onUnload: function () {
- },
-
- onPullDownRefresh: function () {
- },
-
- onReachBottom: function () {
- },
-
- onShareAppMessage: function () {
- },
-
- getLocation: function () {
- wx.showLoading({
- title: '定位中'
- })
- wx.getLocation({
- type: 'wgs84',
- success: res => {
- this.setData({
- longitude: res.longitude,
- latitude: res.latitude
- })
- this.getBindConch()
- },
- fail: res => {
- wx.showToast({
- title: '定位失败',
- icon: 'none'
- })
- },
- complete: res => {
- wx.hideLoading()
- }
- })
- },
-
- getData: function (cb) {
- const continuousFn = { fn: this.getData, param: { ...arguments } }
- const { derver } = this.data
- UntieDerver({ data: { derver }, continuousFn }).then(res => {
- wx.showToast({
- title: '解绑成功',
- icon: 'none'
- })
- this.setData({ derver:""})
- if (isFn(cb)) cb()
- }).catch(res => {
- this.setData({ isLoaded: true })
- if (isFn(cb)) cb()
- })
- },
-
- getBindConch: function (cb) {
- const continuousFn = { fn: this.getBindConch, param: { ...arguments } }
- const { vipId,longitude, latitude } = this.data
- var that=this
- wx.scanCode({
- onlyFromCamera: true,
- success: (e) => {
- console.log(e)
-
- BindConch({ data: { vipId, qrCode: e.result, longitude, latitude }, continuousFn }).then(res => {
- const {derver}=this.data;
- that.setData({derver})
- wx.showToast({
- title: '绑定成功',
- icon: 'none'
- })
- if (isFn(cb)) cb()
- }).catch(res => {
- this.setData({ isLoaded: true })
- if (isFn(cb)) cb()
- })
-
-
-
-
-
-
-
- }
- })
-
-
- }
- })
|