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
c8ecc865
Commit
c8ecc865
authored
May 11, 2021
by
李超鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update:update
scope:self-support body:修改拍照页面问题、完工问题
parent
9cb25c04
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
2398 additions
and
1852 deletions
+2398
-1852
cert.js
src/common/api/cert.js
+13
-0
order.js
src/common/api/order.js
+5
-0
XhFiles.vue
src/components/createCom/XhFiles.vue
+110
-59
setting.vue
src/components/photo/setting.vue
+449
-449
index.vue
src/components/take/index.vue
+637
-637
order.vue
src/pages/index/order.vue
+3
-3
detail.vue
src/pages/mine/cert/detail.vue
+65
-0
index.vue
src/pages/mine/cert/index.vue
+148
-0
index.vue
src/pages/mine/customer/index.vue
+77
-0
index.vue
src/pages/mine/wallet/index.vue
+169
-0
complete.vue
src/pages/order/complete.vue
+146
-130
detail.vue
src/pages/order/detail.vue
+42
-41
list.vue
src/pages/photo/list.vue
+505
-504
setting.vue
src/pages/photo/setting.vue
+29
-29
No files found.
src/common/api/cert.js
0 → 100644
View file @
c8ecc865
const
globalUrl
=
process
.
uniEnv
||
{}
const
ucenterApiUrl
=
globalUrl
.
ucenterUrl
.
apiUrl
let
certApiFun
=
function
(
vm
){
let
getCertList
=
async
(
params
=
{})
=>
await
vm
.
$u
.
get
(
ucenterApiUrl
+
'/v1/settled/get-cert-list'
,
params
);
const
certApi
=
{
getCertList
}
return
certApi
}
module
.
exports
=
{
certApiFun
}
\ No newline at end of file
src/common/api/order.js
View file @
c8ecc865
...
...
@@ -64,6 +64,10 @@ let orderApiFun = function(vm){
* 获取拍照标准
*/
let
orderStandard
=
async
(
params
=
{})
=>
await
vm
.
$u
.
get
(
prefix
+
vm
.
vuex_token
+
'/photo/standard'
,
params
);
/**
* 获取拍照标准单独项目
*/
let
orderStandardItem
=
async
(
params
=
{})
=>
await
vm
.
$u
.
get
(
prefix
+
vm
.
vuex_token
+
'/photo/standard/only'
,
params
);
/**
* 保存图片信息
...
...
@@ -147,6 +151,7 @@ let orderApiFun = function(vm){
traceAndAppointment
,
rejectOrder
,
orderStandard
,
orderStandardItem
,
saveImage
,
getWatermark
,
saveWatermark
,
...
...
src/components/createCom/XhFiles.vue
View file @
c8ecc865
<!-- ******************* 文件上传 ******************* -->
<
template
>
<view>
<view
class=
"file-box"
v-if=
"!takeStatus"
>
<!--
<view
class=
"u-flex"
>
<view
class=
"txt u-flex-1"
>
{{
item
.
fieldsTitle
}}
</view>
<u-icon
name=
"arrow-right"
color=
"#666"
size=
"28"
></u-icon>
</view>
-->
<view
class=
"pics u-flex u-flex-wrap"
>
<view
class=
"img-list"
v-for=
"(item,index) in imgList"
:key=
"index"
>
<u-image
class=
"pic"
width=
"160"
height=
"160"
:src=
"item.path"
:border-radius=
"10"
@
click
.
stop=
"prviewImage(item.path,index)"
></u-image>
<view
class=
"icon-del-box"
@
click
.
stop=
"delFile(index)"
>
<view
class=
"icon-del"
></view>
<view
class=
"icon-del rotate"
></view>
</view>
</view>
<view
class=
"img-list"
>
<u-image
class=
"pic"
width=
"160rpx"
height=
"160rpx"
:border-radius=
"10"
@
click=
"selectUpload"
:src=
"uploadImage"
></u-image>
</view>
<!--
<u-image
class=
"pic"
v-for=
"item in 6"
width=
"170rpx"
height=
"170"
src=
"'https://cdn.uviewui.com/uview/example/fade.jpg"
></u-image>
-->
</view>
<u-action-sheet
:list=
"list"
v-model=
"maskShow"
:cancel-btn=
"true"
@
click=
"uploadSelect"
></u-action-sheet>
</view>
<take-photo
v-else
@
close=
"closeTake"
></take-photo>
<
template
>
<view>
<view
class=
"file-box"
v-if=
"!takeStatus"
>
<!--
<view
class=
"u-flex"
>
<view
class=
"txt u-flex-1"
>
{{
item
.
fieldsTitle
}}
</view>
<u-icon
name=
"arrow-right"
color=
"#666"
size=
"28"
></u-icon>
</view>
-->
<view
class=
"pics u-flex u-flex-wrap"
>
<view
class=
"img-list"
v-for=
"(item,index) in imgList"
:key=
"index"
>
<u-image
class=
"pic"
width=
"160"
height=
"160"
:src=
"item.path"
:border-radius=
"10"
@
click
.
stop=
"prviewImage(item.path,index)"
></u-image>
<view
class=
"icon-del-box"
@
click
.
stop=
"delFile(index)"
>
<view
class=
"icon-del"
></view>
<view
class=
"icon-del rotate"
></view>
</view>
</view>
<view
class=
"img-list"
>
<u-image
class=
"pic"
width=
"160rpx"
height=
"160rpx"
:border-radius=
"10"
@
click=
"selectUpload"
:src=
"uploadImage"
></u-image>
</view>
<!--
<u-image
class=
"pic"
v-for=
"item in 6"
width=
"170rpx"
height=
"170"
src=
"'https://cdn.uviewui.com/uview/example/fade.jpg"
></u-image>
-->
</view>
<u-action-sheet
:list=
"list"
v-model=
"maskShow"
:cancel-btn=
"true"
@
click=
"uploadSelect"
></u-action-sheet>
</view>
<take-photo
v-else
@
close=
"closeTake"
:currentItem=
"currentItemDate"
></take-photo>
</view>
</
template
>
<
script
>
import
arrMixin
from
'./arrMixin'
import
baseFile
from
'@/components/upload/index'
;
import
baseFile
from
'@/components/upload/index'
;
import
takePhoto
from
'@/components/take/index.vue'
export
default
{
name
:
'XhFiles'
,
components
:
{
'take-photo'
:
takePhoto
components
:
{
'take-photo'
:
takePhoto
},
mixins
:
[
arrMixin
,
baseFile
],
props
:
{
files
:
{
type
:
Array
,
}
},
partnerCompanyId
:
{
type
:
String
,
default
:
'{}'
},
},
filters
:{},
data
()
{
return
{
return
{
maskShow
:
false
,
list
:
[
{
...
...
@@ -53,14 +57,15 @@
}
],
takeStatus
:
false
,
currentItemDate
:{},
}
},
computed
:
{
settings
()
{
return
this
.
item
.
settings
||
[]
},
uploadImage
()
{
return
process
.
uniEnv
.
qn_base_url
+
'upload-file.png'
},
uploadImage
()
{
return
process
.
uniEnv
.
qn_base_url
+
'upload-file.png'
},
},
mounted
()
{
...
...
@@ -72,12 +77,12 @@
}
},
methods
:
{
selectUpload
(){
if
(
this
.
imgList
.
length
===
10
)
{
selectUpload
(){
if
(
this
.
imgList
.
length
===
10
)
{
return
this
.
$refs
.
uToast
.
show
({
title
:
'图片已超出最大数量'
,
type
:
'error'
,
})
})
}
// 弹窗展示
this
.
maskShow
=
true
...
...
@@ -106,23 +111,25 @@
}
// 使用拍照工具拍摄
this
.
takeStatus
=
true
this
.
getWatermark
()
this
.
getPhotoStander
()
},
setValue
()
{
const
dataValue
=
[]
this
.
imgList
.
map
(
item
=>
{
dataValue
.
push
(
item
.
path
)
})
})
this
.
valueChange
(
dataValue
)
},
closeTake
(
val
)
{
if
(
val
&&
val
.
length
>
0
){
val
.
forEach
((
item
,
index
,
array
)
=>
{
item
.
path
=
item
.
key
this
.
imgList
.
push
(
item
)
})
this
.
setValue
()
}
this
.
takeStatus
=
false
},
closeTake
(
val
)
{
if
(
val
&&
val
.
length
>
0
){
val
.
forEach
((
item
,
index
,
array
)
=>
{
item
.
path
=
item
.
key
this
.
imgList
.
push
(
item
)
})
this
.
setValue
()
}
this
.
takeStatus
=
false
},
prviewImage
(
url
,
index
)
{
uni
.
previewImage
({
...
...
@@ -133,27 +140,71 @@
delFile
(
index
)
{
this
.
imgList
.
splice
(
index
,
1
)
this
.
setValue
()
},
getPhotoStander
(){
// 获取拍照规范接口
let
self
=
this
// this.$u.api.orderStandardItem({}).then((res)=>{
// if (res.code == 200 && res.data.length>0) {
// self.currentItemDate = res.data[0]
// }else{
// console.log("获取完工项的拍照标准异常",res.data.message)
// }
// })
self
.
currentItemDate
=
{
"id"
:
154
,
"partnerCompanyId"
:
10331001475
,
"categoryId"
:
1100000216
,
"brandId"
:
null
,
"type"
:
"勘测部分"
,
"name"
:
"勘测单"
,
"fieldName"
:
"06"
,
"images"
:
[
"https://cloud-bak.banshouhui.com/2-勘测单.jpg"
],
"mainPoint"
:
[
"表格清晰,文字可辨"
,
"表格居中,不倾斜"
,
"全部填写完整,不能填写的部分划横杠。"
,
"涉及到用户签字部分,不允许我方人员代签,由用户或用户指定人进行签字确认。"
,
"涉及到物业的由现场物业人员签字确认。"
],
"note"
:
"正面拍摄,完整看到单据 4 条边"
,
"orderImages"
:
null
}
},
getWatermark
(){
if
(
getApp
().
globalData
.
photo
.
waterSetting
){
return
}
var
data
=
{
partnerCompanyId
:
this
.
partnerCompanyId
}
this
.
$u
.
api
.
getWatermark
(
data
).
then
((
res
)
=>
{
if
(
res
.
code
==
200
)
{
getApp
().
globalData
.
photo
.
waterSetting
=
res
.
data
}
else
{
console
.
log
(
"获取水印备注异常"
,
res
.
data
.
message
)
}
});
}
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
.img-list
{
position
:
relative
;
margin
:
8rpx
;
width
:
160rpx
;
height
:
160rpx
;
.pic
{
// margin-right: 15rpx;
// margin-bottom: 15rpx;
&
:nth-child
(
3n
)
{
margin-right
:
0
;
}
}
height
:
160rpx
;
.pic
{
// margin-right: 15rpx;
// margin-bottom: 15rpx;
&
:nth-child
(
3n
)
{
margin-right
:
0
;
}
}
.icon-del-box
{
/* #ifndef APP-NVUE */
display
:
flex
;
...
...
@@ -170,14 +221,14 @@
z-index
:
2
;
transform
:
rotate
(
-45deg
);
}
.icon-del
{
width
:
30rpx
;
height
:
4rpx
;
background-color
:
#fff
;
border-radius
:
2px
;
}
.rotate
{
position
:
absolute
;
transform
:
rotate
(
90deg
);
...
...
src/components/photo/setting.vue
View file @
c8ecc865
<
template
>
<view
class=
"backView"
>
<u-navbar
title=
"设置"
:title-size=
"26"
title-color=
"#000"
:custom-back=
"backTake"
></u-navbar>
<view
class=
"shadowBackView"
style=
"background-color: transparent;z-index: 1"
v-if=
"loading"
>
<u-loading
style=
"position: fixed;top: 50%;"
:show=
"loading"
size=
"36"
mode=
"flower"
></u-loading>
</view>
<view
class=
"itemView firstItem"
>
<view
class=
"itemTitleView"
>
<text
class=
"itemTitle"
>
保存原图
</text>
<text
class=
"itemNotice"
>
拍照后另保存一张无水印的图片
</text>
</view>
<switch
class=
"itemSwitch"
:checked=
"result['hasOrigin']"
@
change=
"handleOrigineChange"
color=
"#007AFF"
/>
</view>
<view
class=
"itemView"
v-if=
"showTitleSwitch"
>
<view
class=
"itemTitleView"
@
click=
"itemClick(
{},-1)">
<text
class=
"itemTitle"
>
水印标题
</text>
<text
class=
"itemNotice"
>
{{
result
[
'lowerLeft'
][
'title'
]
||
'点击可编辑更改'
}}
</text>
</view>
<switch
class=
"itemSwitch"
disabled
:checked=
"result['lowerLeft']['title'] != ''"
@
click=
"handleClickTitleSwitch"
color=
"#007AFF"
/>
</view>
<view
class=
"itemView"
v-for=
"(item,ikey) in itemList"
:key=
"ikey"
>
<view
class=
"itemTitleView"
@
click=
"itemClick(item,ikey)"
>
<text
class=
"itemTitle"
>
{{
item
[
'watemarkText'
]
||
'自定义'
+
(
ikey
+
1
)
}}
</text>
<text
class=
"itemNotice"
>
{{
item
[
'watemarkValue'
]
||
'点击可编辑更改'
}}
</text>
</view>
<switch
class=
"itemSwitch"
:checked=
"item['enable']"
@
change=
"itemChange(item, ikey)"
color=
"#007AFF"
/>
</view>
<u-popup
border-radius=
"10"
v-model=
"isPopShow"
safe-area-inset-bottom
:mask-close-able=
"false"
mode=
"center"
width=
"690rpx"
height=
"600rpx"
@
close=
"handlePopClose"
>
<view
class=
"popCenterView"
>
<text
class=
"popTitle"
>
设置自定义项
</text>
<view
class=
"inputBackView"
>
<view
class=
"ph-pop-left-view"
>
<view
class=
"leftInputView"
>
<input
class=
"leftInput"
type=
"text"
v-model=
"currenItem['watemarkText']"
@
input=
"leftInput()"
:disabled=
"currenItem.type === '备注'"
placeholder=
"请输入"
maxlength=
"10"
/>
</view>
<view
class=
"ph-pop-tip-view"
v-if=
"showTipLeft"
>
*必填项
</view>
</view>
<view
class=
"ph-pop-mid-view"
>
:
</view>
<view>
<view
class=
"rightInputView"
>
<input
class=
"rightInput"
type=
"text"
v-model=
"currenItem['watemarkValue']"
@
input=
"rightInput()"
placeholder=
"请输入内容"
maxlength=
"30"
/>
</view>
<view
class=
"ph-pop-tip-view"
v-if=
"showTipRight"
>
*必填项
</view>
</view>
</view>
<text
class=
"popNoticeText u-m-t-20"
>
示例:
</text>
<text
class=
"popNoticeText"
>
工程队名称:蓝天工程队
</text>
<view
class=
"popBtnView"
>
<u-button
:custom-style=
"customStyleCancel"
hover-class=
"none"
shape=
"circle"
type=
"primary"
@
click=
"popCancelClick()"
>
取消
</u-button>
<u-button
:custom-style=
"customStyleSave"
shape=
"circle"
type=
"primary"
@
click=
"popSaveClick()"
>
保存
</u-button>
</view>
</view>
</u-popup>
</view>
</
template
>
<
script
>
export
default
{
data
()
{
return
{
systemId
:
''
,
isSaveOrigine
:
true
,
isPopShow
:
false
,
icon_close_new
:
''
,
result
:
{
hasOrigin
:
true
,
lowerLeft
:
{
body
:
[]
}
},
currenItem
:
{
'watemarkText'
:
''
,
'watemarkValue'
:
''
},
editingItem
:
{},
showTipLeft
:
false
,
showTipRight
:
false
,
loading
:
true
}
},
computed
:
{
itemList
()
{
console
.
log
(
this
.
result
)
if
(
this
.
result
[
'lowerLeft'
])
{
var
arr
=
this
.
result
[
'lowerLeft'
][
'body'
]
return
arr
.
filter
((
item
)
=>
{
return
item
.
watemarkType
===
'备注'
})
}
else
{
return
[]
}
},
showTitleSwitch
()
{
return
this
.
result
[
'lowerLeft'
].
hasOwnProperty
(
'title'
)
},
customStyleCancel
()
{
return
{
'background-color'
:
'#D1D4D4'
,
'width'
:
'280rpx'
,
'height'
:
'96rpx'
}
},
customStyleSave
()
{
return
{
'background-color'
:
'##2272FF'
,
'width'
:
'280rpx'
,
'height'
:
'96rpx'
,
'margin-left'
:
'50rpx'
}
}
},
created
(
e
)
{
getApp
().
trackPage
(
'水印设置页'
)
const
globalData
=
getApp
().
globalData
this
.
icon_close_new
=
globalData
.
icon_close_new
this
.
systemId
=
globalData
.
photo
.
currentItem
.
partnerCompanyId
this
.
getItemList
()
},
methods
:
{
getItemList
:
function
()
{
this
.
loading
=
true
this
.
$u
.
api
.
getWatermark
({
partnerCompanyId
:
this
.
systemId
}).
then
(
res
=>
{
if
(
res
.
code
==
200
)
{
this
.
result
=
res
.
data
}
else
{
uni
.
showToast
({
title
:
res
.
data
.
message
})
}
this
.
loading
=
false
})
},
saveUserWatermark
:
function
()
{
this
.
loading
=
true
this
.
$u
.
api
.
saveWatermark
(
this
.
result
).
then
(
res
=>
{
if
(
res
.
code
===
200
){
uni
.
showToast
({
title
:
'保存成功'
})
getApp
().
globalData
.
photo
.
waterSetting
=
this
.
result
this
.
$emit
(
"changeWatermark"
,
this
.
result
);
}
else
{
uni
.
showToast
({
title
:
res
.
message
})
}
this
.
loading
=
false
})
},
//保存原图 开关
handleOrigineChange
:
function
(
e
)
{
this
.
result
[
'hasOrigin'
]
=
!
this
.
result
[
'hasOrigin'
]
this
.
saveUserWatermark
()
},
handleClickTitleSwitch
:
function
(
e
)
{
var
string
=
this
.
result
[
'lowerLeft'
][
'title'
]
?
'水印标题不可关闭'
:
'请先编辑该自定义项'
uni
.
showToast
({
icon
:
'none'
,
title
:
string
})
},
//自定义 开关
itemChange
:
function
(
item
,
ikey
)
{
if
(
item
[
'watemarkValue'
])
{
// 修改
item
[
'enable'
]
=
!
item
[
'enable'
]
this
.
saveUserWatermark
()
}
else
{
uni
.
showToast
({
icon
:
'none'
,
title
:
'请先编辑该自定义项'
})
}
},
//自定义 点击
itemClick
:
function
(
item
,
ikey
)
{
if
(
ikey
===
-
1
)
{
this
.
currenItem
=
{
'watemarkText'
:
'水印标题'
,
'watemarkValue'
:
this
.
result
[
'lowerLeft'
][
'title'
],
'type'
:
'备注'
}
}
else
{
this
.
editingItem
=
item
this
.
currenItem
=
{
...
item
}
}
this
.
isPopShow
=
true
},
//左侧输入框
leftInput
:
function
(
e
)
{
if
(
this
.
currenItem
[
'watemarkText'
])
{
this
.
showTipLeft
=
false
}
},
//右侧输入框
rightInput
:
function
(
e
)
{
if
(
this
.
currenItem
[
'watemarkValue'
])
{
this
.
showTipRight
=
false
}
},
//自定义弹窗 关闭
popCancelClick
:
function
()
{
this
.
isPopShow
=
false
this
.
currenItem
=
{
'watemarkText'
:
''
,
'watemarkValue'
:
''
}
},
handlePopClose
()
{
this
.
showTipLeft
=
false
,
this
.
showTipRight
=
false
},
backTake
()
{
this
.
$emit
(
'changeType'
,
1
)
},
//自定义弹窗 保存
popSaveClick
:
function
()
{
if
(
this
.
currenItem
[
'watemarkText'
]
&&
this
.
currenItem
[
'watemarkValue'
])
{
this
.
isPopShow
=
false
if
(
this
.
currenItem
.
type
===
'备注'
)
{
this
.
result
[
'lowerLeft'
][
'title'
]
=
this
.
currenItem
[
'watemarkValue'
]
}
else
{
this
.
editingItem
[
'watemarkText'
]
=
this
.
currenItem
[
'watemarkText'
]
this
.
editingItem
[
'watemarkValue'
]
=
this
.
currenItem
[
'watemarkValue'
]
this
.
editingItem
[
'enable'
]
=
true
}
this
.
saveUserWatermark
()
}
else
{
// 提示
if
(
!
this
.
currenItem
[
'watemarkText'
])
{
this
.
showTipLeft
=
true
}
if
(
!
this
.
currenItem
[
'watemarkValue'
])
{
this
.
showTipRight
=
true
}
}
}
}
}
</
script
>
<
style
>
.backView
{
background-color
:
#FAFAFA
;
position
:
absolute
;
top
:
0
;
left
:
0
;
width
:
100%
;
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
}
/*
.firstItemView{
background-color: #FFFFFF;
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
padding-top: 80rpx;
padding-bottom: 80rpx;
border-bottom: 2rpx solid #F4F5F7;
} */
.itemView
{
background-color
:
#FFFFFF
;
width
:
100%
;
display
:
flex
;
flex-direction
:
row
;
align-items
:
center
;
justify-content
:
space-between
;
padding-top
:
54
rpx
;
padding-bottom
:
54
rpx
;
}
.itemView.firstItem
{
border-bottom
:
2
rpx
solid
#F4F5F7
;
}
.itemTitleView
{
background-color
:
#FFFFFF
;
width
:
80%
;
display
:
flex
;
flex-direction
:
column
;
padding-left
:
30
rpx
;
}
.itemTitle
{
font-size
:
32
rpx
;
font-weight
:
bold
;
color
:
#333333
;
}
.itemNotice
{
font-size
:
26
rpx
;
color
:
#666666
;
margin-top
:
4
rpx
;
}
.itemSwitch
{
margin-right
:
30
rpx
;
transform
:
scale
(
0.78
,
0.75
);
}
.shadowBackView
{
background-color
:
rgba
(
0
,
0
,
0
,
0.5
);
position
:
absolute
;
top
:
0
;
left
:
0
;
width
:
100%
;
height
:
100%
;
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
}
.popCenterView
{
background-color
:
#FFFFFF
;
display
:
flex
;
flex-direction
:
column
;
}
.popTitle
{
font-size
:
36
rpx
;
font-weight
:
bold
;
margin-top
:
50
rpx
;
padding-left
:
30
rpx
;
}
.inputBackView
{
margin-top
:
52
rpx
;
width
:
100%
;
height
:
90
rpx
;
display
:
flex
;
flex-direction
:
row
;
align-items
:
center
;
justify-content
:
space-between
;
display
:
flex
;
align-items
:
flex-start
;
}
.leftInputView
{
width
:
220
rpx
;
height
:
72
rpx
;
border
:
2
rpx
solid
#666666
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
}
.leftInput
{
width
:
180
rpx
;
height
:
32
rpx
;
}
.ph-pop-left-view
{
margin-left
:
30
rpx
;
}
.ph-pop-tip-view
{
color
:
#F56C6C
;
}
.ph-pop-mid-view
{
margin-top
:
20
rpx
;
}
.rightInputView
{
width
:
360
rpx
;
height
:
72
rpx
;
border
:
2
rpx
solid
#666666
;
margin-right
:
30
rpx
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
}
.rightInput
{
width
:
320
rpx
;
height
:
32
rpx
;
}
.popNoticeText
{
font-size
:
26
rpx
;
color
:
#666666
;
padding-left
:
30
rpx
;
}
.popBtnView
{
margin-top
:
110
rpx
;
width
:
100%
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
}
/* .popCancelBtn {
background-color: #D1D4D4;
width: 280rpx;
height: 96rpx;
border-radius: 48rpx;
margin-left: 40rpx;
display: flex;
align-items: center;
justify-content: center;
} */
/* .popSaveBtn {
background-color: #2272FF;
width: 280rpx;
height: 96rpx;
border-radius: 48rpx;
margin-right: 40rpx;
display: flex;
align-items: center;
justify-content: center;
} */
/* .popBtnText {
font-size: 32rpx;
color: #FFFFFF;
font-weight: 600;
} */
</
style
>
<
template
>
<view
class=
"backView"
>
<u-navbar
title=
"设置"
:title-size=
"26"
title-color=
"#000"
:custom-back=
"backTake"
></u-navbar>
<view
class=
"shadowBackView"
style=
"background-color: transparent;z-index: 1"
v-if=
"loading"
>
<u-loading
style=
"position: fixed;top: 50%;"
:show=
"loading"
size=
"36"
mode=
"flower"
></u-loading>
</view>
<view
class=
"itemView firstItem"
>
<view
class=
"itemTitleView"
>
<text
class=
"itemTitle"
>
保存原图
</text>
<text
class=
"itemNotice"
>
拍照后另保存一张无水印的图片
</text>
</view>
<switch
class=
"itemSwitch"
:checked=
"result['hasOrigin']"
@
change=
"handleOrigineChange"
color=
"#007AFF"
/>
</view>
<view
class=
"itemView"
v-if=
"showTitleSwitch"
>
<view
class=
"itemTitleView"
@
click=
"itemClick(
{},-1)">
<text
class=
"itemTitle"
>
水印标题
</text>
<text
class=
"itemNotice"
>
{{
result
[
'lowerLeft'
][
'title'
]
||
'点击可编辑更改'
}}
</text>
</view>
<switch
class=
"itemSwitch"
disabled
:checked=
"result['lowerLeft']['title'] != ''"
@
click=
"handleClickTitleSwitch"
color=
"#007AFF"
/>
</view>
<view
class=
"itemView"
v-for=
"(item,ikey) in itemList"
:key=
"ikey"
>
<view
class=
"itemTitleView"
@
click=
"itemClick(item,ikey)"
>
<text
class=
"itemTitle"
>
{{
item
[
'watemarkText'
]
||
'自定义'
+
(
ikey
+
1
)
}}
</text>
<text
class=
"itemNotice"
>
{{
item
[
'watemarkValue'
]
||
'点击可编辑更改'
}}
</text>
</view>
<switch
class=
"itemSwitch"
:checked=
"item['enable']"
@
change=
"itemChange(item, ikey)"
color=
"#007AFF"
/>
</view>
<u-popup
border-radius=
"10"
v-model=
"isPopShow"
safe-area-inset-bottom
:mask-close-able=
"false"
mode=
"center"
width=
"690rpx"
height=
"600rpx"
@
close=
"handlePopClose"
>
<view
class=
"popCenterView"
>
<text
class=
"popTitle"
>
设置自定义项
</text>
<view
class=
"inputBackView"
>
<view
class=
"ph-pop-left-view"
>
<view
class=
"leftInputView"
>
<input
class=
"leftInput"
type=
"text"
v-model=
"currenItem['watemarkText']"
@
input=
"leftInput()"
:disabled=
"currenItem.type === '备注'"
placeholder=
"请输入"
maxlength=
"10"
/>
</view>
<view
class=
"ph-pop-tip-view"
v-if=
"showTipLeft"
>
*必填项
</view>
</view>
<view
class=
"ph-pop-mid-view"
>
:
</view>
<view>
<view
class=
"rightInputView"
>
<input
class=
"rightInput"
type=
"text"
v-model=
"currenItem['watemarkValue']"
@
input=
"rightInput()"
placeholder=
"请输入内容"
maxlength=
"30"
/>
</view>
<view
class=
"ph-pop-tip-view"
v-if=
"showTipRight"
>
*必填项
</view>
</view>
</view>
<text
class=
"popNoticeText u-m-t-20"
>
示例:
</text>
<text
class=
"popNoticeText"
>
工程队名称:蓝天工程队
</text>
<view
class=
"popBtnView"
>
<u-button
:custom-style=
"customStyleCancel"
hover-class=
"none"
shape=
"circle"
type=
"primary"
@
click=
"popCancelClick()"
>
取消
</u-button>
<u-button
:custom-style=
"customStyleSave"
shape=
"circle"
type=
"primary"
@
click=
"popSaveClick()"
>
保存
</u-button>
</view>
</view>
</u-popup>
</view>
</
template
>
<
script
>
export
default
{
data
()
{
return
{
systemId
:
''
,
isSaveOrigine
:
true
,
isPopShow
:
false
,
icon_close_new
:
''
,
result
:
{
hasOrigin
:
true
,
lowerLeft
:
{
body
:
[]
}
},
currenItem
:
{
'watemarkText'
:
''
,
'watemarkValue'
:
''
},
editingItem
:
{},
showTipLeft
:
false
,
showTipRight
:
false
,
loading
:
true
}
},
computed
:
{
itemList
()
{
console
.
log
(
this
.
result
)
if
(
this
.
result
[
'lowerLeft'
])
{
var
arr
=
this
.
result
[
'lowerLeft'
][
'body'
]
return
arr
.
filter
((
item
)
=>
{
return
item
.
watemarkType
===
'备注'
})
}
else
{
return
[]
}
},
showTitleSwitch
()
{
return
this
.
result
[
'lowerLeft'
].
hasOwnProperty
(
'title'
)
},
customStyleCancel
()
{
return
{
'background-color'
:
'#D1D4D4'
,
'width'
:
'280rpx'
,
'height'
:
'96rpx'
}
},
customStyleSave
()
{
return
{
'background-color'
:
'##2272FF'
,
'width'
:
'280rpx'
,
'height'
:
'96rpx'
,
'margin-left'
:
'50rpx'
}
}
},
created
(
e
)
{
getApp
().
trackPage
(
'水印设置页'
)
const
globalData
=
getApp
().
globalData
this
.
icon_close_new
=
globalData
.
icon_close_new
this
.
systemId
=
globalData
.
photo
.
currentItem
.
partnerCompanyId
this
.
getItemList
()
},
methods
:
{
getItemList
:
function
()
{
this
.
loading
=
true
this
.
$u
.
api
.
getWatermark
({
partnerCompanyId
:
this
.
systemId
}).
then
(
res
=>
{
if
(
res
.
code
==
200
)
{
this
.
result
=
res
.
data
}
else
{
uni
.
showToast
({
title
:
res
.
data
.
message
})
}
this
.
loading
=
false
})
},
saveUserWatermark
:
function
()
{
this
.
loading
=
true
this
.
$u
.
api
.
saveWatermark
(
this
.
result
).
then
(
res
=>
{
if
(
res
.
code
===
200
){
uni
.
showToast
({
title
:
'保存成功'
})
getApp
().
globalData
.
photo
.
waterSetting
=
this
.
result
this
.
$emit
(
"changeWatermark"
,
this
.
result
);
}
else
{
uni
.
showToast
({
title
:
res
.
message
})
}
this
.
loading
=
false
})
},
//保存原图 开关
handleOrigineChange
:
function
(
e
)
{
this
.
result
[
'hasOrigin'
]
=
!
this
.
result
[
'hasOrigin'
]
this
.
saveUserWatermark
()
},
handleClickTitleSwitch
:
function
(
e
)
{
var
string
=
this
.
result
[
'lowerLeft'
][
'title'
]
?
'水印标题不可关闭'
:
'请先编辑该自定义项'
uni
.
showToast
({
icon
:
'none'
,
title
:
string
})
},
//自定义 开关
itemChange
:
function
(
item
,
ikey
)
{
if
(
item
[
'watemarkValue'
])
{
// 修改
item
[
'enable'
]
=
!
item
[
'enable'
]
this
.
saveUserWatermark
()
}
else
{
uni
.
showToast
({
icon
:
'none'
,
title
:
'请先编辑该自定义项'
})
}
},
//自定义 点击
itemClick
:
function
(
item
,
ikey
)
{
if
(
ikey
===
-
1
)
{
this
.
currenItem
=
{
'watemarkText'
:
'水印标题'
,
'watemarkValue'
:
this
.
result
[
'lowerLeft'
][
'title'
],
'type'
:
'备注'
}
}
else
{
this
.
editingItem
=
item
this
.
currenItem
=
{
...
item
}
}
this
.
isPopShow
=
true
},
//左侧输入框
leftInput
:
function
(
e
)
{
if
(
this
.
currenItem
[
'watemarkText'
])
{
this
.
showTipLeft
=
false
}
},
//右侧输入框
rightInput
:
function
(
e
)
{
if
(
this
.
currenItem
[
'watemarkValue'
])
{
this
.
showTipRight
=
false
}
},
//自定义弹窗 关闭
popCancelClick
:
function
()
{
this
.
isPopShow
=
false
this
.
currenItem
=
{
'watemarkText'
:
''
,
'watemarkValue'
:
''
}
},
handlePopClose
()
{
this
.
showTipLeft
=
false
,
this
.
showTipRight
=
false
},
backTake
()
{
this
.
$emit
(
'changeType'
,
1
)
},
//自定义弹窗 保存
popSaveClick
:
function
()
{
if
(
this
.
currenItem
[
'watemarkText'
]
&&
this
.
currenItem
[
'watemarkValue'
])
{
this
.
isPopShow
=
false
if
(
this
.
currenItem
.
type
===
'备注'
)
{
this
.
result
[
'lowerLeft'
][
'title'
]
=
this
.
currenItem
[
'watemarkValue'
]
}
else
{
this
.
editingItem
[
'watemarkText'
]
=
this
.
currenItem
[
'watemarkText'
]
this
.
editingItem
[
'watemarkValue'
]
=
this
.
currenItem
[
'watemarkValue'
]
this
.
editingItem
[
'enable'
]
=
true
}
this
.
saveUserWatermark
()
}
else
{
// 提示
if
(
!
this
.
currenItem
[
'watemarkText'
])
{
this
.
showTipLeft
=
true
}
if
(
!
this
.
currenItem
[
'watemarkValue'
])
{
this
.
showTipRight
=
true
}
}
}
}
}
</
script
>
<
style
>
.backView
{
background-color
:
#FAFAFA
;
position
:
absolute
;
top
:
0
;
left
:
0
;
width
:
100%
;
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
}
/*
.firstItemView{
background-color: #FFFFFF;
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
padding-top: 80rpx;
padding-bottom: 80rpx;
border-bottom: 2rpx solid #F4F5F7;
} */
.itemView
{
background-color
:
#FFFFFF
;
width
:
100%
;
display
:
flex
;
flex-direction
:
row
;
align-items
:
center
;
justify-content
:
space-between
;
padding-top
:
54
rpx
;
padding-bottom
:
54
rpx
;
}
.itemView.firstItem
{
border-bottom
:
2
rpx
solid
#F4F5F7
;
}
.itemTitleView
{
background-color
:
#FFFFFF
;
width
:
80%
;
display
:
flex
;
flex-direction
:
column
;
padding-left
:
30
rpx
;
}
.itemTitle
{
font-size
:
32
rpx
;
font-weight
:
bold
;
color
:
#333333
;
}
.itemNotice
{
font-size
:
26
rpx
;
color
:
#666666
;
margin-top
:
4
rpx
;
}
.itemSwitch
{
margin-right
:
30
rpx
;
transform
:
scale
(
0.78
,
0.75
);
}
.shadowBackView
{
background-color
:
rgba
(
0
,
0
,
0
,
0.5
);
position
:
absolute
;
top
:
0
;
left
:
0
;
width
:
100%
;
height
:
100%
;
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
}
.popCenterView
{
background-color
:
#FFFFFF
;
display
:
flex
;
flex-direction
:
column
;
}
.popTitle
{
font-size
:
36
rpx
;
font-weight
:
bold
;
margin-top
:
50
rpx
;
padding-left
:
30
rpx
;
}
.inputBackView
{
margin-top
:
52
rpx
;
width
:
100%
;
height
:
90
rpx
;
display
:
flex
;
flex-direction
:
row
;
align-items
:
center
;
justify-content
:
space-between
;
display
:
flex
;
align-items
:
flex-start
;
}
.leftInputView
{
width
:
220
rpx
;
height
:
72
rpx
;
border
:
2
rpx
solid
#666666
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
}
.leftInput
{
width
:
180
rpx
;
height
:
32
rpx
;
}
.ph-pop-left-view
{
margin-left
:
30
rpx
;
}
.ph-pop-tip-view
{
color
:
#F56C6C
;
}
.ph-pop-mid-view
{
margin-top
:
20
rpx
;
}
.rightInputView
{
width
:
360
rpx
;
height
:
72
rpx
;
border
:
2
rpx
solid
#666666
;
margin-right
:
30
rpx
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
}
.rightInput
{
width
:
320
rpx
;
height
:
32
rpx
;
}
.popNoticeText
{
font-size
:
26
rpx
;
color
:
#666666
;
padding-left
:
30
rpx
;
}
.popBtnView
{
margin-top
:
110
rpx
;
width
:
100%
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
}
/* .popCancelBtn {
background-color: #D1D4D4;
width: 280rpx;
height: 96rpx;
border-radius: 48rpx;
margin-left: 40rpx;
display: flex;
align-items: center;
justify-content: center;
} */
/* .popSaveBtn {
background-color: #2272FF;
width: 280rpx;
height: 96rpx;
border-radius: 48rpx;
margin-right: 40rpx;
display: flex;
align-items: center;
justify-content: center;
} */
/* .popBtnText {
font-size: 32rpx;
color: #FFFFFF;
font-weight: 600;
} */
</
style
>
src/components/take/index.vue
View file @
c8ecc865
<
template
>
<view
class=
"camera"
>
<view
class=
"camera-container"
v-if=
"showType === 1"
>
<cover-view
class=
"header-box"
:style=
"
{'height':navHeight/2 + 'px'}">
<cover-view
class=
"inner"
>
<cover-image
@
click=
"setCameraInfo('devicePosition')"
class=
"icon"
mode=
"aspectFit"
src=
"/static/photo/icon-switch.png"
></cover-image>
<cover-image
@
click=
"setCameraInfo('flash')"
class=
"icon"
mode=
"aspectFit"
:src=
"'/static/photo/icon-light-' + cameraInfo.flash +'.png'"
></cover-image>
<cover-image
v-if=
"currentItem.partnerCompanyId"
@
click=
"changeType(3)"
class=
"icon"
mode=
"aspectFit"
src=
"/static/photo/icon-setting.png"
></cover-image>
</cover-view>
</cover-view>
<camera
class=
"camera-box"
v-if=
"cameraChange&&!standardShow"
:device-position=
"cameraInfo.devicePosition"
:flash=
"cameraInfo.flash"
:style=
"
{'height':cameraHeight/2 + 'px','top':parseInt(navHeight/2) + 'px'}"
@error="cameraError">
<cover-view
class=
"mark-box"
>
<cover-view
class=
"txt big"
v-if=
"titleTxt"
>
{{
titleTxt
}}
</cover-view>
<cover-view
class=
"txt"
v-for=
"(txt,index) in settingTxtArr"
:key=
"index"
>
{{
txt
||
'获取中'
}}
</cover-view>
<!--
<cover-view
class=
"txt u-m-t-10"
>
维度:
{{
waterInfo
.
latitude
||
'正在获取中...'
}}
</cover-view>
<cover-view
class=
"txt u-m-t-10"
>
地址:
{{
waterInfo
.
address
||
'正在获取中...'
}}
</cover-view>
<cover-view
class=
"txt u-m-t-10"
>
时间:
{{
waterInfo
.
date
||
'正在获取中...'
}}
</cover-view>
-->
</cover-view>
<cover-image
class=
"mark-water"
mode=
"aspectFit"
:src=
"waterInfo.markImage"
></cover-image>
</camera>
<cover-view
class=
"bottom-box"
v-if=
"!standardShow"
>
<cover-image
class=
"icon"
src=
'/static/photo/icon-back.png'
mode=
""
@
click=
"goBack"
></cover-image>
<cover-image
class=
'icon-take icon'
src=
'/static/photo/icon-take.png'
@
click=
"$u.debounce(takePhoto, 500)"
>
</cover-image>
<cover-image
class=
'icon'
src=
'/static/photo/icon-standard.png'
@
click=
"standardShow = true"
v-if=
"standardStatus"
>
</cover-image>
<view
class=
'icon'
v-else
></view>
</cover-view>
<canvas
canvas-id=
"canvas"
id=
"photoCanvas"
class=
"canvas"
:style=
"
{'width':750 + 'rpx','height': cameraHeight + 'rpx'}">
</canvas>
<view
v-show=
"standardShow"
class=
"page-mask"
:z-index=
"10000"
>
<photo-standard
:currentItem=
"currentItem"
/>
<view
class=
"btn-close"
>
<image
@
click=
"closeShadow"
class=
"icon icon-close"
mode=
"aspectFit"
src=
"/static/photo/icon-close.png"
></image>
</view>
</view>
</view>
<photo-preview
v-if=
"showType === 2"
@
changeType=
"changeType"
@
finish=
"finish"
/>
<photo-setting
v-if=
"showType === 3"
@
changeType=
"changeType"
@
changeWatermark=
"changeWatermark"
/>
</view>
</
template
>
<
script
>
let
r
=
require
(
"@/libs/bmap-wx.min.js"
);
let
h
=
new
r
.
BMapWX
({
// ak: "rpVq5d3yxaRCoKzVwmFMo0o4iC524CAG",
ak
:
"iXsGdyEcm1iQONoUPyEp0hrBTLCuOaW2"
});
import
standard
from
'@/components/photo/standard.vue'
import
preview
from
'@/components/photo/preview.vue'
import
setting
from
'@/components/photo/setting.vue'
export
default
{
props
:
{
currentItem
:
{
// 对应的规范item
default
()
{
return
{
_id
:
''
,
// 规格ID
system_id
:
''
,
// 系统ID
brand_id
:
''
,
// 品牌ID
classify_id
:
''
,
// 分类ID
images
:
[],
// 拍照要求示意图
main_point
:
[]
// 要点
}
}
}
},
components
:
{
'photo-standard'
:
standard
,
'photo-preview'
:
preview
,
'photo-setting'
:
setting
,
},
data
()
{
return
{
showType
:
1
,
standardShow
:
false
,
cameraInfo
:
{
devicePosition
:
'back'
,
flash
:
'auto'
},
waterInfo
:
{
longitude
:
''
,
// 经度
latitude
:
''
,
// 维度
address
:
''
,
//地址
date
:
''
,
//日期
markImage
:
'https://qn-static.banshouhui.com/live_mark.png'
},
tempImgs
:
{
'markImage'
:
''
,
// 拍照水印
'origin'
:
''
,
// 无水印照片
'mixWater'
:
''
,
// 有水印照片
},
authSetting
:
{
camera
:
false
,
// 相机授权
location
:
false
,
// 位置授权
},
navHeight
:
130
,
cameraWidth
:
750
,
cameraHeight
:
1000
,
// (4 / 3 * 750) 图片比例4:3
ratio
:
0
,
cameraChange
:
false
,
waterSetting
:
null
,
shadowInitShow
:
false
,
// 第一次进入页面需显示弹窗
standardStatus
:
false
// 是否显示拍照要求
}
},
created
(
e
)
{
const
photo
=
getApp
().
globalData
.
photo
getApp
().
trackPage
(
'拍照页'
)
photo
.
allImages
=
[]
photo
.
currentItemLength
=
0
// this.ctx = uni.createCameraContext();
this
.
updateTime
()
this
.
getLocation
()
this
.
getMarkPath
()
this
.
initData
()
photo
.
currentItem
=
this
.
currentItem
if
(
this
.
currentItem
.
images
.
length
>
0
)
{
this
.
shadowInitShow
=
true
this
.
standardShow
=
true
this
.
standardStatus
=
true
}
},
computed
:
{
titleTxt
()
{
const
waterSetting
=
this
.
waterSetting
let
txt
=
''
if
(
!
waterSetting
||
!
waterSetting
.
lowerLeft
)
{
return
''
}
txt
=
waterSetting
.
lowerLeft
&&
waterSetting
.
lowerLeft
.
title
||
''
return
txt
},
settingTxtArr
()
{
let
arr
=
[]
// 包含经纬度
const
waterInfo
=
this
.
waterInfo
arr
=
[
'经度:'
+
waterInfo
.
longitude
,
'纬度:'
+
waterInfo
.
latitude
,
'地址:'
+
waterInfo
.
address
,
'时间:'
+
waterInfo
.
date
]
let
settingTxtArr
=
[]
const
typeArr
=
[
'经度'
,
'纬度'
,
'地址'
,
'时间'
]
const
waterSetting
=
this
.
waterSetting
if
(
!
waterSetting
||
!
waterSetting
.
lowerLeft
||
!
waterSetting
.
lowerLeft
.
body
)
{
return
arr
}
const
settingArr
=
waterSetting
.
lowerLeft
.
body
settingArr
.
map
(
item
=>
{
const
idx
=
typeArr
.
indexOf
(
item
.
watemarkType
)
if
(
item
.
enable
&&
(
idx
>
-
1
||
(
item
.
watemarkValue
&&
item
.
watemarkText
)))
{
if
(
idx
>
-
1
)
{
settingTxtArr
.
push
(
arr
[
idx
])
}
else
{
settingTxtArr
.
push
(
item
.
watemarkText
+
':'
+
item
.
watemarkValue
)
}
}
})
return
settingTxtArr
}
},
watch
:
{},
mounted
()
{
// 默认开启弹窗
const
photo
=
getApp
().
globalData
.
photo
this
.
waterSetting
=
photo
.
waterSetting
this
.
standardShow
=
this
.
shadowInitShow
this
.
cameraChange
=
true
// this.initData()
},
destroyed
(){
this
.
cameraChange
=
false
},
methods
:
{
closeShadow
()
{
this
.
shadowInitShow
=
false
this
.
standardShow
=
false
},
goBack
()
{
uni
.
showTabBar
()
this
.
$emit
(
'close'
)
},
finish
()
{
uni
.
showTabBar
()
const
photo
=
getApp
().
globalData
.
photo
this
.
$emit
(
'close'
,
photo
.
allImages
)
},
changeType
(
type
)
{
this
.
showType
=
type
},
changeWatermark
(
watermark
){
this
.
waterSetting
=
watermark
},
updateTime
()
{
this
.
waterInfo
.
date
=
this
.
getTime
()
// let timer = setTimeout(() => {
// clearTimeout(timer);
// this.updateTime()
// }, 1000)
},
setCameraInfo
(
type
)
{
// 设置相机前置后置、闪关灯等
const
cameraInfo
=
this
.
cameraInfo
let
val
=
cameraInfo
[
type
]
switch
(
type
)
{
case
'devicePosition'
:
val
=
val
===
'back'
?
'front'
:
'back'
break
;
case
'flash'
:
val
=
val
===
'auto'
?
'on'
:
(
val
===
'on'
?
'off'
:
'auto'
)
break
;
defalut
:
break
;
}
this
.
cameraInfo
[
type
]
=
val
},
initData
()
{
const
globalData
=
getApp
().
globalData
this
.
navHeight
=
globalData
.
navHeight
this
.
cameraHeight
=
parseInt
(
globalData
.
safeHeight
*
2
-
globalData
.
navHeight
-
200
)
this
.
ratio
=
globalData
.
screenHeight
/
globalData
.
rpxScreenHeight
this
.
waterSetting
=
globalData
.
photo
.
waterSetting
},
baiduLocation
()
{
// 百度sdk解析经纬度
let
waterInfo
=
this
.
waterInfo
const
t
=
function
()
{
let
t
=
{
success
:
function
(
res
)
{
let
e
=
res
.
wxMarkerData
[
0
];
let
i
=
e
.
address
;
waterInfo
.
address
=
i
},
fail
:
function
(
err
)
{
//console.log(err, 'err')
}
};
if
(
waterInfo
.
latitude
&&
waterInfo
.
longitude
)
{
let
e
=
waterInfo
.
latitude
+
","
+
waterInfo
.
longitude
;
t
.
location
=
e
;
}
h
.
regeocoding
(
t
);
};
t
()
},
cameraError
(
e
)
{
const
{
errMsg
}
=
e
.
detail
// console.log(e.detail, 'e.detail')
if
(
errMsg
!==
'insertCamera:fail auth deny'
)
{
return
}
this
.
showSettingModal
(
'camera'
)
},
//获取位置
getLocation
()
{
let
that
=
this
const
waterInfo
=
this
.
waterInfo
uni
.
getLocation
({
type
:
'gcj02'
,
success
:
function
(
res
)
{
waterInfo
.
longitude
=
parseFloat
(
res
.
longitude
).
toFixed
(
4
)
waterInfo
.
latitude
=
parseFloat
(
res
.
latitude
).
toFixed
(
3
)
that
.
baiduLocation
()
},
fail
(
err
)
{
that
.
showSettingModal
(
'location'
)
// that.showLocationAuthModal('')
}
});
},
showSettingModal
(
type
)
{
type
=
type
||
'camera'
const
self
=
this
let
authSetting
=
{
'camera'
:
{
content
:
'将无法进行拍照'
,
method
:
''
},
'location'
:
{
content
:
'将无法定位当前位置'
,
method
:
''
},
'writePhotosAlbum'
:
{
content
:
'将无法保存图片到本地'
,
method
:
''
}
}
let
content
=
authSetting
[
type
].
content
uni
.
showModal
({
content
:
'拒绝授权'
+
content
+
',是否去设置打开?'
,
confirmText
:
"确认"
,
cancelText
:
'取消'
,
success
(
res
)
{
if
(
res
.
confirm
)
{
self
.
openSetting
()
}
},
fail
()
{}
})
},
openSetting
()
{
// 打开设置
let
self
=
this
this
.
cameraChange
=
false
wx
.
openSetting
({
success
(
res
)
{
const
authSetting
=
res
.
authSetting
self
.
cameraChange
=
true
if
(
authSetting
[
'scope.userLocation'
])
{
// 位置授权成功
self
.
authSetting
.
location
=
true
self
.
getLocation
()
}
if
(
res
.
authSetting
[
'scope.camera'
])
{
self
.
authSetting
.
camera
=
true
}
if
(
res
.
authSetting
[
'scope.writePhotosAlbum'
])
{
self
.
authSetting
.
writePhotosAlbum
=
true
}
}
})
},
//获取 水印 本地缓存路径
getMarkPath
:
function
()
{
uni
.
downloadFile
({
url
:
this
.
waterInfo
.
markImage
,
//仅为示例,并非真实的资源
success
:
(
res
)
=>
{
if
(
res
.
statusCode
===
200
)
{
this
.
tempImgs
.
markImage
=
res
.
tempFilePath
}
},
fail
()
{
console
.
log
(
'水印图片 下载失败'
)
}
})
},
/* ---------------------- 拍照流程 ---------------------- */
// 第一步:拍照
takePhoto
()
{
wx
.
createCameraContext
().
takePhoto
({
quality
:
"high"
}).
then
(
res
=>
{
this
.
tempImgs
.
origin
=
res
.
tempImagePath
this
.
drawCanvas
(
res
.
tempImagePath
)
})
},
// 第二步:绘制画布
drawCanvas
:
function
(
tempPath
)
{
uni
.
showLoading
({
title
:
'数据处理中...'
,
icon
:
'loading'
})
const
waterSetting
=
this
.
waterSetting
const
globalTempPath
=
getApp
().
globalData
.
photo
.
tempPath
const
ratio
=
this
.
ratio
console
.
log
(
this
.
ratio
,
'this.ratio'
)
// const ratio = 0.5
let
canvasWidth
=
this
.
cameraWidth
*
ratio
let
canvasHeight
=
this
.
cameraHeight
*
ratio
const
waterInfo
=
this
.
waterInfo
this
.
showImage
=
true
const
settingTxtArr
=
this
.
settingTxtArr
//将原图画到canvas上面
let
canvas
=
uni
.
createCanvasContext
(
"canvas"
,
this
)
canvas
.
rect
(
0
,
0
,
canvasWidth
,
canvasHeight
)
canvas
.
drawImage
(
tempPath
,
0
,
0
,
canvasWidth
,
canvasHeight
)
// this.canvas.draw()
let
txtHeight
=
18
let
h
=
1
//加入 水印文字
for
(
let
i
=
settingTxtArr
.
length
-
1
;
i
>=
0
;
i
--
)
{
txtHeight
=
20
canvas
.
setFontSize
(
15
)
canvas
.
setFillStyle
(
'#f2f2f2'
)
let
txt
=
settingTxtArr
[
i
]
if
(
txt
.
indexOf
(
'时间'
)
>=
0
){
canvas
.
fillText
(
txt
,
10
,
canvasHeight
-
txtHeight
*
h
++
);
}
else
{
if
(
txt
.
length
>
22
){
canvas
.
fillText
(
txt
.
substr
(
22
,
22
),
10
,
canvasHeight
-
txtHeight
*
h
++
);
canvas
.
fillText
(
txt
.
substr
(
0
,
22
),
10
,
canvasHeight
-
txtHeight
*
h
++
);
}
else
{
canvas
.
fillText
(
txt
,
10
,
canvasHeight
-
txtHeight
*
h
++
);
}
}
// canvas.fillText(txt, 10, canvasHeight - txtHeight * h++);
}
const
title
=
this
.
titleTxt
if
(
title
)
{
canvas
.
save
()
let
titleHeight
=
title
.
length
>
14
?
60
:
30
let
rectWidth
=
title
.
length
>
14
?
215
:
title
.
length
*
10
canvas
.
setFillStyle
(
'rgba(34, 114, 255, 0.6)'
)
canvas
.
fillRect
(
10
,
canvasHeight
-
txtHeight
*
h
-
titleHeight
,
215
,
titleHeight
)
canvas
.
restore
()
canvas
.
setFontSize
(
20
)
canvas
.
setFillStyle
(
'#f2f2f2'
)
// canvas.setTextAlign('center')
if
(
title
.
length
>
14
)
{
canvas
.
fillText
(
title
.
substr
(
14
,
14
),
10
,
canvasHeight
-
txtHeight
*
h
++
+
20
);
}
canvas
.
fillText
(
title
.
substr
(
0
,
14
),
10
,
canvasHeight
-
txtHeight
*
h
++
-
titleHeight
/
2
+
10
);
}
if
(
this
.
waterSetting
&&
this
.
waterSetting
.
mid_text
)
{
//加入 水印图片
canvas
.
drawImage
(
this
.
tempImgs
.
markImage
,
canvasWidth
/
2
-
100
,
canvasHeight
/
2
-
25
,
200
,
50
)
}
// canvas.drawImage(this.tempImgs.markImage, canvasWidth / 2 - 100, canvasHeight / 2 - 25, 200, 50)
canvas
.
draw
(
false
,
setTimeout
(()
=>
{
uni
.
canvasToTempFilePath
({
width
:
canvasWidth
,
height
:
canvasHeight
,
canvasId
:
'canvas'
,
success
:
(
res
)
=>
{
this
.
tempImgs
.
mixWater
=
res
.
tempFilePath
globalTempPath
.
origin
=
this
.
tempImgs
.
origin
globalTempPath
.
mixWater
=
res
.
tempFilePath
let
timer
=
setTimeout
(()
=>
{
//this.goPage('/pages/photo/preview')
this
.
changeType
(
2
)
},
0
)
// this.saveToLocal(res.tempFilePath)
},
fail
:
(
res
)
=>
{
console
.
log
(
res
);
},
complete
:
()
=>
{
uni
.
hideLoading
();
}
},
this
);
},
50
))
},
// 第三步:保存到本地
saveToLocal
(
tempImagePath
)
{
//has_origin //是否保存原图
let
that
=
this
uni
.
saveImageToPhotosAlbum
({
filePath
:
tempImagePath
,
success
()
{
uni
.
showToast
({
icon
:
'none'
,
title
:
'已将照片保存到本地相册'
})
},
fail
()
{}
})
},
showPreviewFn
(
img
)
{
uni
.
previewImage
({
current
:
0
,
urls
:
[
img
]
});
},
//获取当前时间
getTime
:
function
()
{
let
d
=
new
Date
();
let
year
=
d
.
getFullYear
();
let
month
=
d
.
getMonth
()
+
1
;
let
date
=
d
.
getDate
();
let
days
=
new
Array
(
"日"
,
"一"
,
"二"
,
"三"
,
"四"
,
"五"
,
"六"
);
let
day
=
d
.
getDay
();
let
hour
=
(
d
.
getHours
()
<
10
)
?
(
"0"
+
d
.
getHours
())
:
d
.
getHours
();
let
min
=
(
d
.
getMinutes
()
<
10
)
?
(
"0"
+
d
.
getMinutes
())
:
d
.
getMinutes
();
let
sec
=
(
d
.
getSeconds
()
<
10
)
?
(
"0"
+
d
.
getSeconds
())
:
d
.
getSeconds
();
let
now
=
year
+
"年"
+
month
+
"月"
+
date
+
"日 "
+
hour
+
":"
+
min
+
":"
+
sec
;
return
now
},
}
}
</
script
>
<
style
scoped
lang=
"scss"
>
.camera
{
position
:fixed
;
padding
:
0
;
margin
:
0
;
top
:
0
;
left
:
0
;
width
:
100%
;
height
:
100%
;
z-index
:
999999
;
}
.camera-container
{
// padding-top:var(--status-bar-height);
min-height
:
100vh
;
background-color
:
black
;
}
.header-box
{
// padding:10rpx 20rpx;
position
:
relative
;
.inner
{
display
:
flex
;
position
:
absolute
;
left
:
0
;
right
:
0
;
bottom
:
0
;
}
.icon
{
margin
:
20rpx
;
display
:
block
;
width
:
44rpx
;
height
:
44rpx
;
}
}
.camera-box
{
position
:
absolute
;
left
:
0
;
width
:
100%
;
// height: 100vh;
z-index
:
1
;
}
.mark-water
{
position
:
absolute
;
left
:
50%
;
top
:
50%
;
transform
:
translate
(
-50%
,
-50%
);
width
:
360rpx
;
height
:
90rpx
;
z-index
:
6
;
}
.mark-box
{
position
:
absolute
;
left
:
0
;
bottom
:
0
;
padding
:
20rpx
;
.txt
{
max-width
:
500rpx
;
max-height
:
80rpx
;
overflow
:
hidden
;
margin-top
:
5rpx
;
line-height
:
40rpx
;
white-space
:
normal
;
font-size
:
28rpx
;
color
:
#fff
;
&
.big
{
padding
:
10rpx
;
margin-bottom
:
10rpx
;
width
:
430rpx
;
line-height
:
40rpx
;
font-size
:
32rpx
;
background-color
:
rgba
(
34
,
114
,
255
,
0
.6
);
}
}
}
.bottom-box
{
position
:
absolute
;
left
:
0
;
right
:
0
;
bottom
:
0
;
// bottom: constant(safe-area-inset-bottom);
// bottom: env(safe-area-inset-bottom);
z-index
:
5
;
box-sizing
:
border-box
;
height
:
200rpx
;
display
:
flex
;
justify-content
:
space-between
;
padding
:
20rpx
78rpx
;
align-items
:
center
;
background-color
:
black
;
.txt
{
white-space
:
nowrap
;
line-height
:
60rpx
;
color
:
#fff
;
}
.icon
{
display
:
block
;
width
:
92rpx
;
height
:
92rpx
;
&
.icon-take
{
width
:
144rpx
;
height
:
144rpx
;
}
}
}
.canvas
{
position
:
fixed
;
left
:
-750rpx
;
top
:
0
;
}
// 拍照规范
.page-mask
{
position
:
fixed
;
bottom
:
0
;
bottom
:
constant
(
safe-area-inset-bottom
);
bottom
:
env
(
safe-area-inset-bottom
);
z-index
:
1000
;
width
:
750rpx
;
height
:
100vh
;
// padding: 0 30rpx;
box-sizing
:
border-box
;
background-color
:
rgba
(
0
,
0
,
0
,
0
.8
);
.icon
{
width
:
92rpx
;
height
:
92rpx
;
}
.btn-close
{
position
:
absolute
;
bottom
:
0
;
bottom
:
constant
(
safe-area-inset-bottom
);
bottom
:
env
(
safe-area-inset-bottom
);
left
:
0
;
right
:
0
;
height
:
200rpx
;
z-index
:
100
;
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
}
}
</
style
>
<
template
>
<view
class=
"camera"
>
<view
class=
"camera-container"
v-if=
"showType === 1"
>
<cover-view
class=
"header-box"
:style=
"
{'height':navHeight/2 + 'px'}">
<cover-view
class=
"inner"
>
<cover-image
@
click=
"setCameraInfo('devicePosition')"
class=
"icon"
mode=
"aspectFit"
src=
"/static/photo/icon-switch.png"
></cover-image>
<cover-image
@
click=
"setCameraInfo('flash')"
class=
"icon"
mode=
"aspectFit"
:src=
"'/static/photo/icon-light-' + cameraInfo.flash +'.png'"
></cover-image>
<cover-image
v-if=
"currentItem.partnerCompanyId"
@
click=
"changeType(3)"
class=
"icon"
mode=
"aspectFit"
src=
"/static/photo/icon-setting.png"
></cover-image>
</cover-view>
</cover-view>
<camera
class=
"camera-box"
v-if=
"cameraChange&&!standardShow"
:device-position=
"cameraInfo.devicePosition"
:flash=
"cameraInfo.flash"
:style=
"
{'height':cameraHeight/2 + 'px','top':parseInt(navHeight/2) + 'px'}"
@error="cameraError">
<cover-view
class=
"mark-box"
>
<cover-view
class=
"txt big"
v-if=
"titleTxt"
>
{{
titleTxt
}}
</cover-view>
<cover-view
class=
"txt"
v-for=
"(txt,index) in settingTxtArr"
:key=
"index"
>
{{
txt
||
'获取中'
}}
</cover-view>
<!--
<cover-view
class=
"txt u-m-t-10"
>
维度:
{{
waterInfo
.
latitude
||
'正在获取中...'
}}
</cover-view>
<cover-view
class=
"txt u-m-t-10"
>
地址:
{{
waterInfo
.
address
||
'正在获取中...'
}}
</cover-view>
<cover-view
class=
"txt u-m-t-10"
>
时间:
{{
waterInfo
.
date
||
'正在获取中...'
}}
</cover-view>
-->
</cover-view>
<cover-image
class=
"mark-water"
mode=
"aspectFit"
:src=
"waterInfo.markImage"
></cover-image>
</camera>
<cover-view
class=
"bottom-box"
v-if=
"!standardShow"
>
<cover-image
class=
"icon"
src=
'/static/photo/icon-back.png'
mode=
""
@
click=
"goBack"
></cover-image>
<cover-image
class=
'icon-take icon'
src=
'/static/photo/icon-take.png'
@
click=
"$u.debounce(takePhoto, 500)"
>
</cover-image>
<cover-image
class=
'icon'
src=
'/static/photo/icon-standard.png'
@
click=
"standardShow = true"
v-if=
"standardStatus"
>
</cover-image>
<view
class=
'icon'
v-else
></view>
</cover-view>
<canvas
canvas-id=
"canvas"
id=
"photoCanvas"
class=
"canvas"
:style=
"
{'width':750 + 'rpx','height': cameraHeight + 'rpx'}">
</canvas>
<view
v-show=
"standardShow"
class=
"page-mask"
:z-index=
"10000"
>
<photo-standard
:currentItem=
"currentItem"
/>
<view
class=
"btn-close"
>
<image
@
click=
"closeShadow"
class=
"icon icon-close"
mode=
"aspectFit"
src=
"/static/photo/icon-close.png"
></image>
</view>
</view>
</view>
<photo-preview
v-if=
"showType === 2"
@
changeType=
"changeType"
@
finish=
"finish"
/>
<photo-setting
v-if=
"showType === 3"
@
changeType=
"changeType"
@
changeWatermark=
"changeWatermark"
/>
</view>
</
template
>
<
script
>
let
r
=
require
(
"@/libs/bmap-wx.min.js"
);
let
h
=
new
r
.
BMapWX
({
// ak: "rpVq5d3yxaRCoKzVwmFMo0o4iC524CAG",
ak
:
"iXsGdyEcm1iQONoUPyEp0hrBTLCuOaW2"
});
import
standard
from
'@/components/photo/standard.vue'
import
preview
from
'@/components/photo/preview.vue'
import
setting
from
'@/components/photo/setting.vue'
export
default
{
props
:
{
currentItem
:
{
// 对应的规范item
default
()
{
return
{
_id
:
''
,
// 规格ID
system_id
:
''
,
// 系统ID
brand_id
:
''
,
// 品牌ID
classify_id
:
''
,
// 分类ID
images
:
[],
// 拍照要求示意图
main_point
:
[]
// 要点
}
}
}
},
components
:
{
'photo-standard'
:
standard
,
'photo-preview'
:
preview
,
'photo-setting'
:
setting
,
},
data
()
{
return
{
showType
:
1
,
standardShow
:
false
,
cameraInfo
:
{
devicePosition
:
'back'
,
flash
:
'auto'
},
waterInfo
:
{
longitude
:
''
,
// 经度
latitude
:
''
,
// 维度
address
:
''
,
//地址
date
:
''
,
//日期
markImage
:
'https://qn-static.banshouhui.com/live_mark.png'
},
tempImgs
:
{
'markImage'
:
''
,
// 拍照水印
'origin'
:
''
,
// 无水印照片
'mixWater'
:
''
,
// 有水印照片
},
authSetting
:
{
camera
:
false
,
// 相机授权
location
:
false
,
// 位置授权
},
navHeight
:
130
,
cameraWidth
:
750
,
cameraHeight
:
1000
,
// (4 / 3 * 750) 图片比例4:3
ratio
:
0
,
cameraChange
:
false
,
waterSetting
:
null
,
shadowInitShow
:
false
,
// 第一次进入页面需显示弹窗
standardStatus
:
false
// 是否显示拍照要求
}
},
created
(
e
)
{
const
photo
=
getApp
().
globalData
.
photo
getApp
().
trackPage
(
'拍照页'
)
photo
.
allImages
=
[]
photo
.
currentItemLength
=
0
// this.ctx = uni.createCameraContext();
this
.
updateTime
()
this
.
getLocation
()
this
.
getMarkPath
()
this
.
initData
()
photo
.
currentItem
=
this
.
currentItem
if
(
this
.
currentItem
.
images
.
length
>
0
)
{
this
.
shadowInitShow
=
true
this
.
standardShow
=
true
this
.
standardStatus
=
true
}
},
computed
:
{
titleTxt
()
{
const
waterSetting
=
this
.
waterSetting
let
txt
=
''
if
(
!
waterSetting
||
!
waterSetting
.
lowerLeft
)
{
return
''
}
txt
=
waterSetting
.
lowerLeft
&&
waterSetting
.
lowerLeft
.
title
||
''
return
txt
},
settingTxtArr
()
{
let
arr
=
[]
// 包含经纬度
const
waterInfo
=
this
.
waterInfo
arr
=
[
'经度:'
+
waterInfo
.
longitude
,
'纬度:'
+
waterInfo
.
latitude
,
'地址:'
+
waterInfo
.
address
,
'时间:'
+
waterInfo
.
date
]
let
settingTxtArr
=
[]
const
typeArr
=
[
'经度'
,
'纬度'
,
'地址'
,
'时间'
]
const
waterSetting
=
this
.
waterSetting
if
(
!
waterSetting
||
!
waterSetting
.
lowerLeft
||
!
waterSetting
.
lowerLeft
.
body
)
{
return
arr
}
const
settingArr
=
waterSetting
.
lowerLeft
.
body
settingArr
.
map
(
item
=>
{
const
idx
=
typeArr
.
indexOf
(
item
.
watemarkType
)
if
(
item
.
enable
&&
(
idx
>
-
1
||
(
item
.
watemarkValue
&&
item
.
watemarkText
)))
{
if
(
idx
>
-
1
)
{
settingTxtArr
.
push
(
arr
[
idx
])
}
else
{
settingTxtArr
.
push
(
item
.
watemarkText
+
':'
+
item
.
watemarkValue
)
}
}
})
return
settingTxtArr
}
},
watch
:
{},
mounted
()
{
// 默认开启弹窗
const
photo
=
getApp
().
globalData
.
photo
this
.
waterSetting
=
photo
.
waterSetting
this
.
standardShow
=
this
.
shadowInitShow
this
.
cameraChange
=
true
// this.initData()
},
destroyed
(){
this
.
cameraChange
=
false
},
methods
:
{
closeShadow
()
{
this
.
shadowInitShow
=
false
this
.
standardShow
=
false
},
goBack
()
{
uni
.
showTabBar
()
this
.
$emit
(
'close'
)
},
finish
()
{
uni
.
showTabBar
()
const
photo
=
getApp
().
globalData
.
photo
this
.
$emit
(
'close'
,
photo
.
allImages
)
},
changeType
(
type
)
{
this
.
showType
=
type
},
changeWatermark
(
watermark
){
this
.
waterSetting
=
watermark
},
updateTime
()
{
this
.
waterInfo
.
date
=
this
.
getTime
()
// let timer = setTimeout(() => {
// clearTimeout(timer);
// this.updateTime()
// }, 1000)
},
setCameraInfo
(
type
)
{
// 设置相机前置后置、闪关灯等
const
cameraInfo
=
this
.
cameraInfo
let
val
=
cameraInfo
[
type
]
switch
(
type
)
{
case
'devicePosition'
:
val
=
val
===
'back'
?
'front'
:
'back'
break
;
case
'flash'
:
val
=
val
===
'auto'
?
'on'
:
(
val
===
'on'
?
'off'
:
'auto'
)
break
;
defalut
:
break
;
}
this
.
cameraInfo
[
type
]
=
val
},
initData
()
{
const
globalData
=
getApp
().
globalData
this
.
navHeight
=
globalData
.
navHeight
this
.
cameraHeight
=
parseInt
(
globalData
.
safeHeight
*
2
-
globalData
.
navHeight
-
200
)
this
.
ratio
=
globalData
.
screenHeight
/
globalData
.
rpxScreenHeight
this
.
waterSetting
=
globalData
.
photo
.
waterSetting
},
baiduLocation
()
{
// 百度sdk解析经纬度
let
waterInfo
=
this
.
waterInfo
const
t
=
function
()
{
let
t
=
{
success
:
function
(
res
)
{
let
e
=
res
.
wxMarkerData
[
0
];
let
i
=
e
.
address
;
waterInfo
.
address
=
i
},
fail
:
function
(
err
)
{
//console.log(err, 'err')
}
};
if
(
waterInfo
.
latitude
&&
waterInfo
.
longitude
)
{
let
e
=
waterInfo
.
latitude
+
","
+
waterInfo
.
longitude
;
t
.
location
=
e
;
}
h
.
regeocoding
(
t
);
};
t
()
},
cameraError
(
e
)
{
const
{
errMsg
}
=
e
.
detail
// console.log(e.detail, 'e.detail')
if
(
errMsg
!==
'insertCamera:fail auth deny'
)
{
return
}
this
.
showSettingModal
(
'camera'
)
},
//获取位置
getLocation
()
{
let
that
=
this
const
waterInfo
=
this
.
waterInfo
uni
.
getLocation
({
type
:
'gcj02'
,
success
:
function
(
res
)
{
waterInfo
.
longitude
=
parseFloat
(
res
.
longitude
).
toFixed
(
4
)
waterInfo
.
latitude
=
parseFloat
(
res
.
latitude
).
toFixed
(
3
)
that
.
baiduLocation
()
},
fail
(
err
)
{
that
.
showSettingModal
(
'location'
)
// that.showLocationAuthModal('')
}
});
},
showSettingModal
(
type
)
{
type
=
type
||
'camera'
const
self
=
this
let
authSetting
=
{
'camera'
:
{
content
:
'将无法进行拍照'
,
method
:
''
},
'location'
:
{
content
:
'将无法定位当前位置'
,
method
:
''
},
'writePhotosAlbum'
:
{
content
:
'将无法保存图片到本地'
,
method
:
''
}
}
let
content
=
authSetting
[
type
].
content
uni
.
showModal
({
content
:
'拒绝授权'
+
content
+
',是否去设置打开?'
,
confirmText
:
"确认"
,
cancelText
:
'取消'
,
success
(
res
)
{
if
(
res
.
confirm
)
{
self
.
openSetting
()
}
},
fail
()
{}
})
},
openSetting
()
{
// 打开设置
let
self
=
this
this
.
cameraChange
=
false
wx
.
openSetting
({
success
(
res
)
{
const
authSetting
=
res
.
authSetting
self
.
cameraChange
=
true
if
(
authSetting
[
'scope.userLocation'
])
{
// 位置授权成功
self
.
authSetting
.
location
=
true
self
.
getLocation
()
}
if
(
res
.
authSetting
[
'scope.camera'
])
{
self
.
authSetting
.
camera
=
true
}
if
(
res
.
authSetting
[
'scope.writePhotosAlbum'
])
{
self
.
authSetting
.
writePhotosAlbum
=
true
}
}
})
},
//获取 水印 本地缓存路径
getMarkPath
:
function
()
{
uni
.
downloadFile
({
url
:
this
.
waterInfo
.
markImage
,
//仅为示例,并非真实的资源
success
:
(
res
)
=>
{
if
(
res
.
statusCode
===
200
)
{
this
.
tempImgs
.
markImage
=
res
.
tempFilePath
}
},
fail
()
{
console
.
log
(
'水印图片 下载失败'
)
}
})
},
/* ---------------------- 拍照流程 ---------------------- */
// 第一步:拍照
takePhoto
()
{
wx
.
createCameraContext
().
takePhoto
({
quality
:
"high"
}).
then
(
res
=>
{
this
.
tempImgs
.
origin
=
res
.
tempImagePath
this
.
drawCanvas
(
res
.
tempImagePath
)
})
},
// 第二步:绘制画布
drawCanvas
:
function
(
tempPath
)
{
uni
.
showLoading
({
title
:
'数据处理中...'
,
icon
:
'loading'
})
const
waterSetting
=
this
.
waterSetting
const
globalTempPath
=
getApp
().
globalData
.
photo
.
tempPath
const
ratio
=
this
.
ratio
console
.
log
(
this
.
ratio
,
'this.ratio'
)
// const ratio = 0.5
let
canvasWidth
=
this
.
cameraWidth
*
ratio
let
canvasHeight
=
this
.
cameraHeight
*
ratio
const
waterInfo
=
this
.
waterInfo
this
.
showImage
=
true
const
settingTxtArr
=
this
.
settingTxtArr
//将原图画到canvas上面
let
canvas
=
uni
.
createCanvasContext
(
"canvas"
,
this
)
canvas
.
rect
(
0
,
0
,
canvasWidth
,
canvasHeight
)
canvas
.
drawImage
(
tempPath
,
0
,
0
,
canvasWidth
,
canvasHeight
)
// this.canvas.draw()
let
txtHeight
=
18
let
h
=
1
//加入 水印文字
for
(
let
i
=
settingTxtArr
.
length
-
1
;
i
>=
0
;
i
--
)
{
txtHeight
=
20
canvas
.
setFontSize
(
15
)
canvas
.
setFillStyle
(
'#f2f2f2'
)
let
txt
=
settingTxtArr
[
i
]
if
(
txt
.
indexOf
(
'时间'
)
>=
0
){
canvas
.
fillText
(
txt
,
10
,
canvasHeight
-
txtHeight
*
h
++
);
}
else
{
if
(
txt
.
length
>
22
){
canvas
.
fillText
(
txt
.
substr
(
22
,
22
),
10
,
canvasHeight
-
txtHeight
*
h
++
);
canvas
.
fillText
(
txt
.
substr
(
0
,
22
),
10
,
canvasHeight
-
txtHeight
*
h
++
);
}
else
{
canvas
.
fillText
(
txt
,
10
,
canvasHeight
-
txtHeight
*
h
++
);
}
}
// canvas.fillText(txt, 10, canvasHeight - txtHeight * h++);
}
const
title
=
this
.
titleTxt
if
(
title
)
{
canvas
.
save
()
let
titleHeight
=
title
.
length
>
14
?
60
:
30
let
rectWidth
=
title
.
length
>
14
?
215
:
title
.
length
*
10
canvas
.
setFillStyle
(
'rgba(34, 114, 255, 0.6)'
)
canvas
.
fillRect
(
10
,
canvasHeight
-
txtHeight
*
h
-
titleHeight
,
215
,
titleHeight
)
canvas
.
restore
()
canvas
.
setFontSize
(
20
)
canvas
.
setFillStyle
(
'#f2f2f2'
)
// canvas.setTextAlign('center')
if
(
title
.
length
>
14
)
{
canvas
.
fillText
(
title
.
substr
(
14
,
14
),
10
,
canvasHeight
-
txtHeight
*
h
++
+
20
);
}
canvas
.
fillText
(
title
.
substr
(
0
,
14
),
10
,
canvasHeight
-
txtHeight
*
h
++
-
titleHeight
/
2
+
10
);
}
if
(
this
.
waterSetting
&&
this
.
waterSetting
.
mid_text
)
{
//加入 水印图片
canvas
.
drawImage
(
this
.
tempImgs
.
markImage
,
canvasWidth
/
2
-
100
,
canvasHeight
/
2
-
25
,
200
,
50
)
}
// canvas.drawImage(this.tempImgs.markImage, canvasWidth / 2 - 100, canvasHeight / 2 - 25, 200, 50)
canvas
.
draw
(
false
,
setTimeout
(()
=>
{
uni
.
canvasToTempFilePath
({
width
:
canvasWidth
,
height
:
canvasHeight
,
canvasId
:
'canvas'
,
success
:
(
res
)
=>
{
this
.
tempImgs
.
mixWater
=
res
.
tempFilePath
globalTempPath
.
origin
=
this
.
tempImgs
.
origin
globalTempPath
.
mixWater
=
res
.
tempFilePath
let
timer
=
setTimeout
(()
=>
{
//this.goPage('/pages/photo/preview')
this
.
changeType
(
2
)
},
0
)
// this.saveToLocal(res.tempFilePath)
},
fail
:
(
res
)
=>
{
console
.
log
(
res
);
},
complete
:
()
=>
{
uni
.
hideLoading
();
}
},
this
);
},
50
))
},
// 第三步:保存到本地
saveToLocal
(
tempImagePath
)
{
//has_origin //是否保存原图
let
that
=
this
uni
.
saveImageToPhotosAlbum
({
filePath
:
tempImagePath
,
success
()
{
uni
.
showToast
({
icon
:
'none'
,
title
:
'已将照片保存到本地相册'
})
},
fail
()
{}
})
},
showPreviewFn
(
img
)
{
uni
.
previewImage
({
current
:
0
,
urls
:
[
img
]
});
},
//获取当前时间
getTime
:
function
()
{
let
d
=
new
Date
();
let
year
=
d
.
getFullYear
();
let
month
=
d
.
getMonth
()
+
1
;
let
date
=
d
.
getDate
();
let
days
=
new
Array
(
"日"
,
"一"
,
"二"
,
"三"
,
"四"
,
"五"
,
"六"
);
let
day
=
d
.
getDay
();
let
hour
=
(
d
.
getHours
()
<
10
)
?
(
"0"
+
d
.
getHours
())
:
d
.
getHours
();
let
min
=
(
d
.
getMinutes
()
<
10
)
?
(
"0"
+
d
.
getMinutes
())
:
d
.
getMinutes
();
let
sec
=
(
d
.
getSeconds
()
<
10
)
?
(
"0"
+
d
.
getSeconds
())
:
d
.
getSeconds
();
let
now
=
year
+
"年"
+
month
+
"月"
+
date
+
"日 "
+
hour
+
":"
+
min
+
":"
+
sec
;
return
now
},
}
}
</
script
>
<
style
scoped
lang=
"scss"
>
.camera
{
position
:fixed
;
padding
:
0
;
margin
:
0
;
top
:
0
;
left
:
0
;
width
:
100%
;
height
:
100%
;
z-index
:
999999
;
}
.camera-container
{
// padding-top:var(--status-bar-height);
min-height
:
100vh
;
background-color
:
black
;
}
.header-box
{
// padding:10rpx 20rpx;
position
:
relative
;
.inner
{
display
:
flex
;
position
:
absolute
;
left
:
0
;
right
:
0
;
bottom
:
0
;
}
.icon
{
margin
:
20rpx
;
display
:
block
;
width
:
44rpx
;
height
:
44rpx
;
}
}
.camera-box
{
position
:
absolute
;
left
:
0
;
width
:
100%
;
// height: 100vh;
z-index
:
1
;
}
.mark-water
{
position
:
absolute
;
left
:
50%
;
top
:
50%
;
transform
:
translate
(
-50%
,
-50%
);
width
:
360rpx
;
height
:
90rpx
;
z-index
:
6
;
}
.mark-box
{
position
:
absolute
;
left
:
0
;
bottom
:
0
;
padding
:
20rpx
;
.txt
{
max-width
:
500rpx
;
max-height
:
80rpx
;
overflow
:
hidden
;
margin-top
:
5rpx
;
line-height
:
40rpx
;
white-space
:
normal
;
font-size
:
28rpx
;
color
:
#fff
;
&
.big
{
padding
:
10rpx
;
margin-bottom
:
10rpx
;
width
:
430rpx
;
line-height
:
40rpx
;
font-size
:
32rpx
;
background-color
:
rgba
(
34
,
114
,
255
,
0
.6
);
}
}
}
.bottom-box
{
position
:
absolute
;
left
:
0
;
right
:
0
;
bottom
:
0
;
// bottom: constant(safe-area-inset-bottom);
// bottom: env(safe-area-inset-bottom);
z-index
:
5
;
box-sizing
:
border-box
;
height
:
200rpx
;
display
:
flex
;
justify-content
:
space-between
;
padding
:
20rpx
78rpx
;
align-items
:
center
;
background-color
:
black
;
.txt
{
white-space
:
nowrap
;
line-height
:
60rpx
;
color
:
#fff
;
}
.icon
{
display
:
block
;
width
:
92rpx
;
height
:
92rpx
;
&
.icon-take
{
width
:
144rpx
;
height
:
144rpx
;
}
}
}
.canvas
{
position
:
fixed
;
left
:
-750rpx
;
top
:
0
;
}
// 拍照规范
.page-mask
{
position
:
fixed
;
bottom
:
0
;
bottom
:
constant
(
safe-area-inset-bottom
);
bottom
:
env
(
safe-area-inset-bottom
);
z-index
:
1000
;
width
:
750rpx
;
height
:
100vh
;
// padding: 0 30rpx;
box-sizing
:
border-box
;
background-color
:
rgba
(
0
,
0
,
0
,
0
.8
);
.icon
{
width
:
92rpx
;
height
:
92rpx
;
}
.btn-close
{
position
:
absolute
;
bottom
:
0
;
bottom
:
constant
(
safe-area-inset-bottom
);
bottom
:
env
(
safe-area-inset-bottom
);
left
:
0
;
right
:
0
;
height
:
200rpx
;
z-index
:
100
;
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
}
}
</
style
>
src/pages/index/order.vue
View file @
c8ecc865
...
...
@@ -328,14 +328,14 @@
console
.
log
(
'click cell'
)
this
.
viewOderItem
(
item
.
orderId
)
},
filish
(
item
){
filish
(
item
){
// 去完工
uni
.
navigateTo
({
url
:
'pages/order/complete?orderId='
+
item
.
orderId
+
"&categoryId="
+
item
.
categoryId
+
"&orderServiceType="
+
item
.
orderServiceType
+
"&inGuaranteePeriod="
+
item
.
inGuaranteePeriod
+
"&auditResultsId="
+
Object
.
keys
(
item
.
auditResults
)[
0
]
+
"&inGuaranteePeriod="
+
item
.
inGuaranteePeriod
+
"&auditResultsId="
+
(
item
.
auditResults
?
Object
.
keys
(
item
.
auditResults
)[
0
]:
''
)
})
},
handleAction
(
item
)
{
...
...
src/pages/mine/cert/detail.vue
0 → 100644
View file @
c8ecc865
<
template
>
<view
class=
"cert-page"
>
<u-navbar
back-icon-color=
"#000000"
:background=
"background"
title-color=
"#000"
:border-bottom=
"false"
title=
"我的证件"
title-bold=
"true"
></u-navbar>
<view
class=
"content-cody"
>
<view
class=
"title"
>
{{
info
.
type
}}
</view>
<view
class=
"content"
v-for=
"item in info.url"
><image
:src=
"item"
mode=
""
></image></view>
</view>
</view>
</
template
>
<
script
>
export
default
{
data
()
{
return
{
info
:
{
type
:
""
,
url
:
null
}
}
},
onLoad
()
{
var
that
=
this
;
const
eventChannel
=
this
.
getOpenerEventChannel
()
eventChannel
.
on
(
'acceptDataFromCert'
,
function
(
data
)
{
try
{
let
urlArr
=
data
.
url
.
split
(
','
);
that
.
info
.
type
=
data
.
type
;
that
.
info
.
url
=
urlArr
;
console
.
log
(
urlArr
);
}
catch
(
e
){}
console
.
log
(
that
.
info
);
})
},
}
</
script
>
<
style
>
.cert-page
{
font-size
:
28
rpx
;
margin
:
30
rpx
;
}
.content-cody
{
padding-left
:
30
rpx
;
padding-right
:
30
rpx
;
background-color
:
#F4F5F7
;
border-radius
:
12
rpx
;
}
.title
{
font-size
:
32
rpx
;
font-weight
:
bold
;
}
.content
{
padding-top
:
30
rpx
;
}
</
style
>
src/pages/mine/cert/index.vue
0 → 100644
View file @
c8ecc865
<
template
>
<view
class=
"cert-page"
>
<u-navbar
class=
"navbarHeigth"
back-icon-color=
"#000000"
:background=
"background"
title-color=
"#000"
:border-bottom=
"false"
title=
"我的证件"
title-bold=
"true"
></u-navbar>
<view
class=
"content-cody"
>
<u-cell-group
:border=
"false"
>
<u-cell-item
v-for=
"item in list"
:title=
"item.name"
:value=
"item.isUploadName"
:arrow=
"true"
:value-style=
"
{'color': item.color}" @click="toDetail(item.keyName)" :title-style="{'padding-left':'20rpx'}">
<u-icon
slot=
"icon"
size=
"32"
name=
"checkmark-circle"
:color=
"item.iconColor"
></u-icon>
</u-cell-item>
</u-cell-group>
</view>
</view>
</
template
>
<
script
>
export
default
{
data
()
{
return
{
list
:
{
id_card
:
{
name
:
"身份证"
,
isUpload
:
false
,
isUploadName
:
""
,
keyName
:
"id_card"
,
color
:
"#999999"
},
electrician_certificate
:
{
name
:
"电工证"
,
isUpload
:
false
,
isUploadName
:
""
,
keyName
:
"electrician_certificate"
,
color
:
"#999999"
},
driver_license
:
{
name
:
"驾驶证"
,
isUpload
:
false
,
isUploadName
:
""
,
keyName
:
"driver_license"
,
color
:
"#999999"
},
driving_license
:
{
name
:
"行驶证"
,
isUpload
:
false
,
isUploadName
:
""
,
keyName
:
"driving_license"
,
color
:
"#999999"
},
vehicle
:
{
name
:
"车辆照"
,
isUpload
:
false
,
isUploadName
:
""
,
keyName
:
"vehicle"
,
color
:
"#999999"
},
high_sky_license
:
{
name
:
"高空证"
,
isUpload
:
false
,
isUploadName
:
""
,
keyName
:
"high_sky_license"
,
color
:
"#999999"
},
refrigeration_license
:
{
name
:
"制冷证"
,
isUpload
:
false
,
isUploadName
:
""
,
keyName
:
"refrigeration_license"
,
color
:
"#999999"
},
business_license
:
{
name
:
"营业执照"
,
isUpload
:
false
,
isUploadName
:
""
,
keyName
:
"business_license"
,
color
:
"#999999"
},
}
}
},
onLoad
()
{
let
that
=
this
;
this
.
$u
.
api
.
getCertList
()
.
then
((
res
)
=>
{
if
(
res
.
code
!=
200
){
return
}
for
(
let
key
in
this
.
list
){
let
getData
=
res
.
data
[
key
];
this
.
list
[
key
].
isUpload
=
getData
.
status
;
this
.
list
[
key
].
isUploadName
=
getData
.
status
==
1
?
'已上传'
:
'未上传'
;
this
.
list
[
key
].
color
=
getData
.
status
==
1
?
"#999999"
:
"#2272FF"
;
this
.
list
[
key
].
iconColor
=
getData
.
status
==
1
?
"#2272FF"
:
"#999999"
;
this
.
list
[
key
].
data
=
getData
;
}
console
.
log
(
this
.
list
);
console
.
log
(
res
);
}).
catch
((
err
)
=>
{
console
.
log
(
err
);
});
},
methods
:
{
isUpload
(
typeBool
)
{
return
typeBool
?
'已上传'
:
'未上传'
},
toDetail
(
key
)
{
let
data
=
this
.
list
[
key
].
data
;
if
(
data
.
status
!=
1
){
return
;
}
wx
.
navigateTo
({
url
:
'/pages/mine/cert/detail'
,
success
:
function
(
res
)
{
res
.
eventChannel
.
emit
(
'acceptDataFromCert'
,
data
)
}
});
}
}
}
</
script
>
<
style
>
.cert-page
{
font-size
:
28
rpx
;
margin
:
30
rpx
;
height
:
100vh
;
display
:
flex
;
flex-direction
:
column
;
}
.content-cody
{
padding
:
30
rpx
;
background-color
:
#ffffff
;
border-radius
:
12
rpx
;
height
:
82vh
;
}
.rightBlue
{
color
:
#007AFF
;
}
</
style
>
src/pages/mine/customer/index.vue
0 → 100644
View file @
c8ecc865
<
template
>
<view
class=
"cus-wrap"
>
<w-navbar
title=
"联系客服"
></w-navbar>
<view
class=
"content"
>
<u-image
class=
"qrcode"
:src=
"cusQrcode"
width=
"400"
mode=
"widthFix"
@
longtap=
"download"
>
<u-loading
slot=
"loading"
></u-loading>
<view
slot=
"error"
style=
"font-size: 24rpx;"
>
加载失败
</view>
</u-image>
<text
class=
"desc"
>
长按二维码保存图片添加官方客服微信
</text>
</view>
</view>
</
template
>
<
script
>
export
default
{
data
()
{
return
{
};
},
computed
:
{
cusQrcode
()
{
return
process
.
uniEnv
.
qn_base_url
+
'erweima-bg.png'
},
},
methods
:
{
download
()
{
let
that
=
this
;
uni
.
downloadFile
({
//获得二维码的临时地址
url
:
that
.
erweimaImage
,
success
:(
res
)
=>
{
if
(
res
.
statusCode
==
200
){
uni
.
saveImageToPhotosAlbum
({
filePath
:
res
.
tempFilePath
,
//传入临时地址
success
()
{
that
.
$u
.
toast
(
'保存成功!'
);
},
fail
()
{
that
.
$u
.
toast
(
'保存失败!'
);
}
})
}
}
})
}
}
}
</
script
>
<
style
lang=
"scss"
>
.cus-wrap
{
background-color
:
#F4F5F7
;
padding
:
30rpx
;
.content
{
width
:
690rpx
;
height
:
800rpx
;
background
:
#FFFFFF
;
border-radius
:
12rpx
;
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
.qrcode
{
margin-top
:
160rpx
;
}
.desc
{
margin-top
:
40rpx
;
font-size
:
24rpx
;
font-weight
:
400
;
color
:
#666666
;
line-height
:
24rpx
;
}
}
}
</
style
>
src/pages/mine/wallet/index.vue
0 → 100644
View file @
c8ecc865
<
template
>
<view
class=
"wallet-view"
>
<u-navbar
back-icon-color=
"#333333"
background=
"#F4F5F7"
title=
"我的钱包"
titleColor=
"#333333"
:border-bottom=
"false"
></u-navbar>
<image
class=
"header-image"
mode=
"widthFix"
:src=
"qianbaobeijing"
></image>
<view
class=
"survey-view"
>
<view
class=
"survey-top-view"
>
<view
class=
"survey-top-left"
>
<view>
账户总资产(元)
</view>
<view>
{{
info
.
totalPayAmount
}}
</view>
</view>
<view
class=
"survey-top-right"
>
<u-button>
提现
</u-button>
</view>
</view>
<view
class=
"survey-bottom-view"
>
<view
v-for=
"(value, key) in items"
:key=
"key"
>
<view>
{{
value
}}
</view>
<view>
{{
info
[
key
]
}}
</view>
</view>
</view>
</view>
<view
class=
"content-view"
>
<view
v-for=
"(item, index) in lists"
:class=
"['content-list',
{'first': index==0}]" :key="index">
<view
class=
"content-list-left"
>
<image
class=
"content-list-image"
:src=
"item.icon"
></image>
<view
class=
"content-list-text"
>
<view
class=
"content-list-text-title"
>
{{
item
.
title
}}
</view>
<view>
{{
item
.
content
}}
</view>
</view>
</view>
<view
class=
"content-list-right"
>
<text
class=
"content-list-right-text"
>
点击查看
</text>
<u-icon
name=
"arrow-right"
></u-icon>
</view>
</view>
</view>
<view
class=
"list-view"
>
</view>
</view>
</
template
>
<
script
>
export
default
{
data
()
{
return
{
info
:
{
canApplyAmount
:
0
,
// 可提现金额
saveApplyCount
:
0
,
// 已申请提现的支付单数
canApplyCount
:
0
,
// 可申请提现的支付单数
saveAndApplyAmount
:
0
,
// 已申请提现金额
totalPayAmount
:
0
,
// 总共收入
/* 还没对字段名 */
dairuzhang
:
0
,
// 预计待入账
}
}
},
computed
:
{
lists
()
{
return
[{
title
:
'结算账单'
,
content
:
'展示您已提现的账单信息'
,
icon
:
this
.
imageUrl
+
'jiesuan.png'
},{
title
:
'收入流水'
,
content
:
'当前展示最近5条,点击查看全部'
,
icon
:
this
.
imageUrl
+
'liushui.png'
}]
},
items
()
{
return
{
canApplyAmount
:
'可提现(元)'
,
dairuzhang
:
'预计待入账(元)'
}
},
imageUrl
()
{
return
process
.
uniEnv
.
qn_base_url
},
qianbaobeijing
()
{
return
this
.
imageUrl
+
'qianbaobeijing.png'
},
},
methods
:
{
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
.wallet-view
{
position
:
relative
;
height
:
100vh
;
overflow
:
auto
;
background-color
:
#F4F5F7
;
.header-image
{
position
:
absolute
;
width
:
100%
;
margin-left
:
4rpx
;
margin-top
:
10rpx
;
}
.survey-view
{
position
:
relative
;
height
:
400rpx
;
margin
:
30rpx
30rpx
10rpx
30rpx
;
color
:
#FFFFFF
;
padding
:
30rpx
;
.survey-top-view
{
display
:
flex
;
justify-content
:
space-between
;
align-items
:
flex-end
;
.survey-top-left
{
}
.survey-top-right
{
}
}
.survey-bottom-view
{
display
:
flex
;
justify-content
:
space-between
;
}
}
.content-view
{
position
:
relative
;
padding
:
0
30rpx
;
.content-list
{
height
:
140rpx
;
border-radius
:
12rpx
;
display
:
flex
;
justify-content
:
space-between
;
padding
:
30rpx
;
background-color
:
#FFFFFF
;
&
.first
{
margin-bottom
:
20rpx
;
}
.content-list-left
{
display
:
flex
;
.content-list-image
{
width
:
56rpx
;
height
:
56rpx
;
margin-top
:
2rpx
;
}
.content-list-text
{
font-size
:
24rpx
;
color
:
#666666
;
margin-left
:
20rpx
;
.content-list-text-title
{
font-size
:
32rpx
;
color
:
#333333
;
}
}
}
.content-list-right
{
color
:
#2272FF
;
font-size
:
26rpx
;
.content-list-right-text
{
margin-right
:
4rpx
;
}
}
}
}
.list-view
{
position
:
relative
;
}
}
</
style
>
src/pages/order/complete.vue
View file @
c8ecc865
...
...
@@ -10,78 +10,78 @@
:class=
"[current == index ? 'u-tab-item-active' : '']"
@
tap
.
stop=
"swichMenu(index)"
>
<text
class=
"u-line-1"
>
{{
item
.
name
}}
</text>
</view>
</scroll-view>
<view
class=
"right-boxs"
>
<scroll-view
:scroll-top=
"scrollRightTop"
scroll-y
scroll-with-animation
class=
"right-box"
@
scroll=
"rightScroll"
>
</scroll-view>
<view
class=
"form-list"
>
<u-form
:model=
"form"
ref=
"uForm"
>
<template
v-for=
"(groupItem, groupIndex) in (list.length>0?list[tabIndex].items:[])"
>
<view
class=
"class-item"
:key=
"groupIndex"
v-show=
"current == groupIndex"
>
<view
class=
"title"
v-if=
"groupItem.name !== '基本信息'"
>
{{
groupItem
.
name
}}
</view>
<view
class=
"class-bd"
>
<u-form-item
v-for=
"(item,itemIndex) in groupItem.items"
:key=
"itemIndex"
label-position=
"top"
:prop=
"item.fieldsName"
:border-bottom=
"false"
v-show=
"item.fieldsId != 200 || show200"
>
<view
:class=
"[
{'label-bold': groupItem.name === '基本信息'}, 'label']" v-if="typeToComponentType(item.fieldsType)!=='location'">
<image
class=
"item-image"
:src=
"mixingImage"
v-if=
"item.required"
></image>
{{
item
.
fieldsTitle
}}
</view>
<template
v-if=
"item.fieldsType"
>
<xh-input
v-if=
"typeToComponentType(item.fieldsType)==='input'"
:groupIndex=
"groupIndex"
:itemIndex=
"itemIndex"
:item=
"item"
:value=
'form[item.fieldsName] || ""'
@
value-change=
"fieldValueChange"
>
</xh-input>
<xh-multi-input
v-else-if=
"typeToComponentType(item.fieldsType)==='multiinput'"
:groupIndex=
"groupIndex"
:itemIndex=
"itemIndex"
:item=
"item"
:value=
'form[item.fieldsName] || ""'
@
value-change=
"fieldValueChange"
>
</xh-multi-input>
<xh-radio
v-else-if=
"typeToComponentType(item.fieldsType)==='radio'"
:groupIndex=
"groupIndex"
:itemIndex=
"itemIndex"
:item=
"item"
:value=
'form[item.fieldsName] || ""'
@
value-change=
"fieldValueChange"
>
</xh-radio>
<xh-checkbox
v-else-if=
"typeToComponentType(item.fieldsType)==='checkbox'"
:groupIndex=
"groupIndex"
:itemIndex=
"itemIndex"
:item=
"item"
:value=
'form[item.fieldsName] || ""'
@
value-change=
"fieldValueChange"
>
</xh-checkbox>
<xh-select
v-else-if=
"typeToComponentType(item.fieldsType)==='select'"
:groupIndex=
"groupIndex"
:itemIndex=
"itemIndex"
:item=
"item"
:value=
'form[item.fieldsName] || ""'
@
value-change=
"fieldValueChange"
>
</xh-select>
<xh-files
v-else-if=
"typeToComponentType(item.fieldsType)==='file'"
:groupIndex=
"groupIndex"
:itemIndex=
"itemIndex"
:item=
"item"
:
value=
'form[item.fieldsName] || []'
@
value-change=
"fieldValueChange"
>
</xh-files>
<xh-location
v-else-if=
"typeToComponentType(item.fieldsType)==='location'"
:groupIndex=
"groupIndex"
:itemIndex=
"itemIndex"
:item=
"item"
:value=
'form[item.fieldsName] || ""'
@
value-change=
"fieldValueChange"
>
</xh-location>
<xh-scan
v-else-if=
"typeToComponentType(item.fieldsType)==='scan'"
:groupIndex=
"groupIndex"
:itemIndex=
"itemIndex"
:item=
"item"
:value=
'form[item.fieldsName] || ""'
@
value-change=
"fieldValueChange"
>
</xh-scan>
<xh-picker
v-else-if=
"typeToComponentType(item.fieldsType)==='picker'"
:groupIndex=
"groupIndex"
:itemIndex=
"itemIndex"
:item=
"item"
:value=
'form[item.fieldsName] || ""'
@
value-change=
"fieldValueChange"
>
</xh-picker>
<xh-service-measure
v-else-if=
"typeToComponentType(item.fieldsType)==='servicemeasure'"
:groupIndex=
"groupIndex"
:itemIndex=
"itemIndex"
:item=
"item"
:orderId=
"orderId"
:categoryId=
"categoryId"
:orderServiceType=
"orderServiceType"
:specificationId=
"form['specificationId'] || 0"
:value=
"form[item.fieldsName]"
@
value-change=
"fieldValueChange"
>
</xh-service-measure>
<xh-time
v-else-if=
"typeToComponentType(item.fieldsType)==='time'"
:groupIndex=
"groupIndex"
:itemIndex=
"itemIndex"
:item=
"item"
:value=
'form[item.fieldsName] || ""'
@
value-change=
"fieldValueChange"
>
</xh-time>
</
template
>
</u-form-item>
</view>
</view>
</template>
</u-form>
</view>
</scroll-view>
<view
class=
"right-boxs"
>
<scroll-view
:scroll-top=
"scrollRightTop"
scroll-y
scroll-with-animation
class=
"right-box"
@
scroll=
"rightScroll"
>
</scroll-view>
<view
class=
"form-list"
>
<u-form
:model=
"form"
ref=
"uForm"
>
<template
v-for=
"(groupItem, groupIndex) in (list.length>0?list[tabIndex].items:[])"
>
<view
class=
"class-item"
:key=
"groupIndex"
v-show=
"current == groupIndex"
>
<view
class=
"title"
v-if=
"groupItem.name !== '基本信息'"
>
{{
groupItem
.
name
}}
</view>
<view
class=
"class-bd"
>
<u-form-item
v-for=
"(item,itemIndex) in groupItem.items"
:key=
"itemIndex"
label-position=
"top"
:prop=
"item.fieldsName"
:border-bottom=
"false"
v-show=
"item.fieldsId != 200 || show200"
>
<view
:class=
"[
{'label-bold': groupItem.name === '基本信息'}, 'label']" v-if="typeToComponentType(item.fieldsType)!=='location'">
<image
class=
"item-image"
:src=
"mixingImage"
v-if=
"item.required"
></image>
{{
item
.
fieldsTitle
}}
</view>
<template
v-if=
"item.fieldsType"
>
<xh-input
v-if=
"typeToComponentType(item.fieldsType)==='input'"
:groupIndex=
"groupIndex"
:itemIndex=
"itemIndex"
:item=
"item"
:value=
'form[item.fieldsName] || ""'
@
value-change=
"fieldValueChange"
>
</xh-input>
<xh-multi-input
v-else-if=
"typeToComponentType(item.fieldsType)==='multiinput'"
:groupIndex=
"groupIndex"
:itemIndex=
"itemIndex"
:item=
"item"
:value=
'form[item.fieldsName] || ""'
@
value-change=
"fieldValueChange"
>
</xh-multi-input>
<xh-radio
v-else-if=
"typeToComponentType(item.fieldsType)==='radio'"
:groupIndex=
"groupIndex"
:itemIndex=
"itemIndex"
:item=
"item"
:value=
'form[item.fieldsName] || ""'
@
value-change=
"fieldValueChange"
>
</xh-radio>
<xh-checkbox
v-else-if=
"typeToComponentType(item.fieldsType)==='checkbox'"
:groupIndex=
"groupIndex"
:itemIndex=
"itemIndex"
:item=
"item"
:value=
'form[item.fieldsName] || ""'
@
value-change=
"fieldValueChange"
>
</xh-checkbox>
<xh-select
v-else-if=
"typeToComponentType(item.fieldsType)==='select'"
:groupIndex=
"groupIndex"
:itemIndex=
"itemIndex"
:item=
"item"
:value=
'form[item.fieldsName] || ""'
@
value-change=
"fieldValueChange"
>
</xh-select>
<xh-files
v-else-if=
"typeToComponentType(item.fieldsType)==='file'"
:groupIndex=
"groupIndex"
:itemIndex=
"itemIndex"
:item=
"item"
:
partnerCompanyId=
"partnerCompanyId"
:value=
'form[item.fieldsName] || []'
@
value-change=
"fieldValueChange"
>
</xh-files>
<xh-location
v-else-if=
"typeToComponentType(item.fieldsType)==='location'"
:groupIndex=
"groupIndex"
:itemIndex=
"itemIndex"
:item=
"item"
:value=
'form[item.fieldsName] || ""'
@
value-change=
"fieldValueChange"
>
</xh-location>
<xh-scan
v-else-if=
"typeToComponentType(item.fieldsType)==='scan'"
:groupIndex=
"groupIndex"
:itemIndex=
"itemIndex"
:item=
"item"
:value=
'form[item.fieldsName] || ""'
@
value-change=
"fieldValueChange"
>
</xh-scan>
<xh-picker
v-else-if=
"typeToComponentType(item.fieldsType)==='picker'"
:groupIndex=
"groupIndex"
:itemIndex=
"itemIndex"
:item=
"item"
:value=
'form[item.fieldsName] || ""'
@
value-change=
"fieldValueChange"
>
</xh-picker>
<xh-service-measure
v-else-if=
"typeToComponentType(item.fieldsType)==='servicemeasure'"
:groupIndex=
"groupIndex"
:itemIndex=
"itemIndex"
:item=
"item"
:orderId=
"orderId"
:categoryId=
"categoryId"
:orderServiceType=
"orderServiceType"
:specificationId=
"form['specificationId'] || 0"
:value=
"form[item.fieldsName]"
@
value-change=
"fieldValueChange"
>
</xh-service-measure>
<xh-time
v-else-if=
"typeToComponentType(item.fieldsType)==='time'"
:groupIndex=
"groupIndex"
:itemIndex=
"itemIndex"
:item=
"item"
:value=
'form[item.fieldsName] || ""'
@
value-change=
"fieldValueChange"
>
</xh-time>
</
template
>
</u-form-item>
</view>
</view>
</template>
</u-form>
</view>
</view>
</view>
<view
:class=
"['btn-wrap', 'flex-xc', {'btn-bottom': tabIndex > 0}]"
>
<u-button
class=
"btn-submit"
@
click=
"saveComplete"
...
...
@@ -97,7 +97,7 @@
下一步
</u-button>
</view>
</view>
</view>
<u-toast
ref=
"uToast"
/>
</view>
</template>
...
...
@@ -121,7 +121,8 @@
orderId
:
0
,
categoryId
:
0
,
orderServiceType
:
''
,
inGuaranteePeriod
:
''
,
inGuaranteePeriod
:
''
,
partnerCompanyId
:
''
,
auditResultsId
:
''
,
list
:
[],
tabIndex
:
0
,
...
...
@@ -169,7 +170,7 @@
completeCheckResult
:
[],
waitHandlerPanelIndex
:
0
,
waitHandlerGroupIndex
:
0
,
waitHandlerEleIndex
:
0
,
waitHandlerEleIndex
:
0
,
pass
:
false
,
}
},
...
...
@@ -195,7 +196,8 @@
this
.
orderId
=
option
.
orderId
this
.
categoryId
=
option
.
categoryId
this
.
orderServiceType
=
decodeURIComponent
(
option
.
orderServiceType
)
this
.
inGuaranteePeriod
=
option
.
inGuaranteePeriod
this
.
inGuaranteePeriod
=
option
.
inGuaranteePeriod
this
.
partnerCompanyId
=
option
.
partnerCompanyId
this
.
auditResultsId
=
option
.
auditResultsId
}
else
{
this
.
orderId
=
11880091
...
...
@@ -251,51 +253,54 @@
self
.
$u
.
api
.
getCompleteConfigAndData
(
self
.
orderId
).
then
((
res
)
=>
{
if
(
res
.
code
==
200
)
{
self
.
list
=
res
.
data
.
config
self
.
form
=
res
.
data
.
value
||
{}
// 异常单处理
self
.
form
=
res
.
data
.
value
||
{}
// 异常单处理
if
(
self
.
auditResultsId
)
self
.
checkCompleteError
()
}
else
{
console
.
log
(
res
.
message
,
"获取订单完工项目失败!"
);
}
});
}
},
checkCompleteError
()
{
// 异常单定位错误项
let
self
=
this
self
.
list
.
forEach
((
panel
,
panelIndex
)
=>
{
panel
.
items
.
forEach
((
group
,
groupIndex
)
=>
{
group
.
items
.
forEach
((
ele
,
eleIndex
)
=>
{
if
(
ele
.
fieldsName
===
self
.
auditResultsId
)
{
self
.
waitHandlerPanelIndex
=
panelIndex
self
.
waitHandlerGroupIndex
=
groupIndex
self
.
waitHandlerEleIndex
=
eleIndex
}
})
})
})
this
.
locationCompleteItem
(
self
.
waitHandlerPanelIndex
,
self
.
waitHandlerGroupIndex
,
self
.
waitHandlerEleIndex
)
},
saveComplete
(){
// 保存完工信息
checkCompleteError
()
{
// 异常单定位错误项
let
self
=
this
let
param
=
{}
self
.
list
.
forEach
((
panel
)
=>
{
self
.
list
.
forEach
((
panel
,
panelIndex
)
=>
{
panel
.
items
.
forEach
((
group
,
groupIndex
)
=>
{
group
.
items
.
forEach
((
ele
,
eleIndex
)
=>
{
if
(
ele
.
fieldsName
===
self
.
auditResultsId
)
{
self
.
waitHandlerPanelIndex
=
panelIndex
self
.
waitHandlerGroupIndex
=
groupIndex
self
.
waitHandlerEleIndex
=
eleIndex
}
})
})
})
this
.
locationCompleteItem
(
self
.
waitHandlerPanelIndex
,
self
.
waitHandlerGroupIndex
,
self
.
waitHandlerEleIndex
)
},
handleSaveData
(){
let
param
=
{}
this
.
list
.
forEach
((
panel
)
=>
{
param
[
panel
.
panelFieldsName
]
=
[]
panel
.
items
.
forEach
((
group
)
=>
{
group
.
items
.
forEach
((
ele
)
=>
{
if
(
self
.
form
[
ele
.
fieldsName
]){
if
(
this
.
form
[
ele
.
fieldsName
]){
param
[
panel
.
panelFieldsName
].
push
({
"fieldsName"
:
ele
.
fieldsName
,
"fieldsType"
:
ele
.
fieldsType
,
"fieldsValue"
:
self
.
form
[
ele
.
fieldsName
],
"fieldsValue"
:
this
.
form
[
ele
.
fieldsName
],
"required"
:
ele
.
required
,
})
}
})
})
})
self
.
$u
.
api
.
saveCompleteData
(
param
,
self
.
orderId
).
then
((
res
)
=>
{
})
return
param
},
saveComplete
(){
// 保存完工信息
let
self
=
this
let
param
=
self
.
handleSaveData
()
self
.
$u
.
api
.
saveCompleteData
(
param
,
self
.
orderId
).
then
((
res
)
=>
{
if
(
res
.
code
==
200
)
{
this
.
$refs
.
uToast
.
show
({
title
:
'保存成功'
,
...
...
@@ -303,7 +308,7 @@
})
}
else
{
this
.
$refs
.
uToast
.
show
({
title
:
res
.
data
,
title
:
res
.
message
,
type
:
'error'
,
})
}
...
...
@@ -325,7 +330,7 @@
panelResult
.
submitted
++
}
else
if
(
value
&&
Array
.
isArray
(
value
)
&&
value
.
length
>
0
){
panelResult
.
submitted
++
}
else
if
(
first
){
// 记录第一个 为空 并且需要必填的项 用于定位
}
else
if
(
first
){
// 记录第一个 为空 并且需要必填的项 用于定位
first
=
false
self
.
waitHandlerPanelIndex
=
panelIndex
self
.
waitHandlerGroupIndex
=
groupIndex
...
...
@@ -365,23 +370,33 @@
},
orderFinish
(){
let
self
=
this
let
pass
=
this
.
checkCompleteItem
()
let
pass
=
this
.
checkCompleteItem
()
if
(
!
pass
){
self
.
completeCheckStatus
=
true
}
else
{
console
.
log
(
"完工"
);
this
.
pass
=
pass
if
(
self
.
inGuaranteePeriod
===
'Y'
){
self
.
$u
.
api
.
inOrderFinish
(
self
.
orderId
).
then
((
res
)
=>
{
console
.
log
(
res
)
self
.
completeCheckStatus
=
true
})
}
else
{
self
.
$u
.
api
.
outOrderFinish
({
customerPayType
:
'CASH'
},
self
.
orderId
).
then
((
res
)
=>
{
console
.
log
(
res
)
self
.
completeCheckStatus
=
true
})
}
}
else
{
// 先保存完工项
let
param
=
self
.
handleSaveData
()
self
.
$u
.
api
.
saveCompleteData
(
param
,
self
.
orderId
).
then
((
res
)
=>
{
if
(
res
.
code
==
200
)
{
//完工项信息保存成功再次完工工单
console
.
log
(
"完工"
);
this
.
pass
=
pass
if
(
self
.
inGuaranteePeriod
===
'Y'
){
self
.
$u
.
api
.
inOrderFinish
(
self
.
orderId
).
then
((
res
)
=>
{
console
.
log
(
res
)
self
.
completeCheckStatus
=
true
})
}
else
{
self
.
$u
.
api
.
outOrderFinish
({
customerPayType
:
'CASH'
},
self
.
orderId
).
then
((
res
)
=>
{
console
.
log
(
res
)
self
.
completeCheckStatus
=
true
})
}
}
else
{
this
.
$refs
.
uToast
.
show
({
title
:
res
.
message
,
type
:
'error'
,
})
}
})
}
},
tabsChange
(
index
){
...
...
@@ -401,7 +416,7 @@
if
(
groupItem
.
items
)
{
innerItem
=
groupItem
.
items
[
data
.
itemIndex
]
}
if
(
innerItem
.
fieldsType
===
'multiInput'
){
// 多个输入框的值触发
let
key
=
Object
.
keys
(
data
.
value
)[
0
]
...
...
@@ -424,8 +439,8 @@
nextStep
()
{
if
(
this
.
tabIndex
<
this
.
list
.
length
-
1
)
{
this
.
tabIndex
++
this
.
arr
=
[]
this
.
scrollRightTop
=
0
this
.
arr
=
[]
this
.
scrollRightTop
=
0
this
.
leftMenuStatus
(
0
)
this
.
$nextTick
(
function
()
{
this
.
getMenuItemTop
()
...
...
@@ -467,6 +482,7 @@
formType
=
'location'
break
case
'scan'
:
case
'machine_code'
:
formType
=
'scan'
break
case
'picker'
:
...
...
@@ -493,7 +509,7 @@
this
.
scrollRightTop
=
this
.
oldScrollTop
;
this
.
$nextTick
(
function
()
{
this
.
scrollRightTop
=
this
.
arr
[
index
];
this
.
current
=
index
;
this
.
current
=
index
;
this
.
leftMenuStatus
(
index
);
})
},
...
...
@@ -618,12 +634,12 @@
.label
{
color
:
#333
;
font-size
:
28rpx
;
line-height
:
40rpx
;
line-height
:
40rpx
;
padding-bottom
:
20rpx
;
}
.label-bold
{
font-size
:
32rpx
;
font-weight
:
bold
;
.label-bold
{
font-size
:
32rpx
;
font-weight
:
bold
;
}
.required
{
padding-right
:
10rpx
;
...
...
@@ -670,7 +686,7 @@
display
:
flex
;
overflow
:
hidden
;
border-radius
:
12rpx
12rpx
0
0
;
}
.u-search-inner
{
...
...
@@ -690,7 +706,7 @@
.u-tab-view
{
width
:
200rpx
;
height
:
100%
;
border
:
4rpx
solid
#F4F5F7
;
border
:
4rpx
solid
#F4F5F7
;
overflow
:
auto
;
}
...
...
@@ -728,8 +744,8 @@
.right-box
,
.right-boxs
{
// background-color: rgb(250, 250, 250);
background-color
:
#FFFFFF
;
overflow
:
auto
;
background-color
:
#FFFFFF
;
overflow
:
auto
;
width
:
100%
;
}
...
...
src/pages/order/detail.vue
View file @
c8ecc865
...
...
@@ -40,7 +40,7 @@
<view
v-if=
"readMore"
@
click=
"readMore = false"
class=
"read-more-toggle"
>
<u-icon
name=
"arrow-down"
></u-icon>
<text
class=
"read-more-text"
>
查看更多
</text>
</view>
</view>
<view
v-else
class=
"order-item-more"
>
<view
class=
"line-view"
></view>
<view
class=
"order-cell between-cell"
>
...
...
@@ -55,7 +55,7 @@
<text
class=
"cell-title"
>
充电桩信息:
</text>
<text>
{{
order
.
serviceContent
}}
</text>
</view>
<!--
<view
class=
"order-cell between-cell"
>
<!--
<view
class=
"order-cell between-cell"
>
<text>
备注:
</text>
...
...
@@ -102,7 +102,7 @@
<view
v-if=
"readMoreRecord"
@
click=
"readMoreRecord = false"
class=
"read-more-toggle"
>
<u-icon
name=
"arrow-down"
></u-icon>
<text
class=
"read-more-text"
>
查看更多
</text>
</view>
</view>
<view
v-else
class=
"read-more-toggle"
>
<u-icon
name=
"arrow-up"
></u-icon>
<text
class=
"read-more-text"
@
click=
"readMoreRecord = true"
>
点击收起
</text>
...
...
@@ -129,14 +129,14 @@
<text>
{{
centerButtonText
}}
</text>
<view
v-if=
"order.currentOverTime && showTimeOut"
class=
"time-view"
>
<text
style=
"padding-right: 8rpx;"
>
{{
order
.
currentOverTime
>
new
Date
().
getTime
()?
'剩'
:
'超'
}}
</text>
<u-count-down
:timestamp=
"timestampDiff(order.currentOverTime)"
font-size=
"20"
<u-count-down
:timestamp=
"timestampDiff(order.currentOverTime)"
font-size=
"20"
color=
"#FFFFFF"
bg-color=
"transparent"
separator-color=
"#FFFFFF"
separator-size=
"20"
:ref=
"'uCountDown'"
:ref=
"'uCountDown'"
show-days
height=
"20"
:show-days=
"threeDays()"
...
...
@@ -152,7 +152,7 @@
<view
class=
"right"
>
<view
v-if=
"errorSignIn || scenePhoto"
@
click=
"$u.debounce(handleClickRight, 500)"
:class=
"['button',
{'active': scenePhoto}]">
<text>
{{
errorSignIn
?
'异常'
:
'拍照'
}}
</text>
</view>
</view>
</view>
...
...
@@ -240,14 +240,14 @@
console
.
log
(
"option"
,
option
)
if
(
option
&&
option
.
id
)
{
this
.
orderId
=
option
.
id
}
}
this
.
loadOrderDetail
()
this
.
loadOrderRecord
()
this
.
getLocation
()
this
.
getSignDistance
()
},
computed
:
{
phoneIcon
()
{
//self-support/icon/dianhua-0@2x.png
if
(
this
.
isAllowDianhuaAndDaohang
){
...
...
@@ -302,7 +302,7 @@
success
:
function
()
{
console
.
log
(
'success'
);
}
});
},
complete
:
function
(
res
)
{
...
...
@@ -320,7 +320,7 @@
}
});
}
}
})
}
else
{
...
...
@@ -345,7 +345,7 @@
this
.
contactTime
()
}
},
contactTime
()
{
contactTime
()
{
let
self
=
this
var
data
=
{}
if
(
this
.
submitType
===
"workerAppointment"
){
...
...
@@ -414,7 +414,7 @@
self
.
$u
.
api
.
getSignDistance
(
data
).
then
((
res
)
=>
{
if
(
res
.
code
==
200
)
{
self
.
signDistance
=
res
.
data
}
}
});
},
loadOrderRecord
()
{
...
...
@@ -599,7 +599,7 @@
}
this
.
$u
.
api
[
this
.
submitType
](
data
,
this
.
order
.
orderId
).
then
(
res
=>
{
let
self
=
this
if
((
res
.
data
.
code
!==
undefined
&&
res
.
data
.
code
===
200
)
if
((
res
.
data
.
code
!==
undefined
&&
res
.
data
.
code
===
200
)
||
(
res
.
code
!==
undefined
&&
res
.
code
===
200
)
)
{
this
.
$refs
.
uToast
.
show
({
title
:
this
.
centerButtonText
+
'操作成功'
,
...
...
@@ -647,10 +647,11 @@
filish
(){
// 去完工
uni
.
navigateTo
({
url
:
'pages/order/complete?orderId='
+
this
.
order
.
orderId
+
"&categoryId="
+
this
.
order
.
categoryId
url
:
'pages/order/complete?orderId='
+
this
.
order
.
orderId
+
"&categoryId="
+
this
.
order
.
categoryId
+
"&orderServiceType="
+
this
.
order
.
orderServiceType
+
"&inGuaranteePeriod="
+
this
.
order
.
inGuaranteePeriod
+
"&partnerCompanyId="
+
this
.
order
.
partnerCompanyId
})
},
rejectOrder
()
{
// 拒单
...
...
@@ -682,23 +683,23 @@
self
.
dataValue
=
dataValue
},
fail
(
err
)
{
}
});
},
getDistance
(
Latitud
,
Longitud
){
return
this
.
distance
(
Latitud
,
Longitud
,
this
.
dataValue
[
1
],
this
.
dataValue
[
0
])
},
/**
/**
* echo distance(116.3896,39.91917,116.3940,39.91726);
* 计算两点之间直线距离
* @param float $lon1 经度
* @param float $lat1 维度
* @param float $lon2 经度
* @param float $lat2 维度
* @return float 浮点数
*/
distance
(
lat1
,
lng1
,
lat2
,
lng2
)
{
* 计算两点之间直线距离
* @param float $lon1 经度
* @param float $lat1 维度
* @param float $lon2 经度
* @param float $lat2 维度
* @return float 浮点数
*/
distance
(
lat1
,
lng1
,
lat2
,
lng2
)
{
console
.
log
(
lat1
,
lng1
,
lat2
,
lng2
)
var
radLat1
=
this
.
Rad
(
lat1
);
var
radLat2
=
this
.
Rad
(
lat2
);
...
...
@@ -708,7 +709,7 @@
Math
.
cos
(
radLat1
)
*
Math
.
cos
(
radLat2
)
*
Math
.
pow
(
Math
.
sin
(
b
/
2
),
2
)));
s
=
s
*
6378.137
;
// EARTH_RADIUS;
s
=
Math
.
round
(
s
*
10000
)
/
10
;
//输出为米
console
.
log
(
"计算结果"
,
s
,
'M'
);
console
.
log
(
"计算结果"
,
s
,
'M'
);
return
Number
(
s
?
s
.
toFixed
(
2
):
0
);
},
Rad
(
d
){
...
...
@@ -736,7 +737,7 @@
})
},
threeDays
()
{
return
this
.
timestampDiff
(
this
.
order
.
currentOverTime
)
>
3600
*
24
*
3
return
this
.
timestampDiff
(
this
.
order
.
currentOverTime
)
>
3600
*
24
*
3
}
}
};
...
...
@@ -814,7 +815,7 @@
color
:
#FFFFFF
;
line-height
:
40rpx
;
background-image
:
linear-gradient
(
to
right
,
#FF930D
,
#FFC174
);
&
.active
{
background-image
:
linear-gradient
(
to
right
,
#2272FF
,
#47ABFF
);
}
...
...
@@ -861,7 +862,7 @@
}
}
}
.read-more-toggle
{
text-align
:
center
;
color
:
#2272FF
;
...
...
@@ -869,11 +870,11 @@
margin-top
:
30rpx
;
padding-bottom
:
30rpx
;
}
.read-more-text
{
padding-left
:
8rpx
;
}
.order-item-more
{
font-size
:
26rpx
;
color
:
#333333
;
...
...
@@ -883,9 +884,9 @@
height
:
2rpx
;
margin-bottom
:
20rpx
;
}
}
.order-item
{
padding-bottom
:
6rpx
;
...
...
@@ -902,15 +903,15 @@
color
:
#333333
;
line-height
:
36rpx
;
}
}
.no-record-view
{
font-size
:
26rpx
;
color
:
#333333
;
margin-top
:
30rpx
;
}
.record-line-view
{
padding-left
:
30rpx
;
position
:
relative
;
...
...
@@ -923,7 +924,7 @@
.line-view-right
{
// text-align: right;
}
.
record-line-view
:
:
before
{
content
:
" "
;
position
:
absolute
;
...
...
@@ -1013,7 +1014,7 @@
color
:
#FFFFFF
;
font-size
:
32rpx
;
font-weight
:
bold
;
.time-view
{
display
:
flex
;
font-size
:
20rpx
;
...
...
@@ -1069,7 +1070,7 @@
color
:
#333333
;
line-height
:
48rpx
;
margin-bottom
:
10rpx
;
}
.between-cell
{
...
...
src/pages/photo/list.vue
View file @
c8ecc865
<
template
>
<view
class=
"backView"
>
<u-navbar
:title-size=
"32"
title-color=
"#000"
:border-bottom=
"false"
:title=
"title"
></u-navbar>
<u-loading
style=
"position: fixed;top: 50%;"
:show=
"loading"
size=
"36"
mode=
"flower"
></u-loading>
<view
class=
"topView"
>
<view
:class=
"['topItemView',
{'active':activeTop===ikey}]" @click="handleTopItemChange(ikey,item)"
v-for="(item,ikey) in dataList" :key="ikey">
<text
:class=
"['ph-lst-top-index',
{'active':activeTop===ikey}]">
{{
ikey
+
1
}}
</text>
<text
class=
"topItemTitle"
>
{{
item
.
type
}}
</text>
</view>
</view>
<view
class=
"rightView"
>
<view
class=
"right-view-title"
>
拍照项有:
</view>
<scroll-view
scroll-y=
"true"
class=
"scroll-y"
>
<template
v-for=
"(item,ikey) in rightList"
>
<view
class=
"rightItemView"
@
click=
"take(item,ikey)"
:key=
"ikey"
>
<view
:class=
"['rightContentView',
{'active':item.orderImages[0]}]">
<text
class=
"ph-lst-item-index"
>
{{
ikey
+
1
}}
</text>
<text
class=
""
>
{{
item
.
name
}}
</text>
<image
class=
"ph-list-item-arrow"
src=
"/static/photo/arrow.png"
></image>
<!--
<text
class=
"rightContent u-m-t-14 u-m-l-30 u-p-b-30"
>
{{
item
.
describe
}}
</text>
-->
</view>
<view
class=
"rightImageView"
v-if=
"item.orderImages && item.orderImages.length > 0"
>
<image
class=
"rightImage"
v-for=
"(image, index) in item.orderImages.slice(0 , 10)"
:src=
"image"
:key=
"index"
@
click
.
stop=
"handleClickImage(item, index)"
mode=
"aspectFill"
></image>
</view>
</view>
</
template
>
</scroll-view>
<take-photo
type=
"test"
v-if=
"takeStatus"
:currentItem=
"currentItemDate"
@
close=
"closeTake"
></take-photo>
<!-- <u-button v-if="activeTop + 1 === dataList.length" class="ph-list-button" type="error" shape="circle"
:disabled="buttonDisabled" :custom-style="buttonStyle" @click="isPopShow = true">一键清空展示图片</u-button> -->
</view>
<!-- <u-popup border-radius="10" v-model="isPopShow" safe-area-inset-bottom mode="center" width="690rpx"
height="600rpx">
<view class="ph-list-pop-title">
<text>是否一键清空系统展示的图片?</text>
</view>
<view class="ph-list-pop-text">
<text>点击"确定"则删除系统展示的所有图片</text>
</view>
<view class="ph-list-pop-btn-view">
<u-button :custom-style="customStyleCancel" hover-class="none" shape="circle" type="primary"
@click="isPopShow = false">
取消
</u-button>
<u-button :custom-style="customStyleSave" shape="circle" type="primary" @click="handleClickSure()">
确定
</u-button>
</view>
</u-popup> -->
</view>
</template>
<
script
>
import
takePhoto
from
'@/components/take/index.vue'
export
default
{
components
:
{
'take-photo'
:
takePhoto
},
data
()
{
return
{
takeStatus
:
false
,
currentItemDate
:{},
topList
:
[],
activeTop
:
0
,
leftList
:
[],
rightList
:
[],
classifyId
:
''
,
systemId
:
''
,
brand
:
''
,
brandId
:
''
,
orderId
:
''
,
dataList
:
[],
loading
:
true
,
isPopShow
:
false
,
userWatermark
:{},
title
:
'规范展示'
}
},
onLoad
(
e
)
{
getApp
().
trackPage
(
'照片规范列表页'
)
if
(
e
&&
e
.
brandId
)
{
this
.
brandId
=
e
.
brandId
}
if
(
e
&&
e
.
brand
)
{
this
.
brand
=
decodeURIComponent
(
e
.
brand
)
this
.
title
=
this
.
brand
}
if
(
e
&&
e
.
orderId
)
{
this
.
orderId
=
e
.
orderId
}
if
(
e
&&
e
.
systemId
)
{
this
.
systemId
=
e
.
systemId
}
if
(
e
&&
e
.
classifyId
)
{
this
.
classifyId
=
e
.
classifyId
}
// this.getListData()
this
.
getListDataNew
()
this
.
getWatermark
()
},
computed
:
{
buttonStyle
()
{
return
{
'color'
:
'#FFFFFF'
,
'width'
:
'600rpx'
,
'height'
:
'104rpx'
,
'font-size'
:
'36rpx'
}
},
buttonDisabled
()
{
for
(
var
item
of
this
.
dataList
)
{
for
(
var
i
of
item
.
list
)
{
if
((
i
.
imageList
||
[]).
length
>
0
)
{
return
false
}
}
}
return
true
},
customStyleCancel
()
{
return
{
'background-color'
:
'#D1D4D4'
,
'width'
:
'280rpx'
,
'height'
:
'96rpx'
}
},
customStyleSave
()
{
return
{
'background-color'
:
'##2272FF'
,
'width'
:
'280rpx'
,
'height'
:
'96rpx'
,
'margin-left'
:
'50rpx'
}
}
},
methods
:
{
getListData
:
function
()
{
this
.
loading
=
true
let
that
=
this
this
.
$u
.
cloudApi
.
getGroupStandardV2
({
'token'
:
this
.
vuex_token
,
'classify_id'
:
this
.
classifyId
,
'system_id'
:
this
.
systemId
,
'brand_id'
:
this
.
brandId
}).
then
(
res
=>
{
this
.
loading
=
false
if
(
res
&&
res
.
result
)
{
if
(
res
.
result
.
error_code
)
{
uni
.
showToast
({
title
:
res
.
result
.
error_msg
})
}
else
{
that
.
handleData
(
res
.
result
)
}
}
})
},
getListDataNew
()
{
this
.
loading
=
true
let
self
=
this
var
data
=
{
partnerCompanyId
:
this
.
systemId
,
orderId
:
this
.
orderId
,
categoryId
:
this
.
classifyId
,
brandId
:
this
.
brandId
};
self
.
$u
.
api
.
orderStandard
(
data
).
then
((
res
)
=>
{
this
.
loading
=
false
if
(
res
.
code
==
200
)
{
if
(
res
.
data
&&
res
.
data
.
length
>
0
){
let
dataList
=
[]
var
flag
=
false
;
res
.
data
.
forEach
(
item
=>
{
if
(
dataList
.
length
===
0
){
var
dataItem
=
{
type
:
''
,
list
:[]}
dataItem
.
type
=
item
.
type
dataItem
.
list
.
push
(
item
)
dataList
.
push
(
dataItem
)
}
else
{
dataList
.
forEach
(
dataListItem
=>
{
if
(
dataListItem
.
type
===
item
.
type
){
dataListItem
.
list
.
push
(
item
)
flag
=
true
return
false
;
}
else
{
flag
=
false
}
})
if
(
!
flag
){
var
dataItem
=
{
type
:
''
,
list
:[]}
dataItem
.
type
=
item
.
type
dataItem
.
list
.
push
(
item
)
dataList
.
push
(
dataItem
)
}
}
})
console
.
log
(
"==="
,
dataList
)
this
.
handleData
(
dataList
)
}
}
else
{
console
.
log
(
res
.
code
.
message
)
}
});
},
handleData
:
function
(
result
)
{
this
.
activeTop
=
0
this
.
dataList
=
result
if
(
result
.
length
>
0
)
{
var
item
=
result
[
0
]
this
.
rightList
=
item
.
list
}
},
//顶部点击
handleTopItemChange
:
function
(
ikey
,
item
)
{
this
.
activeTop
=
ikey
this
.
rightList
=
item
.
list
const
photo
=
getApp
().
globalData
.
photo
photo
.
topIndex
=
ikey
photo
.
waterSetting
=
item
.
userWatermark
uni
.
pageScrollTo
({
scrollTop
:
0
,
duration
:
0
});
},
// 点击图片
handleClickImage
(
item
,
index
)
{
uni
.
previewImage
({
urls
:
item
.
orderImages
,
current
:
index
})
},
//右侧点击
rightItemClick
:
function
(
item
,
ikey
)
{
const
photo
=
getApp
().
globalData
.
photo
photo
.
currentItem
=
item
photo
.
itemIndex
=
ikey
const
len
=
item
.
imageList
.
length
photo
.
currentItemLength
=
len
>
9
?
10
:
len
uni
.
navigateTo
({
url
:
'/pages/photo/take'
})
},
// 清除图片
handleClickSure
:
function
()
{
this
.
$u
.
cloudApi
.
cleanImage
({
'token'
:
this
.
vuex_token
,
}).
then
(
res
=>
{
this
.
isPopShow
=
false
if
(
res
&&
res
.
result
)
{
this
.
getListData
()
}
})
},
take
(
item
,
ikey
)
{
this
.
currentItemDate
=
item
const
photo
=
getApp
().
globalData
.
photo
photo
.
currentItem
=
item
photo
.
itemIndex
=
ikey
const
len
=
item
.
orderImages
?
item
.
orderImages
.
length
:
0
photo
.
currentItemLength
=
len
>
9
?
10
:
len
uni
.
hideTabBar
()
this
.
takeStatus
=
true
},
closeTake
(
img
)
{
if
(
img
!==
undefined
){
if
(
!
this
.
currentItemDate
.
orderImages
)
this
.
currentItemDate
.
orderImages
=
[]
// step1 添加图片
img
.
forEach
(
v
=>
{
this
.
currentItemDate
.
orderImages
.
push
(
v
.
key
)
})
// step2 保存图片
var
data
=
{
type
:
this
.
currentItemDate
.
type
,
images
:
Array
.
from
(
this
.
currentItemDate
.
orderImages
),
fieldsName
:
this
.
currentItemDate
.
fieldName
}
this
.
$u
.
api
.
saveImage
(
data
,
this
.
orderId
).
then
((
res
)
=>
{
if
(
res
.
code
==
200
)
{
console
.
log
(
"==="
,
res
.
data
)
}
else
{
console
.
log
(
"保存图片异常"
,
res
.
data
.
message
)
}
});
}
this
.
takeStatus
=
false
},
getWatermark
(){
var
data
=
{
partnerCompanyId
:
this
.
systemId
}
this
.
$u
.
api
.
getWatermark
(
data
).
then
((
res
)
=>
{
if
(
res
.
code
==
200
)
{
console
.
log
(
"==="
,
res
.
data
)
this
.
userWatermark
=
res
.
data
}
else
{
console
.
log
(
"获取水印备注异常"
,
res
.
data
.
message
)
}
});
}
}
}
</
script
>
<
style
>
.backView
{
background-color
:
#F4F5F7
;
position
:
absolute
;
top
:
0
;
left
:
0
;
width
:
100%
;
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
height
:
100%
;
}
.centerBackView
{
display
:
flex
;
flex-direction
:
row
;
margin-top
:
80
rpx
;
width
:
100%
;
}
.ph-lst-top-index
{
font-size
:
26
rpx
;
font-weight
:
bold
;
color
:
#FFFFFF
;
border-radius
:
8
rpx
;
background-color
:
#999999
;
width
:
36
rpx
;
height
:
36
rpx
;
line-height
:
36
rpx
;
text-align
:
center
;
}
.ph-lst-top-index.active
{
background-color
:
#2272FF
;
}
.rightView
{
background-color
:
#F4F5F7
;
width
:
100%
;
display
:
flex
;
flex-direction
:
column
;
padding-bottom
:
50
rpx
;
}
.right-view-title
{
font-size
:
36
rpx
;
font-weight
:
bold
;
height
:
104
rpx
;
line-height
:
104
rpx
;
margin-left
:
30
rpx
;
}
.rightItemView
{
/* width: 100%; */
/* display: flex; */
/* flex-direction: row; */
/* justify-content: space-between; */
/* border-bottom: 20rpx solid #F3F3F3; */
margin
:
0
rpx
30
rpx
20
rpx
30
rpx
;
padding
:
36
rpx
30
rpx
30
rpx
30
rpx
;
border-radius
:
12
rpx
;
background-color
:
#FFFFFF
;
/* min-height: 108rpx; */
}
.ph-lst-item-index
{
font-size
:
24
rpx
;
font-weight
:
bold
;
border-radius
:
4
rpx
;
width
:
34
rpx
;
height
:
34
rpx
;
line-height
:
32
rpx
;
text-align
:
center
;
border-width
:
1px
;
border-style
:
solid
;
margin-right
:
10
rpx
;
margin-top
:
4
rpx
;
}
.rightContentView
{
display
:
flex
;
align-items
:
flex-start
;
width
:
100%
;
font-size
:
30
rpx
;
color
:
#2272FF
;
/* flex-direction: column; */
/* border-left: 2rpx solid #F3F3F3; */
}
.rightContentView.active
{
color
:
#666666
;
border-color
:
#666666
;
}
.ph-list-item-arrow
{
position
:
absolute
;
width
:
40
rpx
;
height
:
40
rpx
;
right
:
38
rpx
;
}
.rightContent
{
font-size
:
30
rpx
;
color
:
#333333
;
line-height
:
40
rpx
;
}
.rightImageView
{
/* width: 300rpx; */
/* height: 320rpx; */
display
:
flex
;
align-items
:
center
;
justify-content
:
flex-start
;
flex-wrap
:
wrap
;
margin-top
:
26
rpx
;
}
.rightImage
{
background-color
:
#F3F3F3
;
width
:
116
rpx
;
height
:
116
rpx
;
margin
:
0
rpx
12
rpx
12
rpx
0
rpx
;
}
.rightImage
:nth-child
(
5n
)
{
margin-right
:
0
;
}
.topView
{
background-color
:
#FAFAFA
;
width
:
100%
;
height
:
100
rpx
;
display
:
flex
;
flex-direction
:
row
;
z-index
:
1
;
}
.topItemView
{
/* width: 210rpx; */
height
:
100
rpx
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
-webkit-flex
:
1
;
flex
:
1
;
background-color
:
#FFFFFF
;
color
:
#999999
;
}
.topItemView.active
{
color
:
#2272FF
;
}
.topItemTitle
{
font-size
:
36
rpx
;
font-weight
:
bold
;
padding-left
:
30
rpx
;
}
.greenBackColor
{
background-color
:
#4CD964
;
}
.ph-list-pop-text
{
color
:
#666666
;
text-align
:
center
;
margin-top
:
20
rpx
;
font-size
:
30
rpx
;
}
.ph-list-pop-title
{
font-size
:
40
rpx
;
padding-top
:
150
rpx
;
text-align
:
center
;
color
:
#333333
;
}
.ph-list-pop-btn-view
{
display
:
flex
;
justify-content
:
center
;
margin-top
:
150
rpx
;
}
.scroll-y
{
height
:
73vh
;
}
</
style
>
<
template
>
<view
class=
"backView"
>
<u-navbar
:title-size=
"32"
title-color=
"#000"
:border-bottom=
"false"
:title=
"title"
></u-navbar>
<u-loading
style=
"position: fixed;top: 50%;"
:show=
"loading"
size=
"36"
mode=
"flower"
></u-loading>
<view
class=
"topView"
>
<view
:class=
"['topItemView',
{'active':activeTop===ikey}]" @click="handleTopItemChange(ikey,item)"
v-for="(item,ikey) in dataList" :key="ikey">
<text
:class=
"['ph-lst-top-index',
{'active':activeTop===ikey}]">
{{
ikey
+
1
}}
</text>
<text
class=
"topItemTitle"
>
{{
item
.
type
}}
</text>
</view>
</view>
<view
class=
"rightView"
>
<view
class=
"right-view-title"
>
拍照项有:
</view>
<scroll-view
scroll-y=
"true"
class=
"scroll-y"
>
<template
v-for=
"(item,ikey) in rightList"
>
<view
class=
"rightItemView"
@
click=
"take(item,ikey)"
:key=
"ikey"
>
<view
:class=
"['rightContentView',
{'active':item.orderImages[0]}]">
<text
class=
"ph-lst-item-index"
>
{{
ikey
+
1
}}
</text>
<text
class=
""
>
{{
item
.
name
}}
</text>
<image
class=
"ph-list-item-arrow"
src=
"/static/photo/arrow.png"
></image>
<!--
<text
class=
"rightContent u-m-t-14 u-m-l-30 u-p-b-30"
>
{{
item
.
describe
}}
</text>
-->
</view>
<view
class=
"rightImageView"
v-if=
"item.orderImages && item.orderImages.length > 0"
>
<image
class=
"rightImage"
v-for=
"(image, index) in item.orderImages.slice(0 , 10)"
:src=
"image"
:key=
"index"
@
click
.
stop=
"handleClickImage(item, index)"
mode=
"aspectFill"
></image>
</view>
</view>
</
template
>
</scroll-view>
<take-photo
type=
"test"
v-if=
"takeStatus"
:currentItem=
"currentItemDate"
@
close=
"closeTake"
></take-photo>
<!-- <u-button v-if="activeTop + 1 === dataList.length" class="ph-list-button" type="error" shape="circle"
:disabled="buttonDisabled" :custom-style="buttonStyle" @click="isPopShow = true">一键清空展示图片</u-button> -->
</view>
<!-- <u-popup border-radius="10" v-model="isPopShow" safe-area-inset-bottom mode="center" width="690rpx"
height="600rpx">
<view class="ph-list-pop-title">
<text>是否一键清空系统展示的图片?</text>
</view>
<view class="ph-list-pop-text">
<text>点击"确定"则删除系统展示的所有图片</text>
</view>
<view class="ph-list-pop-btn-view">
<u-button :custom-style="customStyleCancel" hover-class="none" shape="circle" type="primary"
@click="isPopShow = false">
取消
</u-button>
<u-button :custom-style="customStyleSave" shape="circle" type="primary" @click="handleClickSure()">
确定
</u-button>
</view>
</u-popup> -->
</view>
</template>
<
script
>
import
takePhoto
from
'@/components/take/index.vue'
export
default
{
components
:
{
'take-photo'
:
takePhoto
},
data
()
{
return
{
takeStatus
:
false
,
currentItemDate
:{},
topList
:
[],
activeTop
:
0
,
leftList
:
[],
rightList
:
[],
classifyId
:
''
,
systemId
:
''
,
brand
:
''
,
brandId
:
''
,
orderId
:
''
,
dataList
:
[],
loading
:
true
,
isPopShow
:
false
,
userWatermark
:{},
title
:
'规范展示'
}
},
onLoad
(
e
)
{
getApp
().
trackPage
(
'照片规范列表页'
)
if
(
e
&&
e
.
brandId
)
{
this
.
brandId
=
e
.
brandId
}
if
(
e
&&
e
.
brand
)
{
this
.
brand
=
decodeURIComponent
(
e
.
brand
)
this
.
title
=
this
.
brand
}
if
(
e
&&
e
.
orderId
)
{
this
.
orderId
=
e
.
orderId
}
if
(
e
&&
e
.
systemId
)
{
this
.
systemId
=
e
.
systemId
}
if
(
e
&&
e
.
classifyId
)
{
this
.
classifyId
=
e
.
classifyId
}
// this.getListData()
this
.
getListDataNew
()
this
.
getWatermark
()
},
computed
:
{
buttonStyle
()
{
return
{
'color'
:
'#FFFFFF'
,
'width'
:
'600rpx'
,
'height'
:
'104rpx'
,
'font-size'
:
'36rpx'
}
},
buttonDisabled
()
{
for
(
var
item
of
this
.
dataList
)
{
for
(
var
i
of
item
.
list
)
{
if
((
i
.
imageList
||
[]).
length
>
0
)
{
return
false
}
}
}
return
true
},
customStyleCancel
()
{
return
{
'background-color'
:
'#D1D4D4'
,
'width'
:
'280rpx'
,
'height'
:
'96rpx'
}
},
customStyleSave
()
{
return
{
'background-color'
:
'##2272FF'
,
'width'
:
'280rpx'
,
'height'
:
'96rpx'
,
'margin-left'
:
'50rpx'
}
}
},
methods
:
{
getListData
:
function
()
{
this
.
loading
=
true
let
that
=
this
this
.
$u
.
cloudApi
.
getGroupStandardV2
({
'token'
:
this
.
vuex_token
,
'classify_id'
:
this
.
classifyId
,
'system_id'
:
this
.
systemId
,
'brand_id'
:
this
.
brandId
}).
then
(
res
=>
{
this
.
loading
=
false
if
(
res
&&
res
.
result
)
{
if
(
res
.
result
.
error_code
)
{
uni
.
showToast
({
title
:
res
.
result
.
error_msg
})
}
else
{
that
.
handleData
(
res
.
result
)
}
}
})
},
getListDataNew
()
{
this
.
loading
=
true
let
self
=
this
var
data
=
{
partnerCompanyId
:
this
.
systemId
,
orderId
:
this
.
orderId
,
categoryId
:
this
.
classifyId
,
brandId
:
this
.
brandId
};
self
.
$u
.
api
.
orderStandard
(
data
).
then
((
res
)
=>
{
this
.
loading
=
false
if
(
res
.
code
==
200
)
{
if
(
res
.
data
&&
res
.
data
.
length
>
0
){
let
dataList
=
[]
var
flag
=
false
;
res
.
data
.
forEach
(
item
=>
{
if
(
dataList
.
length
===
0
){
var
dataItem
=
{
type
:
''
,
list
:[]}
dataItem
.
type
=
item
.
type
dataItem
.
list
.
push
(
item
)
dataList
.
push
(
dataItem
)
}
else
{
dataList
.
forEach
(
dataListItem
=>
{
if
(
dataListItem
.
type
===
item
.
type
){
dataListItem
.
list
.
push
(
item
)
flag
=
true
return
false
;
}
else
{
flag
=
false
}
})
if
(
!
flag
){
var
dataItem
=
{
type
:
''
,
list
:[]}
dataItem
.
type
=
item
.
type
dataItem
.
list
.
push
(
item
)
dataList
.
push
(
dataItem
)
}
}
})
console
.
log
(
"==="
,
dataList
)
this
.
handleData
(
dataList
)
}
}
else
{
console
.
log
(
res
.
code
.
message
)
}
});
},
handleData
:
function
(
result
)
{
this
.
activeTop
=
0
this
.
dataList
=
result
if
(
result
.
length
>
0
)
{
var
item
=
result
[
0
]
this
.
rightList
=
item
.
list
}
},
//顶部点击
handleTopItemChange
:
function
(
ikey
,
item
)
{
this
.
activeTop
=
ikey
this
.
rightList
=
item
.
list
const
photo
=
getApp
().
globalData
.
photo
photo
.
topIndex
=
ikey
photo
.
waterSetting
=
item
.
userWatermark
uni
.
pageScrollTo
({
scrollTop
:
0
,
duration
:
0
});
},
// 点击图片
handleClickImage
(
item
,
index
)
{
uni
.
previewImage
({
urls
:
item
.
orderImages
,
current
:
index
})
},
//右侧点击
rightItemClick
:
function
(
item
,
ikey
)
{
const
photo
=
getApp
().
globalData
.
photo
photo
.
currentItem
=
item
photo
.
itemIndex
=
ikey
const
len
=
item
.
imageList
.
length
photo
.
currentItemLength
=
len
>
9
?
10
:
len
uni
.
navigateTo
({
url
:
'/pages/photo/take'
})
},
// 清除图片
handleClickSure
:
function
()
{
this
.
$u
.
cloudApi
.
cleanImage
({
'token'
:
this
.
vuex_token
,
}).
then
(
res
=>
{
this
.
isPopShow
=
false
if
(
res
&&
res
.
result
)
{
this
.
getListData
()
}
})
},
take
(
item
,
ikey
)
{
this
.
currentItemDate
=
item
const
photo
=
getApp
().
globalData
.
photo
photo
.
currentItem
=
item
photo
.
itemIndex
=
ikey
const
len
=
item
.
orderImages
?
item
.
orderImages
.
length
:
0
photo
.
currentItemLength
=
len
>
9
?
10
:
len
uni
.
hideTabBar
()
this
.
takeStatus
=
true
},
closeTake
(
img
)
{
if
(
img
!==
undefined
){
if
(
!
this
.
currentItemDate
.
orderImages
)
this
.
currentItemDate
.
orderImages
=
[]
// step1 添加图片
img
.
forEach
(
v
=>
{
this
.
currentItemDate
.
orderImages
.
push
(
v
.
key
)
})
// step2 保存图片
var
data
=
{
type
:
this
.
currentItemDate
.
type
,
images
:
Array
.
from
(
this
.
currentItemDate
.
orderImages
),
fieldsName
:
this
.
currentItemDate
.
fieldName
}
this
.
$u
.
api
.
saveImage
(
data
,
this
.
orderId
).
then
((
res
)
=>
{
if
(
res
.
code
==
200
)
{
console
.
log
(
"==="
,
res
.
data
)
}
else
{
console
.
log
(
"保存图片异常"
,
res
.
data
.
message
)
}
});
}
this
.
takeStatus
=
false
},
getWatermark
(){
var
data
=
{
partnerCompanyId
:
this
.
systemId
}
this
.
$u
.
api
.
getWatermark
(
data
).
then
((
res
)
=>
{
if
(
res
.
code
==
200
)
{
console
.
log
(
"==="
,
res
.
data
)
this
.
userWatermark
=
res
.
data
getApp
().
globalData
.
photo
.
waterSetting
=
this
.
userWatermark
}
else
{
console
.
log
(
"获取水印备注异常"
,
res
.
data
.
message
)
}
});
}
}
}
</
script
>
<
style
>
.backView
{
background-color
:
#F4F5F7
;
position
:
absolute
;
top
:
0
;
left
:
0
;
width
:
100%
;
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
height
:
100%
;
}
.centerBackView
{
display
:
flex
;
flex-direction
:
row
;
margin-top
:
80
rpx
;
width
:
100%
;
}
.ph-lst-top-index
{
font-size
:
26
rpx
;
font-weight
:
bold
;
color
:
#FFFFFF
;
border-radius
:
8
rpx
;
background-color
:
#999999
;
width
:
36
rpx
;
height
:
36
rpx
;
line-height
:
36
rpx
;
text-align
:
center
;
}
.ph-lst-top-index.active
{
background-color
:
#2272FF
;
}
.rightView
{
background-color
:
#F4F5F7
;
width
:
100%
;
display
:
flex
;
flex-direction
:
column
;
padding-bottom
:
50
rpx
;
}
.right-view-title
{
font-size
:
36
rpx
;
font-weight
:
bold
;
height
:
104
rpx
;
line-height
:
104
rpx
;
margin-left
:
30
rpx
;
}
.rightItemView
{
/* width: 100%; */
/* display: flex; */
/* flex-direction: row; */
/* justify-content: space-between; */
/* border-bottom: 20rpx solid #F3F3F3; */
margin
:
0
rpx
30
rpx
20
rpx
30
rpx
;
padding
:
36
rpx
30
rpx
30
rpx
30
rpx
;
border-radius
:
12
rpx
;
background-color
:
#FFFFFF
;
/* min-height: 108rpx; */
}
.ph-lst-item-index
{
font-size
:
24
rpx
;
font-weight
:
bold
;
border-radius
:
4
rpx
;
width
:
34
rpx
;
height
:
34
rpx
;
line-height
:
32
rpx
;
text-align
:
center
;
border-width
:
1px
;
border-style
:
solid
;
margin-right
:
10
rpx
;
margin-top
:
4
rpx
;
}
.rightContentView
{
display
:
flex
;
align-items
:
flex-start
;
width
:
100%
;
font-size
:
30
rpx
;
color
:
#2272FF
;
/* flex-direction: column; */
/* border-left: 2rpx solid #F3F3F3; */
}
.rightContentView.active
{
color
:
#666666
;
border-color
:
#666666
;
}
.ph-list-item-arrow
{
position
:
absolute
;
width
:
40
rpx
;
height
:
40
rpx
;
right
:
38
rpx
;
}
.rightContent
{
font-size
:
30
rpx
;
color
:
#333333
;
line-height
:
40
rpx
;
}
.rightImageView
{
/* width: 300rpx; */
/* height: 320rpx; */
display
:
flex
;
align-items
:
center
;
justify-content
:
flex-start
;
flex-wrap
:
wrap
;
margin-top
:
26
rpx
;
}
.rightImage
{
background-color
:
#F3F3F3
;
width
:
116
rpx
;
height
:
116
rpx
;
margin
:
0
rpx
12
rpx
12
rpx
0
rpx
;
}
.rightImage
:nth-child
(
5n
)
{
margin-right
:
0
;
}
.topView
{
background-color
:
#FAFAFA
;
width
:
100%
;
height
:
100
rpx
;
display
:
flex
;
flex-direction
:
row
;
z-index
:
1
;
}
.topItemView
{
/* width: 210rpx; */
height
:
100
rpx
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
-webkit-flex
:
1
;
flex
:
1
;
background-color
:
#FFFFFF
;
color
:
#999999
;
}
.topItemView.active
{
color
:
#2272FF
;
}
.topItemTitle
{
font-size
:
36
rpx
;
font-weight
:
bold
;
padding-left
:
30
rpx
;
}
.greenBackColor
{
background-color
:
#4CD964
;
}
.ph-list-pop-text
{
color
:
#666666
;
text-align
:
center
;
margin-top
:
20
rpx
;
font-size
:
30
rpx
;
}
.ph-list-pop-title
{
font-size
:
40
rpx
;
padding-top
:
150
rpx
;
text-align
:
center
;
color
:
#333333
;
}
.ph-list-pop-btn-view
{
display
:
flex
;
justify-content
:
center
;
margin-top
:
150
rpx
;
}
.scroll-y
{
height
:
73vh
;
}
</
style
>
src/pages/photo/setting.vue
View file @
c8ecc865
...
...
@@ -8,20 +8,20 @@
<text
class=
"itemTitle"
>
保存原图
</text>
<text
class=
"itemNotice"
>
拍照后另保存一张无水印的图片
</text>
</view>
<switch
class=
"itemSwitch"
:checked=
"result['has
_o
rigin']"
@
change=
"handleOrigineChange"
color=
"#007AFF"
/>
<switch
class=
"itemSwitch"
:checked=
"result['has
O
rigin']"
@
change=
"handleOrigineChange"
color=
"#007AFF"
/>
</view>
<view
class=
"itemView"
v-if=
"showTitleSwitch"
>
<view
class=
"itemTitleView"
@
click=
"itemClick(
{},-1)">
<text
class=
"itemTitle"
>
水印标题
</text>
<text
class=
"itemNotice"
>
{{
result
[
'lower
_right'
][
'title_text
'
]
||
'点击可编辑更改'
}}
</text>
<text
class=
"itemNotice"
>
{{
result
[
'lower
Left'
][
'title
'
]
||
'点击可编辑更改'
}}
</text>
</view>
<switch
class=
"itemSwitch"
disabled
:checked=
"result['lower
_right']['title_text
'] != ''"
<switch
class=
"itemSwitch"
disabled
:checked=
"result['lower
Left']['title
'] != ''"
@
click=
"handleClickTitleSwitch"
color=
"#007AFF"
/>
</view>
<view
class=
"itemView"
v-for=
"(item,ikey) in itemList"
:key=
"ikey"
>
<view
class=
"itemTitleView"
@
click=
"itemClick(item,ikey)"
>
<text
class=
"itemTitle"
>
{{
item
[
'watemark
_t
ext'
]
||
'自定义'
+
(
ikey
+
1
)
}}
</text>
<text
class=
"itemNotice"
>
{{
item
[
'watemark
_v
alue'
]
||
'点击可编辑更改'
}}
</text>
<text
class=
"itemTitle"
>
{{
item
[
'watemark
T
ext'
]
||
'自定义'
+
(
ikey
+
1
)
}}
</text>
<text
class=
"itemNotice"
>
{{
item
[
'watemark
V
alue'
]
||
'点击可编辑更改'
}}
</text>
</view>
<switch
class=
"itemSwitch"
:checked=
"item['enable']"
@
change=
"itemChange(item, ikey)"
color=
"#007AFF"
/>
</view>
...
...
@@ -32,7 +32,7 @@
<view
class=
"inputBackView"
>
<view
class=
"ph-pop-left-view"
>
<view
class=
"leftInputView"
>
<input
class=
"leftInput"
type=
"text"
v-model=
"currenItem['watemark
_t
ext']"
<input
class=
"leftInput"
type=
"text"
v-model=
"currenItem['watemark
T
ext']"
@
input=
"leftInput()"
:disabled=
"currenItem.type === 'title_text'"
placeholder=
"请输入"
maxlength=
"10"
/>
</view>
...
...
@@ -41,7 +41,7 @@
<view
class=
"ph-pop-mid-view"
>
:
</view>
<view>
<view
class=
"rightInputView"
>
<input
class=
"rightInput"
type=
"text"
v-model=
"currenItem['watemark
_v
alue']"
<input
class=
"rightInput"
type=
"text"
v-model=
"currenItem['watemark
V
alue']"
@
input=
"rightInput()"
placeholder=
"请输入内容"
maxlength=
"30"
/>
</view>
<view
class=
"ph-pop-tip-view"
v-if=
"showTipRight"
>
*必填项
</view>
...
...
@@ -71,14 +71,14 @@
isPopShow
:
false
,
icon_close_new
:
''
,
result
:
{
has
_o
rigin
:
true
,
lower
_righ
t
:
{
has
O
rigin
:
true
,
lower
Lef
t
:
{
body
:
[]
}
},
currenItem
:
{
'watemark
_t
ext'
:
''
,
'watemark
_v
alue'
:
''
'watemark
T
ext'
:
''
,
'watemark
V
alue'
:
''
},
editingItem
:
{},
showTipLeft
:
false
,
...
...
@@ -88,8 +88,8 @@
},
computed
:
{
itemList
()
{
if
(
this
.
result
[
'lower
_righ
t'
])
{
var
arr
=
this
.
result
[
'lower
_righ
t'
][
'body'
]
if
(
this
.
result
[
'lower
Lef
t'
])
{
var
arr
=
this
.
result
[
'lower
Lef
t'
][
'body'
]
return
arr
.
filter
((
item
)
=>
{
return
item
.
watemark_type
===
'备注'
})
...
...
@@ -99,7 +99,7 @@
},
showTitleSwitch
()
{
return
this
.
result
[
'lower
_right'
].
hasOwnProperty
(
'title_text
'
)
return
this
.
result
[
'lower
Left'
].
hasOwnProperty
(
'title
'
)
},
customStyleCancel
()
{
return
{
...
...
@@ -164,12 +164,12 @@
//保存原图 开关
handleOrigineChange
:
function
(
e
)
{
this
.
result
[
'has
_origin'
]
=
!
this
.
result
[
'has_o
rigin'
]
this
.
result
[
'has
Origin'
]
=
!
this
.
result
[
'hasO
rigin'
]
this
.
saveUserWatermark
()
},
handleClickTitleSwitch
:
function
(
e
)
{
var
string
=
this
.
result
[
'lower
_right'
][
'title_text
'
]
?
'水印标题不可关闭'
:
'请先编辑该自定义项'
var
string
=
this
.
result
[
'lower
Left'
][
'title
'
]
?
'水印标题不可关闭'
:
'请先编辑该自定义项'
uni
.
showToast
({
icon
:
'none'
,
title
:
string
...
...
@@ -178,7 +178,7 @@
//自定义 开关
itemChange
:
function
(
item
,
ikey
)
{
if
(
item
[
'watemark
_v
alue'
])
{
if
(
item
[
'watemark
V
alue'
])
{
// 修改
item
[
'enable'
]
=
!
item
[
'enable'
]
this
.
saveUserWatermark
()
...
...
@@ -194,8 +194,8 @@
itemClick
:
function
(
item
,
ikey
)
{
if
(
ikey
===
-
1
)
{
this
.
currenItem
=
{
'watemark
_t
ext'
:
'水印标题'
,
'watemark
_value'
:
this
.
result
[
'lower_right'
][
'title_text
'
],
'watemark
T
ext'
:
'水印标题'
,
'watemark
Value'
:
this
.
result
[
'lowerLeft'
][
'title
'
],
'type'
:
'title_text'
}
}
else
{
...
...
@@ -210,7 +210,7 @@
//左侧输入框
leftInput
:
function
(
e
)
{
if
(
this
.
currenItem
[
'watemark
_t
ext'
])
{
if
(
this
.
currenItem
[
'watemark
T
ext'
])
{
this
.
showTipLeft
=
false
}
...
...
@@ -218,7 +218,7 @@
//右侧输入框
rightInput
:
function
(
e
)
{
if
(
this
.
currenItem
[
'watemark
_v
alue'
])
{
if
(
this
.
currenItem
[
'watemark
V
alue'
])
{
this
.
showTipRight
=
false
}
},
...
...
@@ -227,8 +227,8 @@
popCancelClick
:
function
()
{
this
.
isPopShow
=
false
this
.
currenItem
=
{
'watemark
_t
ext'
:
''
,
'watemark
_v
alue'
:
''
'watemark
T
ext'
:
''
,
'watemark
V
alue'
:
''
}
},
...
...
@@ -239,22 +239,22 @@
//自定义弹窗 保存
popSaveClick
:
function
()
{
if
(
this
.
currenItem
[
'watemark
_text'
]
&&
this
.
currenItem
[
'watemark_v
alue'
])
{
if
(
this
.
currenItem
[
'watemark
Text'
]
&&
this
.
currenItem
[
'watemarkV
alue'
])
{
this
.
isPopShow
=
false
if
(
this
.
currenItem
.
type
===
'title_text'
)
{
this
.
result
[
'lower
_right'
][
'title_text'
]
=
this
.
currenItem
[
'watemark_v
alue'
]
this
.
result
[
'lower
Left'
][
'title'
]
=
this
.
currenItem
[
'watemarkV
alue'
]
}
else
{
this
.
editingItem
[
'watemark
_text'
]
=
this
.
currenItem
[
'watemark_t
ext'
]
this
.
editingItem
[
'watemark
_value'
]
=
this
.
currenItem
[
'watemark_v
alue'
]
this
.
editingItem
[
'watemark
Text'
]
=
this
.
currenItem
[
'watemarkT
ext'
]
this
.
editingItem
[
'watemark
Value'
]
=
this
.
currenItem
[
'watemarkV
alue'
]
this
.
editingItem
[
'enable'
]
=
true
}
this
.
saveUserWatermark
()
}
else
{
// 提示
if
(
!
this
.
currenItem
[
'watemark
_t
ext'
])
{
if
(
!
this
.
currenItem
[
'watemark
T
ext'
])
{
this
.
showTipLeft
=
true
}
if
(
!
this
.
currenItem
[
'watemark
_v
alue'
])
{
if
(
!
this
.
currenItem
[
'watemark
V
alue'
])
{
this
.
showTipRight
=
true
}
}
...
...
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