workDetail.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  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. successPay(e){
  104. this.setData(
  105. {
  106. ["work.ticketProgress"]:3
  107. }
  108. )
  109. },
  110. payMoney(data){
  111. var payData ={
  112. title:'支付工单',
  113. type:data.ticketType,
  114. goods:[
  115. {
  116. id:data.id,
  117. name:this.data.ticketTypes[data.ticketType]+'-工单',
  118. price:data.price,
  119. num:1
  120. }
  121. ],
  122. servicePrice:0.00,
  123. price:data.price,
  124. discount:'',
  125. }
  126. pay.openPay(payData)
  127. return
  128. var params = {
  129. goodType:2,
  130. goodUuid:data.num
  131. }
  132. wx.showLoading({
  133. title: '加载中',
  134. })
  135. pay.payMoney(params).then(res=>{
  136. console.log(res)
  137. if(res.errMsg == 'requestPayment:ok'){
  138. api.notify(
  139. {
  140. type:'success',
  141. message:'支付成功',
  142. top:wx.getStorageSync('height')
  143. }
  144. )
  145. this.setData(
  146. {
  147. ["work.ticketProgress"]:3
  148. }
  149. )
  150. }
  151. }).catch(error=>{
  152. })
  153. },
  154. //取消5
  155. cancel(data){
  156. var params = {
  157. id:data.id,
  158. process:5
  159. }
  160. api.updateTicketProcess(params).then(res=>{
  161. if(res.code == 200){
  162. this.setData(
  163. {
  164. ["work.ticketProgress"]:5
  165. }
  166. )
  167. }
  168. })
  169. },
  170. //确认4
  171. confirm(data){
  172. var params = {
  173. id:data.id,
  174. process:4
  175. }
  176. api.updateTicketProcess(params).then(res=>{
  177. if(res.code == 200){
  178. this.setData(
  179. {
  180. ["work.ticketProgress"]:4
  181. }
  182. )
  183. }
  184. })
  185. },
  186. //查看图片
  187. previewImage(e) {
  188. console.log(e)
  189. var { current,imglist,type } = e.currentTarget.dataset
  190. var imgs = []
  191. for(var i =0;i<imglist.length;i++){
  192. if(type == 1){
  193. imgs.push(this.data.imgHttp + imglist[i].guid)
  194. }else{
  195. imgs.push(this.data.imgHttp + imglist[i])
  196. }
  197. }
  198. current = this.data.imgHttp + current
  199. showImage.showImageList(
  200. {
  201. current,
  202. urls: imgs.map((n) => ({ image: n, remark: n })),
  203. indicatorDots: true,
  204. indicatorColor: '#fff',
  205. indicatorActiveColor: '#04BE02',
  206. showDelete:false
  207. }
  208. )
  209. },
  210. /**
  211. * 生命周期函数--监听页面隐藏
  212. */
  213. onHide() {
  214. },
  215. /**
  216. * 生命周期函数--监听页面卸载
  217. */
  218. onUnload() {
  219. },
  220. /**
  221. * 页面相关事件处理函数--监听用户下拉动作
  222. */
  223. onPullDownRefresh() {
  224. },
  225. /**
  226. * 页面上拉触底事件的处理函数
  227. */
  228. onReachBottom() {
  229. },
  230. /**
  231. * 用户点击右上角分享
  232. */
  233. onShareAppMessage() {
  234. }
  235. })