Commit 6ff2ff4b authored by Morson's avatar Morson

Merge branch 'master' of https://git.banshouhui.com/lijundan/self-support

# Conflicts:
#	src/pages.json
#	src/pages/order/search.vue
parents 88759a5d 91ac0bb6
......@@ -68,6 +68,7 @@ export default {
currentItem: null, // 选择的某一项
setting: null, //自定义设置
waterSetting: null, // 水印设置
allImages: [],
tempPath: {
origin: '', // 缓存拍照图片
mixWater: '' // 缓存水印拍照图片
......
......@@ -8,9 +8,9 @@ let orderApiFun = function(vm){
let listOrderCount = async (params = {}) => await vm.$u.get('/wxh-worker-rest/rest/'+ vm.vuex_token+'/order/queryOrdersCount/V2', params);
/**
* 工单列表接口 http://apidoc.banshouhui.com:3000/mock/31/wxh-worker-rest/rest/order/revision/{token}/list
* 工单列表接口 wxh-worker-rest/rest/order/revision/{token}/list
*/
let listOrder = async (params = {}) => await vm.$u.get('/wxh-worker-rest/rest/'+ vm.vuex_token+'/order/revision/list', params);
let listOrder = async (params = {}) => await vm.$u.get('/wxh-worker-rest/rest/order/revision/'+ vm.vuex_token+'/list', params);
/**
* 获取师傅的预约日历
......
This diff is collapsed.
......@@ -58,14 +58,14 @@ const install = (Vue, vm) => {
return config;
}
function getCode(res){
const result = res.data
let code
if(res.hasOwnProperty('statusCode')){
code = res.statusCode
}else if(result.hasOwnProperty('code')){
code = result.code
}
return code
// const result = res.data || res
// let code
// if(result.hasOwnProperty('statusCode')){
// code = res.statusCode
// }else if(result.hasOwnProperty('code')){
// code = result.code
// }
return res.statusCode || res.code || res.data.statusCode || res.data.code
}
function getMsg(res){
res = res.data || res
......
......@@ -51,16 +51,22 @@
</script>
<style lang="scss" scoped>
.list {
display: flex;
.txt {
color: #666;
padding: 10rpx;
&.active {
background-color: red;
color: #fff;
}
display: flex;
flex-wrap: wrap;
.txt{
color:#666;
padding:10rpx 30rpx;
margin: 5rpx;
background: #F4F5F7;
border-radius: 10rpx;
display: flex;
flex-wrap: wrap;
line-height: 50rpx;
max-width: 48%;
&.active{
background-color: #2272FF;
color:#fff;
}
}
}
</style>
<!-- ******************* 文件上传 ******************* -->
<template>
<view class="file-box">
<view class="u-flex" @click="selectUpload">
<!-- <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">
<u-image class="pic" v-for="(item,index) in imgList" width="170rpx" height="170" :src="item.path" :key="index"></u-image>
<!-- <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-popup v-model="maskShow" mode="center" width="500">
<view class="upload-box u-p-30">
<view class="title">请选择图片</view>
<view class="u-flex u-row-between">
<view class="upload-item u-text-center" @click="uploadFile('photo')">
<u-image class="pic" width="170rpx" height="170" src="'https://cdn.uviewui.com/uview/example/fade.jpg"></u-image>
相册
</view>
<view class="upload-item u-text-center" @click="uploadFile">
<u-image class="pic" width="170rpx" height="170" src="'https://cdn.uviewui.com/uview/example/fade.jpg"></u-image>
拍摄
</view>
</view>
</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="170" height="170" :src="item.path" @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" @click="choose">
<u-image class="pic" width="170rpx" height="170" @click="selectUpload" src="https://gitee.com/xuqu/uView/blob/master/static/uview/example/min_button.png"></u-image>
</view>
</u-popup>
<!-- <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>
</template>
......@@ -38,7 +33,15 @@
filters:{},
data() {
return {
maskShow:false
maskShow:false,
list: [
{
text: '相册'
},
{
text: '拍照'
}
]
}
},
computed: {
......@@ -52,6 +55,13 @@
selectUpload(){
// 弹窗展示
this.maskShow = true
},
uploadSelect(index) {
if (index === 0) {
this.uploadFile('photo')
} else {
this.uploadFile()
}
},
async uploadFile(type){
const self = this
......@@ -59,7 +69,9 @@
// 直接打开相册
let config = {
options:{
sourceType:['album'],//['album', 'camera']
sourceType:['album'],//['album', 'camera']
count: 5,
sizeType: ['compressed']
}
}
await this.chooseImage('qiniu',config)
......@@ -73,8 +85,18 @@
const dataValue = []
this.imgList.map(item=>{
dataValue.push(item.key)
})
})
console.log(this.imgList)
this.valueChange(dataValue)
},
prviewImage(url, index) {
uni.previewImage({
urls: [url],
current: index
});
},
delFile(index) {
this.imgList.splice(index, 1)
}
}
}
......@@ -86,7 +108,43 @@
&:nth-child(3n){
margin-right: 0;
}
}
}
.img-list {
position: relative;
margin: 8rpx;
border: 1px solid #eee;
width: 170rpx;
height: 170rpx;
.icon-del-box {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
align-items: center;
justify-content: center;
position: absolute;
top: 10rpx;
right: 10rpx;
height: 40rpx;
width: 40rpx;
border-radius: 50%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 2;
transform: rotate(-45deg);
}
.icon-del {
width: 30rpx;
height: 4rpx;
background-color: #fff;
border-radius: 2px;
}
.rotate {
position: absolute;
transform: rotate(90deg);
}
}
// .list {
// display: flex;
......
<!-- ******************* 输入框 ******************* -->
<template>
<view>
<u-input v-model="dataValue" @input="valueChange" :type="type" />
<u-input :type="type" class="input-item" v-model="dataValue" @input="valueChange" :border="true" placeholder="请输入" />
</view>
</template>
......@@ -16,8 +16,9 @@
return {}
},
computed: {
type() {
if (this.item && this.item.fieldsType == 'password') {
type() {
console.log(this.item)
if (this.item && this.item.fieldsType == 'password' || this.item.fieldsType == 'textarea') {
return this.item.fieldsType
} else {
return 'text'
......@@ -30,5 +31,8 @@
}
</script>
<style>
<style scoped>
.input-item{
background: #F4F5F7;
}
</style>
<!-- ******************* 定位 ******************* -->
<template>
<view class="list u-flex u-row-between">
<text class="required" v-if="item.required">*</text>
<view class="u-m-r-20">{{item.fieldsTitle}}</view>
<view class="u-flex-1">{{valueTxt || ''}}</view>
<u-button type="primary" size="mini" @click="$u.debounce(getLocation,1000)">默认按钮</u-button>
<template>
<view>
<view class="list u-flex u-row-between">
<image class="item-image" :src="mixingImage" v-if="item.required"></image>
<view class="u-m-r-20">{{item.fieldsTitle}}</view>
<!-- <u-button type="primary" size="mini" @click="$u.debounce(getLocation,1000)">自动定位</u-button> -->
<view class="u-flex-1 location-name">
<u-icon name="map" color="#2979ff" size="30"></u-icon>自动定位
</view>
</view>
<view class="u-flex-1 location">{{valueTxt || '正在获取中...'}}</view>
</view>
</template>
......@@ -23,14 +28,19 @@
valueTxt() {
let str = ''
const dataValue = this.dataValue
if(dataValue && dataValue.length>1){
if(dataValue && dataValue.length>1){
str = '经度:'+dataValue[0]+','+'维度:'+dataValue[1]
}
return str
},
mixingImage() {
return process.uniEnv.qn_base_url + 'mixing.png'
}
},
watch: {},
mounted() {},
created() {
this.getLocation()
},
methods: {
getLocation() {
let self = this
......@@ -59,5 +69,18 @@
font-size: 28rpx;
line-height: 40rpx;
color: #fa3534;
}
.item-image {
width: 24rpx;
height: 24rpx;
margin-right: 10rpx;
}
.location-name {
color: #2272FF;
text-align: right;
}
.location {
background: #F4F5F7;
padding: 10rpx;
}
</style>
<!-- ******************* 多个输入框 ******************* -->
<template>
<view class="u-flex u-flex-wrap">
<u-input class="input-item" v-for="(item,index) in inputOptions" v-model="item.value" @input="val=>{getValue(item)}" type="text" :key="index"/>
<u-input class="input-item" v-for="(item,index) in inputOptions" v-model="item.value" @input="val=>{getValue(item)}" type="text" :key="index" :border="true" :placeholder="item.placeholder" />
</view>
</template>
......@@ -40,8 +40,10 @@
}
</script>
<style>
<style scoped>
.input-item{
width:33.3%;
width: 31%;
margin: 5rpx;
background: #F4F5F7;
}
</style>
......@@ -17,7 +17,7 @@
return {}
},
computed: {
settings(){
settings(){
return this.item.settings || []
}
},
......@@ -33,14 +33,23 @@
</script>
<style lang="scss" scoped>
.list{
display: flex;
.txt{
color:#666;
padding:10rpx;
&.active{
background-color: red;
color:#fff;
}
display: flex;
flex-wrap: wrap;
.txt{
color:#666;
padding:10rpx 30rpx;
margin: 5rpx;
background: #F4F5F7;
border-radius: 10rpx;
display: flex;
flex-wrap: wrap;
line-height: 50rpx;
text-align: center;
max-width: 48%;
&.active{
background-color: #2272FF;
color:#fff;
}
}
}
</style>
<!-- ******************* 扫码 ******************* -->
<template>
<view class="">
<view class="u-flex">
请输入:<u-input class="u-flex-1" v-model="dataValue" @input="valueChange" type="text" />
<view class="">
<view class="u-flex" @click="scanCode">
<view class="txt u-flex-1">扫描二维码(仅挚达充电桩可扫描)</view>
<u-icon name="arrow-right" color="#666" size="28"></u-icon>
</view>
<view class="u-flex" @click="scanCode">
<view class="txt u-flex-1">扫描二维码(仅挚达充电桩可扫描)</view>
<u-icon name="arrow-right" color="#666" size="28"></u-icon>
<view class="u-flex">
<u-input class="u-flex-1 input-item" v-model="dataValue" @input="valueChange" type="text" />
</view>
</view>
</template>
<script>
......@@ -62,5 +61,8 @@
font-size: 28rpx;
line-height: 40rpx;
color: #fa3534;
}
.input-item{
background: #F4F5F7;
}
</style>
......@@ -29,7 +29,8 @@
fileMaps: [],
keys: [],
token: '',
product: '',
product: '',
allImages: []
}
},
created(e) {
......@@ -37,10 +38,10 @@
console.log(getApp().globalData.photo.currentItem)
const product = app.globalData.photo.product
this.product = `?brandId=${product.brandId}&brand=${product.brandName}&classifyId=${product.classifyId}&systemId=${product.systemId}`
// if(app.globalData.photo.currentItem) {
// // 获取规格Id
// this.standardId = app.globalData.photo.currentItem._id
// }
if(app.globalData.photo.currentItem) {
// 获取规格Id
this.standardId = app.globalData.photo.currentItem._id
}
getApp().trackPage('照片预览页')
const globalTempPath = getApp().globalData.photo.tempPath
......@@ -50,7 +51,6 @@
// if(e.standardId) {
// this.standardId = e.standardId
// }
console.log(this.files)
this.token = getApp().globalData.token
},
methods: {
......@@ -73,7 +73,8 @@
title: '已将照片原图保存到本地相册'
})
}
}
}
photo.allImages.unshift(photo.tempPath.mixWater)
if(photo.currentItem){
photo.currentItem.imageList.unshift(photo.tempPath.mixWater)
}
......@@ -137,9 +138,8 @@
self.saveTempToLocal()
self.confirmUpload(true)
},
submitFile() {
submitFile() {
let self = this
if(self.keys.length) {
for (let s of self.keys) {
self.$u.api.saveImage({
......@@ -150,7 +150,7 @@
console.log(res, "云服务保存图片");
if(res.result.code) {
// TODO 参数是否要来回传递
const photo = getApp().globalData.photo
const photo = getApp().globalData.photo
photo.currentItemLength = photo.currentItemLength + 1
uni.hideLoading()
// 当前项的图片显示
......
......@@ -122,7 +122,7 @@
getApp().trackPage('水印设置页')
const globalData = getApp().globalData
this.icon_close_new = globalData.icon_close_new
this.systemId = globalData.photo.product.systemId
this.systemId = globalData.photo.currentItem.systemId
this.getItemList()
},
methods: {
......
......@@ -7,7 +7,7 @@
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 @click="changeType(3)" class="icon" mode="aspectFit"
<cover-image v-if="currentItem.system_id" @click="changeType(3)" class="icon" mode="aspectFit"
src="/static/photo/icon-setting.png"></cover-image>
</cover-view>
</cover-view>
......@@ -38,7 +38,7 @@
</view>
</view>
</view>
<photo-preview v-if="showType === 2" @changeType="changeType" @finish="goBack" />
<photo-preview v-if="showType === 2" @changeType="changeType" @finish="finish" />
<photo-setting v-if="showType === 3" @changeType="changeType" />
</view>
</template>
......@@ -57,16 +57,15 @@
import setting from '@/components/photo/setting.vue'
export default {
props: {
currentItem: { // 拍照要求,示意图,system_id, standardId
type: Object,
currentItem: { // 对应的规范item
default () {
return {
images: [
'https://qn-static.banshouhui.com/live_mark.png',
'https://qn-static.banshouhui.com/live_mark.png',
'https://qn-static.banshouhui.com/live_mark.png'
],
main_point: []
_id: '', // 规格ID
system_id: '', // 系统ID
brand_id: '', // 品牌ID
classify_id: '', // 分类ID
images: [], // 拍照要求示意图
main_point: [] // 要点
}
}
}
......@@ -109,16 +108,17 @@
shadowInitShow: true, // 第一次进入页面需显示弹窗
}
},
created(e) {
created(e) {
const photo = getApp().globalData.photo
getApp().trackPage('拍照页')
getApp().trackPage('拍照页')
photo.allImages = []
// this.ctx = uni.createCameraContext();
this.updateTime()
this.getLocation()
this.getMarkPath()
this.initData()
//this.currentItem = photo.currentItem
photo.currentItem = this.currentItem
},
computed: {
titleTxt() {
......@@ -178,6 +178,11 @@
goBack() {
uni.showTabBar()
this.$emit('close')
},
finish() {
uni.showTabBar()
const photo = getApp().globalData.photo
this.$emit('close', photo.allImages)
},
changeType(type) {
this.showType = type
......
## 相机组件使用说明
```
该组件仅用于拍照后返回图片,与业务不关联,目前最多一次可以拍10张图片
```
### 因为相机组件需要全屏展示,所以加载该组件需要在当前页面隐藏顶部导航栏和底部的TabBar
```
uni.hideTabBar()
```
### 然后加上自定义导航栏,通过切换状态takeStatus来显示和隐藏
```
<u-navbar v-if="!takeStatus" :is-back="false" :title-size="26" title-color="#000" title="我的"></u-navbar>
```
## API
### Props
| 属性名 | 类型 | 默认值 | 可选值 | 说明 |
| :-: | :-: | :-: | :-: | :-: |
| currentItem | Object | - | - | 对应的规范数据,用于获取示意图和水印,以及保存图片所需的ID **格式见下文** |
### currentItem 格式
```json
{
_id: '', // 保存图片时需要
system_id: '', // 获取水印列表需要
images: [ // 拍照示意图
'https://qn-static.banshouhui.com/live_mark.png',
'https://qn-static.banshouhui.com/live_mark.png',
'https://qn-static.banshouhui.com/live_mark.png'
],
main_point: [] // 拍照要求
... // 列表其他字段也可传进来,可能会用到
}
```
### Events
|事件称名 |说明 | 返回值 |
|:-: |:-: | :-: |
|@close | 关闭相机或完成拍照的时候触发 | 已拍照完成的图片数组|
## 组件用法
### 基础用法
```html
<u-navbar v-if="!takeStatus" :is-back="false" :title-size="26" title-color="#000" title="我的"></u-navbar>
<view @click="take">打开相机</view>
<take-photo v-if="takeStatus" :currentItem="testData" @close="closeTake"></take-photo>
```
```javascript
import takePhoto from '@/components/take/index.vue'
export default {
components: {
'take-photo': takePhoto
},
data() {
return {
takeStatus: false,
testData: {}
}
},
methods:{
// 打开相机
take() {
uni.hideTabBar() // 打开时隐藏TabBar
this.takeStatus = true
},
// 拍照完成或关闭相机
closeTake(images) {
console.log(images)
this.takeStatus = false
}
}
}
```
\ No newline at end of file
......@@ -25,7 +25,9 @@
{
"path": "pages/order/complete",
"style": {
"navigationBarTitleText": "订单-完工配置"
"navigationBarTitleText": "订单-完工配置",
"navigationBarBackgroundColor": "#2272FF",
"navigationBarTextStyle": "white"
}
},{
"path": "pages/order/feedback",
......@@ -206,15 +208,63 @@
"navigationStyle": "custom"// 隐藏系统导航栏
}
}
},
{
"path": "pages/photo/index",
"style": {
"navigationBarTitleText": "拍照小工具",
"navigationBarBackgroundColor":"#FFFFFF",
"backgroundColor":"#F4F5F7"
}
},
{
"path": "pages/photo/setting",
"style": {
"navigationBarTitleText": "水印设置",
"navigationBarBackgroundColor":"#FFFFFF",
"backgroundColor":"#F4F5F7"
// "navigationBarBackgroundColor": "#333333",
// "navigationBarTextStyle": "#FFFFFF",
// "disableScroll": true
}
},
{
"path": "pages/photo/take",
"style": {
"navigationStyle":"custom",
"navigationBarTitleText": "拍照",
"navigationBarBackgroundColor": "#333333",
"navigationBarTextStyle": "#FFFFFF",
"disableScroll": true
}
},
{
"path": "pages/photo/preview",
"style": {
"navigationBarTitleText": "照片预览",
"navigationBarBackgroundColor":"#333333",
"backgroundColor":"#FFFFFF",
"navigationBarTextStyle":"white"
}
},
{
"path": "pages/photo/list",
"style": {
"navigationBarTitleText": "规范展示",
"navigationBarBackgroundColor":"#FFFFFF",
"backgroundColor":"#F4F5F7"
}
}
,{
"path" : "pages/order/search",
"style" :
{
"navigationBarTitleText": "",
"navigationBarBackgroundColor": "#F4F5F7",
"enablePullDownRefresh": false
}
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false,
"navigationBarBackgroundColor":"#F4F5F7"
}
}
],
......@@ -269,6 +319,11 @@
"path": "pages/order/index", //启动页面,必选
"query": "" //启动参数,在页面的onLoad函数里面得到
},
{
"name": "拍照小工具", //模式名称
"path": "pages/photo/index", //启动页面,必选
"query": "" //启动参数,在页面的onLoad函数里面得到
},
{
"name": "工单搜索",
"path": "pages/order/search",
......
......@@ -162,7 +162,9 @@
}
};
await app.getBaseInfo(self, callBack);
this.orderList = []
this.messageList = []
// 加载消息列表
self.loadMessageList();
self.loadOrderList();
......@@ -184,7 +186,6 @@
},
loadOrderList() {
console.log('-----------准备加载推荐列表-----------')
return
let self = this;
// 加载订单列表
self.search.token = self.vuex_token;
......@@ -192,7 +193,7 @@
uni.stopPullDownRefresh() // 结束下拉刷新
if (res.code == 200) {
if (res.data && res.data.length > 0) {
self.orderList.push().apply(res.data);
self.orderList.push(...res.data);
}
} else {
console.log(res.message, "初始化订单列表异常");
......
......@@ -31,7 +31,7 @@
</u-cell-group>
</view>
</view>
<take-photo type="test" v-if="takeStatus" @close="closeTake"></take-photo>
<take-photo v-if="takeStatus" :currentItem="testData" @close="closeTake"></take-photo>
</view>
</template>
......@@ -45,7 +45,19 @@
return {
pic:'https://uviewui.com/common/logo.png',
show:true,
takeStatus: false
takeStatus: false,
testData: {
_id: '1', // 规格ID
system_id: '2', // 系统ID
brand_id: '3', // 品牌ID
classify_id: '4', // 分类ID
images: [ // 拍照要求示意图
'https://qn-static.banshouhui.com/live_mark.png',
'https://qn-static.banshouhui.com/live_mark.png',
'https://qn-static.banshouhui.com/live_mark.png'
],
main_point: [] // 要点
}
}
},
computed: {
......@@ -68,7 +80,8 @@
uni.hideTabBar()
this.takeStatus = true
},
closeTake() {
closeTake(img) {
console.log(img)
this.takeStatus = false
}
}
......
<template>
<view class="u-wrap">
<view class="u-search-box">
<view class="u-search-inner">
<u-icon name="search" color="#909399" :size="28"></u-icon>
<text class="u-search-text">搜索</text>
</view>
</view>
<u-tabs-swiper ref="tabs" :current="tabIndex" :list="list" :is-scroll="false" bg-color="#2272FF" inactive-color="#a6c6ff" active-color="#fff" height="120"></u-tabs-swiper>
<view class="u-menu-wrap">
<scroll-view scroll-y scroll-with-animation class="u-tab-view menu-scroll-view" :scroll-top="scrollTop"
:scroll-into-view="itemId">
......@@ -23,9 +18,10 @@
<view class="title">{{groupItem.groupName}}</view>
<view class="class-bd">
<u-form-item v-for="(item,itemIndex) in groupItem.item" :key="itemIndex"
label-position="top" :prop="item.fieldsName">
label-position="top" :prop="item.fieldsName" :border-bottom="false">
<view class="label" v-if="item.fieldsType!=='location'">
<text class="required" v-if="item.required">*</text>
<!-- <text class="required" v-if="item.required">*</text> -->
<image class="item-image" :src="mixingImage" v-if="item.required"></image>
{{item.fieldsTitle}}
</view>
<template v-if="item.fieldsType">
......@@ -95,7 +91,19 @@
// import XhRadio from '@/components/createCom/XhRadio.vue'
export default {
data() {
return {
return {
list: [
{
name: '基础信息'
},
{
name: '勘察信息'
},
{
name: '安装信息'
}
],
tabIndex: 0,
scrollTop: 0, //tab标题的滚动条位置
oldScrollTop: 0,
current: 0, // 预设当前项的值
......@@ -163,7 +171,12 @@
this.getMenuItemTop()
},
updated() {
console.log(this.form.name, 'form.name')
//console.log(this.form.name, 'form.name')
},
computed: {
mixingImage() {
return process.uniEnv.qn_base_url + 'mixing.png'
}
},
methods: {
// 字段的值更新
......@@ -193,7 +206,7 @@
// 将fieldType类型统一转换为公共组件判定类型
let formType = ''
type = type.toLocaleLowerCase()
console.log(type,'type')
//console.log(type,'type')
switch (type) {
case 'text':
case 'password':
......@@ -206,6 +219,9 @@
break;
case 'select':
formType = 'select'
break
case 'radio':
formType = 'radio'
break
case 'checkbox':
formType = 'checkbox'
......@@ -226,11 +242,11 @@
case 'time':
formType = 'time'
break
// case 'file':
// formType = 'XhFiles'
// break
case 'file':
formType = 'XhFiles'
break
}
console.log(formType,'formType')
//console.log(formType,'formType')
return formType
},
// ------------------------- 以下方法为展示滚动切换 -------------------------
......@@ -355,7 +371,14 @@
}
}
.class-item {
.class-item {
padding: 50rpx;
.title {
font-weight: bold;
font-size: 32rpx;
line-height: 32rpx;
color: #333;
}
.label {
color: #333;
font-size: 28rpx;
......@@ -367,6 +390,12 @@
font-size: 28rpx;
line-height: 40rpx;
color: #fa3534;
}
.item-image {
width: 24rpx;
height: 24rpx;
margin-right: 10rpx;
}
}
......@@ -426,20 +455,20 @@
.u-tab-item-active {
position: relative;
color: #000;
color: #2272FF;
font-size: 30rpx;
font-weight: 600;
background: #fff;
}
.u-tab-item-active::before {
content: "";
position: absolute;
border-left: 4px solid $u-type-primary;
height: 32rpx;
left: 0;
top: 39rpx;
}
// .u-tab-item-active::before {
// content: "";
// position: absolute;
// border-left: 4px solid $u-type-primary;
// height: 32rpx;
// left: 0;
// top: 39rpx;
// }
.u-tab-view {
height: 100%;
......
......@@ -79,34 +79,49 @@
<!-- 过程反馈 -->
<view class="left">
<view v-show="allowFeedback" @click="clickFeedback" class="button">
<text style="font-size: small;">过程反馈</text>
过程反馈
</view>
</view>
<!--接单,抢单,已被抢, 预约 ,签到 ,去完工 :class="appoint-btn" v-show="buttonShow(btn)"-->
<!--接单,抢单,已被抢, 预约 ,签到 ,去完工 timestampDiff(order.currentOverTime)>0 -->
<view class="center">
<view>
<u-toast ref="uToast" />
</view>
<view v-if="showCenterBtn" @click="handleBtn" class="button" :class="centerButtonClass">
<view v-if="showCenterBtn" @click="handleBtn" class="button" :class="btnClass">
{{ centerButtonText }}
</view>
<view v-show="order.currentOverTime > 0" >
<view class="tag">{{order.currentOverTime * 1000 > new Date().getTime()?'剩':'超'}}</view>
<u-count-down
:timestamp="timestampDiff(order.currentOverTime)"
font-size="30"
:ref="'uCountDown'"
@change="timeOutChange(order.currentOverTime)" >
</u-count-down>
</view>
</view>
<!-- 异常预约 ,现场拍照 这里是调用拍照的两个组件-->
<view class="right">
<view v-show="allowFeedback" @click="clickFeedback" class="button"></view>
<view v-if="errorSignIn" @click="take" class="button">
<text>异常签到</text>
</view>
<view v-if="scenePhoto" @click="scenePhotoClick" class="button">
<text>现场拍照</text>
</view>
</view>
</view>
<take-photo type="test" v-if="takeStatus" @close="closeTake"></take-photo>
</view>
</template>
<script>
import appointTime from '@/components/appoint/appoint-time.vue'
import {
getQueryString
} from '@/common/util.js'
import takePhoto from '@/components/take/index.vue'
export default {
components: {
appointTime
appointTime,
'take-photo': takePhoto
},
data() {
return {
......@@ -127,10 +142,14 @@
centerButtonText: '',
orderRecords: [],
method: null,
allowFeedbackStatus: [30, 31], // 过程反馈状态列表
showCenterBtn: false,
showTimeSelect: false,
submitType: ""
submitType: '',
nextUrl:'',
btnClass:'appoint-btn',
takeStatus:false,
errorSignIn:false,
scenePhoto: false
}
},
onLoad(option) {
......@@ -143,8 +162,8 @@
}
this.loadOrderDetail()
this.loadOrderRecord()
this.getLocation()
},
created(option) {},
computed: {
phoneIcon() {
return process.uniEnv.qn_base_url + 'icon/dianhua-1@2x.png'
......@@ -158,6 +177,21 @@
}
},
methods: {
scenePhotoClick() { // 跳转拍照小程序
uni.navigateTo({
url: 'pages/photo/list?orderId='+this.order.orderId+'&brandId='+this.order.lianbaoBrandId+'&brand='+this.order.brandName
+'&systemId='+this.order.partnerCompanyId+'&classifyId='+this.order.categoryId
})
},
take() {
uni.hideTabBar()
this.takeStatus = true
},
closeTake() {
this.takeStatus = false
// 获取返回的图片 ,如果返回的图片存在则直接异常签约,成功后跳转到去完工页面,
},
loadOrderDetail() { // 获取工单详情
let self = this
let timestamp = new Date().getTime();
......@@ -176,7 +210,6 @@
// self.method =self.operationDoing[self.order.operationType].action;
// // 根据工单的状态确定是否需要过程反馈
// self.allowFeedback = self.allowFeedbackStatus.indexOf(self.order.orderStatus)>0
} else {
console.log(res.message, "获取订单详情失败!");
}
......@@ -189,7 +222,6 @@
};
self.$u.api.listOrderRecord(param).then((res) => {
if (res.code == 200) {
console.log("===========", res.data)
self.orderRecords = res.data
} else {
console.log(res.message, "获取订单详情失败!");
......@@ -231,11 +263,13 @@
this.centerButtonText = "接单"
// 已派单的时显示拒单按钮
this.allowRejection = true
this.submitType = "orderAccept"
} else if (orderStatus < 31 && orderBusinessType === '订单池') {
// 抢单
this.centerButton = "appoint1"
this.centerButtonText = "抢单"
this.showCenterBtn = true
this.submitType = "orderGan"
} else if (orderStatus === 31 && !this.order.appointmentDatetime) {
// 预约
this.centerButton = "appoint2"
......@@ -251,40 +285,142 @@
this.allowFeedback = true
this.showCenterBtn = true
this.submitType = "maintainWorkerCheckin"
this.errorSignIn = true
} else if (orderStatus > 31 && orderStatus < 80) {
// 完工
this.centerButton = "appoint4"
this.centerButton = "filish"
this.centerButtonText = "去完工"
this.allowFeedback = true
this.showCenterBtn = true
this.scenePhoto = true
} else {}
},
handleBtn() {
if(this.centerButton === "filish"){
this.filish()
return
}
if(!this.submitType){
return;
}
const data = {}
// 不同请求类型传递不同数据
if (this.submitType === 'maintainWorkerCheckin') {
if (this.submitType === 'maintainWorkerCheckin') { // 签到
// 检查见到距离是否符合
if(this.getDistance(this.order.contactAddressLatitud,this.order.contactAddressLongitud)>3){
this.$refs.uToast.show({
title: '签到失败,请点击异常签到处理或联系客服',
type: 'error'
})
return
}
data.remark = "123"
data.revert = true
}else if(this.submitType === 'orderAccept'){ // 接单
data.orderId = this.order.orderId
}else if(this.submitType === 'orderGan'){ // 抢单
data.orderId = this.order.orderId
}
this.$u.api[this.submitType](data, 123).then(res => {
if (res.data.code === 200) {
this.$u.api[this.submitType](data, this.order.orderId).then(res => {
if ((res.data.code!==undefined && res.data.code === 200)
|| (res.code!==undefined && res.code === 200) ) {
this.$refs.uToast.show({
title: this.centerButtonText + '操作成功',
type: 'success',
url: 'pages/order/feedback',
url: 'pages/order/detail',
params: {
id: 1,
menu: 3
menu: 2
}
})
} else {
this.$refs.uToast.show({
title: res.data.message,
title: res.data.message!==undefined ? res.data.message:res.message,
// 如果不传此type参数,默认为default,也可以手动写上 type: 'default'
type: 'error'
type: 'error',
callback: res.data.message==='该工单已被抢'?this.isGan():''
})
}
})
},
isGan(){
this.centerButtonText = "已被抢"
this.submitType = ""
this.btnClass='isGan-btn'
},
clickFeedback(){
// 过程反馈
uni.navigateTo({
url: 'pages/order/feedback?orderId='+this.order.orderId
})
},
filish(){
// 去完工
uni.navigateTo({
url: 'pages/order/complete?orderId='+this.order.orderId
})
},
/**
* 获取当前位置的经纬度
*/
getLocation() {
let self = this
const dataValue = this.dataValue || []
const waterInfo = this.waterInfo
uni.getLocation({
type: 'gcj02',
success: function(res) {
dataValue.push(res.longitude)
dataValue.push(res.latitude)
self.dataValue = dataValue
},
fail(err) {
}
});
},
getDistance(Latitud, Longitud){
return this.distance(Latitud,Longitud,this.dataValue[0],this.dataValue[1])
},
/**
* 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(la1, lo1, la2, lo2) {
var La1 = la1 * Math.PI / 180.0;
var La2 = la2 * Math.PI / 180.0;
var La3 = La1 - La2;
var Lb3 = lo1 * Math.PI / 180.0 - lo2 * Math.PI / 180.0;
var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(La3 / 2), 2),Math.cos(La1) * Math.cos(La2) * Math.pow(Math.sin(Lb3 / 2), 2)));
s = s * 6378.137;//地球半径
s = Math.round(s * 10000) / 10000;
// console.log("计算结果",s,'KM');
return s?s.toFixed(2):0;
},
timestampDiff(currentOverTime){ // 计算超时时间
if(!currentOverTime){
return 0
}
var nowTime = new Date(); // 当前时间
if(nowTime.getTime() > currentOverTime*1000){
var diff = nowTime.getTime() - (currentOverTime*1000);
}else{
var diff = (currentOverTime*1000) - nowTime.getTime();
}
return diff;
},
timeOutChange(currentOverTime){
let self = this
var nowTime = new Date(); // 当前时间
if(nowTime.getTime() > currentOverTime*1000){
this.btnClass='timeOut-btn'
self.$refs['uCountDown'].seconds += 2
}
}
}
};
......@@ -451,6 +587,10 @@
height: 100rpx;
background: #929CB8;
border-radius: 100rpx;
font-size: 25rpx;
font-weight: bold;
align-items: center;
display: flex;
}
}
......@@ -477,13 +617,13 @@
box-shadow: 2px 2px 20px 0px rgba(34, 114, 255, 0.3);
}
.sign-timeout-btn {
background: #FA5A49;
.isGan-btn {
background: #93a7a6;
box-shadow: 2px 2px 20px 0px rgba(34, 114, 255, 0.3);
}
.appoint-btn {
background: #2272FF;
.timeOut-btn {
background: #ff0000;
box-shadow: 2px 2px 20px 0px rgba(34, 114, 255, 0.3);
}
}
......@@ -495,8 +635,12 @@
.button {
width: 100rpx;
height: 100rpx;
background: #12CF84;
background: #d99100;
border-radius: 100rpx;
font-size: 25rpx;
font-weight: bold;
align-items: center;
display: flex;
}
}
}
......
......@@ -4,33 +4,31 @@
<view class="tools-box">
<view class="search-sub">
<u-subsection :current="curNow" :list="subList" active-color="white" bg-color="white"
inactive-color="#666" button-color="#2272FF" border-radius="36" @change="sectionChange">
inactive-color="#666" button-color="#2272FF" border-radius="36" @change="sectionChange" height="72"
bold>
</u-subsection>
</view>
<view class="search-btn">
<u-icon name="search" color="#666" size="32"></u-icon>
<view class="search-btn" @click="handleClickSearch">
<image class="search-image" mode="widthFix" :src="sousuoImage"></image>
<text class="search-btn-text">搜订单</text>
</view>
</view>
<view class="u-tabs-box" v-show="curNow == 0">
<u-tabs-swiper activeColor="#2272FF" bg-color="none" inactive-color="#999" bar-height="4" bar-width="44"
:offset="[-1,10]" ref="tabs" :list="list" count="total" :current="current" @change="change"
:is-scroll="false" swiperWidth="750"></u-tabs-swiper>
<u-tabs height="66" activeColor="#2272FF" bg-color="none" inactive-color="#999" bar-height="4" bar-width="44"
:offset="[0,0]" :list="list" count="total" :current="current" @change="change"
:is-scroll="false" font-size="28" bold></u-tabs>
</view>
<swiper class="swiper-box" :current="swiperCurrent" @transition="transition"
@animationfinish="animationfinish">
<swiper-item class="swiper-item" v-for="(res, ind) in orderList" :key="ind">
<view class="tab-view">
<!-- <swiper-item class="swiper-item" v-for="(res, ind) in orderList" :key="ind"> -->
<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom" scroll-anchoring>
<view class="page-box">
<view v-for="(item, index) in res" :key="item.orderId">
<view v-for="(item, index) in orderList" :key="item.orderId">
<OrderCell :orderData="item" :orderType="orderType" :location="dataValue"
@click="handleClick(item)" @action="handleAction(item)"> </OrderCell>
</view>
<u-loadmore :status="loadStatus[ind]" bgColor="#F4F5F7"></u-loadmore>
</view>
<u-loadmore :status="loadStatus" bgColor="#F4F5F7"></u-loadmore>
</scroll-view>
</swiper-item>
</swiper>
<!-- </swiper-item> -->
</view>
<!-- </view> -->
</TabBarPage>
......@@ -48,8 +46,6 @@
return {
showSview: true,
curNow: 0,
timestamp: 1000,
triggered: false,
pageNumber: 0,
pageSize: 10,
//waitAccept、waitAppointment、waitCheckIn、waitFinish、exception、finish
......@@ -61,8 +57,7 @@
4: 'exception',
5: 'finish'
},
orderList: [[],[],[],[],[],[]],
dataList: [],
orderList: [],
list: [{
name: '待预约',
total: 0,
......@@ -85,12 +80,8 @@
}
],
current: 0,
swiperCurrent: 0,
tabsHeight: 0,
dx: 0,
loadStatus: ['loading','loading','loading','loading','loading','loading'],
loadStatus: 'loading',
dataValue: [],
total: 0
};
},
onLoad() {
......@@ -107,22 +98,26 @@
return this.currentIndex + 1
},
currentIndex() {
return this.curNow == 0 ? this.swiperCurrent : 5
return this.curNow == 0 ? this.current : 5
},
sousuoImage() {
return process.uniEnv.qn_base_url + 'sousuo.png'
}
},
methods: {
sectionChange(index) {
this.curNow = index;
this.pageNumber = 0
if (index === 1) {
this.showSview = false
// 加载已完工的数据
this.getOrderList(5)
} else {
this.showSview = true
// 加载已完工的数据
this.getOrderList(0)
}
this.pageNumber = 0
this.orderList = []
this.loadStatus = 'loading'
this.getOrderList(index === 0 ? 0 : 5)
},
// tab栏切换
change(index) {
this.current = index;
this.orderList = []
this.loadStatus = 'loading'
this.getOrderList(index);
},
/**
* 获取当前位置的经纬度
......@@ -145,10 +140,8 @@
},
reachBottom(e) {
console.log(e)
console.log(this.loadStatus[this.currentIndex])
if (this.loadStatus[this.currentIndex] != 'loadmore') return
this.loadStatus[this.currentIndex] == 'loading'
if (this.loadStatus != 'loadmore') return
this.loadStatus == 'loading'
this.getOrderList(this.currentIndex)
},
// 页面数据
......@@ -196,11 +189,11 @@
...res.data.list,...res.data.list,...res.data.list,...res.data.list,...res.data.list,...res.data.list]
/*↑↑↑↑↑↑↑↑↑↑测试数据↑↑↑↑↑↑↑↑↑↑↑↑↑*/
// 后台需要返回order_type,防止数据返回延迟期间点击了其他的tab
// 后台需要返回orderType,防止数据返回延迟期间点击了其他的tab
if (res.data) {
self.orderList[res.data.orderType].push(...res.data.list)
self.orderList.push(...res.data.list)
self.list[res.data.orderType].total = res.data.total
self.loadStatus[res.data.orderType] = res.data.total > self.orderList[res.data.orderType].length ? 'loadmore' : 'nomore'
self.loadStatus = res.data.total > self.orderList.length ? 'loadmore' : 'nomore'
}
} else {
console.log(res.message, "获取订单数量失败!");
......@@ -235,27 +228,6 @@
}
});
},
// tab栏切换
change(index) {
this.swiperCurrent = index;
this.getOrderList(index);
},
transition({
detail: {
dx
}
}) {
this.$refs.tabs.setDx(dx);
},
animationfinish({
detail: {
current
}
}) {
this.$refs.tabs.setFinishCurrent(current);
this.swiperCurrent = current;
this.current = current;
},
viewOderItem(orderId) { // 跳转工单详情页面
uni.navigateTo({
url: 'pages/order/detail?id=' + orderId
......@@ -268,6 +240,11 @@
handleAction(item) {
console.log('click button')
this.viewOderItem(item.orderId)
},
handleClickSearch() {
uni.navigateTo({
url: 'pages/order/search'
})
}
}
};
......@@ -453,24 +430,30 @@
flex-direction: column;
height: calc(100vh - var(--window-top));
width: 100%;
}
.tab-view {
height: 100%;
overflow: auto;
padding-bottom: 20rpx;
}
.swiper-box {
flex: 1;
}
// .swiper-box {
// flex: 1;
// }
.swiper-item {
height: 100%;
.page-box {
padding-bottom: 20rpx;
}
}
// .swiper-item {
// height: 100%;
// .page-box {
// padding-bottom: 20rpx;
// }
// }
.tools-box {
display: flex;
flex-direction: row;
justify-content: space-between;
padding: 20rpx 0rpx 18rpx 0rpx;
padding-bottom: 20rpx;
.search-sub {
height: 72rpx;
......@@ -484,10 +467,14 @@
border-radius: 36rpx;
color: #666666;
display: flex;
flex-direction: row;
justify-content: space-around;
justify-content: center;
align-items: center;
.search-image {
width: 36rpx;
height: 32rpx;
flex-shrink: 0;
margin-right: 20rpx;
}
.search-btn-text {
line-height: 36rpx;
font-weight: 400;
......
<template>
<view class="backView">
<view class="ph-pr-arr" v-for="(dataItem, index) in list" :key="index">
<template v-if="dataItem.data.length > 0">
<view class="topTitle"><text>{{ dataItem.title }}</text></view>
<view class="ph-pr-content">
<view v-for="(item,ikey) in dataItem.data"
:class="param[dataItem.type] === item.id ? 'select-item-view' : 'item-view'"
@click="itemClick(dataItem.type, item, ikey)" :key="item.id">
<text class="itemTitle">{{item.name}}</text>
</view>
</view>
</template>
</view>
<u-button class="ph-pr-button" type="primary" shape="circle" @click="handleClick"
:hover-class="selectedAll ? '' : 'none'" :custom-style="buttonStyle">下一步</u-button>
</view>
</template>
<script>
export default {
data() {
return {
classifyList: [],
systemList: [],
brandList: [],
param: {
classifyId: '',
systemId: '',
brandId: '',
},
brandName: '',
selectedAll: false,
}
},
computed: {
list() {
return [{
title: '请选择类别',
type: 'classifyId',
data: this.classifyList
},
{
title: '请选择系统',
type: 'systemId',
data: this.systemList
},
{
title: '请选择品牌',
type: 'brandId',
data: this.brandList
}
]
},
buttonStyle() {
return this.selectedAll ? {
'color': '#FFFFFF',
'background-color': '#2272FF;',
'width': '600rpx',
'height': '104rpx'
} : {
'color': '#FFFFFF',
'background-color': '#D1D4D4;',
'width': '600rpx',
'height': '104rpx'
}
}
},
onLoad(e) {
getApp().trackPage('选择产品页')
this.getRelationDictionaryV2()
},
onShareAppMessage(res) {
let shareObj = {
title: '',
path: '/pages/photo/product',
imageUrl: '',
success() {},
fail() {}
}
return shareObj
},
methods: {
getRelationDictionaryV2: function() {
this.$u.cloudApi.getRelationDictionaryV2().then(res => {
if (res && res.result) {
this.classifyList = res.result
this.param.classifyId = res.result[0].id
this.systemList = res.result[0].child
}
})
},
//选择 点击
itemClick: function(type, item, ikey) {
switch (type) {
case 'classifyId':
this.param = {
classifyId: item.id,
systemId: '',
brandId: ''
}
this.selectedAll = false
this.systemList = this.classifyList[ikey].child
this.brandList = []
break
case 'systemId':
this.param = {
classifyId: this.param.classifyId,
systemId: item.id,
brandId: ''
}
this.selectedAll = false
this.brandList = this.systemList[ikey].child
break
case 'brandId':
this.param.brandId = item.id
this.selectedAll = true
this.brandName = item.name
break
default:
break
}
},
// 点击下一步
handleClick() {
// 点击下一步设置全局拍照品牌品类
if (!this.selectedAll) {
return
}
const globalData = getApp().globalData
// if (!globalData.token) {
// uni.navigateTo({
// url: '/pages/login/wxlogin'
// })
// return
// }
let keys = ['brandId', 'brandName', 'classifyId', 'systemId']
keys.map(key => {
globalData.photo.product[key] = this[key] || this.param[key]
})
uni.navigateTo({
url: '/pages/photo/list' +
'?brandId=' + this.param.brandId +
'&brand=' + this.brandName +
'&classifyId=' + this.param.classifyId +
'&systemId=' + this.param.systemId,
})
}
}
}
</script>
<style>
.backView {
background-color: #F4f5f7;
position: absolute;
top: 0;
left: 0;
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
height: 100%;
}
.topTitle {
margin-top: 50rpx;
padding-left: 30rpx;
font-size: 36rpx;
font-weight: bold;
color: #333333;
}
.ph-pr-content {
display: flex;
flex-wrap: wrap;
justify-content: flex-start;
width: 100%;
padding: 22rpx 22rpx;
}
.ph-pr-arr {
width: 100%;
}
.item-view {
background-color: #FFFFFF;
/* width: 548rpx; */
margin: 0rpx 8rpx 24rpx 8rpx;
/* flex: 1 1 0%;
max-width: 33%; */
width: 222rpx;
height: 76rpx;
display: flex;
align-items: center;
justify-content: center;
border-style: solid;
box-shadow: 0px 2px 7px 0px rgba(0, 0, 0, 0.05);
border-width: 0rpx;
border-radius: 12rpx;
font-size: 26rpx;
color: #666666;
}
.select-item-view {
background-color: #2272FF;
margin: 0rpx 8rpx 24rpx 8rpx;
/* flex: 1 1 0%;
max-width: 33%; */
width: 222rpx;
height: 76rpx;
display: flex;
align-items: center;
justify-content: center;
border-style: solid;
box-shadow: 0px 2px 7px 0px rgba(0, 0, 0, 0.05);
border-width: 0rpx;
border-radius: 12rpx;
font-size: 26rpx;
color: #FFFFFF;
}
.ph-pr-button {
position: absolute;
bottom: 76rpx;
font-size: 32rpx;
}
</style>
<template>
<view class="backView">
<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>
<template v-for="(item,ikey) in rightList">
<view class="rightItemView" @click="rightItemClick(item,ikey)" :key="ikey">
<view :class="['rightContentView', {'active':item.imageList[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.imageList.length > 0">
<image class="rightImage" v-for="(image, index) in item.imageList.slice(0 , 10)" :src="image"
:key="index" @click.stop="handleClickImage(item, index)" mode="aspectFill"></image>
</view>
</view>
</template>
<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>
export default {
data() {
return {
topList: [],
activeTop: 0,
leftList: [],
rightList: [],
classifyId: '',
systemId: '',
brand: '',
brandId: '',
dataList: [],
loading: true,
isPopShow: false
}
},
onLoad(e) {
getApp().trackPage('照片规范列表页')
if (e && e.brandId) {
this.brandId = e.brandId
}
if (e && e.brand) {
this.brand = e.brand
uni.setNavigationBarTitle({
title: this.brand
});
}
if (e && e.systemId) {
this.systemId = e.systemId
}
if (e && e.classifyId) {
this.classifyId = e.classifyId
}
this.getListData()
},
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': getApp().globalData.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)
}
}
})
},
handleData: function(result) {
this.activeTop = 0
const globalData = getApp().globalData
globalData.photo.productList = result
this.dataList = result
if (result.length > 0) {
var item = result[0]
globalData.photo.waterSetting = item.userWatermark
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.imageList,
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': getApp().globalData.token,
}).then(res => {
this.isPopShow = false
if (res && res.result) {
this.getListData()
}
})
}
}
}
</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: 80rpx;
width: 100%;
}
.ph-lst-top-index {
font-size: 26rpx;
font-weight: bold;
color: #FFFFFF;
border-radius: 8rpx;
background-color: #999999;
width: 36rpx;
height: 36rpx;
line-height: 36rpx;
text-align: center;
}
.ph-lst-top-index.active {
background-color: #2272FF;
}
.rightView {
background-color: #F4F5F7;
width: 100%;
display: flex;
flex-direction: column;
padding-top: 100rpx;
padding-bottom: 50rpx;
}
.right-view-title {
font-size: 36rpx;
font-weight: bold;
height: 104rpx;
line-height: 104rpx;
margin-left: 30rpx;
}
.rightItemView {
/* width: 100%; */
/* display: flex; */
/* flex-direction: row; */
/* justify-content: space-between; */
/* border-bottom: 20rpx solid #F3F3F3; */
margin: 0rpx 30rpx 20rpx 30rpx;
padding: 36rpx 30rpx 30rpx 30rpx;
border-radius: 12rpx;
background-color: #FFFFFF;
/* min-height: 108rpx; */
}
.ph-lst-item-index {
font-size: 24rpx;
font-weight: bold;
border-radius: 4rpx;
width: 34rpx;
height: 34rpx;
line-height: 32rpx;
text-align: center;
border-width: 1px;
border-style: solid;
margin-right: 10rpx;
margin-top: 4rpx;
}
.rightContentView {
display: flex;
align-items: flex-start;
width: 100%;
font-size: 30rpx;
color: #2272FF;
/* flex-direction: column; */
/* border-left: 2rpx solid #F3F3F3; */
}
.rightContentView.active {
color: #666666;
border-color: #666666;
}
.ph-list-item-arrow {
position: absolute;
width: 40rpx;
height: 40rpx;
right: 38rpx;
}
.rightContent {
font-size: 30rpx;
color: #333333;
line-height: 40rpx;
}
.rightImageView {
/* width: 300rpx; */
/* height: 320rpx; */
display: flex;
align-items: center;
justify-content: flex-start;
flex-wrap: wrap;
margin-top: 26rpx;
}
.rightImage {
background-color: #F3F3F3;
width: 116rpx;
height: 116rpx;
margin: 0rpx 12rpx 12rpx 0rpx;
}
.rightImage:nth-child(5n) {
margin-right: 0;
}
.topView {
background-color: #FAFAFA;
width: 100%;
height: 100rpx;
position: fixed;
display: flex;
flex-direction: row;
z-index: 1;
}
.topItemView {
/* width: 210rpx; */
height: 100rpx;
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: 36rpx;
font-weight: bold;
padding-left: 30rpx;
}
.greenBackColor {
background-color: #4CD964;
}
.ph-list-pop-text {
color: #666666;
text-align: center;
margin-top: 20rpx;
font-size: 30rpx;
}
.ph-list-pop-title {
font-size: 40rpx;
padding-top: 150rpx;
text-align: center;
color: #333333;
}
.ph-list-pop-btn-view {
display: flex;
justify-content: center;
margin-top: 150rpx;
}
</style>
<template>
<view>
<view class="contentView">
<u-image class="pic" :src="files[0]" bg-color="transparent" @click="showPreviewFn"></u-image>
<!-- <image class="pic" :src="files[0]" v-lazy mode="aspectFit"></image> -->
</view>
<view class="bottomView">
<image class="btn" :src="btn_remake" @click="$u.throttle(remakePhoto, 3000)"></image>
<image class="btn" :src="btn_continue" @click="$u.throttle(continuePhoto, 3000)"></image>
</view>
<image class="btn finish" src="/static/photo/finish.png" @click="$u.throttle(finishPhoto, 3000)"></image>
</view>
</template>
<script>
import qiniup from '@/components/upload/qiniup';
const app = getApp()
export default {
mixins: [qiniup],
data() {
return {
protocolContent: '',
btn_remake: 'https://qn-static.banshouhui.com/take_order/photo/remake.png',
btn_continue: '/static/photo/continue.png',
standardId: '',
images: [],
files: [],
fileMaps: [],
keys: [],
token: '',
product: '',
}
},
onLoad(e) {
// 获取照片选项对象
const product = app.globalData.photo.product
this.product = `?brandId=${product.brandId}&brand=${product.brandName}&classifyId=${product.classifyId}&systemId=${product.systemId}`
if(app.globalData.photo.currentItem) {
// 获取规格Id
this.standardId = app.globalData.photo.currentItem._id
}
getApp().trackPage('照片预览页')
const globalTempPath = getApp().globalData.photo.tempPath
if(globalTempPath && globalTempPath.mixWater){
this.files = [globalTempPath.mixWater]
}
if(e.standardId) {
this.standardId = e.standardId
}
this.token = getApp().globalData.token
},
methods: {
// 保存照片到本地
async saveTempToLocal(tempImagePath) {
//has_origin //是否保存原图
let that = this
const photo = getApp().globalData.photo
if(!photo.tempPath){
return
}
let path = ''
if(photo.tempPath.origin && photo.waterSetting && photo.waterSetting.has_origin){
// 保存原图到本地
path = photo.tempPath.origin
let result = await this.saveLocal(path)
if(result){
uni.showToast({
icon: 'none',
title: '已将照片原图保存到本地相册'
})
}
}
if(photo.currentItem){
photo.currentItem.imageList.unshift(photo.tempPath.mixWater)
}
// if(photo.productList && photo.productList[photo.topIndex]){
// const topArr = photo.productList[photo.topIndex]
// if(topArr[photo.itemIndex]){
// topArr[photo.itemIndex].imageList.push(photo.tempPath.mixWater)
// }
// }
// photo.
if(photo.tempPath.mixWater){
// 保存水印处理图片到本地
path = photo.tempPath.mixWater
let result1 = await this.saveLocal(path)
if(result1){
uni.showToast({
icon: 'none',
title: '已将水印图片保存到本地相册'
})
}
}
},
saveLocal(path){
return new Promise((resolve,reject)=>{
uni.saveImageToPhotosAlbum({
filePath: path,
success() {
resolve(true)
},
fail() {
reject('保存失败')
}
})
})
},
showPreviewFn(img) {
uni.previewImage({
current: 0,
urls: this.files
});
},
// 重拍图片
remakePhoto() {
uni.navigateBack({
delta:1
})
},
finishPhoto(){
const photo = getApp().globalData.photo
photo.currentItemLength = 10
this.continuePhoto()
// 完成本项
// uni.navigateBack({
// delta:2
// })
},
// 确认图片
continuePhoto() {
let self = this
uni.showLoading({
title:'图片保存中…'
})
self.saveTempToLocal()
self.confirmUpload(true)
},
submitFile() {
let self = this
if(self.keys.length) {
for (let s of self.keys) {
self.$u.cloudApi.saveImage({
"token": self.token,
"standardId": self.standardId,
"url": s,
}).then(async res =>{
console.log(res, "云服务保存图片");
if(res.result.code) {
// TODO 参数是否要来回传递
const photo = getApp().globalData.photo
photo.currentItemLength = photo.currentItemLength + 1
uni.hideLoading()
// 当前项的图片显示
// 拍照项张数目增加 等于10张
if(photo.currentItemLength<10){
uni.navigateBack({
delta:1
})
}else{
uni.navigateBack({
delta:2
})
}
// let timer = setTimeout(()=>{
// if(photo.currentItemLength<10){
// uni.navigateBack({
// delta:1
// })
// }else{
// uni.navigateBack({
// delta:2
// })
// }
// },2000)
} else {
uni.showToast({
title:'图片上传失败 '+ res.result.msg
})
}
})
}
}
},
downloadImages() {
let self = this;
for (let url of this.images) {
uni.downloadFile({
url: url, //仅为示例,并非真实的资源
success(res) {
// 只要服务器有响应数据,就会把响应内容写入文件并进入 success 回调,业务需要自行判断是否下载到了想要的内容
if (res.statusCode === 200) {
self.files.push(res.tempFilePath)
}
},
fail(e) {
debugger
}
})
}
},
}
}
</script>
<style lang="scss">
.contentView {
background-color: #333333;
/* padding-top: 120rpx; */
padding-bottom:228rpx;
height: 100vh;
display: flex;
flex-direction: column;
}
/deep/ .u-image{
height:100%!important;
}
/deep/ .u-image__loading{
background-color: transparent!important;
}
/deep/ .u-image__error{
background-color: transparent!important;
}
.pic {
flex:1;
width: 100%;
/* height:auto */
/* height: 760rpx; */
}
.bottomView {
box-shadow: 0 0 1rpx 6rpx rgba(255,255,255,0.05);
background-color: #333333;
width: 100%;
padding:70rpx 0;
position: fixed;
bottom: 0;
display: flex;
justify-content: space-around;
align-items: center;
.btn{
display: block;
width: 200rpx;
height: 88rpx;
}
}
.btn{
display: block;
width: 232rpx;
height: 80rpx;
&.finish{
position: fixed;
top:30rpx;
right:30rpx;
}
}
</style>
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment