"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);