This commit is contained in:
parent
4cc64ef2ca
commit
42b171758e
|
|
@ -26,7 +26,7 @@
|
|||
methods: {
|
||||
getBottomBar() {
|
||||
uni.request({
|
||||
url: 'https://api.cmspro.haodanku.com/bottomBar/lists?cid=qOstW90',
|
||||
url: 'https://api.cmspro.haodanku.com/bottomBar/lists?cid=YsWZ21tx',
|
||||
success: (res) => {
|
||||
if (res.data && res.data.code === 200 && res.data.data.bottom_bar) {
|
||||
// 过滤并排序:剔除“发现”,仅保留首页、榜单、分类
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@
|
|||
},
|
||||
getCategoryTabs() {
|
||||
uni.request({
|
||||
url: 'https://api.cmspro.haodanku.com/index/superCategory?is_get_second=1&cid=qOstW90',
|
||||
url: 'https://api.cmspro.haodanku.com/index/superCategory?is_get_second=1&cid=YsWZ21tx',
|
||||
success: (res) => {
|
||||
if (res.data && res.data.code === 200) {
|
||||
// 映射为与首页一致的 navList 结构
|
||||
|
|
@ -192,7 +192,7 @@
|
|||
}
|
||||
|
||||
uni.request({
|
||||
url: `https://api.cmspro.haodanku.com/find/allItemList?category_id=${this.currentCatId}&page=${this.page}&sort=${sortParam}&page_size=20&cid=qOstW90`,
|
||||
url: `https://api.cmspro.haodanku.com/find/allItemList?category_id=${this.currentCatId}&page=${this.page}&sort=${sortParam}&page_size=20&cid=YsWZ21tx`,
|
||||
success: (res) => {
|
||||
if (res.data && res.data.code === 200 && res.data.data && res.data.data.item_info) {
|
||||
const list = res.data.data.item_info.map(item => ({
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@
|
|||
}
|
||||
|
||||
uni.request({
|
||||
url: `https://api.cmspro.haodanku.com/find/allItemList?category_id=${this.mainCatId}&son_category=${encodeURIComponent(this.secondCategory)}&page=${this.page}&sort=${sortParam}&page_size=20&cid=qOstW90${filterParams}`,
|
||||
url: `https://api.cmspro.haodanku.com/find/allItemList?category_id=${this.mainCatId}&son_category=${encodeURIComponent(this.secondCategory)}&page=${this.page}&sort=${sortParam}&page_size=20&cid=YsWZ21tx${filterParams}`,
|
||||
success: (res) => {
|
||||
if (res.data && res.data.code === 200 && res.data.data && res.data.data.item_info) {
|
||||
const list = res.data.data.item_info.map(item => ({
|
||||
|
|
@ -245,7 +245,7 @@
|
|||
if (this.filterIsTmall) recommendParams += '&min_id=1';
|
||||
|
||||
uni.request({
|
||||
url: `https://api.cmspro.haodanku.com/superSearch/getList?sort=0&page_size=20&category_id=${this.mainCatId}&son_category=${encodeURIComponent(this.secondCategory)}&cid=qOstW90${recommendParams}`,
|
||||
url: `https://api.cmspro.haodanku.com/superSearch/getList?sort=0&page_size=20&category_id=${this.mainCatId}&son_category=${encodeURIComponent(this.secondCategory)}&cid=YsWZ21tx${recommendParams}`,
|
||||
success: (res) => {
|
||||
if (res.data && res.data.code === 200 && res.data.data) {
|
||||
const list = res.data.data.map(item => ({
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@
|
|||
methods: {
|
||||
getSuperCategory() {
|
||||
uni.request({
|
||||
url: 'https://api.cmspro.haodanku.com/index/superCategory?cid=qOstW90',
|
||||
url: 'https://api.cmspro.haodanku.com/index/superCategory?cid=YsWZ21tx',
|
||||
header: {
|
||||
'accept': 'application/json, text/plain, */*',
|
||||
'accept-language': 'zh-CN,zh;q=0.9'
|
||||
|
|
@ -93,7 +93,7 @@
|
|||
matchNavActive() {
|
||||
// 获取底部导航数据,查找“分类”对应的索引
|
||||
uni.request({
|
||||
url: 'https://api.cmspro.haodanku.com/bottomBar/lists?cid=qOstW90',
|
||||
url: 'https://api.cmspro.haodanku.com/bottomBar/lists?cid=YsWZ21tx',
|
||||
success: (res) => {
|
||||
if (res.data && res.data.code === 200 && res.data.data.bottom_bar) {
|
||||
const allowedTitles = ['首页', '榜单', '分类'];
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@
|
|||
<view class="coupon-time">使用期限: {{ product.couponTime }}</view>
|
||||
</view>
|
||||
<view class="coupon-right">
|
||||
<view class="get-btn">立即领券</view>
|
||||
<view class="get-btn" @click="goBuy">立即领券</view>
|
||||
</view>
|
||||
<view class="coupon-circle top"></view>
|
||||
<view class="coupon-circle bottom"></view>
|
||||
|
|
@ -204,8 +204,8 @@
|
|||
</view>
|
||||
</view>
|
||||
<view class="bar-right">
|
||||
<view class="copy-btn">复制口令购买</view>
|
||||
<view class="buy-btn">领券购买</view>
|
||||
<view class="copy-btn" @click="copyTaoWord">复制口令购买</view>
|
||||
<view class="buy-btn" @click="goBuy">领券购买</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -265,7 +265,7 @@
|
|||
methods: {
|
||||
getDetailData() {
|
||||
uni.request({
|
||||
url: `https://api.cmspro.haodanku.com/detail/itemInfo?id=${this.product.id}&cid=qOstW90`,
|
||||
url: `https://api.cmspro.haodanku.com/detail/itemInfo?id=${this.product.id}&cid=YsWZ21tx`,
|
||||
success: (res) => {
|
||||
if (res.data && res.data.code === 200) {
|
||||
const d = res.data.data;
|
||||
|
|
@ -355,6 +355,7 @@
|
|||
detailImages: detailImages,
|
||||
activity: d.activity_info,
|
||||
activityTime: activityTime,
|
||||
activityId: (d.activity_info && d.activity_info.activityid) || d.activityid || '',
|
||||
commission: d.tkmoney,
|
||||
taobaoId: d.itemid,
|
||||
sonCategory: d.son_category
|
||||
|
|
@ -362,13 +363,41 @@
|
|||
|
||||
// 获取同类推荐 (使用 itemid 和 son_category)
|
||||
this.getSimilarProducts(d.itemid, d.son_category);
|
||||
// 加载完商品后请求淘口令 / 领券链接
|
||||
this.fetchTaoWord();
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
fetchTaoWord() {
|
||||
if (!this.product.taobaoId) return;
|
||||
uni.request({
|
||||
url: 'https://api.cmspro.haodanku.com/taobao/getTaoWord',
|
||||
method: 'POST',
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
data: {
|
||||
domain: 'cms.baimajiayuanjiankang.com',
|
||||
itemid: this.product.taobaoId,
|
||||
activityid: this.product.activityId || '',
|
||||
title: this.product.title || '',
|
||||
relation_id: '2887601176',
|
||||
cid: 'YsWZ21tx'
|
||||
},
|
||||
success: (res) => {
|
||||
const body = res.data || {};
|
||||
if (body.code === 200 && body.data) {
|
||||
this.product.taoCode = body.data.tao_code || '';
|
||||
this.product.spreadUrl = body.data.spread_url || '';
|
||||
this.product.couponUrl = body.data.coupon_url || '';
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
getSimilarProducts(itemId, sonCategory) {
|
||||
uni.request({
|
||||
url: `https://api.cmspro.haodanku.com/detail/getRecommendItems?itemid=${itemId}&son_category=${sonCategory}&cid=qOstW90`,
|
||||
url: `https://api.cmspro.haodanku.com/detail/getRecommendItems?itemid=${itemId}&son_category=${sonCategory}&cid=YsWZ21tx`,
|
||||
success: (res) => {
|
||||
if (res.data && res.data.code === 200) {
|
||||
this.similarProducts = res.data.data.slice(0, 10);
|
||||
|
|
@ -390,6 +419,39 @@
|
|||
goBack() {
|
||||
uni.navigateBack();
|
||||
},
|
||||
copyTaoWord() {
|
||||
if (!this.product.taoCode) {
|
||||
uni.showToast({ title: '口令加载中,请稍候', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
uni.setClipboardData({
|
||||
data: this.product.taoCode,
|
||||
success: () => {
|
||||
uni.showToast({ title: '淘口令已复制', icon: 'success' });
|
||||
},
|
||||
fail: () => {
|
||||
uni.showToast({ title: '复制失败', icon: 'none' });
|
||||
}
|
||||
});
|
||||
},
|
||||
goBuy() {
|
||||
const url = this.product.couponUrl;
|
||||
if (!url) {
|
||||
uni.showToast({ title: '链接加载中,请稍候', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
// #ifdef H5
|
||||
window.location.href = url;
|
||||
// #endif
|
||||
// #ifndef H5
|
||||
uni.setClipboardData({
|
||||
data: url,
|
||||
success: () => {
|
||||
uni.showToast({ title: '链接已复制,请到浏览器打开', icon: 'none' });
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
},
|
||||
handleScroll(e) {
|
||||
const scrollTop = e.detail.scrollTop;
|
||||
// 0-150px 完成渐变
|
||||
|
|
|
|||
|
|
@ -341,7 +341,7 @@
|
|||
},
|
||||
getIndexData() {
|
||||
uni.request({
|
||||
url: 'https://api.cmspro.haodanku.com/index/index?cid=qOstW90',
|
||||
url: 'https://api.cmspro.haodanku.com/index/index?cid=YsWZ21tx',
|
||||
success: (res) => {
|
||||
if (res.data && res.data.code === 200 && res.data.data.navs) {
|
||||
this.menus = res.data.data.navs;
|
||||
|
|
@ -358,7 +358,7 @@
|
|||
|
||||
getCategoryList() {
|
||||
uni.request({
|
||||
url: 'https://api.cmspro.haodanku.com/index/category?cid=qOstW90',
|
||||
url: 'https://api.cmspro.haodanku.com/index/category?cid=YsWZ21tx',
|
||||
success: (res) => {
|
||||
if (res.data && res.data.code === 200 && res.data.data.category) {
|
||||
this.navList = [{ name: '首页', cat_id: 0 }, { name: '推荐', cat_id: -1 }, ...res.data.data.category];
|
||||
|
|
@ -368,7 +368,7 @@
|
|||
},
|
||||
getNoticeList() {
|
||||
uni.request({
|
||||
url: 'https://api.cmspro.haodanku.com/msg/getMsgs?cid=qOstW90',
|
||||
url: 'https://api.cmspro.haodanku.com/msg/getMsgs?cid=YsWZ21tx',
|
||||
success: (res) => {
|
||||
if (res.data && res.data.code === 200) {
|
||||
this.noticeList = res.data.data.msgs;
|
||||
|
|
@ -378,7 +378,7 @@
|
|||
},
|
||||
getGoodsList() {
|
||||
uni.request({
|
||||
url: 'https://api.cmspro.haodanku.com/recommend/getRecommend?page_size=200&page=1&type=2&cid=qOstW90',
|
||||
url: 'https://api.cmspro.haodanku.com/recommend/getRecommend?page_size=200&page=1&type=2&cid=YsWZ21tx',
|
||||
success: (res) => {
|
||||
if (res.data && res.data.code === 200) {
|
||||
const list = res.data.data.recommends.map(item => {
|
||||
|
|
@ -407,7 +407,7 @@
|
|||
},
|
||||
getWorthBuyLists() {
|
||||
uni.request({
|
||||
url: 'https://api.cmspro.haodanku.com/index/deserveLists?cid=qOstW90',
|
||||
url: 'https://api.cmspro.haodanku.com/index/deserveLists?cid=YsWZ21tx',
|
||||
success: (res) => {
|
||||
if (res.data && res.data.code === 200) {
|
||||
const formatData = (list) => {
|
||||
|
|
@ -434,7 +434,7 @@
|
|||
},
|
||||
getBrandSaleList() {
|
||||
uni.request({
|
||||
url: 'https://api.cmspro.haodanku.com/brandItem/choiceness?cid=qOstW90',
|
||||
url: 'https://api.cmspro.haodanku.com/brandItem/choiceness?cid=YsWZ21tx',
|
||||
success: (res) => {
|
||||
if (res.data && res.data.code === 200 && res.data.data.brand_prefecture) {
|
||||
this.brandSaleShops = res.data.data.brand_prefecture.map(shop => ({
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@
|
|||
category_id: this.currentCateId,
|
||||
page: this.page,
|
||||
page_size: 60,
|
||||
cid: 'qOstW90'
|
||||
cid: 'YsWZ21tx'
|
||||
},
|
||||
success: (res) => {
|
||||
if (res.data && res.data.code === 200 && res.data.data && res.data.data.list_item && res.data.data.list_item.list) {
|
||||
|
|
|
|||
|
|
@ -251,7 +251,7 @@
|
|||
},
|
||||
getRankingList() {
|
||||
uni.request({
|
||||
url: 'https://api.cmspro.haodanku.com/search/searchRankingList?cid=qOstW90',
|
||||
url: 'https://api.cmspro.haodanku.com/search/searchRankingList?cid=YsWZ21tx',
|
||||
success: (res) => {
|
||||
if (res.data && res.data.code === 200 && res.data.data.ranking_list) {
|
||||
this.rankingList = res.data.data.ranking_list.slice(0, 10);
|
||||
|
|
@ -261,7 +261,7 @@
|
|||
},
|
||||
getHotThemes() {
|
||||
uni.request({
|
||||
url: 'https://api.cmspro.haodanku.com/index/hotTheme?cid=qOstW90',
|
||||
url: 'https://api.cmspro.haodanku.com/index/hotTheme?cid=YsWZ21tx',
|
||||
success: (res) => {
|
||||
if (res.data && res.data.code === 200) {
|
||||
this.hotThemes = res.data.data.slice(0, 10);
|
||||
|
|
@ -308,7 +308,7 @@
|
|||
page_size: this.pageSize,
|
||||
keyword: encodeURIComponent(word), // 双重编码:data 序列化时会再次 encode
|
||||
sort: sortParam,
|
||||
cid: 'qOstW90'
|
||||
cid: 'YsWZ21tx'
|
||||
};
|
||||
if (this.filterHasCoupon) data.filtrate_type = 16;
|
||||
if (this.filterIsBrand) data.is_brand = 1;
|
||||
|
|
|
|||
Loading…
Reference in New Issue