|
|
@@ -3,7 +3,9 @@
|
|
3
|
3
|
import {
|
|
4
|
4
|
getDyProductDetail,
|
|
5
|
5
|
getJdProductDetail,
|
|
6
|
|
- getPddProductDetail, getShareId,
|
|
|
6
|
+ getJTTProductDetail,
|
|
|
7
|
+ getPddProductDetail,
|
|
|
8
|
+ getShareId,
|
|
7
|
9
|
getSuProductDetail,
|
|
8
|
10
|
getTaobaoProductDetail,
|
|
9
|
11
|
getVipProductDetail
|
|
|
@@ -14,6 +16,7 @@ import type {
|
|
14
|
16
|
DyProductModel,
|
|
15
|
17
|
IProductDetail,
|
|
16
|
18
|
JdProductDetailModel,
|
|
|
19
|
+
|
|
17
|
20
|
JdProductModel,
|
|
18
|
21
|
SuNingProductModel,
|
|
19
|
22
|
TaobaoProductThirdPartyWaresModel,
|
|
|
@@ -66,14 +69,17 @@ const props = defineProps({
|
|
66
|
69
|
|
|
67
|
70
|
const state = reactive({
|
|
68
|
71
|
data: {},
|
|
69
|
|
- shareId: ''
|
|
|
72
|
+ shareId: '',
|
|
|
73
|
+ pddData: {}
|
|
70
|
74
|
})
|
|
71
|
75
|
const isShow = ref(false)
|
|
72
|
76
|
const detail = ref<IProductDetail>()
|
|
73
|
77
|
const detailclone = ref<IProductDetail>()
|
|
|
78
|
+const isNeedAuth = ref(false)
|
|
74
|
79
|
onLoad((options: any) => {
|
|
75
|
80
|
|
|
76
|
81
|
const data: Partial<IProductDetail> = JSON.parse(decodeBase64(options.params))
|
|
|
82
|
+ state.pddData = data
|
|
77
|
83
|
// console.log('我是options数据', data) url: `/pages/store/product/other?platform=${item.type}&id=${item.id}`
|
|
78
|
84
|
userStore.setRedirectPage(`/pages/store/product/other?params=${encodeBase64(data)}`, 'page')
|
|
79
|
85
|
// if (options.platform && options.id) {
|
|
|
@@ -88,6 +94,13 @@ onLoad((options: any) => {
|
|
88
|
94
|
|
|
89
|
95
|
onShow(() => {
|
|
90
|
96
|
isSubmit.value = false
|
|
|
97
|
+
|
|
|
98
|
+ console.log('onshow----')
|
|
|
99
|
+ if (isNeedAuth.value) {
|
|
|
100
|
+ console.log('从授权进来的。。。。')
|
|
|
101
|
+ loadProductDetail(state.pddData)
|
|
|
102
|
+ isNeedAuth.value = false
|
|
|
103
|
+ }
|
|
91
|
104
|
})
|
|
92
|
105
|
|
|
93
|
106
|
//精品推荐
|
|
|
@@ -104,14 +117,18 @@ function YouLike() {
|
|
104
|
117
|
|
|
105
|
118
|
//商品不存在详情
|
|
106
|
119
|
function soldOut() {
|
|
|
120
|
+ console.log('1')
|
|
|
121
|
+ console.log(userStore.uid)
|
|
107
|
122
|
if (userStore.uid) {
|
|
108
|
123
|
isShow.value = true
|
|
|
124
|
+ console.log('2')
|
|
109
|
125
|
uni.setNavigationBarTitle({
|
|
110
|
126
|
title: '商品下架不存在'
|
|
111
|
127
|
})
|
|
112
|
128
|
loadList('reload')
|
|
113
|
129
|
uni.hideLoading()
|
|
114
|
130
|
} else {
|
|
|
131
|
+ console.log('3')
|
|
115
|
132
|
uni.showToast({
|
|
116
|
133
|
title: '请登录',
|
|
117
|
134
|
icon: 'none'
|
|
|
@@ -140,25 +157,50 @@ function loadProductDetail(product: Partial<IProductDetail>) {
|
|
140
|
157
|
|
|
141
|
158
|
// 京东
|
|
142
|
159
|
if (product.platform == 6) {
|
|
143
|
|
- getJdProductDetail(product.id).then(res => {
|
|
144
|
|
- console.log(res);
|
|
145
|
|
- let { data, status } = res
|
|
146
|
|
- if (status === 200) {
|
|
147
|
|
- const jdProduct = data[0]
|
|
148
|
|
- // console.log(jdProduct)
|
|
149
|
|
- mergeProductDetailclone({
|
|
150
|
|
- images: jdProduct.detail,
|
|
151
|
|
- coupon: {
|
|
152
|
|
- amount: jdProduct.couMoney
|
|
153
|
|
- },
|
|
154
|
|
- ...jdProduct
|
|
155
|
|
- })
|
|
156
|
|
-
|
|
157
|
|
- uni.hideLoading()
|
|
158
|
|
- } else {
|
|
159
|
|
- soldOut()
|
|
160
|
|
- }
|
|
161
|
|
- })
|
|
|
160
|
+
|
|
|
161
|
+ if (userStore.uid) { // 已登录的
|
|
|
162
|
+ getJdProductDetail(product.id).then(res => {
|
|
|
163
|
+ console.log('京东商品详情',res);
|
|
|
164
|
+ let { data, status } = res
|
|
|
165
|
+
|
|
|
166
|
+ const jdProduct = data[0]
|
|
|
167
|
+ // console.log(jdProduct)
|
|
|
168
|
+ mergeProductDetailclone({
|
|
|
169
|
+ images: jdProduct.detail,
|
|
|
170
|
+ coupon: {
|
|
|
171
|
+ amount: jdProduct.couMoney
|
|
|
172
|
+ },
|
|
|
173
|
+ ...jdProduct
|
|
|
174
|
+ })
|
|
|
175
|
+
|
|
|
176
|
+ uni.hideLoading()
|
|
|
177
|
+ })
|
|
|
178
|
+ } else { // 未登录的
|
|
|
179
|
+ getJTTProductDetail(product.id, 1).then(res => {
|
|
|
180
|
+ console.log('京东商品详情',res);
|
|
|
181
|
+ let { data, status } = res
|
|
|
182
|
+
|
|
|
183
|
+ const jdProduct = data[0]
|
|
|
184
|
+ // console.log(jdProduct)
|
|
|
185
|
+ mergeProductDetailclone({
|
|
|
186
|
+ images: jdProduct.detail,
|
|
|
187
|
+ coupon: {
|
|
|
188
|
+ amount: jdProduct.couMoney
|
|
|
189
|
+ },
|
|
|
190
|
+ ...jdProduct
|
|
|
191
|
+ })
|
|
|
192
|
+
|
|
|
193
|
+ uni.hideLoading()
|
|
|
194
|
+ })
|
|
|
195
|
+ }
|
|
|
196
|
+
|
|
|
197
|
+
|
|
|
198
|
+ // if (status === 200) {
|
|
|
199
|
+
|
|
|
200
|
+ // } else {
|
|
|
201
|
+ // soldOut()
|
|
|
202
|
+ // }
|
|
|
203
|
+
|
|
162
|
204
|
}
|
|
163
|
205
|
// 淘宝 *
|
|
164
|
206
|
if (product.platform === 5) {
|
|
|
@@ -187,7 +229,9 @@ function loadProductDetail(product: Partial<IProductDetail>) {
|
|
187
|
229
|
// 拼多多 *
|
|
188
|
230
|
if (product.platform == 1) {
|
|
189
|
231
|
getPddProductDetail(product.id).then(res => {
|
|
190
|
|
- // console.log(res);
|
|
|
232
|
+ console.log('res')
|
|
|
233
|
+ console.log(res)
|
|
|
234
|
+ console.log()
|
|
191
|
235
|
let { status, data } = res
|
|
192
|
236
|
// detail.value = res
|
|
193
|
237
|
if (status !== 200) {
|
|
|
@@ -337,14 +381,22 @@ function handleBuyNow() {
|
|
337
|
381
|
})
|
|
338
|
382
|
}
|
|
339
|
383
|
} else if (detail.value?.platform == 1) {
|
|
340
|
|
- // console.log(detail.value)
|
|
|
384
|
+ console.log(detail.value)
|
|
|
385
|
+
|
|
|
386
|
+ if (detail.value.pddlink.mobile_url.includes('mobile.yangkeduo')) {
|
|
|
387
|
+ isNeedAuth.value = true
|
|
|
388
|
+
|
|
|
389
|
+ console.log('需要授权')
|
|
|
390
|
+ }
|
|
|
391
|
+
|
|
|
392
|
+
|
|
341
|
393
|
const pddWx = detail.value.pddlink.wx
|
|
342
|
394
|
if (pddWx) {
|
|
343
|
395
|
uni.navigateToMiniProgram({
|
|
344
|
396
|
appId: pddWx.app_id,
|
|
345
|
397
|
path: pddWx.page_path,
|
|
346
|
398
|
// extraData: {
|
|
347
|
|
- // foo: 'bar'
|
|
|
399
|
+ // foo: 'bar'mobile_url: "https://p.pinduoduo.com/VHKD9VbP" mobile.yangkeduo
|
|
348
|
400
|
// },
|
|
349
|
401
|
envVersion: 'release',
|
|
350
|
402
|
success(res) {
|
|
|
@@ -400,10 +452,14 @@ function handleBuyNow() {
|
|
400
|
452
|
})*/
|
|
401
|
453
|
|
|
402
|
454
|
// }
|
|
403
|
|
- return uni.showToast({
|
|
404
|
|
- title: '商品维护中,请稍后再试',
|
|
405
|
|
- icon: 'none'
|
|
406
|
|
- })
|
|
|
455
|
+ if (detail.value?.platform == 6) {
|
|
|
456
|
+
|
|
|
457
|
+ } else {
|
|
|
458
|
+ return uni.showToast({
|
|
|
459
|
+ title: '商品维护中,请稍后再试',
|
|
|
460
|
+ icon: 'none'
|
|
|
461
|
+ })
|
|
|
462
|
+ }
|
|
407
|
463
|
}
|
|
408
|
464
|
}
|
|
409
|
465
|
/*
|