123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- const app = getApp()
- var util = require("../../../utils/util.js")
- Page({
- data: {
- p_name: undefined,
- p_code: undefined,
- PIGroups: [],
- PIClasses: [],
- PIServices: [],
- PIServiceLength: undefined,
- Showname: [],
- p_id: '',
- imgLists: []
- },
- onLoad: function(option) {
- this.setData({
- p_id: option.p_id
- })
- var that = this
- // 根据ID获取详情pic
- util.getData('/getPackageImagesByID', {
- p_id: that.data.p_id
- }).then(res => {
- // console.log(res);
- that.setData({
- imgLists: res
- })
- })
- util.getData('/getPackageDetail',{
- p_code: option.para
- }).then(res=>{
- that.setData({
- p_name: res.p_name,
- p_code: option.para,
- })
- })
- util.getData('/getPIGroups').then(res=>{
- that.setData({
- PIGroups: res
- })
- })
- util.getData('/getPIClasses').then(res=>{
- that.setData({
- PIClasses: res
- })
- })
- wx.request({
- url: app.globalData.url + '/getPIServices',
- method: 'get',
- success: function(res3) {
- that.setData({
- PIServices: res3.data,
- PIServiceLength: res3.data.length - 1
- })
- },
- fail() {
- app.timeOut()
- }
- })
- wx.request({
- url: app.globalData.url + '/getPackageShowname',
- method: 'get',
- success: function(res4) {
- that.setData({
- Showname: res4.data
- })
- },
- fail() {
- app.timeOut()
- }
- })
- let _this = this;
- _this.setData({
- navH: app.globalData.navHeight
- })
- },
- bookingpackages: function(e) {
- var that = this
- app.checkSession().then(res => {
- if (app.globalData.userphone == null) {
- app.ifAuthorization();
- } else {
- wx.showLoading({
- title: '保存中......',
- icon: 'loading',
- duration: 55000
- })
- //保存数据库
- var duedate = new Date();
- var year = duedate.getFullYear();
- var month = duedate.getMonth() + 1;
- var strDate = duedate.getDate();
- var seperator1 = "-";
- var date = new Date();
- var year = date.getFullYear();
- var month = ("0" + (date.getMonth() + 1)).slice(-2);;
- var strDate = ("0" + (date.getDate())).slice(-2);
- var hours = ("0" + (date.getHours())).slice(-2);
- var minutes = ("0" + (date.getMinutes())).slice(-2);
- var seconds = ("0" + (date.getSeconds())).slice(-2);
- var eh_time = year + '-' + month + '-' + strDate + ' ' + hours + ':' + minutes + ':' + seconds;
- util.getData('/getDcIntroducerConsultants', {
- dig_introducer_phone: app.globalData.introducer
- }).then(res => {
- if (res != null) {
- that.setData({
- consultants: res
- })
- }
- let branche_code = wx.getStorageSync('branche_code');
- util.postData('/insertCustomerBooking', {
- bk_phone: app.globalData.userphone,
- bk_date: year + seperator1 + month + seperator1 + strDate,
- bk_type: 1,
- bk_branches_id: branche_code,
- bk_desc: that.data.p_name,
- bk_introducer_phone: app.globalData.introducer,
- bk_introducer_consultant: that.data.consultants
- }).then(res => {
- wx.hideLoading()
- if (res > 1) {
- wx.showToast({
- title: '亲,您今天已经预约过了',
- icon: 'none',
- duration: 5000
- })
- } else {
- wx.showToast({
- title: '预约成功!',
- icon: 'success',
- duration: 5000
- })
- // 发送消息
- util.postData('/WXSendBookingMessage', {
- bk_phone: app.globalData.userphone,
- bk_type: 1,
- bk_date: eh_time,
- bk_desc: that.data.p_name,
- bk_branches_id: branche_code,
- bk_introducer_phone: app.globalData.introducer,
- bk_introducer_consultant: that.data.consultants
- })
- util.postData('/insertDcIntroduceLog', {
- xul_openid: app.globalData.openid,
- xul_phone: app.globalData.userphone,
- xul_event: 4,
- xul_introducer_phone: app.globalData.introducer
- })
- }
- })
- })
- }
- })
- },
- onShareAppMessage: function() {
- return {
- title: '悦所-套餐详情(' + this.data.p_name + ')',
- path: '/pages/index/index?skip=1&path=' + '/pages/packages/packagedetail/packagedetail¶=' + this.data.p_code
- }
- },
- })
|