Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
self-support
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李俊赕
self-support
Commits
aebe688a
Commit
aebe688a
authored
Mar 31, 2022
by
刘文虎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dev-3/31
parent
41a602a0
Changes
55
Hide whitespace changes
Inline
Side-by-side
Showing
55 changed files
with
5948 additions
and
789 deletions
+5948
-789
package-lock.json
package-lock.json
+88
-81
index.js
src/common/api/index.js
+6
-0
inventory.js
src/common/api/mine/inventory.js
+32
-0
received.js
src/common/api/mine/received.js
+37
-0
common.js
src/common/common.js
+49
-0
received.js
src/common/optinos/mine/received.js
+9
-0
XhScan.vue
src/components/createCom/XhScan.vue
+4
-1
stringMixin.js
src/components/createCom/stringMixin.js
+1
-0
fixed-button.vue
src/components/mine/fixed-button.vue
+50
-0
xh-button.vue
src/components/mine/xh-button.vue
+32
-0
pages.json
src/pages.json
+69
-44
index.vue
src/pages/index/index.vue
+2
-2
mine.vue
src/pages/index/mine.vue
+397
-385
XhPickerSelect.vue
src/pages/mine/warehouse/components/XhPickerSelect.vue
+141
-0
goodsCount.vue
src/pages/mine/warehouse/components/inventory/goodsCount.vue
+65
-0
inventoryHead.vue
...ges/mine/warehouse/components/inventory/inventoryHead.vue
+93
-0
inventoryInfo.vue
...ges/mine/warehouse/components/inventory/inventoryInfo.vue
+128
-0
receiveBarCode.vue
...ine/warehouse/components/receiveDetail/receiveBarCode.vue
+129
-0
receiveImages - 副本.vue
...warehouse/components/receiveDetail/receiveImages - 副本.vue
+180
-0
receiveImages.vue
...mine/warehouse/components/receiveDetail/receiveImages.vue
+180
-0
receiveQrCode.vue
...mine/warehouse/components/receiveDetail/receiveQrCode.vue
+135
-0
receivedHead.vue
...pages/mine/warehouse/components/received/receivedHead.vue
+75
-0
receivingInfo.vue
...ages/mine/warehouse/components/received/receivingInfo.vue
+112
-0
index.vue
src/pages/mine/warehouse/index.vue
+300
-276
inventory.vue
src/pages/mine/warehouse/inventory.vue
+296
-0
inventoryDetail.vue
src/pages/mine/warehouse/inventoryDetail.vue
+177
-0
receiveDetail.vue
src/pages/mine/warehouse/receiveDetail.vue
+180
-0
received.vue
src/pages/mine/warehouse/received.vue
+258
-0
changelog.md
src/uni_modules/uni-scss/changelog.md
+8
-0
index.scss
src/uni_modules/uni-scss/index.scss
+1
-0
package.json
src/uni_modules/uni-scss/package.json
+82
-0
readme.md
src/uni_modules/uni-scss/readme.md
+4
-0
index.scss
src/uni_modules/uni-scss/styles/index.scss
+7
-0
_border.scss
src/uni_modules/uni-scss/styles/setting/_border.scss
+3
-0
_color.scss
src/uni_modules/uni-scss/styles/setting/_color.scss
+66
-0
_radius.scss
src/uni_modules/uni-scss/styles/setting/_radius.scss
+55
-0
_space.scss
src/uni_modules/uni-scss/styles/setting/_space.scss
+56
-0
_styles.scss
src/uni_modules/uni-scss/styles/setting/_styles.scss
+167
-0
_text.scss
src/uni_modules/uni-scss/styles/setting/_text.scss
+24
-0
_variables.scss
src/uni_modules/uni-scss/styles/setting/_variables.scss
+146
-0
functions.scss
src/uni_modules/uni-scss/styles/tools/functions.scss
+19
-0
theme.scss
src/uni_modules/uni-scss/theme.scss
+31
-0
variables.scss
src/uni_modules/uni-scss/variables.scss
+62
-0
changelog.md
src/uni_modules/uni-swipe-action/changelog.md
+31
-0
bindingx.js
...swipe-action/components/uni-swipe-action-item/bindingx.js
+300
-0
isPC.js
...uni-swipe-action/components/uni-swipe-action-item/isPC.js
+12
-0
mpalipay.js
...swipe-action/components/uni-swipe-action-item/mpalipay.js
+193
-0
mpother.js
...-swipe-action/components/uni-swipe-action-item/mpother.js
+257
-0
mpwxs.js
...ni-swipe-action/components/uni-swipe-action-item/mpwxs.js
+82
-0
render.js
...i-swipe-action/components/uni-swipe-action-item/render.js
+270
-0
uni-swipe-action-item.vue
...omponents/uni-swipe-action-item/uni-swipe-action-item.vue
+348
-0
wx.wxs
.../uni-swipe-action/components/uni-swipe-action-item/wx.wxs
+341
-0
uni-swipe-action.vue
...e-action/components/uni-swipe-action/uni-swipe-action.vue
+60
-0
package.json
src/uni_modules/uni-swipe-action/package.json
+87
-0
readme.md
src/uni_modules/uni-swipe-action/readme.md
+11
-0
No files found.
package-lock.json
View file @
aebe688a
...
...
@@ -3039,16 +3039,6 @@
"integrity"
:
"sha1-/q7SVZc9LndVW4PbwIhRpsY1IPo="
,
"dev"
:
true
},
"ansi-styles"
:
{
"version"
:
"4.3.0"
,
"resolved"
:
"https://repo.huaweicloud.com/repository/npm/ansi-styles/-/ansi-styles-4.3.0.tgz"
,
"integrity"
:
"sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"color-convert"
:
"^2.0.1"
}
},
"cacache"
:
{
"version"
:
"13.0.1"
,
"resolved"
:
"https://registry.npm.taobao.org/cacache/download/cacache-13.0.1.tgz?cache=0&sync_timestamp=1616431156987&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcacache%2Fdownload%2Fcacache-13.0.1.tgz"
,
...
...
@@ -3075,34 +3065,6 @@
"unique-filename"
:
"^1.1.1"
}
},
"chalk"
:
{
"version"
:
"4.1.2"
,
"resolved"
:
"https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz"
,
"integrity"
:
"sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"ansi-styles"
:
"^4.1.0"
,
"supports-color"
:
"^7.1.0"
}
},
"color-convert"
:
{
"version"
:
"2.0.1"
,
"resolved"
:
"https://repo.huaweicloud.com/repository/npm/color-convert/-/color-convert-2.0.1.tgz"
,
"integrity"
:
"sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"color-name"
:
"~1.1.4"
}
},
"color-name"
:
{
"version"
:
"1.1.4"
,
"resolved"
:
"https://repo.huaweicloud.com/repository/npm/color-name/-/color-name-1.1.4.tgz"
,
"integrity"
:
"sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
,
"dev"
:
true
,
"optional"
:
true
},
"css-loader"
:
{
"version"
:
"3.6.0"
,
"resolved"
:
"https://registry.npm.taobao.org/css-loader/download/css-loader-3.6.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcss-loader%2Fdownload%2Fcss-loader-3.6.0.tgz"
,
...
...
@@ -3197,13 +3159,6 @@
"slash"
:
"^2.0.0"
}
},
"has-flag"
:
{
"version"
:
"4.0.0"
,
"resolved"
:
"https://repo.huaweicloud.com/repository/npm/has-flag/-/has-flag-4.0.0.tgz"
,
"integrity"
:
"sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="
,
"dev"
:
true
,
"optional"
:
true
},
"hash-sum"
:
{
"version"
:
"2.0.0"
,
"resolved"
:
"https://registry.npm.taobao.org/hash-sum/download/hash-sum-2.0.0.tgz"
,
...
...
@@ -3368,16 +3323,6 @@
"minipass"
:
"^3.1.1"
}
},
"supports-color"
:
{
"version"
:
"7.2.0"
,
"resolved"
:
"https://repo.huaweicloud.com/repository/npm/supports-color/-/supports-color-7.2.0.tgz"
,
"integrity"
:
"sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"has-flag"
:
"^4.0.0"
}
},
"terser-webpack-plugin"
:
{
"version"
:
"2.3.8"
,
"resolved"
:
"https://registry.npm.taobao.org/terser-webpack-plugin/download/terser-webpack-plugin-2.3.8.tgz?cache=0&sync_timestamp=1610196021147&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fterser-webpack-plugin%2Fdownload%2Fterser-webpack-plugin-2.3.8.tgz"
,
...
...
@@ -3415,32 +3360,6 @@
"dev"
:
true
}
}
},
"vue-loader-v16"
:
{
"version"
:
"npm:vue-loader@16.8.3"
,
"resolved"
:
"https://registry.npmjs.org/vue-loader/-/vue-loader-16.8.3.tgz"
,
"integrity"
:
"sha512-7vKN45IxsKxe5GcVCbc2qFU5aWzyiLrYJyUuMz4BQLKctCj/fmCa0w6fGiiQ2cLFetNcek1ppGJQDCup0c1hpA=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"chalk"
:
"^4.1.0"
,
"hash-sum"
:
"^2.0.0"
,
"loader-utils"
:
"^2.0.0"
},
"dependencies"
:
{
"loader-utils"
:
{
"version"
:
"2.0.2"
,
"resolved"
:
"https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.2.tgz"
,
"integrity"
:
"sha512-TM57VeHptv569d/GKh6TAYdzKblwDNiumOdkFnejjD0XwTH87K90w3O7AiJRqdQoXygvi1VQTJTLGhJl7WqA7A=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"big.js"
:
"^5.2.2"
,
"emojis-list"
:
"^3.0.0"
,
"json5"
:
"^2.1.2"
}
}
}
}
}
},
...
...
@@ -16461,6 +16380,94 @@
"vue-style-loader"
:
"^4.1.0"
}
},
"vue-loader-v16"
:
{
"version"
:
"npm:vue-loader@16.8.3"
,
"resolved"
:
"https://registry.npmjs.org/vue-loader/-/vue-loader-16.8.3.tgz"
,
"integrity"
:
"sha512-7vKN45IxsKxe5GcVCbc2qFU5aWzyiLrYJyUuMz4BQLKctCj/fmCa0w6fGiiQ2cLFetNcek1ppGJQDCup0c1hpA=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"chalk"
:
"^4.1.0"
,
"hash-sum"
:
"^2.0.0"
,
"loader-utils"
:
"^2.0.0"
},
"dependencies"
:
{
"ansi-styles"
:
{
"version"
:
"4.3.0"
,
"resolved"
:
"https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz"
,
"integrity"
:
"sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"color-convert"
:
"^2.0.1"
}
},
"chalk"
:
{
"version"
:
"4.1.2"
,
"resolved"
:
"https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz"
,
"integrity"
:
"sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"ansi-styles"
:
"^4.1.0"
,
"supports-color"
:
"^7.1.0"
}
},
"color-convert"
:
{
"version"
:
"2.0.1"
,
"resolved"
:
"https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz"
,
"integrity"
:
"sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"color-name"
:
"~1.1.4"
}
},
"color-name"
:
{
"version"
:
"1.1.4"
,
"resolved"
:
"https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz"
,
"integrity"
:
"sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
,
"dev"
:
true
,
"optional"
:
true
},
"has-flag"
:
{
"version"
:
"4.0.0"
,
"resolved"
:
"https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz"
,
"integrity"
:
"sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="
,
"dev"
:
true
,
"optional"
:
true
},
"hash-sum"
:
{
"version"
:
"2.0.0"
,
"resolved"
:
"https://registry.npmjs.org/hash-sum/-/hash-sum-2.0.0.tgz"
,
"integrity"
:
"sha512-WdZTbAByD+pHfl/g9QSsBIIwy8IT+EsPiKDs0KNX+zSHhdDLFKdZu0BQHljvO+0QI/BasbMSUa8wYNCZTvhslg=="
,
"dev"
:
true
,
"optional"
:
true
},
"loader-utils"
:
{
"version"
:
"2.0.2"
,
"resolved"
:
"https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.2.tgz"
,
"integrity"
:
"sha512-TM57VeHptv569d/GKh6TAYdzKblwDNiumOdkFnejjD0XwTH87K90w3O7AiJRqdQoXygvi1VQTJTLGhJl7WqA7A=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"big.js"
:
"^5.2.2"
,
"emojis-list"
:
"^3.0.0"
,
"json5"
:
"^2.1.2"
}
},
"supports-color"
:
{
"version"
:
"7.2.0"
,
"resolved"
:
"https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz"
,
"integrity"
:
"sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"has-flag"
:
"^4.0.0"
}
}
}
},
"vue-style-loader"
:
{
"version"
:
"4.1.3"
,
"resolved"
:
"https://registry.npm.taobao.org/vue-style-loader/download/vue-style-loader-4.1.3.tgz?cache=0&sync_timestamp=1614758652197&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fvue-style-loader%2Fdownload%2Fvue-style-loader-4.1.3.tgz"
,
...
...
src/common/api/index.js
View file @
aebe688a
...
...
@@ -9,6 +9,8 @@ import { orderApiFun } from "@/common/api/order.js";
import
{
assessmentApiFun
}
from
"@/common/api/assessment.js"
import
{
certApiFun
}
from
"@/common/api/cert.js"
import
{
partsApiFun
}
from
"@/common/api/parts.js"
import
{
receivedApiFun
}
from
"@/common/api/mine/received.js"
import
{
inventoryApiFun
}
from
"@/common/api/mine/inventory.js"
let
apiFun
=
function
(
vm
)
{
let
commonApi
=
commonApiFun
(
vm
);
let
settledApi
=
settledApiFun
(
vm
)
...
...
@@ -17,6 +19,8 @@ let apiFun = function(vm) {
let
orderApi
=
orderApiFun
(
vm
)
let
certApi
=
certApiFun
(
vm
)
let
partsApi
=
partsApiFun
(
vm
)
let
receivedApi
=
receivedApiFun
(
vm
)
let
inventoryApi
=
inventoryApiFun
(
vm
)
let
apiUrl
=
{
...
commonApi
,
...
settledApi
,
...
...
@@ -25,6 +29,8 @@ let apiFun = function(vm) {
...
assessmentApi
,
...
certApi
,
...
partsApi
,
...
receivedApi
,
...
inventoryApi
,
}
return
apiUrl
}
...
...
src/common/api/mine/inventory.js
0 → 100644
View file @
aebe688a
import
util
from
'@/utils/util.js'
const
jsonType
=
{
'content-type'
:
'application/json'
}
const
formType
=
{
'content-type'
:
'application/x-www-form-urlencoded'
}
const
dataType
=
{
'content-type'
:
'multipart/form-data'
}
let
inventoryApiFun
=
function
(
vm
){
// 接口公共前缀
let
parts
=
"/wxh-worker-rest/rest/parts/"
//收货 inventory 模块
/**
* 收货列表
*/
let
inventoryListByInventoryModules
=
async
(
params
=
{})
=>
await
vm
.
$u
.
get
(
parts
+
vm
.
vuex_token
+
'/take/stock/take/stock'
,
params
);
/**
* 收货单详情
*/
let
inventoryDetailByInventoryModules
=
async
(
params
=
{})
=>
await
vm
.
$u
.
get
(
parts
+
vm
.
vuex_token
+
'/take/stock/sign/detail/'
+
params
);
/**
* 确认收货
*/
let
addInventoryByInventoryModules
=
async
(
params
=
{})
=>
await
vm
.
$u
.
post
(
parts
+
vm
.
vuex_token
+
'/take/stock/detail/add'
,
params
,
formType
);
const
inventoryApi
=
{
inventoryListByInventoryModules
,
inventoryDetailByInventoryModules
,
addInventoryByInventoryModules
,
}
return
inventoryApi
}
module
.
exports
=
{
inventoryApiFun
}
src/common/api/mine/received.js
0 → 100644
View file @
aebe688a
import
util
from
'@/utils/util.js'
const
jsonType
=
{
'content-type'
:
'application/json'
}
const
formType
=
{
'content-type'
:
'application/x-www-form-urlencoded'
}
const
dataType
=
{
'content-type'
:
'multipart/form-data'
}
let
receivedApiFun
=
function
(
vm
){
// 接口公共前缀
let
parts
=
"/wxh-worker-rest/rest/parts/"
//收货 received 模块
/**
* 品牌列表 参数固定
*/
let
brandListByReceivedModules
=
async
(
params
=
{})
=>
await
vm
.
$u
.
get
(
parts
+
vm
.
vuex_token
+
'/type/threeLevel/1100000216/1'
,
params
);
/**
* 收货列表
*/
let
receiveListByReceivedModules
=
async
(
params
=
{})
=>
await
vm
.
$u
.
get
(
parts
+
vm
.
vuex_token
+
'/take/stock/sign/list'
,
params
);
/**
* 收货单详情
*/
let
receiveDetailByReceivedModules
=
async
(
params
=
{})
=>
await
vm
.
$u
.
get
(
parts
+
vm
.
vuex_token
+
'/take/stock/sign/detail/'
+
params
);
/**
* 确认收货
*/
let
addReceiveByReceivedModules
=
async
(
params
=
{})
=>
await
vm
.
$u
.
post
(
parts
+
vm
.
vuex_token
+
'/take/stock/sign/create'
,
params
,
formType
);
const
receivedApi
=
{
brandListByReceivedModules
,
receiveListByReceivedModules
,
receiveDetailByReceivedModules
,
addReceiveByReceivedModules
,
}
return
receivedApi
}
module
.
exports
=
{
receivedApiFun
}
src/common/common.js
0 → 100644
View file @
aebe688a
// 自定义filter
export
function
myFilter
(
value
,
options
,
key
=
"label"
)
{
if
(
options
&&
options
instanceof
Array
)
{
let
arr
=
options
.
filter
(
item
=>
item
.
value
===
value
)
if
(
arr
.
length
)
{
return
arr
[
0
]
&&
arr
[
0
][
key
]
}
else
{
return
value
}
}
else
{
return
value
}
}
// showToast
export
function
showToast
(
title
,
mask
=
true
)
{
uni
.
showToast
({
title
,
icon
:
'none'
,
mask
,
duration
:
2000
})
}
let
localtionshowModal
=
null
export
function
showModal
({
content
=
"是否执行?"
,
showCancel
=
true
,
success
,
fail
})
{
if
(
localtionshowModal
)
{
return
false
;
}
localtionshowModal
=
setTimeout
(()
=>
{
uni
.
showModal
({
content
:
content
,
confirmText
:
'确认'
,
cancelText
:
'取消'
,
showCancel
:
showCancel
,
success
,
complete
:
()
=>
{
clearTimeout
(
localtionshowModal
);
localtionshowModal
=
null
;
}
});
},
1
);
}
\ No newline at end of file
src/common/optinos/mine/received.js
0 → 100644
View file @
aebe688a
export
const
receiveStatusOptions
=
[{
name
:
'未使用'
,
value
:
0
},
{
name
:
'已使用'
,
value
:
1
}
]
src/components/createCom/XhScan.vue
View file @
aebe688a
...
...
@@ -2,7 +2,10 @@
<
template
>
<view
class=
""
>
<view
class=
"u-flex"
@
click=
"scanCode"
>
<view
class=
"txt u-flex-1"
>
扫描二维码(仅挚达充电桩可扫描)
</view>
<view
class=
"txt u-flex-1"
>
<text
v-if=
"item.fieldsTitle==='充电桩箱体二维码'"
>
扫描二维码
</text>
<text
v-else
>
扫描二维码(仅挚达充电桩可扫描)
</text>
</view>
<u-icon
name=
"arrow-right"
color=
"#666"
size=
"28"
></u-icon>
</view>
<view
class=
"u-flex"
>
...
...
src/components/createCom/stringMixin.js
View file @
aebe688a
...
...
@@ -50,6 +50,7 @@ export default {
itemIndex
:
this
.
itemIndex
,
//右侧某一项下标
value
:
val
,
}
console
.
log
(
data
)
this
.
$emit
(
'value-change'
,
data
)
},
},
...
...
src/components/mine/fixed-button.vue
0 → 100644
View file @
aebe688a
<
template
>
<!-- 底部按钮 -->
<view
class=
"fixed-button"
><xh-button
@
handleClick=
"handleClick"
:text=
"text"
></xh-button></view>
</
template
>
<
script
>
import
XhButton
from
"./xh-button.vue"
export
default
{
name
:
"FixedButton"
,
components
:{
XhButton
},
props
:{
text
:{
type
:
String
,
default
:
"提交"
}
},
data
()
{
return
{
buttonStyle
:
{
width
:
'100%'
,
height
:
'80rpx'
,
fontSize
:
'32rpx'
,
fontWeight
:
'bold'
}
};
},
methods
:{
handleClick
(){
this
.
$emit
(
"handleClick"
)
}
}
};
</
script
>
<
style
lang=
"scss"
scoped
>
.fixed-button
{
width
:
100%
;
box-sizing
:
border-box
;
position
:
fixed
;
left
:
0
;
padding
:
0
30rpx
;
padding-bottom
:
constant
(
safe-area-inset-bottom
);
/*
兼容
iOS
<
11
.
2
*/
padding-bottom
:
env
(
safe-area-inset-bottom
);
/* 兼容 iOS >= 11.2 */
bottom
:
20rpx
;
}
</
style
>
src/components/mine/xh-button.vue
0 → 100644
View file @
aebe688a
<
template
>
<u-button
class=
"settle-button"
type=
"primary"
shape=
"circle"
@
click=
"handleClick"
:custom-style=
"buttonStyle"
>
{{
text
}}
</u-button>
</
template
>
<
script
>
export
default
{
name
:
'XhButton'
,
props
:
{
text
:
{
type
:
String
,
default
:
'提交'
}
},
data
()
{
return
{
buttonStyle
:
{
width
:
'100%'
,
height
:
'80rpx'
,
fontSize
:
'32rpx'
,
fontWeight
:
'bold'
}
};
},
methods
:
{
handleClick
()
{
this
.
$emit
(
'handleClick'
);
}
}
};
</
script
>
<
style
lang=
"scss"
></
style
>
src/pages.json
View file @
aebe688a
...
...
@@ -5,8 +5,7 @@
"^u-(.*)"
:
"@/uview-ui/components/u-$1/u-$1.vue"
}
},
"pages"
:
[
{
"pages"
:
[{
"path"
:
"pages/index/index"
,
"style"
:
{
"navigationBarTitleText"
:
"首页"
,
...
...
@@ -42,16 +41,14 @@
"path"
:
"pages/login/index"
,
"style"
:
{
//
"navigationBarTitleText"
:
"授权登录"
,
"navigationBarBackgroundColor"
:
"#FFFFFF"
,
"navigationBarBackgroundColor"
:
"#FFFFFF"
,
"disableScroll"
:
true
}
}
],
"subPackages"
:
[
{
"subPackages"
:
[{
"root"
:
"pages/exam"
,
"pages"
:
[
{
"pages"
:
[{
"path"
:
"start"
,
"style"
:
{
"navigationBarTitleText"
:
"考试"
...
...
@@ -69,8 +66,7 @@
},
{
"root"
:
"pages/learn"
,
"pages"
:
[
{
"pages"
:
[{
"path"
:
"assessment"
,
"style"
:
{
"navigationBarTitleText"
:
"认证介绍"
,
...
...
@@ -143,8 +139,7 @@
},
{
"root"
:
"pages/mine"
,
"pages"
:
[
{
"pages"
:
[{
"path"
:
"address/index"
,
"style"
:
{
"navigationBarTitleText"
:
"收获地址"
,
...
...
@@ -344,7 +339,7 @@
"path"
:
"warehouse/searchParts"
,
"style"
:
{
"navigationStyle"
:
"custom"
,
"navigationBarTitleText"
:
" "
,
"navigationBarTitleText"
:
" "
,
"enablePullDownRefresh"
:
false
,
"navigationBarBackgroundColor"
:
"#F4F5F7"
,
"disableScroll"
:
true
...
...
@@ -354,7 +349,7 @@
"path"
:
"warehouse/express"
,
"style"
:
{
"navigationStyle"
:
"custom"
,
"navigationBarTitleText"
:
" "
,
"navigationBarTitleText"
:
" "
,
"enablePullDownRefresh"
:
false
,
"navigationBarBackgroundColor"
:
"#F4F5F7"
,
"disableScroll"
:
true
...
...
@@ -378,6 +373,25 @@
"disableScroll"
:
true
}
},
{
"path"
:
"warehouse/inventory"
,
"style"
:
{
"navigationStyle"
:
"custom"
,
"navigationBarTitleText"
:
"盘点"
,
"enablePullDownRefresh"
:
false
,
"disableScroll"
:
true
}
},
{
"path"
:
"warehouse/received"
,
"style"
:
{
"navigationStyle"
:
"custom"
,
"navigationBarTitleText"
:
"充电桩收货"
,
"enablePullDownRefresh"
:
false
}
},
{
"path"
:
"superLogin/index"
,
"style"
:
{
...
...
@@ -393,12 +407,32 @@
"disableScroll"
:
true
}
}
]
,{
"path"
:
"warehouse/receiveDetail"
,
"style"
:
{
"navigationStyle"
:
"custom"
,
"navigationBarTitleText"
:
"收货"
,
"enablePullDownRefresh"
:
false
}
}
,{
"path"
:
"warehouse/inventoryDetail"
,
"style"
:
{
"navigationStyle"
:
"custom"
,
"navigationBarTitleText"
:
"盘点"
,
"enablePullDownRefresh"
:
false
}
}
]
},
{
"root"
:
"pages/order"
,
"pages"
:
[
{
"pages"
:
[{
"path"
:
"complete"
,
"style"
:
{
"navigationBarTitleText"
:
"订单完工"
,
...
...
@@ -495,8 +529,7 @@
},
{
"root"
:
"pages/photo"
,
"pages"
:
[
{
"pages"
:
[{
"path"
:
"index"
,
"style"
:
{
"navigationBarTitleText"
:
"拍照小工具"
,
...
...
@@ -545,8 +578,7 @@
},
{
"root"
:
"pages/settle"
,
"pages"
:
[
{
"pages"
:
[{
"path"
:
"index"
,
"style"
:
{
"navigationBarTitleText"
:
"入驻"
,
...
...
@@ -611,10 +643,9 @@
]
},
{
"root"
:
"pages/parts"
,
"pages"
:[
{
"path"
:
"application"
,
"root"
:
"pages/parts"
,
"pages"
:
[{
"path"
:
"application"
,
"style"
:
{
"navigationBarTitleText"
:
"物料申请"
,
"navigationStyle"
:
"custom"
,
...
...
@@ -622,7 +653,7 @@
}
},
{
"path"
:
"address"
,
"path"
:
"address"
,
"style"
:
{
"navigationBarTitleText"
:
"收货地址"
,
"enablePullDownRefresh"
:
false
,
...
...
@@ -636,26 +667,22 @@
"navigationBarTitleText"
:
"物料选择"
,
"disableScroll"
:
true
}
}
,{
"path"
:
"nodes"
,
"style"
:
{
},
{
"path"
:
"nodes"
,
"style"
:
{
"navigationBarTitleText"
:
"物料申请、返件成功"
,
"navigationStyle"
:
"custom"
,
"navigationStyle"
:
"custom"
,
"enablePullDownRefresh"
:
false
}
}
,{
"path"
:
"returnParts"
,
"style"
:
{
},
{
"path"
:
"returnParts"
,
"style"
:
{
"navigationBarTitleText"
:
"退件"
,
"navigationStyle"
:
"custom"
,
"navigationStyle"
:
"custom"
,
"enablePullDownRefresh"
:
false
}
}
]
}
]
}
],
"preloadRule"
:
{
...
...
@@ -682,8 +709,7 @@
"selectedColor"
:
"#007AFF"
,
"borderStyle"
:
"white"
,
"backgroundColor"
:
"#FFFFFF"
,
"list"
:
[
{
"list"
:
[{
"pagePath"
:
"pages/index/index"
,
"iconPath"
:
"static/tab/shouye-0@3x.png"
,
"selectedIconPath"
:
"static/tab/shouye-1@3x.png"
,
...
...
@@ -711,8 +737,7 @@
},
"condition"
:
{
"current"
:
0
,
"list"
:
[
{
"list"
:
[{
"name"
:
"拍照小工具"
,
"path"
:
"pages/photo/index"
,
"query"
:
{}
...
...
@@ -724,4 +749,4 @@
}
]
}
}
\ No newline at end of file
}
src/pages/index/index.vue
View file @
aebe688a
...
...
@@ -139,8 +139,8 @@ export default {
return
{
status
:
0
,
// 入驻状态:0=>'待提交',1=>'待审核',2=>'已通过',3=>'备选',4=>'已驳回',6=>'已签约',7=>'已支付保证金',8=>'已通过考试',9=>'待提交'
location
:
[],
// 经纬度
title
:
false
,
title
:
'Hello'
,
//
title: false,
//
title: 'Hello',
loaded
:
false
,
loadedOrder
:
false
,
needSettled
:
false
,
...
...
src/pages/index/mine.vue
View file @
aebe688a
<
template
>
<view
class=
"mine-view"
>
<image
class=
"header-image"
mode=
"widthFix"
:src=
"wodebeijingImage"
></image>
<u-navbar
:is-back=
"false"
:background=
"
{ background: 'transparent' }" :border-bottom="false">
<text
class=
"title-view"
>
我的
</text>
</u-navbar>
<u-navbar
:is-back=
"false"
:background=
"
{ background: 'transparent' }" :border-bottom="false">
<text
class=
"title-view"
>
我的
</text></u-navbar>
<view
class=
"header-view"
>
<view
class=
"header-left-view"
>
<view
class=
"head-image"
>
<image
:style=
"headImageStyle"
:src=
"headImageUrl"
></image>
</view>
<view
class=
"header-content"
>
<view
class=
"name-view"
@
click=
"handleClickName"
>
{{
name
||
"点击登录"
}}
</view>
<view
:class=
"['tel-view',
{'active': mobile}]" @click="$u.throttle(handleClickTel, 500)">
<text>
{{
telTip
}}
</text>
<u-icon
class=
"tel-arrow-icon"
name=
"arrow-up-fill"
></u-icon>
</view>
<view
class=
"header-left-view"
>
<view
class=
"head-image"
><image
:style=
"headImageStyle"
:src=
"headImageUrl"
></image></view>
<view
class=
"header-content"
>
<view
class=
"name-view"
@
click=
"handleClickName"
>
{{
name
||
'点击登录'
}}
</view>
<view
:class=
"['tel-view',
{ active: mobile }]" @click="$u.throttle(handleClickTel, 500)">
<text>
{{
telTip
}}
</text>
<u-icon
class=
"tel-arrow-icon"
name=
"arrow-up-fill"
></u-icon>
</view>
</view>
<view
class=
"header-right-view"
@
click=
"$u.throttle(handleClickSetting, 500)"
>
<view
class=
"setting-view"
>
<image
:src=
"shezhiImage"
class=
"right-image-view"
></image>
<text>
设置
</text>
</view>
<view
v-if=
"isSuperuser"
class=
"super-button"
><u-button
@
click=
"handleSuperButton"
>
切换用户
</u-button></view>
</view>
<view
class=
"header-right-view"
@
click=
"$u.throttle(handleClickSetting, 500)"
>
<view
class=
"setting-view"
>
<image
:src=
"shezhiImage"
class=
"right-image-view"
></image>
<text>
设置
</text>
</view>
<view
v-if=
"isSuperuser"
class=
"super-button"
><u-button
@
click=
"handleSuperButton"
>
切换用户
</u-button></view>
</view>
</view>
<view
class=
"mine-content"
>
<view
class=
"ware-house-view"
>
<view
class=
"ware-house-title"
>
仓配功能
</view>
<view
class=
"ware-house-title"
>
<text
class=
"ware-house-title-text"
>
仓配功能
</text>
<view
class=
"ware-house-title-received"
hover-class=
"u-hover-class"
@
click=
"handleClick('warehouse/received', true)"
>
<text>
充电桩收货
</text>
<u-icon
name=
"arrow-right"
></u-icon>
</view>
</view>
<view
class=
"ware-house-content"
>
<view
v-for=
"(item, index) in warehouseItems"
:key=
"index"
class=
"ware-house-content-item"
@
click=
"handleClick(item.pathName, true)"
hover-class=
"u-hover-class"
>
<view
class=
"ware-house-image"
>
<image
:src=
"item.icon"
:style=
"item.imageStyle"
></image>
</view>
<view>
{{
item
.
title
}}
</view>
<view
v-for=
"(item, index) in warehouseItems"
:key=
"index"
class=
"ware-house-content-item"
@
click=
"handleClick(item.pathName, true)"
hover-class=
"u-hover-class"
>
<view
class=
"ware-house-image"
><image
:src=
"item.icon"
:style=
"item.imageStyle"
></image></view>
<view>
{{
item
.
title
}}
</view>
</view>
</view>
</view>
<view
class=
"list-view"
>
<view
v-for=
"(group, ind) in items"
:key=
"ind"
class=
"group-view"
>
<u-cell-group
:border=
"false"
>
<view
v-for=
"(item, index) in group"
:key=
"index"
>
<u-cell-item
:value=
"item.value"
:border-bottom=
"false"
@
click=
"handleClick(item.pathName, false)"
>
<image
slot=
"icon"
:src=
"qnFile(item.icon)"
:style=
"item.imageStyle"
></image>
<view
slot=
"title"
class=
"item-title"
>
{{
item
.
title
}}
</view>
<view
slot=
"value"
class=
"item-value"
>
{{
value
}}
</view>
</u-cell-item>
</view>
</u-cell-group>
<u-cell-group
:border=
"false"
>
<view
v-for=
"(item, index) in group"
:key=
"index"
>
<u-cell-item
:value=
"item.value"
:border-bottom=
"false"
@
click=
"handleClick(item.pathName, false)"
>
<image
slot=
"icon"
:src=
"qnFile(item.icon)"
:style=
"item.imageStyle"
></image>
<view
slot=
"title"
class=
"item-title"
>
{{
item
.
title
}}
</view>
<view
slot=
"value"
class=
"item-value"
>
{{
value
}}
</view>
</u-cell-item>
</view>
</u-cell-group>
</view>
</view>
</view>
<u-modal
v-model=
"show"
:content=
"content"
show-cancel-button
@
confirm=
"logout"
></u-modal>
<view>
<u-toast
ref=
"uToast"
/>
</view>
<MaskTip
:show=
"showMask"
imageName=
"mengceng4.png"
:imageStyle=
"imageStyle"
name=
"order_tip"
@
click=
"showMask1 = true"
/>
<MaskTip
:show=
"showMask1"
imageName=
"mengceng3.png"
:imageStyle=
"imageStyle1"
name=
"history_tip"
:timeout=
"false"
/>
<view><u-toast
ref=
"uToast"
/></view>
<MaskTip
:show=
"showMask"
imageName=
"mengceng4.png"
:imageStyle=
"imageStyle"
name=
"order_tip"
@
click=
"showMask1 = true"
/>
<MaskTip
:show=
"showMask1"
imageName=
"mengceng3.png"
:imageStyle=
"imageStyle1"
name=
"history_tip"
:timeout=
"false"
/>
</view>
</
template
>
<
script
>
import
login
from
"@/utils/login.js"
;
import
MaskTip
from
'@/components/mask-tip/index.vue'
import
login
from
'@/utils/login.js'
;
import
MaskTip
from
'@/components/mask-tip/index.vue'
;
const
app
=
getApp
();
export
default
{
components
:
{
MaskTip
const
app
=
getApp
();
export
default
{
components
:
{
MaskTip
},
data
()
{
return
{
serviceTel
:
'18124099271'
,
// showSuperButton: false,
show
:
false
,
content
:
'是否确认退出该账户?'
,
wodebeijingImage
:
''
,
placeholderImage
:
''
,
needSettled
:
true
,
// 需要入驻
showMask
:
false
,
showMask1
:
false
};
},
computed
:
{
settled
()
{
return
(
this
.
vuex_token
&&
this
.
vuex_settled
&&
this
.
vuex_settled
.
record
)
||
null
;
},
data
()
{
return
{
serviceTel
:
'18124099271'
,
// showSuperButton: false,
show
:
false
,
content
:
'是否确认退出该账户?'
,
wodebeijingImage
:
''
,
placeholderImage
:
''
,
needSettled
:
true
,
// 需要入驻
showMask
:
false
,
showMask1
:
false
,
}
avatar
()
{
return
this
.
vuex_settled
&&
this
.
vuex_settled
.
avatar
;
},
computed
:
{
settled
()
{
return
this
.
vuex_token
&&
this
.
vuex_settled
&&
this
.
vuex_settled
.
record
||
null
},
avatar
()
{
return
this
.
vuex_settled
&&
this
.
vuex_settled
.
avatar
},
name
()
{
return
(
this
.
settled
&&
this
.
settled
.
nickname
)
||
(
this
.
vuex_user
&&
(
this
.
vuex_user
.
name
||
this
.
vuex_user
.
loginName
))
},
mobile
()
{
return
(
this
.
settled
&&
this
.
settled
.
mobile
)
||
(
this
.
vuex_user
&&
this
.
vuex_user
.
mobile
)
},
items
()
{
return
[
[{
name
()
{
return
(
this
.
settled
&&
this
.
settled
.
nickname
)
||
(
this
.
vuex_user
&&
(
this
.
vuex_user
.
name
||
this
.
vuex_user
.
loginName
));
},
mobile
()
{
return
(
this
.
settled
&&
this
.
settled
.
mobile
)
||
(
this
.
vuex_user
&&
this
.
vuex_user
.
mobile
);
},
items
()
{
return
[
[
{
pathName
:
'order/index'
,
title
:
'订单管理'
,
value
:
''
,
icon
:
'dingdanguanli.png'
,
imageStyle
:
'width:34rpx;height:32rpx'
},{
},
{
pathName
:
'wallet/index'
,
title
:
'我的钱包'
,
value
:
''
,
...
...
@@ -144,9 +137,9 @@
value
:
''
,
icon
:
'liulanjilu.png'
,
imageStyle
:
'width:34rpx;height:32rpx'
}
,
],
[
}
],
[
// {
// pathName: 'address/index',
// title: '收货地址',
...
...
@@ -160,337 +153,356 @@
value
:
this
.
serviceTel
,
icon
:
'lxkefu.png'
,
imageStyle
:
'width:32rpx;height:32rpx'
}
]
}
]
},
warehouseItems
()
{
return
[
{
pathName
:
'warehouse/index'
,
title
:
'物料订单'
,
value
:
''
,
icon
:
process
.
uniEnv
.
qn_base_url
+
'wodepeijian.png'
,
imageStyle
:
'width:60rpx;height:54rpx'
},
{
pathName
:
'warehouse/spare'
,
title
:
'物料库'
,
value
:
''
,
icon
:
process
.
uniEnv
.
qn_base_url
+
'wodebeijian.png'
,
imageStyle
:
'width:60rpx;height:54rpx'
},
{
pathName
:
'warehouse/return'
,
title
:
'返件信息'
,
value
:
''
,
icon
:
process
.
uniEnv
.
qn_base_url
+
'fanjianxinxi.png'
,
imageStyle
:
'width:56rpx;height:54rpx'
},
{
pathName
:
'warehouse/records'
,
title
:
'出库记录'
,
value
:
''
,
icon
:
process
.
uniEnv
.
qn_base_url
+
'churuku.png'
,
imageStyle
:
'width:50rpx;height:54rpx'
},
]
},
telTip
()
{
return
this
.
mobile
||
'绑定手机号'
},
headImageUrl
()
{
return
this
.
avatar
||
this
.
placeholderImage
},
headImageStyle
()
{
return
this
.
avatar
?
'width:112rpx; height:112rpx;border-radius:56rpx'
:
'width:120rpx; height:120rpx;border-radius:60rpx'
},
headSize
()
{
return
this
.
avatar
?
112
:
120
},
shezhiImage
()
{
return
process
.
uniEnv
.
qn_base_url
+
'shezhi.png'
},
liulanjilumage
()
{
return
process
.
uniEnv
.
qn_base_url
+
'liulanjilu.png'
},
wodeziliaoImage
()
{
return
process
.
uniEnv
.
qn_base_url
+
'wodeziliao.png'
},
isSuperuser
()
{
return
this
.
vuex_superuser
},
imageStyle
()
{
return
'width:602rpx; margin-top:560rpx; margin-left:28rpx'
},
imageStyle1
()
{
return
'width:596rpx; margin-top:736rpx; margin-left:28rpx'
}
];
},
watch
:
{
vuex_token
(
val
,
oldVal
)
{
if
(
val
&&
!
this
.
isSuperuser
)
{
this
.
allowLogin
()
warehouseItems
()
{
return
[
{
pathName
:
'warehouse/index'
,
title
:
'物料订单'
,
value
:
''
,
icon
:
process
.
uniEnv
.
qn_base_url
+
'wodepeijian.png'
,
imageStyle
:
'width:60rpx;height:54rpx'
},
{
pathName
:
'warehouse/spare'
,
title
:
'物料库'
,
value
:
''
,
icon
:
process
.
uniEnv
.
qn_base_url
+
'wodebeijian.png'
,
imageStyle
:
'width:60rpx;height:54rpx'
},
{
pathName
:
'warehouse/return'
,
title
:
'返件信息'
,
value
:
''
,
icon
:
process
.
uniEnv
.
qn_base_url
+
'fanjianxinxi.png'
,
imageStyle
:
'width:56rpx;height:54rpx'
},
{
pathName
:
'warehouse/records'
,
title
:
'出库记录'
,
value
:
''
,
icon
:
process
.
uniEnv
.
qn_base_url
+
'churuku.png'
,
imageStyle
:
'width:50rpx;height:54rpx'
},
{
pathName
:
'warehouse/inventory'
,
title
:
'盘点'
,
value
:
''
,
icon
:
process
.
uniEnv
.
qn_base_url
+
'pandiantubiao@2x.png'
,
imageStyle
:
'width:54rpx;height:54rpx'
}
},
];
},
onLoad
()
{
app
.
trackPage
(
'我的首页'
)
if
(
this
.
vuex_token
)
{
if
(
!
this
.
isSuperuser
)
{
this
.
allowLogin
()
}
if
(
!
this
.
settled
)
{
this
.
getData
()
}
telTip
()
{
return
this
.
mobile
||
'绑定手机号'
;
},
headImageUrl
()
{
return
this
.
avatar
||
this
.
placeholderImage
;
},
headImageStyle
()
{
return
this
.
avatar
?
'width:112rpx; height:112rpx;border-radius:56rpx'
:
'width:120rpx; height:120rpx;border-radius:60rpx'
;
},
headSize
()
{
return
this
.
avatar
?
112
:
120
;
},
shezhiImage
()
{
return
process
.
uniEnv
.
qn_base_url
+
'shezhi.png'
;
},
liulanjilumage
()
{
return
process
.
uniEnv
.
qn_base_url
+
'liulanjilu.png'
;
},
wodeziliaoImage
()
{
return
process
.
uniEnv
.
qn_base_url
+
'wodeziliao.png'
;
},
isSuperuser
()
{
return
this
.
vuex_superuser
;
},
imageStyle
()
{
return
'width:602rpx; margin-top:560rpx; margin-left:28rpx'
;
},
imageStyle1
()
{
return
'width:596rpx; margin-top:736rpx; margin-left:28rpx'
;
}
},
watch
:
{
vuex_token
(
val
,
oldVal
)
{
if
(
val
&&
!
this
.
isSuperuser
)
{
this
.
allowLogin
();
}
this
.
wodebeijingImage
=
this
.
qnFile
(
'wodebeijing-jb.png'
)
this
.
placeholderImage
=
this
.
qnFile
(
'touxiang.png'
)
this
.
showMaskTip
()
}
},
onLoad
()
{
app
.
trackPage
(
'我的首页'
);
if
(
this
.
vuex_token
)
{
if
(
!
this
.
isSuperuser
)
{
this
.
allowLogin
();
}
if
(
!
this
.
settled
)
{
this
.
getData
();
}
}
this
.
wodebeijingImage
=
this
.
qnFile
(
'wodebeijing-jb.png'
);
this
.
placeholderImage
=
this
.
qnFile
(
'touxiang.png'
);
this
.
showMaskTip
();
},
onShow
()
{
// 更新是否需要入住
if
(
!
this
.
needSettled
)
return
;
this
.
$u
.
api
.
getSettleBaseInfo
().
then
(
res
=>
{
this
.
needSettled
=
res
.
data
.
needSettled
;
});
},
methods
:
{
qnFile
(
src
)
{
return
process
.
uniEnv
.
qn_base_url
+
src
;
},
onShow
()
{
// 更新是否需要入住
if
(
!
this
.
needSettled
)
return
this
.
$u
.
api
.
getSettleBaseInfo
().
then
((
res
)
=>
{
this
.
needSettled
=
res
.
data
?.
needSettled
})
getData
()
{
let
self
=
this
;
app
.
getBaseInfo
(
self
);
},
methods
:
{
qnFile
(
src
)
{
return
process
.
uniEnv
.
qn_base_url
+
src
},
getData
()
{
let
self
=
this
app
.
getBaseInfo
(
self
);
},
handleClick
(
path
,
isWarehouse
)
{
if
(
this
.
vuex_token
)
{
// 没入驻不能进入仓配相关页面
if
(
isWarehouse
&&
this
.
needSettled
)
{
this
.
$refs
.
uToast
.
show
({
title
:
'请先在首页入驻'
,
type
:
'warning'
,
duration
:
1500
,
})
return
}
this
.
$u
.
route
({
url
:
'pages/mine/'
+
path
})
}
else
{
this
.
$u
.
route
({
url
:
"pages/login/index"
})
}
},
handleClickSetting
()
{
this
.
$u
.
route
({
url
:
'pages/mine/setting/index'
})
},
handleClickName
()
{
if
(
this
.
vuex_token
&&
this
.
settled
)
{
return
false
}
this
.
$u
.
route
({
url
:
"pages/login/index"
})
},
handleClickTel
()
{
if
(
this
.
vuex_token
&&
this
.
settled
&&
this
.
mobile
)
{
this
.
show
=
true
return
false
handleClick
(
path
,
isWarehouse
)
{
this
.
$u
.
route
({
url
:
'pages/mine/'
+
path
});
if
(
this
.
vuex_token
)
{
// 没入驻不能进入仓配相关页面
if
(
isWarehouse
&&
this
.
needSettled
)
{
this
.
$refs
.
uToast
.
show
({
title
:
'请先在首页入驻'
,
type
:
'warning'
,
duration
:
1500
});
return
;
}
this
.
$u
.
route
({
url
:
"pages/login/index"
})
},
logout
()
{
login
.
setUserData
({},
this
);
app
.
globalData
.
logout
=
true
},
async
allowLogin
()
{
// 超级用户,显示登录按钮
let
res
=
await
this
.
$u
.
api
.
allowLogin
()
if
(
res
&&
res
.
code
==
200
)
{
this
.
$u
.
vuex
(
'vuex_superuser'
,
res
.
data
);
}
},
handleSuperButton
()
{
if
(
this
.
vuex_token
)
{
this
.
$u
.
route
({
url
:
'pages/mine/superLogin/index'
})
}
else
{
this
.
$u
.
route
({
url
:
"pages/login/index"
})
}
},
// 显示提示蒙版
showMaskTip
()
{
this
.
showMask
=
true
},
this
.
$u
.
route
({
url
:
'pages/mine/'
+
path
});
}
else
{
this
.
$u
.
route
({
url
:
'pages/login/index'
});
}
},
handleClickSetting
()
{
this
.
$u
.
route
({
url
:
'pages/mine/setting/index'
});
},
handleClickName
()
{
if
(
this
.
vuex_token
&&
this
.
settled
)
{
return
false
;
}
this
.
$u
.
route
({
url
:
'pages/login/index'
});
},
handleClickTel
()
{
if
(
this
.
vuex_token
&&
this
.
settled
&&
this
.
mobile
)
{
this
.
show
=
true
;
return
false
;
}
this
.
$u
.
route
({
url
:
'pages/login/index'
});
},
logout
()
{
login
.
setUserData
({},
this
);
app
.
globalData
.
logout
=
true
;
},
async
allowLogin
()
{
// 超级用户,显示登录按钮
let
res
=
await
this
.
$u
.
api
.
allowLogin
();
if
(
res
&&
res
.
code
==
200
)
{
this
.
$u
.
vuex
(
'vuex_superuser'
,
res
.
data
);
}
},
handleSuperButton
()
{
if
(
this
.
vuex_token
)
{
this
.
$u
.
route
({
url
:
'pages/mine/superLogin/index'
});
}
else
{
this
.
$u
.
route
({
url
:
'pages/login/index'
});
}
},
// 显示提示蒙版
showMaskTip
()
{
this
.
showMask
=
true
;
}
}
};
</
script
>
<
style
lang=
"scss"
scoped
>
.mine-view
{
position
:
relative
;
height
:
100vh
;
display
:
flex
;
background-color
:
#F4F5F
7
;
flex-direction
:
column
;
.header-image
{
position
:
absolute
;
width
:
100%
;
}
.mine-view
{
position
:
relative
;
height
:
100vh
;
display
:
flex
;
background-color
:
#f4f5f
7
;
flex-direction
:
column
;
.header-image
{
position
:
absolute
;
width
:
100%
;
}
.title-view
{
color
:
#ffffff
;
font-weight
:
bold
;
font-size
:
40rpx
;
padding-left
:
30rpx
;
}
.header-view
{
display
:
flex
;
align-items
:
flex-start
;
justify-content
:
space-between
;
// margin-bottom: 60rpx;
padding
:
26rpx
30rpx
60rpx
30rpx
;
.title-view
{
color
:
#FFFFFF
;
font-weight
:
bold
;
font-size
:
40rpx
;
padding-left
:
30rpx
;
}
.header-view
{
.header-left-view
{
display
:
flex
;
align-items
:
center
;
.head-image
{
z-index
:
1
;
width
:
120rpx
;
height
:
120rpx
;
background-color
:
#ffffff
;
border-radius
:
60rpx
;
display
:
flex
;
align-items
:
flex-start
;
justify-content
:
space-between
;
// margin-bottom: 60rpx;
padding
:
26rpx
30rpx
60rpx
30rpx
;
align-items
:
center
;
justify-content
:
center
;
}
.header-content
{
color
:
#ffffff
;
z-index
:
1
;
margin-left
:
24rpx
;
.name-view
{
font-size
:
40rpx
;
font-weight
:
bold
;
margin-bottom
:
6rpx
;
margin-top
:
-4rpx
;
}
.header-left-view
{
.tel-view
{
background-color
:
#ffffff
;
border-radius
:
26rpx
;
color
:
#2272ff
;
width
:
180rpx
;
height
:
52rpx
;
font-size
:
20rpx
;
display
:
flex
;
align-items
:
center
;
.head-image
{
z-index
:
1
;
width
:
120rpx
;
height
:
120rpx
;
background-color
:
#FFFFFF
;
border-radius
:
60rpx
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
}
.header-content
{
color
:
#FFFFFF
;
z-index
:
1
;
margin-left
:
24rpx
;
.name-view
{
font-size
:
40rpx
;
font-weight
:
bold
;
margin-bottom
:
6rpx
;
margin-top
:
-4rpx
;
}
.tel-view
{
background-color
:
#FFFFFF
;
border-radius
:
26rpx
;
color
:
#2272FF
;
width
:
180rpx
;
height
:
52rpx
;
font-size
:
20rpx
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
&
.active
{
color
:
#FFFFFF
;
border
:
2rpx
solid
#FFFFFF
;
background-color
:
#2272FF
;
}
.tel-arrow-icon
{
transform
:
rotate
(
90deg
);
margin-left
:
6rpx
;
}
}
justify-content
:
center
;
.tel-arrow-icon
{
transform
:
rotate
(
90deg
);
margin-left
:
6rpx
;
}
}
.header-right-view
{
z-index
:
1
;
.setting-view
{
display
:
flex
;
justify-content
:
flex-end
;
align-items
:
center
;
color
:
#FFFFFF
;
margin-right
:
4rpx
;
font-size
:
26rpx
;
margin-top
:
-24rpx
;
.right-image-view
{
width
:
34rpx
;
height
:
32rpx
;
margin-right
:
10rpx
;
}
}
.super-button
{
margin-top
:
20rpx
;
}
.active
{
color
:
#ffffff
;
border
:
2rpx
solid
#ffffff
;
background-color
:
#2272ff
;
}
}
}
.header-right-view
{
z-index
:
1
;
.setting-view
{
display
:
flex
;
justify-content
:
flex-end
;
align-items
:
center
;
color
:
#ffffff
;
margin-right
:
4rpx
;
font-size
:
26rpx
;
margin-top
:
-24rpx
;
.right-image-view
{
width
:
34rpx
;
height
:
32rpx
;
margin-right
:
10rpx
;
}
}
.mine-content
{
height
:
100%
;
overflow
:
auto
;
position
:
relative
;
padding-bottom
:
30rpx
;
margin
:
0rpx
30rpx
;
border-radius
:
12rpx
;
.ware-house-view
{
background-color
:
#FFFFFF
;
border-radius
:
12rpx
;
padding
:
30rpx
30rpx
40rpx
30rpx
;
height
:
240rpx
;
.ware-house-title
{
color
:
#333333
;
.super-button
{
margin-top
:
20rpx
;
}
}
}
.mine-content
{
height
:
100%
;
overflow
:
auto
;
position
:
relative
;
padding-bottom
:
30rpx
;
margin
:
0rpx
30rpx
;
border-radius
:
12rpx
;
.ware-house-view
{
background-color
:
#ffffff
;
border-radius
:
12rpx
;
padding
:
30rpx
30rpx
40rpx
30rpx
;
height
:
240rpx
;
.ware-house-title
{
color
:
#333333
;
font-size
:
32rpx
;
margin-bottom
:
30rpx
;
display
:
flex
;
justify-content
:
space-between
;
align-items
:
flex-end
;
.ware-house-title-text
{
font-weight
:
bold
;
font-size
:
32rpx
;
margin-bottom
:
30rpx
;
}
.ware-house-content
{
.ware-house-title-received
{
font-size
:
24rpx
;
color
:
#409eff
;
}
}
.ware-house-content
{
display
:
flex
;
justify-content
:
space-around
;
align-items
:
center
;
.ware-house-content-item
{
color
:
#333333
;
font-size
:
26rpx
;
display
:
flex
;
justify-content
:
space-around
;
justify-content
:
center
;
flex-direction
:
column
;
align-items
:
center
;
.ware-house-content-item
{
color
:
#333333
;
font-size
:
26rpx
;
.ware-house-image
{
width
:
60rpx
;
height
:
60rpx
;
margin-bottom
:
14rpx
;
display
:
flex
;
justify-content
:
center
;
flex-direction
:
column
;
align-items
:
center
;
.ware-house-image
{
width
:
60rpx
;
height
:
60rpx
;
margin-bottom
:
14rpx
;
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
}
}
}
}
}
.list-view
{
.group-view
{
margin-top
:
20rpx
;
background-color
:
#FFFFFF
;
border-radius
:
12rpx
;
overflow
:
hidden
;
.item-title
{
font-size
:
32rpx
;
color
:
#333333
;
margin-left
:
16rpx
;
line-height
:
32rpx
;
}
.item-value
{
font-size
:
26rpx
;
color
:
#999999
;
}
.line-view
{
height
:
2rpx
;
background-color
:
#F4F5F7
;
margin
:
30rpx
;
}
.list-view
{
.group-view
{
margin-top
:
20rpx
;
background-color
:
#ffffff
;
border-radius
:
12rpx
;
overflow
:
hidden
;
.item-title
{
font-size
:
32rpx
;
color
:
#333333
;
margin-left
:
16rpx
;
line-height
:
32rpx
;
}
.item-value
{
font-size
:
26rpx
;
color
:
#999999
;
}
.line-view
{
height
:
2rpx
;
background-color
:
#f4f5f7
;
margin
:
30rpx
;
}
}
}
}
.logout
{
padding
:
20rpx
;
}
</
style
>
}
.logout
{
padding
:
20rpx
;
}
</
style
>
src/pages/mine/warehouse/components/XhPickerSelect.vue
0 → 100644
View file @
aebe688a
<!-- ******************* 单个下拉选择 ******************* -->
<
template
>
<view
class=
"xh-select"
:style=
"
{ width: width }">
<view
class=
"u-flex u-row-between picker-common"
:class=
"
{ border: border }" :style="{ background: background }">
<picker
mode=
"selector"
:value=
"index"
:range-key=
"rangeKey"
:range=
"list"
@
click=
"onOpen"
@
change=
"pickerChange"
@
cancel=
"close"
class=
"u-flex-1"
:disabled=
"disabled"
>
<view
class=
"txt"
>
{{
text
||
placeholder
}}
</view>
</picker>
<u-icon
class=
"input-icon"
color=
"#2272FF"
:name=
"show ? 'arrow-up' : 'arrow-down'"
></u-icon>
</view>
</view>
</
template
>
<
script
>
export
default
{
name
:
'XhPickerSelect'
,
components
:
{},
props
:
{
value
:
{
type
:
[
Number
,
String
,
null
]
},
placeholder
:
{
type
:
String
,
default
:
'请选择'
},
width
:
{
// 例如:454rpx
type
:
String
,
default
:
'100%'
},
border
:
{
type
:
Boolean
,
default
:
false
},
background
:
{
type
:
String
},
list
:
{
type
:
Array
},
rangeKey
:
{
type
:
String
,
default
:
'label'
},
disabled
:
{
type
:
Boolean
,
default
:
false
}
},
data
()
{
return
{
show
:
false
,
index
:
''
,
dataValue
:
''
};
},
computed
:
{
text
()
{
let
option
=
this
.
list
.
find
((
a
,
i
)
=>
{
return
a
.
id
===
this
.
dataValue
;
});
return
option
?
option
[
this
.
rangeKey
]
:
''
;
},
placeholderStyle
()
{
return
'color:#999999;font-size:26rpx'
;
},
customStyle
()
{
return
{
'background-color'
:
'#F4F5F7'
,
'border-radius'
:
'12rpx'
,
color
:
'#333333'
,
'padding-left'
:
'20rpx'
,
'padding-right'
:
'60rpx'
,
width
:
this
.
width
,
'font-size'
:
'26rpx'
,
height
:
'76rpx'
};
}
},
watch
:
{
value
:
function
(
val
)
{
this
.
dataValue
=
val
;
}
},
mounted
()
{
/** 如果有值以传入值为主 如果无值 已默认值为主 */
this
.
dataValue
=
this
.
value
;
},
methods
:
{
onOpen
()
{
if
(
this
.
disabled
)
return
false
;
this
.
show
=
true
;
},
close
()
{
this
.
show
=
false
;
},
pickerChange
(
event
)
{
this
.
index
=
+
event
.
detail
.
value
;
let
params
=
this
.
list
[
this
.
index
];
this
.
dataValue
=
params
.
id
;
this
.
$emit
(
'change'
,
params
);
this
.
close
();
}
}
};
</
script
>
<
style
lang=
"scss"
scoped
>
.xh-select
{
position
:
relative
;
.input-icon
{
position
:
absolute
;
right
:
20rpx
;
top
:
50%
;
transform
:
translateY
(
-50%
);
color
:
#2272ff
;
}
}
.picker-common
{
min-height
:
34px
;
background-color
:
#ffffff
;
border-radius
:
6px
;
color
:
#333333
;
padding-left
:
10px
;
padding-right
:
50rpx
;
width
:
100%
;
height
:
36px
;
.u-flex-1
{
width
:
100%
;
.txt
{
font-size
:
14px
;
width
:
100%
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
white-space
:
nowrap
;
}
}
}
.border
{
border
:
2upx
solid
#eeeeee
;
}
</
style
>
src/pages/mine/warehouse/components/inventory/goodsCount.vue
0 → 100644
View file @
aebe688a
<
template
>
<view
class=
"goods-count"
>
<view
class=
"goods-count-item"
>
<view
class=
"goods-count-item-title"
>
充电桩库存量
</view>
<view
class=
"goods-count-item-count"
>
{{
inventoryCount
}}
</view>
</view>
<view
class=
"goods-count-line"
></view>
<view
class=
"goods-count-item"
>
<view
class=
"goods-count-item-title"
>
充电桩盘点量
</view>
<view
class=
"goods-count-item-count"
>
{{
checkCount
}}
</view>
</view>
</view>
</
template
>
<
script
>
export
default
{
name
:
'GoodsCount'
,
props
:{
inventoryCount
:{
type
:
Number
,
default
:
0
},
checkCount
:{
type
:
Number
,
default
:
0
},
},
data
()
{
return
{};
}
};
</
script
>
<
style
lang=
"scss"
scoped
>
.goods-count
{
width
:
100%
;
padding
:
0
30rpx
;
margin-bottom
:
20rpx
;
display
:
flex
;
justify-content
:
space-between
;
&
-item
{
width
:
45%
;
text-align
:
center
;
&
-title
{
color
:
#666666
;
}
&
-count
{
margin-top
:
30rpx
;
font-weight
:
550
;
color
:
#2272ff
;
white-space
:
nowrap
;
text-overflow
:
ellipsis
;
overflow
:
hidden
;
word-break
:
break-all
;
}
}
&
-line
{
margin-top
:
68rpx
;
width
:
2rpx
;
height
:
40rpx
;
background-color
:
#cccccc
;
}
}
</
style
>
src/pages/mine/warehouse/components/inventory/inventoryHead.vue
0 → 100644
View file @
aebe688a
<
template
>
<!-- 各个tab -->
<view
class=
"tools-box"
>
<view
class=
"tools-box-left"
>
<view
class=
"tools-box-left-title"
>
选择品牌
</view>
<view
class=
"tools-box-left-select"
><xh-picker-select
background=
"#f4f5f7"
placeholder=
"全部"
:rangeKey=
"rangeKey"
:value=
"value"
:list=
"brandList"
@
change=
"pickerchange"
></xh-picker-select></view>
</view>
<view
class=
"tools-box-navi"
>
<xh-button
@
handleClick=
"naviTo"
text=
"去盘点"
></xh-button>
</view>
</view>
</
template
>
<
script
>
import
XhPickerSelect
from
'../XhPickerSelect.vue'
;
import
XhButton
from
"@/components/mine/xh-button.vue"
import
{
receiveStatusOptions
}
from
'@/common/optinos/mine/received.js'
;
export
default
{
props
:
[
'current'
,
'value'
],
components
:
{
XhPickerSelect
,
XhButton
},
data
()
{
return
{
receiveStatusOptions
,
rangeKey
:
"name"
,
brandList
:
[
{
id
:
0
,
name
:
'全部'
,
},
{
id
:
982
,
name
:
'长城'
,
},
],
};
},
methods
:
{
// 获取品牌列表
async
getBrandList
()
{
let
res
=
await
this
.
$u
.
api
.
brandListByReceivedModules
();
let
{
code
,
data
}
=
res
;
if
(
code
===
200
){
this
.
brandList
=
data
||
[];
}
},
pickerchange
(
data
)
{
this
.
$emit
(
'pickerchange'
,
data
);
},
naviTo
(){
this
.
$emit
(
'toAdd'
);
}
}
};
</
script
>
<
style
lang=
"scss"
scoped
>
.tools-box
{
display
:
flex
;
flex-direction
:
row
;
justify-content
:
space-between
;
align-items
:
center
;
margin-bottom
:
30rpx
;
height
:
100rpx
;
background-color
:
#FFFFFF
;
padding
:
0
30rpx
;
border-radius
:
12rpx
;
&
-left
{
display
:
flex
;
align-items
:
center
;
&
-title
{
width
:
120rpx
;
display
:
flex
;
align-items
:
center
;
justify-content
:
flex-start
;
margin-right
:
20rpx
;
}
&
-select
{
width
:
240rpx
;
background-color
:
#ffffff
;
border-radius
:
8rpx
;
}
}
&
-navi
{
width
:
180rpx
;
}
}
</
style
>
src/pages/mine/warehouse/components/inventory/inventoryInfo.vue
0 → 100644
View file @
aebe688a
<
template
>
<uni-swipe-action-item
:right-options=
"rightOptions"
@
click
.
stop=
"swipeClick"
>
<view
class=
"receiving-info"
@
click
.
stop=
"handleClick"
>
<view
class=
"receiving-info-content"
>
<text
class=
"receiving-info-content-left"
>
箱码
</text>
<text
class=
"receiving-info-content-right"
>
{{
detail
.
code
}}
</text>
</view>
<view
class=
"receiving-info-content"
>
<text
class=
"receiving-info-content-left"
>
状态
</text>
<text
class=
"receiving-info-content-right"
:class=
"[statusColor]"
>
{{
statusLabel
}}
</text>
</view>
</view>
</uni-swipe-action-item>
</
template
>
<
script
>
import
{
myFilter
}
from
'@/common/common.js'
;
import
{
receiveStatusOptions
}
from
'@/common/optinos/mine/received.js'
;
import
{
showModal
}
from
'@/common/common.js'
;
export
default
{
name
:
'ReceivingInfo'
,
props
:
{
detail
:
{
type
:
Object
,
default
:
()
=>
{}
},
/* 品牌类型 */
options
:
{
type
:
Array
|
null
,
default
:
()
=>
[]
}
},
data
()
{
return
{
receiveStatusOptions
,
statusColorOptions
:
{
1
:
'receiving-info-footer-status-grey'
,
2
:
'receiving-info-footer-status-blue'
},
rightOptions
:
[
{
text
:
'取消'
,
style
:
{
backgroundColor
:
'#007aff'
}
},
{
text
:
'删除'
,
style
:
{
backgroundColor
:
'#dd524d'
}
}
]
};
},
computed
:
{
statusColor
()
{
return
this
.
statusColorOptions
[
this
.
detail
.
status
]
||
''
;
},
statusLabel
()
{
// 按钮文字
return
myFilter
(
this
.
detail
.
status
,
this
.
receiveStatusOptions
,
'name'
);
},
brandLabel
()
{
return
myFilter
(
this
.
detail
.
brand
,
this
.
options
);
}
},
created
()
{},
methods
:
{
/* index 为 当前所在的下标*/
/* index1 为 按钮的下标*/
swipeClick
(
e
)
{
let
{
text
}
=
e
.
content
;
console
.
log
(
'点击了'
+
(
e
.
position
===
'left'
?
'左侧'
:
'右侧'
)
+
e
.
content
.
text
+
'按钮'
);
if
(
e
.
position
===
'right'
&&
text
===
'删除'
)
{
this
.
openDelete
();
}
},
handleClick
()
{
this
.
$emit
(
'handleClick'
,
this
.
detail
.
id
);
},
openDelete
(
index
)
{
showModal
({
content
:
'删除车辆后,将无法收到车辆信息,是否删除该车辆?'
,
success
:
res
=>
{
if
(
res
.
confirm
)
{
this
.
$emit
(
'handleDelete'
,
this
.
detail
.
id
);
}
}
});
}
}
};
</
script
>
<
style
lang=
"scss"
scoped
>
.receiving-info
{
background-color
:
#ffffff
;
border-radius
:
12rpx
;
padding
:
20rpx
30rpx
;
// margin-bottom: 20rpx;
font-size
:
24rpx
;
color
:
#666666
;
.hover-class
{
background-color
:
#dddddd
;
}
&
-content
{
display
:
flex
;
justify-content
:
space-between
;
line-height
:
36rpx
;
margin-bottom
:
12rpx
;
&
:last-child
{
margin-bottom
:
0
;
}
&
-left
{
width
:
100rpx
;
}
&
-right
{
text-align
:
right
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
white-space
:
nowrap
;
width
:
80%
;
}
}
}
</
style
>
src/pages/mine/warehouse/components/receiveDetail/receiveBarCode.vue
0 → 100644
View file @
aebe688a
<
template
>
<view
class=
"bar-code"
>
<view
class=
"bar-code-content"
><text>
快递单号
</text></view>
<view
class=
"bar-code-footer"
>
<view
class=
"bar-code-footer-label"
>
快递单号:
</view>
<view
class=
"bar-code-footer-value"
>
<u-input
type=
"text"
class=
"input-item"
v-model=
"dataValue"
@
input=
"valueChange"
placeholder=
"请输入"
:placeholder-style=
"placeholderStyle"
:custom-style=
"customStyle"
:clearable=
"false"
border-color=
"#ECECEC"
maxlength=
"200"
:cursor-spacing=
"10"
:disabled=
"disabled"
/>
<view
class=
"bar-code-footer-value-icon"
@
click=
"scanCode"
><u-icon
name=
"scan"
></u-icon></view>
</view>
</view>
</view>
</
template
>
<
script
>
export
default
{
name
:
'ReceiveBarCode'
,
props
:
{
value
:
{
type
:
[
String
,
null
]
},
disabled
:
{
type
:
Boolean
,
default
:
false
,
},
},
data
()
{
return
{
dataValue
:
''
};
},
mounted
()
{
this
.
dataValue
=
this
.
value
},
watch
:{
value
(
data
){
this
.
dataValue
=
data
}
},
computed
:
{
customStyle
()
{
return
{
'border-radius'
:
'12rpx'
,
color
:
'#999999'
,
'font-size'
:
'26rpx'
,
height
:
'76rpx'
};
},
placeholderStyle
()
{
return
'color:#999999;font-size:26rpx'
;
}
},
created
()
{},
methods
:
{
scanCode
()
{
if
(
this
.
disabled
)
return
false
;
// 允许从相机和相册扫码
uni
.
scanCode
({
scanType
:
[
'barCode'
],
success
:
res
=>
{
let
{
scanType
,
result
}
=
res
;
console
.
log
(
'类型:'
+
scanType
);
console
.
log
(
'内容:'
+
result
);
this
.
dataValue
=
result
;
this
.
$emit
(
'onBarCodeChange'
,
result
);
}
});
},
valueChange
(
e
)
{
this
.
$emit
(
'onBarCodeChange'
,
e
);
}
}
};
</
script
>
<
style
lang=
"scss"
scoped
>
.bar-code
{
background-color
:
#ffffff
;
border-radius
:
12rpx
;
padding
:
40rpx
30rpx
;
margin-bottom
:
20rpx
;
color
:
#333333
;
&
-content
{
font-size
:
32rpx
;
font-weight
:
600
;
}
&
-footer
{
margin-top
:
8rpx
;
display
:
flex
;
width
:
100%
;
align-items
:
center
;
color
:
#999999
;
&
-label
{
margin-right
:
12rpx
;
}
&
-value
{
flex
:
1
;
width
:
100%
;
display
:
flex
;
align-items
:
center
;
justify-content
:
space-between
;
background-color
:
#f4f5f7
;
border-radius
:
6px
;
padding
:
0rpx
20rpx
;
.input-item
{
flex
:
1
;
}
&
-icon
{
width
:
40rpx
;
height
:
38rpx
;
line-height
:
38rpx
;
text-align
:
center
;
}
}
}
}
</
style
>
src/pages/mine/warehouse/components/receiveDetail/receiveImages - 副本.vue
0 → 100644
View file @
aebe688a
<
template
>
<view
class=
"receive-images"
>
<view
class=
"title-view"
>
<view
class=
"title-left-view"
>
<text>
{{
uploadForm
.
label
}}
</text>
</view>
<view
class=
"info-tip-text"
v-if=
"!disabled"
>
{{
uploadForm
.
tips
}}
</view>
<view
class=
"image-view"
>
<block
v-for=
"(item, key) in uploadForm.imgs"
:key=
"key"
>
<view
class=
"info-image-box"
v-if=
"key
<
uploadForm
.
count
"
>
<image
class=
"info-image-box-inner"
mode=
"aspectFill"
v-if=
"item.path"
:src=
"item.path"
@
click=
"perview(key)"
></image>
<view
class=
"info-image-box-close"
v-if=
"!disabled"
@
click=
"removeImage(key)"
><u-icon
name=
"close"
></u-icon></view>
</view>
</block>
<view
class=
"info-image-box"
@
click=
"handleClick"
v-if=
"!disabled&&uploadForm.imgs.length
<
uploadForm
.
count
"
>
<view
class=
"info-image-box-add"
><u-icon
name=
"plus"
></u-icon></view>
</view>
</view>
<view
v-if=
"!disabled&&uploadForm.imgs.length == 0"
class=
"bottom-tip-view"
>
<image
class=
"bottom-tip-image"
mode=
"widthFix"
:src=
"tishiImage"
></image>
<text>
最少上传一张箱码照片
</text>
</view>
</view>
</view>
</
template
>
<
script
>
import
base
from
'@/components/upload/index'
;
export
default
{
name
:
'ReceiveImages'
,
mixins
:
[
base
],
props
:
{
disabled
:
{
type
:
Boolean
,
default
:
false
,
},
},
data
()
{
return
{
tishiImage
:
process
.
uniEnv
.
qn_base_url
+
'tishi.png'
,
uploadForm
:
{
filedName
:
''
,
count
:
3
,
label
:
'箱码照片'
,
tips
:
'上传箱码照片'
,
imgs
:
[]
}
};
},
computed
:
{},
created
()
{},
mounted
()
{
this
.
initImages
();
},
methods
:
{
initImages
(
images
)
{
this
.
uploadForm
.
imgs
=
images
||
[];
console
.
log
(
this
.
uploadForm
.
imgs
)
},
valueChange
(
e
)
{
this
.
$emit
(
'onScanCodeChange'
,
e
);
},
async
handleClick
()
{
if
(
this
.
disabled
)
return
false
;
let
{
count
,
imgs
}
=
this
.
uploadForm
;
// let imgCount=count-imgs.length;
// 已满3张不能再上传
if
(
imgs
.
length
===
count
)
{
return
false
;
}
let
imgList
=
await
this
.
chooseImg
({
count
:
1
,
size
:
[
'compressed'
]
});
this
.
uploadForm
.
imgs
.
push
(...
imgList
);
console
.
log
(
this
.
uploadForm
.
imgs
)
this
.
updateImages
();
},
// 预览
perview
(
index
)
{
let
urls
=
this
.
uploadForm
.
imgs
.
map
(
item
=>
{
return
item
.
path
;
});
uni
.
previewImage
({
current
:
index
,
urls
:
urls
});
},
removeImage
(
index
)
{
this
.
uploadForm
.
imgs
.
splice
(
index
,
1
);
this
.
updateImages
();
},
updateImages
()
{
this
.
$emit
(
'updateImages'
,
this
.
uploadForm
.
imgs
);
}
}
};
</
script
>
<
style
lang=
"scss"
scoped
>
.receive-images
{
background-color
:
#ffffff
;
border-radius
:
12rpx
;
padding
:
20rpx
30rpx
;
margin-bottom
:
20rpx
;
color
:
#333333
;
.title-view
{
font-size
:
32rpx
;
.title-left-view
{
font-weight
:
bold
;
}
.info-tip-text
{
font-size
:
24rpx
;
color
:
#666666
;
margin-top
:
10rpx
;
}
}
.bottom-tip-view
{
color
:
#999999
;
font-size
:
20rpx
;
display
:
flex
;
align-items
:
flex-start
;
margin-top
:
30rpx
;
}
.bottom-tip-image
{
width
:
22rpx
;
height
:
22rpx
;
margin-right
:
8rpx
;
margin-top
:
4rpx
;
flex-shrink
:
0
;
}
.image-view
{
margin-top
:
30rpx
;
display
:
flex
;
.info-image-box
{
width
:
216rpx
;
height
:
216rpx
;
background-color
:
#cccccc
;
position
:
relative
;
margin-right
:
20rpx
;
border-radius
:
12rpx
;
&
:last-child
{
margin-right
:
0
;
}
}
.info-image-box-inner
{
border-radius
:
12rpx
;
overflow
:
hidden
;
width
:
100%
;
height
:
100%
;
}
.info-image-box-close
{
width
:
38rpx
;
height
:
38rpx
;
border-radius
:
50%
;
background-color
:
#666666
;
font-size
:
22rpx
;
line-height
:
38rpx
;
color
:
#ffffff
;
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
position
:
absolute
;
top
:
-8rpx
;
right
:
-8rpx
;
z-index
:
1
;
}
.info-image-box-add
{
width
:
100%
;
height
:
100%
;
font-size
:
120rpx
;
color
:
#ffffff
;
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
}
}
}
</
style
>
src/pages/mine/warehouse/components/receiveDetail/receiveImages.vue
0 → 100644
View file @
aebe688a
<
template
>
<view
class=
"receive-images"
>
<view
class=
"title-view"
>
<view
class=
"title-left-view"
>
<text>
{{
uploadForm
.
label
}}
</text>
</view>
<view
class=
"info-tip-text"
v-if=
"!disabled"
>
{{
uploadForm
.
tips
}}
</view>
<view
class=
"image-view"
>
<block
v-for=
"(item, key) in uploadForm.imgs"
:key=
"key"
>
<view
class=
"info-image-box"
v-if=
"key
<
uploadForm
.
count
"
>
<image
class=
"info-image-box-inner"
mode=
"aspectFill"
v-if=
"item.path"
:src=
"item.path"
@
click=
"perview(key)"
></image>
<view
class=
"info-image-box-close"
v-if=
"!disabled"
@
click=
"removeImage(key)"
><u-icon
name=
"close"
></u-icon></view>
</view>
</block>
<view
class=
"info-image-box"
@
click=
"handleClick"
v-if=
"!disabled&&uploadForm.imgs.length
<
uploadForm
.
count
"
>
<view
class=
"info-image-box-add"
><u-icon
name=
"plus"
></u-icon></view>
</view>
</view>
<view
v-if=
"!disabled&&uploadForm.imgs.length == 0"
class=
"bottom-tip-view"
>
<image
class=
"bottom-tip-image"
mode=
"widthFix"
:src=
"tishiImage"
></image>
<text>
最少上传一张箱码照片
</text>
</view>
</view>
</view>
</
template
>
<
script
>
import
base
from
'@/components/upload/index'
;
export
default
{
name
:
'ReceiveImages'
,
mixins
:
[
base
],
props
:
{
disabled
:
{
type
:
Boolean
,
default
:
false
,
},
},
data
()
{
return
{
tishiImage
:
process
.
uniEnv
.
qn_base_url
+
'tishi.png'
,
uploadForm
:
{
filedName
:
''
,
count
:
3
,
label
:
'箱码照片'
,
tips
:
'上传箱码照片'
,
imgs
:
[]
}
};
},
computed
:
{},
created
()
{},
mounted
()
{
this
.
initImages
();
},
methods
:
{
initImages
(
images
)
{
this
.
uploadForm
.
imgs
=
images
||
[];
console
.
log
(
this
.
uploadForm
.
imgs
)
},
valueChange
(
e
)
{
this
.
$emit
(
'onScanCodeChange'
,
e
);
},
async
handleClick
()
{
if
(
this
.
disabled
)
return
false
;
let
{
count
,
imgs
}
=
this
.
uploadForm
;
// let imgCount=count-imgs.length;
// 已满3张不能再上传
if
(
imgs
.
length
===
count
)
{
return
false
;
}
let
imgList
=
await
this
.
chooseImg
({
count
:
1
,
size
:
[
'compressed'
]
});
this
.
uploadForm
.
imgs
.
push
(...
imgList
);
console
.
log
(
this
.
uploadForm
.
imgs
)
this
.
updateImages
();
},
// 预览
perview
(
index
)
{
let
urls
=
this
.
uploadForm
.
imgs
.
map
(
item
=>
{
return
item
.
path
;
});
uni
.
previewImage
({
current
:
index
,
urls
:
urls
});
},
removeImage
(
index
)
{
this
.
uploadForm
.
imgs
.
splice
(
index
,
1
);
this
.
updateImages
();
},
updateImages
()
{
this
.
$emit
(
'updateImages'
,
this
.
uploadForm
.
imgs
);
}
}
};
</
script
>
<
style
lang=
"scss"
scoped
>
.receive-images
{
background-color
:
#ffffff
;
border-radius
:
12rpx
;
padding
:
20rpx
30rpx
;
margin-bottom
:
20rpx
;
color
:
#333333
;
.title-view
{
font-size
:
32rpx
;
.title-left-view
{
font-weight
:
bold
;
}
.info-tip-text
{
font-size
:
24rpx
;
color
:
#666666
;
margin-top
:
10rpx
;
}
}
.bottom-tip-view
{
color
:
#999999
;
font-size
:
20rpx
;
display
:
flex
;
align-items
:
flex-start
;
margin-top
:
30rpx
;
}
.bottom-tip-image
{
width
:
22rpx
;
height
:
22rpx
;
margin-right
:
8rpx
;
margin-top
:
4rpx
;
flex-shrink
:
0
;
}
.image-view
{
margin-top
:
30rpx
;
display
:
flex
;
.info-image-box
{
width
:
216rpx
;
height
:
216rpx
;
background-color
:
#cccccc
;
position
:
relative
;
margin-right
:
20rpx
;
border-radius
:
12rpx
;
&
:last-child
{
margin-right
:
0
;
}
}
.info-image-box-inner
{
border-radius
:
12rpx
;
overflow
:
hidden
;
width
:
100%
;
height
:
100%
;
}
.info-image-box-close
{
width
:
38rpx
;
height
:
38rpx
;
border-radius
:
50%
;
background-color
:
#666666
;
font-size
:
22rpx
;
line-height
:
38rpx
;
color
:
#ffffff
;
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
position
:
absolute
;
top
:
-8rpx
;
right
:
-8rpx
;
z-index
:
1
;
}
.info-image-box-add
{
width
:
100%
;
height
:
100%
;
font-size
:
120rpx
;
color
:
#ffffff
;
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
}
}
}
</
style
>
src/pages/mine/warehouse/components/receiveDetail/receiveQrCode.vue
0 → 100644
View file @
aebe688a
<
template
>
<view
class=
"qr-code"
>
<view
class=
"qr-code-head"
@
click=
"scanCode"
>
<view
class=
"qr-code-head-scan"
><image
:src=
"backgroundImage"
class=
"qr-code-head-scan-image"
mode=
""
></image></view>
</view>
<view
class=
"qr-code-content"
><text>
扫描结果
</text></view>
<view
class=
"qr-code-footer"
>
<view
class=
"qr-code-footer-label"
>
充电桩箱码:
</view>
<view
class=
"qr-code-footer-value"
>
<u-input
type=
"text"
class=
"input-item"
v-model=
"dataValue"
@
input=
"valueChange"
placeholder=
"请输入"
:placeholder-style=
"placeholderStyle"
:custom-style=
"customStyle"
:clearable=
"false"
border-color=
"#ECECEC"
maxlength=
"200"
:cursor-spacing=
"10"
:disabled=
"disabled"
/>
</view>
</view>
</view>
</
template
>
<
script
>
export
default
{
name
:
'ReceiveQrCode'
,
props
:
{
value
:
{
type
:
[
String
,
null
]
},
disabled
:
{
type
:
Boolean
,
default
:
false
,
},
},
data
()
{
return
{
backgroundImage
:
process
.
uniEnv
.
qn_base_url
+
'saomashibie.png'
,
dataValue
:
''
};
},
mounted
()
{
this
.
dataValue
=
this
.
value
},
watch
:{
value
(
data
){
this
.
dataValue
=
data
}
},
computed
:
{
customStyle
()
{
return
{
'border-radius'
:
'12rpx'
,
color
:
'#999999'
,
'padding'
:
'0 20rpx'
,
'font-size'
:
'26rpx'
,
height
:
'76rpx'
,
'background-color'
:
"#f4f5f7"
,
'border-radius'
:
"6px"
,
};
},
placeholderStyle
()
{
return
'color:#999999;font-size:26rpx'
;
}
},
created
()
{},
methods
:
{
scanCode
()
{
if
(
this
.
disabled
)
return
false
;
// 允许从相机和相册扫码
uni
.
scanCode
({
scanType
:
[
'qrCode'
],
success
:
res
=>
{
let
{
scanType
,
result
}
=
res
;
console
.
log
(
'类型:'
+
scanType
);
console
.
log
(
'内容:'
+
result
);
if
(
scanType
===
'QR_CODE'
)
{
this
.
dataValue
=
result
;
this
.
$emit
(
"onScanCodeChange"
,
result
)
}
}
});
},
valueChange
(
e
)
{
this
.
$emit
(
"onScanCodeChange"
,
e
)
}
}
};
</
script
>
<
style
lang=
"scss"
scoped
>
.qr-code
{
background-color
:
#ffffff
;
border-radius
:
12rpx
;
padding
:
40rpx
30rpx
;
margin-bottom
:
20rpx
;
color
:
#333333
;
&
-head
{
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
&
-scan
{
width
:
240rpx
;
height
:
240rpx
;
&
-image
{
width
:
100%
;
height
:
100%
;
}
}
}
&
-content
{
margin-top
:
20rpx
;
font-size
:
32rpx
;
font-weight
:
600
;
}
&
-footer
{
margin-top
:
8rpx
;
display
:
flex
;
align-items
:
center
;
color
:
#999999
;
&
-label
{
margin-right
:
12rpx
;
}
&
-value
{
flex
:
1
;
}
}
}
</
style
>
src/pages/mine/warehouse/components/received/receivedHead.vue
0 → 100644
View file @
aebe688a
<
template
>
<!-- 各个tab -->
<view
class=
"tools-box"
>
<view
class=
"search-sub"
>
<u-subsection
:current=
"current"
:list=
"receiveStatusOptions"
active-color=
"white"
bg-color=
"white"
inactive-color=
"#666"
button-color=
"#2272FF"
border-radius=
"36"
@
change=
"change"
height=
"72"
bold
></u-subsection>
</view>
<view
class=
"select-view"
><xh-picker-select
placeholder=
"品牌"
:list=
"brandList"
:rangeKey=
"rangeKey"
:value=
"value"
@
change=
"pickerchange"
></xh-picker-select></view>
</view>
</
template
>
<
script
>
import
XhPickerSelect
from
'../XhPickerSelect.vue'
;
import
{
receiveStatusOptions
}
from
'@/common/optinos/mine/received.js'
;
export
default
{
props
:
[
'current'
,
'value'
],
components
:
{
XhPickerSelect
},
data
()
{
return
{
receiveStatusOptions
,
rangeKey
:
"name"
,
brandList
:
[]
};
},
methods
:
{
// 获取品牌列表
async
getBrandList
()
{
let
res
=
await
this
.
$u
.
api
.
brandListByReceivedModules
();
let
{
code
,
data
}
=
res
;
if
(
code
===
200
){
this
.
brandList
=
data
||
[];
}
},
// tab栏切换
change
(
index
)
{
this
.
$emit
(
'update:current'
,
index
);
this
.
$emit
(
'currentChange'
);
},
pickerchange
(
data
)
{
this
.
$emit
(
'pickerchange'
,
data
);
}
}
};
</
script
>
<
style
lang=
"scss"
scoped
>
.tools-box
{
display
:
flex
;
flex-direction
:
row
;
justify-content
:
space-between
;
margin-bottom
:
30rpx
;
.search-sub
{
height
:
72rpx
;
width
:
320rpx
;
}
.select-view
{
width
:
240rpx
;
background-color
:
#ffffff
;
border-radius
:
8rpx
;
}
}
</
style
>
src/pages/mine/warehouse/components/received/receivingInfo.vue
0 → 100644
View file @
aebe688a
<
template
>
<view
class=
"receiving-info"
@
click=
"handleClick"
>
<view
class=
"receiving-info-head"
>
<text
class=
"receiving-info-head-left"
>
箱码
</text>
<text
class=
"receiving-info-head-right"
>
品牌
</text>
</view>
<view
class=
"receiving-info-content"
>
<text
class=
"receiving-info-content-left"
>
{{
detail
.
productCode
}}
</text>
<text
class=
"receiving-info-content-right"
>
{{
detail
.
brandName
}}
</text>
</view>
<view
class=
"receiving-info-footer"
>
<view
:class=
"[statusColor]"
>
{{
detail
.
status
}}
</view>
</view>
</view>
</
template
>
<
script
>
import
{
myFilter
}
from
'@/common/common.js'
;
import
{
receiveStatusOptions
}
from
'@/common/optinos/mine/received.js'
;
export
default
{
name
:
'ReceivingInfo'
,
props
:
{
detail
:
{
type
:
Object
,
default
:
()
=>
{}
},
},
data
()
{
return
{
receiveStatusOptions
};
},
computed
:
{
statusColor
()
{
return
this
.
detail
.
status
===
"已使用"
?
'receiving-info-footer-status-grey'
:
'receiving-info-footer-status-blue'
;
},
statusLabel
()
{
// 按钮文字
return
myFilter
(
this
.
detail
.
status
,
this
.
receiveStatusOptions
,
'name'
);
},
},
created
()
{},
methods
:
{
handleClick
()
{
this
.
$emit
(
'handleClick'
,
this
.
detail
.
id
);
}
}
};
</
script
>
<
style
lang=
"scss"
scoped
>
.receiving-info
{
background-color
:
#ffffff
;
border-radius
:
12rpx
;
padding
:
20rpx
30rpx
;
margin-bottom
:
20rpx
;
color
:
#333333
;
.hover-class
{
background-color
:
#dddddd
;
}
&
-head
{
display
:
flex
;
align-items
:
flex-end
;
justify-content
:
space-between
;
margin-bottom
:
20rpx
;
&
-left
{
font-size
:
36rpx
;
font-weight
:
bold
;
}
&
-right
{
font-size
:
24rpx
;
}
}
&
-content
{
display
:
flex
;
justify-content
:
space-between
;
line-height
:
36rpx
;
&
-left
{
width
:
45%
;
font-size
:
26rpx
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
white-space
:
nowrap
;
}
&
-right
{
text-align
:
right
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
white-space
:
nowrap
;
width
:
45%
;
}
}
&
-footer
{
border-top
:
2rpx
solid
#f4f5f7
;
margin-top
:
20rpx
;
padding-top
:
20rpx
;
font-size
:
28rpx
;
text-align
:
right
;
&
-status
{
&
-grey
{
color
:
#666666
;
}
&
-blue
{
color
:
#2272ff
;
}
}
}
}
</
style
>
src/pages/mine/warehouse/index.vue
View file @
aebe688a
<
template
>
<!-- 物料订单 -->
<view
class=
"ware-house"
>
<u-navbar
back-icon-color=
"#333333"
background=
"#FFFFFF"
title=
"物料订单"
titleColor=
"#333333"
:border-bottom=
"false"
title-bold
></u-navbar>
<!-- 搜索 -->
<u-navbar
back-icon-color=
"#333333"
background=
"#FFFFFF"
title=
"物料订单"
titleColor=
"#333333"
:border-bottom=
"false"
title-bold
></u-navbar>
<!-- 搜索 -->
<view
class=
"search-view"
@
click
.
self=
"handleClickSearch"
>
<u-search
:clearabled=
"false"
disabled
@
custom=
"handleClickSearch"
placeholder=
"请输入关键字"
:action-style=
"actionStyle"
placeholder-color=
"#999999"
color=
"#333333"
bg-color=
"#FFFFFF"
height=
"72"
search-icon-color=
"#999999"
>
</u-search>
<u-search
:clearabled=
"false"
disabled
@
custom=
"handleClickSearch"
placeholder=
"请输入关键字"
:action-style=
"actionStyle"
placeholder-color=
"#999999"
color=
"#333333"
bg-color=
"#FFFFFF"
height=
"72"
search-icon-color=
"#999999"
></u-search>
</view>
<!-- 各个tab -->
<view
class=
"u-tabs-box"
>
<u-tabs
height=
"66"
activeColor=
"#2272FF"
bg-color=
"none"
inactive-color=
"#999"
bar-height=
"4"
bar-width=
"44"
:offset=
"[0,0]"
:list=
"list"
count=
"total"
:current=
"currentIndex"
@
change=
"change"
:is-scroll=
"false"
font-size=
"28"
bold
></u-tabs>
<u-tabs
height=
"66"
activeColor=
"#2272FF"
bg-color=
"none"
inactive-color=
"#999"
bar-height=
"4"
bar-width=
"44"
:offset=
"[0, 0]"
:list=
"list"
count=
"total"
:current=
"currentIndex"
@
change=
"change"
:is-scroll=
"false"
font-size=
"28"
bold
></u-tabs>
</view>
<!-- 列表 -->
<view
class=
"tab-view"
>
<scroll-view
scroll-y
style=
"height: 100%;width: 100%;"
@
scrolltolower=
"reachBottom"
scroll-anchoring
refresher-enabled=
"true"
:refresher-triggered=
"triggered"
:refresher-threshold=
"100"
@
scroll=
"scroll"
refresher-background=
"#F4F5F7"
@
refresherrefresh=
"onRefresh"
@
refresherrestore=
"onRestore"
enable-back-to-top
>
<scroll-view
scroll-y
style=
"height: 100%;width: 100%;"
@
scrolltolower=
"reachBottom"
scroll-anchoring
refresher-enabled=
"true"
:refresher-triggered=
"triggered"
:refresher-threshold=
"100"
@
scroll=
"scroll"
refresher-background=
"#F4F5F7"
@
refresherrefresh=
"onRefresh"
@
refresherrestore=
"onRestore"
enable-back-to-top
>
<!-- 加载中 && 没有下拉:显示加载中 -->
<view
class=
"loading-view"
v-if=
"!loaded && _freshing"
>
<u-loading
mode=
"flower"
></u-loading>
</view>
<view
class=
"loading-view"
v-if=
"!loaded && _freshing"
><u-loading
mode=
"flower"
></u-loading></view>
<!-- 无数据 -->
<NoOrder
v-else-if=
"noParts"
imageName=
"wupeijianxinxi.png"
text=
"当前暂无物料信息"
:customStyle=
"noPartsCustomStyle"
/>
<NoOrder
v-else-if=
"noParts"
imageName=
"wupeijianxinxi.png"
text=
"当前暂无物料信息"
:customStyle=
"noPartsCustomStyle"
/>
<template
v-else
>
<!-- 列表 -->
<view
v-for=
"(item, index) in partsList"
:key=
"item.id"
>
<AppliedCell
@
operate=
"handleOperate"
:info=
"item"
@
action=
"handleClickCell"
@
express=
"handleClickExpress"
></AppliedCell>
</view>
<!-- 底部加载状态 -->
<view
class=
"load-more-view"
v-show=
"(pageNumber == 1 && loaded) || pageNumber > 1"
>
<u-loadmore
:status=
"loadStatus"
bgColor=
"#F4F5F7"
></u-loadmore>
</view>
<view
class=
"load-more-view"
v-show=
"(pageNumber == 1 && loaded) || pageNumber > 1"
><u-loadmore
:status=
"loadStatus"
bgColor=
"#F4F5F7"
></u-loadmore></view>
</
template
>
</scroll-view>
</view>
<!-- 悬浮申请按钮 -->
<view
class=
"fixed-button"
>
<ApplyButton
:type
.
sync=
"buttonType"
@
click=
"handleClickApply"
/>
</view>
<view
class=
"fixed-button"
><ApplyButton
:type
.
sync=
"buttonType"
@
click=
"handleClickApply"
/></view>
<!-- 通用提示框 -->
<view>
<u-toast
ref=
"uToast"
/>
</view>
<view><u-toast
ref=
"uToast"
/></view>
</view>
</template>
<
script
>
import
AppliedCell
from
"@/components/parts/appliedPartsCell.vue"
import
NoOrder
from
"@/components/order/noOrder.vue"
import
ApplyButton
from
"@/components/parts/applyButton.vue"
export
default
{
components
:
{
AppliedCell
,
NoOrder
,
ApplyButton
import
AppliedCell
from
'@/components/parts/appliedPartsCell.vue'
;
import
NoOrder
from
'@/components/order/noOrder.vue'
;
import
ApplyButton
from
'@/components/parts/applyButton.vue'
;
export
default
{
components
:
{
AppliedCell
,
NoOrder
,
ApplyButton
},
data
()
{
return
{
pageNumber
:
0
,
pageSize
:
10
,
partsList
:
[],
// 物料订单列表
currentIndex
:
0
,
// 当前tab的index
loadStatus
:
'loading'
,
// 底部加载状态
loaded
:
false
,
// 页面加载
triggered
:
true
,
// true:下拉刷新
_freshing
:
false
,
// 防止下拉刷新重复触发
buttonType
:
'expand'
// 申请按钮宽 collapse': '80rpx', 'expand': '220rpx''
};
},
computed
:
{
// 不传值 全部;待签收 15;待发货 10;待审核 1;已驳回 -2;已签收 20;已取消 -1;
list
()
{
return
[
{
name
:
'待签收'
,
status
:
15
},
{
name
:
'待审核'
,
status
:
1
},
{
name
:
'待发货'
,
status
:
10
},
{
name
:
'已取消'
,
status
:
-
1
},
{
name
:
'已驳回'
,
status
:
-
2
},
{
name
:
'全部'
,
status
:
null
}
];
},
data
()
{
return
{
pageNumber
:
0
,
pageSize
:
10
,
partsList
:
[],
// 物料订单列表
currentIndex
:
0
,
// 当前tab的index
loadStatus
:
'loading'
,
// 底部加载状态
loaded
:
false
,
// 页面加载
triggered
:
true
,
// true:下拉刷新
_freshing
:
false
,
// 防止下拉刷新重复触发
buttonType
:
'expand'
// 申请按钮宽 collapse': '80rpx', 'expand': '220rpx''
};
// 当下tab
currentTab
()
{
return
this
.
list
[
this
.
currentIndex
];
},
computed
:
{
// 不传值 全部;待签收 15;待发货 10;待审核 1;已驳回 -2;已签收 20;已取消 -1;
list
()
{
return
[
{
'name'
:
'待签收'
,
'status'
:
15
},
{
'name'
:
'待审核'
,
'status'
:
1
},
{
'name'
:
'待发货'
,
'status'
:
10
},
{
'name'
:
'已取消'
,
'status'
:
-
1
},
{
'name'
:
'已驳回'
,
'status'
:
-
2
},
{
'name'
:
'全部'
,
'status'
:
null
},
]
},
// 当下tab
currentTab
()
{
return
this
.
list
[
this
.
currentIndex
]
},
// 搜索图标
sousuoImage
()
{
return
process
.
uniEnv
.
qn_base_url
+
'sousuo.png'
},
// 无数据
noParts
()
{
return
this
.
partsList
.
length
==
0
&&
this
.
loaded
},
// 无数据页面样式
noPartsCustomStyle
()
{
return
'margin-top: 100rpx;background-color: #F4F5F7'
},
// 搜索控件右面'搜索'/'取消'按钮风格
actionStyle
()
{
return
{
'font-size'
:
'32rpx'
,
'color'
:
'#2272FF'
,
'margin-left'
:
'20rpx'
}
},
// 搜索图标
sousuoImage
()
{
return
process
.
uniEnv
.
qn_base_url
+
'sousuo.png'
;
},
onLoad
(
e
)
{
getApp
().
trackPage
(
'物料订单页'
)
if
(
e
&&
e
.
index
)
{
// 跳转到第几个tab页
this
.
currentIndex
=
e
.
index
}
this
.
_freshing
=
false
;
this
.
reloadPartsList
()
// 加载数据
// 无数据
noParts
()
{
return
this
.
partsList
.
length
==
0
&&
this
.
loaded
;
},
onShow
()
{
let
pages
=
getCurrentPages
()
let
page
=
pages
[
pages
.
length
-
1
]
if
(
page
.
needRefresh
)
{
// 需要初始化页面
page
.
needRefresh
=
null
this
.
currentIndex
=
0
this
.
reloadPartsList
()
}
// 无数据页面样式
noPartsCustomStyle
()
{
return
'margin-top: 100rpx;background-color: #F4F5F7'
;
},
// 搜索控件右面'搜索'/'取消'按钮风格
actionStyle
()
{
return
{
'font-size'
:
'32rpx'
,
color
:
'#2272FF'
,
'margin-left'
:
'20rpx'
};
}
},
onLoad
(
e
)
{
getApp
().
trackPage
(
'物料订单页'
);
if
(
e
&&
e
.
index
)
{
// 跳转到第几个tab页
this
.
currentIndex
=
e
.
index
;
}
this
.
_freshing
=
false
;
this
.
reloadPartsList
();
// 加载数据
},
onShow
()
{
let
pages
=
getCurrentPages
();
let
page
=
pages
[
pages
.
length
-
1
];
if
(
page
.
needRefresh
)
{
// 需要初始化页面
page
.
needRefresh
=
null
;
this
.
currentIndex
=
0
;
this
.
reloadPartsList
();
}
},
methods
:
{
// tab栏切换
change
(
index
)
{
this
.
currentIndex
=
index
;
this
.
reloadPartsList
();
},
methods
:
{
// tab栏切换
change
(
index
)
{
this
.
currentIndex
=
index
;
this
.
reloadPartsList
()
},
// 页面数据:未入库
getUnstockedList
(
status
)
{
// 状态处理
this
.
pageNumber
+=
1
if
(
this
.
pageNumber
==
1
)
{
this
.
loaded
=
false
}
var
param
=
{
'pageSize'
:
this
.
pageSize
,
'pageNumber'
:
this
.
pageNumber
,
}
if
(
status
!=
null
)
{
param
.
status
=
status
//不传值 全部;待签收 15;待发货 10;待审核 1;已取消 -1;已驳回 -2;已签收 20
// 页面数据:未入库
getUnstockedList
(
status
)
{
// 状态处理
this
.
pageNumber
+=
1
;
if
(
this
.
pageNumber
==
1
)
{
this
.
loaded
=
false
;
}
var
param
=
{
pageSize
:
this
.
pageSize
,
pageNumber
:
this
.
pageNumber
};
if
(
status
!=
null
)
{
param
.
status
=
status
;
//不传值 全部;待签收 15;待发货 10;待审核 1;已取消 -1;已驳回 -2;已签收 20
}
this
.
$u
.
api
.
applyList
(
param
).
then
(
res
=>
{
if
(
res
.
code
==
200
)
{
if
(
this
.
pageNumber
==
1
)
{
this
.
partsList
=
[];
}
let
list
=
res
.
data
||
[];
this
.
partsList
.
push
(...
list
);
this
.
loadStatus
=
list
.
length
<
this
.
pageSize
?
'nomore'
:
'loadmore'
;
// 底部加载状态
}
else
{
console
.
log
(
res
.
message
);
}
this
.
$u
.
api
.
applyList
(
param
).
then
((
res
)
=>
{
if
(
res
.
code
==
200
)
{
if
(
this
.
pageNumber
==
1
)
{
this
.
partsList
=
[]
}
let
list
=
res
.
data
||
[]
this
.
partsList
.
push
(...
list
)
this
.
loadStatus
=
list
.
length
<
this
.
pageSize
?
'nomore'
:
'loadmore'
// 底部加载状态
}
else
{
console
.
log
(
res
.
message
)
this
.
$nextTick
(()
=>
{
// 页面刷新完之后更新下拉状态
if
(
this
.
_freshing
)
{
this
.
triggered
=
false
;
this
.
_freshing
=
false
;
}
this
.
$nextTick
(()
=>
{
// 页面刷新完之后更新下拉状态
if
(
this
.
_freshing
)
{
this
.
triggered
=
false
;
this
.
_freshing
=
false
;
}
})
this
.
loaded
=
true
// 加载完成
});
},
// 点击了订单cell的按钮
handleOperate
(
partsId
,
operateType
)
{
this
.
$u
.
api
[
operateType
](
partsId
).
then
(
res
=>
{
var
type
=
'error'
var
message
=
res
.
message
if
(
res
.
code
===
200
)
{
type
=
'success'
message
=
'操作成功'
this
.
currentIndex
=
0
this
.
reloadPartsList
()
}
else
{
console
.
log
(
res
.
message
)
}
this
.
$refs
.
uToast
.
show
({
title
:
message
,
type
:
type
,
duration
:
1500
,
callback
:
function
()
{}
})
})
},
// 点击了订单cell本身,跳转到详情
handleClickCell
(
info
)
{
this
.
setPageInfo
(
info
)
uni
.
navigateTo
({
url
:
'pages/mine/warehouse/partsDetail'
})
},
// 点击了订单cell的物流号,跳转到物流页面
handleClickExpress
(
info
)
{
this
.
setPageInfo
(
info
)
uni
.
navigateTo
({
url
:
'pages/mine/warehouse/express'
})
},
// 本页数据设置,用于其他页面访问本页数据
setPageInfo
(
info
)
{
var
pages
=
getCurrentPages
();
if
(
pages
.
length
>=
1
)
{
var
page
=
pages
[
pages
.
length
-
1
];
page
.
info
=
info
this
.
loaded
=
true
;
// 加载完成
});
},
// 点击了订单cell的按钮
handleOperate
(
partsId
,
operateType
)
{
this
.
$u
.
api
[
operateType
](
partsId
).
then
(
res
=>
{
var
type
=
'error'
;
var
message
=
res
.
message
;
if
(
res
.
code
===
200
)
{
type
=
'success'
;
message
=
'操作成功'
;
this
.
currentIndex
=
0
;
this
.
reloadPartsList
();
}
else
{
console
.
log
(
res
.
message
);
}
},
// 点击了悬浮申请按钮
handleClickApply
()
{
uni
.
navigateTo
({
url
:
'pages/parts/application?applyType=1'
})
},
// 点击了搜索,跳转到搜索页面
handleClickSearch
()
{
var
pages
=
getCurrentPages
();
uni
.
navigateTo
({
url
:
'pages/mine/warehouse/searchParts'
})
},
// 下拉刷新
onRefresh
()
{
if
(
this
.
_freshing
)
return
;
this
.
_freshing
=
true
;
this
.
reloadPartsList
()
},
// 重置下拉状态
onRestore
()
{
this
.
triggered
=
'restore'
;
// 需要重置
},
// 初始化加载
reloadPartsList
()
{
// 第一页数据
this
.
pageNumber
=
0
this
.
loadStatus
=
'loading'
this
.
getUnstockedList
(
this
.
currentTab
.
status
)
},
// 滚到底部
reachBottom
(
e
)
{
if
(
this
.
loadStatus
!=
'loadmore'
)
return
this
.
loadStatus
==
'loading'
this
.
getUnstockedList
(
this
.
currentTab
.
status
)
},
// 滚动触发悬浮按钮变为收起状态
scroll
()
{
this
.
buttonType
=
'collapse'
},
this
.
$refs
.
uToast
.
show
({
title
:
message
,
type
:
type
,
duration
:
1500
,
callback
:
function
()
{}
});
});
},
// 点击了订单cell本身,跳转到详情
handleClickCell
(
info
)
{
this
.
setPageInfo
(
info
);
uni
.
navigateTo
({
url
:
'pages/mine/warehouse/partsDetail'
});
},
// 点击了订单cell的物流号,跳转到物流页面
handleClickExpress
(
info
)
{
this
.
setPageInfo
(
info
);
uni
.
navigateTo
({
url
:
'pages/mine/warehouse/express'
});
},
// 本页数据设置,用于其他页面访问本页数据
setPageInfo
(
info
)
{
var
pages
=
getCurrentPages
();
if
(
pages
.
length
>=
1
)
{
var
page
=
pages
[
pages
.
length
-
1
];
page
.
info
=
info
;
}
},
// 点击了悬浮申请按钮
handleClickApply
()
{
uni
.
navigateTo
({
url
:
'pages/parts/application?applyType=1'
});
},
// 点击了搜索,跳转到搜索页面
handleClickSearch
()
{
var
pages
=
getCurrentPages
();
uni
.
navigateTo
({
url
:
'pages/mine/warehouse/searchParts'
});
},
// 下拉刷新
onRefresh
()
{
if
(
this
.
_freshing
)
return
;
this
.
_freshing
=
true
;
this
.
reloadPartsList
();
},
// 重置下拉状态
onRestore
()
{
this
.
triggered
=
'restore'
;
// 需要重置
},
// 初始化加载
reloadPartsList
()
{
// 第一页数据
this
.
pageNumber
=
0
;
this
.
loadStatus
=
'loading'
;
this
.
getUnstockedList
(
this
.
currentTab
.
status
);
},
// 滚到底部
reachBottom
(
e
)
{
if
(
this
.
loadStatus
!=
'loadmore'
)
return
;
this
.
loadStatus
==
'loading'
;
this
.
getUnstockedList
(
this
.
currentTab
.
status
);
},
// 滚动触发悬浮按钮变为收起状态
scroll
()
{
this
.
buttonType
=
'collapse'
;
}
};
}
};
</
script
>
<
style
lang=
"scss"
scoped
>
.ware-house
{
padding
:
0
30rpx
;
height
:
100vh
;
display
:
flex
;
flex-direction
:
column
;
.ware-house
{
padding
:
0
30rpx
;
height
:
100vh
;
display
:
flex
;
flex-direction
:
column
;
.search-view
{
margin-bottom
:
20rpx
;
margin-top
:
10rpx
;
.search-view
{
margin-bottom
:
20rpx
;
margin-top
:
10rpx
;
/
deep
/
.u-search
.u-content
{
padding-left
:
40rpx
;
}
/
deep
/
.u-search
.u-input
{
margin
:
0
20rpx
;
}
/
deep
/
.u-search
.u-content
{
padding-left
:
40rpx
;
}
/
deep
/
.u-search
.u-icon--right
.u-iconfont
{
font-size
:
36rpx
!
important
;
}
/
deep
/
.u-search
.u-input
{
margin
:
0
20rpx
;
}
.u-tabs-box
{
margin-bottom
:
30rpx
;
/
deep
/
.u-search
.u-icon--right
.u-iconfont
{
font-size
:
36rpx
!
important
;
}
}
.tab-view
{
height
:
100%
;
overflow
:
auto
;
.u-tabs-box
{
margin-bottom
:
30rpx
;
}
.load-more
-view
{
padding-bottom
:
64rpx
;
}
.tab
-view
{
height
:
100%
;
overflow
:
auto
;
.loading-view
{
width
:
100%
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
margin-top
:
300rpx
;
position
:
absolute
;
}
.load-more-view
{
padding-bottom
:
64rpx
;
}
.fixed-button
{
position
:
fixed
;
right
:
20rpx
;
bottom
:
64rpx
;
.loading-view
{
width
:
100%
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
margin-top
:
300rpx
;
position
:
absolute
;
}
}
</
style
>
.fixed-button
{
position
:
fixed
;
right
:
20rpx
;
bottom
:
64rpx
;
}
}
</
style
>
src/pages/mine/warehouse/inventory.vue
0 → 100644
View file @
aebe688a
<
template
>
<!-- 收货列表 -->
<view
class=
"ware-house"
>
<u-navbar
back-icon-color=
"#333333"
background=
"#FFFFFF"
title=
"盘点"
titleColor=
"#333333"
:border-bottom=
"false"
title-bold
></u-navbar>
<inventory-head
ref=
"inventory-head"
@
toAdd=
"toAdd"
:value=
"form.brandId"
@
pickerchange=
"pickerchange"
></inventory-head>
<goods-count
:inventoryCount=
"inventoryCount"
:checkCount=
"checkCount"
></goods-count>
<!-- 列表 -->
<view
class=
"tab-view"
@
click=
"closeAll"
>
<scroll-view
scroll-y
style=
"height: 100%;width: 100%;"
@
scrolltolower=
"reachBottom"
scroll-anchoring
refresher-enabled=
"true"
:refresher-triggered=
"triggered"
:refresher-threshold=
"100"
:scroll-top=
"scrollTop"
refresher-background=
"#F4F5F7"
@
refresherrefresh=
"onRefresh"
@
refresherrestore=
"onRestore"
@
scroll=
"scroll"
enable-back-to-top
>
<NoOrder
v-if=
"noParts"
imageName=
"zwdd.png"
:customStyle=
"noOrderCustomStyle"
/>
<template
v-else
>
<uni-swipe-action
ref=
"uni-swipe-action"
>
<view
class=
"swipe-action"
v-for=
"(item, index) in list"
:key=
"item.id"
>
<inventory-info
:detail=
"item"
:options=
"brandList"
@
handleClick=
"handleClick"
@
handleDelete=
"handleDelete"
></inventory-info>
</view>
</uni-swipe-action>
<view
class=
"load-more-view"
v-show=
"(form.pageNumber == 1 && loaded) || form.pageNumber > 1"
><u-loadmore
:status=
"loadStatus"
bgColor=
"#F4F5F7"
></u-loadmore></view>
</
template
>
<view
class=
"loading-view"
v-if=
"!loaded && !freshing"
><u-loading
mode=
"flower"
></u-loading></view>
</scroll-view>
</view>
<!-- 底部按钮 -->
<fixed-button
text=
"确认盘点"
@
handleClick=
"confirm"
></fixed-button>
<!-- 通用提示框 -->
<view><u-toast
ref=
"uToast"
/></view>
</view>
</template>
<
script
>
import
inventoryHead
from
'./components/inventory/inventoryHead.vue'
;
import
GoodsCount
from
'./components/inventory/goodsCount.vue'
;
import
FixedButton
from
'@/components/mine/fixed-button.vue'
;
import
InventoryInfo
from
'./components/inventory/inventoryInfo.vue'
;
import
NoOrder
from
'@/components/order/noOrder.vue'
;
import
ApplyButton
from
'@/components/parts/applyButton.vue'
;
import
{
receiveStatusOptions
}
from
'@/common/optinos/mine/received.js'
;
export
default
{
components
:
{
inventoryHead
,
InventoryInfo
,
NoOrder
,
ApplyButton
,
FixedButton
,
GoodsCount
},
data
()
{
return
{
receiveStatusOptions
,
list
:
[
{
id
:
1
,
status
:
1
,
code
:
'dsadq4231'
,
brand
:
'byd'
,
show
:
false
},
{
id
:
2
,
status
:
1
,
code
:
'dsadq4231'
,
brand
:
'byd'
,
show
:
false
},
{
id
:
3
,
status
:
1
,
code
:
'dsadq4231'
,
brand
:
'byd'
,
show
:
false
},
{
id
:
4
,
status
:
1
,
code
:
'dsadq4231'
,
brand
:
'byd'
,
show
:
false
},
{
id
:
5
,
status
:
1
,
code
:
'dsadq4231'
,
brand
:
'byd'
,
show
:
false
},
{
id
:
6
,
status
:
1
,
code
:
'dsadq4231'
,
brand
:
'byd'
,
show
:
false
},
{
id
:
7
,
status
:
1
,
code
:
'dsadq4231'
,
brand
:
'byd'
,
show
:
false
},
{
id
:
8
,
status
:
1
,
code
:
'dsadq4231'
,
brand
:
'byd'
,
show
:
false
},
{
id
:
9
,
status
:
1
,
code
:
'dsadq4231'
,
brand
:
'byd'
,
show
:
false
},
{
id
:
10
,
status
:
1
,
code
:
'dsadq4231'
,
brand
:
'byd'
,
show
:
false
},
{
id
:
11
,
status
:
1
,
code
:
'dsadq4231'
,
brand
:
'byd'
,
show
:
false
},
{
id
:
12
,
status
:
1
,
code
:
'dsadq4231'
,
brand
:
'byd'
,
show
:
false
},
{
id
:
13
,
status
:
1
,
code
:
'dsadq4231'
,
brand
:
'byd'
,
show
:
false
},
{
id
:
14
,
status
:
1
,
code
:
'dsadq4231'
,
brand
:
'byd'
,
show
:
false
},
{
id
:
15
,
status
:
1
,
code
:
'dsadq4231'
,
brand
:
'byd'
,
show
:
false
},
{
id
:
16
,
status
:
1
,
code
:
'dsadq4231'
,
brand
:
'byd'
,
show
:
false
},
{
id
:
17
,
status
:
1
,
code
:
'dsadq4231'
,
brand
:
'byd'
,
show
:
false
},
{
id
:
18
,
status
:
1
,
code
:
'dsadq4231'
,
brand
:
'byd'
,
show
:
false
},
{
id
:
19
,
status
:
1
,
code
:
'dsadq4231'
,
brand
:
'byd'
,
show
:
false
},
{
id
:
20
,
status
:
1
,
code
:
'dsadq4231'
,
brand
:
'byd'
,
show
:
false
},
{
id
:
21
,
status
:
1
,
code
:
'dsadq4231'
,
brand
:
'byd'
,
show
:
false
},
{
id
:
22
,
status
:
1
,
code
:
'dsadq4231'
,
brand
:
'byd'
,
show
:
false
},
{
id
:
23
,
status
:
1
,
code
:
'dsadq4231'
,
brand
:
'byd'
,
show
:
false
}
],
// 物料订单列表
form
:
{
pageNumber
:
0
,
pageSize
:
10
,
brandId
:
''
,
},
show
:
false
,
loadStatus
:
'loading'
,
// 底部加载状态
loaded
:
false
,
// 页面加载
triggered
:
true
,
// true:下拉刷新
freshing
:
false
,
// 防止下拉刷新重复触发
buttonType
:
'expand'
,
// 申请按钮宽 collapse': '80rpx', 'expand': '220rpx''
scrollTop
:
0
,
old
:
{
scrollTop
:
0
},
buttonStyle
:
{
width
:
'100%'
,
height
:
'80rpx'
,
fontSize
:
'32rpx'
,
fontWeight
:
'bold'
},
inventoryCount
:
0
,
checkCount
:
0
};
},
computed
:
{
// 无数据
noParts
()
{
return
this
.
list
.
length
==
0
&&
this
.
loaded
;
},
// 无数据页面样式
noPartsCustomStyle
()
{
return
'margin-top: 100rpx;background-color: #F4F5F7'
;
}
},
onLoad
(
e
)
{
// getApp().trackPage('物料订单页');
// if (e && e.index) {
// // 跳转到第几个tab页
// this.currentIndex = e.index;
// }
this
.
freshing
=
false
;
this
.
reloadList
();
// 加载数据
},
onShow
()
{
let
pages
=
getCurrentPages
();
let
page
=
pages
[
pages
.
length
-
1
];
if
(
page
.
needRefresh
)
{
// 需要初始化页面
page
.
needRefresh
=
null
;
this
.
reloadList
();
}
},
methods
:
{
pickerchange
(
data
)
{
this
.
form
.
brandId
=
data
.
id
||
""
;
this
.
reloadList
();
},
// 获取品牌列表
getBrandList
(){
this
.
$refs
[
"inventory-head"
].
getBrandList
()
},
// 页面数据:未入库
async
getList
()
{
// 状态处理
this
.
form
.
pageNumber
+=
1
;
if
(
this
.
form
.
pageNumber
==
1
)
{
this
.
loaded
=
false
;
}
var
param
=
this
.
form
let
res
=
await
this
.
$u
.
api
.
inventoryListByReceivedModules
(
param
);
if
(
res
.
code
==
200
)
{
if
(
this
.
form
.
pageNumber
==
1
)
{
this
.
list
=
[];
}
let
list
=
res
.
data
||
[];
list
.
forEach
(
item
=>
(
item
.
show
=
false
));
this
.
list
.
push
(...
list
);
this
.
loadStatus
=
list
.
length
<
this
.
pageSize
?
'nomore'
:
'loadmore'
;
// 底部加载状态
}
else
{
// this.loadStatus = 'loadmore';
console
.
log
(
res
.
message
);
}
this
.
$nextTick
(()
=>
{
// 页面刷新完之后更新下拉状态
if
(
this
.
freshing
)
{
this
.
triggered
=
false
;
this
.
freshing
=
false
;
}
});
this
.
loaded
=
true
;
// 加载完成
},
// 跳转到详情
handleClick
(
id
)
{
let
url
=
'pages/mine/warehouse/inventoryDetail'
;
if
(
id
)
url
+=
`?id=
${
id
}
`
;
uni
.
navigateTo
({
url
});
},
// 新增收货
toAdd
()
{
this
.
handleClick
();
},
// 本页数据设置,用于其他页面访问本页数据
setPageInfo
(
info
)
{
var
pages
=
getCurrentPages
();
if
(
pages
.
length
>=
1
)
{
var
page
=
pages
[
pages
.
length
-
1
];
page
.
info
=
info
;
}
},
// 下拉刷新
onRefresh
()
{
if
(
this
.
freshing
)
return
;
this
.
freshing
=
true
;
this
.
reloadList
();
},
// 重置下拉状态
onRestore
()
{
this
.
triggered
=
'restore'
;
// 需要重置
},
// 初始化加载
reloadList
()
{
// 第一页数据
this
.
form
.
pageNumber
=
0
;
this
.
loadStatus
=
'loading'
;
this
.
getList
();
},
// 滚到底部加载下一页
reachBottom
(
e
)
{
if
(
this
.
loadStatus
!=
'loadmore'
)
return
;
this
.
loadStatus
==
'loading'
;
this
.
getList
();
},
scroll
(
e
)
{
// this.old.scrollTop = e.detail.scrollTop;
},
closeAll
()
{
if
(
this
.
list
.
length
)
{
this
.
$refs
[
'uni-swipe-action'
].
closeOther
(
undefined
);
}
},
async
handleDelete
(
id
)
{
console
.
log
(
'删除--'
,
id
);
// let {code,data}=await onDelete(id)
},
// 确认盘点
async
confirm
()
{
if
(
this
.
list
.
length
)
{
// let res=await confirmSubmit()
}
}
}
};
</
script
>
<
style
lang=
"scss"
scoped
>
.ware-house
{
padding
:
0
30rpx
;
height
:
100vh
;
// min-height: 100vh;
display
:
flex
;
flex-direction
:
column
;
padding-bottom
:
constant
(
safe-area-inset-bottom
);
/*
兼容
iOS
<
11
.
2
*/
padding-bottom
:
env
(
safe-area-inset-bottom
);
/* 兼容 iOS >= 11.2 */
.tab-view
{
height
:
100%
;
overflow
:
auto
;
margin-bottom
:
100rpx
;
padding-bottom
:
constant
(
safe-area-inset-bottom
);
/*
兼容
iOS
<
11
.
2
*/
padding-bottom
:
env
(
safe-area-inset-bottom
);
/* 兼容 iOS >= 11.2 */
.swipe-action
{
padding-bottom
:
20rpx
;
}
.load-more-view
{
padding-bottom
:
64rpx
;
}
.loading-view
{
width
:
100%
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
margin-top
:
300rpx
;
position
:
absolute
;
}
}
.fixed-button
{
width
:
100%
;
box-sizing
:
border-box
;
position
:
fixed
;
left
:
0
;
padding
:
0
30rpx
;
padding-bottom
:
constant
(
safe-area-inset-bottom
);
/*
兼容
iOS
<
11
.
2
*/
padding-bottom
:
env
(
safe-area-inset-bottom
);
/* 兼容 iOS >= 11.2 */
bottom
:
20rpx
;
}
}
</
style
>
src/pages/mine/warehouse/inventoryDetail.vue
0 → 100644
View file @
aebe688a
<
template
>
<!-- 收货详情 -->
<view
class=
"ware-house"
>
<u-navbar
back-icon-color=
"#333333"
background=
"#FFFFFF"
title=
"盘点"
titleColor=
"#333333"
:border-bottom=
"false"
title-bold
></u-navbar>
<view
class=
"tools-box"
>
<text
class=
"tools-box-title"
>
品牌
</text>
<view
class=
"select-view"
>
<xh-picker-select
background=
"#f4f5f7"
placeholder=
"全部"
border
width=
"100%"
:list=
"brandList"
:disabled=
"disabled"
:value=
"form.brandId"
:rangeKey=
"rangeKey"
@
change=
"pickerchange"
></xh-picker-select>
</view>
</view>
<!-- 列表 -->
<view
class=
"tab-view"
>
<receive-qr-code
@
onScanCodeChange=
"onScanCodeChange"
></receive-qr-code>
<receive-images
ref=
"receive-images"
@
updateImages=
"updateImages"
></receive-images>
</view>
<!-- 底部按钮 -->
<fixed-button
text=
"保存并下一个"
@
handleClick=
"submit"
></fixed-button>
<!-- 通用提示框 -->
<view><u-toast
ref=
"uToast"
/></view>
</view>
</
template
>
<
script
>
import
XhPickerSelect
from
'./components/XhPickerSelect.vue'
;
import
FixedButton
from
'@/components/mine/fixed-button.vue'
;
import
ReceiveQrCode
from
'./components/receiveDetail/receiveQrCode.vue'
;
import
ReceiveImages
from
'./components/receiveDetail/receiveImages.vue'
;
import
{
receiveStatusOptions
}
from
'@/common/optinos/mine/received.js'
;
import
{
showToast
}
from
'@/common/common.js'
;
export
default
{
components
:
{
XhPickerSelect
,
FixedButton
,
ReceiveQrCode
,
ReceiveImages
},
data
()
{
return
{
receiveStatusOptions
,
rangeKey
:
'name'
,
brandList
:
[
{
id
:
0
,
name
:
'全部'
},
{
id
:
982
,
name
:
'长城'
}
],
form
:
{
id
:
''
,
takeId
:
''
,
brandId
:
''
,
brandName
:
''
,
productCode
:
''
,
// 箱码二维码
image
:
''
// 箱码图片
}
};
},
computed
:
{},
onLoad
(
e
)
{
this
.
getBrandList
();
if
(
e
&&
e
.
id
)
{
this
.
form
.
id
=
e
.
id
;
this
.
getDetail
();
this
.
disabled
=
true
;
}
},
onShow
()
{},
methods
:
{
pickerchange
(
data
)
{
this
.
form
.
brandId
=
data
.
id
;
this
.
form
.
brandName
=
data
.
brandName
;
},
onScanCodeChange
(
data
)
{
this
.
form
.
productCode
=
data
;
},
updateImages
(
data
)
{
let
image
=
data
.
map
(
item
=>
process
.
uniEnv
.
qn_asset_url
+
'/'
+
item
.
src
+
'?imageView2/1/w/100/h/100/q/75'
);
this
.
form
.
image
=
image
.
join
(
";"
);
},
// 获取品牌列表
async
getBrandList
()
{
let
res
=
await
this
.
$u
.
api
.
brandListByReceivedModules
();
let
{
code
,
data
}
=
res
;
if
(
code
===
200
)
{
this
.
brandList
=
data
||
[];
}
},
async
getDetail
()
{
let
res
=
await
this
.
$u
.
api
.
inventoryDetailByInventoryModules
(
this
.
form
.
id
);
let
{
code
,
data
}
=
res
;
if
(
code
===
200
)
{
let
image
=
data
.
image
.
split
(
';'
).
map
(
item
=>
{
return
{
path
:
item
};
});
this
.
$refs
[
'receive-images'
].
initImages
(
image
);
this
.
form
=
Object
.
assign
(
this
.
form
,
data
);
}
},
submit
()
{
let
{
brandId
,
productCode
,
image
}
=
this
.
form
;
if
(
!
brandId
)
{
showToast
(
'请选择品牌'
);
return
false
;
}
if
(
!
productCode
)
{
showToast
(
'请输入箱码'
);
return
false
;
}
if
(
!
image
)
{
showToast
(
'最少上传一张图片'
);
return
false
;
}
this
.
$u
.
throttle
(
this
.
createdReceive
(
this
.
form
),
300
)
},
async
createdReceive
(
form
)
{
let
res
=
await
this
.
$u
.
api
.
addInventoryByInventoryModules
(
form
)
let
{
code
,
data
}
=
res
;
if
(
code
===
200
)
{
showToast
(
'操作成功'
);
setTimeout
(()
=>
{
this
.
replacePage
()
},
1500
);
}
},
// 刷新当前页
replacePage
()
{
uni
.
redirectTo
({
url
:
'pages/mine/warehouse/receiveDetail'
});
}
}
};
</
script
>
<
style
lang=
"scss"
scoped
>
.ware-house
{
padding
:
0
30rpx
;
display
:
flex
;
flex-direction
:
column
;
margin-bottom
:
100rpx
;
padding-bottom
:
constant
(
safe-area-inset-bottom
);
/*
兼容
iOS
<
11
.
2
*/
padding-bottom
:
env
(
safe-area-inset-bottom
);
/* 兼容 iOS >= 11.2 */
.tools-box
{
width
:
100%
;
height
:
100rpx
;
border-radius
:
12rpx
;
display
:
flex
;
align-items
:
center
;
margin-bottom
:
30rpx
;
padding
:
0
30rpx
;
background-color
:
#ffffff
;
.tools-box-title
{
font-size
:
28rpx
;
margin-right
:
20rpx
;
width
:
58rpx
;
}
.select-view
{
width
:
552rpx
;
}
}
}
</
style
>
src/pages/mine/warehouse/receiveDetail.vue
0 → 100644
View file @
aebe688a
<
template
>
<!-- 收货详情 -->
<view
class=
"ware-house"
>
<u-navbar
back-icon-color=
"#333333"
background=
"#FFFFFF"
title=
"收货"
titleColor=
"#333333"
:border-bottom=
"false"
title-bold
></u-navbar>
<view
class=
"tools-box"
>
<text
class=
"tools-box-title"
>
品牌
</text>
<view
class=
"select-view"
>
<xh-picker-select
background=
"#f4f5f7"
placeholder=
"全部"
border
width=
"100%"
:disabled=
"disabled"
:value=
"form.brandId"
:rangeKey=
"rangeKey"
:list=
"brandList"
@
change=
"pickerchange"
></xh-picker-select>
</view>
</view>
<!-- 列表 -->
<view
class=
"tab-view"
>
<receive-qr-code
:disabled=
"disabled"
:value=
"form.productCode"
@
onScanCodeChange=
"onScanCodeChange"
></receive-qr-code>
<receive-images
ref=
"receive-images"
:disabled=
"disabled"
:value=
"form.image"
@
updateImages=
"updateImages"
></receive-images>
<receive-bar-code
:disabled=
"disabled"
:value=
"form.courierNumber"
@
onBarCodeChange=
"onBarCodeChange"
></receive-bar-code>
</view>
<!-- 底部按钮 -->
<fixed-button
text=
"保存并下一个"
v-if=
"!disabled"
@
handleClick=
"submit"
></fixed-button>
<!-- 通用提示框 -->
<view><u-toast
ref=
"uToast"
/></view>
</view>
</
template
>
<
script
>
import
XhPickerSelect
from
'./components/XhPickerSelect.vue'
;
import
FixedButton
from
'@/components/mine/fixed-button.vue'
;
import
ReceiveQrCode
from
'./components/receiveDetail/receiveQrCode.vue'
;
import
ReceiveBarCode
from
'./components/receiveDetail/receiveBarCode.vue'
;
import
ReceiveImages
from
'./components/receiveDetail/receiveImages.vue'
;
import
{
receiveStatusOptions
}
from
'@/common/optinos/mine/received.js'
;
import
{
showToast
}
from
'@/common/common.js'
;
export
default
{
components
:
{
XhPickerSelect
,
FixedButton
,
ReceiveQrCode
,
ReceiveBarCode
,
ReceiveImages
},
data
()
{
return
{
receiveStatusOptions
,
rangeKey
:
'name'
,
brandList
:
[],
disabled
:
false
,
form
:
{
id
:
''
,
brandId
:
''
,
brandName
:
""
,
productCode
:
''
,
// 箱码二维码
image
:
""
,
// 箱码图片
courierNumber
:
''
// 快递单号
}
};
},
computed
:
{},
onLoad
(
e
)
{
this
.
getBrandList
();
if
(
e
&&
e
.
id
)
{
this
.
form
.
id
=
e
.
id
;
this
.
getDetail
();
this
.
disabled
=
true
;
}
},
onShow
()
{},
methods
:
{
pickerchange
(
data
)
{
this
.
form
.
brandId
=
data
.
id
;
this
.
form
.
brandName
=
data
.
brandName
;
},
onScanCodeChange
(
data
)
{
this
.
form
.
productCode
=
data
;
},
onBarCodeChange
(
data
)
{
this
.
form
.
courierNumber
=
data
;
},
updateImages
(
data
)
{
let
image
=
data
.
map
(
item
=>
process
.
uniEnv
.
qn_asset_url
+
'/'
+
item
.
src
+
'?imageView2/1/w/100/h/100/q/75'
);
this
.
form
.
image
=
image
.
join
(
";"
);
},
// 获取品牌列表
async
getBrandList
()
{
let
res
=
await
this
.
$u
.
api
.
brandListByReceivedModules
();
let
{
code
,
data
}
=
res
;
if
(
code
===
200
)
{
this
.
brandList
=
data
||
[];
}
},
async
getDetail
()
{
let
res
=
await
this
.
$u
.
api
.
receiveDetailByReceivedModules
(
this
.
form
.
id
);
let
{
code
,
data
}
=
res
;
if
(
code
===
200
)
{
let
image
=
data
.
image
.
split
(
';'
).
map
(
item
=>
{
return
{
path
:
item
};
});
this
.
$refs
[
'receive-images'
].
initImages
(
image
);
this
.
form
=
Object
.
assign
(
this
.
form
,
data
);
}
},
submit
()
{
console
.
log
(
this
.
form
)
let
{
brandId
,
productCode
,
courierNumber
,
image
}
=
this
.
form
;
if
(
!
brandId
)
{
showToast
(
'请选择品牌'
);
return
false
;
}
if
(
!
productCode
)
{
showToast
(
'请输入箱码'
);
return
false
;
}
if
(
!
image
)
{
showToast
(
'最少上传一张图片'
);
return
false
;
}
if
(
!
courierNumber
)
{
showToast
(
'请输入快递单号'
);
return
false
;
}
this
.
$u
.
throttle
(
this
.
createdReceive
(
this
.
form
),
300
)
},
async
createdReceive
(
form
)
{
let
res
=
await
this
.
$u
.
api
.
addReceiveByReceivedModules
(
form
)
let
{
code
,
data
}
=
res
;
if
(
code
===
200
)
{
showToast
(
'操作成功'
);
setTimeout
(()
=>
{
this
.
replacePage
()
},
1500
);
}
},
// 刷新当前页
replacePage
()
{
uni
.
redirectTo
({
url
:
'pages/mine/warehouse/receiveDetail'
});
}
}
};
</
script
>
<
style
lang=
"scss"
scoped
>
.ware-house
{
padding
:
0
30rpx
;
display
:
flex
;
flex-direction
:
column
;
margin-bottom
:
100rpx
;
padding-bottom
:
constant
(
safe-area-inset-bottom
);
/*
兼容
iOS
<
11
.
2
*/
padding-bottom
:
env
(
safe-area-inset-bottom
);
/* 兼容 iOS >= 11.2 */
.tools-box
{
width
:
100%
;
height
:
100rpx
;
border-radius
:
12rpx
;
display
:
flex
;
align-items
:
center
;
margin-bottom
:
30rpx
;
padding
:
0
30rpx
;
background-color
:
#ffffff
;
.tools-box-title
{
font-size
:
28rpx
;
margin-right
:
20rpx
;
width
:
58rpx
;
}
.select-view
{
width
:
552rpx
;
}
}
}
</
style
>
src/pages/mine/warehouse/received.vue
0 → 100644
View file @
aebe688a
<
template
>
<!-- 收货列表 -->
<view
class=
"ware-house"
>
<u-navbar
back-icon-color=
"#333333"
background=
"#FFFFFF"
title=
"收货列表"
titleColor=
"#333333"
:border-bottom=
"false"
title-bold
></u-navbar>
<received-head
ref=
"received-head"
:current
.
sync=
"form.status"
:value=
"form.brandId"
@
currentChange=
"currentChange"
@
pickerchange=
"pickerchange"
></received-head>
<!-- 列表 -->
<view
class=
"tab-view"
>
<scroll-view
scroll-y
style=
"height: 100%;width: 100%;"
@
scrolltolower=
"reachBottom"
scroll-anchoring
refresher-enabled=
"true"
:refresher-triggered=
"triggered"
:refresher-threshold=
"100"
:scroll-top=
"scrollTop"
refresher-background=
"#F4F5F7"
@
refresherrefresh=
"onRefresh"
@
refresherrestore=
"onRestore"
@
scroll=
"scroll"
enable-back-to-top
>
<NoOrder
v-if=
"noParts"
imageName=
"zwdd.png"
:customStyle=
"noOrderCustomStyle"
/>
<template
v-else
>
<view
v-for=
"(item, index) in list"
:key=
"index"
><receiving-info
:detail=
"item"
@
handleClick=
"handleClick"
></receiving-info></view>
<view
class=
"load-more-view"
v-show=
"(form.pageNumber == 1 && loaded) || form.pageNumber > 1"
><u-loadmore
:status=
"loadStatus"
bgColor=
"#F4F5F7"
></u-loadmore></view>
</
template
>
<view
class=
"loading-view"
v-if=
"!loaded && !freshing"
><u-loading
mode=
"flower"
></u-loading></view>
</scroll-view>
</view>
<!-- 底部按钮 -->
<fixed-button
text=
"新增收货"
@
handleClick=
"toAdd"
></fixed-button>
<!-- 通用提示框 -->
<view><u-toast
ref=
"uToast"
/></view>
</view>
</template>
<
script
>
import
ReceivedHead
from
'./components/received/receivedHead.vue'
;
import
FixedButton
from
'@/components/mine/fixed-button.vue'
;
import
ReceivingInfo
from
'./components/received/receivingInfo.vue'
;
import
NoOrder
from
'@/components/order/noOrder.vue'
;
import
ApplyButton
from
'@/components/parts/applyButton.vue'
;
import
{
receiveStatusOptions
}
from
'@/common/optinos/mine/received.js'
;
export
default
{
components
:
{
ReceivedHead
,
ReceivingInfo
,
NoOrder
,
ApplyButton
,
FixedButton
},
data
()
{
return
{
receiveStatusOptions
,
list
:
[
{
id
:
123456
,
status
:
"未使用"
,
productCode
:
'dsadq4231'
,
brandName
:
'比亚迪'
,
courierNumber
:
"SF7720"
},
{
id
:
1111
,
status
:
"未使用"
,
productCode
:
'dsadq4231'
,
brandName
:
'比亚迪'
,
courierNumber
:
"SF7720"
},
{
id
:
1111
,
status
:
"未使用"
,
productCode
:
'dsadq4231'
,
brandName
:
'比亚迪'
,
courierNumber
:
"SF7720"
},
{
id
:
1111
,
status
:
"未使用"
,
productCode
:
'dsadq4231'
,
brandName
:
'比亚迪'
,
courierNumber
:
"SF7720"
},
],
// 物料订单列表
form
:
{
pageNumber
:
0
,
pageSize
:
10
,
status
:
0
,
brandId
:
982
,
},
show
:
false
,
loadStatus
:
'loading'
,
// 底部加载状态
loaded
:
false
,
// 页面加载
triggered
:
true
,
// true:下拉刷新
freshing
:
false
,
// 防止下拉刷新重复触发
buttonType
:
'expand'
,
// 申请按钮宽 collapse': '80rpx', 'expand': '220rpx''
scrollTop
:
0
,
old
:
{
scrollTop
:
0
},
buttonStyle
:
{
width
:
'100%'
,
height
:
'80rpx'
,
fontSize
:
'32rpx'
,
fontWeight
:
'bold'
}
};
},
computed
:
{
// 当下tab
currentTab
()
{
return
this
.
receiveStatusOptions
[
this
.
form
.
status
];
},
// 无数据
noParts
()
{
return
this
.
list
.
length
==
0
&&
this
.
loaded
;
},
// 无数据页面样式
noPartsCustomStyle
()
{
return
'margin-top: 100rpx;background-color: #F4F5F7'
;
}
},
onLoad
(
e
)
{
// getApp().trackPage('物料订单页');
// if (e && e.index) {
// // 跳转到第几个tab页
// this.status = e.index;
// }
this
.
freshing
=
false
;
this
.
getBrandList
()
// 获取品牌列表
this
.
reloadList
();
// 加载数据
},
onShow
()
{
let
pages
=
getCurrentPages
();
let
page
=
pages
[
pages
.
length
-
1
];
if
(
page
.
needRefresh
)
{
// 需要初始化页面
page
.
needRefresh
=
null
;
this
.
form
.
status
=
0
;
this
.
reloadList
();
}
},
methods
:
{
// tab栏切换
currentChange
()
{
this
.
reloadList
();
},
pickerchange
(
data
)
{
this
.
form
.
brandId
=
data
.
id
||
""
;
this
.
reloadList
();
},
// 获取品牌列表
getBrandList
(){
this
.
$refs
[
"received-head"
].
getBrandList
()
},
// 页面数据:收货列表
async
getList
()
{
// 状态处理
this
.
form
.
pageNumber
+=
1
;
if
(
this
.
form
.
pageNumber
==
1
)
{
this
.
loaded
=
false
;
}
var
param
=
this
.
form
let
res
=
await
this
.
$u
.
api
.
receiveListByReceivedModules
(
param
);
if
(
res
.
code
==
200
)
{
if
(
this
.
form
.
pageNumber
==
1
)
{
this
.
list
=
[];
}
let
list
=
res
.
data
||
[];
this
.
list
.
push
(...
list
);
this
.
loadStatus
=
list
.
length
<
this
.
pageSize
?
'nomore'
:
'loadmore'
;
// 底部加载状态
}
else
{
// this.loadStatus = 'loadmore';
console
.
log
(
res
.
message
);
}
this
.
$nextTick
(()
=>
{
// 页面刷新完之后更新下拉状态
if
(
this
.
freshing
)
{
this
.
triggered
=
false
;
this
.
freshing
=
false
;
}
});
this
.
loaded
=
true
;
// 加载完成
},
// 跳转到详情
handleClick
(
id
)
{
let
url
=
'pages/mine/warehouse/receiveDetail'
;
if
(
id
)
url
+=
`?id=
${
id
}
`
;
uni
.
navigateTo
({
url
});
},
// 新增收货
toAdd
()
{
this
.
handleClick
();
},
// 本页数据设置,用于其他页面访问本页数据
setPageInfo
(
info
)
{
var
pages
=
getCurrentPages
();
if
(
pages
.
length
>=
1
)
{
var
page
=
pages
[
pages
.
length
-
1
];
page
.
info
=
info
;
}
},
// 下拉刷新
onRefresh
()
{
if
(
this
.
freshing
)
return
;
this
.
freshing
=
true
;
this
.
reloadList
();
},
// 重置下拉状态
onRestore
()
{
this
.
triggered
=
'restore'
;
// 需要重置
},
// 初始化加载
reloadList
()
{
// 第一页数据
this
.
form
.
pageNumber
=
0
;
this
.
loadStatus
=
'loading'
;
this
.
getList
();
},
// 滚到底部加载下一页
reachBottom
(
e
)
{
if
(
this
.
loadStatus
!=
'loadmore'
)
return
;
this
.
loadStatus
==
'loading'
;
this
.
getList
();
},
scroll
(
e
)
{
// this.old.scrollTop = e.detail.scrollTop;
}
}
};
</
script
>
<
style
lang=
"scss"
scoped
>
.ware-house
{
padding
:
0
30rpx
;
height
:
100vh
;
// min-height: 100vh;
display
:
flex
;
flex-direction
:
column
;
padding-bottom
:
constant
(
safe-area-inset-bottom
);
/*
兼容
iOS
<
11
.
2
*/
padding-bottom
:
env
(
safe-area-inset-bottom
);
/* 兼容 iOS >= 11.2 */
.tab-view
{
height
:
100%
;
overflow
:
auto
;
margin-bottom
:
100rpx
;
padding-bottom
:
constant
(
safe-area-inset-bottom
);
/*
兼容
iOS
<
11
.
2
*/
padding-bottom
:
env
(
safe-area-inset-bottom
);
/* 兼容 iOS >= 11.2 */
.load-more-view
{
padding-bottom
:
64rpx
;
}
.loading-view
{
width
:
100%
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
margin-top
:
300rpx
;
position
:
absolute
;
}
}
.fixed-button
{
width
:
100%
;
box-sizing
:
border-box
;
position
:
fixed
;
left
:
0
;
padding
:
0
30rpx
;
padding-bottom
:
constant
(
safe-area-inset-bottom
);
/*
兼容
iOS
<
11
.
2
*/
padding-bottom
:
env
(
safe-area-inset-bottom
);
/* 兼容 iOS >= 11.2 */
bottom
:
20rpx
;
}
}
</
style
>
src/uni_modules/uni-scss/changelog.md
0 → 100644
View file @
aebe688a
## 1.0.3(2022-01-21)
-
优化 组件示例
## 1.0.2(2021-11-22)
-
修复 / 符号在 vue 不同版本兼容问题引起的报错问题
## 1.0.1(2021-11-22)
-
修复 vue3中scss语法兼容问题
## 1.0.0(2021-11-18)
-
init
src/uni_modules/uni-scss/index.scss
0 → 100644
View file @
aebe688a
@import
'./styles/index.scss'
;
src/uni_modules/uni-scss/package.json
0 → 100644
View file @
aebe688a
{
"id"
:
"uni-scss"
,
"displayName"
:
"uni-scss 辅助样式"
,
"version"
:
"1.0.3"
,
"description"
:
"uni-sass是uni-ui提供的一套全局样式 ,通过一些简单的类名和sass变量,实现简单的页面布局操作,比如颜色、边距、圆角等。"
,
"keywords"
:
[
"uni-scss"
,
"uni-ui"
,
"辅助样式"
],
"repository"
:
"https://github.com/dcloudio/uni-ui"
,
"engines"
:
{
"HBuilderX"
:
"^3.1.0"
},
"dcloudext"
:
{
"category"
:
[
"JS SDK"
,
"通用 SDK"
],
"sale"
:
{
"regular"
:
{
"price"
:
"0.00"
},
"sourcecode"
:
{
"price"
:
"0.00"
}
},
"contact"
:
{
"qq"
:
""
},
"declaration"
:
{
"ads"
:
"无"
,
"data"
:
"无"
,
"permissions"
:
"无"
},
"npmurl"
:
"https://www.npmjs.com/package/@dcloudio/uni-ui"
},
"uni_modules"
:
{
"dependencies"
:
[],
"encrypt"
:
[],
"platforms"
:
{
"cloud"
:
{
"tcb"
:
"y"
,
"aliyun"
:
"y"
},
"client"
:
{
"App"
:
{
"app-vue"
:
"y"
,
"app-nvue"
:
"u"
},
"H5-mobile"
:
{
"Safari"
:
"y"
,
"Android Browser"
:
"y"
,
"微信浏览器(Android)"
:
"y"
,
"QQ浏览器(Android)"
:
"y"
},
"H5-pc"
:
{
"Chrome"
:
"y"
,
"IE"
:
"y"
,
"Edge"
:
"y"
,
"Firefox"
:
"y"
,
"Safari"
:
"y"
},
"小程序"
:
{
"微信"
:
"y"
,
"阿里"
:
"y"
,
"百度"
:
"y"
,
"字节跳动"
:
"y"
,
"QQ"
:
"y"
},
"快应用"
:
{
"华为"
:
"n"
,
"联盟"
:
"n"
},
"Vue"
:
{
"vue2"
:
"y"
,
"vue3"
:
"y"
}
}
}
}
}
src/uni_modules/uni-scss/readme.md
0 → 100644
View file @
aebe688a
`uni-sass`
是
`uni-ui`
提供的一套全局样式 ,通过一些简单的类名和
`sass`
变量,实现简单的页面布局操作,比如颜色、边距、圆角等。
### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-sass)
#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839
\ No newline at end of file
src/uni_modules/uni-scss/styles/index.scss
0 → 100644
View file @
aebe688a
@import
'./setting/_variables.scss'
;
@import
'./setting/_border.scss'
;
@import
'./setting/_color.scss'
;
@import
'./setting/_space.scss'
;
@import
'./setting/_radius.scss'
;
@import
'./setting/_text.scss'
;
@import
'./setting/_styles.scss'
;
src/uni_modules/uni-scss/styles/setting/_border.scss
0 → 100644
View file @
aebe688a
.uni-border
{
border
:
1px
$uni-border-1
solid
;
}
\ No newline at end of file
src/uni_modules/uni-scss/styles/setting/_color.scss
0 → 100644
View file @
aebe688a
// TODO 暂时不需要 class ,需要用户使用变量实现 ,如果使用类名其实并不推荐
// @mixin get-styles($k,$c) {
// @if $k == size or $k == weight{
// font-#{$k}:#{$c}
// }@else{
// #{$k}:#{$c}
// }
// }
$uni-ui-color
:(
//
主色
primary
:
$uni-primary
,
primary-disable
:
$uni-primary-disable
,
primary-light
:
$uni-primary-light
,
//
辅助色
success
:
$uni-success
,
success-disable
:
$uni-success-disable
,
success-light
:
$uni-success-light
,
warning
:
$uni-warning
,
warning-disable
:
$uni-warning-disable
,
warning-light
:
$uni-warning-light
,
error
:
$uni-error
,
error-disable
:
$uni-error-disable
,
error-light
:
$uni-error-light
,
info
:
$uni-info
,
info-disable
:
$uni-info-disable
,
info-light
:
$uni-info-light
,
//
中性色
main-color
:
$uni-main-color
,
base-color
:
$uni-base-color
,
secondary-color
:
$uni-secondary-color
,
extra-color
:
$uni-extra-color
,
//
背景色
bg-color
:
$uni-bg-color
,
//
边框颜色
border-1
:
$uni-border-1
,
border-2
:
$uni-border-2
,
border-3
:
$uni-border-3
,
border-4
:
$uni-border-4
,
//
黑色
black
:
$uni-black
,
//
白色
white
:
$uni-white
,
//
透明
transparent
:
$uni-transparent
)
!
default
;
@each
$key
,
$child
in
$uni-ui-color
{
.uni-
#{
""
+
$key
}
{
color
:
$child
;
}
.uni-
#{
""
+
$key
}
-bg
{
background-color
:
$child
;
}
}
.uni-shadow-sm
{
box-shadow
:
$uni-shadow-sm
;
}
.uni-shadow-base
{
box-shadow
:
$uni-shadow-base
;
}
.uni-shadow-lg
{
box-shadow
:
$uni-shadow-lg
;
}
.uni-mask
{
background-color
:
$uni-mask
;
}
src/uni_modules/uni-scss/styles/setting/_radius.scss
0 → 100644
View file @
aebe688a
@mixin
radius
(
$r
,
$d
:
null
,
$important
:
false
){
$radius-value
:
map-get
(
$uni-radius
,
$r
)
if
(
$important
,
!
important
,
null
);
// Key exists within the $uni-radius variable
@if
(
map-has-key
(
$uni-radius
,
$r
)
and
$d
){
@if
$d
==
t
{
border-top-left-radius
:
$radius-value
;
border-top-right-radius
:
$radius-value
;
}
@else
if
$d
==
r
{
border-top-right-radius
:
$radius-value
;
border-bottom-right-radius
:
$radius-value
;
}
@else
if
$d
==
b
{
border-bottom-left-radius
:
$radius-value
;
border-bottom-right-radius
:
$radius-value
;
}
@else
if
$d
==
l
{
border-top-left-radius
:
$radius-value
;
border-bottom-left-radius
:
$radius-value
;
}
@else
if
$d
==
tl
{
border-top-left-radius
:
$radius-value
;
}
@else
if
$d
==
tr
{
border-top-right-radius
:
$radius-value
;
}
@else
if
$d
==
br
{
border-bottom-right-radius
:
$radius-value
;
}
@else
if
$d
==
bl
{
border-bottom-left-radius
:
$radius-value
;
}
}
@else
{
border-radius
:
$radius-value
;
}
}
@each
$key
,
$child
in
$uni-radius
{
@if
(
$key
){
.uni-radius-
#{
""
+
$key
}
{
@include
radius
(
$key
)
}
}
@else
{
.uni-radius
{
@include
radius
(
$key
)
}
}
}
@each
$direction
in
t
,
r
,
b
,
l
,
tl
,
tr
,
br
,
bl
{
@each
$key
,
$child
in
$uni-radius
{
@if
(
$key
){
.uni-radius-
#{
""
+
$direction
}
-
#{
""
+
$key
}
{
@include
radius
(
$key
,
$direction
,
false
)
}
}
@else
{
.uni-radius-
#{
$direction
}
{
@include
radius
(
$key
,
$direction
,
false
)
}
}
}
}
src/uni_modules/uni-scss/styles/setting/_space.scss
0 → 100644
View file @
aebe688a
@mixin
fn
(
$space
,
$direction
,
$size
,
$n
)
{
@if
$n
{
#{
$space
}
-
#{
$direction
}
:
#{
$size
*
$uni-space-root
}
px
}
@else
{
#{
$space
}
-
#{
$direction
}
:
#{
-
$size
*
$uni-space-root
}
px
}
}
@mixin
get-styles
(
$direction
,
$i
,
$space
,
$n
){
@if
$direction
==
t
{
@include
fn
(
$space
,
top
,
$i
,
$n
);
}
@if
$direction
==
r
{
@include
fn
(
$space
,
right
,
$i
,
$n
);
}
@if
$direction
==
b
{
@include
fn
(
$space
,
bottom
,
$i
,
$n
);
}
@if
$direction
==
l
{
@include
fn
(
$space
,
left
,
$i
,
$n
);
}
@if
$direction
==
x
{
@include
fn
(
$space
,
left
,
$i
,
$n
);
@include
fn
(
$space
,
right
,
$i
,
$n
);
}
@if
$direction
==
y
{
@include
fn
(
$space
,
top
,
$i
,
$n
);
@include
fn
(
$space
,
bottom
,
$i
,
$n
);
}
@if
$direction
==
a
{
@if
$n
{
#{
$space
}
:
#{
$i
*
$uni-space-root
}
px
;
}
@else
{
#{
$space
}
:
#{
-
$i
*
$uni-space-root
}
px
;
}
}
}
@each
$orientation
in
m
,
p
{
$space
:
margin
;
@if
$orientation
==
m
{
$space
:
margin
;
}
@else
{
$space
:
padding
;
}
@for
$i
from
0
through
16
{
@each
$direction
in
t
,
r
,
b
,
l
,
x
,
y
,
a
{
.uni-
#{
$orientation
}#{
$direction
}
-
#{
$i
}
{
@include
get-styles
(
$direction
,
$i
,
$space
,
true
);
}
.uni-
#{
$orientation
}#{
$direction
}
-n
#{
$i
}
{
@include
get-styles
(
$direction
,
$i
,
$space
,
false
);
}
}
}
}
\ No newline at end of file
src/uni_modules/uni-scss/styles/setting/_styles.scss
0 → 100644
View file @
aebe688a
/* #ifndef APP-NVUE */
$-color-white
:
#fff
;
$-color-black
:
#000
;
@mixin
base-style
(
$color
)
{
color
:
#fff
;
background-color
:
$color
;
border-color
:
mix
(
$-color-black
,
$color
,
8%
);
&
:not
([
hover-class
])
:active
{
background
:
mix
(
$-color-black
,
$color
,
10%
);
border-color
:
mix
(
$-color-black
,
$color
,
20%
);
color
:
$-color-white
;
outline
:
none
;
}
}
@mixin
is-color
(
$color
)
{
@include
base-style
(
$color
);
&
[
loading
]
{
@include
base-style
(
$color
);
&
:
:
before
{
margin-right
:
5px
;
}
}
&
[
disabled
]
{
&
,
&
[
loading
],
&
:not
([
hover-class
])
:active
{
color
:
$-color-white
;
border-color
:
mix
(
darken
(
$color
,
10%
)
,
$-color-white
);
background-color
:
mix
(
$color
,
$-color-white
);
}
}
}
@mixin
base-plain-style
(
$color
)
{
color
:
$color
;
background-color
:
mix
(
$-color-white
,
$color
,
90%
);
border-color
:
mix
(
$-color-white
,
$color
,
70%
);
&
:not
([
hover-class
])
:active
{
background
:
mix
(
$-color-white
,
$color
,
80%
);
color
:
$color
;
outline
:
none
;
border-color
:
mix
(
$-color-white
,
$color
,
50%
);
}
}
@mixin
is-plain
(
$color
){
&
[
plain
]
{
@include
base-plain-style
(
$color
);
&
[
loading
]
{
@include
base-plain-style
(
$color
);
&
:
:
before
{
margin-right
:
5px
;
}
}
&
[
disabled
]
{
&
,
&
:active
{
color
:
mix
(
$-color-white
,
$color
,
40%
);
background-color
:
mix
(
$-color-white
,
$color
,
90%
);
border-color
:
mix
(
$-color-white
,
$color
,
80%
);
}
}
}
}
.uni-btn
{
margin
:
5px
;
color
:
#393939
;
border
:
1px
solid
#ccc
;
font-size
:
16px
;
font-weight
:
200
;
background-color
:
#F9F9F9
;
// TODO 暂时处理边框隐藏一边的问题
overflow
:
visible
;
&
:
:
after
{
border
:
none
;
}
&
:not
([
type
]),
&
[
type
=
default
]
{
color
:
#999
;
&
[
loading
]
{
background
:
none
;
&
:
:
before
{
margin-right
:
5px
;
}
}
&
[
disabled
]
{
color
:
mix
(
$-color-white
,
#999
,
60%
);
&
,
&
[
loading
],
&
:active
{
color
:
mix
(
$-color-white
,
#999
,
60%
);
background-color
:
mix
(
$-color-white
,
$-color-black
,
98%
);
border-color
:
mix
(
$-color-white
,
#999
,
85%
);
}
}
&
[
plain
]
{
color
:
#999
;
background
:
none
;
border-color
:
$uni-border-1
;
&
:not
([
hover-class
])
:active
{
background
:
none
;
color
:
mix
(
$-color-white
,
$-color-black
,
80%
);
border-color
:
mix
(
$-color-white
,
$-color-black
,
90%
);
outline
:
none
;
}
&
[
disabled
]
{
&
,
&
[
loading
],
&
:active
{
background
:
none
;
color
:
mix
(
$-color-white
,
#999
,
60%
);
border-color
:
mix
(
$-color-white
,
#999
,
85%
);
}
}
}
}
&
:not
([
hover-class
])
:active
{
color
:
mix
(
$-color-white
,
$-color-black
,
50%
);
}
&
[
size
=
mini
]
{
font-size
:
16px
;
font-weight
:
200
;
border-radius
:
8px
;
}
&
.uni-btn-small
{
font-size
:
14px
;
}
&
.uni-btn-mini
{
font-size
:
12px
;
}
&
.uni-btn-radius
{
border-radius
:
999px
;
}
&
[
type
=
primary
]
{
@include
is-color
(
$uni-primary
);
@include
is-plain
(
$uni-primary
)
}
&
[
type
=
success
]
{
@include
is-color
(
$uni-success
);
@include
is-plain
(
$uni-success
)
}
&
[
type
=
error
]
{
@include
is-color
(
$uni-error
);
@include
is-plain
(
$uni-error
)
}
&
[
type
=
warning
]
{
@include
is-color
(
$uni-warning
);
@include
is-plain
(
$uni-warning
)
}
&
[
type
=
info
]
{
@include
is-color
(
$uni-info
);
@include
is-plain
(
$uni-info
)
}
}
/* #endif */
src/uni_modules/uni-scss/styles/setting/_text.scss
0 → 100644
View file @
aebe688a
@mixin
get-styles
(
$k
,
$c
)
{
@if
$k
==
size
or
$k
==
weight
{
font-
#{
$k
}
:
#{
$c
}
}
@else
{
#{
$k
}
:
#{
$c
}
}
}
@each
$key
,
$child
in
$uni-headings
{
/* #ifndef APP-NVUE */
.uni-
#{
$key
}
{
@each
$k
,
$c
in
$child
{
@include
get-styles
(
$k
,
$c
)
}
}
/* #endif */
/* #ifdef APP-NVUE */
.container
.uni-
#{
$key
}
{
@each
$k
,
$c
in
$child
{
@include
get-styles
(
$k
,
$c
)
}
}
/* #endif */
}
src/uni_modules/uni-scss/styles/setting/_variables.scss
0 → 100644
View file @
aebe688a
// @use "sass:math";
@import
'../tools/functions.scss'
;
// 间距基础倍数
$uni-space-root
:
2
!
default
;
// 边框半径默认值
$uni-radius-root
:
5px
!
default
;
$uni-radius
:
()
!
default
;
// 边框半径断点
$uni-radius
:
map-deep-merge
(
(
0
:
0
,
//
TODO
当前版本暂时不支持
sm
属性
//
'sm'
:
math
.
div
(
$uni-radius-root
,
2
)
,
null
:
$uni-radius-root
,
'lg'
:
$uni-radius-root
*
2
,
'xl'
:
$uni-radius-root
*
6
,
'pill'
:
9999px
,
'circle'
:
50%
)
,
$uni-radius
);
// 字体家族
$body-font-family
:
'Roboto'
,
sans-serif
!
default
;
// 文本
$heading-font-family
:
$body-font-family
!
default
;
$uni-headings
:
()
!
default
;
$letterSpacing
:
-0
.01562em
;
$uni-headings
:
map-deep-merge
(
(
'h1'
:
(
size
:
32px
,
weight
:
300
,
line-height
:
50px
,
//
letter-spacing
:-
0
.01562em
)
,
'h2'
:
(
size
:
28px
,
weight
:
300
,
line-height
:
40px
,
//
letter-spacing
:
-0
.00833em
)
,
'h3'
:
(
size
:
24px
,
weight
:
400
,
line-height
:
32px
,
//
letter-spacing
:
normal
)
,
'h4'
:
(
size
:
20px
,
weight
:
400
,
line-height
:
30px
,
//
letter-spacing
:
0
.00735em
)
,
'h5'
:
(
size
:
16px
,
weight
:
400
,
line-height
:
24px
,
//
letter-spacing
:
normal
)
,
'h6'
:
(
size
:
14px
,
weight
:
500
,
line-height
:
18px
,
//
letter-spacing
:
0
.0125em
)
,
'subtitle'
:
(
size
:
12px
,
weight
:
400
,
line-height
:
20px
,
//
letter-spacing
:
0
.00937em
)
,
'body'
:
(
font-size
:
14px
,
font-weight
:
400
,
line-height
:
22px
,
//
letter-spacing
:
0
.03125em
)
,
'caption'
:
(
'size'
:
12px
,
'weight'
:
400
,
'line-height'
:
20px
,
//
'letter-spacing'
:
0
.03333em
,
//
'text-transform'
:
false
)
)
,
$uni-headings
);
// 主色
$uni-primary
:
#2979ff
!
default
;
$uni-primary-disable
:
lighten
(
$uni-primary
,
20%
)
!
default
;
$uni-primary-light
:
lighten
(
$uni-primary
,
25%
)
!
default
;
// 辅助色
// 除了主色外的场景色,需要在不同的场景中使用(例如危险色表示危险的操作)。
$uni-success
:
#18bc37
!
default
;
$uni-success-disable
:
lighten
(
$uni-success
,
20%
)
!
default
;
$uni-success-light
:
lighten
(
$uni-success
,
25%
)
!
default
;
$uni-warning
:
#f3a73f
!
default
;
$uni-warning-disable
:
lighten
(
$uni-warning
,
20%
)
!
default
;
$uni-warning-light
:
lighten
(
$uni-warning
,
25%
)
!
default
;
$uni-error
:
#e43d33
!
default
;
$uni-error-disable
:
lighten
(
$uni-error
,
20%
)
!
default
;
$uni-error-light
:
lighten
(
$uni-error
,
25%
)
!
default
;
$uni-info
:
#8f939c
!
default
;
$uni-info-disable
:
lighten
(
$uni-info
,
20%
)
!
default
;
$uni-info-light
:
lighten
(
$uni-info
,
25%
)
!
default
;
// 中性色
// 中性色用于文本、背景和边框颜色。通过运用不同的中性色,来表现层次结构。
$uni-main-color
:
#3a3a3a
!
default
;
// 主要文字
$uni-base-color
:
#6a6a6a
!
default
;
// 常规文字
$uni-secondary-color
:
#909399
!
default
;
// 次要文字
$uni-extra-color
:
#c7c7c7
!
default
;
// 辅助说明
// 边框颜色
$uni-border-1
:
#F0F0F0
!
default
;
$uni-border-2
:
#EDEDED
!
default
;
$uni-border-3
:
#DCDCDC
!
default
;
$uni-border-4
:
#B9B9B9
!
default
;
// 常规色
$uni-black
:
#000000
!
default
;
$uni-white
:
#ffffff
!
default
;
$uni-transparent
:
rgba
(
$color
:
#000000
,
$alpha
:
0
)
!
default
;
// 背景色
$uni-bg-color
:
#f7f7f7
!
default
;
/* 水平间距 */
$uni-spacing-sm
:
8px
!
default
;
$uni-spacing-base
:
15px
!
default
;
$uni-spacing-lg
:
30px
!
default
;
// 阴影
$uni-shadow-sm
:
0
0
5px
rgba
(
$color
:
#d8d8d8
,
$alpha
:
0
.5
)
!
default
;
$uni-shadow-base
:
0
1px
8px
1px
rgba
(
$color
:
#a5a5a5
,
$alpha
:
0
.2
)
!
default
;
$uni-shadow-lg
:
0px
1px
10px
2px
rgba
(
$color
:
#a5a4a4
,
$alpha
:
0
.5
)
!
default
;
// 蒙版
$uni-mask
:
rgba
(
$color
:
#000000
,
$alpha
:
0
.4
)
!
default
;
src/uni_modules/uni-scss/styles/tools/functions.scss
0 → 100644
View file @
aebe688a
// 合并 map
@function
map-deep-merge
(
$parent-map
,
$child-map
){
$result
:
$parent-map
;
@each
$key
,
$child
in
$child-map
{
$parent-has-key
:
map-has-key
(
$result
,
$key
);
$parent-value
:
map-get
(
$result
,
$key
);
$parent-type
:
type-of
(
$parent-value
);
$child-type
:
type-of
(
$child
);
$parent-is-map
:
$parent-type
==
map
;
$child-is-map
:
$child-type
==
map
;
@if
(
not
$parent-has-key
)
or
(
$parent-type
!=
$child-type
)
or
(
not
(
$parent-is-map
and
$child-is-map
)){
$result
:
map-merge
(
$result
,
(
$key
:
$child
));
}
@else
{
$result
:
map-merge
(
$result
,
(
$key
:
map-deep-merge
(
$parent-value
,
$child
)
));
}
}
@return
$result
;
};
src/uni_modules/uni-scss/theme.scss
0 → 100644
View file @
aebe688a
// 间距基础倍数
$uni-space-root
:
2
;
// 边框半径默认值
$uni-radius-root
:
5px
;
// 主色
$uni-primary
:
#2979ff
;
// 辅助色
$uni-success
:
#4cd964
;
// 警告色
$uni-warning
:
#f0ad4e
;
// 错误色
$uni-error
:
#dd524d
;
// 描述色
$uni-info
:
#909399
;
// 中性色
$uni-main-color
:
#303133
;
$uni-base-color
:
#606266
;
$uni-secondary-color
:
#909399
;
$uni-extra-color
:
#C0C4CC
;
// 背景色
$uni-bg-color
:
#f5f5f5
;
// 边框颜色
$uni-border-1
:
#DCDFE6
;
$uni-border-2
:
#E4E7ED
;
$uni-border-3
:
#EBEEF5
;
$uni-border-4
:
#F2F6FC
;
// 常规色
$uni-black
:
#000000
;
$uni-white
:
#ffffff
;
$uni-transparent
:
rgba
(
$color
:
#000000
,
$alpha
:
0
);
src/uni_modules/uni-scss/variables.scss
0 → 100644
View file @
aebe688a
@import
'./styles/setting/_variables.scss'
;
// 间距基础倍数
$uni-space-root
:
2
;
// 边框半径默认值
$uni-radius-root
:
5px
;
// 主色
$uni-primary
:
#2979ff
;
$uni-primary-disable
:
mix
(
#fff
,
$uni-primary
,
50%
);
$uni-primary-light
:
mix
(
#fff
,
$uni-primary
,
80%
);
// 辅助色
// 除了主色外的场景色,需要在不同的场景中使用(例如危险色表示危险的操作)。
$uni-success
:
#18bc37
;
$uni-success-disable
:
mix
(
#fff
,
$uni-success
,
50%
);
$uni-success-light
:
mix
(
#fff
,
$uni-success
,
80%
);
$uni-warning
:
#f3a73f
;
$uni-warning-disable
:
mix
(
#fff
,
$uni-warning
,
50%
);
$uni-warning-light
:
mix
(
#fff
,
$uni-warning
,
80%
);
$uni-error
:
#e43d33
;
$uni-error-disable
:
mix
(
#fff
,
$uni-error
,
50%
);
$uni-error-light
:
mix
(
#fff
,
$uni-error
,
80%
);
$uni-info
:
#8f939c
;
$uni-info-disable
:
mix
(
#fff
,
$uni-info
,
50%
);
$uni-info-light
:
mix
(
#fff
,
$uni-info
,
80%
);
// 中性色
// 中性色用于文本、背景和边框颜色。通过运用不同的中性色,来表现层次结构。
$uni-main-color
:
#3a3a3a
;
// 主要文字
$uni-base-color
:
#6a6a6a
;
// 常规文字
$uni-secondary-color
:
#909399
;
// 次要文字
$uni-extra-color
:
#c7c7c7
;
// 辅助说明
// 边框颜色
$uni-border-1
:
#F0F0F0
;
$uni-border-2
:
#EDEDED
;
$uni-border-3
:
#DCDCDC
;
$uni-border-4
:
#B9B9B9
;
// 常规色
$uni-black
:
#000000
;
$uni-white
:
#ffffff
;
$uni-transparent
:
rgba
(
$color
:
#000000
,
$alpha
:
0
);
// 背景色
$uni-bg-color
:
#f7f7f7
;
/* 水平间距 */
$uni-spacing-sm
:
8px
;
$uni-spacing-base
:
15px
;
$uni-spacing-lg
:
30px
;
// 阴影
$uni-shadow-sm
:
0
0
5px
rgba
(
$color
:
#d8d8d8
,
$alpha
:
0
.5
);
$uni-shadow-base
:
0
1px
8px
1px
rgba
(
$color
:
#a5a5a5
,
$alpha
:
0
.2
);
$uni-shadow-lg
:
0px
1px
10px
2px
rgba
(
$color
:
#a5a4a4
,
$alpha
:
0
.5
);
// 蒙版
$uni-mask
:
rgba
(
$color
:
#000000
,
$alpha
:
0
.4
);
src/uni_modules/uni-swipe-action/changelog.md
0 → 100644
View file @
aebe688a
## 1.3.2(2022-03-16)
-
修复 h5和app端下报el错误的bug
## 1.3.1(2022-03-07)
-
修复 HBuilderX 1.4.X 版本中,h5和app端下报错的bug
## 1.3.0(2021-11-19)
-
优化 组件UI,并提供设计资源,详见:
[
https://uniapp.dcloud.io/component/uniui/resource
](
https://uniapp.dcloud.io/component/uniui/resource
)
-
文档迁移,详见:
[
https://uniapp.dcloud.io/component/uniui/uni-swipe-action
](
https://uniapp.dcloud.io/component/uniui/uni-swipe-action
)
## 1.2.4(2021-08-20)
-
优化 close-all 方法
## 1.2.3(2021-08-20)
-
新增 close-all 方法,关闭所有已打开的组件
## 1.2.2(2021-08-17)
-
新增 resize() 方法,在非微信小程序、h5、app-vue端出现不能滑动的问题的时候,重置组件
-
修复 app 端偶尔出现类似 Page
[
x
][
-x,xx;-x,xx,x,x-x
]
的问题
-
优化 微信小程序、h5、app-vue 滑动逻辑,避免出现动态新增组件后不能滑动的问题
## 1.2.1(2021-07-30)
-
组件兼容 vue3,如何创建vue3项目,详见
[
uni-app 项目支持 vue3 介绍
](
https://ask.dcloud.net.cn/article/37834
)
-
修复 跨页面修改组件数据 ,导致不能滑动的问题
## 1.1.10(2021-06-17)
-
修复 按钮点击执行两次的bug
## 1.1.9(2021-05-12)
-
新增 项目示例地址
## 1.1.8(2021-03-26)
-
修复 微信小程序 nv_navigator is not defined 报错的bug
## 1.1.7(2021-02-05)
-
调整为uni_modules目录规范
-
新增 左侧滑动
-
新增 插槽使用方式
-
新增 threshold 属性,可以控制滑动缺省值
-
优化 长列表滚动性能
-
修复 滚动页面时触发组件滑动的Bug
src/uni_modules/uni-swipe-action/components/uni-swipe-action-item/bindingx.js
0 → 100644
View file @
aebe688a
let
bindIngXMixins
=
{}
// #ifdef APP-NVUE
const
BindingX
=
uni
.
requireNativePlugin
(
'bindingx'
);
const
dom
=
uni
.
requireNativePlugin
(
'dom'
);
const
animation
=
uni
.
requireNativePlugin
(
'animation'
);
bindIngXMixins
=
{
data
()
{
return
{}
},
watch
:
{
show
(
newVal
)
{
if
(
this
.
autoClose
)
return
if
(
this
.
stop
)
return
this
.
stop
=
true
if
(
newVal
)
{
this
.
open
(
newVal
)
}
else
{
this
.
close
()
}
},
leftOptions
()
{
this
.
getSelectorQuery
()
this
.
init
()
},
rightOptions
(
newVal
)
{
this
.
init
()
}
},
created
()
{
this
.
swipeaction
=
this
.
getSwipeAction
()
if
(
this
.
swipeaction
.
children
!==
undefined
)
{
this
.
swipeaction
.
children
.
push
(
this
)
}
},
mounted
()
{
this
.
box
=
this
.
getEl
(
this
.
$refs
[
'selector-box--hock'
])
this
.
selector
=
this
.
getEl
(
this
.
$refs
[
'selector-content--hock'
]);
this
.
leftButton
=
this
.
getEl
(
this
.
$refs
[
'selector-left-button--hock'
]);
this
.
rightButton
=
this
.
getEl
(
this
.
$refs
[
'selector-right-button--hock'
]);
this
.
init
()
},
// beforeDestroy() {
// this.swipeaction.children.forEach((item, index) => {
// if (item === this) {
// this.swipeaction.children.splice(index, 1)
// }
// })
// },
methods
:
{
init
()
{
this
.
$nextTick
(()
=>
{
this
.
x
=
0
this
.
button
=
{
show
:
false
}
setTimeout
(()
=>
{
this
.
getSelectorQuery
()
},
200
)
})
},
onClick
(
index
,
item
,
position
)
{
this
.
$emit
(
'click'
,
{
content
:
item
,
index
,
position
})
},
touchstart
(
e
)
{
// 每次只触发一次,避免多次监听造成闪烁
if
(
this
.
stop
)
return
this
.
stop
=
true
if
(
this
.
autoClose
)
{
this
.
swipeaction
.
closeOther
(
this
)
}
const
leftWidth
=
this
.
button
.
left
.
width
const
rightWidth
=
this
.
button
.
right
.
width
let
expression
=
this
.
range
(
this
.
x
,
-
rightWidth
,
leftWidth
)
let
leftExpression
=
this
.
range
(
this
.
x
-
leftWidth
,
-
leftWidth
,
0
)
let
rightExpression
=
this
.
range
(
this
.
x
+
rightWidth
,
0
,
rightWidth
)
this
.
eventpan
=
BindingX
.
bind
({
anchor
:
this
.
box
,
eventType
:
'pan'
,
props
:
[{
element
:
this
.
selector
,
property
:
'transform.translateX'
,
expression
},
{
element
:
this
.
leftButton
,
property
:
'transform.translateX'
,
expression
:
leftExpression
},
{
element
:
this
.
rightButton
,
property
:
'transform.translateX'
,
expression
:
rightExpression
},
]
},
(
e
)
=>
{
// nope
if
(
e
.
state
===
'end'
)
{
this
.
x
=
e
.
deltaX
+
this
.
x
;
this
.
isclick
=
true
this
.
bindTiming
(
e
.
deltaX
)
}
});
},
touchend
(
e
)
{
if
(
this
.
isopen
!==
'none'
&&
!
this
.
isclick
)
{
this
.
open
(
'none'
)
}
},
bindTiming
(
x
)
{
const
left
=
this
.
x
const
leftWidth
=
this
.
button
.
left
.
width
const
rightWidth
=
this
.
button
.
right
.
width
const
threshold
=
this
.
threshold
if
(
!
this
.
isopen
||
this
.
isopen
===
'none'
)
{
if
(
left
>
threshold
)
{
this
.
open
(
'left'
)
}
else
if
(
left
<
-
threshold
)
{
this
.
open
(
'right'
)
}
else
{
this
.
open
(
'none'
)
}
}
else
{
if
((
x
>
-
leftWidth
&&
x
<
0
)
||
x
>
rightWidth
)
{
if
((
x
>
-
threshold
&&
x
<
0
)
||
(
x
-
rightWidth
>
threshold
))
{
this
.
open
(
'left'
)
}
else
{
this
.
open
(
'none'
)
}
}
else
{
if
((
x
<
threshold
&&
x
>
0
)
||
(
x
+
leftWidth
<
-
threshold
))
{
this
.
open
(
'right'
)
}
else
{
this
.
open
(
'none'
)
}
}
}
},
/**
* 移动范围
* @param {Object} num
* @param {Object} mix
* @param {Object} max
*/
range
(
num
,
mix
,
max
)
{
return
`min(max(x+
${
num
}
,
${
mix
}
),
${
max
}
)`
},
/**
* 开启swipe
*/
open
(
type
)
{
this
.
animation
(
type
)
},
/**
* 关闭swipe
*/
close
()
{
this
.
animation
(
'none'
)
},
/**
* 开启关闭动画
* @param {Object} type
*/
animation
(
type
)
{
const
time
=
300
const
leftWidth
=
this
.
button
.
left
.
width
const
rightWidth
=
this
.
button
.
right
.
width
if
(
this
.
eventpan
&&
this
.
eventpan
.
token
)
{
BindingX
.
unbind
({
token
:
this
.
eventpan
.
token
,
eventType
:
'pan'
})
}
switch
(
type
)
{
case
'left'
:
Promise
.
all
([
this
.
move
(
this
.
selector
,
leftWidth
),
this
.
move
(
this
.
leftButton
,
0
),
this
.
move
(
this
.
rightButton
,
rightWidth
*
2
)
]).
then
(()
=>
{
this
.
setEmit
(
leftWidth
,
type
)
})
break
case
'right'
:
Promise
.
all
([
this
.
move
(
this
.
selector
,
-
rightWidth
),
this
.
move
(
this
.
leftButton
,
-
leftWidth
*
2
),
this
.
move
(
this
.
rightButton
,
0
)
]).
then
(()
=>
{
this
.
setEmit
(
-
rightWidth
,
type
)
})
break
default
:
Promise
.
all
([
this
.
move
(
this
.
selector
,
0
),
this
.
move
(
this
.
leftButton
,
-
leftWidth
),
this
.
move
(
this
.
rightButton
,
rightWidth
)
]).
then
(()
=>
{
this
.
setEmit
(
0
,
type
)
})
}
},
setEmit
(
x
,
type
)
{
const
leftWidth
=
this
.
button
.
left
.
width
const
rightWidth
=
this
.
button
.
right
.
width
this
.
isopen
=
this
.
isopen
||
'none'
this
.
stop
=
false
this
.
isclick
=
false
// 只有状态不一致才会返回结果
if
(
this
.
isopen
!==
type
&&
this
.
x
!==
x
)
{
if
(
type
===
'left'
&&
leftWidth
>
0
)
{
this
.
$emit
(
'change'
,
'left'
)
}
if
(
type
===
'right'
&&
rightWidth
>
0
)
{
this
.
$emit
(
'change'
,
'right'
)
}
if
(
type
===
'none'
)
{
this
.
$emit
(
'change'
,
'none'
)
}
}
this
.
x
=
x
this
.
isopen
=
type
},
move
(
ref
,
value
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
animation
.
transition
(
ref
,
{
styles
:
{
transform
:
`translateX(
${
value
}
)`
,
},
duration
:
150
,
//ms
timingFunction
:
'linear'
,
needLayout
:
false
,
delay
:
0
//ms
},
function
(
res
)
{
resolve
(
res
)
})
})
},
/**
* 获取ref
* @param {Object} el
*/
getEl
(
el
)
{
return
el
.
ref
},
/**
* 获取节点信息
*/
getSelectorQuery
()
{
Promise
.
all
([
this
.
getDom
(
'left'
),
this
.
getDom
(
'right'
),
]).
then
((
data
)
=>
{
let
show
=
'none'
if
(
this
.
autoClose
)
{
show
=
'none'
}
else
{
show
=
this
.
show
}
if
(
show
===
'none'
)
{
// this.close()
}
else
{
this
.
open
(
show
)
}
})
},
getDom
(
str
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
dom
.
getComponentRect
(
this
.
$refs
[
`selector-
${
str
}
-button--hock`
],
(
data
)
=>
{
if
(
data
)
{
this
.
button
[
str
]
=
data
.
size
resolve
(
data
)
}
else
{
reject
()
}
})
})
}
}
}
// #endif
export
default
bindIngXMixins
src/uni_modules/uni-swipe-action/components/uni-swipe-action-item/isPC.js
0 → 100644
View file @
aebe688a
export
function
isPC
()
{
var
userAgentInfo
=
navigator
.
userAgent
;
var
Agents
=
[
"Android"
,
"iPhone"
,
"SymbianOS"
,
"Windows Phone"
,
"iPad"
,
"iPod"
];
var
flag
=
true
;
for
(
let
v
=
0
;
v
<
Agents
.
length
-
1
;
v
++
)
{
if
(
userAgentInfo
.
indexOf
(
Agents
[
v
])
>
0
)
{
flag
=
false
;
break
;
}
}
return
flag
;
}
\ No newline at end of file
src/uni_modules/uni-swipe-action/components/uni-swipe-action-item/mpalipay.js
0 → 100644
View file @
aebe688a
export
default
{
data
()
{
return
{
x
:
0
,
transition
:
false
,
width
:
0
,
viewWidth
:
0
,
swipeShow
:
0
}
},
watch
:
{
show
(
newVal
)
{
if
(
this
.
autoClose
)
return
if
(
newVal
&&
newVal
!==
'none'
)
{
this
.
transition
=
true
this
.
open
(
newVal
)
}
else
{
this
.
close
()
}
}
},
created
()
{
this
.
swipeaction
=
this
.
getSwipeAction
()
if
(
this
.
swipeaction
.
children
!==
undefined
)
{
this
.
swipeaction
.
children
.
push
(
this
)
}
},
mounted
()
{
this
.
isopen
=
false
setTimeout
(()
=>
{
this
.
getQuerySelect
()
},
50
)
},
methods
:
{
appTouchStart
(
e
)
{
const
{
clientX
}
=
e
.
changedTouches
[
0
]
this
.
clientX
=
clientX
this
.
timestamp
=
new
Date
().
getTime
()
},
appTouchEnd
(
e
,
index
,
item
,
position
)
{
const
{
clientX
}
=
e
.
changedTouches
[
0
]
// fixed by xxxx 模拟点击事件,解决 ios 13 点击区域错位的问题
let
diff
=
Math
.
abs
(
this
.
clientX
-
clientX
)
let
time
=
(
new
Date
().
getTime
())
-
this
.
timestamp
if
(
diff
<
40
&&
time
<
300
)
{
this
.
$emit
(
'click'
,
{
content
:
item
,
index
,
position
})
}
},
/**
* 移动触发
* @param {Object} e
*/
onChange
(
e
)
{
this
.
moveX
=
e
.
detail
.
x
this
.
isclose
=
false
},
touchstart
(
e
)
{
this
.
transition
=
false
this
.
isclose
=
true
this
.
autoClose
&&
this
.
swipeaction
.
closeOther
(
this
)
},
touchmove
(
e
)
{},
touchend
(
e
)
{
// 0的位置什么都不执行
if
(
this
.
isclose
&&
this
.
isopen
===
'none'
)
return
if
(
this
.
isclose
&&
this
.
isopen
!==
'none'
)
{
this
.
transition
=
true
this
.
close
()
}
else
{
this
.
move
(
this
.
moveX
+
this
.
leftWidth
)
}
},
/**
* 移动
* @param {Object} moveX
*/
move
(
moveX
)
{
// 打开关闭的处理逻辑不太一样
this
.
transition
=
true
// 未打开状态
if
(
!
this
.
isopen
||
this
.
isopen
===
'none'
)
{
if
(
moveX
>
this
.
threshold
)
{
this
.
open
(
'left'
)
}
else
if
(
moveX
<
-
this
.
threshold
)
{
this
.
open
(
'right'
)
}
else
{
this
.
close
()
}
}
else
{
if
(
moveX
<
0
&&
moveX
<
this
.
rightWidth
)
{
const
rightX
=
this
.
rightWidth
+
moveX
if
(
rightX
<
this
.
threshold
)
{
this
.
open
(
'right'
)
}
else
{
this
.
close
()
}
}
else
if
(
moveX
>
0
&&
moveX
<
this
.
leftWidth
)
{
const
leftX
=
this
.
leftWidth
-
moveX
if
(
leftX
<
this
.
threshold
)
{
this
.
open
(
'left'
)
}
else
{
this
.
close
()
}
}
}
},
/**
* 打开
*/
open
(
type
)
{
this
.
x
=
this
.
moveX
this
.
animation
(
type
)
},
/**
* 关闭
*/
close
()
{
this
.
x
=
this
.
moveX
// TODO 解决 x 值不更新的问题,所以会多触发一次 nextTick ,待优化
this
.
$nextTick
(()
=>
{
this
.
x
=
-
this
.
leftWidth
if
(
this
.
isopen
!==
'none'
){
this
.
$emit
(
'change'
,
'none'
)
}
this
.
isopen
=
'none'
})
},
/**
* 执行结束动画
* @param {Object} type
*/
animation
(
type
)
{
this
.
$nextTick
(()
=>
{
if
(
type
===
'left'
)
{
this
.
x
=
0
}
else
{
this
.
x
=
-
this
.
rightWidth
-
this
.
leftWidth
}
if
(
this
.
isopen
!==
type
){
this
.
$emit
(
'change'
,
type
)
}
this
.
isopen
=
type
})
},
getSlide
(
x
)
{},
getQuerySelect
()
{
const
query
=
uni
.
createSelectorQuery
().
in
(
this
);
query
.
selectAll
(
'.movable-view--hock'
).
boundingClientRect
(
data
=>
{
this
.
leftWidth
=
data
[
1
].
width
this
.
rightWidth
=
data
[
2
].
width
this
.
width
=
data
[
0
].
width
this
.
viewWidth
=
this
.
width
+
this
.
rightWidth
+
this
.
leftWidth
if
(
this
.
leftWidth
===
0
)
{
// TODO 疑似bug ,初始化的时候如果x 是0,会导致移动位置错误,所以让元素超出一点
this
.
x
=
-
0.1
}
else
{
this
.
x
=
-
this
.
leftWidth
}
this
.
moveX
=
this
.
x
this
.
$nextTick
(()
=>
{
this
.
swipeShow
=
1
})
if
(
!
this
.
buttonWidth
)
{
this
.
disabledView
=
true
}
if
(
this
.
autoClose
)
return
if
(
this
.
show
!==
'none'
)
{
this
.
transition
=
true
this
.
open
(
this
.
shows
)
}
}).
exec
();
}
}
}
src/uni_modules/uni-swipe-action/components/uni-swipe-action-item/mpother.js
0 → 100644
View file @
aebe688a
let
otherMixins
=
{}
// #ifndef APP-PLUS|| MP-WEIXIN || H5
const
MIN_DISTANCE
=
10
;
otherMixins
=
{
data
()
{
// TODO 随机生生元素ID,解决百度小程序获取同一个元素位置信息的bug
const
elClass
=
`Uni_
${
Math
.
ceil
(
Math
.
random
()
*
10
e5
).
toString
(
36
)}
`
return
{
uniShow
:
false
,
left
:
0
,
buttonShow
:
'none'
,
ani
:
false
,
moveLeft
:
''
,
elClass
}
},
watch
:
{
show
(
newVal
)
{
if
(
this
.
autoClose
)
return
this
.
openState
(
newVal
)
},
left
(){
this
.
moveLeft
=
`translateX(
${
this
.
left
}
px)`
},
buttonShow
(
newVal
){
if
(
this
.
autoClose
)
return
this
.
openState
(
newVal
)
},
leftOptions
()
{
this
.
init
()
},
rightOptions
()
{
this
.
init
()
}
},
mounted
()
{
this
.
swipeaction
=
this
.
getSwipeAction
()
if
(
this
.
swipeaction
.
children
!==
undefined
)
{
this
.
swipeaction
.
children
.
push
(
this
)
}
this
.
init
()
},
methods
:
{
init
(){
clearTimeout
(
this
.
timer
)
this
.
timer
=
setTimeout
(()
=>
{
this
.
getSelectorQuery
()
},
100
)
// 移动距离
this
.
left
=
0
this
.
x
=
0
},
closeSwipe
(
e
)
{
if
(
!
this
.
autoClose
)
return
this
.
swipeaction
.
closeOther
(
this
)
},
appTouchStart
(
e
)
{
const
{
clientX
}
=
e
.
changedTouches
[
0
]
this
.
clientX
=
clientX
this
.
timestamp
=
new
Date
().
getTime
()
},
appTouchEnd
(
e
,
index
,
item
,
position
)
{
const
{
clientX
}
=
e
.
changedTouches
[
0
]
// fixed by xxxx 模拟点击事件,解决 ios 13 点击区域错位的问题
let
diff
=
Math
.
abs
(
this
.
clientX
-
clientX
)
let
time
=
(
new
Date
().
getTime
())
-
this
.
timestamp
if
(
diff
<
40
&&
time
<
300
)
{
this
.
$emit
(
'click'
,
{
content
:
item
,
index
,
position
})
}
},
touchstart
(
e
)
{
if
(
this
.
disabled
)
return
this
.
ani
=
false
this
.
x
=
this
.
left
||
0
this
.
stopTouchStart
(
e
)
this
.
autoClose
&&
this
.
closeSwipe
()
},
touchmove
(
e
)
{
if
(
this
.
disabled
)
return
// 是否可以滑动页面
this
.
stopTouchMove
(
e
);
if
(
this
.
direction
!==
'horizontal'
)
{
return
;
}
this
.
move
(
this
.
x
+
this
.
deltaX
)
return
false
},
touchend
()
{
if
(
this
.
disabled
)
return
this
.
moveDirection
(
this
.
left
)
},
/**
* 设置移动距离
* @param {Object} value
*/
move
(
value
)
{
value
=
value
||
0
const
leftWidth
=
this
.
leftWidth
const
rightWidth
=
this
.
rightWidth
// 获取可滑动范围
this
.
left
=
this
.
range
(
value
,
-
rightWidth
,
leftWidth
);
},
/**
* 获取范围
* @param {Object} num
* @param {Object} min
* @param {Object} max
*/
range
(
num
,
min
,
max
)
{
return
Math
.
min
(
Math
.
max
(
num
,
min
),
max
);
},
/**
* 移动方向判断
* @param {Object} left
* @param {Object} value
*/
moveDirection
(
left
)
{
const
threshold
=
this
.
threshold
const
isopen
=
this
.
isopen
||
'none'
const
leftWidth
=
this
.
leftWidth
const
rightWidth
=
this
.
rightWidth
if
(
this
.
deltaX
===
0
)
{
this
.
openState
(
'none'
)
return
}
if
((
isopen
===
'none'
&&
rightWidth
>
0
&&
-
left
>
threshold
)
||
(
isopen
!==
'none'
&&
rightWidth
>
0
&&
rightWidth
+
left
<
threshold
))
{
// right
this
.
openState
(
'right'
)
}
else
if
((
isopen
===
'none'
&&
leftWidth
>
0
&&
left
>
threshold
)
||
(
isopen
!==
'none'
&&
leftWidth
>
0
&&
leftWidth
-
left
<
threshold
))
{
// left
this
.
openState
(
'left'
)
}
else
{
// default
this
.
openState
(
'none'
)
}
},
/**
* 开启状态
* @param {Boolean} type
*/
openState
(
type
)
{
const
leftWidth
=
this
.
leftWidth
const
rightWidth
=
this
.
rightWidth
let
left
=
''
this
.
isopen
=
this
.
isopen
?
this
.
isopen
:
'none'
switch
(
type
)
{
case
"left"
:
left
=
leftWidth
break
case
"right"
:
left
=
-
rightWidth
break
default
:
left
=
0
}
if
(
this
.
isopen
!==
type
)
{
this
.
throttle
=
true
this
.
$emit
(
'change'
,
type
)
}
this
.
isopen
=
type
// 添加动画类
this
.
ani
=
true
this
.
$nextTick
(()
=>
{
this
.
move
(
left
)
})
// 设置最终移动位置,理论上只要进入到这个函数,肯定是要打开的
},
close
()
{
this
.
openState
(
'none'
)
},
getDirection
(
x
,
y
)
{
if
(
x
>
y
&&
x
>
MIN_DISTANCE
)
{
return
'horizontal'
;
}
if
(
y
>
x
&&
y
>
MIN_DISTANCE
)
{
return
'vertical'
;
}
return
''
;
},
/**
* 重置滑动状态
* @param {Object} event
*/
resetTouchStatus
()
{
this
.
direction
=
''
;
this
.
deltaX
=
0
;
this
.
deltaY
=
0
;
this
.
offsetX
=
0
;
this
.
offsetY
=
0
;
},
/**
* 设置滑动开始位置
* @param {Object} event
*/
stopTouchStart
(
event
)
{
this
.
resetTouchStatus
();
const
touch
=
event
.
touches
[
0
];
this
.
startX
=
touch
.
clientX
;
this
.
startY
=
touch
.
clientY
;
},
/**
* 滑动中,是否禁止打开
* @param {Object} event
*/
stopTouchMove
(
event
)
{
const
touch
=
event
.
touches
[
0
];
this
.
deltaX
=
touch
.
clientX
-
this
.
startX
;
this
.
deltaY
=
touch
.
clientY
-
this
.
startY
;
this
.
offsetX
=
Math
.
abs
(
this
.
deltaX
);
this
.
offsetY
=
Math
.
abs
(
this
.
deltaY
);
this
.
direction
=
this
.
direction
||
this
.
getDirection
(
this
.
offsetX
,
this
.
offsetY
);
},
getSelectorQuery
()
{
const
views
=
uni
.
createSelectorQuery
().
in
(
this
)
views
.
selectAll
(
'.'
+
this
.
elClass
)
.
boundingClientRect
(
data
=>
{
if
(
data
.
length
===
0
)
return
let
show
=
'none'
if
(
this
.
autoClose
)
{
show
=
'none'
}
else
{
show
=
this
.
show
}
this
.
leftWidth
=
data
[
0
].
width
||
0
this
.
rightWidth
=
data
[
1
].
width
||
0
this
.
buttonShow
=
show
})
.
exec
()
}
}
}
// #endif
export
default
otherMixins
src/uni_modules/uni-swipe-action/components/uni-swipe-action-item/mpwxs.js
0 → 100644
View file @
aebe688a
let
mpMixins
=
{}
// #ifdef APP-VUE|| MP-WEIXIN || H5
import
{
isPC
}
from
"./isPC"
mpMixins
=
{
data
()
{
return
{
is_show
:
'none'
}
},
watch
:
{
show
(
newVal
)
{
this
.
is_show
=
this
.
show
}
},
created
()
{
this
.
swipeaction
=
this
.
getSwipeAction
()
if
(
this
.
swipeaction
.
children
!==
undefined
)
{
this
.
swipeaction
.
children
.
push
(
this
)
}
},
mounted
()
{
this
.
is_show
=
this
.
show
},
methods
:
{
// wxs 中调用
closeSwipe
(
e
)
{
if
(
!
this
.
autoClose
)
return
this
.
swipeaction
.
closeOther
(
this
)
},
change
(
e
)
{
this
.
$emit
(
'change'
,
e
.
open
)
if
(
this
.
is_show
!==
e
.
open
)
{
this
.
is_show
=
e
.
open
}
},
appTouchStart
(
e
)
{
// #ifdef H5
if
(
isPC
())
return
// #endif
const
{
clientX
}
=
e
.
changedTouches
[
0
]
this
.
clientX
=
clientX
this
.
timestamp
=
new
Date
().
getTime
()
},
appTouchEnd
(
e
,
index
,
item
,
position
)
{
// #ifdef H5
if
(
isPC
())
return
// #endif
const
{
clientX
}
=
e
.
changedTouches
[
0
]
// fixed by xxxx 模拟点击事件,解决 ios 13 点击区域错位的问题
let
diff
=
Math
.
abs
(
this
.
clientX
-
clientX
)
let
time
=
(
new
Date
().
getTime
())
-
this
.
timestamp
if
(
diff
<
40
&&
time
<
300
)
{
this
.
$emit
(
'click'
,
{
content
:
item
,
index
,
position
})
}
},
onClickForPC
(
index
,
item
,
position
)
{
// #ifdef H5
if
(
!
isPC
())
return
this
.
$emit
(
'click'
,
{
content
:
item
,
index
,
position
})
// #endif
}
}
}
// #endif
export
default
mpMixins
src/uni_modules/uni-swipe-action/components/uni-swipe-action-item/render.js
0 → 100644
View file @
aebe688a
const
MIN_DISTANCE
=
10
;
export
default
{
showWatch
(
newVal
,
oldVal
,
ownerInstance
,
instance
,
self
)
{
var
state
=
self
.
state
var
$el
=
ownerInstance
.
$el
||
ownerInstance
.
$vm
&&
ownerInstance
.
$vm
.
$el
if
(
!
$el
)
return
this
.
getDom
(
instance
,
ownerInstance
,
self
)
if
(
newVal
&&
newVal
!==
'none'
)
{
this
.
openState
(
newVal
,
instance
,
ownerInstance
,
self
)
return
}
if
(
state
.
left
)
{
this
.
openState
(
'none'
,
instance
,
ownerInstance
,
self
)
}
this
.
resetTouchStatus
(
instance
,
self
)
},
/**
* 开始触摸操作
* @param {Object} e
* @param {Object} ins
*/
touchstart
(
e
,
ownerInstance
,
self
)
{
let
instance
=
e
.
instance
;
let
disabled
=
instance
.
getDataset
().
disabled
let
state
=
self
.
state
;
this
.
getDom
(
instance
,
ownerInstance
,
self
)
// fix by mehaotian, TODO 兼容 app-vue 获取dataset为字符串 , h5 获取 为 undefined 的问题,待框架修复
disabled
=
this
.
getDisabledType
(
disabled
)
if
(
disabled
)
return
// 开始触摸时移除动画类
instance
.
requestAnimationFrame
(
function
()
{
instance
.
removeClass
(
'ani'
);
ownerInstance
.
callMethod
(
'closeSwipe'
);
})
// 记录上次的位置
state
.
x
=
state
.
left
||
0
// 计算滑动开始位置
this
.
stopTouchStart
(
e
,
ownerInstance
,
self
)
},
/**
* 开始滑动操作
* @param {Object} e
* @param {Object} ownerInstance
*/
touchmove
(
e
,
ownerInstance
,
self
)
{
let
instance
=
e
.
instance
;
// 删除之后已经那不到实例了
if
(
!
instance
)
return
;
let
disabled
=
instance
.
getDataset
().
disabled
let
state
=
self
.
state
// fix by mehaotian, TODO 兼容 app-vue 获取dataset为字符串 , h5 获取 为 undefined 的问题,待框架修复
disabled
=
this
.
getDisabledType
(
disabled
)
if
(
disabled
)
return
// 是否可以滑动页面
this
.
stopTouchMove
(
e
,
self
);
if
(
state
.
direction
!==
'horizontal'
)
{
return
;
}
if
(
e
.
preventDefault
)
{
// 阻止页面滚动
e
.
preventDefault
()
}
let
x
=
state
.
x
+
state
.
deltaX
this
.
move
(
x
,
instance
,
ownerInstance
,
self
)
},
/**
* 结束触摸操作
* @param {Object} e
* @param {Object} ownerInstance
*/
touchend
(
e
,
ownerInstance
,
self
)
{
let
instance
=
e
.
instance
;
let
disabled
=
instance
.
getDataset
().
disabled
let
state
=
self
.
state
// fix by mehaotian, TODO 兼容 app-vue 获取dataset为字符串 , h5 获取 为 undefined 的问题,待框架修复
disabled
=
this
.
getDisabledType
(
disabled
)
if
(
disabled
)
return
// 滑动过程中触摸结束,通过阙值判断是开启还是关闭
// fixed by mehaotian 定时器解决点击按钮,touchend 触发比 click 事件时机早的问题 ,主要是 ios13
this
.
moveDirection
(
state
.
left
,
instance
,
ownerInstance
,
self
)
},
/**
* 设置移动距离
* @param {Object} value
* @param {Object} instance
* @param {Object} ownerInstance
*/
move
(
value
,
instance
,
ownerInstance
,
self
)
{
value
=
value
||
0
let
state
=
self
.
state
let
leftWidth
=
state
.
leftWidth
let
rightWidth
=
state
.
rightWidth
// 获取可滑动范围
state
.
left
=
this
.
range
(
value
,
-
rightWidth
,
leftWidth
);
instance
.
requestAnimationFrame
(
function
()
{
instance
.
setStyle
({
transform
:
'translateX('
+
state
.
left
+
'px)'
,
'-webkit-transform'
:
'translateX('
+
state
.
left
+
'px)'
})
})
},
/**
* 获取元素信息
* @param {Object} instance
* @param {Object} ownerInstance
*/
getDom
(
instance
,
ownerInstance
,
self
)
{
var
state
=
self
.
state
var
$el
=
ownerInstance
.
$el
||
ownerInstance
.
$vm
&&
ownerInstance
.
$vm
.
$el
var
leftDom
=
$el
.
querySelector
(
'.button-group--left'
)
var
rightDom
=
$el
.
querySelector
(
'.button-group--right'
)
state
.
leftWidth
=
leftDom
.
offsetWidth
||
0
state
.
rightWidth
=
rightDom
.
offsetWidth
||
0
state
.
threshold
=
instance
.
getDataset
().
threshold
},
getDisabledType
(
value
)
{
return
(
typeof
(
value
)
===
'string'
?
JSON
.
parse
(
value
)
:
value
)
||
false
;
},
/**
* 获取范围
* @param {Object} num
* @param {Object} min
* @param {Object} max
*/
range
(
num
,
min
,
max
)
{
return
Math
.
min
(
Math
.
max
(
num
,
min
),
max
);
},
/**
* 移动方向判断
* @param {Object} left
* @param {Object} value
* @param {Object} ownerInstance
* @param {Object} ins
*/
moveDirection
(
left
,
ins
,
ownerInstance
,
self
)
{
var
state
=
self
.
state
var
threshold
=
state
.
threshold
var
position
=
state
.
position
var
isopen
=
state
.
isopen
||
'none'
var
leftWidth
=
state
.
leftWidth
var
rightWidth
=
state
.
rightWidth
if
(
state
.
deltaX
===
0
)
{
this
.
openState
(
'none'
,
ins
,
ownerInstance
,
self
)
return
}
if
((
isopen
===
'none'
&&
rightWidth
>
0
&&
-
left
>
threshold
)
||
(
isopen
!==
'none'
&&
rightWidth
>
0
&&
rightWidth
+
left
<
threshold
))
{
// right
this
.
openState
(
'right'
,
ins
,
ownerInstance
,
self
)
}
else
if
((
isopen
===
'none'
&&
leftWidth
>
0
&&
left
>
threshold
)
||
(
isopen
!==
'none'
&&
leftWidth
>
0
&&
leftWidth
-
left
<
threshold
))
{
// left
this
.
openState
(
'left'
,
ins
,
ownerInstance
,
self
)
}
else
{
// default
this
.
openState
(
'none'
,
ins
,
ownerInstance
,
self
)
}
},
/**
* 开启状态
* @param {Boolean} type
* @param {Object} ins
* @param {Object} ownerInstance
*/
openState
(
type
,
ins
,
ownerInstance
,
self
)
{
let
state
=
self
.
state
let
leftWidth
=
state
.
leftWidth
let
rightWidth
=
state
.
rightWidth
let
left
=
''
state
.
isopen
=
state
.
isopen
?
state
.
isopen
:
'none'
switch
(
type
)
{
case
"left"
:
left
=
leftWidth
break
case
"right"
:
left
=
-
rightWidth
break
default
:
left
=
0
}
// && !state.throttle
if
(
state
.
isopen
!==
type
)
{
state
.
throttle
=
true
ownerInstance
.
callMethod
(
'change'
,
{
open
:
type
})
}
state
.
isopen
=
type
// 添加动画类
ins
.
requestAnimationFrame
(()
=>
{
ins
.
addClass
(
'ani'
);
this
.
move
(
left
,
ins
,
ownerInstance
,
self
)
})
},
getDirection
(
x
,
y
)
{
if
(
x
>
y
&&
x
>
MIN_DISTANCE
)
{
return
'horizontal'
;
}
if
(
y
>
x
&&
y
>
MIN_DISTANCE
)
{
return
'vertical'
;
}
return
''
;
},
/**
* 重置滑动状态
* @param {Object} event
*/
resetTouchStatus
(
instance
,
self
)
{
let
state
=
self
.
state
;
state
.
direction
=
''
;
state
.
deltaX
=
0
;
state
.
deltaY
=
0
;
state
.
offsetX
=
0
;
state
.
offsetY
=
0
;
},
/**
* 设置滑动开始位置
* @param {Object} event
*/
stopTouchStart
(
event
,
ownerInstance
,
self
)
{
let
instance
=
event
.
instance
;
let
state
=
self
.
state
this
.
resetTouchStatus
(
instance
,
self
);
var
touch
=
event
.
touches
[
0
];
state
.
startX
=
touch
.
clientX
;
state
.
startY
=
touch
.
clientY
;
},
/**
* 滑动中,是否禁止打开
* @param {Object} event
*/
stopTouchMove
(
event
,
self
)
{
let
instance
=
event
.
instance
;
let
state
=
self
.
state
;
let
touch
=
event
.
touches
[
0
];
state
.
deltaX
=
touch
.
clientX
-
state
.
startX
;
state
.
deltaY
=
touch
.
clientY
-
state
.
startY
;
state
.
offsetY
=
Math
.
abs
(
state
.
deltaY
);
state
.
offsetX
=
Math
.
abs
(
state
.
deltaX
);
state
.
direction
=
state
.
direction
||
this
.
getDirection
(
state
.
offsetX
,
state
.
offsetY
);
}
}
src/uni_modules/uni-swipe-action/components/uni-swipe-action-item/uni-swipe-action-item.vue
0 → 100644
View file @
aebe688a
<
template
>
<!-- 在微信小程序 app vue端 h5 使用wxs 实现-->
<!-- #ifdef APP-VUE || MP-WEIXIN || H5 -->
<view
class=
"uni-swipe"
>
<!-- #ifdef MP-WEIXIN || VUE3 -->
<view
class=
"uni-swipe_box"
:change:prop=
"wxsswipe.showWatch"
:prop=
"is_show"
:data-threshold=
"threshold"
:data-disabled=
"disabled"
@
touchstart=
"wxsswipe.touchstart"
@
touchmove=
"wxsswipe.touchmove"
@
touchend=
"wxsswipe.touchend"
>
<!-- #endif -->
<!-- #ifndef MP-WEIXIN || VUE3 -->
<view
class=
"uni-swipe_box"
:change:prop=
"renderswipe.showWatch"
:prop=
"is_show"
:data-threshold=
"threshold"
:data-disabled=
"disabled+''"
@
touchstart=
"renderswipe.touchstart"
@
touchmove=
"renderswipe.touchmove"
@
touchend=
"renderswipe.touchend"
>
<!-- #endif -->
<!-- 在微信小程序 app vue端 h5 使用wxs 实现-->
<view
class=
"uni-swipe_button-group button-group--left"
>
<slot
name=
"left"
>
<view
v-for=
"(item,index) in leftOptions"
:key=
"index"
:style=
"
{
backgroundColor: item.style
&&
item.style.backgroundColor ? item.style.backgroundColor : '#C7C6CD',
fontSize: item.style
&&
item.style.fontSize ? item.style.fontSize : '16px'
}" class="uni-swipe_button button-hock" @touchstart="appTouchStart"
@touchend="appTouchEnd($event,index,item,'left')" @click.stop="onClickForPC(index,item,'left')">
<text
class=
"uni-swipe_button-text"
:style=
"
{color: item.style
&&
item.style.color ? item.style.color : '#FFFFFF',}">
{{
item
.
text
}}
</text>
</view>
</slot>
</view>
<view
class=
"uni-swipe_text--center"
>
<slot></slot>
</view>
<view
class=
"uni-swipe_button-group button-group--right"
>
<slot
name=
"right"
>
<view
v-for=
"(item,index) in rightOptions"
:key=
"index"
:style=
"
{
backgroundColor: item.style
&&
item.style.backgroundColor ? item.style.backgroundColor : '#C7C6CD',
fontSize: item.style
&&
item.style.fontSize ? item.style.fontSize : '16px'
}" class="uni-swipe_button button-hock" @touchstart="appTouchStart"
@touchend="appTouchEnd($event,index,item,'right')"
@click.stop="onClickForPC(index,item,'right')">
<text
class=
"uni-swipe_button-text"
:style=
"
{color: item.style
&&
item.style.color ? item.style.color : '#FFFFFF',}">
{{
item
.
text
}}
</text>
</view>
</slot>
</view>
</view>
</view>
<!-- #endif -->
<!-- app nvue端 使用 bindingx -->
<!-- #ifdef APP-NVUE -->
<view
ref=
"selector-box--hock"
class=
"uni-swipe"
@
horizontalpan=
"touchstart"
@
touchend=
"touchend"
>
<view
ref=
'selector-left-button--hock'
class=
"uni-swipe_button-group button-group--left"
>
<slot
name=
"left"
>
<view
v-for=
"(item,index) in leftOptions"
:data-button=
"btn"
:key=
"index"
:style=
"
{
backgroundColor: item.style
&&
item.style.backgroundColor ? item.style.backgroundColor : '#C7C6CD',
fontSize: item.style
&&
item.style.fontSize ? item.style.fontSize : '16px'
}" class="uni-swipe_button button-hock" @click.stop="onClick(index,item,'left')">
<text
class=
"uni-swipe_button-text"
:style=
"
{color: item.style
&&
item.style.color ? item.style.color : '#FFFFFF',}">
{{
item
.
text
}}
</text>
</view>
</slot>
</view>
<view
ref=
'selector-right-button--hock'
class=
"uni-swipe_button-group button-group--right"
>
<slot
name=
"right"
>
<view
v-for=
"(item,index) in rightOptions"
:data-button=
"btn"
:key=
"index"
:style=
"
{
backgroundColor: item.style
&&
item.style.backgroundColor ? item.style.backgroundColor : '#C7C6CD',
fontSize: item.style
&&
item.style.fontSize ? item.style.fontSize : '16px'
}" class="uni-swipe_button button-hock" @click.stop="onClick(index,item,'right')">
<text
class=
"uni-swipe_button-text"
:style=
"
{color: item.style
&&
item.style.color ? item.style.color : '#FFFFFF',}">
{{
item
.
text
}}
</text>
</view>
</slot>
</view>
<view
ref=
'selector-content--hock'
class=
"uni-swipe_box"
>
<slot></slot>
</view>
</view>
<!-- #endif -->
<!-- 其他平台使用 js ,长列表性能可能会有影响-->
<!-- #ifdef MP-ALIPAY || MP-BAIDU || MP-TOUTIAO || MP-QQ -->
<view
class=
"uni-swipe"
>
<view
class=
"uni-swipe_box"
@
touchstart=
"touchstart"
@
touchmove=
"touchmove"
@
touchend=
"touchend"
:style=
"
{transform:moveLeft}" :class="{ani:ani}">
<view
class=
"uni-swipe_button-group button-group--left"
:class=
"[elClass]"
>
<slot
name=
"left"
>
<view
v-for=
"(item,index) in leftOptions"
:data-button=
"btn"
:key=
"index"
:style=
"
{
backgroundColor: item.style
&&
item.style.backgroundColor ? item.style.backgroundColor : '#C7C6CD',
fontSize: item.style
&&
item.style.fontSize ? item.style.fontSize : '16px'
}" class="uni-swipe_button button-hock" @touchstart="appTouchStart"
@touchend="appTouchEnd($event,index,item,'left')">
<text
class=
"uni-swipe_button-text"
:style=
"
{color: item.style
&&
item.style.color ? item.style.color : '#FFFFFF',}">
{{
item
.
text
}}
</text>
</view>
</slot>
</view>
<slot></slot>
<view
class=
"uni-swipe_button-group button-group--right"
:class=
"[elClass]"
>
<slot
name=
"right"
>
<view
v-for=
"(item,index) in rightOptions"
:data-button=
"btn"
:key=
"index"
:style=
"
{
backgroundColor: item.style
&&
item.style.backgroundColor ? item.style.backgroundColor : '#C7C6CD',
fontSize: item.style
&&
item.style.fontSize ? item.style.fontSize : '16px'
}" @touchstart="appTouchStart" @touchend="appTouchEnd($event,index,item,'right')"
class="uni-swipe_button button-hock">
<text
class=
"uni-swipe_button-text"
:style=
"
{color: item.style
&&
item.style.color ? item.style.color : '#FFFFFF',}">
{{
item
.
text
}}
</text>
</view>
</slot>
</view>
</view>
</view>
<!-- #endif -->
</
template
>
<
script
src=
"./wx.wxs"
module=
"wxsswipe"
lang=
"wxs"
></
script
>
<
script
module=
"renderswipe"
lang=
"renderjs"
>
import
render
from
'./render.js'
export
default
{
mounted
(
e
,
ins
,
owner
)
{
this
.
state
=
{}
},
methods
:{
showWatch
(
newVal
,
oldVal
,
ownerInstance
,
instance
){
render
.
showWatch
(
newVal
,
oldVal
,
ownerInstance
,
instance
,
this
)
},
touchstart
(
e
,
ownerInstance
){
render
.
touchstart
(
e
,
ownerInstance
,
this
)
},
touchmove
(
e
,
ownerInstance
){
render
.
touchmove
(
e
,
ownerInstance
,
this
)
},
touchend
(
e
,
ownerInstance
){
render
.
touchend
(
e
,
ownerInstance
,
this
)
}
}
}
</
script
>
<
script
>
import
mpwxs
from
'./mpwxs'
import
bindingx
from
'./bindingx.js'
import
mpother
from
'./mpother'
/**
* SwipeActionItem 滑动操作子组件
* @description 通过滑动触发选项的容器
* @tutorial https://ext.dcloud.net.cn/plugin?id=181
* @property {Boolean} show = [left|right|none] 开启关闭组件,auto-close = false 时生效
* @property {Boolean} disabled = [true|false] 是否禁止滑动
* @property {Boolean} autoClose = [true|false] 滑动打开当前组件,是否关闭其他组件
* @property {Number} threshold 滑动缺省值
* @property {Array} leftOptions 左侧选项内容及样式
* @property {Array} rgihtOptions 右侧选项内容及样式
* @event {Function} click 点击选项按钮时触发事件,e = {content,index} ,content(点击内容)、index(下标)
* @event {Function} change 组件打开或关闭时触发,left\right\none
*/
export
default
{
mixins
:
[
mpwxs
,
bindingx
,
mpother
],
emits
:[
'click'
,
'change'
],
props
:
{
// 控制开关
show
:
{
type
:
String
,
default
:
'none'
},
// 禁用
disabled
:
{
type
:
Boolean
,
default
:
false
},
// 是否自动关闭
autoClose
:
{
type
:
Boolean
,
default
:
true
},
// 滑动缺省距离
threshold
:
{
type
:
Number
,
default
:
20
},
// 左侧按钮内容
leftOptions
:
{
type
:
Array
,
default
()
{
return
[]
}
},
// 右侧按钮内容
rightOptions
:
{
type
:
Array
,
default
()
{
return
[]
}
}
},
// #ifndef VUE3
// TODO vue2
destroyed
()
{
if
(
this
.
__isUnmounted
)
return
this
.
uninstall
()
},
// #endif
// #ifdef VUE3
// TODO vue3
unmounted
()
{
this
.
__isUnmounted
=
true
this
.
uninstall
()
},
// #endif
methods
:
{
uninstall
()
{
if
(
this
.
swipeaction
)
{
this
.
swipeaction
.
children
.
forEach
((
item
,
index
)
=>
{
if
(
item
===
this
)
{
this
.
swipeaction
.
children
.
splice
(
index
,
1
)
}
})
}
},
/**
* 获取父元素实例
*/
getSwipeAction
(
name
=
'uniSwipeAction'
)
{
let
parent
=
this
.
$parent
;
let
parentName
=
parent
.
$options
.
name
;
while
(
parentName
!==
name
)
{
parent
=
parent
.
$parent
;
if
(
!
parent
)
return
false
;
parentName
=
parent
.
$options
.
name
;
}
return
parent
;
}
}
}
</
script
>
<
style
lang=
"scss"
>
.uni-swipe
{
position
:
relative
;
/* #ifndef APP-NVUE */
overflow
:
hidden
;
/* #endif */
}
.uni-swipe_box
{
/* #ifndef APP-NVUE */
display
:
flex
;
flex-shrink
:
0
;
// touch-action: none;
/* #endif */
position
:
relative
;
}
.uni-swipe_content
{
// border: 1px red solid;
}
.uni-swipe_text--center
{
width
:
100%
;
/* #ifndef APP-NVUE */
cursor
:
grab
;
/* #endif */
}
.uni-swipe_button-group
{
/* #ifndef APP-NVUE */
box-sizing
:
border-box
;
display
:
flex
;
/* #endif */
flex-direction
:
row
;
position
:
absolute
;
top
:
0
;
bottom
:
0
;
/* #ifdef H5 */
cursor
:
pointer
;
/* #endif */
}
.button-group--left
{
left
:
0
;
transform
:
translateX
(
-100%
)
}
.button-group--right
{
right
:
0
;
transform
:
translateX
(
100%
)
}
.uni-swipe_button
{
/* #ifdef APP-NVUE */
flex
:
1
;
/* #endif */
/* #ifndef APP-NVUE */
display
:
flex
;
/* #endif */
flex-direction
:
row
;
justify-content
:
center
;
align-items
:
center
;
padding
:
0
20px
;
}
.uni-swipe_button-text
{
/* #ifndef APP-NVUE */
flex-shrink
:
0
;
/* #endif */
font-size
:
14px
;
}
.ani
{
transition-property
:
transform
;
transition-duration
:
0
.3s
;
transition-timing-function
:
cubic-bezier
(
0
.165
,
0
.84
,
0
.44
,
1
);
}
/* #ifdef MP-ALIPAY */
.movable-area
{
/* width: 100%; */
height
:
45px
;
}
.movable-view
{
display
:
flex
;
/* justify-content: center; */
position
:
relative
;
flex
:
1
;
height
:
45px
;
z-index
:
2
;
}
.movable-view-button
{
display
:
flex
;
flex-shrink
:
0
;
flex-direction
:
row
;
height
:
100%
;
background
:
#C0C0C0
;
}
/* .transition {
transition: all 0.3s;
} */
.movable-view-box
{
flex-shrink
:
0
;
height
:
100%
;
background-color
:
#fff
;
}
/* #endif */
</
style
>
src/uni_modules/uni-swipe-action/components/uni-swipe-action-item/wx.wxs
0 → 100644
View file @
aebe688a
var MIN_DISTANCE = 10;
/**
* 判断当前是否为H5、app-vue
*/
var IS_HTML5 = false
if (typeof window === 'object') IS_HTML5 = true
/**
* 监听页面内值的变化,主要用于动态开关swipe-action
* @param {Object} newValue
* @param {Object} oldValue
* @param {Object} ownerInstance
* @param {Object} instance
*/
function showWatch(newVal, oldVal, ownerInstance, instance) {
var state = instance.getState()
getDom(instance, ownerInstance)
if (newVal && newVal !== 'none') {
openState(newVal, instance, ownerInstance)
return
}
if (state.left) {
openState('none', instance, ownerInstance)
}
resetTouchStatus(instance)
}
/**
* 开始触摸操作
* @param {Object} e
* @param {Object} ins
*/
function touchstart(e, ownerInstance) {
var instance = e.instance;
var disabled = instance.getDataset().disabled
var state = instance.getState();
getDom(instance, ownerInstance)
// fix by mehaotian, TODO 兼容 app-vue 获取dataset为字符串 , h5 获取 为 undefined 的问题,待框架修复
disabled = (typeof(disabled) === 'string' ? JSON.parse(disabled) : disabled) || false;
if (disabled) return
// 开始触摸时移除动画类
instance.requestAnimationFrame(function() {
instance.removeClass('ani');
ownerInstance.callMethod('closeSwipe');
})
// 记录上次的位置
state.x = state.left || 0
// 计算滑动开始位置
stopTouchStart(e, ownerInstance)
}
/**
* 开始滑动操作
* @param {Object} e
* @param {Object} ownerInstance
*/
function touchmove(e, ownerInstance) {
var instance = e.instance;
var disabled = instance.getDataset().disabled
var state = instance.getState()
// fix by mehaotian, TODO 兼容 app-vue 获取dataset为字符串 , h5 获取 为 undefined 的问题,待框架修复
disabled = (typeof(disabled) === 'string' ? JSON.parse(disabled) : disabled) || false;
if (disabled) return
// 是否可以滑动页面
stopTouchMove(e);
if (state.direction !== 'horizontal') {
return;
}
if (e.preventDefault) {
// 阻止页面滚动
e.preventDefault()
}
move(state.x + state.deltaX, instance, ownerInstance)
}
/**
* 结束触摸操作
* @param {Object} e
* @param {Object} ownerInstance
*/
function touchend(e, ownerInstance) {
var instance = e.instance;
var disabled = instance.getDataset().disabled
var state = instance.getState()
// fix by mehaotian, TODO 兼容 app-vue 获取dataset为字符串 , h5 获取 为 undefined 的问题,待框架修复
disabled = (typeof(disabled) === 'string' ? JSON.parse(disabled) : disabled) || false;
if (disabled) return
// 滑动过程中触摸结束,通过阙值判断是开启还是关闭
// fixed by mehaotian 定时器解决点击按钮,touchend 触发比 click 事件时机早的问题 ,主要是 ios13
moveDirection(state.left, instance, ownerInstance)
}
/**
* 设置移动距离
* @param {Object} value
* @param {Object} instance
* @param {Object} ownerInstance
*/
function move(value, instance, ownerInstance) {
value = value || 0
var state = instance.getState()
var leftWidth = state.leftWidth
var rightWidth = state.rightWidth
// 获取可滑动范围
state.left = range(value, -rightWidth, leftWidth);
instance.requestAnimationFrame(function() {
instance.setStyle({
transform: 'translateX(' + state.left + 'px)',
'-webkit-transform': 'translateX(' + state.left + 'px)'
})
})
}
/**
* 获取元素信息
* @param {Object} instance
* @param {Object} ownerInstance
*/
function getDom(instance, ownerInstance) {
var state = instance.getState()
var leftDom = ownerInstance.selectComponent('.button-group--left')
var rightDom = ownerInstance.selectComponent('.button-group--right')
var leftStyles = {
width: 0
}
var rightStyles = {
width: 0
}
leftStyles = leftDom.getBoundingClientRect()
rightStyles = rightDom.getBoundingClientRect()
state.leftWidth = leftStyles.width || 0
state.rightWidth = rightStyles.width || 0
state.threshold = instance.getDataset().threshold
}
/**
* 获取范围
* @param {Object} num
* @param {Object} min
* @param {Object} max
*/
function range(num, min, max) {
return Math.min(Math.max(num, min), max);
}
/**
* 移动方向判断
* @param {Object} left
* @param {Object} value
* @param {Object} ownerInstance
* @param {Object} ins
*/
function moveDirection(left, ins, ownerInstance) {
var state = ins.getState()
var threshold = state.threshold
var position = state.position
var isopen = state.isopen || 'none'
var leftWidth = state.leftWidth
var rightWidth = state.rightWidth
if (state.deltaX === 0) {
openState('none', ins, ownerInstance)
return
}
if ((isopen === 'none' && rightWidth > 0 && -left > threshold) || (isopen !== 'none' && rightWidth > 0 &&
rightWidth +
left < threshold)) {
// right
openState('right', ins, ownerInstance)
} else if ((isopen === 'none' && leftWidth > 0 && left > threshold) || (isopen !== 'none' && leftWidth > 0 &&
leftWidth - left < threshold)) {
// left
openState('left', ins, ownerInstance)
} else {
// default
openState('none', ins, ownerInstance)
}
}
/**
* 开启状态
* @param {Boolean} type
* @param {Object} ins
* @param {Object} ownerInstance
*/
function openState(type, ins, ownerInstance) {
var state = ins.getState()
var leftWidth = state.leftWidth
var rightWidth = state.rightWidth
var left = ''
state.isopen = state.isopen ? state.isopen : 'none'
switch (type) {
case "left":
left = leftWidth
break
case "right":
left = -rightWidth
break
default:
left = 0
}
// && !state.throttle
if (state.isopen !== type) {
state.throttle = true
ownerInstance.callMethod('change', {
open: type
})
}
state.isopen = type
// 添加动画类
ins.requestAnimationFrame(function() {
ins.addClass('ani');
move(left, ins, ownerInstance)
})
// 设置最终移动位置,理论上只要进入到这个函数,肯定是要打开的
}
function getDirection(x, y) {
if (x > y && x > MIN_DISTANCE) {
return 'horizontal';
}
if (y > x && y > MIN_DISTANCE) {
return 'vertical';
}
return '';
}
/**
* 重置滑动状态
* @param {Object} event
*/
function resetTouchStatus(instance) {
var state = instance.getState();
state.direction = '';
state.deltaX = 0;
state.deltaY = 0;
state.offsetX = 0;
state.offsetY = 0;
}
/**
* 设置滑动开始位置
* @param {Object} event
*/
function stopTouchStart(event) {
var instance = event.instance;
var state = instance.getState();
resetTouchStatus(instance);
var touch = event.touches[0];
if (IS_HTML5 && isPC()) {
touch = event;
}
state.startX = touch.clientX;
state.startY = touch.clientY;
}
/**
* 滑动中,是否禁止打开
* @param {Object} event
*/
function stopTouchMove(event) {
var instance = event.instance;
var state = instance.getState();
var touch = event.touches[0];
if (IS_HTML5 && isPC()) {
touch = event;
}
state.deltaX = touch.clientX - state.startX;
state.deltaY = touch.clientY - state.startY;
state.offsetY = Math.abs(state.deltaY);
state.offsetX = Math.abs(state.deltaX);
state.direction = state.direction || getDirection(state.offsetX, state.offsetY);
}
function isPC() {
var userAgentInfo = navigator.userAgent;
var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
var flag = true;
for (var v = 0; v < Agents.length - 1; v++) {
if (userAgentInfo.indexOf(Agents[v]) > 0) {
flag = false;
break;
}
}
return flag;
}
var movable = false
function mousedown(e, ins) {
if (!IS_HTML5) return
if (!isPC()) return
touchstart(e, ins)
movable = true
}
function mousemove(e, ins) {
if (!IS_HTML5) return
if (!isPC()) return
if (!movable) return
touchmove(e, ins)
}
function mouseup(e, ins) {
if (!IS_HTML5) return
if (!isPC()) return
touchend(e, ins)
movable = false
}
function mouseleave(e, ins) {
if (!IS_HTML5) return
if (!isPC()) return
movable = false
}
module.exports = {
showWatch: showWatch,
touchstart: touchstart,
touchmove: touchmove,
touchend: touchend,
mousedown: mousedown,
mousemove: mousemove,
mouseup: mouseup,
mouseleave: mouseleave
}
src/uni_modules/uni-swipe-action/components/uni-swipe-action/uni-swipe-action.vue
0 → 100644
View file @
aebe688a
<
template
>
<view>
<slot></slot>
</view>
</
template
>
<
script
>
/**
* SwipeAction 滑动操作
* @description 通过滑动触发选项的容器
* @tutorial https://ext.dcloud.net.cn/plugin?id=181
*/
export
default
{
name
:
"uniSwipeAction"
,
data
()
{
return
{};
},
created
()
{
this
.
children
=
[];
},
methods
:
{
// 公开给用户使用,重制组件样式
resize
(){
// wxs 会自己计算组件大小,所以无需执行下面代码
// #ifndef APP-VUE || H5 || MP-WEIXIN
this
.
children
.
forEach
(
vm
=>
{
vm
.
init
()
})
// #endif
},
// 公开给用户使用,关闭全部 已经打开的组件
closeAll
(){
this
.
children
.
forEach
(
vm
=>
{
// #ifdef APP-VUE || H5 || MP-WEIXIN
vm
.
is_show
=
'none'
// #endif
// #ifndef APP-VUE || H5 || MP-WEIXIN
vm
.
close
()
// #endif
})
},
closeOther
(
vm
)
{
if
(
this
.
openItem
&&
this
.
openItem
!==
vm
)
{
// #ifdef APP-VUE || H5 || MP-WEIXIN
this
.
openItem
.
is_show
=
'none'
// #endif
// #ifndef APP-VUE || H5 || MP-WEIXIN
this
.
openItem
.
close
()
// #endif
}
// 记录上一个打开的 swipe-action-item ,用于 auto-close
this
.
openItem
=
vm
}
}
};
</
script
>
<
style
></
style
>
src/uni_modules/uni-swipe-action/package.json
0 → 100644
View file @
aebe688a
{
"id"
:
"uni-swipe-action"
,
"displayName"
:
"uni-swipe-action 滑动操作"
,
"version"
:
"1.3.2"
,
"description"
:
"SwipeAction 滑动操作操作组件"
,
"keywords"
:
[
""
,
"uni-ui"
,
"uniui"
,
"滑动删除"
,
"侧滑删除"
],
"repository"
:
"https://github.com/dcloudio/uni-ui"
,
"engines"
:
{
"HBuilderX"
:
""
},
"directories"
:
{
"example"
:
"../../temps/example_temps"
},
"dcloudext"
:
{
"category"
:
[
"前端组件"
,
"通用组件"
],
"sale"
:
{
"regular"
:
{
"price"
:
"0.00"
},
"sourcecode"
:
{
"price"
:
"0.00"
}
},
"contact"
:
{
"qq"
:
""
},
"declaration"
:
{
"ads"
:
"无"
,
"data"
:
"无"
,
"permissions"
:
"无"
},
"npmurl"
:
"https://www.npmjs.com/package/@dcloudio/uni-ui"
},
"uni_modules"
:
{
"dependencies"
:
[
"uni-scss"
],
"encrypt"
:
[],
"platforms"
:
{
"cloud"
:
{
"tcb"
:
"y"
,
"aliyun"
:
"y"
},
"client"
:
{
"App"
:
{
"app-vue"
:
"y"
,
"app-nvue"
:
"y"
},
"H5-mobile"
:
{
"Safari"
:
"y"
,
"Android Browser"
:
"y"
,
"微信浏览器(Android)"
:
"y"
,
"QQ浏览器(Android)"
:
"y"
},
"H5-pc"
:
{
"Chrome"
:
"y"
,
"IE"
:
"y"
,
"Edge"
:
"y"
,
"Firefox"
:
"y"
,
"Safari"
:
"y"
},
"小程序"
:
{
"微信"
:
"y"
,
"阿里"
:
"y"
,
"百度"
:
"y"
,
"字节跳动"
:
"y"
,
"QQ"
:
"y"
},
"快应用"
:
{
"华为"
:
"y"
,
"联盟"
:
"u"
},
"Vue"
:
{
"vue2"
:
"y"
,
"vue3"
:
"y"
}
}
}
}
}
\ No newline at end of file
src/uni_modules/uni-swipe-action/readme.md
0 → 100644
View file @
aebe688a
## SwipeAction 滑动操作
> **组件名:uni-swipe-action**
> 代码块: `uSwipeAction`、`uSwipeActionItem`
通过滑动触发选项的容器
### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-swipe-action)
#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment