Sanakey
2021-04-30 8724a444c8a1d09dc8f9efd005e8443aad8df1ab
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
 
// const app = getApp<IAppOption>();
Component({
  /**
   * 组件的属性列表
   */
  options: {
    styleIsolation: 'shared',
    addGlobalClass: true,
    multipleSlots: true // 在组件定义时的选项中启用多slot支持
  },
  properties: {
    listItem:{
      type: Object,
      value: {}
    },
    from:{
      type:String,
      value: ''
    },
    isGoDetails:{
      type:Boolean,
      value: true
    },
    titleWidth:{
      type:String,
      value:'520rpx'
    },
    border:{
      type:Boolean,
      value: true
    }
  },
 
  /**
   * 组件的初始数据
   */
  data: {
 
  },
 
  lifetimes: {
    attached: function() {
      // 在组件实例进入页面节点树时执行
      // console.log(this.data.listItem);
    },
    detached: function() {
      // 在组件实例被从页面节点树移除时执行
    },
  },
  /**
   * 组件的方法列表
   */
  methods: {
    goDetail(){
      if (!this.data.isGoDetails) return;
      let fromPage = this.data.from;
      let doccode = this.data.listItem.doccode;
      let url = `/pages/detail/detail?from=${fromPage}&doccode=${doccode}`;
      // let _this = this;
      // console.log(this);
      if (fromPage==='myOrder'){
        url = `/pages/orderDetail/orderDetail?from=${fromPage}&doccode=${doccode}`
      }
      wx.navigateTo({
        url,
        events: {
          // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
          detailCheckCode: (data: any)=> {
            console.log('选择的商品',data)
            this.triggerEvent('comeback',data);
            // console.log(_this,this);
            // let [errMsg,qrRes] = await this.getPosterQrCode({
            //   QrCodeType:30,
            //   matcode: data.goods
            // });
            // if (errMsg) {
            //   return;
            // }
            // this.setData({
            //   qrRes,
            //   selectedQr:index
            // })
          }
        }
      })
    },
    // toggleCheckbox(e:any) {
    //   if (this.data.isGoDetails) return;
    //   console.log('eee..',e);
    //   this.triggerEvent('toggleCheckbox',{
    //     index: e.currentTarget.dataset
    //   });
    // }
  }
})