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 个修改的文件
包含
277 行增加
和
285 行删除
+277
-285
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
+155
-126
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'
// 报价单-是否存在
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 @@
<view
v-if=
"item.isSubmit"
class=
"group-item"
>
<u-row
class=
"item"
>
<u-col
:span=
"1"
>
<u-checkbox
:name=
"item.id"
v-model=
"item.checked"
shape=
"circle"
></u-checkbox>
<u-checkbox
:name=
"item.id"
v-model=
"item.checked"
shape=
"circle"
></u-checkbox>
</u-col>
<u-col
:span=
"3"
>
<u-image
v-if=
"type === 0"
width=
"140rpx"
height=
"200rpx"
:src=
"baseUrl + item.picUrl"
class=
"img"
></u-image>
<u-image
v-if=
"type === 0"
width=
"140rpx"
height=
"200rpx"
:src=
"baseUrl + item.picUrl"
class=
"img"
></u-image>
</u-col>
<u-col
:span=
"delCircle ? 7 : 5"
class=
"details"
@
tap=
"
delCircle
? () => {
return;
}
: togoods(item)
"
>
<u-col
:span=
"delCircle ? 7 : 5"
class=
"details"
@
tap=
"
delCircle
? () => {
return;
}
: togoods(item)
"
>
<view>
{{ item.goodsName }}
</view>
<view
class=
"b-tag"
>
<block
v-for=
"(item1, index1) in item.specifications?.length"
:key=
"index1"
>
<u-tag
:text=
"item.specifications[index1]"
type=
"info"
size=
"mini"
style=
"margin: 8rpx 8rpx 8rpx 0;"
/>
<block
v-for=
"(item1, index1) in item.specifications?.length"
:key=
"index1"
>
<u-tag
:text=
"item.specifications[index1]"
type=
"info"
size=
"mini"
style=
"margin: 8rpx 8rpx 8rpx 0;"
/>
</block>
</view>
<view
v-if=
"item.partList?.length !== 0"
class=
"b-tag"
>
<block
v-for=
"(item1, index1) in item.partList?.length"
:key=
"index1"
>
<u-tag
:text=
"item.partList[index1]"
type=
"warning"
size=
"mini"
style=
"margin: 8rpx 8rpx 8rpx 0;"
/>
<block
v-for=
"(item1, index1) in item.partList?.length"
:key=
"index1"
>
<u-tag
:text=
"item.partList[index1]"
type=
"warning"
size=
"mini"
style=
"margin: 8rpx 8rpx 8rpx 0;"
/>
</block>
</view>
</u-col>
...
...
@@ -74,12 +47,8 @@
</u-col>
<u-col
v-else
:span=
"3"
style=
"margin-top: 20%;"
>
<view
class=
"number-box"
>
<u-number-box
v-model=
"item.number"
:min=
"1"
disabled-input
@
change=
"valChange($event, item)"
></u-number-box>
<u-number-box
v-model=
"item.number"
:min=
"1"
disabled-input
@
change=
"valChange($event, item)"
></u-number-box>
</view>
</u-col>
</u-row>
...
...
@@ -89,33 +58,21 @@
<view
class=
"item"
>
<u-row>
<u-col
:span=
"1"
>
<u-checkbox
:name=
"item.id"
:disabled=
"!item.isSubmit && !delCircle"
v-model=
"item.checked"
shape=
"circle"
></u-checkbox>
<u-checkbox
:name=
"item.id"
:disabled=
"!item.isSubmit && !delCircle"
v-model=
"item.checked"
shape=
"circle"
></u-checkbox>
</u-col>
<u-col
:span=
"3"
>
<u-image
v-if=
"type === 0"
width=
"140rpx"
height=
"200rpx"
:src=
"baseUrl + item.picUrl"
class=
"img"
></u-image>
<u-image
v-if=
"type === 0"
width=
"140rpx"
height=
"200rpx"
:src=
"baseUrl + item.picUrl"
class=
"img"
></u-image>
</u-col>
<u-col
:span=
"7"
>
<view
class=
"details"
@
tap=
"
item.deleted
? () => {
return;
}
: togoods(item)
"
>
<view
class=
"details"
@
tap=
"
item.deleted
? () => {
return;
}
: togoods(item)
"
>
<view>
{{ item.goodsName }}
</view>
<view
style=
"color: #ccc; margin-top: 20%;"
>
{{ item.message }}
...
...
@@ -133,7 +90,9 @@
</block>
</u-checkbox-group>
</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
class=
"footer"
>
<view
class=
"left"
>
...
...
@@ -148,39 +107,29 @@
<text v-show="!delCircle" style="color: red; font-size: 40rpx;">
¥{{ totalPrice }}
</text> -->
<u-button
shape=
"circle"
size=
"medium"
hover-class=
"#f32329"
style=
"background-color: #f32329; margin-left: 20rpx; color: #fff;"
@
tap=
"tapOptions"
>
<u-button
shape=
"circle"
size=
"medium"
hover-class=
"#f32329"
style=
"background-color: #f32329; margin-left: 20rpx; color: #fff;"
@
tap=
"tapOptions"
>
{{ !delCircle ? '结算' : '删除' }}
</u-button>
</view>
</view>
<!-- 删除模态框 -->
<u-modal
v-model=
"showModel.show"
:content=
"showModel.content"
:title=
"showModel.title"
show-cancel-button
async-close
:cancel-text=
"showModel.cancelText"
@
confirm=
"onConfirm"
></u-modal>
<u-modal
v-model=
"showModel.show"
:content=
"showModel.content"
:title=
"showModel.title"
show-cancel-button
async-close
:cancel-text=
"showModel.cancelText"
@
confirm=
"onConfirm"
></u-modal>
</template>
<
script
lang=
"ts"
setup
>
import
{
ref
,
reactive
}
from
'vue'
;
import
{
getCartIndex
,
cartChecked
,
cartDelete
,
cartUpdate
}
from
'@/api/cart'
;
import
{
onShow
}
from
'@dcloudio/uni-app'
;
import
{
useSpecStore
}
from
'@/store/useStore'
import
_
from
'lodash'
;
import
config
from
'@/utils/config'
;
let
baseUrl
=
config
.
baseUrl
;
const
specStore
=
useSpecStore
()
// 记录默认规格
const
cartList
=
ref
([]
as
any
);
// 购物车数据
const
checkedAll
=
ref
(
false
);
// 全选checkbox
const
allGoods
=
ref
();
// 购物车列表id
...
...
@@ -311,7 +260,18 @@ const tapOptions = () => {
let
togoods
=
(
data
:
any
)
=>
{
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
uni
.
reLaunch
({
url
:
'../productLine/productLine?id='
+
data
.
goodsId
+
'&cartId='
+
data
.
id
,
...
...
@@ -447,6 +407,7 @@ onShow(() => {
padding
:
15rpx
;
margin-bottom
:
10rpx
;
background-color
:
#fff
;
.details
{
width
:
55%
;
min-height
:
200rpx
;
...
...
@@ -454,12 +415,14 @@ onShow(() => {
flex-direction
:
column
;
align-items
:
self-start
!
important
;
margin-left
:
20rpx
;
.b-tag
{
display
:
flex
;
flex-direction
:
row
;
flex-wrap
:
wrap
;
}
}
.circle
{
position
:
relative
;
display
:
inline-block
;
...
...
@@ -468,6 +431,7 @@ onShow(() => {
border-radius
:
50%
;
background-color
:
#f32329
;
margin-right
:
20rpx
;
.horizontal
{
position
:
absolute
;
top
:
44%
;
...
...
@@ -480,6 +444,7 @@ onShow(() => {
background-color
:
#fff
;
}
}
.number-box
{
display
:
flex
;
flex-direction
:
column
;
...
...
@@ -498,9 +463,11 @@ onShow(() => {
justify-content
:
space-between
;
align-items
:
center
;
margin-bottom
:
2rpx
;
.left
{
// height: 100%;
}
// .left {
// height: 100%;
// }
.right
{
display
:
flex
;
flex-direction
:
row
;
...
...
src/pages/goods/goodsSku.vue
浏览文件 @
e94ea407
...
...
@@ -10,7 +10,7 @@
</
template
>
<
script
setup
lang=
"ts"
>
import
{
ref
,
watch
,
nextTick
}
from
'vue'
;
import
{
ref
,
watch
}
from
'vue'
;
import
{
addCart
,
fastaddCart
,
readdCart
}
from
'@/api/index'
;
// SKU弹窗模式
...
...
@@ -70,29 +70,6 @@ let onConfirm = (val: string, index: number) => {
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
index
=
partsIds
.
value
.
indexOf
(
data
.
id
)
...
...
@@ -307,7 +284,7 @@ const addProduct = (selectShop: any) => {
skuPopupRef
.
value
.
handClose
()
let
productId
:
any
=
getProductId
(
selectShop
.
sku_name_arr
)
let
shop
=
custom
(
selectShop
)
let
specifications
:
any
=
[]
let
specifications
:
any
=
selectShop
.
sku_name_arr
let
specificationCustom
:
any
=
[]
// 有自定义会走下面的逻辑
if
(
shop
.
flag
)
{
...
...
@@ -362,6 +339,7 @@ defineExpose({
skuMode
,
partsIds
,
goodsInfoCopy
,
defaultSelect
,
init
,
handleClose
,
});
...
...
src/pages/goods/index.vue
浏览文件 @
e94ea407
...
...
@@ -94,8 +94,10 @@ import {
goodsParts
,
orderAttribute
}
from
'@/api/index'
;
import
{
useSpecStore
}
from
'@/store/useStore'
import
goodsSku
from
'./goodsSku.vue'
const
specStore
=
useSpecStore
()
const
goodsSkuRef
=
ref
()
const
attrPopup
=
ref
(
false
);
const
detailData
:
any
=
ref
();
...
...
@@ -124,9 +126,8 @@ const buttonGroup = ref([
const
detailId
=
ref
()
const
cartId
=
ref
()
// 判断是否从购物车进去修改购物车信息的购物车Id
onLoad
((
options
:
any
)
=>
{
if
(
typeof
options
.
cartId
!==
'undefined'
)
cartId
.
value
=
options
.
cartId
if
(
options
.
cartId
)
cartId
.
value
=
options
.
cartId
detailId
.
value
=
options
.
id
// 在结算中返回时使用
uni
.
setStorage
({
...
...
@@ -141,6 +142,7 @@ let selectedGoodsSum = ref()
// 选择规格展示
let
selectedGoods
=
computed
(()
=>
{
console
.
log
(
selectedGoodsItem
.
value
);
if
(
selectedGoodsItem
.
value
.
length
>
0
)
{
let
str
=
''
selectedGoodsItem
.
value
.
forEach
((
item
:
any
,
i
:
number
)
=>
{
...
...
@@ -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
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
.
skuKey
=
true
};
...
...
src/pages/order/editQuotation.vue
浏览文件 @
e94ea407
...
...
@@ -57,8 +57,9 @@
import
{
onLoad
,
onBackPress
}
from
'@dcloudio/uni-app'
;
import
{
ref
,
computed
,
nextTick
}
from
'vue'
;
import
{
quotationInitAgain
,
fillQuotation
}
from
'@/api/cart'
;
import
{
getTax
}
from
'@/api/index'
;
import
{
deleteAddress
,
getTax
}
from
'@/api/index'
;
import
config
from
'@/utils/config'
;
import
{
numberLiteralTypeAnnotation
}
from
'@babel/types'
;
let
baseUrl
=
config
.
baseUrl
;
let
orderId
=
ref
();
...
...
@@ -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
=
()
=>
{
showModel
.
value
=
false
;
};
...
...
src/pages/order/orderList.vue
浏览文件 @
e94ea407
...
...
@@ -2,72 +2,38 @@
<view>
<view
class=
"wrap"
>
<view
class=
"u-tabs-box"
>
<u-tabs-swiper
activeColor=
"#f29100"
ref=
"swiperTabs"
:list=
"list"
:current=
"current"
@
change=
"change"
:is-scroll=
"false"
swiperWidth=
"750"
></u-tabs-swiper>
<u-tabs-swiper
activeColor=
"#f29100"
ref=
"swiperTabs"
:list=
"list"
:current=
"current"
@
change=
"change"
:is-scroll=
"false"
swiperWidth=
"750"
></u-tabs-swiper>
</view>
<swiper
class=
"swiper-box"
:current=
"swiperCurrent"
@
transition=
"transition"
@
animationfinish=
"animationfinish"
>
<swiper
class=
"swiper-box"
:current=
"swiperCurrent"
@
transition=
"transition"
@
animationfinish=
"animationfinish"
>
<swiper-item
v-for=
"(s, i) in list.length"
:key=
"i"
class=
"swiper-item"
>
<scroll-view
v-if=
"orderData.length !== 0"
scroll-y
style=
"height: 100%;width: 100%;"
@
scrolltolower=
"reachBottom"
>
<scroll-view
v-if=
"orderData.length !== 0"
scroll-y
style=
"height: 100%;width: 100%;"
@
scrolltolower=
"reachBottom"
>
<view
class=
"page-box"
>
<view
class=
"order"
v-for=
"(res, index) in orderData"
:key=
"res.id"
>
<view
class=
"top"
>
<view
class=
"left"
>
<u-icon
name=
"home"
:size=
"30"
color=
"rgb(94,94,94)"
></u-icon>
<u-icon
name=
"home"
:size=
"30"
color=
"rgb(94,94,94)"
></u-icon>
<view
class=
"store"
>
订单编号:
{{
res
.
orderSn
}}
</view>
<u-icon
name=
"arrow-right"
color=
"rgb(203,203,203)"
:size=
"26"
></u-icon>
<u-icon
name=
"arrow-right"
color=
"rgb(203,203,203)"
:size=
"26"
></u-icon>
</view>
<view
class=
"right"
>
{{
res
.
orderStatusText
}}
</view>
</view>
<view
class=
"item"
v-for=
"(item, index) in res.goodsList"
:key=
"index"
>
<view
class=
"item"
v-for=
"(item, index) in res.goodsList"
:key=
"index"
>
<view
class=
"left"
>
<image
:src=
"
item.picUrl.split('http').length > 1
? item.picUrl
: baseUrl + item.picUrl
"
mode=
"aspectFill"
></image>
<image
:src=
"
item.picUrl.split('http').length > 1
? item.picUrl
: baseUrl + item.picUrl
"
mode=
"aspectFill"
></image>
</view>
<view
class=
"content"
>
<view
class=
"title u-line-2"
>
{{
item
.
goodsName
}}
</view>
<view
class=
"type"
>
{{
item
.
type
}}
</view>
<view
class=
"content-item"
>
<view
v-for=
"(item1, index1) in item.specifications
.length"
:key=
"index1"
class=
"delivery-time"
>
<view
v-for=
"(item1, index1) in item.specifications
.length"
:key=
"index1"
class=
"delivery-time"
>
{{
item
.
specifications
[
index1
]
}}
</view>
</view>
...
...
@@ -92,37 +58,27 @@
</text>
</view>
<view
class=
"bottom"
>
<view
class=
""
></view
>
<view
/
>
<view
style=
"display: flex; flex-direction: row;"
>
<view
v-if=
"res.orderStatusText === '待推送'"
class=
"evaluate btn"
@
tap=
"orderQuotation(res.id, res.type)
"
>
<view
class=
"evaluate1 btn1"
@
tap=
"addCart(res.id)"
>
加入购物车
</view>
<view
v-if=
"res.orderStatusText === '待推送'"
class=
"evaluate btn
"
@
tap=
"orderQuotation(res.id, res.type)"
>
生成报价
</view>
<view
v-if=
"res.orderStatusText === '待推送'"
class=
"evaluate btn"
@
tap=
"orderPush(res.id)"
>
<view
v-if=
"res.orderStatusText === '待推送'"
class=
"evaluate btn"
@
tap=
"orderPush(res.id)"
>
推送订单
</view>
<view
v-if=
"res.orderStatusText === '待推送'"
class=
"evaluate btn"
@
tap=
"orderDel(res.id)"
>
<view
v-if=
"res.orderStatusText === '待推送'"
class=
"evaluate btn"
@
tap=
"orderDel(res.id)"
>
删除订单
</view>
</view>
</view>
</view>
<u-loadmore
:status=
"status"
bgColor=
"#f2f2f2"
style=
"padding: 20rpx 0;"
></u-loadmore>
<u-loadmore
:status=
"status"
bgColor=
"#f2f2f2"
style=
"padding: 20rpx 0;"
></u-loadmore>
</view>
</scroll-view>
...
...
@@ -131,10 +87,8 @@
<view
class=
"page-box"
>
<view>
<view
class=
"centre"
>
<image
src=
"https://cdn.uviewui.com/uview/template/taobao-order.png"
mode=
""
></image>
<image
src=
"https://cdn.uviewui.com/uview/template/taobao-order.png"
mode=
""
>
</image>
<view
class=
"explain"
>
您还没有相关的订单
<view
class=
"tips"
>
可以去看看有那些想买的
</view>
...
...
@@ -155,7 +109,7 @@
<
script
setup
lang=
"ts"
>
import
{
ref
,
computed
}
from
'vue'
import
{
getOrderData
,
orderDelete
,
pushOrder
}
from
'@/api/index'
import
{
quotationExist
}
from
'@/api/cart'
import
{
quotationExist
,
orderCartAgain
}
from
'@/api/cart'
import
{
onLoad
}
from
'@dcloudio/uni-app'
import
{
useCurrentStore
}
from
'@/store/useStore'
import
config
from
'@/utils/config'
;
...
...
@@ -170,15 +124,29 @@ let listQuery = ref({
page
:
1
,
limit
:
10
})
let
value1
=
ref
(
1
)
let
options1
=
ref
([{
label
:
'默认排序'
,
value
:
1
,
},
{
label
:
'距离优先'
,
value
:
2
,
},
{
label
:
'价格优先'
,
value
:
3
,
}
])
let
swiperTabs
=
ref
()
let
orderData
=
ref
([]
as
any
)
let
total
=
ref
(
0
)
let
list
=
ref
([
{
name
:
'全部'
},
{
name
:
'待推送'
},
{
name
:
'待生产'
},
{
name
:
'待发货'
},
{
name
:
'已完成'
}
// count: 12
{
name
:
'全部'
},
{
name
:
'待推送'
},
{
name
:
'待生产'
},
{
name
:
'待发货'
},
{
name
:
'已完成'
}
// count: 12
])
let
current
=
ref
(
0
)
let
swiperCurrent
=
ref
(
0
)
...
...
@@ -186,7 +154,7 @@ let status = ref('loadmore')
let
orderIds
=
ref
(
0
)
//删除的订单id
onLoad
((
options
?:
any
)
=>
{
if
(
options
)
{
if
(
options
)
{
current
.
value
=
options
.
showType
swiperCurrent
.
value
=
options
.
showType
listQuery
.
value
.
showType
=
options
.
showType
...
...
@@ -194,20 +162,20 @@ onLoad((options?: any) => {
getOrderList
()
})
// 价格小数
// 价格小数
let
priceDecimal
=
computed
(()
=>
{
return
(
val
:
any
)
=>
{
if
(
val
!==
parseInt
(
val
))
return
val
.
slice
(
-
2
);
else
return
'00'
;
};
})
// 价格整数
return
(
val
:
any
)
=>
{
if
(
val
!==
parseInt
(
val
))
return
val
.
slice
(
-
2
);
else
return
'00'
;
};
})
// 价格整数
let
priceInt
=
computed
(()
=>
{
return
(
val
:
any
)
=>
{
if
(
val
!==
parseInt
(
val
))
return
val
.
split
(
'.'
)[
0
];
else
return
val
;
};
})
return
(
val
:
any
)
=>
{
if
(
val
!==
parseInt
(
val
))
return
val
.
split
(
'.'
)[
0
];
else
return
val
;
};
})
let
reachBottom
=
()
=>
{
// 判断是否还有下一页数据
...
...
@@ -218,25 +186,25 @@ let reachBottom = () => {
getOrderList
();
}
// 总价
// 总价
let
totalPrice
=
(
item
:
any
)
=>
{
let
price
=
0
;
item
.
map
((
val
:
any
)
=>
{
price
+=
parseFloat
(
val
.
price
);
});
return
price
.
toFixed
(
2
);
}
// 总件数
let
price
=
0
;
item
.
map
((
val
:
any
)
=>
{
price
+=
parseFloat
(
val
.
price
);
});
return
price
.
toFixed
(
2
);
}
// 总件数
let
totalNum
=
(
item
:
any
)
=>
{
let
num
=
0
;
item
.
map
((
val
:
any
)
=>
{
num
+=
val
.
number
;
});
return
num
;
}
// tab栏切换
let
num
=
0
;
item
.
map
((
val
:
any
)
=>
{
num
+=
val
.
number
;
});
return
num
;
}
// tab栏切换
let
change
=
(
index
:
any
)
=>
{
if
(
swiperCurrent
.
value
===
index
)
return
if
(
swiperCurrent
.
value
===
index
)
return
swiperCurrent
.
value
=
index
;
listQuery
.
value
.
showType
=
index
orderData
.
value
=
[]
...
...
@@ -244,15 +212,22 @@ let change = (index: any) => {
}
// swiper-item 的位置发生改变时会触发
let
transition
=
(
data
:
any
)
=>
{
let
dx
=
data
.
detail
.
dx
swiperTabs
.
value
?.
setDx
(
dx
);
}
let
dx
=
data
.
detail
.
dx
swiperTabs
.
value
?.
setDx
(
dx
);
}
// 动画结束时会触发 animationfinish 事件
let
animationfinish
=
(
data
:
any
)
=>
{
let
currentNum
=
data
.
detail
.
current
swiperTabs
.
value
?.
setFinishCurrent
(
currentNum
);
swiperCurrent
.
value
=
currentNum
;
current
.
value
=
currentNum
;
let
currentNum
=
data
.
detail
.
current
swiperTabs
.
value
?.
setFinishCurrent
(
currentNum
);
swiperCurrent
.
value
=
currentNum
;
current
.
value
=
currentNum
;
}
// 加入购物车
let
addCart
=
(
orderId
:
number
)
=>
{
orderIds
.
value
=
orderId
content
.
value
=
'确定加入购物车?'
show
.
value
=
true
}
// 删除订单
...
...
@@ -265,10 +240,10 @@ let orderDel = (orderId: number) => {
// 生成报价 type为0是普通订单, 2是生产线订单
let
orderQuotation
=
(
orderId
:
number
,
type
:
number
)
=>
{
orderIds
.
value
=
orderId
if
(
type
==
0
)
{
if
(
type
==
0
)
{
quotationExist
({
orderId
}).
then
((
res
:
any
)
=>
{
if
(
res
.
data
.
code
===
200
)
{
if
(
res
.
data
.
data
)
{
if
(
res
.
data
.
code
===
200
)
{
if
(
res
.
data
.
data
)
{
uni
.
navigateTo
({
url
:
'../order/editQuotation?orderId='
+
orderId
})
...
...
@@ -304,9 +279,9 @@ let orderPush = (orderId: number) => {
// 确认操作
let
onConfirm
=
()
=>
{
if
(
content
.
value
==
'确认删除该订单?'
)
{
if
(
content
.
value
==
'确认删除该订单?'
)
{
orderDelete
({
orderId
:
orderIds
.
value
}).
then
((
res
:
any
)
=>
{
if
(
res
.
data
.
code
===
200
)
{
if
(
res
.
data
.
code
===
200
)
{
orderData
.
value
=
[]
listQuery
.
value
.
page
=
1
getOrderList
()
...
...
@@ -316,9 +291,19 @@ let onConfirm = () => {
})
}
})
}
else
if
(
content
.
value
==
'确定加入购物车?'
)
{
orderCartAgain
({
orderId
:
orderIds
.
value
}).
then
((
res
:
any
)
=>
{
if
(
res
.
data
.
code
===
200
)
{
uni
.
showToast
({
title
:
'加入成功'
,
icon
:
'none'
,
mask
:
true
})
}
})
}
else
{
pushOrder
({
orderId
:
orderIds
.
value
}).
then
((
res
:
any
)
=>
{
if
(
res
.
data
.
code
===
200
)
{
if
(
res
.
data
.
code
===
200
)
{
orderData
.
value
=
[]
listQuery
.
value
.
page
=
1
getOrderList
()
...
...
@@ -335,7 +320,7 @@ let onConfirm = () => {
let
getOrderList
=
()
=>
{
status
.
value
=
'loading'
;
getOrderData
(
listQuery
.
value
).
then
((
res
:
any
)
=>
{
if
(
res
.
data
.
code
===
200
)
{
if
(
res
.
data
.
code
===
200
)
{
if
(
res
.
data
.
data
.
total
>
10
)
status
.
value
=
'loadmore'
;
else
status
.
value
=
'nomore'
;
total
.
value
=
res
.
data
.
data
.
total
...
...
@@ -351,6 +336,7 @@ page {
/* height: 100%; */
/* background-color: #f2f2f2; */
}
/* #endif */
</
style
>
...
...
@@ -363,49 +349,61 @@ page {
box-sizing
:
border-box
;
padding
:
20rpx
;
font-size
:
28rpx
;
.top
{
display
:
flex
;
justify-content
:
space-between
;
.left
{
display
:
flex
;
align-items
:
center
;
.store
{
margin
:
0
10rpx
;
font-size
:
26rpx
;
font-weight
:
bold
;
}
}
.right
{
color
:
$u-type-warning-dark
;
}
}
.item
{
display
:
flex
;
margin
:
20rpx
0
0
;
.left
{
margin-right
:
20rpx
;
image
{
width
:
200rpx
;
height
:
200rpx
;
border-radius
:
10rpx
;
}
}
.content
{
width
:
45%
;
.title
{
font-size
:
28rpx
;
line-height
:
72rpx
;
}
.type
{
margin
:
10rpx
0
;
font-size
:
24rpx
;
color
:
$u-tips-color
;
}
.content-item
{
display
:
flex
;
flex-direction
:
row
;
justify-content
:
flex-start
;
flex-wrap
:
wrap
;
.delivery-time
{
color
:
#e5d001
;
font-size
:
24rpx
;
...
...
@@ -413,65 +411,93 @@ page {
}
}
}
.right
{
margin-left
:
10rpx
;
padding-top
:
20rpx
;
text-align
:
right
;
.decimal
{
font-size
:
24rpx
;
margin-top
:
4rpx
;
}
.number
{
color
:
$u-tips-color
;
font-size
:
24rpx
;
}
}
}
.total
{
margin-top
:
20rpx
;
text-align
:
right
;
font-size
:
24rpx
;
.total-price
{
font-size
:
32rpx
;
}
}
.bottom
{
display
:
flex
;
margin-top
:
40rpx
;
padding
:
0
10rpx
;
justify-content
:
space-between
;
align-items
:
center
;
.btn
{
line-height
:
52rpx
;
width
:
160rpx
;
width
:
140rpx
;
border-radius
:
26rpx
;
border
:
2rpx
solid
$u-border-color
;
font-size
:
24rpx
;
text-align
:
center
;
color
:
$u-type-info-dark
;
}
.btn1
{
line-height
:
52rpx
;
width
:
150rpx
;
border-radius
:
26rpx
;
border
:
2rpx
solid
$u-border-color
;
font-size
:
2
6
rpx
;
font-size
:
2
4
rpx
;
text-align
:
center
;
color
:
$u-type-info-dark
;
}
.evaluate
{
color
:
$u-type-warning-dark
;
border-color
:
$u-type-warning-dark
;
margin-right
:
8rpx
;
}
.evaluate1
{
color
:
#000
;
border-color
:
rgba
(
204
,
204
,
204
,
0
.621
);
margin-right
:
8rpx
;
}
}
}
.centre
{
text-align
:
center
;
margin
:
200rpx
auto
;
font-size
:
32rpx
;
image
{
width
:
164rpx
;
height
:
164rpx
;
border-radius
:
50%
;
margin-bottom
:
20rpx
;
}
.tips
{
font-size
:
24rpx
;
color
:
#999999
;
margin-top
:
20rpx
;
}
.btn
{
margin
:
80rpx
auto
;
width
:
200rpx
;
...
...
@@ -482,15 +508,18 @@ page {
background
:
linear-gradient
(
270deg
,
rgba
(
249
,
116
,
90
,
1
)
0%
,
rgba
(
255
,
158
,
1
,
1
)
100%
);
}
}
.wrap
{
display
:
flex
;
flex-direction
:
column
;
height
:
calc
(
100vh
-
var
(
--
window-top
));
width
:
100%
;
}
.swiper-box
{
flex
:
1
;
}
.swiper-item
{
height
:
100%
;
}
...
...
src/pages/productLine/productLine.vue
浏览文件 @
e94ea407
...
...
@@ -71,7 +71,7 @@
import
{
ref
,
nextTick
}
from
'vue'
;
import
{
onLoad
}
from
'@dcloudio/uni-app'
;
import
{
indexDetails
}
from
'@/api/index'
;
import
{
useStore
}
from
'@/store/useStore'
;
import
{
useStore
,
useSpecStore
}
from
'@/store/useStore'
;
import
{
addProductLineCart
,
productLineCollect
,
...
...
@@ -86,6 +86,7 @@ import goodsSku from '@/pages/goods/goodsSku.vue';
import
setTitle
from
'./components/setTitle.vue'
;
let
store
=
useStore
();
let
specStore
=
useSpecStore
()
let
baseUrl
=
config
.
baseUrl
;
let
lineList
:
any
=
ref
(
store
.
lineData
);
//右侧tabber数据
let
showPopup
:
any
=
ref
(
false
);
// popup弹窗
...
...
@@ -232,6 +233,7 @@ let addTabs = () => {
title
:
'添加商品已达上限'
,
icon
:
'none'
})
goodsSkuRef
.
value
.
defaultSelect
=
{}
// 清除默认sku
categoryRef
.
value
.
currentSubCategoryData
=
[];
showPopup
.
value
=
true
;
categoryRef
.
value
.
initIndex
();
...
...
@@ -320,9 +322,17 @@ let sheetEdit = (index: number) => {
index
,
data
,
};
specStore
.
$patch
({
isDefaultSku
:
true
,
defaultSelect
:
{
sku
:
data
.
specifications
,
num
:
data
.
number
}
})
store
.
$patch
({
lineData
:
lineList
.
value
.
splice
(
index
,
1
),
});
console
.
log
(
specStore
.
defaultSelect
,
'defaultSelect'
);
initDetails
(
data
.
goodsId
);
};
...
...
@@ -601,6 +611,13 @@ let initDetails = (id: number) => {
if
(
res
.
data
.
code
===
200
)
{
uni
.
hideLoading
();
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
.
skuKey
=
true
;
goodsSkuRef
.
value
.
skuMode
=
5
;
...
...
src/store/useStore.ts
浏览文件 @
e94ea407
...
...
@@ -4,7 +4,7 @@ import { defineStore, createPinia } from 'pinia'
export
let
useStore
=
defineStore
(
'productLine'
,
{
state
:
()
=>
{
return
{
lineData
:
[{
show
:
false
,
status
:
0
}],
lineData
:
[{
show
:
false
,
status
:
0
}],
title
:
''
,
star
:
false
,
collectData
:
{}
// 收藏返回数据
...
...
@@ -20,3 +20,15 @@ export let useCurrentStore = defineStore('current', {
}
}
})
// 默认规格数据
export
let
useSpecStore
=
defineStore
(
'specData'
,
{
state
:
()
=>
{
return
{
defaultSelect
:
{},
// 数据
isDefaultSku
:
false
// 默认值
}
}
})
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论