zhaojs
2023-04-25 f38ca22088b7a0de7e7db316c564b4bf7526f105
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
"use strict";
const common_vendor = require("../../common/vendor.js");
const common_util = require("../../common/util.js");
const _sfc_main = {
  data() {
    return {
      getNumData: common_util.getNumData,
      goodid: "",
      info: {},
      copyText: "",
      hasGet: false,
      type: 1,
      routerr: "",
      imgNum: 1
    };
  },
  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 me = this;
      let url = "https://h.ushopvip.com/api/TkProduct/GetGoodDetail";
      if (type == "2") {
        url = "https://h.ushopvip.com/api/TkJdProduct/GetJdGoodDetail";
      }
      common_vendor.index.request({
        url,
        method: "POST",
        data: {
          id
        },
        success(res) {
          if (res.data.success) {
            let data = res.data.result;
            if (data.detailPics) {
              let imgss = JSON.parse(data.detailPics);
              let img = [];
              imgss.map((ii) => {
                img.push(ii.img);
              });
              data.detailImages = img;
            }
            me.info = data;
          } else {
            if (JSON.parse(decodeURIComponent(opt.info)).imgs && JSON.parse(decodeURIComponent(opt.info)).imgs.length > 0) {
              me.info = JSON.parse(decodeURIComponent(opt.info));
            } else {
              let data = JSON.parse(decodeURIComponent(opt.info));
              data.imgs = [data.mainPic];
              me.info = data;
            }
          }
        },
        fail(err) {
          console.log("GetGoodDetail失败:", err);
        }
      });
    },
    GetPrivilegeLink(id) {
      let me = this;
      let url = "https://h.ushopvip.com/api/TkProduct/GetPrivilegeLink";
      let param = {
        id
      };
      if (me.type == "3") {
        url = "https://h.ushopvip.com/api/TkTiktokProduct/GetTiktokProductShare";
        param = {
          productUrl: me.info.detailUrl
        };
      } else if (me.type == "2") {
        url = "https://h.ushopvip.com/api/TkJdProduct/GetTiktokProductShare";
        param = {
          productUrl: me.info.materialUrl
        };
      } else if (me.type == "4") {
        url = "https://h.ushopvip.com/api/TkPddProduct/GetPddProductShare";
        param = {
          id: me.info.goodsSign
        };
      }
      common_vendor.index.request({
        url,
        method: "POST",
        data: param,
        success(res) {
          if (res.data.success) {
            if (me.type == "2") {
              let e = encodeURIComponent(res.data.result.shortUrl);
              common_vendor.index.navigateToMiniProgram({
                appId: "wx91d27dbf599dff74",
                path: "pages/union/proxy/proxy?spreadUrl=" + e + "&appid=wx12f06ec7a21748bc",
                // 不填默认首页
                // extraData: {
                //     'data1': 'test'
                // },
                success(res2) {
                }
              });
            } else if (me.type == "4") {
              encodeURIComponent(res.data.result);
              common_vendor.index.navigateToMiniProgram({
                appId: "wxa918198f16869201",
                path: res.data.result,
                success(res2) {
                }
              });
            } else {
              let txt = res.data.result.longTpwd ?? res.data.result.dyPassword;
              me.copyText = txt;
              me.copy(txt);
            }
          }
        },
        fail(err) {
          console.log("GetPrivilegeLink失败:", err);
        }
      });
    },
    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", "D:/项目/Yfcodes/crm_app_new/pages/goodDetail/index.vue"]]);
_sfc_main.__runtimeHooks = 6;
wx.createPage(MiniProgramPage);