Commit b86e799e authored by 和慭琛's avatar 和慭琛

完工页 照片选取

parent 3adcf201
......@@ -61,6 +61,8 @@
//工单完工
configCompletion:'',
protocolContent:''
},
......@@ -80,6 +82,8 @@
}
})
this.getProtocolContent()
},
onShow: function() {
console.log('App Show')
......@@ -148,13 +152,20 @@
//*/
},
getProtocolContent: function() {
this.protocolContent
},
},
onHide: function() {
console.log('App Hide')
}
},
}
</script>
......
......@@ -6,6 +6,21 @@
*/
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "下单"
}
},
{
"path": "pages/take/finish",
"style": {
"navigationBarTitleText": "完工信息"
}
},
{
"path": "pages/take/index",
"style": {
......@@ -14,22 +29,23 @@
},
{
"path": "pages/index/index",
"path": "pages/index/protocol",
"style": {
"navigationBarTitleText": "下单"
"navigationBarTitleText": "服务协议"
}
},
{
"path": "pages/take/finish",
"path": "pages/take/web",
"style": {
"navigationBarTitleText": "完工信息"
"navigationBarTitleText": "网页"
}
},
{
"path": "pages/take/measure",
"style": {
......
......@@ -193,6 +193,15 @@
//查看历史订单
recordClick: function () {
if(!getApp().globalData.token){
uni.navigateTo({
url: '/pages/login/wxlogin'
})
return
}
uni.navigateTo({
url: '/pages/index/record'
})
......@@ -207,11 +216,20 @@
if(this.isAllInput==false){
uni.showToast({
icon:'none',
title:'请填写所有必填项'
})
return
}
if(this.isAgree==false){
uni.showToast({
icon:'none',
title:'请阅读并同意服务协议'
})
return
}
if(!getApp().globalData.token){
uni.navigateTo({
url:'/pages/login/wxlogin'
......@@ -234,8 +252,7 @@
&& this.address.length>0
&& this.activeProduct.length>0
&& this.activeService.length>0
&& this.demandContent.length>0
&& this.isAgree==true){
&& this.demandContent.length>0){
this.isAllInput = true
}
/*
......@@ -299,11 +316,17 @@
if(res.data.code==200){
uni.showToast({
title:'下单成功'
icon:'none',
title:res.data.message//'下单成功'
})
this.showSubscribeModal()
}else{
uni.showToast({
icon:'none',
title:res.data.message
})
}
......@@ -311,6 +334,7 @@
fail: (e) => {
uni.hideLoading()
uni.showToast({
icon:'none',
title:'下单失败'
})
console.log('客户报单接口 失败')
......
<template>
<view class="">
<text></text>
</view>
</template>
<script>
export default {
data() {
return {
protocolContent:''
}
},
onLoad(e) {
if(e && e.activeService && e.activeService.length>0){
console.log(e.activeService)
this.activeService = e.activeService
}
},
methods: {
//拨打客服 点击
phoneCallClick: function (phone) {
uni.makePhoneCall({
phoneNumber: phone
});
},
}
}
</script>
<style>
</style>
......@@ -60,6 +60,9 @@
<text class="noDataText">暂无数据</text>
</view>
</view>
<view class="bottomView" @click="bottomClick()">
<text class="u-font-28 whiteColor">查看接单列表</text>
</view>
</view>
</template>
......@@ -86,11 +89,34 @@
// })
// return
// }
this.createOrderList()
this.getToken()
},
methods: {
async getToken () {
let that = this
await uni.getStorage({
key: 'token',
success: function (res) {
console.log('本地获取token成功')
console.log(res.data);
getApp().globalData.token = res.data
that.createOrderList()
},
fail() {
uni.navigateTo({
url:'/pages/login/wxlogin'
})
}
})
//await this.getData()
},
//'/wxh-worker-rest/rest/order/revision/applets/'
//+this.globalData.token+'/order/customer'
......@@ -112,6 +138,13 @@
console.log('获取下单列表 成功')
console.log(res)
if(res.statusCode==401){
uni.navigateTo({
url:'/pages/login/wxlogin'
})
return
}
if(res.data.code==200){
console.log('code=200')
//未完工
......@@ -127,7 +160,8 @@
}else{
uni.showToast({
title:res.errMsg
icon:'none',
title:res.data.message
})
......@@ -136,6 +170,10 @@
},
fail: (e) => {
uni.showToast({
icon:'none',
title:'获取下单列表失败'
})
console.log('获取下单列表 失败')
console.log(e)
}
......@@ -167,6 +205,12 @@
},
bottomClick: function (item) {
uni.navigateTo({
url: '/pages/take/index',
})
},
}
}
......@@ -361,5 +405,21 @@
font-size: 28rpx;
}
.bottomView{
background-color: #2272FF;
width: 100%;
height: 104rpx;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
position: fixed;
bottom: 0;
}
.whiteColor{
color: #FFFFFF;
}
</style>
......@@ -144,12 +144,14 @@
if(res.data.data.token){
uni.showToast({
icon:'none',
title:'登陆成功'
})
this.saveUserInfo(res)
}else{
uni.showToast({
icon:'none',
title:'新用户请授权登录'
})
this.isNewUser = true
......@@ -159,7 +161,8 @@
}else{
uni.showToast({
title:res.errMsg
icon:'none',
title:res.data.message
})
......@@ -245,13 +248,15 @@
if(res.data.code==200){
uni.showToast({
title:'登陆成功'
icon:'none',
title:'登录成功'
})
this.saveUserInfo(res)
}else{
uni.showToast({
title:res.errMsg
icon:'none',
title:res.data.message
})
......
......@@ -87,7 +87,7 @@
<text class="u-font-28 gray66">退单</text>
</view>
<view class="bottomRightView" @click="finishClick()">
<text class="bottomTitle whiteColor">完工</text>
<text class="bottomTitle whiteColor">{{bottomTitle}}</text>
</view>
</view>
</view>
......@@ -102,7 +102,8 @@
photoList:[
{image:''},{image:''},{image:''},{image:''},
],
domain_name:''
domain_name:'',
bottomTitle:''
}
},
......@@ -128,6 +129,9 @@
//getApp().globalData.workOrderDetail
//获取工单详情
getOrderDetail: function () {
console.log('获取工单详情:')
console.log(getApp().globalData.domain_Name
+getApp().globalData.workOrderDetail)
uni.request({
url: getApp().globalData.domain_Name
......@@ -142,14 +146,15 @@
if(res.data.code==200){
this.orderInfo = res.data.data
this.setBottomTitle(res)
if(res.data.data.images){
this.adjustPhotoList(res.data.data.images)
}
}else{
uni.showToast({
title:res.errMsg
icon:'none',
title:res.data.message
})
......@@ -164,6 +169,17 @@
})
},
//底部按钮标题
setBottomTitle: function(res){
if (res.data.data.statusText=='待接单'){
this.bottomTitle = '接单'
}else{
this.bottomTitle = '完工'
}
},
//https://system.banshouhui.com/wxh-sts-rest/rest/file/image/order/13767/1442887919988.jpg
adjustPhotoList: function (images) {
var photoArray = images.split(',')
......@@ -210,6 +226,7 @@
if(res.data.code==200){
uni.showToast({
icon:'none',
title:'退单成功',
})
uni.navigateBack({
......@@ -217,6 +234,7 @@
})
}else{
uni.showToast({
icon:'none',
title:res.data.message
})
......@@ -229,6 +247,7 @@
console.log('退单 失败')
console.log(e)
uni.showToast({
icon:'none',
title:'退单失败',
})
}
......@@ -236,7 +255,12 @@
},
finishClick: function () {
if(this.bottomTitle=='接单'){
this.robPost()
return
}
uni.navigateTo({
url: '/pages/take/finish'
+'?orderId='+this.orderId
......@@ -252,6 +276,47 @@
})
},
//抢单请求
////%@/worker/%@/order/%@/accept
robPost: function () {
console.log('抢单请求')
// /wxh-worker-rest/rest/order/revision/applets/{token}/order/acceptAppletsOrder
uni.request({
url: getApp().globalData.domain_Name
+'/wxh-worker-rest/rest/order/revision/applets/'+
getApp().globalData.token
+'/order/acceptAppletsOrder',//%@/worker/%@/order/%@/receive
method: 'POST',
data: {
orderId:this.orderId
},
header:{
'Content-Type': 'application/x-www-form-urlencoded'
},
success: (res) => {
console.log('抢单请求 成功')
console.log(res)
if(res.data.code==200){
}else{
uni.showToast({
icon:'none',
title:res.data.message
})
}
},
fail: (e) => {
console.log('抢单请求 失败')
console.log(e)
}
})
},
}
}
</script>
......
......@@ -61,7 +61,7 @@
<text class="itemTitle bold">{{item.fieldsTitle}}</text>
<text class="itemRedStar" v-if="item.required">*</text>
</view>
<view class="photoBackView u-p-b-30" v-if="item.fieldsValue">
<view class="photoBackView u-p-b-30" v-if="photoList">
<view class="photoItemView" @click="photoClick(item,ikey)" v-for="(item,ikey) in photoList":key="ikey">
<image class="photoImage" :src="item.image" mode="aspectFill"></image>
</view>
......@@ -191,6 +191,7 @@
//照片相关
photoList:[],
photo_fieldsValue:'',
photo_tempFilePaths:[]
}
},
onLoad(e) {
......@@ -215,7 +216,7 @@
getTopInfo: function (e) {
this.icon_arrow_right = getApp().globalData.icon_arrow_right
this.icon_photo_add = getApp().globalData.icon_photo_add
this.photoList = [{image:this.icon_photo_add}]
if(e && e.orderId){
this.orderId = e.orderId
}
......@@ -259,8 +260,8 @@
//测试
/*
getApp().globalData.token = 'RTOKEN9336b56cffb3c2bafec54b3687f86c38bfaa364a'
this.orderId = '10704464'
getApp().globalData.token = 'RTOKENc8a2a8c196ab702b3fb1594647f46737a5332206'
this.orderId = '11877725'
this.categoryId = '88',
this.brandId = '1000000171',
this.partnerCompanyId = '1814',
......@@ -328,7 +329,8 @@
//照片
if(item.fieldsType == 'PHOTOS'){
this.photoList = [{image:'111'},{image:'222'},{image:'333'},{image:'444'}]
//this.photoList = [{image:this.icon_photo_add},{image:'222'},{image:'333'},{image:'444'}]
// console.log('处理前 的 照片数组:')
// console.log(item.fieldsValue)
// var photoList = [{image:'111'},{image:'222'},{image:'333'},{image:'444'}]
......@@ -584,7 +586,8 @@
this.is_PRODUCT_NUMBER_picker_show = true
}else{
uni.showToast({
title:res.errMsg
icon:'none',
title:res.data.message
})
......@@ -663,6 +666,7 @@
if(this.current_SPECIFICATIONS_specificationId.length==0){
uni.showToast({
icon:'none',
title:'请先选择产品规格'
})
return
......@@ -737,7 +741,114 @@
},
//照片 点击
photoClick: function (item,ikey) {
console.log('照片点击')
console.log(ikey)
if(ikey == 0){
this.addPhoto()
}
},
//照片 添加
addPhoto: function (){
let that = this
uni.chooseImage({
count: 9,
sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['album'], //从相册选择
success: function (res) {
console.log('照片添加成功')
that.getImageInfo(res)
},
error : function(e){
uni.showToast({
icon: "none",
title: '选取照片失败'
})
}
})
},
//获取照片信息
getImageInfo: function(res) {
this.photo_tempFilePaths = res.tempFilePaths
let that = this
const tempFilePaths = res.tempFilePaths;
//官方仅支持单张获取 循环多张获取
for(let i = 0;i < tempFilePaths.length; i++) {
uni.getImageInfo({
src: res.tempFilePaths[0],
success: function (image) {
console.log('获取照片信息 成功:')
console.log(image.width);
console.log(image.height);
console.log(image.path);
console.log(image.orientation);
console.log(image.type);
var imageDic = {image:image.path}
that.photoList.push(imageDic)
}
});
}
},
//照片上传
photoUpload: function(res){
let that = this
const tempFilePaths = res.tempFilePaths;
//官方仅支持单张上传 循环多张上传
for(let i = 0;i < tempFilePaths.length; i++) {
uni.showLoading({
mask: true,
title: '上传中'
});
//http://system.banshouhui.com/wxh-worker-rest/rest/RTOKEN01d7a2f3de4f86313745d71f2c1be73b8bae7850/order/11885888/guarantee/image
uni.uploadFile({
url : getApp().globalData.domain_Name
+'/wxh-worker-rest/rest/'+getApp().globalData.token
+/order/+this.orderId
+'/guarantee/image',
filePath: tempFilePaths[i],
name: 'yore'+i,
formData: {
//'qiniutoken': resToken.data.token
},
success: function (uploadFileRes) {
console.log('照片上传成功')
console.log(uploadFileRes)
uni.hideLoading();
// let upRes = JSON.parse(uploadFileRes.data);
// var photo = {
// image:upRes.data.fullurl,
// }
// that.photoList.push(photo)
},
fail() {
console.log('照片上传失败')
}
});
}
},
//输入类 事件处理
inputTypeInput: function (e,item,ikey) {
......@@ -842,10 +953,7 @@
},
photoClick: function (item,ikey) {
console.log('照片点击')
console.log(ikey)
},
confirmClick: function () {
console.log('确认完工 点击')
......
......@@ -6,7 +6,7 @@
<view class="activeItemBottom" v-if="activeTop == 0"></view>
</view>
<view class="topItemView" @click="topClick(1)">
<text :class="activeTop == 1 ? 'activeItemText' : 'topItemText' ">全部未完工</text>
<text :class="activeTop == 1 ? 'activeItemText' : 'topItemText' ">{{currentOrderTypeTitle}} ▼</text>
<view class="activeItemBottom" v-if="activeTop == 1"></view>
</view>
<view class="topItemView" @click="topClick(2)">
......@@ -78,7 +78,17 @@
<text class="noDataText">暂无数据</text>
</view>
</view>
<w-picker
:visible.sync="isOrderTypeShow"
mode="selector"
value=""
default-type="label"
:default-props="orderType_defaultProps"
:options="orderTypeList"
@confirm="orderTypeOnConfirm($event,'selector')"
@cancel="orderTypeOnCancel"
ref="selector"
></w-picker>
</view>
......@@ -104,33 +114,25 @@
icon_noData:'',
grabList:[],
unfinishList:[],
finishList:[
/*{
allocateWorkerDatetime: null,
appointmentDatetime: null,
appointmentType: "未预约",
brandName: "小米",
categoryName: "开水机",
contactAddress: "1",
contactMobilephone: "13631612077",
contactName: "郭小清",
createDatetime: 1607308416000,
guaranteeExplain: null,
images: null,
inGuaranteePeriod: true,
inGuaranteePeriodText: "保内",
maintainWorkerName: null,
maintainWorkerPhone: null,
orderFinishDatetime: null,
orderId: 10704469,
orderServiceType: "维修",
orderTypeText: "抢单工单",
serviceContent: "1",
status: 5,
statusText: "待接单",
userType: "师傅用户",
}*/
finishList:[],
isOrderTypeShow:false,
result:{
result:""
},
orderType_defaultProps:{
label:"title",
value:"type"
},
orderTypeList:[
{title:'全部',type:0},
{title:'待接单',type:1},
{title:'今日预约',type:2},
{title:'明日预约',type:3},
{title:'未预约',type:4},
//{title:'已完成',type:5},
],
currentOrderType: 0,
currentOrderTypeTitle:'全部'
}
},
......@@ -166,6 +168,7 @@
methods: {
async getToken () {
let that = this
await uni.getStorage({
key: 'token',
success: function (res) {
......@@ -173,12 +176,55 @@
console.log(res.data);
getApp().globalData.token = res.data
this.getData()
that.getData()
},
fail() {
uni.navigateTo({
url:'/pages/login/wxlogin'
})
}
})
//await this.getData()
},
topClick: function (active) {
if(this.activeTop!=active){
this.activeTop = active
//中间未完工
if(active == 1){
this.isOrderTypeShow = true
}
this.getData()
}else if(active == 1){
this.isOrderTypeShow = true
}
},
//工单类型切换 确认选择
orderTypeOnConfirm(res,type){
this.result=res;
console.log('工单类型切换 确认选择')
console.log(res.result)
console.log(res.value)
this.currentOrderTypeTitle = res.result
this.currentOrderType = res.value
this.getData()
},
//产品规格 取消选择
orderTypeOnCancel(){
console.log('工单类型切换 取消选择')
},
//获取数据
getData: function () {
......@@ -195,7 +241,7 @@
//全部未完工
if(this.activeTop==1){
//0 全部
this.getOrderList(0)
this.getOrderList(this.currentOrderType)
}
//已完工
......@@ -240,7 +286,8 @@
this.grabList = res.data.data
}else{
uni.showToast({
title:res.errMsg
icon:'none',
title:res.data.message
})
......@@ -280,7 +327,8 @@
}else{
uni.showToast({
title:res.errMsg
icon:'none',
title:res.data.message
})
......@@ -289,18 +337,17 @@
},
fail: (e) => {
uni.showToast({
icon:'none',
title:'获取工单列表失败'
})
console.log('获取工单列表 失败')
console.log(e)
}
})
},
topClick: function (active) {
if(this.activeTop!=active){
this.activeTop = active
this.getData()
}
},
bookClick: function (item) {
console.log(item.address)
......@@ -407,6 +454,7 @@
if(res.statusCode==200){
uni.showToast({
icon:'none',
title:'预约成功'
})
that.getOrderList(0)
......
......@@ -135,7 +135,8 @@
}else{
uni.showToast({
title:res.errMsg
icon:'none',
title:res.data.message
})
......@@ -180,7 +181,8 @@
}else{
uni.showToast({
title:res.errMsg
icon:'none',
title:res.data.message
})
......@@ -223,7 +225,8 @@
}else{
uni.showToast({
title:res.errMsg
icon:'none',
title:res.data.message
})
......@@ -265,6 +268,7 @@
if(res.statusCode==200){
uni.showToast({
icon:'none',
title:'请求成功'
})
......@@ -272,7 +276,8 @@
}else{
uni.showToast({
title:res.errMsg
icon:'none',
title:res.data.message
})
......
......@@ -80,7 +80,8 @@
this.orderInfo = res.data.data
}else{
uni.showToast({
title:res.errMsg
icon:'none',
title:res.data.message
})
......@@ -119,7 +120,8 @@
this.checkShowModal(res.data.data)
}else{
uni.showToast({
title:res.errMsg
icon:'none',
title:res.data.message
})
......@@ -248,7 +250,8 @@
}else{
uni.showToast({
title:res.errMsg
icon:'none',
title:res.data.message
})
......
<template>
<view class="">
网页
</view>
</template>
<script>
</script>
<style>
</style>
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