123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254 |
- // pages/taxDisputes/taxDisputesPages/xcyysjd/xcyysjd.js
- import {
- selectTel,
- getFuture7Day,
- getYysjByRq,
- reserve
- } from "../../../../apis/sfzy"
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- hall: "",
- phones: [],
- dateBoxStyle: '',
- dates: [],
- dateIndex: 0,
- times: [],
- timeIndex: 0,
- sqText: ""
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
- let that = this
- that.getPhones()
- that.getDatas()
- },
- getPhones() {
- let that = this
- let form = {
- bsfwtDm: wx.getStorageSync('MY_HALL').bsfwtDm
- }
- selectTel(form).then(res => {
- if (res.code == 200) {
- that.setData({
- hall: wx.getStorageSync('MY_HALL').bsfwtmc,
- phones: [res.dhhm, res.sjhm]
- })
- } else {
- wx.showToast({
- title: res.msg || res.message,
- icon: "none"
- })
- }
- })
- },
- getWeek(e) {
- let weeks = [
- "周日",
- "周一",
- "周二",
- "周三",
- "周四",
- "周五",
- "周六",
- ]
- return weeks[e]
- },
- getDatas() {
- let that = this
- getFuture7Day().then(res => {
- if (res.code == 200) {
- that.setData({
- dates: res.data.map((e) => {
- return {
- week: that.getWeek(new Date(e).getDay()),
- date: e.substring(5, 10),
- dates: e
- }
- })
- })
- that.getTimes(res.data[0])
- } else {
- wx.showToast({
- title: res.msg || res.message,
- icon: "none"
- })
- }
- })
- },
- getTimes(e) {
- wx.showLoading({
- title: '获取数据中...',
- })
- let that = this
- let form = {
- yyrq: e,
- bsfwtDm: wx.getStorageSync('MY_HALL').bsfwtDm
- }
- getYysjByRq(form).then(res => {
- wx.hideLoading()
- if (res.code == 200) {
- that.setData({
- times: res.data.map((item) => {
- return {
- sjd: item.kssj + '-' + item.jssj,
- yh: item.syhm
- }
- })
- })
- } else {
- wx.showToast({
- title: res.msg || res.message,
- icon: "none"
- })
- that.setData({
- times: []
- })
- }
- })
- },
- call(e) {
- let phone = e.currentTarget.dataset.phone
- wx.makePhoneCall({
- phoneNumber: phone,
- })
- },
- showHiden() {
- let that = this
- let dateBoxStyle = that.data.dateBoxStyle
- if (dateBoxStyle == '') {
- that.setData({
- dateBoxStyle: "timesActive"
- })
- } else {
- that.setData({
- dateBoxStyle: ""
- })
- }
- },
- selectDate(e) {
- let that = this
- let index = e.currentTarget.dataset.index
- let item = e.currentTarget.dataset.item
- that.setData({
- dateIndex: index
- })
- that.getTimes(item.dates)
- },
- selectTime(e) {
- let that = this
- let index = e.currentTarget.dataset.index
- let item = e.currentTarget.dataset.item
- that.setData({
- timeIndex: index
- })
- },
- sq(e) {
- let that = this
- let value = e.detail.value
- that.setData({
- sqText: value
- })
- },
- next() {
- let that = this
- let sqText = that.data.sqText
- let dates = that.data.dates
- let dateIndex = that.data.dateIndex
- let times = that.data.times
- let timeIndex = that.data.timeIndex
- if (sqText.length > 0) {
- wx.showLoading({
- title: '正在预约...',
- })
- let form = {
- bsfwtDm: wx.getStorageSync('MY_HALL').bsfwtDm,
- unionid: wx.getStorageSync('PUBLIC_ID').unionid,
- yyrq: dates[dateIndex].dates,
- yysjd: times[timeIndex].sjd,
- syph: times[timeIndex].yh,
- wtms: sqText,
- }
- reserve(form).then(res => {
- wx.hideLoading()
- if (res.code == 200) {
- res.data.wdsq = sqText
- wx.setStorageSync('SFZY_YY_DATAS', res.data)
- wx.navigateTo({
- url: '../success/success',
- })
- } else {
- wx.showToast({
- title: res.msg || res.message,
- icon: "none"
- })
- }
- })
- }
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {
- }
- })
|