zhaojs
2023-07-28 88e2da5097fdb19a4dfb6cb9477ba48e934aa8fe
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
"use strict";
const common_vendor = require("../../common/vendor.js");
const common_util = require("../../common/util.js");
const common_request = require("../../common/request.js");
const _sfc_main = {
  data() {
    return {
      getNumData: common_util.getNumData,
      requestx: common_request.requestx,
      goodid: "",
      info: {},
      copyText: "",
      hasGet: false,
      type: 1,
      routerr: "",
      imgNum: 1,
      baseUrl: ""
    };
  },
  onShareAppMessage: function() {
    return {
      title: "淘券获取",
      path: "/pages/index/index"
      // promise
    };
  },
  onShareTimeline() {
    return {
      title: "淘券获取",
      query: "/pages/index/index"
    };
  },
  onLoad(opt) {
    var _a;
    let rr = getCurrentPages();
    this.routerr = (_a = rr[rr.length - 1].$page) == null ? void 0 : _a.fullPath;
    this.GetGoodDetail(opt.id, opt.type, opt);
    this.type = opt.type ?? 1;
    this.goodid = opt.id;
  },
  methods: {
    GetGoodDetail(id, type, opt) {
      let url = "/TkProduct/GetGoodDetail";
      if (type == "2") {
        url = "/TkJdProduct/GetJdGoodDetail";
      }
      this.requestx({
        url,
        method: "POST",
        data: {
          id
        }
      }).then((res) => {
        if (res.success) {
          let data2 = res.result;
          if (data2.detailPics) {
            let imgss = JSON.parse(data2.detailPics);
            let img = [];
            imgss.map((ii) => {
              img.push(ii.img);
            });
            data2.detailImages = img;
          }
          this.info = data2;
        } else {
          if (JSON.parse(decodeURIComponent(opt.info)).imgs && JSON.parse(decodeURIComponent(opt.info)).imgs.length > 0) {
            this.info = JSON.parse(decodeURIComponent(opt.info));
          } else {
            var data = JSON.parse(decodeURIComponent(opt.info));
            console.log(data);
            data.imgs = [data.mainPic];
            this.info = data;
          }
        }
      });
    },
    GetPrivilegeLink(id) {
      let me = this;
      let url = "/TkProduct/GetPrivilegeLink";
      let param = {
        id
      };
      if (me.type == "3") {
        url = "/TkTiktokProduct/GetTiktokProductShare";
        let prourl = me.info.detailUrl ? me.info.detailUrl : me.info.itemLink;
        param = {
          productUrl: prourl
        };
      } else if (me.type == "2") {
        url = "/TkJdProduct/GetTiktokProductShare";
        param = {
          productUrl: me.info.materialUrl
        };
      } else if (me.type == "4") {
        url = "/TkPddProduct/GetPddProductShare";
        let goodssign = me.info.goodsSign ? me.info.goodsSign : me.info.goods_sign;
        param = {
          id: goodssign
        };
      }
      this.requestx({
        url,
        method: "POST",
        data: param
      }).then((res) => {
        if (res.success) {
          if (me.type == "2") {
            let e = encodeURIComponent(res.result.shortUrl);
            common_vendor.index.navigateToMiniProgram({
              appId: "wx91d27dbf599dff74",
              path: "pages/union/proxy/proxy?spreadUrl=" + e + "&appid=wxb4e7e6d63908a36e",
              // 不填默认首页
              // extraData: {
              //     'data1': 'test'
              // },
              success(res2) {
              }
            });
          } else if (me.type == "4") {
            encodeURIComponent(res.result);
            common_vendor.index.navigateToMiniProgram({
              appId: "wx32540bd863b27570",
              path: res.result,
              success(res2) {
              }
            });
          } else {
            if (res.data) {
              let txt = res.data.result.longTpwd ?? res.data.result.dyPassword;
              me.copyText = txt;
              me.copy(txt);
            } else {
              let txt = res.result.longTpwd ?? res.result.dyPassword;
              me.copyText = txt;
              me.copy(txt);
            }
          }
        }
      });
    },
    copy(txt) {
      let title = this.type == "3" ? "复制口令成功,打开【抖音】领券购买" : "复制口令成功,打开【淘宝】领券购买";
      common_vendor.index.setClipboardData({
        data: txt,
        success(res) {
          common_vendor.index.showToast({
            title,
            icon: "none"
          });
        }
      });
    },
    imgNumCHange(val) {
      this.imgNum = val.detail.current + 1;
    }
  }
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  var _a, _b, _c, _d, _e, _f, _g;
  return common_vendor.e({
    a: common_vendor.f($data.info.imgs, (item, index, i0) => {
      return {
        a: item,
        b: index
      };
    }),
    b: common_vendor.o((...args) => $options.imgNumCHange && $options.imgNumCHange(...args)),
    c: ((_a = $data.info.imgs) == null ? void 0 : _a.length) > 0
  }, ((_b = $data.info.imgs) == null ? void 0 : _b.length) > 0 ? {
    d: common_vendor.t($data.imgNum),
    e: common_vendor.t($data.info.imgs.length)
  } : {}, {
    f: (_c = $data.info) == null ? void 0 : _c.subdivisionName
  }, ((_d = $data.info) == null ? void 0 : _d.subdivisionName) ? {
    g: common_vendor.t($data.info.subdivisionName),
    h: common_vendor.t($data.info.subdivisionRank)
  } : {}, {
    i: common_vendor.t($data.info.actualPrice == "0" ? $data.info.originalPrice : $data.info.actualPrice),
    j: Number($data.info.actualPrice) && Number($data.info.actualPrice) < Number($data.info.originalPrice)
  }, Number($data.info.actualPrice) && Number($data.info.actualPrice) < Number($data.info.originalPrice) ? {
    k: common_vendor.t($data.info.originalPrice)
  } : {}, {
    l: common_vendor.t($data.getNumData($data.info.monthSales ?? 0) + ($data.getNumData($data.info.monthSales) ? "+" : "")),
    m: ($data.info.shopType == 0 || $data.info.shopType == 1) && $data.type !== "2"
  }, ($data.info.shopType == 0 || $data.info.shopType == 1) && $data.type !== "2" ? {
    n: $data.info.shopType == 0 ? "https://img.alicdn.com/imgextra/i4/751308485/O1CN01ppfg8j2CYBRpPtb51_!!751308485.png" : "https://img.alicdn.com/imgextra/i4/751308485/O1CN01mKVp3U2CYBRzeHVcG_!!751308485.png"
  } : {}, {
    o: common_vendor.t((_e = $data.info) == null ? void 0 : _e.dtitle),
    p: $data.info.desc
  }, $data.info.desc ? {
    q: common_vendor.t($data.info.desc)
  } : {}, {
    r: $data.info.detailImages && ((_f = $data.info.detailImages) == null ? void 0 : _f[0]) !== ""
  }, $data.info.detailImages && ((_g = $data.info.detailImages) == null ? void 0 : _g[0]) !== "" ? {
    s: common_vendor.f($data.info.detailImages, (item, index, i0) => {
      return {
        a: item,
        b: item
      };
    })
  } : {}, {
    t: $data.type == 2 || $data.type == 4
  }, $data.type == 2 || $data.type == 4 ? common_vendor.e({
    v: common_vendor.t($data.info.actualPrice),
    w: Number($data.info.actualPrice) < Number($data.info.originalPrice)
  }, Number($data.info.actualPrice) < Number($data.info.originalPrice) ? {
    x: common_vendor.t($data.info.originalPrice)
  } : {}, {
    y: Number($data.info.actualPrice) < Number($data.info.originalPrice)
  }, Number($data.info.actualPrice) < Number($data.info.originalPrice) ? {} : {}, {
    z: common_vendor.o(($event) => $options.GetPrivilegeLink($data.goodid))
  }) : {
    A: common_vendor.o(($event) => $options.GetPrivilegeLink($data.goodid))
  });
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "E:/OPProject/TK_H5_Web/pages/goodDetail/index.vue"]]);
_sfc_main.__runtimeHooks = 6;
wx.createPage(MiniProgramPage);