|
|
@@ -1,7 +1,7 @@
|
|
1
|
1
|
<script lang="ts" setup>
|
|
2
|
|
-import {getRecommendList} from "~/apis/merchant";
|
|
|
2
|
+import {getRecommendList ,getProductDetail} from "~/apis/merchant";
|
|
3
|
3
|
import MerchantProductCard from "~/pages/store/home/components/MerchantProductCard.vue";
|
|
4
|
|
-import {deleteCartItem, getCartCount, getCartList} from "~/apis/user";
|
|
|
4
|
+import {deleteCartItem, getCartCount, getCartList,xcxBanding} from "~/apis/user";
|
|
5
|
5
|
import type {ShoppingResult} from "~/apis/model/shopping.model";
|
|
6
|
6
|
import FPrice from "~/components/FPrice/FPrice.vue";
|
|
7
|
7
|
import FButton from "~/components/FButton/FButton.vue";
|
|
|
@@ -13,11 +13,13 @@ import {
|
|
13
|
13
|
TaobaoProductThirdPartyWaresModel, VipProductModel
|
|
14
|
14
|
} from "~/apis/model/product.model";
|
|
15
|
15
|
import {DcProductModel} from "~/apis/model/dacang.model";
|
|
|
16
|
+import {createShopping , changeProdoctSku} from "~/apis/order.api";
|
|
16
|
17
|
import {encodeBase64} from "~/utils/http/helper";
|
|
17
|
18
|
import {CDN_URL} from "~/config/app";
|
|
18
|
19
|
import {uniq} from "lodash-es";
|
|
19
|
20
|
import {cartChange} from "~/apis/order.api";
|
|
20
|
21
|
import type CXBBackTop from "~/components/CXBBackTop/CXBBackTop.vue";
|
|
|
22
|
+import CXBSkuPopup from "~/components/CXBSkuPopup/CXBSkuPopup.vue";
|
|
21
|
23
|
const gouwucheImage = CDN_URL + '/static/assets/gouwuche.png'
|
|
22
|
24
|
const like_adorn_220628Image = CDN_URL + '/static/assets/like_adorn_220628.png'
|
|
23
|
25
|
const pageStore = usePageStoreWidthOut()
|
|
|
@@ -36,11 +38,73 @@ const state = reactive({
|
|
36
|
38
|
selectAllIndeterminate: false,
|
|
37
|
39
|
|
|
38
|
40
|
cart_id: [],
|
|
|
41
|
+ changeSkuCart_id:'0',
|
|
39
|
42
|
isManage: true,
|
|
40
|
43
|
|
|
41
|
44
|
currentType: '',
|
|
|
45
|
+
|
|
|
46
|
+ isShowSku: false,
|
|
|
47
|
+ cartNum: 1,
|
|
|
48
|
+ currentSku: {},
|
|
42
|
49
|
})
|
|
43
|
50
|
|
|
|
51
|
+const detail: any = ref(null)
|
|
|
52
|
+
|
|
|
53
|
+
|
|
|
54
|
+function onSelectedSku(item) {
|
|
|
55
|
+ state.currentSku = item
|
|
|
56
|
+}
|
|
|
57
|
+
|
|
|
58
|
+function handleCreateShopping() {
|
|
|
59
|
+ // console.log(state.flag)
|
|
|
60
|
+ console.log(state.currentSku.unique,'切换sku展示的商品',state)
|
|
|
61
|
+ changeProdoctSku(
|
|
|
62
|
+ // product_attr_unique: JSON.stringify(state.currentSku),
|
|
|
63
|
+ // detail.value.unique
|
|
|
64
|
+ state.changeSkuCart_id,
|
|
|
65
|
+ state.currentSku.unique
|
|
|
66
|
+ ).then(res => {
|
|
|
67
|
+ console.log(res)
|
|
|
68
|
+ // if (res.cart_id) {
|
|
|
69
|
+ // // console.log(state.flag)
|
|
|
70
|
+ // if (state.flag == '1' || state.flag == '3') {
|
|
|
71
|
+ // uni.navigateTo({
|
|
|
72
|
+ // url: `/pages/order-confirm/index?cartId=${res.cart_id}&type=${state.flag}&product_id=${detail.value.product_id}`
|
|
|
73
|
+ // })
|
|
|
74
|
+ // } else {
|
|
|
75
|
+ // uni.$emit('cart-reload')
|
|
|
76
|
+
|
|
|
77
|
+ // uni.showToast({
|
|
|
78
|
+ // title: '添加购物车成功',
|
|
|
79
|
+ // icon: 'none'
|
|
|
80
|
+ // })
|
|
|
81
|
+ // loadCartCount()
|
|
|
82
|
+ // state.isShowSku = false
|
|
|
83
|
+ // }
|
|
|
84
|
+ // }
|
|
|
85
|
+ // if(res.status === 200){
|
|
|
86
|
+ // state.isShowSku = false
|
|
|
87
|
+ // }
|
|
|
88
|
+ state.isShowSku = false
|
|
|
89
|
+ uni.$on('cart-reload', () => {
|
|
|
90
|
+ // console.log('新商品添加...')
|
|
|
91
|
+ state.cart_id = []
|
|
|
92
|
+ loadCartList()
|
|
|
93
|
+ })
|
|
|
94
|
+
|
|
|
95
|
+ state.cart_id = []
|
|
|
96
|
+ loadCartList()
|
|
|
97
|
+ })
|
|
|
98
|
+}
|
|
|
99
|
+
|
|
|
100
|
+function handleCountChange(val) {
|
|
|
101
|
+ // console.log(val)
|
|
|
102
|
+ // detail.value.
|
|
|
103
|
+ // if (val > 0) {
|
|
|
104
|
+ state.cartNum = val
|
|
|
105
|
+ // }
|
|
|
106
|
+}
|
|
|
107
|
+
|
|
44
|
108
|
// 距离顶部距离
|
|
45
|
109
|
let Scroll_X = ref(0)
|
|
46
|
110
|
|
|
|
@@ -440,23 +504,58 @@ onPageScroll((page) => {
|
|
440
|
504
|
headerClass.value = ''
|
|
441
|
505
|
}
|
|
442
|
506
|
})
|
|
443
|
|
-const changeSku = ref(false)
|
|
444
|
|
-const openTestLog = ()=>{
|
|
|
507
|
+const openTestLog1 = (a)=>{
|
|
|
508
|
+ console.log('商品的id',a.product_id)
|
|
445
|
509
|
console.log('测试点击sku,多规模');
|
|
446
|
|
- changeSku.value = true
|
|
|
510
|
+ state.isShowSku = true
|
|
447
|
511
|
|
|
448
|
512
|
}
|
|
|
513
|
+
|
|
|
514
|
+function openTestLog(element) {
|
|
|
515
|
+ state.isShowSku = true
|
|
|
516
|
+ state.changeSkuCart_id = element.cart_id
|
|
|
517
|
+console.log('用户点击sku,展示商品id和购物车id',element.product_id,element.cart_id)
|
|
|
518
|
+getProductDetail(element.product_id).then(res => {
|
|
|
519
|
+ console.log(res.sku,'点击sku,展示返回的res')
|
|
|
520
|
+ detail.value = res
|
|
|
521
|
+ // console.log(detail.value,'点击sku获取的商品信息,存储的detail')
|
|
|
522
|
+ state.shareImage = detail.value.image
|
|
|
523
|
+ if (res && res.mer_id && res.mer_id === '148') {
|
|
|
524
|
+ if (detail.value && detail.value.price ) {
|
|
|
525
|
+ detail.value.price = detail.value.price * 30
|
|
|
526
|
+ }
|
|
|
527
|
+ }
|
|
|
528
|
+ state.isRelation = res.isRelation
|
|
|
529
|
+ if (res.merchant_type == 2) {
|
|
|
530
|
+ xcxBanding({
|
|
|
531
|
+ mer_id: res.mer_id,
|
|
|
532
|
+ share_id: state.shareId
|
|
|
533
|
+ }).then(res => {
|
|
|
534
|
+ console.info(res)
|
|
|
535
|
+ })
|
|
|
536
|
+ }
|
|
|
537
|
+
|
|
|
538
|
+ // if (detail.value.mer_id === '148') {
|
|
|
539
|
+ // }
|
|
|
540
|
+ uni.hideLoading()
|
|
|
541
|
+}).catch(error => {
|
|
|
542
|
+ // console.log(error)
|
|
|
543
|
+ uni.showToast({
|
|
|
544
|
+ icon: "none",
|
|
|
545
|
+ title: error
|
|
|
546
|
+ }).then( () => {
|
|
|
547
|
+ setTimeout(() => {
|
|
|
548
|
+ uni.navigateBack()
|
|
|
549
|
+ }, 500)
|
|
|
550
|
+ })
|
|
|
551
|
+})
|
|
|
552
|
+}
|
|
449
|
553
|
const closeTestLog = ()=>{
|
|
450
|
554
|
console.log('测试点击sku,多规模');
|
|
451
|
|
- changeSku.value = false
|
|
452
|
555
|
|
|
453
|
556
|
}
|
|
454
|
557
|
</script>
|
|
455
|
558
|
<template>
|
|
456
|
|
- <div v-if="changeSku" style="width: 100%; height: 100%; background-color: skyblue; margin-top: 100px;">
|
|
457
|
|
- <p>sku信息</p>
|
|
458
|
|
- <button @click="closeTestLog">关闭</button>
|
|
459
|
|
- </div>
|
|
460
|
559
|
<div class="">
|
|
461
|
560
|
<div
|
|
462
|
561
|
v-if="hasShopping"
|
|
|
@@ -529,8 +628,8 @@ const closeTestLog = ()=>{
|
|
529
|
628
|
class="text-overflow line-clamp-2 text-xs">{{ goodItem.product.store_name }}</div>
|
|
530
|
629
|
<div class="flex flex-col justify-start gap-1">
|
|
531
|
630
|
<div
|
|
532
|
|
- class="text-[10px] text-gray min-w-5 p-1 items-center flex" @click="openTestLog">
|
|
533
|
|
- {{ goodItem.productAttr.sku }}
|
|
|
631
|
+ class="text-[10px] text-gray min-w-5 p-1 items-center flex skushadow" v-if="goodItem.productAttr.sku" @click="openTestLog(goodItem)">
|
|
|
632
|
+ {{ goodItem.productAttr.sku +' V'}}
|
|
534
|
633
|
</div>
|
|
535
|
634
|
<div class="flex">
|
|
536
|
635
|
<CXBYaojinTag :amount="goodItem.yanglao"/>
|
|
|
@@ -584,7 +683,13 @@ const closeTestLog = ()=>{
|
|
584
|
683
|
</div>
|
|
585
|
684
|
</div>
|
|
586
|
685
|
</div>
|
|
587
|
|
-
|
|
|
686
|
+ <CXBSkuPopup
|
|
|
687
|
+ v-model:show="state.isShowSku"
|
|
|
688
|
+ :detail="detail"
|
|
|
689
|
+ @selected:item="onSelectedSku"
|
|
|
690
|
+ @submit="handleCreateShopping"
|
|
|
691
|
+ @count-change="handleCountChange"
|
|
|
692
|
+ />
|
|
588
|
693
|
<div v-if="hasShopping"
|
|
589
|
694
|
class="fixed bottom-0 w-full z-3">
|
|
590
|
695
|
<div class="bg-white h-10 flex justify-between" v-if="shopping && shopping.list">
|
|
|
@@ -618,6 +723,10 @@ const closeTestLog = ()=>{
|
|
618
|
723
|
page {
|
|
619
|
724
|
background-color: #f8f8f8;
|
|
620
|
725
|
}
|
|
|
726
|
+.skushadow{
|
|
|
727
|
+ background-color: rgb(240, 240, 240);
|
|
|
728
|
+ border-radius: 10px;
|
|
|
729
|
+}
|
|
621
|
730
|
</style>
|
|
622
|
731
|
<route lang="yaml">
|
|
623
|
732
|
style:
|