|
- // pages/lookPrizeDetail/lookPrizeDetail.js
- const app = getApp()
- Component({
- /**
- * 组件的属性列表
- */
- properties: {
- lookIndex:{
- type: Object,
- value: {}
- }
- },
-
- /**
- * 组件的初始数据
- */
- data: {
- imgUrl: app.globalData.urlStatic,//图片路径
- showType:1
- },
- //组件生命周期函数-在组件实例进入页面节点树时执行
- attached(){
- if(this.data.lookIndex.productId){
- this.getAwardProductInfo();
- }
- },
- /**
- * 组件的方法列表
- */
- methods: {
- closeXieyi: function () {
- this.triggerEvent('lookPrizeDetail')
- },
- showTypeControl: function (e) {
- this.setData({
- showType: e.currentTarget.dataset.type
- })
- },
- copyExchangeCode: function (e) {
- var type = e.currentTarget.dataset.type;
- if(type==1){
- var text = this.data.lookIndex.couponCode;
- }else{
- var text = this.data.lookIndex.couponSecret;
- }
- this.contentCopy(text);
- },
- contentCopy: function (text) {//内容复制
- wx.setClipboardData({
- data: text
- })
- },
- getAwardProductInfo:function(){
- app.wxRequest(app.globalData.urlRoot +"award/getAwardProductInfo",{productId:this.data.lookIndex.productId},res=>{
- if(res.code==200){
- this.data.lookIndex.couponCode = res.data.productCode;
- this.data.lookIndex.couponSecret = res.data.productSecret;
- this.data.lookIndex.dead_date = res.data.dead_date;
- this.setData({
- lookIndex: this.data.lookIndex
- })
- }
- },this);
- }
- }
- })
|