东风启辰小程序端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
1.6KB

  1. // pages/lookPrizeDetail/lookPrizeDetail.js
  2. const app = getApp()
  3. Component({
  4. /**
  5. * 组件的属性列表
  6. */
  7. properties: {
  8. lookIndex:{
  9. type: Object,
  10. value: {}
  11. }
  12. },
  13. /**
  14. * 组件的初始数据
  15. */
  16. data: {
  17. imgUrl: app.globalData.urlStatic,//图片路径
  18. showType:1
  19. },
  20. //组件生命周期函数-在组件实例进入页面节点树时执行
  21. attached(){
  22. if(this.data.lookIndex.productId){
  23. this.getAwardProductInfo();
  24. }
  25. },
  26. /**
  27. * 组件的方法列表
  28. */
  29. methods: {
  30. closeXieyi: function () {
  31. this.triggerEvent('lookPrizeDetail')
  32. },
  33. showTypeControl: function (e) {
  34. this.setData({
  35. showType: e.currentTarget.dataset.type
  36. })
  37. },
  38. copyExchangeCode: function (e) {
  39. var type = e.currentTarget.dataset.type;
  40. if(type==1){
  41. var text = this.data.lookIndex.couponCode;
  42. }else{
  43. var text = this.data.lookIndex.couponSecret;
  44. }
  45. this.contentCopy(text);
  46. },
  47. contentCopy: function (text) {//内容复制
  48. wx.setClipboardData({
  49. data: text
  50. })
  51. },
  52. getAwardProductInfo:function(){
  53. app.wxRequest(app.globalData.urlRoot +"award/getAwardProductInfo",{productId:this.data.lookIndex.productId},res=>{
  54. if(res.code==200){
  55. this.data.lookIndex.couponCode = res.data.productCode;
  56. this.data.lookIndex.couponSecret = res.data.productSecret;
  57. this.data.lookIndex.dead_date = res.data.dead_date;
  58. this.setData({
  59. lookIndex: this.data.lookIndex
  60. })
  61. }
  62. },this);
  63. }
  64. }
  65. })