"use strict";
|
const common_vendor = require("../../common/vendor.js");
|
const common_tk_api = require("../../common/tk_api.js");
|
require("../../common/tk_index.js");
|
const _sfc_main = {
|
data() {
|
return {
|
api: common_tk_api.api,
|
goodsItem: [],
|
loading: false,
|
isshowfan: false,
|
plat: [
|
{
|
"platname": "淘宝",
|
"plat": "tb",
|
"choose": true
|
},
|
{
|
"platname": "京东",
|
"plat": "jd",
|
"choose": true
|
},
|
{
|
"platname": "抖音",
|
"plat": "dy",
|
"choose": true
|
},
|
{
|
"platname": "拼多多",
|
"plat": "pdd",
|
"choose": true
|
}
|
],
|
txtareatxt: "",
|
issearch: false,
|
showTxt: "猜你喜欢",
|
txtplaceholder: "1、支持淘宝、天猫、京东、抖音、拼多多等平台\r\n2、请粘贴您需要转换的分享文案/链接和口令/商品链接;不支持券链接"
|
};
|
},
|
onShareAppMessage: function() {
|
return {
|
title: "搜优惠券",
|
path: "/pages/comparePrice/index"
|
// promise
|
};
|
},
|
onShareTimeline() {
|
return {
|
title: "搜优惠券",
|
path: "/pages/comparePrice/index"
|
};
|
},
|
onLoad(options) {
|
var postData = {
|
postData: "OAID",
|
deviceValue: ""
|
};
|
this.likeDataGet(postData);
|
},
|
methods: {
|
changeplat(item) {
|
var index = this.plat.findIndex((i) => i.plat == item.plat);
|
item.choose = !item.choose;
|
this.plat[index] = item;
|
this.search();
|
},
|
//查询
|
search() {
|
if (this.txtareatxt == "") {
|
return;
|
}
|
this.showTxt = "查询结果";
|
this.goodsItem = [];
|
var that = this;
|
var postData = {
|
content: that.txtareatxt
|
};
|
common_vendor.index.showLoading({
|
title: "加载中",
|
mask: true
|
});
|
var cancelPlat = this.plat.filter((i2) => !i2.choose);
|
if (cancelPlat && cancelPlat.length > 0) {
|
for (var i = 0; i < cancelPlat.length; i++) {
|
switch (cancelPlat[i].plat) {
|
case "tb":
|
postData.exclude_tb = 1;
|
break;
|
case "jd":
|
postData.exclude_jd = 1;
|
break;
|
case "pdd":
|
postData.exclude_pdd = 1;
|
break;
|
case "dy":
|
postData.exclude_dy = 1;
|
break;
|
}
|
}
|
}
|
this.api.post("/api/taoke/compare_good", postData).then((e) => {
|
common_vendor.index.hideLoading();
|
if (e.code != 0) {
|
common_vendor.index.showToast({
|
title: e.data.msg,
|
icon: "none"
|
});
|
return;
|
}
|
that.issearch = true;
|
if (e.code == 0) {
|
that.goodsItem = e.data.list;
|
}
|
}).catch(function(err) {
|
console.log(err);
|
});
|
},
|
Infoformat(info) {
|
info = info.replace(/\%/g, "%25");
|
info = info.replace(/\#/g, "%23");
|
info = info.replace(/\&/g, "%26");
|
info = info.replace(/\?/g, "%3F");
|
return info;
|
},
|
handleCdetailFavorite(item) {
|
var type = 1;
|
switch (item.sourceType) {
|
case "jd":
|
type = 2;
|
break;
|
case "dy":
|
type = 3;
|
break;
|
case "pdd":
|
type = 4;
|
break;
|
}
|
var itemsStr = encodeURIComponent(JSON.stringify(item));
|
console.log("/pages/goodDetail/index?type=" + type + "&id=" + item.goodsId + "&info=" + itemsStr);
|
common_vendor.index.navigateTo({
|
url: "/pages/goodDetail/index?type=" + type + "&id=" + item.goodsId + "&info=" + itemsStr
|
});
|
},
|
likeDataGet(postData) {
|
var _this = this;
|
var data = {
|
deviceType: postData.postData,
|
deviceValue: postData.deviceValue,
|
pageId: 1,
|
pageSize: 10,
|
type: 1
|
};
|
common_vendor.index.showLoading({
|
title: "加载中",
|
mask: true
|
});
|
this.api.post("/api/taoke/get_goods_things", data).then((e) => {
|
common_vendor.index.hideLoading();
|
if (e.code != 0) {
|
common_vendor.index.showToast({
|
title: e.data.msg,
|
icon: "none"
|
});
|
return;
|
}
|
_this.goodsItem = e.data.list;
|
}).catch(function(err) {
|
console.log(err);
|
});
|
},
|
clear() {
|
this.txtareatxt = "";
|
},
|
fromcopy() {
|
var that = this;
|
common_vendor.index.getClipboardData({
|
success: function(res) {
|
if (res && res.data && res.data.length > 0) {
|
that.txtareatxt = res.data;
|
}
|
}
|
});
|
}
|
}
|
};
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
return common_vendor.e({
|
a: $data.loading
|
}, $data.loading ? {} : {}, {
|
b: common_vendor.o(($event) => $options.clear()),
|
c: common_vendor.o(($event) => $options.fromcopy()),
|
d: $data.txtplaceholder,
|
e: $data.txtareatxt,
|
f: common_vendor.o(($event) => $data.txtareatxt = $event.detail.value),
|
g: common_vendor.o(($event) => $options.search()),
|
h: common_vendor.t($data.showTxt),
|
i: $data.goodsItem.length == 0
|
}, $data.goodsItem.length == 0 ? {} : common_vendor.e({
|
j: $data.issearch
|
}, $data.issearch ? {
|
k: common_vendor.f($data.plat, (item, k0, i0) => {
|
return common_vendor.e({
|
a: item.choose
|
}, item.choose ? {
|
b: common_vendor.t(item.platname)
|
} : {
|
c: common_vendor.t(item.platname)
|
}, {
|
d: common_vendor.o(($event) => $options.changeplat(item)),
|
e: common_vendor.n(item.choose ? "plat-ite" : "plat-unite")
|
});
|
})
|
} : {}, {
|
l: common_vendor.f($data.goodsItem, (g, k0, i0) => {
|
return common_vendor.e({
|
a: g.mainPic,
|
b: common_vendor.n(g.sourceType == "dy" ? "shoplabel___dy" : "shoplabel___1_Nv0"),
|
c: g.labelImg,
|
d: common_vendor.t(g.title),
|
e: g.couponPrice
|
}, g.couponPrice ? {
|
f: common_vendor.t(g.couponPrice)
|
} : {}, $data.isshowfan ? {
|
g: common_vendor.t(g.fanli)
|
} : {}, {
|
h: common_vendor.t(g.actualPrice),
|
i: g.sourceType == "tb" || g.sourceType == "tm"
|
}, g.sourceType == "tb" || g.sourceType == "tm" ? {
|
j: common_vendor.t(g.originalPrice)
|
} : {}, {
|
k: common_vendor.t(g.monthSales),
|
l: common_vendor.t(g.shopName),
|
m: g.id,
|
n: common_vendor.o(($event) => $options.handleCdetailFavorite(g), g.id)
|
});
|
}),
|
m: $data.isshowfan
|
}));
|
}
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "E:/OPProject/TK_H5_Web/pages/comparePrice/index.vue"]]);
|
_sfc_main.__runtimeHooks = 6;
|
wx.createPage(MiniProgramPage);
|