|
|
@@ -1,50 +1,53 @@
|
|
1
|
1
|
<script setup lang="ts">
|
|
2
|
2
|
// import mpHtml from 'mp-html/dist/uni-app/components/mp-html/mp-html'
|
|
|
3
|
+import { merge } from 'lodash-es'
|
|
|
4
|
+import dayjs from 'dayjs'
|
|
3
|
5
|
import {
|
|
4
|
6
|
getDyProductDetail,
|
|
5
|
|
- getJdProductDetail,
|
|
6
|
7
|
getJTTProductDetail,
|
|
7
|
|
- getPddProductDetail,
|
|
|
8
|
+ getJdProductDetail,
|
|
|
9
|
+ getPddProductDetail,
|
|
8
|
10
|
getShareId,
|
|
9
|
11
|
getSuProductDetail,
|
|
10
|
12
|
getTaobaoProductDetail,
|
|
11
|
|
- getVipProductDetail
|
|
12
|
|
-} from "~/apis/product";
|
|
13
|
|
-import CXBBasePage from "~/components/CXBBasePage/CXBBasePage.vue";
|
|
14
|
|
-import MerchantProductCard from "~/pages/store/home/components/MerchantProductCard.vue";
|
|
|
13
|
+ getVipProductDetail,
|
|
|
14
|
+} from '~/apis/product'
|
|
|
15
|
+import CXBBasePage from '~/components/CXBBasePage/CXBBasePage.vue'
|
|
|
16
|
+import MerchantProductCard from '~/pages/store/home/components/MerchantProductCard.vue'
|
|
15
|
17
|
import type {
|
|
16
|
18
|
DyProductModel,
|
|
17
|
19
|
IProductDetail,
|
|
18
|
20
|
JdProductDetailModel,
|
|
19
|
|
-
|
|
|
21
|
+
|
|
20
|
22
|
JdProductModel,
|
|
21
|
23
|
SuNingProductModel,
|
|
22
|
24
|
TaobaoProductThirdPartyWaresModel,
|
|
23
|
25
|
TaobaoWaresDetail,
|
|
24
|
|
- VipProductModel
|
|
25
|
|
-} from "~/apis/model/product.model";
|
|
26
|
|
-import FPrice from "~/components/FPrice/FPrice.vue";
|
|
27
|
|
-import FButton from "~/components/FButton/FButton.vue";
|
|
28
|
|
-import CXBButton from "~/components/CXBButton/CXBButton.vue";
|
|
29
|
|
-import CXBBackTop from "~/components/CXBBackTop/CXBBackTop.vue";
|
|
30
|
|
-import { debounce, merge } from "lodash-es";
|
|
31
|
|
-
|
|
32
|
|
-import { useDebounceFn } from '@vueuse/core';
|
|
33
|
|
-import dayjs from "dayjs";
|
|
34
|
|
-import { decodeBase64, encodeBase64 } from "~/utils/http/helper";
|
|
35
|
|
-import { CDN_URL, CDM_URL } from "~/config/app";
|
|
36
|
|
-import { getRecommendList } from "~/apis/merchant";
|
|
37
|
|
-import type { DcProductModel } from "~/apis/model/dacang.model";
|
|
38
|
|
-
|
|
39
|
|
-const discount_coupon_bg_220804Image = CDN_URL + '/static/assets/discount_coupon_bg_220804.png'
|
|
|
26
|
+ VipProductModel,
|
|
|
27
|
+} from '~/apis/model/product.model'
|
|
|
28
|
+import FPrice from '~/components/FPrice/FPrice.vue'
|
|
|
29
|
+import CXBBackTop from '~/components/CXBBackTop/CXBBackTop.vue'
|
|
|
30
|
+
|
|
|
31
|
+import { decodeBase64, encodeBase64 } from '~/utils/http/helper'
|
|
|
32
|
+import { CDM_URL, CDN_URL } from '~/config/app'
|
|
|
33
|
+import { getRecommendList } from '~/apis/merchant'
|
|
|
34
|
+import type { DcProductModel } from '~/apis/model/dacang.model'
|
|
|
35
|
+
|
|
|
36
|
+const props = defineProps({
|
|
|
37
|
+ type: {
|
|
|
38
|
+ type: Number,
|
|
|
39
|
+ default: 0,
|
|
|
40
|
+ },
|
|
|
41
|
+})
|
|
|
42
|
+const discount_coupon_bg_220804Image = `${CDN_URL}/static/assets/discount_coupon_bg_220804.png`
|
|
40
|
43
|
const productId = ref('')
|
|
41
|
|
-//推荐商品列表
|
|
42
|
|
-let skuInfo = reactive({
|
|
|
44
|
+// 推荐商品列表
|
|
|
45
|
+const skuInfo = reactive({
|
|
43
|
46
|
recommendList: [],
|
|
44
|
47
|
totalPage: 0,
|
|
45
|
48
|
pageSize: 10,
|
|
46
|
49
|
status: '',
|
|
47
|
|
- currentPage: 1
|
|
|
50
|
+ currentPage: 1,
|
|
48
|
51
|
})
|
|
49
|
52
|
|
|
50
|
53
|
const userStore = useUserStore()
|
|
|
@@ -56,28 +59,20 @@ const coupon = ref({
|
|
56
|
59
|
money: '',
|
|
57
|
60
|
// 优惠券有效期
|
|
58
|
61
|
startTime: '',
|
|
59
|
|
- endTime: ''
|
|
|
62
|
+ endTime: '',
|
|
60
|
63
|
})
|
|
61
|
64
|
const productDetail = ref<JdProductDetailModel | TaobaoWaresDetail>()
|
|
62
|
65
|
|
|
63
|
|
-const props = defineProps({
|
|
64
|
|
- type: {
|
|
65
|
|
- type: Number,
|
|
66
|
|
- default: 0
|
|
67
|
|
- }
|
|
68
|
|
-})
|
|
69
|
|
-
|
|
70
|
66
|
const state = reactive({
|
|
71
|
67
|
data: {},
|
|
72
|
68
|
shareId: '',
|
|
73
|
|
- pddData: {}
|
|
|
69
|
+ pddData: {},
|
|
74
|
70
|
})
|
|
75
|
71
|
const isShow = ref(false)
|
|
76
|
72
|
const detail = ref<IProductDetail>()
|
|
77
|
73
|
const detailclone = ref<IProductDetail>()
|
|
78
|
74
|
const isNeedAuth = ref(false)
|
|
79
|
75
|
onLoad((options: any) => {
|
|
80
|
|
-
|
|
81
|
76
|
const data: Partial<IProductDetail> = JSON.parse(decodeBase64(options.params))
|
|
82
|
77
|
state.pddData = data
|
|
83
|
78
|
// console.log('我是options数据', data) url: `/pages/store/product/other?platform=${item.type}&id=${item.id}`
|
|
|
@@ -85,7 +80,7 @@ onLoad((options: any) => {
|
|
85
|
80
|
// if (options.platform && options.id) {
|
|
86
|
81
|
uni.showLoading({
|
|
87
|
82
|
title: '数据加载中',
|
|
88
|
|
- icon: 'none'
|
|
|
83
|
+ icon: 'none',
|
|
89
|
84
|
})
|
|
90
|
85
|
mergeProductDetail(data)
|
|
91
|
86
|
loadProductDetail(data)
|
|
|
@@ -94,62 +89,59 @@ onLoad((options: any) => {
|
|
94
|
89
|
|
|
95
|
90
|
onShow(() => {
|
|
96
|
91
|
isSubmit.value = false
|
|
97
|
|
-
|
|
98
|
|
- console.log('onshow----')
|
|
99
|
|
- if (isNeedAuth.value) {
|
|
100
|
|
- console.log('从授权进来的。。。。')
|
|
101
|
|
- loadProductDetail(state.pddData)
|
|
102
|
|
- isNeedAuth.value = false
|
|
103
|
|
- }
|
|
|
92
|
+
|
|
|
93
|
+ console.log('onshow----')
|
|
|
94
|
+ if (isNeedAuth.value) {
|
|
|
95
|
+ console.log('从授权进来的。。。。')
|
|
|
96
|
+ loadProductDetail(state.pddData)
|
|
|
97
|
+ isNeedAuth.value = false
|
|
|
98
|
+ }
|
|
104
|
99
|
})
|
|
105
|
100
|
|
|
106
|
|
-//精品推荐
|
|
|
101
|
+// 精品推荐
|
|
107
|
102
|
function YouLike() {
|
|
108
|
103
|
getRecommendList({
|
|
109
|
104
|
page: 1,
|
|
110
|
|
- limit: 10
|
|
111
|
|
- }).then(res => {
|
|
|
105
|
+ limit: 10,
|
|
|
106
|
+ }).then((res) => {
|
|
112
|
107
|
skuInfo.recommendList = res.list
|
|
113
|
108
|
// console.log(skuInfo.recommendList);
|
|
114
|
|
-
|
|
115
|
109
|
})
|
|
116
|
110
|
}
|
|
117
|
111
|
|
|
118
|
|
-//商品不存在详情
|
|
|
112
|
+// 商品不存在详情
|
|
119
|
113
|
function soldOut() {
|
|
120
|
|
- console.log('1')
|
|
121
|
|
- console.log(userStore.uid)
|
|
|
114
|
+ console.log('1')
|
|
|
115
|
+ console.log(userStore.uid)
|
|
122
|
116
|
if (userStore.uid) {
|
|
123
|
117
|
isShow.value = true
|
|
124
|
|
- console.log('2')
|
|
|
118
|
+ console.log('2')
|
|
125
|
119
|
uni.setNavigationBarTitle({
|
|
126
|
|
- title: '商品下架不存在'
|
|
|
120
|
+ title: '商品下架不存在',
|
|
127
|
121
|
})
|
|
128
|
122
|
loadList('reload')
|
|
129
|
123
|
uni.hideLoading()
|
|
130
|
|
- } else {
|
|
|
124
|
+ }
|
|
|
125
|
+ else {
|
|
131
|
126
|
console.log('3')
|
|
132
|
127
|
uni.showToast({
|
|
133
|
128
|
title: '请登录',
|
|
134
|
|
- icon: 'none'
|
|
|
129
|
+ icon: 'none',
|
|
135
|
130
|
})
|
|
136
|
131
|
setTimeout(() => {
|
|
137
|
132
|
uni.redirectTo({
|
|
138
|
|
- url: '/pages/user/login/index?key=4'
|
|
|
133
|
+ url: '/pages/user/login/index?key=4',
|
|
139
|
134
|
})
|
|
140
|
135
|
}, 500)
|
|
141
|
136
|
}
|
|
142
|
|
-
|
|
143
|
137
|
}
|
|
144
|
138
|
|
|
145
|
139
|
function mergeProductDetail(data: Partial<IProductDetail> = {}) {
|
|
146
|
140
|
detailclone.value = merge(detailclone.value, data)
|
|
147
|
|
-
|
|
148
|
141
|
}
|
|
149
|
142
|
function mergeProductDetailclone(data: Partial<IProductDetail> = {}) {
|
|
150
|
143
|
detail.value = merge(detailclone.value, data)
|
|
151
|
144
|
// console.log(detail.value);
|
|
152
|
|
-
|
|
153
|
145
|
}
|
|
154
|
146
|
|
|
155
|
147
|
function loadProductDetail(product: Partial<IProductDetail>) {
|
|
|
@@ -157,92 +149,90 @@ function loadProductDetail(product: Partial<IProductDetail>) {
|
|
157
|
149
|
|
|
158
|
150
|
// 京东
|
|
159
|
151
|
if (product.platform == 6) {
|
|
160
|
|
-
|
|
161
|
152
|
if (userStore.uid) { // 已登录的
|
|
162
|
|
- getJdProductDetail(product.id).then(res => {
|
|
163
|
|
- console.log('京东商品详情',res);
|
|
164
|
|
- let { data, status } = res
|
|
165
|
|
-
|
|
|
153
|
+ getJdProductDetail(product.id).then((res) => {
|
|
|
154
|
+ console.log('京东商品详情', res)
|
|
|
155
|
+ const { data, status } = res
|
|
|
156
|
+
|
|
166
|
157
|
const jdProduct = data[0]
|
|
167
|
158
|
// console.log(jdProduct)
|
|
168
|
159
|
mergeProductDetailclone({
|
|
169
|
160
|
images: jdProduct.detail,
|
|
170
|
161
|
coupon: {
|
|
171
|
|
- amount: jdProduct.couMoney
|
|
|
162
|
+ amount: jdProduct.couMoney,
|
|
172
|
163
|
},
|
|
173
|
|
- ...jdProduct
|
|
|
164
|
+ ...jdProduct,
|
|
174
|
165
|
})
|
|
175
|
|
-
|
|
|
166
|
+
|
|
176
|
167
|
uni.hideLoading()
|
|
177
|
|
- })
|
|
178
|
|
- } else { // 未登录的
|
|
179
|
|
- getJTTProductDetail(product.id, 1).then(res => {
|
|
180
|
|
- console.log('京东商品详情',res);
|
|
181
|
|
- let { data, status } = res
|
|
182
|
|
-
|
|
|
168
|
+ })
|
|
|
169
|
+ }
|
|
|
170
|
+ else { // 未登录的
|
|
|
171
|
+ getJTTProductDetail(product.id, 1).then((res) => {
|
|
|
172
|
+ console.log('京东商品详情', res)
|
|
|
173
|
+ const { data, status } = res
|
|
|
174
|
+
|
|
183
|
175
|
const jdProduct = data[0]
|
|
184
|
176
|
// console.log(jdProduct)
|
|
185
|
177
|
mergeProductDetailclone({
|
|
186
|
178
|
images: jdProduct.detail,
|
|
187
|
179
|
coupon: {
|
|
188
|
|
- amount: jdProduct.couMoney
|
|
|
180
|
+ amount: jdProduct.couMoney,
|
|
189
|
181
|
},
|
|
190
|
|
- ...jdProduct
|
|
|
182
|
+ ...jdProduct,
|
|
191
|
183
|
})
|
|
192
|
|
-
|
|
|
184
|
+
|
|
193
|
185
|
uni.hideLoading()
|
|
194
|
|
- })
|
|
|
186
|
+ })
|
|
195
|
187
|
}
|
|
196
|
|
-
|
|
197
|
|
-
|
|
198
|
|
- // if (status === 200) {
|
|
199
|
|
-
|
|
200
|
|
- // } else {
|
|
201
|
|
- // soldOut()
|
|
202
|
|
- // }
|
|
203
|
|
-
|
|
|
188
|
+
|
|
|
189
|
+ // if (status === 200) {
|
|
|
190
|
+
|
|
|
191
|
+ // } else {
|
|
|
192
|
+ // soldOut()
|
|
|
193
|
+ // }
|
|
204
|
194
|
}
|
|
205
|
195
|
// 淘宝 *
|
|
206
|
196
|
if (product.platform === 5) {
|
|
207
|
|
- getTaobaoProductDetail(product.id).then(res => {
|
|
|
197
|
+ getTaobaoProductDetail(product.id).then((res) => {
|
|
208
|
198
|
// console.log('taobao>>>',res);
|
|
209
|
|
- let { status, data } = res
|
|
|
199
|
+ const { status, data } = res
|
|
210
|
200
|
if (status === 200) {
|
|
211
|
201
|
const product = data.waresDetail
|
|
212
|
202
|
mergeProductDetailclone({
|
|
213
|
203
|
images: product.small_images,
|
|
214
|
204
|
coupon: {
|
|
215
|
205
|
startTime: product.couponStartTime,
|
|
216
|
|
- endTime: product.couponEndTime
|
|
|
206
|
+ endTime: product.couponEndTime,
|
|
217
|
207
|
},
|
|
218
|
|
- ...product
|
|
|
208
|
+ ...product,
|
|
219
|
209
|
})
|
|
220
|
210
|
uni.hideLoading()
|
|
221
|
|
- } else {
|
|
|
211
|
+ }
|
|
|
212
|
+ else {
|
|
222
|
213
|
soldOut()
|
|
223
|
214
|
}
|
|
224
|
|
-
|
|
225
|
|
-
|
|
226
|
215
|
})
|
|
227
|
216
|
}
|
|
228
|
217
|
|
|
229
|
218
|
// 拼多多 *
|
|
230
|
219
|
if (product.platform == 1) {
|
|
231
|
|
- getPddProductDetail(product.id).then(res => {
|
|
232
|
|
- console.log('res')
|
|
|
220
|
+ getPddProductDetail(product.id).then((res) => {
|
|
|
221
|
+ console.log('res')
|
|
233
|
222
|
console.log(res)
|
|
234
|
223
|
console.log()
|
|
235
|
|
- let { status, data } = res
|
|
|
224
|
+ const { status, data } = res
|
|
236
|
225
|
// detail.value = res
|
|
237
|
226
|
if (status !== 200) {
|
|
238
|
227
|
soldOut()
|
|
239
|
|
- } else {
|
|
|
228
|
+ }
|
|
|
229
|
+ else {
|
|
240
|
230
|
mergeProductDetailclone({
|
|
241
|
231
|
spreadUrl: data.pddlink.url,
|
|
242
|
232
|
images: data.goods_gallery_urls,
|
|
243
|
233
|
featured: data.goods_gallery_urls,
|
|
244
|
234
|
mallName: data.mall_name,
|
|
245
|
|
- ...data
|
|
|
235
|
+ ...data,
|
|
246
|
236
|
// allowance:
|
|
247
|
237
|
})
|
|
248
|
238
|
|
|
|
@@ -251,27 +241,26 @@ function loadProductDetail(product: Partial<IProductDetail>) {
|
|
251
|
241
|
coupon: {
|
|
252
|
242
|
// amount: (res.extra_coupon_amount / 100).toString(),
|
|
253
|
243
|
startTime: dayjs.unix(data.coupon_start_time).format('YYYY-MM-DD'),
|
|
254
|
|
- endTime: dayjs.unix(data.coupon_end_time).format('YYYY-MM-DD')
|
|
|
244
|
+ endTime: dayjs.unix(data.coupon_end_time).format('YYYY-MM-DD'),
|
|
255
|
245
|
},
|
|
256
|
246
|
})
|
|
257
|
|
- } else {
|
|
|
247
|
+ }
|
|
|
248
|
+ else {
|
|
258
|
249
|
mergeProductDetailclone({
|
|
259
|
|
- coupon: null
|
|
|
250
|
+ coupon: null,
|
|
260
|
251
|
})
|
|
261
|
252
|
}
|
|
262
|
253
|
|
|
263
|
254
|
uni.hideLoading()
|
|
264
|
255
|
}
|
|
265
|
|
-
|
|
266
|
|
-
|
|
267
|
256
|
})
|
|
268
|
257
|
}
|
|
269
|
258
|
|
|
270
|
259
|
// 唯品会 *
|
|
271
|
260
|
if (product.platform == 2) {
|
|
272
|
|
- getVipProductDetail(product.id).then(res => {
|
|
|
261
|
+ getVipProductDetail(product.id).then((res) => {
|
|
273
|
262
|
// console.log(res.result[0])
|
|
274
|
|
- let { data, status } = res
|
|
|
263
|
+ const { data, status } = res
|
|
275
|
264
|
if (status === 200) {
|
|
276
|
265
|
const product = data.result[0]
|
|
277
|
266
|
// detail.value = product
|
|
|
@@ -280,77 +269,74 @@ function loadProductDetail(product: Partial<IProductDetail>) {
|
|
280
|
269
|
images: product.goodsDetailPictures,
|
|
281
|
270
|
mallName: '唯品自营',
|
|
282
|
271
|
...product,
|
|
283
|
|
- ...res
|
|
|
272
|
+ ...res,
|
|
284
|
273
|
})
|
|
285
|
274
|
if (product.couponInfo) {
|
|
286
|
275
|
mergeProductDetailclone({
|
|
287
|
276
|
coupon: {
|
|
288
|
277
|
amount: product.couponInfo.activedAmount,
|
|
289
|
278
|
startTime: product.couponInfo.useBeginTime,
|
|
290
|
|
- endTime: product.couponInfo.useEndTime
|
|
291
|
|
- }
|
|
|
279
|
+ endTime: product.couponInfo.useEndTime,
|
|
|
280
|
+ },
|
|
292
|
281
|
})
|
|
293
|
282
|
}
|
|
294
|
283
|
|
|
295
|
284
|
uni.hideLoading()
|
|
296
|
|
- } else {
|
|
|
285
|
+ }
|
|
|
286
|
+ else {
|
|
297
|
287
|
soldOut()
|
|
298
|
288
|
}
|
|
299
|
|
-
|
|
300
|
|
-
|
|
301
|
289
|
})
|
|
302
|
290
|
}
|
|
303
|
291
|
// 苏宁 *
|
|
304
|
292
|
if (product.platform == 3) {
|
|
305
|
|
- getSuProductDetail(product.id).then(res => {
|
|
|
293
|
+ getSuProductDetail(product.id).then((res) => {
|
|
306
|
294
|
// const product = res
|
|
307
|
|
- let { status, data } = res
|
|
|
295
|
+ const { status, data } = res
|
|
308
|
296
|
if (status === 200) {
|
|
309
|
297
|
mergeProductDetailclone({
|
|
310
|
298
|
images: data.detail,
|
|
311
|
|
- ...data
|
|
|
299
|
+ ...data,
|
|
312
|
300
|
})
|
|
313
|
301
|
|
|
314
|
302
|
uni.hideLoading()
|
|
315
|
|
-
|
|
316
|
|
- } else {
|
|
|
303
|
+ }
|
|
|
304
|
+ else {
|
|
317
|
305
|
soldOut()
|
|
318
|
306
|
}
|
|
319
|
|
-
|
|
320
|
307
|
})
|
|
321
|
308
|
}
|
|
322
|
309
|
// 抖音 *
|
|
323
|
310
|
if (product.platform == 9) {
|
|
324
|
|
- getDyProductDetail(product.id).then(res => {
|
|
|
311
|
+ getDyProductDetail(product.id).then((res) => {
|
|
325
|
312
|
console.log(res)
|
|
326
|
|
- let { status, data } = res
|
|
|
313
|
+ const { status, data } = res
|
|
327
|
314
|
if (status === 200) {
|
|
328
|
315
|
mergeProductDetailclone({
|
|
329
|
316
|
mallName: data.shopName,
|
|
330
|
317
|
images: data.imgs,
|
|
331
|
|
- ...data
|
|
|
318
|
+ ...data,
|
|
332
|
319
|
})
|
|
333
|
320
|
|
|
334
|
321
|
uni.hideLoading()
|
|
335
|
|
- } else {
|
|
|
322
|
+ }
|
|
|
323
|
+ else {
|
|
336
|
324
|
soldOut()
|
|
337
|
325
|
}
|
|
338
|
|
-
|
|
339
|
|
-
|
|
340
|
326
|
})
|
|
341
|
|
-
|
|
342
|
|
-
|
|
343
|
327
|
}
|
|
344
|
328
|
}
|
|
345
|
329
|
|
|
346
|
330
|
function handleBuyNow() {
|
|
347
|
|
- if (isSubmit.value) return
|
|
|
331
|
+ if (isSubmit.value)
|
|
|
332
|
+ return
|
|
348
|
333
|
if (!userStore.uid) {
|
|
349
|
334
|
isSubmit.value = true
|
|
350
|
335
|
|
|
351
|
336
|
uni.navigateTo({
|
|
352
|
|
- url: '/pages/user/login/index'
|
|
|
337
|
+ url: '/pages/user/login/index',
|
|
353
|
338
|
})
|
|
|
339
|
+ return
|
|
354
|
340
|
}
|
|
355
|
341
|
if (detail.value?.platform) {
|
|
356
|
342
|
// 京东
|
|
|
@@ -361,9 +347,9 @@ function handleBuyNow() {
|
|
361
|
347
|
uni.navigateToMiniProgram({
|
|
362
|
348
|
appId: 'wx91d27dbf599dff74',
|
|
363
|
349
|
// path: 'pages/union/proxy/proxy?spreadUrl=' + encodeURIComponent(detail.value?.spreadUrl),
|
|
364
|
|
- path: 'pages/union/proxy/proxy?spreadUrl=' + detail.value.materialUrl,
|
|
|
350
|
+ path: `pages/union/proxy/proxy?spreadUrl=${detail.value.materialUrl}`,
|
|
365
|
351
|
extraData: {
|
|
366
|
|
- foo: 'bar'
|
|
|
352
|
+ foo: 'bar',
|
|
367
|
353
|
},
|
|
368
|
354
|
envVersion: 'release',
|
|
369
|
355
|
success(res) {
|
|
|
@@ -371,25 +357,26 @@ function handleBuyNow() {
|
|
371
|
357
|
// console.log(res);
|
|
372
|
358
|
},
|
|
373
|
359
|
fail: (error) => {
|
|
374
|
|
- console.log(error);
|
|
375
|
|
- }
|
|
|
360
|
+ console.log(error)
|
|
|
361
|
+ },
|
|
376
|
362
|
})
|
|
377
|
|
- } else {
|
|
|
363
|
+ }
|
|
|
364
|
+ else {
|
|
378
|
365
|
return uni.showToast({
|
|
379
|
366
|
title: '跳转失败请重试',
|
|
380
|
|
- icon: 'none'
|
|
|
367
|
+ icon: 'none',
|
|
381
|
368
|
})
|
|
382
|
369
|
}
|
|
383
|
|
- } else if (detail.value?.platform == 1) {
|
|
|
370
|
+ }
|
|
|
371
|
+ else if (detail.value?.platform == 1) {
|
|
384
|
372
|
console.log(detail.value)
|
|
385
|
|
-
|
|
|
373
|
+
|
|
386
|
374
|
if (detail.value.pddlink.mobile_url.includes('mobile.yangkeduo')) {
|
|
387
|
375
|
isNeedAuth.value = true
|
|
388
|
|
-
|
|
|
376
|
+
|
|
389
|
377
|
console.log('需要授权')
|
|
390
|
378
|
}
|
|
391
|
|
-
|
|
392
|
|
-
|
|
|
379
|
+
|
|
393
|
380
|
const pddWx = detail.value.pddlink.wx
|
|
394
|
381
|
if (pddWx) {
|
|
395
|
382
|
uni.navigateToMiniProgram({
|
|
|
@@ -404,19 +391,20 @@ function handleBuyNow() {
|
|
404
|
391
|
// console.log(res);
|
|
405
|
392
|
},
|
|
406
|
393
|
fail: (error) => {
|
|
407
|
|
- console.log(error);
|
|
408
|
|
- }
|
|
|
394
|
+ console.log(error)
|
|
|
395
|
+ },
|
|
409
|
396
|
})
|
|
410
|
|
-
|
|
411
|
|
- } else {
|
|
|
397
|
+ }
|
|
|
398
|
+ else {
|
|
412
|
399
|
uni.showToast({
|
|
413
|
400
|
title: '跳转失败请重试',
|
|
414
|
|
- icon: 'none'
|
|
|
401
|
+ icon: 'none',
|
|
415
|
402
|
})
|
|
416
|
403
|
}
|
|
417
|
404
|
// console.log(detail.value.pddlink)
|
|
418
|
405
|
// console.log(pddWx)
|
|
419
|
|
- } else {
|
|
|
406
|
+ }
|
|
|
407
|
+ else {
|
|
420
|
408
|
/* let platformName = ''
|
|
421
|
409
|
let clipboardData = ''
|
|
422
|
410
|
if (detail.value?.platform == 5) {
|
|
|
@@ -449,15 +437,16 @@ function handleBuyNow() {
|
|
449
|
437
|
icon: 'none'
|
|
450
|
438
|
})
|
|
451
|
439
|
}
|
|
452
|
|
- })*/
|
|
|
440
|
+ }) */
|
|
453
|
441
|
|
|
454
|
442
|
// }
|
|
455
|
443
|
if (detail.value?.platform == 6) {
|
|
456
|
|
-
|
|
457
|
|
- } else {
|
|
|
444
|
+
|
|
|
445
|
+ }
|
|
|
446
|
+ else {
|
|
458
|
447
|
return uni.showToast({
|
|
459
|
448
|
title: '商品维护中,请稍后再试',
|
|
460
|
|
- icon: 'none'
|
|
|
449
|
+ icon: 'none',
|
|
461
|
450
|
})
|
|
462
|
451
|
}
|
|
463
|
452
|
}
|
|
|
@@ -471,48 +460,46 @@ function handleBuyNow() {
|
|
471
|
460
|
}
|
|
472
|
461
|
if (detail.value?.platform == 2) {
|
|
473
|
462
|
console.log(detail.value)
|
|
474
|
|
- }*/
|
|
|
463
|
+ } */
|
|
475
|
464
|
|
|
476
|
465
|
onShareAppMessage(async () => {
|
|
477
|
466
|
await uni.showLoading({
|
|
478
|
467
|
title: '分享中',
|
|
479
|
|
- icon: 'none'
|
|
|
468
|
+ icon: 'none',
|
|
480
|
469
|
})
|
|
481
|
|
- return await getShareId({ pid: state.id, type: 1 }).then(res => {
|
|
|
470
|
+ return await getShareId({ pid: state.id, type: 1 }).then((res) => {
|
|
482
|
471
|
if (res) {
|
|
483
|
472
|
state.shareId = res.share_id
|
|
484
|
473
|
uni.hideLoading()
|
|
485
|
474
|
return {
|
|
486
|
475
|
title: `${detail.value.title}`,
|
|
487
|
|
- path: `pages/store/product/detail?id=${detail.value.id}&from=share&shareID=${state.shareId}`
|
|
|
476
|
+ path: `pages/store/product/detail?id=${detail.value.id}&from=share&shareID=${state.shareId}`,
|
|
488
|
477
|
}
|
|
489
|
478
|
}
|
|
490
|
|
- }).catch(error => {
|
|
|
479
|
+ }).catch((error) => {
|
|
491
|
480
|
uni.showToast({
|
|
492
|
481
|
title: '请登录后分享',
|
|
493
|
|
- icon: 'none'
|
|
|
482
|
+ icon: 'none',
|
|
494
|
483
|
}).then(() => {
|
|
495
|
484
|
setTimeout(() => {
|
|
496
|
485
|
uni.navigateTo({
|
|
497
|
|
- url: '/pages/user/login/index'
|
|
|
486
|
+ url: '/pages/user/login/index',
|
|
498
|
487
|
})
|
|
499
|
488
|
}, 500)
|
|
500
|
489
|
})
|
|
501
|
490
|
uni.hideLoading()
|
|
502
|
491
|
})
|
|
503
|
|
-
|
|
504
|
492
|
})
|
|
505
|
493
|
|
|
506
|
494
|
onShareTimeline(() => {
|
|
507
|
|
-
|
|
508
|
495
|
if (!userStore.uid) {
|
|
509
|
496
|
return uni.showToast({
|
|
510
|
497
|
title: '请登录后分享',
|
|
511
|
|
- icon: 'none'
|
|
|
498
|
+ icon: 'none',
|
|
512
|
499
|
}).then(() => {
|
|
513
|
500
|
setTimeout(() => {
|
|
514
|
501
|
uni.navigateTo({
|
|
515
|
|
- url: '/pages/user/login/index'
|
|
|
502
|
+ url: '/pages/user/login/index',
|
|
516
|
503
|
})
|
|
517
|
504
|
}, 500)
|
|
518
|
505
|
})
|
|
|
@@ -521,11 +508,9 @@ function handleBuyNow() {
|
|
521
|
508
|
return {
|
|
522
|
509
|
title: `${detail.value.store_name}`,
|
|
523
|
510
|
imageUrl: state.shareImage,
|
|
524
|
|
- query: `id=${state.id}&from=share&shareID=${state.shareId}`
|
|
|
511
|
+ query: `id=${state.id}&from=share&shareID=${state.shareId}`,
|
|
525
|
512
|
}
|
|
526
|
|
-
|
|
527
|
513
|
})
|
|
528
|
|
-
|
|
529
|
514
|
}
|
|
530
|
515
|
|
|
531
|
516
|
/**
|
|
|
@@ -535,15 +520,15 @@ const hasCoupon = computed(() => {
|
|
535
|
520
|
return detail.value?.coupon && detail.value?.coupon.startTime
|
|
536
|
521
|
})
|
|
537
|
522
|
|
|
538
|
|
-//跳转大仓商品详情
|
|
|
523
|
+// 跳转大仓商品详情
|
|
539
|
524
|
function handleProductItemClick(
|
|
540
|
525
|
item:
|
|
541
|
|
- JdProductModel
|
|
542
|
|
- & DcProductModel
|
|
543
|
|
- & DyProductModel
|
|
544
|
|
- & SuNingProductModel
|
|
545
|
|
- & TaobaoProductThirdPartyWaresModel
|
|
546
|
|
- & VipProductModel
|
|
|
526
|
+ JdProductModel
|
|
|
527
|
+ & DcProductModel
|
|
|
528
|
+ & DyProductModel
|
|
|
529
|
+ & SuNingProductModel
|
|
|
530
|
+ & TaobaoProductThirdPartyWaresModel
|
|
|
531
|
+ & VipProductModel,
|
|
547
|
532
|
) {
|
|
548
|
533
|
// function navigateToDetail(params) {
|
|
549
|
534
|
// let otherDetailUrl = `/pages/store/product/other`
|
|
|
@@ -553,19 +538,17 @@ function handleProductItemClick(
|
|
553
|
538
|
// }
|
|
554
|
539
|
// 大仓
|
|
555
|
540
|
uni.navigateTo({
|
|
556
|
|
- url: `/pages/store/product/detail?id=${item.product_id}`
|
|
|
541
|
+ url: `/pages/store/product/detail?id=${item.product_id}`,
|
|
557
|
542
|
})
|
|
558
|
543
|
}
|
|
559
|
544
|
|
|
560
|
545
|
const outImg = computed(() => {
|
|
561
|
|
- if (isShow) {
|
|
562
|
|
- return CDM_URL + '/image/2023-11-24/20231124182002679.png'
|
|
563
|
|
- }
|
|
564
|
|
-
|
|
|
546
|
+ if (isShow)
|
|
|
547
|
+ return `${CDM_URL}/image/2023-11-24/20231124182002679.png`
|
|
565
|
548
|
})
|
|
566
|
549
|
|
|
567
|
550
|
// 距离顶部距离
|
|
568
|
|
-let Scroll_X = ref(0)
|
|
|
551
|
+const Scroll_X = ref(0)
|
|
569
|
552
|
|
|
570
|
553
|
const headerClass = ref('')
|
|
571
|
554
|
onPageScroll((page) => {
|
|
|
@@ -573,50 +556,47 @@ onPageScroll((page) => {
|
|
573
|
556
|
|
|
574
|
557
|
// console.log(page.scrollTop.toFixed(),'距离顶部的距离')
|
|
575
|
558
|
Scroll_X.value = Number(page.scrollTop.toFixed())
|
|
576
|
|
- if (page.scrollTop >= 76) {
|
|
|
559
|
+ if (page.scrollTop >= 76)
|
|
577
|
560
|
headerClass.value = 'bg-white !text-gray-900'
|
|
578
|
|
- } else {
|
|
|
561
|
+ else
|
|
579
|
562
|
headerClass.value = ''
|
|
580
|
|
- }
|
|
581
|
563
|
})
|
|
582
|
564
|
|
|
583
|
|
-
|
|
584
|
|
-//列表加载
|
|
|
565
|
+// 列表加载
|
|
585
|
566
|
function loadList(action: 'page' | 'reload', callback?: (items) => void) {
|
|
586
|
567
|
const params = {
|
|
587
|
568
|
page: skuInfo.currentPage,
|
|
588
|
|
- limit: skuInfo.pageSize
|
|
|
569
|
+ limit: skuInfo.pageSize,
|
|
589
|
570
|
}
|
|
590
|
571
|
|
|
591
|
|
- if (action === 'reload') {
|
|
|
572
|
+ if (action === 'reload')
|
|
592
|
573
|
params.page = 1
|
|
593
|
|
- }
|
|
594
|
574
|
|
|
595
|
575
|
getRecommendList({
|
|
596
|
|
- ...params
|
|
597
|
|
- }).then(res => {
|
|
598
|
|
- if (action === 'page') {
|
|
|
576
|
+ ...params,
|
|
|
577
|
+ }).then((res) => {
|
|
|
578
|
+ if (action === 'page')
|
|
599
|
579
|
skuInfo.recommendList = skuInfo.recommendList.concat(res.list)
|
|
600
|
|
- }
|
|
|
580
|
+
|
|
601
|
581
|
if (action === 'reload') {
|
|
602
|
582
|
// state.list = state.list.concat(res.list)
|
|
603
|
583
|
skuInfo.recommendList = res.list
|
|
604
|
584
|
}
|
|
605
|
|
- skuInfo.totalPage = Math.ceil(res.count / skuInfo.pageSize);
|
|
|
585
|
+ skuInfo.totalPage = Math.ceil(res.count / skuInfo.pageSize)
|
|
606
|
586
|
skuInfo.status = 'more'
|
|
607
|
|
- if (callback) {
|
|
|
587
|
+ if (callback)
|
|
608
|
588
|
callback(res.list)
|
|
609
|
|
- }
|
|
610
|
589
|
})
|
|
611
|
590
|
}
|
|
612
|
591
|
|
|
613
|
592
|
function handleScrollToLower() {
|
|
614
|
|
- skuInfo.status = 'loading';
|
|
615
|
|
- skuInfo.currentPage += 1;
|
|
|
593
|
+ skuInfo.status = 'loading'
|
|
|
594
|
+ skuInfo.currentPage += 1
|
|
616
|
595
|
// console.log(state.totalPage)
|
|
617
|
596
|
if (skuInfo.currentPage > skuInfo.totalPage) {
|
|
618
|
|
- skuInfo.status = 'noMore';
|
|
619
|
|
- } else {
|
|
|
597
|
+ skuInfo.status = 'noMore'
|
|
|
598
|
+ }
|
|
|
599
|
+ else {
|
|
620
|
600
|
setTimeout(() => {
|
|
621
|
601
|
loadList('page')
|
|
622
|
602
|
}, 300)
|
|
|
@@ -625,16 +605,16 @@ function handleScrollToLower() {
|
|
625
|
605
|
|
|
626
|
606
|
onReachBottom(() => {
|
|
627
|
607
|
handleScrollToLower()
|
|
628
|
|
-
|
|
629
|
608
|
})
|
|
630
|
|
-
|
|
631
|
|
-
|
|
632
|
609
|
</script>
|
|
|
610
|
+
|
|
633
|
611
|
<template>
|
|
634
|
612
|
<CXBBasePage>
|
|
635
|
|
- <div class="relative w-screen " v-if="detail">
|
|
636
|
|
- <swiper v-if="detail.featured" :indicator-dots="false" :circular="true" :autoplay="true" :interval="5000"
|
|
637
|
|
- :duration="500" class="h-95">
|
|
|
613
|
+ <div v-if="detail" class="relative w-screen ">
|
|
|
614
|
+ <swiper
|
|
|
615
|
+ v-if="detail.featured" :indicator-dots="false" :circular="true" :autoplay="true" :interval="5000"
|
|
|
616
|
+ :duration="500" class="h-95"
|
|
|
617
|
+ >
|
|
638
|
618
|
<swiper-item v-for="(item, index) in detail.featured" :key="index">
|
|
639
|
619
|
<image :key="index" :src="item" mode="aspectFill" class="h-full w-full" />
|
|
640
|
620
|
</swiper-item>
|
|
|
@@ -642,47 +622,60 @@ onReachBottom(() => {
|
|
642
|
622
|
<div>
|
|
643
|
623
|
<div class="relative p-3 bg-white">
|
|
644
|
624
|
<div class="flex gap-2 items-end">
|
|
645
|
|
- <FPrice v-if="detail && detail.salePrice" :price="detail.salePrice" need-symbol :size="'large'"
|
|
646
|
|
- ex-class="!text-[24px]" />
|
|
647
|
|
- <FPrice v-if="detail && detail.price" :price="detail.price" :ex-class="'!text-gray'" need-symbol
|
|
648
|
|
- strike-through />
|
|
|
625
|
+ <FPrice
|
|
|
626
|
+ v-if="detail && detail.salePrice" :price="detail.salePrice" need-symbol size="large"
|
|
|
627
|
+ ex-class="!text-[24px]"
|
|
|
628
|
+ />
|
|
|
629
|
+ <FPrice
|
|
|
630
|
+ v-if="detail && detail.price" :price="detail.price" ex-class="!text-gray" need-symbol
|
|
|
631
|
+ strike-through
|
|
|
632
|
+ />
|
|
649
|
633
|
</div>
|
|
650
|
634
|
|
|
651
|
|
- <div class="font-bold py-2">{{ detail.title }}</div>
|
|
|
635
|
+ <div class="font-bold py-2">
|
|
|
636
|
+ {{ detail.title }}
|
|
|
637
|
+ </div>
|
|
652
|
638
|
</div>
|
|
653
|
639
|
|
|
654
|
|
- <div class="relative" v-if="hasCoupon">
|
|
|
640
|
+ <div v-if="hasCoupon" class="relative">
|
|
655
|
641
|
<div class="px-3 relative" @tap="handleBuyNow">
|
|
656
|
|
- <image lazy-load :src="discount_coupon_bg_220804Image" mode="widthFix" class="w-full"></image>
|
|
|
642
|
+ <image lazy-load :src="discount_coupon_bg_220804Image" mode="widthFix" class="w-full" />
|
|
657
|
643
|
<div class="absolute top-2 left-15 h-full w-fit text-white">
|
|
658
|
644
|
<div class=" inline-flex justify-center items-end w-full py-2">
|
|
659
|
|
- <div class="text-[28px]">{{ detail.coupon.amount }}</div>
|
|
|
645
|
+ <div class="text-[28px]">
|
|
|
646
|
+ {{ detail.coupon.amount }}
|
|
|
647
|
+ </div>
|
|
660
|
648
|
元代金劵
|
|
661
|
649
|
</div>
|
|
662
|
|
- <div class="text-[10px]">使用期限:{{ detail.coupon.startTime }} -{{ detail.coupon.endTime }}</div>
|
|
|
650
|
+ <div class="text-[10px]">
|
|
|
651
|
+ 使用期限:{{ detail.coupon.startTime }} -{{ detail.coupon.endTime }}
|
|
|
652
|
+ </div>
|
|
663
|
653
|
</div>
|
|
664
|
654
|
</div>
|
|
665
|
|
-
|
|
666
|
655
|
</div>
|
|
667
|
656
|
|
|
668
|
657
|
<div class="relative pb-safe mt-3 bg-white">
|
|
669
|
658
|
<div v-if="detail.mallName" class="p-3 font-bold">
|
|
670
|
659
|
{{ detail.mallName }}
|
|
671
|
660
|
</div>
|
|
672
|
|
- <!-- <mpHtml :content=""></mpHtml>-->
|
|
673
|
|
- <image v-for="(imgItem, index) in detail.images" :key="index" mode="widthFix" :src="imgItem"
|
|
674
|
|
- class="w-full h-full"></image>
|
|
|
661
|
+ <!-- <mpHtml :content=""></mpHtml> -->
|
|
|
662
|
+ <image
|
|
|
663
|
+ v-for="(imgItem, index) in detail.images" :key="index" mode="widthFix" :src="imgItem"
|
|
|
664
|
+ class="w-full h-full"
|
|
|
665
|
+ />
|
|
675
|
666
|
</div>
|
|
676
|
667
|
</div>
|
|
677
|
668
|
<div class="fixed bottom-0 w-full h-15 shadow">
|
|
678
|
669
|
<div class="w-full bg-white pb-safe">
|
|
679
|
670
|
<div class="flex justify-between items-center p-3">
|
|
680
|
671
|
<div class="inline-flex items-center">
|
|
681
|
|
- <div class="text-sm">预估养老金</div>
|
|
|
672
|
+ <div class="text-sm">
|
|
|
673
|
+ 预估养老金
|
|
|
674
|
+ </div>
|
|
682
|
675
|
<FPrice :price="detail.yanglao || detail.commission" need-symbol ex-class="text-[20px] font-bold" />
|
|
683
|
676
|
</div>
|
|
684
|
677
|
<div>
|
|
685
|
|
- <nut-button type="primary" @tap="handleBuyNow" :disabled="isSubmit">
|
|
|
678
|
+ <nut-button type="primary" :disabled="isSubmit" @tap="handleBuyNow">
|
|
686
|
679
|
立即购买
|
|
687
|
680
|
</nut-button>
|
|
688
|
681
|
</div>
|
|
|
@@ -691,32 +684,32 @@ onReachBottom(() => {
|
|
691
|
684
|
</div>
|
|
692
|
685
|
</div>
|
|
693
|
686
|
<!-- 商品下架展示 -->
|
|
694
|
|
- <div class="relative w-screen " v-if="isShow">
|
|
695
|
|
- <CXBBackTop :Scroll_X="Scroll_X" :isCss="1" />
|
|
|
687
|
+ <div v-if="isShow" class="relative w-screen ">
|
|
|
688
|
+ <CXBBackTop :Scroll_X="Scroll_X" :is-css="1" />
|
|
696
|
689
|
<div class="box-out">
|
|
697
|
690
|
<div class="flex-box pb-3 px-3 ">
|
|
698
|
691
|
<div class="img-div">
|
|
699
|
|
- <image lazy-load :src="outImg" mode="widthFix" class=" top-0 right-0 sold-out ">
|
|
700
|
|
- </image>
|
|
|
692
|
+ <image lazy-load :src="outImg" mode="widthFix" class=" top-0 right-0 sold-out " />
|
|
|
693
|
+ </div>
|
|
|
694
|
+ <div class="out-conter">
|
|
|
695
|
+ 该商品下架不存在
|
|
701
|
696
|
</div>
|
|
702
|
|
- <div class="out-conter">该商品下架不存在</div>
|
|
703
|
697
|
</div>
|
|
704
|
|
-
|
|
705
|
698
|
</div>
|
|
706
|
699
|
<div class="flex flex-col pb-safe gap-3">
|
|
707
|
700
|
<div class="p-3 bg-white">
|
|
708
|
701
|
<div
|
|
709
|
|
- class="before:content-[''] before:block before:absolute before:w-1 before:h-full before:bg-gradient-to-b from-red-500 to-red-600 before:rounded relative inline-block">
|
|
|
702
|
+ class="before:content-[''] before:block before:absolute before:w-1 before:h-full before:bg-gradient-to-b from-red-500 to-red-600 before:rounded relative inline-block"
|
|
|
703
|
+ >
|
|
710
|
704
|
<div class="pl-2">
|
|
711
|
705
|
精品推荐
|
|
712
|
706
|
</div>
|
|
713
|
707
|
</div>
|
|
714
|
708
|
</div>
|
|
715
|
|
- <div class="pb-3 px-3" v-if="skuInfo.recommendList.length != 0">
|
|
|
709
|
+ <div v-if="skuInfo.recommendList.length != 0" class="pb-3 px-3">
|
|
716
|
710
|
<grid-view type="masonry" cross-axis-count="2" cross-axis-gap="10px" main-axis-gap="10px">
|
|
717
|
711
|
<div v-for="(item, index) in skuInfo.recommendList" :key="index" @click="handleProductItemClick(item)">
|
|
718
|
712
|
<MerchantProductCard :item="item" />
|
|
719
|
|
-
|
|
720
|
713
|
</div>
|
|
721
|
714
|
</grid-view>
|
|
722
|
715
|
<div class=" flex justify-center items-center text-[12px] text-gray-500">
|
|
|
@@ -728,12 +721,11 @@ onReachBottom(() => {
|
|
728
|
721
|
</div>
|
|
729
|
722
|
</div>
|
|
730
|
723
|
</div>
|
|
731
|
|
-
|
|
732
|
724
|
</div>
|
|
733
|
725
|
</div>
|
|
734
|
|
-
|
|
735
|
726
|
</CXBBasePage>
|
|
736
|
727
|
</template>
|
|
|
728
|
+
|
|
737
|
729
|
<style scoped>
|
|
738
|
730
|
.box-out {
|
|
739
|
731
|
background: #f8f8f8;
|
|
|
@@ -765,8 +757,9 @@ onReachBottom(() => {
|
|
765
|
757
|
text-align: center;
|
|
766
|
758
|
}
|
|
767
|
759
|
</style>
|
|
|
760
|
+
|
|
768
|
761
|
<route lang="yaml">
|
|
769
|
762
|
style:
|
|
770
|
763
|
navigationBarTitleText: 商品详情
|
|
771
|
764
|
enablePullDownRefresh: true
|
|
772
|
|
-</route>
|
|
|
765
|
+</route>
|