Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yongxinda-h5
Project
Project
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
Graph
比较
统计图
议题
0
议题
0
列表
看板
标记
Milestones
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
刘旭
yongxinda-h5
Commits
e94ea407
提交
e94ea407
authored
12月 29, 2022
作者:
刘旭
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
优化
上级
bc413cf7
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
122 行增加
和
159 行删除
+122
-159
cart.ts
src/api/cart.ts
+3
-0
index.vue
src/pages/cart/index.vue
+60
-93
goodsSku.vue
src/pages/goods/goodsSku.vue
+3
-25
index.vue
src/pages/goods/index.vue
+23
-2
editQuotation.vue
src/pages/order/editQuotation.vue
+2
-37
orderList.vue
src/pages/order/orderList.vue
+0
-0
productLine.vue
src/pages/productLine/productLine.vue
+18
-1
useStore.ts
src/store/useStore.ts
+13
-1
没有找到文件。
src/api/cart.ts
浏览文件 @
e94ea407
...
@@ -44,3 +44,6 @@ export const quotationDownload = (data: any) => request('/wx/quotation/download'
...
@@ -44,3 +44,6 @@ export const quotationDownload = (data: any) => request('/wx/quotation/download'
// 报价单-是否存在
// 报价单-是否存在
export
const
quotationExist
=
(
data
:
any
)
=>
request
(
'/wx/quotation/exist'
,
'GET'
,
data
);
export
const
quotationExist
=
(
data
:
any
)
=>
request
(
'/wx/quotation/exist'
,
'GET'
,
data
);
// 再次加入购物车
export
const
orderCartAgain
=
(
data
:
any
)
=>
request
(
'/wx/order/cart/again'
,
'GET'
,
data
);
src/pages/cart/index.vue
浏览文件 @
e94ea407
...
@@ -13,57 +13,30 @@
...
@@ -13,57 +13,30 @@
<view
v-if=
"item.isSubmit"
class=
"group-item"
>
<view
v-if=
"item.isSubmit"
class=
"group-item"
>
<u-row
class=
"item"
>
<u-row
class=
"item"
>
<u-col
:span=
"1"
>
<u-col
:span=
"1"
>
<u-checkbox
<u-checkbox
:name=
"item.id"
v-model=
"item.checked"
shape=
"circle"
></u-checkbox>
:name=
"item.id"
v-model=
"item.checked"
shape=
"circle"
></u-checkbox>
</u-col>
</u-col>
<u-col
:span=
"3"
>
<u-col
:span=
"3"
>
<u-image
<u-image
v-if=
"type === 0"
width=
"140rpx"
height=
"200rpx"
:src=
"baseUrl + item.picUrl"
v-if=
"type === 0"
class=
"img"
></u-image>
width=
"140rpx"
height=
"200rpx"
:src=
"baseUrl + item.picUrl"
class=
"img"
></u-image>
</u-col>
</u-col>
<u-col
<u-col
:span=
"delCircle ? 7 : 5"
class=
"details"
@
tap=
"
:span=
"delCircle ? 7 : 5"
delCircle
class=
"details"
? () => {
@
tap=
"
return;
delCircle
}
? () => {
: togoods(item)
return;
"
>
}
: togoods(item)
"
>
<view>
{{ item.goodsName }}
</view>
<view>
{{ item.goodsName }}
</view>
<view
class=
"b-tag"
>
<view
class=
"b-tag"
>
<block
<block
v-for=
"(item1, index1) in item.specifications?.length"
:key=
"index1"
>
v-for=
"(item1, index1) in item.specifications?.length"
<u-tag
:text=
"item.specifications[index1]"
type=
"info"
size=
"mini"
:key=
"index1"
style=
"margin: 8rpx 8rpx 8rpx 0;"
/>
>
<u-tag
:text=
"item.specifications[index1]"
type=
"info"
size=
"mini"
style=
"margin: 8rpx 8rpx 8rpx 0;"
/>
</block>
</block>
</view>
</view>
<view
v-if=
"item.partList?.length !== 0"
class=
"b-tag"
>
<view
v-if=
"item.partList?.length !== 0"
class=
"b-tag"
>
<block
<block
v-for=
"(item1, index1) in item.partList?.length"
:key=
"index1"
>
v-for=
"(item1, index1) in item.partList?.length"
<u-tag
:text=
"item.partList[index1]"
type=
"warning"
size=
"mini"
:key=
"index1"
style=
"margin: 8rpx 8rpx 8rpx 0;"
/>
>
<u-tag
:text=
"item.partList[index1]"
type=
"warning"
size=
"mini"
style=
"margin: 8rpx 8rpx 8rpx 0;"
/>
</block>
</block>
</view>
</view>
</u-col>
</u-col>
...
@@ -74,12 +47,8 @@
...
@@ -74,12 +47,8 @@
</u-col>
</u-col>
<u-col
v-else
:span=
"3"
style=
"margin-top: 20%;"
>
<u-col
v-else
:span=
"3"
style=
"margin-top: 20%;"
>
<view
class=
"number-box"
>
<view
class=
"number-box"
>
<u-number-box
<u-number-box
v-model=
"item.number"
:min=
"1"
disabled-input
v-model=
"item.number"
@
change=
"valChange($event, item)"
></u-number-box>
:min=
"1"
disabled-input
@
change=
"valChange($event, item)"
></u-number-box>
</view>
</view>
</u-col>
</u-col>
</u-row>
</u-row>
...
@@ -89,33 +58,21 @@
...
@@ -89,33 +58,21 @@
<view
class=
"item"
>
<view
class=
"item"
>
<u-row>
<u-row>
<u-col
:span=
"1"
>
<u-col
:span=
"1"
>
<u-checkbox
<u-checkbox
:name=
"item.id"
:disabled=
"!item.isSubmit && !delCircle"
:name=
"item.id"
v-model=
"item.checked"
shape=
"circle"
></u-checkbox>
:disabled=
"!item.isSubmit && !delCircle"
v-model=
"item.checked"
shape=
"circle"
></u-checkbox>
</u-col>
</u-col>
<u-col
:span=
"3"
>
<u-col
:span=
"3"
>
<u-image
<u-image
v-if=
"type === 0"
width=
"140rpx"
height=
"200rpx"
:src=
"baseUrl + item.picUrl"
v-if=
"type === 0"
class=
"img"
></u-image>
width=
"140rpx"
height=
"200rpx"
:src=
"baseUrl + item.picUrl"
class=
"img"
></u-image>
</u-col>
</u-col>
<u-col
:span=
"7"
>
<u-col
:span=
"7"
>
<view
<view
class=
"details"
@
tap=
"
class=
"details"
item.deleted
@
tap=
"
? () => {
item.deleted
return;
? () => {
}
return;
: togoods(item)
}
"
>
: togoods(item)
"
>
<view>
{{ item.goodsName }}
</view>
<view>
{{ item.goodsName }}
</view>
<view
style=
"color: #ccc; margin-top: 20%;"
>
<view
style=
"color: #ccc; margin-top: 20%;"
>
{{ item.message }}
{{ item.message }}
...
@@ -133,7 +90,9 @@
...
@@ -133,7 +90,9 @@
</block>
</block>
</u-checkbox-group>
</u-checkbox-group>
</view>
</view>
<view
v-else
style=
"margin-top: 200rpx;"
><u-empty
text=
"购物车为空"
mode=
"car"
/></view>
<view
v-else
style=
"margin-top: 200rpx;"
>
<u-empty
text=
"购物车为空"
mode=
"car"
/>
</view>
<view
style=
"width: 100%; height: 100rpx;"
/>
<view
style=
"width: 100%; height: 100rpx;"
/>
<view
class=
"footer"
>
<view
class=
"footer"
>
<view
class=
"left"
>
<view
class=
"left"
>
...
@@ -148,39 +107,29 @@
...
@@ -148,39 +107,29 @@
<text v-show="!delCircle" style="color: red; font-size: 40rpx;">
<text v-show="!delCircle" style="color: red; font-size: 40rpx;">
¥{{ totalPrice }}
¥{{ totalPrice }}
</text> -->
</text> -->
<u-button
<u-button
shape=
"circle"
size=
"medium"
hover-class=
"#f32329"
shape=
"circle"
style=
"background-color: #f32329; margin-left: 20rpx; color: #fff;"
@
tap=
"tapOptions"
>
size=
"medium"
hover-class=
"#f32329"
style=
"background-color: #f32329; margin-left: 20rpx; color: #fff;"
@
tap=
"tapOptions"
>
{{ !delCircle ? '结算' : '删除' }}
{{ !delCircle ? '结算' : '删除' }}
</u-button>
</u-button>
</view>
</view>
</view>
</view>
<!-- 删除模态框 -->
<!-- 删除模态框 -->
<u-modal
<u-modal
v-model=
"showModel.show"
:content=
"showModel.content"
:title=
"showModel.title"
show-cancel-button
v-model=
"showModel.show"
async-close
:cancel-text=
"showModel.cancelText"
@
confirm=
"onConfirm"
></u-modal>
:content=
"showModel.content"
:title=
"showModel.title"
show-cancel-button
async-close
:cancel-text=
"showModel.cancelText"
@
confirm=
"onConfirm"
></u-modal>
</template>
</template>
<
script
lang=
"ts"
setup
>
<
script
lang=
"ts"
setup
>
import
{
ref
,
reactive
}
from
'vue'
;
import
{
ref
,
reactive
}
from
'vue'
;
import
{
getCartIndex
,
cartChecked
,
cartDelete
,
cartUpdate
}
from
'@/api/cart'
;
import
{
getCartIndex
,
cartChecked
,
cartDelete
,
cartUpdate
}
from
'@/api/cart'
;
import
{
onShow
}
from
'@dcloudio/uni-app'
;
import
{
onShow
}
from
'@dcloudio/uni-app'
;
import
{
useSpecStore
}
from
'@/store/useStore'
import
_
from
'lodash'
;
import
_
from
'lodash'
;
import
config
from
'@/utils/config'
;
import
config
from
'@/utils/config'
;
let
baseUrl
=
config
.
baseUrl
;
let
baseUrl
=
config
.
baseUrl
;
const
specStore
=
useSpecStore
()
// 记录默认规格
const
cartList
=
ref
([]
as
any
);
// 购物车数据
const
cartList
=
ref
([]
as
any
);
// 购物车数据
const
checkedAll
=
ref
(
false
);
// 全选checkbox
const
checkedAll
=
ref
(
false
);
// 全选checkbox
const
allGoods
=
ref
();
// 购物车列表id
const
allGoods
=
ref
();
// 购物车列表id
...
@@ -311,7 +260,18 @@ const tapOptions = () => {
...
@@ -311,7 +260,18 @@ const tapOptions = () => {
let
togoods
=
(
data
:
any
)
=>
{
let
togoods
=
(
data
:
any
)
=>
{
if
(
type
.
value
===
0
)
if
(
type
.
value
===
0
)
uni
.
navigateTo
({
url
:
'../goods/index?id='
+
data
.
goodsId
+
'&cartId='
+
data
.
id
});
uni
.
navigateTo
({
url
:
'../goods/index?id='
+
data
.
goodsId
+
'&cartId='
+
data
.
id
+
'&isDefauleSku=true'
,
success
()
{
specStore
.
$patch
({
defaultSelect
:
{
sku
:
data
.
specifications
,
num
:
data
.
number
},
isDefaultSku
:
true
})
}
});
else
else
uni
.
reLaunch
({
uni
.
reLaunch
({
url
:
'../productLine/productLine?id='
+
data
.
goodsId
+
'&cartId='
+
data
.
id
,
url
:
'../productLine/productLine?id='
+
data
.
goodsId
+
'&cartId='
+
data
.
id
,
...
@@ -447,6 +407,7 @@ onShow(() => {
...
@@ -447,6 +407,7 @@ onShow(() => {
padding
:
15rpx
;
padding
:
15rpx
;
margin-bottom
:
10rpx
;
margin-bottom
:
10rpx
;
background-color
:
#fff
;
background-color
:
#fff
;
.details
{
.details
{
width
:
55%
;
width
:
55%
;
min-height
:
200rpx
;
min-height
:
200rpx
;
...
@@ -454,12 +415,14 @@ onShow(() => {
...
@@ -454,12 +415,14 @@ onShow(() => {
flex-direction
:
column
;
flex-direction
:
column
;
align-items
:
self-start
!
important
;
align-items
:
self-start
!
important
;
margin-left
:
20rpx
;
margin-left
:
20rpx
;
.b-tag
{
.b-tag
{
display
:
flex
;
display
:
flex
;
flex-direction
:
row
;
flex-direction
:
row
;
flex-wrap
:
wrap
;
flex-wrap
:
wrap
;
}
}
}
}
.circle
{
.circle
{
position
:
relative
;
position
:
relative
;
display
:
inline-block
;
display
:
inline-block
;
...
@@ -468,6 +431,7 @@ onShow(() => {
...
@@ -468,6 +431,7 @@ onShow(() => {
border-radius
:
50%
;
border-radius
:
50%
;
background-color
:
#f32329
;
background-color
:
#f32329
;
margin-right
:
20rpx
;
margin-right
:
20rpx
;
.horizontal
{
.horizontal
{
position
:
absolute
;
position
:
absolute
;
top
:
44%
;
top
:
44%
;
...
@@ -480,6 +444,7 @@ onShow(() => {
...
@@ -480,6 +444,7 @@ onShow(() => {
background-color
:
#fff
;
background-color
:
#fff
;
}
}
}
}
.number-box
{
.number-box
{
display
:
flex
;
display
:
flex
;
flex-direction
:
column
;
flex-direction
:
column
;
...
@@ -498,9 +463,11 @@ onShow(() => {
...
@@ -498,9 +463,11 @@ onShow(() => {
justify-content
:
space-between
;
justify-content
:
space-between
;
align-items
:
center
;
align-items
:
center
;
margin-bottom
:
2rpx
;
margin-bottom
:
2rpx
;
.left
{
// height: 100%;
// .left {
}
// height: 100%;
// }
.right
{
.right
{
display
:
flex
;
display
:
flex
;
flex-direction
:
row
;
flex-direction
:
row
;
...
...
src/pages/goods/goodsSku.vue
浏览文件 @
e94ea407
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
</
template
>
</
template
>
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
{
ref
,
watch
,
nextTick
}
from
'vue'
;
import
{
ref
,
watch
}
from
'vue'
;
import
{
addCart
,
fastaddCart
,
readdCart
}
from
'@/api/index'
;
import
{
addCart
,
fastaddCart
,
readdCart
}
from
'@/api/index'
;
// SKU弹窗模式
// SKU弹窗模式
...
@@ -70,29 +70,6 @@ let onConfirm = (val: string, index: number) => {
...
@@ -70,29 +70,6 @@ let onConfirm = (val: string, index: number) => {
goodsInfo
.
value
.
spec_list
[
index
].
custom
=
val
goodsInfo
.
value
.
spec_list
[
index
].
custom
=
val
}
}
// 弹出sku后给规格赋值
let
resultSku
=
(
data
?:
any
)
=>
{
if
(
detailData
.
value
.
productList
.
length
===
1
)
{
nextTick
(()
=>
{
defaultSelect
.
value
=
{
sku
:
[...
detailData
.
value
.
productList
[
0
].
specifications
],
num
:
1
}
// skuPopupRef.value.selectArr = [...detailData.value.productList[0].specifications]
})
// skuPopupRef.value.selectShop = {
// buy_num: 1,
// goods_id: detailData.value.productList[0].goodsId,
// goods_name: detailData.value.info.name,
// image: detailData.value.info.picUrl,
// price: 0,
// sku_name_arr: { ...detailData.value.productList[0].specifications },
// stock: 1000,
// _id: detailData.value.productList[0].id,
// }
}
}
// 选择配件
// 选择配件
let
selectParts
=
(
data
:
any
)
=>
{
let
selectParts
=
(
data
:
any
)
=>
{
let
index
=
partsIds
.
value
.
indexOf
(
data
.
id
)
let
index
=
partsIds
.
value
.
indexOf
(
data
.
id
)
...
@@ -307,7 +284,7 @@ const addProduct = (selectShop: any) => {
...
@@ -307,7 +284,7 @@ const addProduct = (selectShop: any) => {
skuPopupRef
.
value
.
handClose
()
skuPopupRef
.
value
.
handClose
()
let
productId
:
any
=
getProductId
(
selectShop
.
sku_name_arr
)
let
productId
:
any
=
getProductId
(
selectShop
.
sku_name_arr
)
let
shop
=
custom
(
selectShop
)
let
shop
=
custom
(
selectShop
)
let
specifications
:
any
=
[]
let
specifications
:
any
=
selectShop
.
sku_name_arr
let
specificationCustom
:
any
=
[]
let
specificationCustom
:
any
=
[]
// 有自定义会走下面的逻辑
// 有自定义会走下面的逻辑
if
(
shop
.
flag
)
{
if
(
shop
.
flag
)
{
...
@@ -362,6 +339,7 @@ defineExpose({
...
@@ -362,6 +339,7 @@ defineExpose({
skuMode
,
skuMode
,
partsIds
,
partsIds
,
goodsInfoCopy
,
goodsInfoCopy
,
defaultSelect
,
init
,
init
,
handleClose
,
handleClose
,
});
});
...
...
src/pages/goods/index.vue
浏览文件 @
e94ea407
...
@@ -94,8 +94,10 @@ import {
...
@@ -94,8 +94,10 @@ import {
goodsParts
,
goodsParts
,
orderAttribute
orderAttribute
}
from
'@/api/index'
;
}
from
'@/api/index'
;
import
{
useSpecStore
}
from
'@/store/useStore'
import
goodsSku
from
'./goodsSku.vue'
import
goodsSku
from
'./goodsSku.vue'
const
specStore
=
useSpecStore
()
const
goodsSkuRef
=
ref
()
const
goodsSkuRef
=
ref
()
const
attrPopup
=
ref
(
false
);
const
attrPopup
=
ref
(
false
);
const
detailData
:
any
=
ref
();
const
detailData
:
any
=
ref
();
...
@@ -124,9 +126,8 @@ const buttonGroup = ref([
...
@@ -124,9 +126,8 @@ const buttonGroup = ref([
const
detailId
=
ref
()
const
detailId
=
ref
()
const
cartId
=
ref
()
// 判断是否从购物车进去修改购物车信息的购物车Id
const
cartId
=
ref
()
// 判断是否从购物车进去修改购物车信息的购物车Id
onLoad
((
options
:
any
)
=>
{
onLoad
((
options
:
any
)
=>
{
if
(
typeof
options
.
cartId
!==
'undefined'
)
cartId
.
value
=
options
.
cartId
if
(
options
.
cartId
)
cartId
.
value
=
options
.
cartId
detailId
.
value
=
options
.
id
detailId
.
value
=
options
.
id
// 在结算中返回时使用
// 在结算中返回时使用
uni
.
setStorage
({
uni
.
setStorage
({
...
@@ -141,6 +142,7 @@ let selectedGoodsSum = ref()
...
@@ -141,6 +142,7 @@ let selectedGoodsSum = ref()
// 选择规格展示
// 选择规格展示
let
selectedGoods
=
computed
(()
=>
{
let
selectedGoods
=
computed
(()
=>
{
console
.
log
(
selectedGoodsItem
.
value
);
if
(
selectedGoodsItem
.
value
.
length
>
0
)
{
if
(
selectedGoodsItem
.
value
.
length
>
0
)
{
let
str
=
''
let
str
=
''
selectedGoodsItem
.
value
.
forEach
((
item
:
any
,
i
:
number
)
=>
{
selectedGoodsItem
.
value
.
forEach
((
item
:
any
,
i
:
number
)
=>
{
...
@@ -215,8 +217,27 @@ const onClick = (e: any) => {
...
@@ -215,8 +217,27 @@ const onClick = (e: any) => {
}
}
};
};
// 页面返回后给弹出sku后给规格赋值
const
resultSku
=
()
=>
{
if
(
selectedGoodsItem
.
value
)
{
let
resultSkuObj
=
{
sku
:
selectedGoodsItem
.
value
,
num
:
selectedGoodsSum
.
value
}
goodsSkuRef
.
value
.
defaultSelect
=
resultSkuObj
}
}
// 打开sku
// 打开sku
const
buttonClick
=
()
=>
{
const
buttonClick
=
()
=>
{
// 如果从购物车来的,即存有默认值,需赋值到sku
if
(
specStore
.
isDefaultSku
)
{
goodsSkuRef
.
value
.
defaultSelect
=
specStore
.
defaultSelect
specStore
.
$patch
({
defaultSelect
:
{},
isDefaultSku
:
false
})
}
else
resultSku
()
goodsSkuRef
.
value
.
init
(
detailData
.
value
,
detailId
.
value
,
partsData
.
value
)
goodsSkuRef
.
value
.
init
(
detailData
.
value
,
detailId
.
value
,
partsData
.
value
)
goodsSkuRef
.
value
.
skuKey
=
true
goodsSkuRef
.
value
.
skuKey
=
true
};
};
...
...
src/pages/order/editQuotation.vue
浏览文件 @
e94ea407
...
@@ -57,8 +57,9 @@
...
@@ -57,8 +57,9 @@
import
{
onLoad
,
onBackPress
}
from
'@dcloudio/uni-app'
;
import
{
onLoad
,
onBackPress
}
from
'@dcloudio/uni-app'
;
import
{
ref
,
computed
,
nextTick
}
from
'vue'
;
import
{
ref
,
computed
,
nextTick
}
from
'vue'
;
import
{
quotationInitAgain
,
fillQuotation
}
from
'@/api/cart'
;
import
{
quotationInitAgain
,
fillQuotation
}
from
'@/api/cart'
;
import
{
getTax
}
from
'@/api/index'
;
import
{
deleteAddress
,
getTax
}
from
'@/api/index'
;
import
config
from
'@/utils/config'
;
import
config
from
'@/utils/config'
;
import
{
numberLiteralTypeAnnotation
}
from
'@babel/types'
;
let
baseUrl
=
config
.
baseUrl
;
let
baseUrl
=
config
.
baseUrl
;
let
orderId
=
ref
();
let
orderId
=
ref
();
...
@@ -136,42 +137,6 @@ let modelConfirm = () => {
...
@@ -136,42 +137,6 @@ let modelConfirm = () => {
}
}
};
};
const
getHeaders
=
(
href
:
string
)
=>
{
// var req = new XMLHttpRequest()
// req.open('GET', href, false)
// req.send(null)
// var headers = req.getAllResponseHeaders().toLowerCase()
// var tempCode = req.getResponseHeader('code')
// var code = '456'
// if (tempCode) {
// code = tempCode
// }
// console.log(headers, 'headersData')
var
req
=
new
XMLHttpRequest
();
req
.
open
(
'GET'
,
href
,
false
);
req
.
send
(
null
);
var
headers
=
req
.
getAllResponseHeaders
().
toLowerCase
();
alert
(
headers
);
// var req = new XMLHttpRequest();
// req.open('GET', href, false);
// req.send(null);
// var headerArr = req.getAllResponseHeaders().split('\n');
// var headers = {} as any;
// headerArr.forEach(item => {
// if (item !== '') {
// var index = item.indexOf(':');
// var key = item.slice(0, index);
// var value = item.slice(index + 1).trim();
// headers[key] = value
// }
// })
// console.log(headers, 'headersData');
// return headers
}
let
modelCancel
=
()
=>
{
let
modelCancel
=
()
=>
{
showModel
.
value
=
false
;
showModel
.
value
=
false
;
};
};
...
...
src/pages/order/orderList.vue
浏览文件 @
e94ea407
差异被折叠。
点击展开。
src/pages/productLine/productLine.vue
浏览文件 @
e94ea407
...
@@ -71,7 +71,7 @@
...
@@ -71,7 +71,7 @@
import
{
ref
,
nextTick
}
from
'vue'
;
import
{
ref
,
nextTick
}
from
'vue'
;
import
{
onLoad
}
from
'@dcloudio/uni-app'
;
import
{
onLoad
}
from
'@dcloudio/uni-app'
;
import
{
indexDetails
}
from
'@/api/index'
;
import
{
indexDetails
}
from
'@/api/index'
;
import
{
useStore
}
from
'@/store/useStore'
;
import
{
useStore
,
useSpecStore
}
from
'@/store/useStore'
;
import
{
import
{
addProductLineCart
,
addProductLineCart
,
productLineCollect
,
productLineCollect
,
...
@@ -86,6 +86,7 @@ import goodsSku from '@/pages/goods/goodsSku.vue';
...
@@ -86,6 +86,7 @@ import goodsSku from '@/pages/goods/goodsSku.vue';
import
setTitle
from
'./components/setTitle.vue'
;
import
setTitle
from
'./components/setTitle.vue'
;
let
store
=
useStore
();
let
store
=
useStore
();
let
specStore
=
useSpecStore
()
let
baseUrl
=
config
.
baseUrl
;
let
baseUrl
=
config
.
baseUrl
;
let
lineList
:
any
=
ref
(
store
.
lineData
);
//右侧tabber数据
let
lineList
:
any
=
ref
(
store
.
lineData
);
//右侧tabber数据
let
showPopup
:
any
=
ref
(
false
);
// popup弹窗
let
showPopup
:
any
=
ref
(
false
);
// popup弹窗
...
@@ -232,6 +233,7 @@ let addTabs = () => {
...
@@ -232,6 +233,7 @@ let addTabs = () => {
title
:
'添加商品已达上限'
,
title
:
'添加商品已达上限'
,
icon
:
'none'
icon
:
'none'
})
})
goodsSkuRef
.
value
.
defaultSelect
=
{}
// 清除默认sku
categoryRef
.
value
.
currentSubCategoryData
=
[];
categoryRef
.
value
.
currentSubCategoryData
=
[];
showPopup
.
value
=
true
;
showPopup
.
value
=
true
;
categoryRef
.
value
.
initIndex
();
categoryRef
.
value
.
initIndex
();
...
@@ -320,9 +322,17 @@ let sheetEdit = (index: number) => {
...
@@ -320,9 +322,17 @@ let sheetEdit = (index: number) => {
index
,
index
,
data
,
data
,
};
};
specStore
.
$patch
({
isDefaultSku
:
true
,
defaultSelect
:
{
sku
:
data
.
specifications
,
num
:
data
.
number
}
})
store
.
$patch
({
store
.
$patch
({
lineData
:
lineList
.
value
.
splice
(
index
,
1
),
lineData
:
lineList
.
value
.
splice
(
index
,
1
),
});
});
console
.
log
(
specStore
.
defaultSelect
,
'defaultSelect'
);
initDetails
(
data
.
goodsId
);
initDetails
(
data
.
goodsId
);
};
};
...
@@ -601,6 +611,13 @@ let initDetails = (id: number) => {
...
@@ -601,6 +611,13 @@ let initDetails = (id: number) => {
if
(
res
.
data
.
code
===
200
)
{
if
(
res
.
data
.
code
===
200
)
{
uni
.
hideLoading
();
uni
.
hideLoading
();
detailData
.
value
=
res
.
data
.
data
;
detailData
.
value
=
res
.
data
.
data
;
if
(
specStore
.
isDefaultSku
)
{
goodsSkuRef
.
value
.
defaultSelect
=
specStore
.
defaultSelect
specStore
.
$patch
({
defaultSelect
:
{},
isDefaultSku
:
false
})
}
goodsSkuRef
.
value
.
init
(
detailData
.
value
,
id
);
goodsSkuRef
.
value
.
init
(
detailData
.
value
,
id
);
goodsSkuRef
.
value
.
skuKey
=
true
;
goodsSkuRef
.
value
.
skuKey
=
true
;
goodsSkuRef
.
value
.
skuMode
=
5
;
goodsSkuRef
.
value
.
skuMode
=
5
;
...
...
src/store/useStore.ts
浏览文件 @
e94ea407
...
@@ -4,7 +4,7 @@ import { defineStore, createPinia } from 'pinia'
...
@@ -4,7 +4,7 @@ import { defineStore, createPinia } from 'pinia'
export
let
useStore
=
defineStore
(
'productLine'
,
{
export
let
useStore
=
defineStore
(
'productLine'
,
{
state
:
()
=>
{
state
:
()
=>
{
return
{
return
{
lineData
:
[{
show
:
false
,
status
:
0
}],
lineData
:
[{
show
:
false
,
status
:
0
}],
title
:
''
,
title
:
''
,
star
:
false
,
star
:
false
,
collectData
:
{}
// 收藏返回数据
collectData
:
{}
// 收藏返回数据
...
@@ -20,3 +20,15 @@ export let useCurrentStore = defineStore('current', {
...
@@ -20,3 +20,15 @@ export let useCurrentStore = defineStore('current', {
}
}
}
}
})
})
// 默认规格数据
export
let
useSpecStore
=
defineStore
(
'specData'
,
{
state
:
()
=>
{
return
{
defaultSelect
:
{},
// 数据
isDefaultSku
:
false
// 默认值
}
}
})
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论