123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168 |
- var app = getApp()
- var util = require('../../utils/util')
- Page({
-
- data: {
- imgShow: false,
- childTitle:"练琴卡详情",
- item:null,
- schoolList:[],
- moreFlag: 0,
- code: ''
- },
- closeWindow:function(){
- this.setData({
- imgShow:false
- })
- },
- showImg:function(){
- this.setData({
- imgShow:true
- })
- },
- getSchool:function(id){
- let params = {
- id : id
- }
- util.doPost(
- 'exercuseSchool',params
- ).then(rs =>{
- if(rs.success == 1){
- for (var i = 0; i < rs.data.length; i++) {
- if (typeof rs.data[i].lat != 'undefined' && rs.data[i].lat != '' && rs.data[i].lat != null) {
- rs.data[i].distance = util.distance(rs.data[i].LONGITUDE, rs.data[i].LONGITUDE, wx.getStorageSync('latlng').latitude, wx.getStorageSync('latlng').longitude)
- rs.data[i].distance = parseFloat(rs.data[i].distance)
- } else {
- rs.data[i].distance = 999999
- }
- if (rs.data[i].id == id) {
- list = rs.data[i]
- rs.data.list.splice(i, 1)
- i--;
- }
- }
- for (var i = 0; i < rs.data.length; i++) {
- for (var j = i; j < rs.data.length; j++) {
- if (rs.data[i].distance > rs.data[j].distance) {
- var tmp = rs.data[i];
- rs.data[i] = rs.data[j];
- rs.data[j] = tmp;
- }
- }
- }
- this.setData({
- schoolList:rs.data
- })
- }
- })
- },
- getMoreSchool:function(){
- if(this.data.moreFlag == 0){
- this.setData({
- moreFlag: 1
- })
- } else{
- this.setData({
- moreFlag: 0
- })
- }
- },
- callPhone(e){
- const index = e.currentTarget.dataset.index
-
- const phone = this.data.schoolList[index].CONTRACT_TELEPHONE
- if(phone){
- wx.makePhoneCall({
- phoneNumber: phone
- })
- } else{
- wx.showToast({
- title: '暂无联系电话',
- icon:"none"
- })
- }
- },
- getCode:function(content){
- const params = {
- content: content
- }
- util.codePost(
- 'generate',params
- ).then(res =>{
- console.log(res)
- })
- },
-
- onLoad: function (options) {
-
-
- const obj = JSON.parse(options.obj)
- this.setData({
- obj,
- codeImg: 'https://app.schoolwisdoms.com/schoolbaby/api/code/generate?content='+obj.code
- })
- this.getSchool(obj.schemeId)
- },
-
- onReady: function () {
- },
-
- onShow: function () {
- },
-
- onHide: function () {
- },
-
- onUnload: function () {
- },
-
- onPullDownRefresh: function () {
- },
-
- onReachBottom: function () {
- },
-
- onShareAppMessage: function () {
- }
- })
|