Commit c1743b6b authored by 刘用法's avatar 刘用法
parents 3d99afba ee3fb5c7
import util from '@/utils/util.js'
const jsonType = {'content-type': 'application/json'}
const formType = {'content-type': 'application/x-www-form-urlencoded'}
const dataType = {'content-type': 'multipart/form-data'}
let orderApiFun = function(vm){
// 接口公共前缀
......@@ -47,7 +48,7 @@ let orderApiFun = function(vm){
let traceAndAppointment = async (params = {}, orderId) => await vm.$u.post('/wxh-worker-rest/rest/order/traceAndAppointment/trace/V2/' + vm.vuex_token + `/`+orderId, params)
/* 师傅拒单 */
let rejectOrder = async (params = {}, orderId) => await vm.$u.get(prefix + vm.vuex_token + `/order/${orderId}/workerReject/V2`, params)
let rejectOrder = async (params = {}, orderId) => await vm.$u.post(prefix + vm.vuex_token + `/order/${orderId}/workerReject/V2`, params, formType)
/**
......@@ -161,7 +162,7 @@ let orderApiFun = function(vm){
// 获取我的钱包-支付单一览
let payableRecord = async (params = {}) => await vm.$u.post(settle + vm.vuex_token + '/payable/v2/queryPayableRecord', params, formType);
// 获取我的钱包-师傅提现
let workerApplyPay = async (payableId) => await vm.$u.post(`/wxh-worker-rest/rest/${vm.vuex_token}/applypay/${payableId}/workerApplyPay`);
let workerApplyPay = async (payableId) => await vm.$u.post(`/wxh-worker-rest/rest/${vm.vuex_token}/applypay/${payableId}/workerApplyPay`, {}, dataType);
const orderApi = {
listByRecommendOrder,
......
......@@ -2,50 +2,6 @@ import {apiFun} from '@/common/api/index.js';
import {
cloudRulesApiFun
} from "@/common/api/cloud_rules.js"
// const upload = async function(path, params = {}, vm) {
// return new Promise((resolve, reject) => {
// uni.showLoading({
// mask: true,
// title: '上传中'
// });
// let data = {
// url: vm.vuex_config.upload.uploadurl,
// filePath: path,
// header: {
// token: vm.vuex_token || '',
// uid: vm.vuex_user.id || 0
// },
// name: 'file',
// fileType:'image',
// complete: function() {
// uni.hideLoading();
// },
// success: uploadFileRes => {
// try {
// var res = uploadFileRes.data;
// if (vm.$u.test.jsonString(res)) {
// resolve(JSON.parse(res).data)
// }
// if (vm.$u.test.object(res)) {
// resolve(res.data)
// }
// } catch (e) {
// reject(uploadFileRes.data);
// }
// },
// fail: (e) => {
// reject(e);
// }
// };
// let isObj = vm.$u.test.object(vm.vuex_config.upload.multipart);
// if (isObj) {
// data.formData = vm.vuex_config.upload.multipart;
// }
// uni.uploadFile(data);
// })
// }
const install = (Vue, vm) => {
let apiUrls = apiFun(vm)
......
......@@ -20,7 +20,7 @@
</view>
<u-action-sheet :list="list" v-model="maskShow" :cancel-btn="true" @click="uploadSelect"></u-action-sheet>
</view>
<take-photo v-if="takeStatus" @close="closeTake" :currentItem="currentItemDate"></take-photo>
<take-photo v-if="takeStatus" @close="closeTake" :upload="false" :currentItem="currentItemDate"></take-photo>
</view>
</template>
......@@ -28,6 +28,8 @@
import arrMixin from './arrMixin'
import baseFile from '@/components/upload/index';
import takePhoto from '@/components/take/index.vue'
import uploader from '@/plugins/uploader/index.js'
export default {
name: 'XhFiles',
components: {
......@@ -132,10 +134,30 @@
val.forEach(item=>{
this.imgList.push(item)
})
this.setValue()
const files = val.map(v => {
return { path: v.path }
})
this.uploadTakeImg(files)
// this.setValue()
}
this.takeStatus = false
},
uploadTakeImg(files) {
const options = {
files:files, // 必填 临时文件路径 格式: [{path: "图片地址"}]
load: false, //(默认 true 说明:本接口是否提示加载动画)
maxSize: 300000, //(默认 无 说明:上传的文件最大字节数限制,默认不限制)
onEachUpdate: res => {
console.log("上传成功返回:",res);
const value = [uploader.qiniuTokenObj.visitPrefix + res.url]
this.valueChange(value)
},
Update: res => {
console.log("上传进度返回:",res);
}
}
uploader.qnFileUpload(options)
},
prviewImage(item, index) {
uni.previewImage({
urls: [item.path ? item.path : item.src],
......
......@@ -216,7 +216,6 @@
}
},
created() {
console.log('+++++++++++')
/*
orderStatus:
待接单 orderStatus<31 工单状态小于31
......@@ -252,7 +251,6 @@
}
this.timeout = this.orderData.currentOverTime < new Date().getTime()
this.timestamp = Math.round(Math.abs(this.orderData.currentOverTime - new Date().getTime()) / 1000)
console.log('++++++', this.timestamp)
},
methods: {
handleClick() {
......
......@@ -17,7 +17,14 @@
import qiniup from '@/components/upload/qiniup';
const app = getApp()
export default {
props: {},
props: {
upload: { // 是否默认上传 true:会自动上传好图片并返回绝对路径 false: 只返回临时路径,需要在父组件做上传动作
type: Boolean,
default () {
return true
}
}
},
mixins: [qiniup],
data() {
return {
......@@ -128,7 +135,13 @@
title:'图片保存中…'
})
self.saveTempToLocal()
self.confirmUpload(true)
if (this.upload) {
self.confirmUpload(true)
} else {
this.submitFile()
}
},
submitFile() {
const photo = getApp().globalData.photo
......@@ -138,8 +151,9 @@
// 拍照项张数目增加 等于10张
photo.allImages.unshift(
{
key: photo.tempPath.mixWater,
src: this.fileMaps[0].key
path: photo.tempPath.mixWater,
src: photo.tempPath.mixWater,
key: this.fileMaps[0] ? this.fileMaps[0].key : '',
}
)
if(photo.currentItemLength<10){
......
......@@ -38,7 +38,7 @@
</view>
</view>
</view>
<photo-preview v-if="showType === 2" @changeType="changeType" @finish="finish" />
<photo-preview v-if="showType === 2" @changeType="changeType" @finish="finish" :upload="upload" />
<photo-setting v-if="showType === 3" @changeType="changeType" @changeWatermark="changeWatermark"/>
</view>
</template>
......@@ -65,6 +65,12 @@
main_point: [] // 要点
}
}
},
upload: { // 是否默认上传 true:会自动上传好图片并返回绝对路径 false: 只返回临时路径,需要在父组件做上传动作
type: Boolean,
default () {
return true
}
}
},
components: {
......@@ -103,7 +109,7 @@
cameraChange: false,
waterSetting: null,
shadowInitShow: false, // 第一次进入页面需显示弹窗
standardStatus: false // 是否显示拍照要求
standardStatus: false, // 是否显示拍照要求
}
},
created(e) {
......
## 相机组件使用说明
```
该组件仅用于拍照后返回图片,与业务不关联,目前最多一次可以拍10张图片
```
该组件仅用于拍照后返回图片,与业务不关联,目前最多一次可以拍10张图片
```
### 因为相机组件需要全屏展示,所以加载该组件需要在当前页面隐藏顶部导航栏,底部的TabBar以及其他页面元素
### 因为相机组件需要全屏展示,所以加载该组件需要在当前页面隐藏顶部导航栏,底部的TabBar
```
uni.hideTabBar()
```
......@@ -15,33 +15,34 @@ uni.hideTabBar()
## API
### Props
| 属性名 | 类型 | 默认值 | 可选值 | 说明 |
| :-: | :-: | :-: | :-: | :-: |
| 属性名 | 类型 | 默认值 | 可选值 | 说明 |
| :-: | :-: | :-: | :-: | :-: |
| update | Boolean | true | true/false | 是否默认上传 true:会自动上传好图片并返回绝对路径 false: 只返回临时路径,需要在父组件做上传动作 |
| currentItem | Object | - | - | 对应的规范数据,用于获取示意图和水印,以及保存图片所需的ID **格式见下文** |
### currentItem 格式
```json
### 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'
'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 | 关闭相机或完成拍照的时候触发 | 已拍照完成的图片数组 **格式见下文** |
### Events
|事件称名 |说明 | 返回值 |
|:-: |:-: | :-: |
|@close | 关闭相机或完成拍照的时候触发 | 已拍照完成的图片数组 **格式见下文** |
```json
```json
{
[
{
......@@ -51,32 +52,32 @@ uni.hideTabBar()
src: 'wxfile://tmp_2324.png' // 微信临时文件地址
}
]
}
}
```
## 组件用法
## 组件用法
### 基础用法
```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>
```
<view @click="take">打开相机</view>
<take-photo v-if="takeStatus" :currentItem="testData" @close="closeTake"></take-photo>
```
```javascript
import takePhoto from '@/components/take/index.vue'
import takePhoto from '@/components/take/index.vue'
export default {
components: {
'take-photo': takePhoto
},
data() {
return {
data() {
return {
takeStatus: false,
testData: {}
}
},
testData: {}
}
},
methods:{
// 打开相机
// 打开相机
take() {
uni.hideTabBar() // 打开时隐藏TabBar
this.takeStatus = true
......@@ -85,8 +86,8 @@ export default {
closeTake(images) {
console.log(images)
this.takeStatus = false
}
}
}
}
}
}
```
\ No newline at end of file
......@@ -185,11 +185,9 @@
this.initSettleInfo();
},
handleClick(orderId) { // 点击了cell
console.log('点击了cell')
this.viewOderItem(orderId)
},
handleAction(orderId) { // 点击了按钮
console.log('点击了按钮')
this.viewOderItem(orderId)
},
viewOderItem(orderId) { // 跳转工单详情页面
......@@ -333,7 +331,6 @@
var self = this; // 加载订单列表
self.$u.api.listOrderCount().then((res) => {
if (res.code == 200) {
console.log("===", res.data)
if (res.data) {
var count = 0
for (var i in res.data) {
......
......@@ -202,7 +202,6 @@
},
reachBottom(e) {
console.log('-------底部-------', this.loadStatus)
if (this.loadStatus != 'loadmore') return
this.loadStatus == 'loading'
this.getOrderList(this.currentIndex)
......@@ -247,7 +246,6 @@
var self = this; // 加载订单列表
self.$u.api.listOrderCount().then((res) => {
if (res.code == 200) {
console.log("===", res.data)
if (res.data) {
self.list.forEach(item => {
if (item.name === '待预约') {
......@@ -293,7 +291,6 @@
this.filish(item)
return
}
console.log('click cell')
this.viewOderItem(item.orderId)
},
filish(item){
......@@ -307,7 +304,6 @@
})
},
handleAction(item) {
console.log('click button')
if(item.orderStatus===86 || item.orderStatus===88){
this.filish(item)
return
......
......@@ -264,12 +264,6 @@
if (res.code == 200) {
self.list = res.data.config
self.form = res.data.value || {}
uni.showLoading({
title: '加载中'
})
setTimeout(() => {
uni.hideLoading()
}, 1000)
// 异常单处理
if (self.auditResultsId) self.checkCompleteError()
} else {
......
......@@ -237,7 +237,6 @@
},
onLoad(option) {
// 生命周期函数--监听页面加载
console.log("option", option)
if (option && option.id) {
this.orderId = option.id
}
......@@ -306,7 +305,6 @@
// }
// ,
// complete: function(res) {
// console.log('-------complete-----', res)
// if (res.errMsg.indexOf('auth') != -1) {
// uni.showModal({
// title: '提示',
......@@ -348,13 +346,7 @@
let self = this
var data={}
if(this.submitType === "workerAppointment"){
self.$u.api.contactTime(data,this.order.orderId).then((res)=>{
if (res.code == 200) {
console.log("===", res.data)
} else {
console.log(res.message);
}
})
self.$u.api.contactTime(data,this.order.orderId)
}
},
handleClickRight(active) {
......@@ -371,7 +363,6 @@
this.takeStatus = true
},
closeTake(img) {
console.log("image",img)
this.takeStatus = false
// 获取返回的图片 ,如果返回的图片存在则直接异常签约,成功后跳转到去完工页面,
if(img){ // 拍照完成
......@@ -444,7 +435,6 @@
},
weekChange(data){
// 点击下一周
console.log(data,'week-data')
if (data && data.time) {
let num = data.num
let time = data.time
......@@ -486,7 +476,6 @@
},
dateChange(data){
// 点击日期选择
console.log(data,'dateChange')
let self = this
self.appointmentDatetime = data.item.day
self.dateItem = data.item
......@@ -501,7 +490,6 @@
},
timeChange(data){
// 时间段选择变化
console.log(data,'timeChange')
this.appointmentDatetimeRange = data.item
},
addressToCoordinate(){
......@@ -756,7 +744,6 @@
if(!currentOverTime){
return 0
}
console.log('--------', Math.round(Math.abs(this.order.currentOverTime - new Date().getTime()) / 1000))
return Math.round(Math.abs(this.order.currentOverTime - new Date().getTime()) / 1000);
},
timeOutChange(currentOverTime){
......
......@@ -50,7 +50,7 @@
rejectReason: '',
remark: ''
},
count: 3, // 剩余次数
count: 0, // 剩余次数
};
},
computed: {
......@@ -62,15 +62,15 @@
PopView
},
onLoad(e) {
if(e) {
if(e.orderId) {
this.orderId = e.orderId
} else if(e.count) {
if(e && e.orderId) {
this.orderId = e.orderId
if(e.count) {
this.count = e.count
} else {
this.getRejectCount()
}
}
if(!this.count) {
this.getRejectCount()
} else {
this.$u.toast("本月无拒单机会,请联系客服")
}
},
methods: {
......@@ -116,18 +116,9 @@
let res = await self.$u.api.rejectOrder(self.formData, self.orderId)
self.submiting = false
if(res && res.code == 200) {
let data = res.data
if(data.code == 200) {
uni.showToast({
title: "拒单成功",
})
} else {
let message = '本月无拒单机会,请联系客服'
uni.showToast({
icon: 'none',
title: message,
})
}
uni.showToast({
title: res.message || res.data || '拒单成功',
})
}
},
}
......
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