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
3b58d490
提交
3b58d490
authored
12月 07, 2022
作者:
刘旭
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
提交完成代码
上级
8c65f22b
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
17 个修改的文件
包含
649 行增加
和
244 行删除
+649
-244
productLine.ts
src/api/productLine.ts
+24
-8
profile.ts
src/api/profile.ts
+6
-0
index.vue
src/pages/cart/index.vue
+49
-26
goodsSku.vue
src/pages/goods/goodsSku.vue
+10
-3
index.vue
src/pages/goods/index.vue
+10
-10
index.vue
src/pages/index/index.vue
+4
-0
login.vue
src/pages/login/login.vue
+2
-4
checkout.vue
src/pages/order/checkout.vue
+26
-18
downPdf.vue
src/pages/order/downPdf.vue
+4
-85
quotation.vue
src/pages/order/quotation.vue
+0
-0
categoryPopup.vue
src/pages/productLine/components/categoryPopup.vue
+20
-3
drag-and-drop-sort.vue
src/pages/productLine/components/drag-and-drop-sort.vue
+5
-5
searchPopup.vue
src/pages/productLine/components/searchPopup.vue
+113
-0
productLine.vue
src/pages/productLine/productLine.vue
+164
-24
addSite.vue
src/pages/profile/addSite.vue
+29
-13
address.vue
src/pages/profile/address.vue
+65
-29
setting.vue
src/pages/profile/setting.vue
+118
-16
没有找到文件。
src/api/productLine.ts
浏览文件 @
3b58d490
import
{
request
}
from
'@/utils/request'
import
{
request
}
from
'@/utils/request'
;
// 产品线加入购物车
// 产品线加入购物车
export
const
addProductLineCart
=
(
data
:
any
)
=>
request
(
'/wx/productLine/cart'
,
'POST'
,
data
)
export
const
addProductLineCart
=
(
data
:
any
)
=>
request
(
'/wx/productLine/cart'
,
'POST'
,
data
)
;
// 产品线收藏
// 产品线收藏
export
const
productLineCollect
=
(
data
:
any
)
=>
request
(
'/wx/productLine/collect'
,
'POST'
,
data
)
export
const
productLineCollect
=
(
data
:
any
)
=>
request
(
'/wx/productLine/collect'
,
'POST'
,
data
)
;
// 产品线取消收藏或重新收藏
// 产品线取消收藏或重新收藏
export
const
delProductLineCollect
=
(
data
:
any
)
=>
request
(
'/wx/collect/addordelete'
,
'POST'
,
data
)
export
const
delProductLineCollect
=
(
data
:
any
)
=>
request
(
'/wx/collect/addordelete'
,
'POST'
,
data
);
// 产品线点击购买
// 产品线点击购买
export
const
productLineByuNow
=
(
data
:
any
)
=>
request
(
'/wx/cart/fastadd'
,
'POST'
,
data
)
export
const
productLineByuNow
=
(
data
:
any
)
=>
request
(
'/wx/cart/fastadd'
,
'POST'
,
data
)
;
// 产品线点击购买后获取数据
// 产品线点击购买后获取数据
export
const
getProductLineByuNowData
=
(
data
:
any
)
=>
request
(
'/wx/cart/checkout'
,
'GET'
,
data
)
export
const
getProductLineByuNowData
=
(
data
:
any
)
=>
request
(
'/wx/cart/checkout'
,
'GET'
,
data
)
;
// 产品线点击购买后获取数据
// 产品线点击购买后获取数据
export
const
getProductLineIndex
=
(
data
:
any
)
=>
request
(
'/wx/productLine/index'
,
'GET'
,
data
)
export
const
getProductLineIndex
=
(
data
:
any
)
=>
request
(
'/wx/productLine/index'
,
'GET'
,
data
);
\ No newline at end of file
// 产品线-删除组成商品
export
const
getProductLineItemDelete
=
(
data
:
any
)
=>
request
(
'/wx/productLine/item/delete'
,
'POST'
,
data
);
// 产品线-组成商品重新选择规格
export
const
getProductLineItemReadd
=
(
data
:
any
)
=>
request
(
'/wx/productLine/item/readd'
,
'POST'
,
data
);
// 产品线-删除组成商品
export
const
getProductLineItemAdd
=
(
data
:
any
)
=>
request
(
'/wx/productLine/item/add'
,
'POST'
,
data
);
// 产品线-删除组成商品
export
const
getProductLineReAdd
=
(
data
:
any
)
=>
request
(
'/wx/productLine/reAdd'
,
'POST'
,
data
);
src/api/profile.ts
浏览文件 @
3b58d490
...
@@ -23,3 +23,9 @@ export const consigneeList = (data?: any) => request('/wx/address/consignee', 'G
...
@@ -23,3 +23,9 @@ export const consigneeList = (data?: any) => request('/wx/address/consignee', 'G
// 查询每个状态订单数
// 查询每个状态订单数
export
const
orderCount
=
()
=>
request
(
'/wx/user/index'
,
'GET'
);
export
const
orderCount
=
()
=>
request
(
'/wx/user/index'
,
'GET'
);
// 更新发货地址
export
const
resetWorkAddr
=
(
data
:
any
)
=>
request
(
'/wx/auth/reset_work_addr'
,
'POST'
,
data
);
// 更新手机号
export
const
resetMobile
=
(
data
:
any
)
=>
request
(
'/wx/auth/reset_mobile'
,
'POST'
,
data
);
src/pages/cart/index.vue
浏览文件 @
3b58d490
...
@@ -24,20 +24,23 @@
...
@@ -24,20 +24,23 @@
v-if=
"type === 0"
v-if=
"type === 0"
width=
"140rpx"
width=
"140rpx"
height=
"200rpx"
height=
"200rpx"
:src=
"
:src=
"baseUrl + item.picUrl"
item.picUrl?.split('http').length > 1
? item.picUrl
: baseUrl + item.picUrl
"
class=
"img"
class=
"img"
></u-image>
></u-image>
</u-col>
</u-col>
<u-col
:span=
"delCircle ? 7 : 5"
class=
"details"
>
<u-col
:span=
"delCircle ? 7 : 5"
class=
"details"
@
tap=
"
delCircle
? () => {
return;
}
: togoods(item)
"
>
<view>
{{ item.goodsName }}
</view>
<view>
{{ item.goodsName }}
</view>
<view
<view
class=
"b-tag"
>
class=
"b-tag"
:style=
"delCircle ? 'margin-bottom: 26%;' : 'margin-bottom: 40%;'"
>
<block
<block
v-for=
"(item1, index1) in item.specifications?.length"
v-for=
"(item1, index1) in item.specifications?.length"
:key=
"index1"
:key=
"index1"
...
@@ -50,6 +53,19 @@
...
@@ -50,6 +53,19 @@
/>
/>
</block>
</block>
</view>
</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>
</view>
</u-col>
</u-col>
<u-col
v-if=
"delCircle"
:span=
"1"
>
<u-col
v-if=
"delCircle"
:span=
"1"
>
<view
class=
"circle"
@
tap=
"deleteCart(index)"
>
<view
class=
"circle"
@
tap=
"deleteCart(index)"
>
...
@@ -85,16 +101,21 @@
...
@@ -85,16 +101,21 @@
v-if=
"type === 0"
v-if=
"type === 0"
width=
"140rpx"
width=
"140rpx"
height=
"200rpx"
height=
"200rpx"
:src=
"
:src=
"baseUrl + item.picUrl"
item.picUrl?.split('http').length > 1
? item.picUrl
: baseUrl + item.picUrl
"
class=
"img"
class=
"img"
></u-image>
></u-image>
</u-col>
</u-col>
<u-col
:span=
"7"
>
<u-col
:span=
"7"
>
<view
class=
"details"
>
<view
class=
"details"
@
tap=
"
item.deleted
? () => {
return;
}
: 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 }}
...
@@ -250,7 +271,6 @@ const tapOptions = () => {
...
@@ -250,7 +271,6 @@ const tapOptions = () => {
let
flag
=
cartList
.
value
.
every
((
item
:
any
)
=>
{
let
flag
=
cartList
.
value
.
every
((
item
:
any
)
=>
{
return
item
.
checked
===
false
;
return
item
.
checked
===
false
;
});
});
console
.
log
(
flag
);
if
(
flag
)
if
(
flag
)
return
uni
.
showToast
({
return
uni
.
showToast
({
title
:
'请先选择购买商品'
,
title
:
'请先选择购买商品'
,
...
@@ -279,6 +299,15 @@ const tapOptions = () => {
...
@@ -279,6 +299,15 @@ const tapOptions = () => {
}
}
};
};
let
togoods
=
(
data
:
any
)
=>
{
if
(
type
.
value
===
0
)
uni
.
navigateTo
({
url
:
'../goods/index?id='
+
data
.
goodsId
+
'&cartId='
+
data
.
id
});
else
uni
.
reLaunch
({
url
:
'../productLine/productLine?id='
+
data
.
goodsId
+
'&cartId='
+
data
.
id
,
});
};
// 确认删除
// 确认删除
const
onConfirm
=
()
=>
{
const
onConfirm
=
()
=>
{
if
(
delIds
.
value
)
{
if
(
delIds
.
value
)
{
...
@@ -302,14 +331,6 @@ const onConfirm = () => {
...
@@ -302,14 +331,6 @@ const onConfirm = () => {
checkedGoods
.
value
=
getCheckedList
(
cartList
.
value
);
checkedGoods
.
value
=
getCheckedList
(
cartList
.
value
);
totalPrice
.
value
=
res
.
data
.
data
.
cartTotal
.
checkedGoodsAmount
.
toFixed
(
2
);
totalPrice
.
value
=
res
.
data
.
data
.
cartTotal
.
checkedGoodsAmount
.
toFixed
(
2
);
showModel
.
show
=
false
;
showModel
.
show
=
false
;
// 批量删除后,check的name属性没有更新,需要刷新当前页面
// uni.reLaunch({
// url: '../cart/index',
// success() {
// type.value = 2;
// initCartIndex(type.value);
// },
// });
}
}
});
});
}
}
...
@@ -338,6 +359,7 @@ const valChange = (e: any, item: any) => {
...
@@ -338,6 +359,7 @@ const valChange = (e: any, item: any) => {
goodsId
:
item
.
goodsId
,
goodsId
:
item
.
goodsId
,
id
:
item
.
id
,
id
:
item
.
id
,
ids
:
item
.
ids
,
ids
:
item
.
ids
,
productId
:
item
.
productId
,
}).
then
((
res
:
any
)
=>
{
}).
then
((
res
:
any
)
=>
{
if
(
res
.
data
.
code
===
200
)
initCartIndex
(
type
.
value
);
if
(
res
.
data
.
code
===
200
)
initCartIndex
(
type
.
value
);
});
});
...
@@ -394,7 +416,7 @@ const getCheckedList = (goods: any) => {
...
@@ -394,7 +416,7 @@ const getCheckedList = (goods: any) => {
onShow
(()
=>
{
onShow
(()
=>
{
initCartIndex
(
type
.
value
);
initCartIndex
(
type
.
value
);
type
.
value
=
0
;
//
type.value = 0;
});
});
</
script
>
</
script
>
...
@@ -406,6 +428,7 @@ onShow(() => {
...
@@ -406,6 +428,7 @@ onShow(() => {
background-color
:
#fff
;
background-color
:
#fff
;
.details
{
.details
{
width
:
55%
;
width
:
55%
;
min-height
:
200rpx
;
display
:
flex
;
display
:
flex
;
flex-direction
:
column
;
flex-direction
:
column
;
align-items
:
self-start
!
important
;
align-items
:
self-start
!
important
;
...
...
src/pages/goods/goodsSku.vue
浏览文件 @
3b58d490
...
@@ -40,6 +40,11 @@ let detailId = ref()
...
@@ -40,6 +40,11 @@ let detailId = ref()
let
selectedGoodsItem
=
ref
(
''
)
let
selectedGoodsItem
=
ref
(
''
)
let
selectedGoodsSum
=
ref
(
1
)
let
selectedGoodsSum
=
ref
(
1
)
let
emits
=
defineEmits
([
'selected'
,
'addProduct'
,
'close-sku'
,
'partsClose'
])
let
emits
=
defineEmits
([
'selected'
,
'addProduct'
,
'close-sku'
,
'partsClose'
])
let
props
=
defineProps
({
cartId
:
{
type
:
Number
}
})
watch
([
selectedGoodsItem
,
selectedGoodsSum
],(
newVal
)
=>
{
watch
([
selectedGoodsItem
,
selectedGoodsSum
],(
newVal
)
=>
{
if
(
newVal
)
{
if
(
newVal
)
{
...
@@ -160,7 +165,7 @@ let addCartFn = (obj: any) => {
...
@@ -160,7 +165,7 @@ let addCartFn = (obj: any) => {
specifications
=
shop
.
selectShop
.
sku_name_arr
specifications
=
shop
.
selectShop
.
sku_name_arr
specificationCustom
=
shop
.
customArr
specificationCustom
=
shop
.
customArr
}
}
addCart
(
{
let
data
=
{
goodsId
:
detailId
.
value
,
goodsId
:
detailId
.
value
,
number
:
selectShop
.
buy_num
,
number
:
selectShop
.
buy_num
,
productId
:
productId
,
productId
:
productId
,
...
@@ -168,7 +173,9 @@ let addCartFn = (obj: any) => {
...
@@ -168,7 +173,9 @@ let addCartFn = (obj: any) => {
specifications
,
specifications
,
specificationCustom
,
specificationCustom
,
partIds
:
partsIds
.
value
partIds
:
partsIds
.
value
}).
then
((
res
:
any
)
=>
{
}
if
(
props
.
cartId
)
data
=
{
...{
id
:
props
.
cartId
},
...
data
}
addCart
(
data
).
then
((
res
:
any
)
=>
{
if
(
res
.
data
.
code
===
200
)
{
if
(
res
.
data
.
code
===
200
)
{
uni
.
showToast
({
uni
.
showToast
({
title
:
'已添加至购物车'
,
title
:
'已添加至购物车'
,
...
@@ -198,7 +205,7 @@ let addCarts = (selectShop: any) => {
...
@@ -198,7 +205,7 @@ let addCarts = (selectShop: any) => {
};
};
// 立即购买
// 立即购买
let
buyNow
=
(
selectShop
:
any
)
=>
{
let
buyNow
=
(
selectShop
:
any
)
=>
{
console
.
log
(
selectShop
,
selectShop
.
sku_name_arr
,
' selectShop.sku_name_arr'
);
//
console.log(selectShop, selectShop.sku_name_arr ,' selectShop.sku_name_arr');
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
=
[]
...
...
src/pages/goods/index.vue
浏览文件 @
3b58d490
...
@@ -74,7 +74,6 @@
...
@@ -74,7 +74,6 @@
show-with-animation
show-with-animation
lazy-load
lazy-load
selectable
selectable
@imgtap="imgtap"
/>
/>
<u-empty
v-else
text=
"暂无数据"
mode=
"data"
/>
<u-empty
v-else
text=
"暂无数据"
mode=
"data"
/>
</view>
</view>
...
@@ -112,7 +111,12 @@
...
@@ -112,7 +111,12 @@
</u-popup>
</u-popup>
</view>
</view>
<goodsSku
ref=
"goodsSkuRef"
@
selected=
"selected"
@
partsClose=
"partsClose"
></goodsSku>
<goodsSku
ref=
"goodsSkuRef"
:cartId=
"cartId"
@
selected=
"selected"
@
partsClose=
"partsClose"
></goodsSku>
</
template
>
</
template
>
<
script
lang=
"ts"
setup
>
<
script
lang=
"ts"
setup
>
...
@@ -153,8 +157,10 @@ const buttonGroup = ref([
...
@@ -153,8 +157,10 @@ const buttonGroup = ref([
]);
]);
const
detailId
=
ref
()
const
detailId
=
ref
()
const
cartId
=
ref
()
// 判断是否从购物车进去修改购物车信息的购物车Id
onLoad
((
options
:
any
)
=>
{
onLoad
((
options
:
any
)
=>
{
if
(
typeof
options
.
cartId
!==
'undefined'
)
cartId
.
value
=
options
.
cartId
detailId
.
value
=
options
.
id
detailId
.
value
=
options
.
id
// 在结算中返回时使用
// 在结算中返回时使用
uni
.
setStorage
({
uni
.
setStorage
({
...
@@ -183,13 +189,6 @@ let selectedGoods = computed(() => {
...
@@ -183,13 +189,6 @@ let selectedGoods = computed(() => {
}
else
return
''
}
else
return
''
})
})
// #ifdef H5
const
imgtap
=
()
=>
{
}
// #endif
const
selected
=
(
data
:
any
)
=>
{
const
selected
=
(
data
:
any
)
=>
{
selectedGoodsItem
.
value
=
data
[
0
]
selectedGoodsItem
.
value
=
data
[
0
]
selectedGoodsSum
.
value
=
data
[
1
]
selectedGoodsSum
.
value
=
data
[
1
]
...
@@ -303,7 +302,7 @@ const initDetails = (id: number) => {
...
@@ -303,7 +302,7 @@ const initDetails = (id: number) => {
res
.
data
.
data
.
info
.
detail
=
res
.
data
.
data
.
info
.
detail
.
replace
(
/<img/g
,
"<img style='display: block'"
)
res
.
data
.
data
.
info
.
detail
=
res
.
data
.
data
.
info
.
detail
.
replace
(
/<img/g
,
"<img style='display: block'"
)
res
.
data
.
data
.
info
.
detail
=
res
.
data
.
data
.
info
.
detail
.
replace
(
/<video/g
,
"<video preload='auto'"
)
res
.
data
.
data
.
info
.
detail
=
res
.
data
.
data
.
info
.
detail
.
replace
(
/<video/g
,
"<video preload='auto'"
)
detailData
.
value
=
res
.
data
.
data
;
detailData
.
value
=
res
.
data
.
data
;
console
.
log
(
detailData
.
value
,
'商品详情数据'
);
//
console.log(detailData.value, '商品详情数据');
}
}
});
});
}
}
...
@@ -581,6 +580,7 @@ const initParts = (id: number) => {
...
@@ -581,6 +580,7 @@ const initParts = (id: number) => {
.right
{
.right
{
padding
:
20rpx
0
;
padding
:
20rpx
0
;
font-weight
:
600
;
// overflow: hidden;
// overflow: hidden;
// text-overflow: ellipsis; /* 超出部分省略号 */
// text-overflow: ellipsis; /* 超出部分省略号 */
// word-break: break-all; /* break-all(允许在单词内换行。) */
// word-break: break-all; /* break-all(允许在单词内换行。) */
...
...
src/pages/index/index.vue
浏览文件 @
3b58d490
...
@@ -216,6 +216,10 @@ initIndex();
...
@@ -216,6 +216,10 @@ initIndex();
</
script
>
</
script
>
<
style
lang=
"scss"
>
<
style
lang=
"scss"
>
// page {
// filter: progid:DXImageTransform.Microsoft.BasicImage(grayscale=1);
// -webkit-filter: grayscale(100%);
// }
.grid
{
.grid
{
padding
:
16rpx
;
padding
:
16rpx
;
.grid-text
{
.grid-text
{
...
...
src/pages/login/login.vue
浏览文件 @
3b58d490
...
@@ -18,7 +18,7 @@ import { reactive } from 'vue';
...
@@ -18,7 +18,7 @@ import { reactive } from 'vue';
import
{
login
}
from
'@/api/login'
;
import
{
login
}
from
'@/api/login'
;
import
inputLogin
from
'@/components/inputLogin.vue'
;
import
inputLogin
from
'@/components/inputLogin.vue'
;
let
inputData
=
reactive
({
let
inputData
=
reactive
({
inputValue
:
'1
5616168157
'
as
any
,
inputValue
:
'1
3517855555
'
as
any
,
iconfont
:
'icon-a-ziyuan16'
,
iconfont
:
'icon-a-ziyuan16'
,
placeholder
:
'手机号码'
,
placeholder
:
'手机号码'
,
type
:
'text'
,
type
:
'text'
,
...
@@ -64,9 +64,7 @@ let clickNextStep = () => {
...
@@ -64,9 +64,7 @@ let clickNextStep = () => {
let
initLogin
=
async
(
mobile
:
number
,
password
:
string
)
=>
{
let
initLogin
=
async
(
mobile
:
number
,
password
:
string
)
=>
{
uni
.
clearStorage
();
uni
.
clearStorage
();
let
res
:
any
=
await
login
({
mobile
,
password
});
let
res
:
any
=
await
login
({
mobile
,
password
});
console
.
log
(
res
,
'res'
);
if
(
res
.
data
.
code
===
200
)
{
if
(
res
.
data
.
code
===
200
)
{
console
.
log
(
'2000'
);
uni
.
setStorage
({
uni
.
setStorage
({
key
:
'token'
,
key
:
'token'
,
data
:
res
.
data
.
data
.
token
,
data
:
res
.
data
.
data
.
token
,
...
@@ -103,7 +101,7 @@ let initLogin = async (mobile: number, password: string) => {
...
@@ -103,7 +101,7 @@ let initLogin = async (mobile: number, password: string) => {
duration
:
2000
,
duration
:
2000
,
});
});
}
}
}
}
;
</
script
>
</
script
>
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
...
...
src/pages/order/checkout.vue
浏览文件 @
3b58d490
...
@@ -46,7 +46,6 @@
...
@@ -46,7 +46,6 @@
</view>
</view>
<view
class=
"sum-price"
>
<view
class=
"sum-price"
>
<!--
<text>
¥
{{
item
.
price
.
toFixed
(
2
)
}}
</text>
-->
<text></text>
<text></text>
<text
style=
"color: #969799; font-size: 12px;"
>
x
{{
item
.
number
}}
</text>
<text
style=
"color: #969799; font-size: 12px;"
>
x
{{
item
.
number
}}
</text>
</view>
</view>
...
@@ -55,10 +54,6 @@
...
@@ -55,10 +54,6 @@
<!-- list -->
<!-- list -->
<view
class=
"list"
>
<view
class=
"list"
>
<!--
<view
class=
"item-list"
>
<view
class=
"label"
>
商品金额
</view>
<view
class=
"item-price"
>
¥
{{
buyNowData
?.
goodsTotalPrice
.
toFixed
(
2
)
}}
</view>
</view>
-->
<view
class=
"item-list-end"
>
<view
class=
"item-list-end"
>
<view
class=
"label"
>
订单备注
</view>
<view
class=
"label"
>
订单备注
</view>
<u-input
v-model=
"remarks"
/>
<u-input
v-model=
"remarks"
/>
...
@@ -68,12 +63,6 @@
...
@@ -68,12 +63,6 @@
<!-- 提交订单 -->
<!-- 提交订单 -->
<view
class=
"footer"
>
<view
class=
"footer"
>
<view>
<view>
<!--
<text
style=
"font-size: 30rpx;"
>
总计
</text>
<text
style=
"margin-right: 24rpx; color: #ee0a24; font-size: 30rpx; font-weight: 600;"
>
¥
{{
buyNowData
?.
orderTotalPrice
.
toFixed
(
2
)
}}
</text>
-->
<u-button
type=
"error"
size=
"medium"
shape=
"circle"
@
tap=
"onsubmit"
>
结算
</u-button>
<u-button
type=
"error"
size=
"medium"
shape=
"circle"
@
tap=
"onsubmit"
>
结算
</u-button>
</view>
</view>
</view>
</view>
...
@@ -81,12 +70,12 @@
...
@@ -81,12 +70,12 @@
</
template
>
</
template
>
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
{
on
Show
,
onLoad
}
from
'@dcloudio/uni-app'
;
import
{
on
Load
,
onBackPress
}
from
'@dcloudio/uni-app'
;
import
{
ref
}
from
'vue'
;
import
{
ref
}
from
'vue'
;
import
{
checkoutCart
,
orderSubmit
}
from
'@/api/index'
;
import
{
checkoutCart
,
orderSubmit
}
from
'@/api/index'
;
import
config
from
'@/utils/config'
;
import
config
from
'@/utils/config'
;
le
t
baseUrl
=
config
.
baseUrl
;
cons
t
baseUrl
=
config
.
baseUrl
;
const
buyNowId
=
ref
();
const
buyNowId
=
ref
();
const
buyNowData
=
ref
();
const
buyNowData
=
ref
();
const
remarks
=
ref
();
// 订单备注
const
remarks
=
ref
();
// 订单备注
...
@@ -114,8 +103,17 @@ onLoad((options: any) => {
...
@@ -114,8 +103,17 @@ onLoad((options: any) => {
console
.
log
(
type
.
value
,
'.type'
);
console
.
log
(
type
.
value
,
'.type'
);
});
});
onShow
(()
=>
{
onBackPress
((
options
:
any
)
=>
{
if
(
options
.
from
===
'backbutton'
&&
type
.
value
===
'productLineCart'
)
{
let
pages
=
getCurrentPages
();
// 当前页面
let
beforePage
:
any
=
pages
[
pages
.
length
-
2
];
// 上一页
beforePage
.
type
=
2
;
// 执行上一页的onLoad方法
}
if
(
options
.
from
===
'backbutton'
&&
type
.
value
===
'cart'
)
{
let
pages
=
getCurrentPages
();
// 当前页面
let
beforePage
:
any
=
pages
[
pages
.
length
-
2
];
// 上一页
beforePage
.
type
=
0
;
// 执行上一页的onLoad方法
}
});
});
// 设置地址
// 设置地址
...
@@ -127,6 +125,12 @@ const tapAddresss = () => {
...
@@ -127,6 +125,12 @@ const tapAddresss = () => {
// 结算
// 结算
const
onsubmit
=
()
=>
{
const
onsubmit
=
()
=>
{
if
(
uni
.
getStorageSync
(
'addressId'
)
===
0
)
return
uni
.
showToast
({
title
:
'请设置收货地址'
,
icon
:
'none'
,
});
console
.
log
(
uni
.
getStorageSync
(
'addressId'
)
===
0
);
let
types
=
0
;
let
types
=
0
;
if
(
type
.
value
===
'productline'
||
type
.
value
===
'productLineCart'
)
types
=
2
;
if
(
type
.
value
===
'productline'
||
type
.
value
===
'productLineCart'
)
types
=
2
;
else
types
=
0
;
else
types
=
0
;
...
@@ -167,6 +171,10 @@ const initCheckoutCart = (cartId: number, types: number) => {
...
@@ -167,6 +171,10 @@ const initCheckoutCart = (cartId: number, types: number) => {
}).
then
((
res
:
any
)
=>
{
}).
then
((
res
:
any
)
=>
{
if
(
res
.
data
.
code
===
200
)
{
if
(
res
.
data
.
code
===
200
)
{
buyNowData
.
value
=
res
.
data
.
data
;
buyNowData
.
value
=
res
.
data
.
data
;
uni
.
setStorage
({
key
:
'addressData'
,
data
:
res
.
data
.
data
.
checkedAddress
,
});
let
storage
:
any
=
{
let
storage
:
any
=
{
addressId
:
res
.
data
.
data
.
addressId
,
addressId
:
res
.
data
.
data
.
addressId
,
cartId
:
res
.
data
.
data
.
cartId
,
cartId
:
res
.
data
.
data
.
cartId
,
...
@@ -179,13 +187,13 @@ const initCheckoutCart = (cartId: number, types: number) => {
...
@@ -179,13 +187,13 @@ const initCheckoutCart = (cartId: number, types: number) => {
data
:
el
,
data
:
el
,
});
});
});
});
console
.
log
(
buyNowData
.
value
,
'购买数据'
);
//
console.log(buyNowData.value, '购买数据');
}
}
});
});
};
};
const
init
=
(
type
:
string
)
=>
{
const
init
=
()
=>
{
switch
(
type
)
{
switch
(
type
.
value
)
{
case
'cart'
:
case
'cart'
:
buyNowId
.
value
=
0
;
buyNowId
.
value
=
0
;
initCheckoutCart
(
buyNowId
.
value
,
0
);
initCheckoutCart
(
buyNowId
.
value
,
0
);
...
...
src/pages/order/downPdf.vue
浏览文件 @
3b58d490
<
template
>
<
template
>
<!--
<u-navbar
back-text=
""
title=
"订单详情"
title-color=
"#000"
></u-navbar>
-->
<view
class=
"container"
>
<view
class=
"container"
>
<block
v-for=
"(item, index) in detailData"
>
<block
v-for=
"(item, index) in detailData"
>
<view>
<view>
...
@@ -29,57 +28,7 @@
...
@@ -29,57 +28,7 @@
/>
/>
</block>
</block>
</view>
</view>
<text
style=
"color: #969799; font-size: 12px;"
>
x
{{
item
.
number
}}
</text>
<view
class=
"sum-price"
>
<view
style=
"display: flex; flex-direction: column;"
>
<view
style=
"display: flex; flex-direction: row; align-items: center; margin-bottom: 10rpx;"
>
<text>
设置单价:
</text>
<u-input
v-model=
"item.unitPrice"
type=
"number"
height=
"50"
placeholder=
"请输入单价"
style=
"width: 200rpx;"
/>
</view>
<view
style=
"display: flex; flex-direction: row; align-items: center; margin-bottom: 10rpx;"
>
<text>
合同报价:
</text>
<u-input
v-model=
"item.contractQuotation"
type=
"number"
:disabled=
"true"
height=
"50"
placeholder=
""
style=
"width: 200rpx;"
/>
</view>
<view
style=
"margin-bottom: 10rpx;"
>
金额:¥
{{
item
.
unitPrice
?
(
Number
(
item
.
unitPrice
)
*
item
.
number
).
toFixed
(
2
)
:
0
}}
</view>
<view
style=
"margin-bottom: 10rpx;"
>
含税金额:¥
{{
item
.
unitPrice
?
(
Number
(
item
.
unitPrice
)
*
item
.
number
+
Number
(
item
.
unitPrice
)
*
item
.
number
*
tax
*
0.01
).
toFixed
(
2
)
:
0
}}
</view>
</view>
<text
style=
"color: #969799; font-size: 12px;"
>
x
{{
item
.
number
}}
</text>
</view>
</view>
</view>
</view>
</view>
<u-line
v-if=
"detailData.length > 1"
color=
"#e8e8e8"
/>
<u-line
v-if=
"detailData.length > 1"
color=
"#e8e8e8"
/>
...
@@ -103,11 +52,6 @@
...
@@ -103,11 +52,6 @@
</view>
</view>
</view>
</view>
</view>
</view>
<view
style=
"height: 100rpx;"
></view>
<view
class=
"footer"
>
<text>
商品总价:¥
{{
totlePirce
}}
</text>
<text>
含税商品总价:¥
{{
taxTotlePirce
}}
</text>
</view>
</
template
>
</
template
>
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
...
@@ -115,8 +59,7 @@ import { ref, computed } from 'vue';
...
@@ -115,8 +59,7 @@ import { ref, computed } from 'vue';
import
{
onLoad
,
onBackPress
}
from
'@dcloudio/uni-app'
;
import
{
onLoad
,
onBackPress
}
from
'@dcloudio/uni-app'
;
import
config
from
'@/utils/config'
;
import
config
from
'@/utils/config'
;
import
{
useCurrentStore
}
from
'@/store/useStore'
;
import
{
useCurrentStore
}
from
'@/store/useStore'
;
// import { getOrderPdf } from '@/api/cart';
import
{
orderDetail
}
from
'@/api/index'
;
import
{
orderDetail
,
getTax
}
from
'@/api/index'
;
let
baseUrl
=
config
.
baseUrl
;
let
baseUrl
=
config
.
baseUrl
;
let
currentStore
=
useCurrentStore
();
let
currentStore
=
useCurrentStore
();
...
@@ -140,7 +83,6 @@ onLoad((options: any) => {
...
@@ -140,7 +83,6 @@ onLoad((options: any) => {
console
.
log
(
res
,
'订单详情信息'
);
console
.
log
(
res
,
'订单详情信息'
);
});
});
// initPdf(options.orderId); // 查询pdf详细资料
// initPdf(options.orderId); // 查询pdf详细资料
initTax
();
// 查询税率
});
});
// 返回首页
// 返回首页
...
@@ -152,25 +94,9 @@ let toIndex = () => {
...
@@ -152,25 +94,9 @@ let toIndex = () => {
// 生成报价
// 生成报价
let
generateQuote
=
()
=>
{
let
generateQuote
=
()
=>
{
let
data
=
[]
as
any
;
uni
.
navigateTo
({
let
flag
=
true
;
url
:
`./quotation?orderId=
${
orderId
.
value
}
`
,
detailData
.
value
.
map
((
item
:
any
)
=>
{
if
(
typeof
item
.
unitPrice
===
'undefined'
)
{
flag
=
false
;
return
uni
.
showToast
({
title
:
`请填写
${
item
.
goodsName
}
单价`
,
icon
:
'none'
,
});
}
else
data
.
push
({
goodsName
:
item
.
goodsName
,
unitPrice
:
item
.
unitPrice
,
});
});
});
if
(
flag
)
uni
.
navigateTo
({
url
:
`./quotation?orderId=
${
orderId
.
value
}
&data=
${
JSON
.
stringify
(
data
)}
`
,
});
};
};
// 总价格
// 总价格
...
@@ -229,13 +155,6 @@ let download = () => {
...
@@ -229,13 +155,6 @@ let download = () => {
// });
// });
// };
// };
// 获取税率
let
initTax
=
()
=>
{
getTax
().
then
((
res
:
any
)
=>
{
if
(
res
.
data
.
code
===
200
)
tax
.
value
=
Number
(
res
.
data
.
data
.
mall_tax_rate
);
});
};
onBackPress
((
options
:
any
)
=>
{
onBackPress
((
options
:
any
)
=>
{
if
(
options
.
from
===
'navigateBack'
)
{
if
(
options
.
from
===
'navigateBack'
)
{
return
false
;
return
false
;
...
...
src/pages/order/quotation.vue
浏览文件 @
3b58d490
差异被折叠。
点击展开。
src/pages/productLine/components/categoryPopup.vue
浏览文件 @
3b58d490
...
@@ -62,12 +62,20 @@
...
@@ -62,12 +62,20 @@
</view>
</view>
</view>
</view>
</u-popup>
</u-popup>
<search-popup
ref=
"searchPopupRef"
:show=
"showSearchPopup"
@
search-close=
"searchClose"
@
cateGoryGoods=
"cateGoryGoods"
/>
</
template
>
</
template
>
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
{
ref
}
from
'vue'
;
import
{
ref
}
from
'vue'
;
import
{
getCatalogIndex
,
getGoodsList
}
from
'@/api/category'
;
import
{
getCatalogIndex
,
getGoodsList
}
from
'@/api/category'
;
import
config
from
'@/utils/config'
;
import
config
from
'@/utils/config'
;
import
searchPopup
from
'./searchPopup.vue'
;
let
baseUrl
=
config
.
baseUrl
;
let
baseUrl
=
config
.
baseUrl
;
...
@@ -85,6 +93,8 @@ const listQuery = ref({
...
@@ -85,6 +93,8 @@ const listQuery = ref({
let
status
=
ref
(
'loadmore'
);
let
status
=
ref
(
'loadmore'
);
let
total
=
ref
(
0
);
let
total
=
ref
(
0
);
let
emits
=
defineEmits
([
'close'
,
'categoryData'
]);
let
emits
=
defineEmits
([
'close'
,
'categoryData'
]);
const
showSearchPopup
=
ref
(
false
);
const
searchPopupRef
=
ref
();
let
props
=
defineProps
({
let
props
=
defineProps
({
show
:
{
show
:
{
...
@@ -94,7 +104,10 @@ let props = defineProps({
...
@@ -94,7 +104,10 @@ let props = defineProps({
});
});
const
search
=
(
val
:
any
)
=>
{
const
search
=
(
val
:
any
)
=>
{
uni
.
navigateTo
({
url
:
'../index/search?keyword='
+
val
.
value
});
// if (!val.value) return;
searchPopupRef
.
value
.
searchQuery
.
keyword
=
val
.
value
;
searchPopupRef
.
value
.
initList
();
showSearchPopup
.
value
=
true
;
};
};
const
cateGoryGoods
=
(
row
:
any
)
=>
{
const
cateGoryGoods
=
(
row
:
any
)
=>
{
...
@@ -145,7 +158,7 @@ const initIndex = () => {
...
@@ -145,7 +158,7 @@ const initIndex = () => {
if
(
listQuery
.
value
.
categoryId
===
0
)
if
(
listQuery
.
value
.
categoryId
===
0
)
listQuery
.
value
.
categoryId
=
categoryList
.
value
[
0
].
id
;
listQuery
.
value
.
categoryId
=
categoryList
.
value
[
0
].
id
;
initGoodsList
(
listQuery
.
value
);
initGoodsList
(
listQuery
.
value
);
console
.
log
(
categoryList
.
value
,
'分类数据'
);
//
console.log(categoryList.value, '分类数据');
}
}
});
});
};
};
...
@@ -165,9 +178,13 @@ let handleClose = () => {
...
@@ -165,9 +178,13 @@ let handleClose = () => {
emits
(
'close'
,
false
);
emits
(
'close'
,
false
);
};
};
const
searchClose
=
()
=>
{
showSearchPopup
.
value
=
false
;
};
defineExpose
({
defineExpose
({
initIndex
,
initIndex
,
currentSubCategoryData
currentSubCategoryData
,
});
});
</
script
>
</
script
>
...
...
src/pages/productLine/components/drag-and-drop-sort.vue
浏览文件 @
3b58d490
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
@
touchstart=
"handleTouchstart($event, index)"
@
touchstart=
"handleTouchstart($event, index)"
@
touchmove
.
prevent=
"handleTouchmove($event, index)"
@
touchmove
.
prevent=
"handleTouchmove($event, index)"
@
touchend=
"handleTouchend"
@
touchend=
"handleTouchend"
@
tap=
"handleTap(index)"
@
tap=
"handleTap(index
, item
)"
style=
"width: 100%; height: 100%;"
style=
"width: 100%; height: 100%;"
>
>
<!-- 自定义内容 -->
<!-- 自定义内容 -->
...
@@ -142,7 +142,7 @@ export default {
...
@@ -142,7 +142,7 @@ export default {
// console.log(tempArray, 'tempArray');
// console.log(tempArray, 'tempArray');
return
tempArray
;
return
tempArray
;
},
},
handleTap
(
index
)
{
handleTap
(
index
,
item
)
{
let
that
=
this
;
let
that
=
this
;
// console.log(that.controlsArray, index);
// console.log(that.controlsArray, index);
if
(
index
==
that
.
controlsArray
.
length
-
1
)
return
;
if
(
index
==
that
.
controlsArray
.
length
-
1
)
return
;
...
@@ -155,7 +155,7 @@ export default {
...
@@ -155,7 +155,7 @@ export default {
uni
.
showActionSheet
({
uni
.
showActionSheet
({
itemList
:
[
'修改规格'
,
'复制'
,
'删除'
],
itemList
:
[
'修改规格'
,
'复制'
,
'删除'
],
success
:
function
(
res
)
{
success
:
function
(
res
)
{
that
.
sheetChange
(
res
.
tapIndex
);
that
.
sheetChange
(
res
.
tapIndex
,
item
);
},
},
fail
:
function
(
res
)
{
fail
:
function
(
res
)
{
console
.
log
(
res
.
errMsg
);
console
.
log
(
res
.
errMsg
);
...
@@ -163,7 +163,7 @@ export default {
...
@@ -163,7 +163,7 @@ export default {
});
});
},
},
// 点击选择操作
// 点击选择操作
sheetChange
(
index
)
{
sheetChange
(
index
,
item
)
{
let
that
=
this
;
let
that
=
this
;
switch
(
index
)
{
switch
(
index
)
{
case
0
:
case
0
:
...
@@ -173,7 +173,7 @@ export default {
...
@@ -173,7 +173,7 @@ export default {
that
.
$emit
(
'sheet-copy'
,
that
.
sheetIndex
);
that
.
$emit
(
'sheet-copy'
,
that
.
sheetIndex
);
break
;
break
;
case
2
:
case
2
:
that
.
$emit
(
'sheet-del'
,
that
.
sheetIndex
);
that
.
$emit
(
'sheet-del'
,
that
.
sheetIndex
,
item
);
break
;
break
;
}
}
},
},
...
...
src/pages/productLine/components/searchPopup.vue
0 → 100644
浏览文件 @
3b58d490
<
template
>
<u-popup
v-model=
"show"
mode=
"bottom"
length=
"90%"
:mask-close-able=
"false"
closeable
@
close=
"handleClose"
>
<view>
<view
style=
"width: 90%; height: 50px; position: fixed; top: 0; z-index: 1; background-color: #fff;"
>
<uni-search-bar
v-model=
"searchQuery.keyword"
placeholder=
"输入搜索商品"
bgColor=
"#EEEEEE"
clearButton=
"auto"
cancelButton=
"none"
@
confirm=
"search"
/>
</view>
<view
style=
"height: 120rpx"
></view>
<view
v-if=
"searchList.length !== 0"
>
<goodsItem
v-for=
"item in searchList"
:src=
"item.picUrl"
:name=
"item.name"
:brief=
"item.brief"
:counterPrice=
"item.counterPrice"
:retailPrice=
"item.retailPrice"
@
tap=
"searchGoods(item)"
/>
<view
style=
"padding-bottom: 40rpx;"
>
<u-loadmore
:status=
"status"
icon-type=
"flower"
@
loadmore=
"loadMore"
/>
</view>
</view>
<view
v-else
><u-loadmore
status=
"nomore"
icon-type=
"flower"
/></view>
</view>
</u-popup>
</
template
>
<
script
lang=
"ts"
setup
>
import
{
ref
,
reactive
}
from
'vue'
;
import
{
getGoodsList
}
from
'@/api/category'
;
import
goodsItem
from
'@/components/goodsItem.vue'
;
let
props
=
defineProps
({
show
:
{
type
:
Boolean
,
default
:
false
,
},
});
let
emits
=
defineEmits
([
'search-close'
,
'cateGoryGoods'
]);
let
searchQuery
=
reactive
({
keyword
:
''
,
page
:
1
,
limit
:
10
,
categoryId
:
0
,
});
let
status
=
ref
(
'loadmore'
);
let
total
=
ref
(
0
);
let
searchList
=
ref
([]
as
any
);
let
search
=
(
val
:
any
)
=>
{
searchList
.
value
=
[];
searchQuery
.
page
=
1
;
searchQuery
.
keyword
=
val
.
value
;
initList
();
};
let
searchGoods
=
(
item
:
any
)
=>
{
emits
(
'search-close'
,
false
);
emits
(
'cateGoryGoods'
,
item
);
};
// 点击加载更多 status = loadmore 时生效
let
loadMore
=
()
=>
{
// 判断是否还有下一页数据
if
(
searchQuery
.
page
*
searchQuery
.
limit
>=
total
.
value
)
return
(
status
.
value
=
'nomore'
);
// // 判断是否正在请求其它数据,如果是,则不发起额外的请求
if
(
status
.
value
===
'loading'
)
return
;
searchQuery
.
page
+=
1
;
initList
();
};
let
initList
=
()
=>
{
status
.
value
=
'loading'
;
getGoodsList
(
searchQuery
).
then
((
res
:
any
)
=>
{
if
(
res
.
data
.
data
.
total
>
10
)
status
.
value
=
'loadmore'
;
else
status
.
value
=
'nomore'
;
if
(
res
.
data
.
code
===
200
)
{
total
.
value
=
res
.
data
.
data
.
total
;
searchList
.
value
=
[...
searchList
.
value
,
...
res
.
data
.
data
.
list
];
}
});
};
let
handleClose
=
()
=>
{
searchList
.
value
=
[];
emits
(
'search-close'
,
false
);
};
defineExpose
({
searchQuery
,
initList
,
});
</
script
>
<
style
></
style
>
src/pages/productLine/productLine.vue
浏览文件 @
3b58d490
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
<view
class=
"u-menu-wrap"
>
<view
class=
"u-menu-wrap"
>
<view
style=
"position: fixed; left: 8rpx; top: 6%;"
>
<view
style=
"position: fixed; left: 8rpx; top: 6%;"
>
<drag-and-drop-sort
<drag-and-drop-sort
v-if=
"flag"
ref=
"dragRef"
ref=
"dragRef"
style=
"display: flex; justify-content: center;"
style=
"display: flex; justify-content: center;"
:controlsList=
"lineList"
:controlsList=
"lineList"
...
@@ -31,7 +32,18 @@
...
@@ -31,7 +32,18 @@
:show-line=
"scope.row?.show"
:show-line=
"scope.row?.show"
:line-color=
"scope.row?.show ? '#0000f0' : ''"
:line-color=
"scope.row?.show ? '#0000f0' : ''"
style=
"margin-left: 20rpx;"
style=
"margin-left: 20rpx;"
></u-section>
>
<template
v-if=
"item?.isSubmit || scope.row.isSubmit !== undefined"
#
right
>
<u-icon
name=
"error-circle-fill"
color=
"#ff0000"
style=
"margin-right: 4rpx;"
/>
</
template
>
</u-section>
<view
v-else
class=
"add"
>
<view
v-else
class=
"add"
>
<u-icon
<u-icon
name=
"plus"
name=
"plus"
...
@@ -46,16 +58,13 @@
...
@@ -46,16 +58,13 @@
<view
class=
"left-cates"
/>
<view
class=
"left-cates"
/>
<view
class=
"right-cates"
>
<view
class=
"right-cates"
>
<view
style=
"width: 80px;"
>
<view
style=
"width: 80px;"
>
<!-- <view style="height: 88rpx;"></view> -->
<block
v-for=
"(item, index) in lineList"
>
<block
v-for=
"(item, index) in lineList"
>
<u-image
<u-image
v-if=
"index != lineList.length - 1"
v-if=
"index != lineList.length - 1"
width=
"160rpx"
width=
"160rpx"
mode=
"widthFix"
mode=
"widthFix"
:src=
"
:src=
"baseUrl + item.url"
item.url.split('http').length > 1
? item.url
: baseUrl + item.url
"
></u-image>
></u-image>
</block>
</block>
</view>
</view>
...
@@ -97,10 +106,17 @@
...
@@ -97,10 +106,17 @@
</template>
</template>
<
script
lang=
"ts"
setup
>
<
script
lang=
"ts"
setup
>
import
{
ref
}
from
'vue'
;
import
{
ref
,
nextTick
}
from
'vue'
;
import
{
onLoad
}
from
'@dcloudio/uni-app'
;
import
{
indexDetails
}
from
'@/api/index'
;
import
{
indexDetails
}
from
'@/api/index'
;
import
{
useStore
}
from
'@/store/useStore'
;
import
{
useStore
}
from
'@/store/useStore'
;
import
{
addProductLineCart
,
productLineCollect
,
delProductLineCollect
}
from
'@/api/productLine'
;
import
{
addProductLineCart
,
productLineCollect
,
delProductLineCollect
,
getProductLineIndex
,
getProductLineReAdd
,
}
from
'@/api/productLine'
;
import
config
from
'@/utils/config'
;
import
config
from
'@/utils/config'
;
import
dragAndDropSort
from
'./components/drag-and-drop-sort.vue'
;
import
dragAndDropSort
from
'./components/drag-and-drop-sort.vue'
;
import
categoryPopup
from
'./components/categoryPopup.vue'
;
import
categoryPopup
from
'./components/categoryPopup.vue'
;
...
@@ -123,6 +139,7 @@ let model = ref({
...
@@ -123,6 +139,7 @@ let model = ref({
show
:
false
,
show
:
false
,
content
:
'确定重置所选产品?'
,
content
:
'确定重置所选产品?'
,
});
});
let
flag
=
ref
(
false
);
let
options
=
ref
([
let
options
=
ref
([
{
{
...
@@ -147,10 +164,60 @@ let buttonGroup = ref([
...
@@ -147,10 +164,60 @@ let buttonGroup = ref([
},
},
]);
]);
let
cartId
=
ref
();
// 修改的产品线id
let
lineId
=
ref
();
// 修改的产品线id
onLoad
((
options
:
any
)
=>
{
// 修改产品线时使用
if
(
typeof
options
.
cartId
!==
'undefined'
)
{
cartId
.
value
=
options
.
cartId
;
flag
.
value
=
false
;
lineId
.
value
=
options
.
id
;
// 把加入购物车变成禁用状态
// buttonGroup.value[0].backgroundColor = '#ccc';
initProductLine
(
options
.
id
);
}
else
{
flag
.
value
=
true
;
}
});
// 修改产品线数据初始化
let
initProductLine
=
(
lineId
:
number
)
=>
{
store
.
$patch
({
lineData
:
[{
show
:
false
,
status
:
0
}],
});
lineList
.
value
=
store
.
lineData
;
// 获取产品线详细数据
getProductLineIndex
({
lineId
}).
then
((
res
:
any
)
=>
{
if
(
res
.
data
.
code
===
200
)
{
// 处理数据
res
.
data
.
data
.
cartList
.
forEach
((
item
:
any
)
=>
{
item
[
'name'
]
=
item
.
goodsName
;
item
[
'show'
]
=
false
;
item
[
'url'
]
=
item
.
picUrl
;
item
[
'status'
]
=
1
;
});
// 合并数据
store
.
$patch
({
lineData
:
[...
res
.
data
.
data
.
cartList
,
...
lineList
.
value
],
});
lineList
.
value
=
store
.
lineData
;
store
.
title
=
res
.
data
.
data
.
lineName
;
setTitleRef
.
value
.
title
=
store
.
title
;
// 处理子组件数据更新延迟问题
nextTick
(()
=>
{
flag
.
value
=
true
;
console
.
log
(
res
.
data
.
data
.
cartList
,
store
.
lineData
,
lineList
.
value
);
});
}
});
};
let
addTabs
=
()
=>
{
let
addTabs
=
()
=>
{
categoryRef
.
value
.
currentSubCategoryData
=
[];
categoryRef
.
value
.
currentSubCategoryData
=
[];
showPopup
.
value
=
true
;
showPopup
.
value
=
true
;
categoryRef
.
value
.
initIndex
();
categoryRef
.
value
.
initIndex
();
// console.log(store.lineData);
};
};
// 获取sku隐藏方式 '' 加入后 mask 点击mask部分, close 点击关闭按钮
// 获取sku隐藏方式 '' 加入后 mask 点击mask部分, close 点击关闭按钮
...
@@ -166,8 +233,14 @@ let closeSku = (val: string) => {
...
@@ -166,8 +233,14 @@ let closeSku = (val: string) => {
if
(
lineList
.
value
.
length
===
2
)
index
=
0
;
if
(
lineList
.
value
.
length
===
2
)
index
=
0
;
let
data
=
lineList
.
value
[
index
];
let
data
=
lineList
.
value
[
index
];
lineList
.
value
.
splice
(
index
,
1
);
lineList
.
value
.
splice
(
index
,
1
);
lineList
.
value
.
splice
(
editIndex
.
value
.
index
,
0
,
data
);
if
(
lineId
.
value
)
{
console
.
log
(
lineList
.
value
,
'lineList.value'
);
lineEdit
.
value
.
productId
=
data
.
productId
;
lineEdit
.
value
.
specificationCustom
=
data
.
specificationCustom
;
lineEdit
.
value
.
specifications
=
data
.
specifications
;
lineEdit
.
value
.
number
=
data
.
number
;
lineList
.
value
.
splice
(
editIndex
.
value
.
index
,
0
,
lineEdit
.
value
);
}
else
lineList
.
value
.
splice
(
editIndex
.
value
.
index
,
0
,
data
);
console
.
log
(
lineEdit
.
value
);
}
}
store
.
$patch
({
store
.
$patch
({
lineData
:
lineList
.
value
,
lineData
:
lineList
.
value
,
...
@@ -182,10 +255,16 @@ let closeSku = (val: string) => {
...
@@ -182,10 +255,16 @@ let closeSku = (val: string) => {
let
editIndex
=
ref
();
let
editIndex
=
ref
();
let
editFlag
=
ref
(
false
);
let
editFlag
=
ref
(
false
);
let
lineEdit
=
ref
();
// 记录产品线修改的数据
// 产品修改
// 产品修改
let
sheetEdit
=
(
index
:
number
)
=>
{
let
sheetEdit
=
(
index
:
number
)
=>
{
editFlag
.
value
=
true
;
editFlag
.
value
=
true
;
let
data
=
lineList
.
value
[
index
];
let
data
=
lineList
.
value
[
index
];
if
(
lineId
.
value
)
{
data
.
updateTime
=
null
;
lineEdit
.
value
=
data
;
}
editIndex
.
value
=
{
editIndex
.
value
=
{
index
,
index
,
data
,
data
,
...
@@ -196,8 +275,16 @@ let sheetEdit = (index: number) => {
...
@@ -196,8 +275,16 @@ let sheetEdit = (index: number) => {
initDetails
(
data
.
goodsId
);
initDetails
(
data
.
goodsId
);
};
};
let
lineDelete
=
ref
([]
as
any
);
// 记录产品线删除数据
// 产品删除
// 产品删除
let
sheetDel
=
(
index
:
number
)
=>
{
let
sheetDel
=
(
index
:
number
)
=>
{
if
(
lineId
.
value
)
{
if
(
lineList
.
value
[
index
].
hasOwnProperty
(
'deleted'
))
{
lineList
.
value
[
index
].
deleted
=
true
;
lineDelete
.
value
.
push
(
lineList
.
value
[
index
]);
}
}
lineList
.
value
.
splice
(
index
,
1
);
lineList
.
value
.
splice
(
index
,
1
);
store
.
$patch
({
store
.
$patch
({
lineData
:
lineList
.
value
,
lineData
:
lineList
.
value
,
...
@@ -206,15 +293,28 @@ let sheetDel = (index: number) => {
...
@@ -206,15 +293,28 @@ let sheetDel = (index: number) => {
// 产品复制
// 产品复制
let
sheetCopy
=
(
index
:
number
)
=>
{
let
sheetCopy
=
(
index
:
number
)
=>
{
flag
.
value
=
false
;
lineList
.
value
.
splice
(
index
,
0
,
lineList
.
value
[
index
]);
lineList
.
value
.
splice
(
index
,
0
,
lineList
.
value
[
index
]);
dragRef
.
value
.
initControlsPosition
();
// 避免splice改变原数组
console
.
log
(
lineList
.
value
);
let
lineInfos
=
JSON
.
parse
(
JSON
.
stringify
(
lineList
.
value
));
// lineList.value.forEach((item: any, i: number) => {
lineInfos
[
index
].
show
=
false
;
// if (index + 1 == i) item.show = true;
lineList
.
value
=
lineInfos
;
// else item.show = false;
// });
store
.
$patch
({
store
.
$patch
({
lineData
:
lineList
.
value
,
lineData
:
lineInfos
,
});
// 通过购物车进入操作时进入
if
(
lineId
.
value
)
{
if
(
lineList
.
value
[
index
+
1
].
hasOwnProperty
(
'deleted'
))
delete
lineList
.
value
[
index
+
1
].
deleted
;
if
(
lineList
.
value
[
index
+
1
].
hasOwnProperty
(
'updateTime'
))
delete
lineList
.
value
[
index
+
1
].
updateTime
;
if
(
lineList
.
value
[
index
+
1
].
hasOwnProperty
(
'id'
))
delete
lineList
.
value
[
index
+
1
].
id
;
store
.
$patch
({
lineData
:
lineList
.
value
,
});
}
nextTick
(()
=>
{
flag
.
value
=
true
;
});
});
};
};
...
@@ -296,21 +396,59 @@ let buttonClick = (e: any) => {
...
@@ -296,21 +396,59 @@ let buttonClick = (e: any) => {
// 加入购物车
// 加入购物车
let
addCart
=
()
=>
{
let
addCart
=
()
=>
{
complete
().
then
((
data
:
any
)
=>
{
complete
().
then
((
data
:
any
)
=>
{
addProductLineCart
(
data
).
then
((
res
:
any
)
=>
{
// 判断是否有失效商品
if
(
res
.
data
.
code
===
200
)
{
if
(
uni
.
showToast
({
data
.
item
.
some
((
item
:
any
)
=>
{
title
:
'加入购物车成功'
,
return
!
item
.
isSubmit
&&
item
.
isSubmit
!==
undefined
;
icon
:
'none'
,
})
)
return
uni
.
showToast
({
title
:
'请先删除带红色图标的失效商品'
,
icon
:
'none'
,
});
if
(
lineId
.
value
)
{
// 修改
data
[
'lineId'
]
=
lineId
.
value
;
// 把删除的数据添加进去
if
(
lineDelete
.
value
.
length
!==
0
)
{
lineDelete
.
value
.
map
((
item
:
any
)
=>
{
data
.
item
.
push
(
item
);
});
});
reload
();
}
}
});
getProductLineReAdd
(
data
).
then
((
res
:
any
)
=>
{
if
(
res
.
data
.
code
===
200
)
{
lineDelete
.
value
=
[];
reload
();
}
});
}
else
{
// 添加到购物车
addProductLineCart
(
data
).
then
((
res
:
any
)
=>
{
if
(
res
.
data
.
code
===
200
)
{
uni
.
showToast
({
title
:
'加入购物车成功'
,
icon
:
'none'
,
});
reload
();
}
});
}
});
});
};
};
// 立即购买
// 立即购买
let
buyNow
=
()
=>
{
let
buyNow
=
()
=>
{
complete
().
then
((
data
:
any
)
=>
{
complete
().
then
((
data
:
any
)
=>
{
// 判断是否有失效商品
if
(
data
.
item
.
some
((
item
:
any
)
=>
{
return
!
item
.
isSubmit
&&
item
.
isSubmit
!==
undefined
;
})
)
return
uni
.
showToast
({
title
:
'请先删除带红色图标的失效商品'
,
icon
:
'none'
,
});
addProductLineCart
(
data
).
then
((
res
:
any
)
=>
{
addProductLineCart
(
data
).
then
((
res
:
any
)
=>
{
if
(
res
.
data
.
code
===
200
)
{
if
(
res
.
data
.
code
===
200
)
{
if
(
!
uni
.
getStorageSync
(
'addressId'
))
{
if
(
!
uni
.
getStorageSync
(
'addressId'
))
{
...
@@ -383,6 +521,7 @@ let addProduct = (data: any, productId: number, specifications: any, specificati
...
@@ -383,6 +521,7 @@ let addProduct = (data: any, productId: number, specifications: any, specificati
show
:
false
,
show
:
false
,
status
:
1
,
status
:
1
,
});
});
store
.
$patch
({
store
.
$patch
({
lineData
:
lineList
.
value
,
lineData
:
lineList
.
value
,
});
});
...
@@ -401,6 +540,7 @@ let initDetails = (id: number) => {
...
@@ -401,6 +540,7 @@ 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
;
// console.log(detailData.value, 'detailData.value');
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/pages/profile/addSite.vue
浏览文件 @
3b58d490
...
@@ -2,36 +2,45 @@
...
@@ -2,36 +2,45 @@
<view
class=
"wrap"
>
<view
class=
"wrap"
>
<view
class=
"top"
>
<view
class=
"top"
>
<view
class=
"item"
>
<view
class=
"item"
>
<view
class=
"left"
>
收货人
</view>
<view
class=
"left"
>
客户名称
</view>
<u-select
v-model=
"showSelect"
:list=
"selectList"
@
confirm=
"onConfirm"
></u-select>
<u-select
v-model=
"showSelect"
:list=
"selectList"
@
confirm=
"onConfirm"
></u-select>
<input
<input
:disabled=
"true"
:disabled=
"true"
v-model=
"addressData.name"
v-model=
"addressData.name"
placeholder-class=
"line"
placeholder-class=
"line"
placeholder=
"请填写
收货人姓名
"
placeholder=
"请填写
客户名称
"
@
tap=
"showSelect = true"
@
tap=
"showSelect = true"
/>
/>
</view>
</view>
<view
class=
"item"
>
<view
class=
"item"
>
<view
class=
"left"
>
联系人
</view>
<view
class=
"left"
>
采购员
</view>
<input
<input
type=
"text"
type=
"text"
v-model=
"addressData.contactName"
v-model=
"addressData.contactName"
placeholder-class=
"line"
placeholder-class=
"line"
placeholder=
"请填写
联系人
"
placeholder=
"请填写
采购员
"
/>
/>
</view>
</view>
<view
class=
"item"
>
<view
class=
"item"
>
<view
class=
"left"
>
手机号码
</view>
<view
class=
"left"
>
采购手机号
</view>
<input
<input
v-model=
"addressData.tel"
v-model=
"addressData.tel"
type=
"text"
type=
"text"
placeholder-class=
"line"
placeholder-class=
"line"
placeholder=
"请填写收货人手机号"
placeholder=
"请填写采购手机号"
/>
</view>
<view
class=
"item"
>
<view
class=
"left"
>
采购邮箱
</view>
<input
v-model=
"addressData.customerEmail"
type=
"text"
placeholder-class=
"line"
placeholder=
"请填写采购邮箱"
/>
/>
</view>
</view>
<view
class=
"item"
@
tap=
"showRegionPicker"
>
<view
class=
"item"
@
tap=
"showRegionPicker"
>
<view
class=
"left"
>
所在地
区
</view>
<view
class=
"left"
>
所在地
址
</view>
<input
<input
v-model=
"addressDetails"
v-model=
"addressDetails"
disabled
disabled
...
@@ -99,6 +108,7 @@ let addressData = ref({
...
@@ -99,6 +108,7 @@ let addressData = ref({
isDefault
:
false
,
isDefault
:
false
,
name
:
''
,
name
:
''
,
contactName
:
''
,
contactName
:
''
,
customerEmail
:
''
,
customerCode
:
''
,
customerCode
:
''
,
postalCode
:
''
,
postalCode
:
''
,
province
:
''
,
province
:
''
,
...
@@ -169,14 +179,20 @@ let confirmModel = () => {
...
@@ -169,14 +179,20 @@ let confirmModel = () => {
let
addressSave
=
()
=>
{
let
addressSave
=
()
=>
{
if
(
!
addressData
.
value
.
name
)
if
(
!
addressData
.
value
.
name
)
return
uni
.
showToast
({
return
uni
.
showToast
({
title
:
'请输入
收货人
'
,
title
:
'请输入
客户名称
'
,
icon
:
'none'
,
icon
:
'none'
,
});
});
if
(
!
addressData
.
value
.
contactName
)
if
(
!
addressData
.
value
.
contactName
)
return
uni
.
showToast
({
return
uni
.
showToast
({
title
:
'请输入联系人'
,
title
:
'请输入采购员'
,
icon
:
'none'
,
icon
:
'none'
,
});
});
let
emailReg
=
/^
[
a-zA-Z0-9
]
+
([
-_.
][
A-Za-zd
]
+
)
*@
([
a-zA-Z0-9
]
+
[
-.
])
+
[
A-Za-zd
]{2,5}
$/
if
(
!
emailReg
.
test
(
addressData
.
value
.
customerEmail
))
return
uni
.
showToast
({
title
:
'邮箱为空或格式不对'
,
icon
:
'none'
,
});
let
reg
=
/^
(
13
[
0-9
]
|14
[
01456879
]
|15
[
0-35-9
]
|16
[
2567
]
|17
[
0-8
]
|18
[
0-9
]
|19
[
0-35-9
])\d{8}
$/
;
let
reg
=
/^
(
13
[
0-9
]
|14
[
01456879
]
|15
[
0-35-9
]
|16
[
2567
]
|17
[
0-8
]
|18
[
0-9
]
|19
[
0-35-9
])\d{8}
$/
;
if
(
!
reg
.
test
(
addressData
.
value
.
tel
))
if
(
!
reg
.
test
(
addressData
.
value
.
tel
))
return
uni
.
showToast
({
return
uni
.
showToast
({
...
@@ -233,7 +249,7 @@ let addressDel = () => {
...
@@ -233,7 +249,7 @@ let addressDel = () => {
border-bottom
:
solid
2rpx
$u-border-color
;
border-bottom
:
solid
2rpx
$u-border-color
;
.left
{
.left
{
width
:
18
0rpx
;
width
:
20
0rpx
;
}
}
input
{
input
{
...
...
src/pages/profile/address.vue
浏览文件 @
3b58d490
<
template
>
<
template
>
<view>
<view>
<view
class=
"address"
v-for=
"(res, index) in siteList"
:key=
"res.id"
>
<view
class=
"address"
v-for=
"(res, index) in siteList"
:key=
"res.id"
>
<view
class=
"item"
@
tap=
"setAddress(res.id)"
>
<u-row>
<view
class=
"top"
>
<u-col
:span=
"11"
>
<view
class=
"name"
>
{{
res
.
name
}}
</view>
<view
<view
class=
"phone"
>
{{
res
.
tel
}}
</view>
class=
"item"
<u-tag
@
tap=
"
v-show=
"res.isDefault"
pagePathFlag
text=
"默认"
? setAddress(res)
type=
"error"
: () =>
{
size=
"mini"
return;
style=
"margin-left: 20rpx;"
}
/>
"
</view>
>
<view
class=
"bottom"
>
<view
class=
"top"
>
{{
res
.
province
+
res
.
city
+
res
.
county
+
res
.
addressDetail
}}
<u-row
style=
"width: 100%;"
>
</view>
<u-col
:span=
"5"
>
</view>
<view
class=
"name"
>
{{
res
.
name
}}
</view>
<u-icon
name=
"edit-pen"
color=
"#3b3b3b"
:size=
"40"
@
tap=
"addressEdit(res)"
/>
</u-col>
<u-col
:span=
"4"
>
<view
class=
"phone"
>
{{
res
.
tel
}}
</view>
</u-col>
<u-col
:span=
"3"
style=
"text-align: end;"
>
<u-tag
v-show=
"res.isDefault"
text=
"默认"
type=
"error"
size=
"mini"
/>
</u-col>
</u-row>
</view>
<view
class=
"bottom"
>
{{
res
.
province
+
res
.
city
+
res
.
county
+
res
.
addressDetail
}}
</view>
</view>
</u-col>
<u-col
:span=
"1"
>
<u-icon
name=
"edit-pen"
color=
"#3b3b3b"
:size=
"40"
@
tap=
"addressEdit(res)"
/>
</u-col>
</u-row>
</view>
</view>
<view
class=
"addSite"
@
tap=
"toAddSite"
>
<view
class=
"addSite"
@
tap=
"toAddSite"
>
...
@@ -31,10 +53,21 @@
...
@@ -31,10 +53,21 @@
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
{
ref
}
from
'vue'
;
import
{
ref
}
from
'vue'
;
import
{
onShow
}
from
'@dcloudio/uni-app'
;
import
{
addressList
}
from
'@/api/index'
;
import
{
addressList
}
from
'@/api/index'
;
const
siteList
=
ref
([]
as
any
);
const
siteList
=
ref
([]
as
any
);
// 判断上个页面是否是 我的 页面
const
pagePathFlag
=
ref
(
false
);
onShow
(()
=>
{
let
pages
=
getCurrentPages
();
let
pagePath
:
any
=
pages
[
pages
.
length
-
2
];
//上个页面
if
(
pagePath
.
route
===
'pages/profile/index'
)
return
(
pagePathFlag
.
value
=
false
);
else
return
(
pagePathFlag
.
value
=
true
);
});
const
toAddSite
=
()
=>
{
const
toAddSite
=
()
=>
{
uni
.
navigateTo
({
uni
.
navigateTo
({
url
:
'./addSite'
,
url
:
'./addSite'
,
...
@@ -42,13 +75,22 @@ const toAddSite = () => {
...
@@ -42,13 +75,22 @@ const toAddSite = () => {
};
};
// 设置地址
// 设置地址
const
setAddress
=
(
i
d
:
any
)
=>
{
const
setAddress
=
(
i
tem
:
any
)
=>
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
uni
.
setStorage
({
uni
.
setStorage
({
key
:
'addressId'
,
key
:
'addressId'
,
data
:
id
,
data
:
i
tem
.
i
d
,
success
()
{
success
()
{
uni
.
navigateBack
();
let
pages
=
getCurrentPages
();
// 当前页面
let
beforePage
:
any
=
pages
[
pages
.
length
-
2
];
// 上一页
console
.
log
(
beforePage
);
uni
.
navigateBack
({
success
:
function
()
{
if
(
beforePage
.
route
===
'pages/order/quotation'
)
beforePage
.
addressData
=
item
;
else
beforePage
.
init
();
// 执行上一页的onLoad方法
},
});
},
},
});
});
},
50
);
},
50
);
...
@@ -69,9 +111,8 @@ const initAddressLit = () => {
...
@@ -69,9 +111,8 @@ const initAddressLit = () => {
initAddressLit
();
initAddressLit
();
uni
.
$on
(
'initAddress'
,
()
=>
{
uni
.
$on
(
'initAddress'
,
()
=>
{
initAddressLit
()
initAddressLit
();
})
});
</
script
>
</
script
>
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
...
@@ -82,19 +123,14 @@ page {
...
@@ -82,19 +123,14 @@ page {
.address
{
.address
{
padding
:
40rpx
20rpx
;
padding
:
40rpx
20rpx
;
display
:
flex
;
flex-direction
:
row
;
align-items
:
center
;
justify-content
:
space-between
;
}
}
.item
{
.item
{
.top
{
.top
{
display
:
flex
;
font-weight
:
bold
;
font-weight
:
bold
;
font-size
:
34rpx
;
font-size
:
34rpx
;
.phone
{
.phone
{
margin-left
:
60
rpx
;
font-size
:
32
rpx
;
}
}
.tag
{
.tag
{
...
...
src/pages/profile/setting.vue
浏览文件 @
3b58d490
...
@@ -29,9 +29,16 @@
...
@@ -29,9 +29,16 @@
</u-cell-item>
</u-cell-item>
<u-cell-item
icon=
""
title=
"姓名"
:value=
"userData.nickName"
@
click=
"setName"
></u-cell-item>
<u-cell-item
icon=
""
title=
"姓名"
:value=
"userData.nickName"
@
click=
"setName"
></u-cell-item>
<u-cell-item
icon=
""
title=
"密码设置"
:value=
"userData.pwd"
@
click=
"setPwd"
></u-cell-item>
<u-cell-item
icon=
""
title=
"密码设置"
:value=
"userData.pwd"
@
click=
"setPwd"
></u-cell-item>
<u-cell-item
icon=
""
title=
"手机号"
:value=
"userData.mobile"
></u-cell-item>
<u-cell-item
icon=
""
title=
"手机号"
:value=
"userData.mobile"
@
click=
"setTel"
></u-cell-item>
<u-cell-item
icon=
""
title=
"编码"
value=
"七妹
"
></u-cell-item>
<u-cell-item
icon=
""
title=
"编码"
:value=
"userData.username
"
></u-cell-item>
<u-cell-item
icon=
""
title=
"邮箱"
:value=
"userData.email"
@
click=
"setEmail"
></u-cell-item>
<u-cell-item
icon=
""
title=
"邮箱"
:value=
"userData.email"
@
click=
"setEmail"
></u-cell-item>
<u-cell-item
icon=
""
title=
"发货地址"
:value=
"userData.workAddr"
:value-style=
"{ marginLeft: '17%' }"
@
tap=
"setAddr"
></u-cell-item>
</u-cell-group>
</u-cell-group>
<u-button
style=
"margin-top: 100rpx;"
@
tap=
"openModel"
>
退出当前用户
</u-button>
<u-button
style=
"margin-top: 100rpx;"
@
tap=
"openModel"
>
退出当前用户
</u-button>
...
@@ -42,9 +49,9 @@
...
@@ -42,9 +49,9 @@
show-cancel-button
show-cancel-button
></u-modal>
></u-modal>
<!-- 修改
用户
名 -->
<!-- 修改
姓
名 -->
<u-popup
v-model=
"options.showPopup"
mode=
"center"
height=
"22%"
width=
"80%"
>
<u-popup
v-model=
"options.showPopup"
mode=
"center"
width=
"80%"
>
<view
style=
"padding: 30rpx;
height: 100%;
margin-top: 0%;"
>
<view
style=
"padding: 30rpx; margin-top: 0%;"
>
<view
style=
"font-size: 34rpx; width: 100%; text-align: center; margin-bottom: 20rpx;"
>
<view
style=
"font-size: 34rpx; width: 100%; text-align: center; margin-bottom: 20rpx;"
>
{{ title }}
{{ title }}
</view>
</view>
...
@@ -60,8 +67,8 @@
...
@@ -60,8 +67,8 @@
</u-popup>
</u-popup>
<!-- 修改密码 -->
<!-- 修改密码 -->
<u-popup
v-model=
"options.showPopupPwd"
mode=
"center"
height=
"30%"
width=
"80%"
>
<u-popup
v-model=
"options.showPopupPwd"
mode=
"center"
width=
"80%"
>
<view
style=
"padding: 30rpx;
height: 100%;
margin-top: 0%;"
>
<view
style=
"padding: 30rpx; margin-top: 0%;"
>
<view
style=
"font-size: 34rpx; width: 100%; text-align: center; margin-bottom: 20rpx;"
>
<view
style=
"font-size: 34rpx; width: 100%; text-align: center; margin-bottom: 20rpx;"
>
设置密码
设置密码
</view>
</view>
...
@@ -92,36 +99,74 @@
...
@@ -92,36 +99,74 @@
</u-button>
</u-button>
</view>
</view>
</u-popup>
</u-popup>
<!-- 修改地址 -->
<u-popup
v-model=
"options.showPopupAddr"
mode=
"center"
width=
"90%"
>
<view
style=
"padding: 30rpx; margin-top: 0%;"
>
<view
style=
"font-size: 34rpx; width: 100%; text-align: center; margin-bottom: 20rpx;"
>
{{ title }}
</view>
<u-form
label-width=
"155"
>
<u-form-item
label=
"选择地址"
>
<u-input
v-model=
"temporaryAddr"
:disabled=
"true"
:border=
"true"
clearable
placeholder=
"请选择地址"
@
tap=
"options.showSelectAddr = true"
/>
</u-form-item>
<u-form-item
label=
"详细信息"
>
<u-input
v-model=
"detailAddr"
type=
"textarea"
:border=
"true"
clearable
placeholder=
"请输入详细信息"
/>
</u-form-item>
</u-form>
<u-button
:maxlength=
"11"
type=
"error"
style=
"margin-top: 8%;"
@
tap=
"addrSave"
>
保存
</u-button>
</view>
</u-popup>
<u-picker
mode=
"region"
ref=
"uPicker"
v-model=
"options.showSelectAddr"
@
confirm=
"selectAddr"
/>
</template>
</template>
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
{
ref
,
reactive
,
getCurrentInstance
}
from
'vue'
;
import
{
ref
,
reactive
,
getCurrentInstance
}
from
'vue'
;
import
{
getAuthInfo
,
resetNickName
,
resetByMobile
,
resetEmail
}
from
'@/api/profile'
;
import
{
getAuthInfo
,
resetNickName
,
resetByMobile
,
resetEmail
,
resetWorkAddr
,
resetMobile
}
from
'@/api/profile'
;
import
config
from
'@/utils/config'
;
import
config
from
'@/utils/config'
;
let
ctx
:
any
=
getCurrentInstance
();
let
ctx
:
any
=
getCurrentInstance
();
let
$u
=
ctx
.
appContext
.
config
.
globalProperties
.
$u
;
let
$u
=
ctx
.
appContext
.
config
.
globalProperties
.
$u
;
// uview方法
let
title
=
ref
(
''
)
let
title
=
ref
(
''
)
let
label
=
ref
(
''
)
let
label
=
ref
(
''
)
let
userData
=
ref
({
let
userData
=
ref
({
avatar
:
''
,
avatar
:
''
,
nickName
:
''
,
nickName
:
''
,
mobile
:
''
,
mobile
:
''
,
phone
:
''
,
email
:
''
,
email
:
''
workAddr
:
''
,
}
);
}
as
any
);
// 用户信息
let
uploadRef
=
ref
()
let
uploadRef
=
ref
()
let
action
=
ref
(
config
.
baseUrl
+
'/wx/auth/reset_avatar'
);
let
action
=
ref
(
config
.
baseUrl
+
'/wx/auth/reset_avatar'
);
let
headers
=
ref
({
Authorization
:
uni
.
getStorageSync
(
'token'
)
});
let
headers
=
ref
({
Authorization
:
uni
.
getStorageSync
(
'token'
)
});
let
nameValue
=
ref
(
''
);
let
nameValue
=
ref
(
''
);
let
oldPwd
=
ref
(
''
);
let
oldPwd
=
ref
(
''
);
// 旧密码
let
newPwd
=
ref
(
''
);
let
newPwd
=
ref
(
''
);
// 新密码
let
fileList
=
ref
([]);
let
fileList
=
ref
([]);
// 头像数据
let
temporaryAddr
=
ref
(
''
)
// 临时地址
let
detailAddr
=
ref
(
''
)
// 详细地址信息
let
options
=
reactive
({
let
options
=
reactive
({
show
:
false
,
show
:
false
,
content
:
'确定退出当前用户'
,
content
:
'确定退出当前用户'
,
showPopup
:
false
,
showPopup
:
false
,
showPopupPwd
:
false
,
showPopupPwd
:
false
,
showPopupAddr
:
false
,
showSelectAddr
:
false
,
});
});
let
openModel
=
()
=>
{
let
openModel
=
()
=>
{
...
@@ -143,6 +188,18 @@ let setPwd = () => {
...
@@ -143,6 +188,18 @@ let setPwd = () => {
options
.
showPopupPwd
=
true
;
options
.
showPopupPwd
=
true
;
};
};
let
setTel
=
()
=>
{
label
.
value
=
'手机号:'
title
.
value
=
'设置手机号'
nameValue
.
value
=
userData
.
value
.
mobile
options
.
showPopup
=
true
;
};
let
setAddr
=
()
=>
{
title
.
value
=
'设置地址'
options
.
showPopupAddr
=
true
;
};
let
success
=
(
res
:
any
)
=>
{
let
success
=
(
res
:
any
)
=>
{
if
(
res
.
code
===
200
)
{
if
(
res
.
code
===
200
)
{
init
();
init
();
...
@@ -173,7 +230,18 @@ let nameSave = () => {
...
@@ -173,7 +230,18 @@ let nameSave = () => {
}
}
});
});
})
})
break
break
;
case
'手机号:'
:
save
(()
=>
{
resetMobile
({
mobile
:
nameValue
.
value
}).
then
((
res
:
any
)
=>
{
if
(
res
.
data
.
code
===
200
)
{
nameValue
.
value
=
''
;
options
.
showPopup
=
false
;
init
();
}
});
})
break
;
}
}
};
};
...
@@ -189,6 +257,31 @@ let save = (func: Function) => {
...
@@ -189,6 +257,31 @@ let save = (func: Function) => {
}
}
}
}
let
selectAddr
=
(
e
:
any
)
=>
{
temporaryAddr
.
value
=
e
.
province
.
name
+
e
.
city
.
name
+
e
.
area
.
name
}
// 保存地址
let
addrSave
=
()
=>
{
if
(
!
temporaryAddr
.
value
)
return
uni
.
showToast
({
title
:
'请选择地址'
,
icon
:
'none'
,
});
if
(
!
detailAddr
.
value
)
return
uni
.
showToast
({
title
:
'请输入收货地址'
,
icon
:
'none'
,
});
let
workAddr
=
temporaryAddr
.
value
+
detailAddr
.
value
resetWorkAddr
({
workAddr
}).
then
((
res
:
any
)
=>
{
if
(
res
.
data
.
code
)
{
options
.
showPopupAddr
=
false
init
()
}
})
}
let
pwdSave
=
()
=>
{
let
pwdSave
=
()
=>
{
if
(
!
oldPwd
.
value
)
if
(
!
oldPwd
.
value
)
return
uni
.
showToast
({
return
uni
.
showToast
({
...
@@ -229,10 +322,19 @@ const toLogin = () => {
...
@@ -229,10 +322,19 @@ const toLogin = () => {
});
});
};
};
// 初始化数据
let
init
=
()
=>
{
let
init
=
()
=>
{
getAuthInfo
().
then
((
res
:
any
)
=>
{
getAuthInfo
().
then
((
res
:
any
)
=>
{
if
(
res
.
data
.
code
===
200
)
{
if
(
res
.
data
.
code
===
200
)
{
userData
.
value
=
res
.
data
.
data
;
userData
.
value
=
res
.
data
.
data
;
var
reg
=
/.+
?(
省|市|自治区|自治州|县|区
)
/g
;
// 省市区的正则
let
addr
=
userData
.
value
.
workAddr
.
match
(
reg
)
temporaryAddr
.
value
=
addr
[
0
]
+
addr
[
1
]
+
addr
[
2
]
addr
.
map
((
item
:
any
,
i
:
number
)
=>
{
if
(
i
>
2
)
{
detailAddr
.
value
+=
item
}
})
}
}
});
});
};
};
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论