workDetail.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. // pages/myWork/workDetail.js
  2. const api = require('../../api/index')
  3. const app = getApp()
  4. const pay = require('../../utils/pay')
  5. const showImage = require('../../utils/showImage')
  6. Page({
  7. /**
  8. * 页面的初始数据
  9. */
  10. data: {
  11. imgHttp:app.globalData.imghttp,
  12. ticketTypeFiled:{
  13. '1':'ticketFillInVO',
  14. '2':'ticketRightsProtectionVO',
  15. '3':'ticketLitigationRespondingVO',
  16. '4':'ticketPatentApplyVO'
  17. },
  18. ticketTypes:{
  19. '1':'专利解读',
  20. '2':'我要维权',
  21. '3':'我要申诉',
  22. '4':'我要申请'
  23. },
  24. ticketProgress:{
  25. '1':'等待受理',
  26. '2':'已受理,待支付',
  27. '3':'正在处理中',
  28. '4':'已完成',
  29. '5':'已取消',
  30. '6':'已上传结果',
  31. },
  32. id:null,
  33. work:{},
  34. show:false,
  35. ticketFlows:[]
  36. },
  37. /**
  38. * 生命周期函数--监听页面加载
  39. */
  40. onLoad(options) {
  41. this.setData(
  42. {
  43. id:options.id
  44. }
  45. )
  46. this.getTicketDetail()
  47. },
  48. /**
  49. * 生命周期函数--监听页面初次渲染完成
  50. */
  51. onReady() {
  52. },
  53. /**
  54. * 生命周期函数--监听页面显示
  55. */
  56. onShow() {
  57. },
  58. showProgress(){
  59. var params = {
  60. ticketId:this.data.id
  61. }
  62. api.queryTicketFlows(params).then(res=>{
  63. if(res.code == 200){
  64. this.setData(
  65. {
  66. ticketFlows:res.data.data.reverse()
  67. }
  68. )
  69. }
  70. })
  71. this.setData(
  72. {
  73. show:true
  74. }
  75. )
  76. },
  77. onClose(){
  78. this.setData(
  79. {
  80. show:false
  81. }
  82. )
  83. },
  84. getTicketDetail(){
  85. var params = {
  86. ticketId:this.data.id
  87. }
  88. api.getTicketDetail(params).then(res=>{
  89. if(res.code == 200){
  90. this.setData(
  91. {
  92. work:res.data.data
  93. }
  94. )
  95. }
  96. })
  97. },
  98. clickBtn(e){
  99. var {method} =e.currentTarget.dataset
  100. this[method](this.data.work)
  101. },
  102. //支付3
  103. payMoney(data){
  104. var params = {
  105. goodType:2,
  106. goodUuid:data.num
  107. }
  108. wx.showLoading({
  109. title: '加载中',
  110. })
  111. pay.payMoney(params).then(res=>{
  112. console.log(res)
  113. if(res.errMsg == 'requestPayment:ok'){
  114. api.notify(
  115. {
  116. type:'success',
  117. message:'支付成功',
  118. top:wx.getStorageSync('height')
  119. }
  120. )
  121. this.setData(
  122. {
  123. ["work.ticketProgress"]:3
  124. }
  125. )
  126. }
  127. }).catch(error=>{
  128. })
  129. },
  130. //取消5
  131. cancel(data){
  132. var params = {
  133. id:data.id,
  134. process:5
  135. }
  136. api.updateTicketProcess(params).then(res=>{
  137. if(res.code == 200){
  138. this.setData(
  139. {
  140. ["work.ticketProgress"]:5
  141. }
  142. )
  143. }
  144. })
  145. },
  146. //确认4
  147. confirm(data){
  148. var params = {
  149. id:data.id,
  150. process:4
  151. }
  152. api.updateTicketProcess(params).then(res=>{
  153. if(res.code == 200){
  154. this.setData(
  155. {
  156. ["work.ticketProgress"]:4
  157. }
  158. )
  159. }
  160. })
  161. },
  162. //查看图片
  163. previewImage(e) {
  164. console.log(e)
  165. var { current,imglist,type } = e.currentTarget.dataset
  166. var imgs = []
  167. for(var i =0;i<imglist.length;i++){
  168. if(type == 1){
  169. imgs.push(this.data.imgHttp + imglist[i].guid)
  170. }else{
  171. imgs.push(this.data.imgHttp + imglist[i])
  172. }
  173. }
  174. current = this.data.imgHttp + current
  175. showImage.showImageList(
  176. {
  177. current,
  178. urls: imgs.map((n) => ({ image: n, remark: n })),
  179. indicatorDots: true,
  180. indicatorColor: '#fff',
  181. indicatorActiveColor: '#04BE02',
  182. showDelete:false
  183. }
  184. )
  185. },
  186. /**
  187. * 生命周期函数--监听页面隐藏
  188. */
  189. onHide() {
  190. },
  191. /**
  192. * 生命周期函数--监听页面卸载
  193. */
  194. onUnload() {
  195. },
  196. /**
  197. * 页面相关事件处理函数--监听用户下拉动作
  198. */
  199. onPullDownRefresh() {
  200. },
  201. /**
  202. * 页面上拉触底事件的处理函数
  203. */
  204. onReachBottom() {
  205. },
  206. /**
  207. * 用户点击右上角分享
  208. */
  209. onShareAppMessage() {
  210. }
  211. })