workDetail.js 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  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:null,
  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 that = this
  157. wx.showModal({
  158. title: '提示',
  159. content: '确定取消该工单吗?',
  160. complete: (res) => {
  161. if (res.cancel) {
  162. }
  163. if (res.confirm) {
  164. var params = {
  165. id:data.id,
  166. process:5
  167. }
  168. api.updateTicketProcess(params).then(res=>{
  169. if(res.code == 200){
  170. that.setData(
  171. {
  172. ["work.ticketProgress"]:5
  173. }
  174. )
  175. }
  176. })
  177. }
  178. }
  179. })
  180. },
  181. //确认4
  182. confirm(data){
  183. var that = this
  184. wx.showModal({
  185. title: '提示',
  186. content: '确定将该工单置为完成吗?',
  187. complete: (res) => {
  188. if (res.cancel) {
  189. }
  190. if (res.confirm) {
  191. var params = {
  192. id:data.id,
  193. process:4
  194. }
  195. api.updateTicketProcess(params).then(res=>{
  196. if(res.code == 200){
  197. that.setData(
  198. {
  199. ["work.ticketProgress"]:4
  200. }
  201. )
  202. }
  203. })
  204. }
  205. }
  206. })
  207. },
  208. //查看图片
  209. previewImage(e) {
  210. console.log(e)
  211. var { current,imglist,type } = e.currentTarget.dataset
  212. var imgs = []
  213. for(var i =0;i<imglist.length;i++){
  214. if(type == 1){
  215. imgs.push(this.data.imgHttp + imglist[i].guid)
  216. }else{
  217. imgs.push(this.data.imgHttp + imglist[i])
  218. }
  219. }
  220. current = this.data.imgHttp + current
  221. showImage.showImageList(
  222. {
  223. current,
  224. urls: imgs.map((n) => ({ image: n, remark: n })),
  225. indicatorDots: true,
  226. indicatorColor: '#fff',
  227. indicatorActiveColor: '#04BE02',
  228. showDelete:false
  229. }
  230. )
  231. },
  232. /**
  233. * 生命周期函数--监听页面隐藏
  234. */
  235. onHide() {
  236. },
  237. /**
  238. * 生命周期函数--监听页面卸载
  239. */
  240. onUnload() {
  241. },
  242. /**
  243. * 页面相关事件处理函数--监听用户下拉动作
  244. */
  245. onPullDownRefresh() {
  246. },
  247. /**
  248. * 页面上拉触底事件的处理函数
  249. */
  250. onReachBottom() {
  251. },
  252. /**
  253. * 用户点击右上角分享
  254. */
  255. onShareAppMessage() {
  256. }
  257. })