xcyysjd.js 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. // pages/taxDisputes/taxDisputesPages/xcyysjd/xcyysjd.js
  2. import {
  3. selectTel,
  4. getFuture7Day,
  5. getYysjByRq,
  6. reserve
  7. } from "../../../../apis/sfzy"
  8. Page({
  9. /**
  10. * 页面的初始数据
  11. */
  12. data: {
  13. hall: "",
  14. phones: [],
  15. dateBoxStyle: '',
  16. dates: [],
  17. dateIndex: 0,
  18. times: [],
  19. timeIndex: 0,
  20. sqText: ""
  21. },
  22. /**
  23. * 生命周期函数--监听页面加载
  24. */
  25. onLoad(options) {
  26. let that = this
  27. that.getPhones()
  28. that.getDatas()
  29. },
  30. getPhones() {
  31. let that = this
  32. let form = {
  33. bsfwtDm: wx.getStorageSync('MY_HALL').bsfwtDm
  34. }
  35. selectTel(form).then(res => {
  36. if (res.code == 200) {
  37. that.setData({
  38. hall: wx.getStorageSync('MY_HALL').bsfwtmc,
  39. phones: [res.dhhm, res.sjhm]
  40. })
  41. } else {
  42. wx.showToast({
  43. title: res.msg || res.message,
  44. icon: "none"
  45. })
  46. }
  47. })
  48. },
  49. getWeek(e) {
  50. let weeks = [
  51. "周日",
  52. "周一",
  53. "周二",
  54. "周三",
  55. "周四",
  56. "周五",
  57. "周六",
  58. ]
  59. return weeks[e]
  60. },
  61. getDatas() {
  62. let that = this
  63. getFuture7Day().then(res => {
  64. if (res.code == 200) {
  65. that.setData({
  66. dates: res.data.map((e) => {
  67. return {
  68. week: that.getWeek(new Date(e).getDay()),
  69. date: e.substring(5, 10),
  70. dates: e
  71. }
  72. })
  73. })
  74. that.getTimes(res.data[0])
  75. } else {
  76. wx.showToast({
  77. title: res.msg || res.message,
  78. icon: "none"
  79. })
  80. }
  81. })
  82. },
  83. getTimes(e) {
  84. wx.showLoading({
  85. title: '获取数据中...',
  86. })
  87. let that = this
  88. let form = {
  89. yyrq: e,
  90. bsfwtDm: wx.getStorageSync('MY_HALL').bsfwtDm
  91. }
  92. getYysjByRq(form).then(res => {
  93. wx.hideLoading()
  94. if (res.code == 200) {
  95. that.setData({
  96. times: res.data.map((item) => {
  97. return {
  98. sjd: item.kssj + '-' + item.jssj,
  99. yh: item.syhm
  100. }
  101. })
  102. })
  103. } else {
  104. wx.showToast({
  105. title: res.msg || res.message,
  106. icon: "none"
  107. })
  108. that.setData({
  109. times: []
  110. })
  111. }
  112. })
  113. },
  114. call(e) {
  115. let phone = e.currentTarget.dataset.phone
  116. wx.makePhoneCall({
  117. phoneNumber: phone,
  118. })
  119. },
  120. showHiden() {
  121. let that = this
  122. let dateBoxStyle = that.data.dateBoxStyle
  123. if (dateBoxStyle == '') {
  124. that.setData({
  125. dateBoxStyle: "timesActive"
  126. })
  127. } else {
  128. that.setData({
  129. dateBoxStyle: ""
  130. })
  131. }
  132. },
  133. selectDate(e) {
  134. let that = this
  135. let index = e.currentTarget.dataset.index
  136. let item = e.currentTarget.dataset.item
  137. that.setData({
  138. dateIndex: index
  139. })
  140. that.getTimes(item.dates)
  141. },
  142. selectTime(e) {
  143. let that = this
  144. let index = e.currentTarget.dataset.index
  145. let item = e.currentTarget.dataset.item
  146. that.setData({
  147. timeIndex: index
  148. })
  149. },
  150. sq(e) {
  151. let that = this
  152. let value = e.detail.value
  153. that.setData({
  154. sqText: value
  155. })
  156. },
  157. next() {
  158. let that = this
  159. let sqText = that.data.sqText
  160. let dates = that.data.dates
  161. let dateIndex = that.data.dateIndex
  162. let times = that.data.times
  163. let timeIndex = that.data.timeIndex
  164. if (sqText.length > 0) {
  165. wx.showLoading({
  166. title: '正在预约...',
  167. })
  168. let form = {
  169. bsfwtDm: wx.getStorageSync('MY_HALL').bsfwtDm,
  170. unionid: wx.getStorageSync('PUBLIC_ID').unionid,
  171. yyrq: dates[dateIndex].dates,
  172. yysjd: times[timeIndex].sjd,
  173. syph: times[timeIndex].yh,
  174. wtms: sqText,
  175. }
  176. reserve(form).then(res => {
  177. wx.hideLoading()
  178. if (res.code == 200) {
  179. res.data.wdsq = sqText
  180. wx.setStorageSync('SFZY_YY_DATAS', res.data)
  181. wx.navigateTo({
  182. url: '../success/success',
  183. })
  184. } else {
  185. wx.showToast({
  186. title: res.msg || res.message,
  187. icon: "none"
  188. })
  189. }
  190. })
  191. }
  192. },
  193. /**
  194. * 生命周期函数--监听页面初次渲染完成
  195. */
  196. onReady() {
  197. },
  198. /**
  199. * 生命周期函数--监听页面显示
  200. */
  201. onShow() {
  202. },
  203. /**
  204. * 生命周期函数--监听页面隐藏
  205. */
  206. onHide() {
  207. },
  208. /**
  209. * 生命周期函数--监听页面卸载
  210. */
  211. onUnload() {
  212. },
  213. /**
  214. * 页面相关事件处理函数--监听用户下拉动作
  215. */
  216. onPullDownRefresh() {
  217. },
  218. /**
  219. * 页面上拉触底事件的处理函数
  220. */
  221. onReachBottom() {
  222. },
  223. /**
  224. * 用户点击右上角分享
  225. */
  226. onShareAppMessage() {
  227. }
  228. })