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
810a0982
提交
810a0982
authored
4月 06, 2023
作者:
刘旭
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
同步代码
上级
e63522c4
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
4 行增加
和
319 行删除
+4
-319
vk-data-goods-sku-popup.vue
...nents/vk-data-goods-sku-popup/vk-data-goods-sku-popup.vue
+1
-0
goodsSku.vue
src/pages/goods/goodsSku.vue
+1
-0
cellItem.vue
src/pages/productLine/components/cellItem.vue
+2
-2
drag-and-drop-sort.vue
src/pages/productLine/components/drag-and-drop-sort.vue
+0
-317
没有找到文件。
src/components/vk-data-goods-sku-popup/vk-data-goods-sku-popup.vue
浏览文件 @
810a0982
...
...
@@ -24,6 +24,7 @@
{{
priceCom
}}
</text>
</view>
-->
<view
style=
"font-weight: 600;"
>
{{
goodsInfo
?.
name
}}
</view>
<view
class=
"inventory"
v-if=
"!hideStock"
>
{{
stockText
}}
:
{{
stockCom
}}
</view>
...
...
src/pages/goods/goodsSku.vue
浏览文件 @
810a0982
...
...
@@ -152,6 +152,7 @@ let init = (data: any, id: number, partsData?: any) => {
spec_list
:
specificationList
,
partsData
};
// console.log(goodsInfo.value);
productList
=
[]
specificationList
=
[]
// resultSku()
...
...
src/pages/productLine/components/cellItem.vue
浏览文件 @
810a0982
<
template
>
<view
class=
"cell-item"
v-if=
"Object.keys(item).length != 0"
>
<view
class=
"cell-item-name"
>
<view>
<view
style=
"overflow: hidden; text-overflow:ellipsis"
>
<u-icon
v-if=
"!item.isSubmit && item.deleted"
name=
"error-circle-fill"
color=
"#ff0000"
style=
"margin-right: 10rpx;"
/>
<u-icon
v-if=
"
...
...
@@ -12,7 +12,7 @@
? false
: !item.isSubmit && !item.deleted
"
name=
"error-circle-fill"
color=
"#0055ff"
style=
"margin-right: 4rpx;"
/>
<text>
{{
item
?.
name
}}
</text>
<text
style=
"white-space:nowrap;"
>
{{
item
?.
name
}}
</text>
</view>
<text
style=
"color: #909399; margin-left: 20rpx;"
>
×
{{
item
?.
number
}}
</text>
</view>
...
...
src/pages/productLine/components/drag-and-drop-sort.vue
deleted
100644 → 0
浏览文件 @
e63522c4
<
template
>
<view
class=
"drag-and-drop-sort-B"
:style=
"[containerSize]"
>
<template
v-if=
"controlsPositionArray.length !== 0"
>
<view
v-for=
"(item, index) in controlsArray"
:key=
"index"
class=
"_item"
:style=
"
{
background: '#fff',
transition: curretnControlsIndex === index ? 'initial' : '.3s',
'z-index': curretnControlsIndex === index ? 1 : 0,
width: controlsSize.width + 'px',
height: controlsSize.height + 'px',
top: controlsPositionArray[index].top + 'px',
left: controlsPositionArray[index].left + 'px',
}">
<view
@
touchstart=
"handleTouchstart($event, index)"
@
touchmove
.
prevent=
"handleTouchmove($event, index)"
@
touchend=
"handleTouchend"
@
tap=
"handleTap(index, item)"
style=
"width: 100%; height: 100%;"
>
<!-- 自定义内容 -->
<view
class=
"item"
style=
"display: flex; align-items: center; justify-content: center; width: 100%; height: 100%;"
:style=
"
{ backgroundColor: item.show ? '#fff' : '#f5f5f5' }">
<slot
:row=
"item"
:index=
"index"
></slot>
</view>
</view>
</view>
</
template
>
<!-- <u-action-sheet
:list="sheetList"
v-model="sheetShow"
:cancel-btn="false"
class="action-sheet"
@click="sheetChange"
></u-action-sheet> -->
</view>
</template>
<
script
>
export
default
{
name
:
'drag-and-drop-sort'
,
props
:
{
// 容器大小
// containerSize: {
// type: Object,
// default: () => ({ wdith: '120px', height: '40px' }),
// },
// 控件的大小
controlsSize
:
{
type
:
Object
,
default
:
()
=>
({
width
:
0
,
height
:
0
}),
},
// 数据列表
controlsList
:
{
type
:
Array
,
default
:
()
=>
[],
},
// 是否为导入方式进入
isUpload
:
{
type
:
Boolean
,
default
:
false
,
},
},
emits
:
[
'sheet-del'
,
'sheet-edit'
,
'sheet-copy'
,
'height-change'
],
data
()
{
return
{
sheetShow
:
false
,
sheetList
:
[
{
text
:
'修改规格'
,
},
{
text
:
'复制'
,
},
{
text
:
'删除'
,
},
],
// 控件列表
controlsArray
:
[],
// 每行最大存放的个数
maxWidthCount
:
1
,
// 控件的间距
margin
:
{
margin_x
:
0
,
margin_y
:
2
,
},
// 记录所有控件的初始位置
recordInitControlsPoisitonList
:
[],
// 控件的数据
controlsPositionArray
:
[],
// 记录当前手指的位置
recordPosition
:
{
x
:
0
,
y
:
0
,
},
// 记录当前操作的控件数据
recordControlsPositionItem
:
{},
// 当前操作的控件的下标
curretnControlsIndex
:
-
1
,
containerSize
:
{
wdith
:
'80px'
,
height
:
''
,
},
systemInfo
:
undefined
,
sheetIndex
:
0
,
};
},
mounted
()
{
this
.
init
();
},
methods
:
{
init
()
{
// 获取系统信息
this
.
systemInfo
=
uni
.
getSystemInfoSync
();
// 获取控件列表
this
.
controlsArray
=
this
.
controlsList
;
// 初始化控件的位置
this
.
controlsPositionArray
=
this
.
initControlsPosition
();
},
/** 初始化各个控件的位置 */
initControlsPosition
()
{
// 用于返回出去的新数组
let
tempArray
=
[];
// 设置控件位置
for
(
let
i
=
0
,
j
=
0
;
i
<
this
.
controlsList
.
length
;
i
++
,
j
++
)
{
tempArray
[
i
]
=
{
left
:
this
.
margin
.
margin_x
,
top
:
j
*
(
this
.
controlsSize
.
height
+
this
.
margin
.
margin_y
)
+
this
.
margin
.
margin_y
,
};
}
// 记录数据 - 进行深拷贝
this
.
recordInitControlsPoisitonList
=
[...
tempArray
];
// 返回数据
// console.log(tempArray, 'tempArray');
return
tempArray
;
},
// 点击操作
handleTap
(
index
,
item
)
{
let
that
=
this
;
if
(
that
.
isUpload
)
return
// console.log(that.controlsArray, index);
if
(
index
==
that
.
controlsArray
.
length
-
1
)
return
;
that
.
controlsArray
.
forEach
((
item
,
i
)
=>
{
if
(
i
!==
index
)
item
.
show
=
false
;
});
that
.
controlsArray
[
index
].
show
=
true
;
// that.sheetShow = true;
that
.
sheetIndex
=
index
;
uni
.
showActionSheet
({
itemList
:
[
'修改规格'
,
'复制'
,
'删除'
],
success
:
function
(
res
)
{
that
.
sheetChange
(
res
.
tapIndex
,
item
);
},
fail
:
function
(
res
)
{
console
.
log
(
res
.
errMsg
);
},
});
},
// 点击选择操作
sheetChange
(
index
,
item
)
{
let
that
=
this
;
switch
(
index
)
{
case
0
:
that
.
$emit
(
'sheet-edit'
,
that
.
sheetIndex
);
break
;
case
1
:
that
.
$emit
(
'sheet-copy'
,
that
.
sheetIndex
);
break
;
case
2
:
that
.
$emit
(
'sheet-del'
,
that
.
sheetIndex
,
item
);
break
;
}
},
/** 处理手指触摸后移动 */
handleTouchmove
(
event
,
index
)
{
if
(
this
.
isUpload
)
return
if
(
index
==
this
.
controlsArray
.
length
-
1
)
return
;
const
{
pageX
,
pageY
}
=
event
.
touches
[
0
];
// 获取移动的差
this
.
controlsPositionArray
[
this
.
curretnControlsIndex
]
=
{
left
:
this
.
controlsPositionArray
[
this
.
curretnControlsIndex
].
left
+
(
pageX
-
this
.
recordPosition
.
x
),
top
:
this
.
controlsPositionArray
[
this
.
curretnControlsIndex
].
top
+
(
pageY
-
this
.
recordPosition
.
y
),
};
// 记录位置
this
.
recordPosition
=
{
x
:
pageX
,
y
:
pageY
};
// 判断当前移动的位置是否需要进行排序
if
(
this
.
controlsPositionArray
[
this
.
curretnControlsIndex
].
top
>=
this
.
recordInitControlsPoisitonList
[
this
.
recordInitControlsPoisitonList
.
length
-
1
]
.
top
)
return
;
if
(
this
.
curretnControlsIndex
!==
this
.
controlsPositionArray
.
length
-
1
&&
this
.
controlsPositionArray
[
this
.
curretnControlsIndex
].
top
>
this
.
controlsPositionArray
[
this
.
curretnControlsIndex
+
1
].
top
)
{
// 向下移动
// 交换位置
this
.
_handleChangeControlsPosition
(
0
,
this
.
curretnControlsIndex
+
1
);
}
// 向上移动
else
if
(
this
.
curretnControlsIndex
!==
0
&&
this
.
controlsPositionArray
[
this
.
curretnControlsIndex
].
top
<
this
.
controlsPositionArray
[
this
.
curretnControlsIndex
-
1
].
top
)
{
// 交换位置
this
.
_handleChangeControlsPosition
(
0
,
this
.
curretnControlsIndex
-
1
);
}
},
/** 处理手指触摸开始事件 */
handleTouchstart
(
event
,
index
)
{
if
(
this
.
isUpload
)
return
if
(
index
==
this
.
controlsArray
.
length
-
1
)
return
;
const
{
pageX
,
pageY
}
=
event
.
touches
[
0
];
// 记录一些数据
this
.
curretnControlsIndex
=
index
;
this
.
recordPosition
=
{
x
:
pageX
,
y
:
pageY
};
this
.
recordControlsPositionItem
=
this
.
controlsPositionArray
[
index
];
},
/** 处理手指松开事件 */
handleTouchend
(
event
)
{
// 将操控的控件归位
this
.
controlsPositionArray
[
this
.
curretnControlsIndex
]
=
this
.
recordInitControlsPoisitonList
[
this
.
curretnControlsIndex
];
this
.
curretnControlsIndex
=
-
1
;
},
// 达到最后一个返回原位
handleReturn
(
index
)
{
let
i
=
this
.
controlsArray
.
length
-
2
;
let
arr
=
this
.
controlsArray
[
index
];
this
.
controlsArray
.
splice
(
i
,
1
);
this
.
controlsArray
.
splice
(
index
,
0
,
arr
);
},
/**
* 处理交换控件位置的方法 -
* @param {number} index 需要与第几个下标交换位置
* */
_handleChangeControlsPosition
(
type
,
index
)
{
// 记录当前操控的控件数据
let
tempControls
=
this
.
controlsArray
[
this
.
curretnControlsIndex
];
// 设置原来位置的数据
this
.
controlsArray
[
this
.
curretnControlsIndex
]
=
this
.
controlsArray
[
index
];
// 将临时存放的数据设置好
this
.
controlsArray
[
index
]
=
tempControls
;
// 调整控件位置数据
this
.
controlsPositionArray
[
index
]
=
this
.
controlsPositionArray
[
this
.
curretnControlsIndex
];
this
.
controlsPositionArray
[
this
.
curretnControlsIndex
]
=
this
.
recordControlsPositionItem
;
// 改变当前选中的位置
this
.
curretnControlsIndex
=
index
;
// 记录新位置的数据
this
.
recordControlsPositionItem
=
this
.
recordInitControlsPoisitonList
[
this
.
curretnControlsIndex
];
},
},
watch
:
{
controlsArray
:
{
handler
:
function
()
{
let
that
=
this
;
this
.
controlsPositionArray
=
that
.
initControlsPosition
();
},
deep
:
true
,
immediate
:
true
,
},
// 监听数组, 大于15条时,增加高度
controlsList
:
{
handler
:
function
()
{
let
that
=
this
;
// that.$emit('height-change');
// if (that.controlsPositionArray.length > 17) that.$emit('height-change', 28);
// else that.$emit('height-change', 40);
},
deep
:
true
,
immediate
:
true
,
},
},
};
</
script
>
<
style
scoped
lang=
"scss"
>
$sheet-heigth
:
var
(
--
window-bottom
);
.drag-and-drop-sort-B
{
position
:
relative
;
._item
{
position
:
absolute
;
}
}
// .action-sheet {
// position: fixed;
// bottom: 50px;
// z-index: 99;
// overflow-y: scroll;
// -webkit-overflow-scrolling: touch;
// }
</
style
>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论