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

细节优化

parent 66d68266
......@@ -204,6 +204,25 @@ function dianji(fn) {
}
}
//时间戳转换成日期时间
function js_date_time(unixtime) {
var date = new Date(unixtime);
var y = date.getFullYear();
var m = date.getMonth() + 1;
m = m < 10 ? ('0' + m) : m;
var d = date.getDate();
d = d < 10 ? ('0' + d) : d;
var h = date.getHours();
h = h < 10 ? ('0' + h) : h;
var minute = date.getMinutes();
var second = date.getSeconds();
minute = minute < 10 ? ('0' + minute) : minute;
second = second < 10 ? ('0' + second) : second;
// return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + second;//年月日时分秒
return y + '-' + m + '-' + d + ' ' + h + ':' + minute;
}
export {
strlen,
isWeiXinBrowser,
......@@ -219,5 +238,6 @@ export {
getStaticUrl,
getDynamicUrl,
getAskUrl,
dianji
dianji,
js_date_time
}
......@@ -200,7 +200,8 @@
itemClick: function (item) {
uni.navigateTo({
url: '/pages/take/detail'
+'?orderId='+item.orderId,
+'?orderId='+item.orderId
+'&isFromCreate='+true,
})
},
......
......@@ -28,21 +28,22 @@
</view>
<view class="itemView u-m-t-60 u-p-b-40">
<text class="titleText u-m-l-30">下单时间:</text>
<text class="contentText u-m-l-20" v-if="orderInfo.createDatetime">{{orderInfo.createDatetime}}</text>
<text class="contentText u-m-l-20" v-if="orderInfo.createDatetime">{{formatDate(orderInfo.createDatetime)}}</text>
</view>
<view class="divideLine"></view>
</view>
<view class="willTakeView" v-if="orderInfo.statusText == '待接单'">
<view class="itemView u-m-t-50">
<text class="titleText u-m-l-30">预约时间:</text>
<text class="blueContentText underLine u-m-l-20" v-if="!orderInfo.appointmentDatetime">待预约上门服务时间</text>
<text class="blueContentText underLine u-m-l-20" v-if="orderInfo.appointmentDatetime">{{orderInfo.appointmentDatetime}}</text>
<text class="blueContentText u-m-l-20" v-if="!orderInfo.appointmentDatetime">接单后可预约上门服务时间</text>
<text class="blueContentText u-m-l-20" v-if="orderInfo.appointmentDatetime">{{formatDate(orderInfo.appointmentDatetime)}}</text>
</view>
<mx-date-picker :show="showPicker" :type="type" :value="value" :show-tips="true" :begin-text="'入住'" :end-text="'离店'" :show-seconds="true" @confirm="onSelected" @cancel="onSelected" />
</view>
<view class="willFinishView" v-if="orderInfo.statusText == '待完工'">
<view class="itemView u-m-t-50">
<text class="titleText u-m-l-30">预约时间:</text>
<text class="blueContentText underLine u-m-l-20" v-if="orderInfo.appointmentDatetime">{{orderInfo.appointmentDatetime}}</text>
<text class="blueContentText underLine u-m-l-20" v-if="orderInfo.appointmentDatetime">{{formatDate(orderInfo.appointmentDatetime)}}</text>
</view>
<view class="itemView u-m-t-30">
<text class="titleText u-m-l-30">接单师傅:</text>
......@@ -51,7 +52,7 @@
</view>
<view class="itemView u-m-t-30 padding_bottom_130">
<text class="titleText u-m-l-30">接单时间:</text>
<text class="contentText u-m-l-20" v-if="orderInfo.allocateWorkerDatetime">{{orderInfo.allocateWorkerDatetime}}</text>
<text class="contentText u-m-l-20" v-if="orderInfo.allocateWorkerDatetime">{{formatDate(orderInfo.allocateWorkerDatetime)}}</text>
</view>
</view>
<view class="finishView" v-if="orderInfo.statusText == '已完工'">
......@@ -62,12 +63,12 @@
</view>
<view class="itemView u-m-t-30 u-p-b-50">
<text class="titleText u-m-l-30">接单时间:</text>
<text class="contentText u-m-l-20" v-if="orderInfo.allocateWorkerDatetime">{{orderInfo.allocateWorkerDatetime}}</text>
<text class="contentText u-m-l-20" v-if="orderInfo.allocateWorkerDatetime">{{formatDate(orderInfo.allocateWorkerDatetime)}}</text>
</view>
<view class="divideLine"></view>
<view class="itemView u-m-t-50">
<text class="titleText u-m-l-30">完工时间:</text>
<text class="contentText u-m-l-20" v-if="orderInfo.orderFinishDatetime">{{orderInfo.orderFinishDatetime}}</text>
<text class="contentText u-m-l-20" v-if="orderInfo.orderFinishDatetime">{{formatDate(orderInfo.orderFinishDatetime)}}</text>
</view>
<view class="itemView u-m-t-30">
<text class="titleText u-m-l-30">完工凭证:</text>
......@@ -82,7 +83,7 @@
<text class="contentText u-m-l-20" v-if="orderInfo.guaranteeExplain">{{orderInfo.guaranteeExplain}}</text>
</view>
</view>
<view class="bottomView" v-if="orderInfo.statusText != '已完工'">
<view class="bottomView" v-if="orderInfo.statusText != '已完工' && isFromCreate == false">
<view class="bottomLeftView" @click="cancelClick()">
<text class="u-font-28 gray66">退单</text>
</view>
......@@ -90,10 +91,12 @@
<text class="bottomTitle whiteColor">{{bottomTitle}}</text>
</view>
</view>
</view>
</template>
<script>
import MxDatePicker from "@/components/mx-datepicker/mx-datepicker.vue";
export default {
data() {
return {
......@@ -103,7 +106,13 @@
{image:''},{image:''},{image:''},{image:''},
],
domain_name:'',
bottomTitle:''
bottomTitle:'',
isFromCreate:false,
showPicker:false,
date: '2019/01/01',
datetime: '2020/12/05 15:00:12',
type: '',
value: '',
}
},
......@@ -113,6 +122,12 @@
this.orderId = e.orderId
}
if(e && e.isFromCreate){
this.isFromCreate = e.isFromCreate
}
//this.domain_name = getApp().globalData.domain_Name
//this.orderId = '10704466'
//getApp().globalData.token = 'RTOKENc9496ce49b2dc61bbae67968979af4f19e0dfad0'
......@@ -144,6 +159,13 @@
console.log('获取工单详情 成功')
console.log(res)
if(res.statusCode==401){
uni.navigateTo({
url:'/pages/login/wxlogin'
})
return
}
if(res.data.code==200){
this.orderInfo = res.data.data
this.setBottomTitle(res)
......@@ -202,11 +224,86 @@
bookClick: function () {
console.log('预约点击')
this.type = 'datetime'
this.showPicker = true;
this.value = this['datetime'];
},
//时间选择器 选择
onSelected: function (e) {//选择
this.showPicker = false;
if(e) {
this[this.type] = e.value;
this.bookPost(e.value)
//选择的值
console.log('value => '+ e.value);
//原始的Date对象
console.log('date => ' + e.date);
}
},
//预约请求
///wxh-worker-rest/rest/order/traceAndAppointment/traceOrder/RTOKEN16ccb9588e63340a6993b3144423131e2c1e0694/order/11889179
//appointmentDatetime=2020-12-05 11:28&orderDelayReason=&orderTraceRemark=&accessoryApply=false
bookPost: function (dateTime) {
dateTime = dateTime.substr(0,16);
dateTime = dateTime.replace("/","-")
dateTime = dateTime.replace("/","-")
dateTime = dateTime.replace("/","-")
//2020/12/25 15:00:12
console.log('预约请求 dateTime'+dateTime)
let that = this
uni.request({
url: getApp().globalData.domain_Name
+'/wxh-worker-rest/rest/order/traceAndAppointment/traceOrder/'
+getApp().globalData.token
+'/order/'+this.orderId,
method: 'POST',
data: {
appointmentDatetime:dateTime,
orderDelayReason:'',
orderTraceRemark:'',
accessoryApply:false
},
header:{
'Content-Type': 'application/x-www-form-urlencoded',
},
success: (res) => {
console.log('预约请求 成功')
console.log(res)
if(res.statusCode==200){
uni.showToast({
icon:'none',
title:'预约成功'
})
this.getOrderDetail()
}else{
uni.showToast({
icon:'none',
title:res.data
})
}
},
fail: (e) => {
console.log('预约请求 失败')
console.log(e)
}
})
},
cancelClick: function () {
console.log('退单点击')
uni.showLoading({
title:'请稍候'
})
uni.request({
url: getApp().globalData.domain_Name
+'/wxh-worker-rest/rest/'
......@@ -221,6 +318,7 @@
'Content-Type': 'application/x-www-form-urlencoded'
},
success: (res) => {
uni.hideLoading()
console.log('退单 成功')
console.log(res)
......@@ -244,6 +342,7 @@
},
fail: (e) => {
uni.hideLoading()
console.log('退单 失败')
console.log(e)
uni.showToast({
......@@ -278,6 +377,9 @@
//接单请求
acceptPost: function() {
uni.showLoading({
title:'请稍候'
})
uni.request({
url: getApp().globalData.domain_Name
+'/wxh-sts-rest/rest/worker/'+
......@@ -289,13 +391,14 @@
//orderId:this.orderId
},
header:{
//'Content-Type': 'application/x-www-form-urlencoded'
'Content-Type': 'application/x-www-form-urlencoded'
},
success: (res) => {
uni.hideLoading()
console.log('接单请求 成功')
console.log(res)
if(res.data.code==200){
if(res.statusCode==200){
uni.showToast({
icon:'none',
title:'接单成功'
......@@ -313,6 +416,7 @@
},
fail: (e) => {
uni.hideLoading()
console.log('接单请求 失败')
console.log(e)
uni.showToast({
......@@ -323,6 +427,22 @@
})
},
//时间戳转换成日期时间
formatDate: function(value) {
var date = new Date();
//date.setTime(value);
var month = date.getMonth() + 1;
var hours = date.getHours();
if (hours < 10)
hours = "0" + hours;
var minutes = date.getMinutes();
if (minutes < 10)
minutes = "0" + minutes;
var time = date.getFullYear() + "-" + month + "-" + date.getDate() +
" " + hours + ":" + minutes;
return time;
}
}
......
......@@ -164,6 +164,7 @@
current_SPECIFICATIONS_specificationId:'',
SPECIFICATIONS_fieldsValue:'',
SPECIFICATIONS_fieldsOptions:'',
SPECIFICATIONS_showContent:'',
//产品型号相关
is_PRODUCT_NUMBER_picker_show:false,
......@@ -305,6 +306,7 @@
}else{
uni.showToast({
icon:'none',
title:res.errMsg
})
......@@ -327,6 +329,18 @@
res.data.data.fieldsItems.forEach(item => {
//产品规格
if(item.fieldsType == 'SPECIFICATIONS'){
if(item.fieldsOptions && item.fieldsOptions.length>0){
var optionsDic = JSON.parse(item.fieldsOptions)
this.SPECIFICATIONS_showContent = optionsDic.specificationName
console.log('之前填写过的 产品规格:')
console.log(optionsDic)
console.log(this.SPECIFICATIONS_showContent)
}
}
//照片
if(item.fieldsType == 'PHOTOS'){
//this.photoList = [{image:this.icon_photo_add},{image:'222'},{image:'333'},{image:'444'}]
......@@ -1110,7 +1124,11 @@
*/
saveInfo: function (maintainFieldsJSON) {
uni.showLoading({
title:'请稍候'
})
console.log('保存完工信息 点击')
let that = this
uni.request({
url: getApp().globalData.domain_Name
+'/wxh-worker-rest/rest/'
......@@ -1125,6 +1143,7 @@
'Content-Type': 'application/x-www-form-urlencoded',
},
success: (res) => {
uni.hideLoading()
console.log('保存完工信息 成功')
console.log(res)
......@@ -1132,14 +1151,18 @@
if(res.statusCode==200){
if(ths.photoList.length>0){
this.photoUpload()
if(that.photoList.length>0){
that.photoUpload()
console.log('11111111111111111111')
return
}
this.finishConfirm()
that.finishConfirm()
console.log('222222222222222')
}else{
uni.showToast({
icon:'none',
title:res.data
})
......@@ -1149,9 +1172,11 @@
},
fail: (e) => {
uni.hideLoading()
console.log('保存完工信息 失败')
console.log(e)
uni.showToast({
icon:'none',
title:'完工失败'
})
}
......@@ -1171,6 +1196,10 @@
finishConfirm: function () {
console.log('确认完工 点击')
uni.showLoading({
title:'请稍候'
})
uni.request({
url: getApp().globalData.domain_Name
+'/wxh-worker-rest/rest/'
......@@ -1186,6 +1215,7 @@
'Content-Encoding': 'gzip'
},
success: (res) => {
uni.hideLoading()
console.log('确认完工 成功')
console.log(res)
console.log(res.statusCode)
......@@ -1203,6 +1233,7 @@
},
fail: (e) => {
uni.hideLoading()
console.log('确认完工 失败')
console.log(e)
uni.showToast({
......
......@@ -36,19 +36,19 @@
<image class="noDataIcon" :src="icon_noData" mode=""></image>
<text class="noDataText">暂无数据</text>
</view>
<view class="itemView" v-if="activeTop == 1" @click.stop="itemClick(item)" v-for="(item,ikey) in unfinishList":key="ikey">
<view class="nameView">
<view class="itemView" v-if="activeTop == 1" v-for="(item,ikey) in unfinishList":key="ikey">
<view class="nameView" @click="itemClick(item)">
<view class="nameLeftView">
<text class="nameText" v-if="item.contactName">{{item.contactName}}</text>
<text class="callPhoneText underLine" @click="callClick(item.contactMobilephone)" v-if="item.contactMobilephone">{{item.contactMobilephone}}</text>
</view>
<text class="productText" v-if="item.brandName && item.categoryName && item.orderServiceType">{{item.brandName}}-{{item.categoryName}}-{{item.orderServiceType}}</text>
</view>
<text class="addressText" v-if="item.contactAddress">{{item.contactAddress}}</text>
<text class="addressText" @click="itemClick(item)" v-if="item.contactAddress">{{item.contactAddress}}</text>
<view class="bookBottomView" v-if="item.maintainWorkerName || item.statusText">
<text class="typeText">({{item.inGuaranteePeriodText}})-{{item.orderServiceType}}</text>
<text class="bookText underLine" @click="onShowDatePicker('datetime',item)" v-if="item.appointmentDatetime">{{item.appointmentDatetime}}</text>
<text class="bookText underLine" @click="onShowDatePicker('datetime',item)" v-if="!item.appointmentDatetime">未预约</text>
<text class="bookText underLine" @click.stop="onShowDatePicker('datetime',item)" v-if="item.appointmentDatetime">{{formatDate(item.appointmentDatetime)}}</text>
<text class="bookText underLine" @click.stop="onShowDatePicker('datetime',item)" v-if="!item.appointmentDatetime">未预约</text>
<text class="statusText" v-if="item.statusText">{{item.statusText}}</text>
</view>
<view class="divideLine u-m-t-30"></view>
......@@ -69,7 +69,7 @@
<text class="addressText" v-if="item.contactAddress">{{item.contactAddress}}</text>
<view class="finishBottomView" v-if="item.maintainWorkerName || item.statusText">
<text class="typeText" v-if="item.inGuaranteePeriodText">({{item.inGuaranteePeriodText}})-{{item.orderServiceType}}</text>
<text class="finishDateText" v-if="item.orderFinishDatetime">{{item.orderFinishDatetime}}</text>
<text class="finishDateText" v-if="item.orderFinishDatetime">完工: {{formatDate(item.orderFinishDatetime)}}</text>
</view>
<view class="divideLine u-m-t-30"></view>
</view>
......@@ -96,10 +96,10 @@
<script>
import MxDatePicker from "@/components/mx-datepicker/mx-datepicker.vue";
import {js_date_time} from "@/common/util.js";
export default {
components: {MxDatePicker},
data() {
data() {
return {
activeTop:0,
orderId:'',
......@@ -145,22 +145,8 @@
onShow() {
/*
uni.getStorage({
key: 'token',
success: function (res) {
console.log('本地获取token成功')
console.log(res.data);
getApp().globalData.token = res.data
}
})
this.getData()
*/
this.getToken()
},
......@@ -275,7 +261,7 @@
console.log('获取抢单广场列表 成功')
console.log(res.statusCode)
if(res.statusCode==401 || res.statusCode==404){
if(res.statusCode==401){
uni.navigateTo({
url:'/pages/login/wxlogin'
})
......@@ -460,7 +446,7 @@
that.getOrderList(0)
}else{
uni.showToast({
icon:none,
icon:'none',
title:res.data
})
......@@ -474,7 +460,25 @@
console.log(e)
}
})
}
},
//时间戳转换成日期时间
formatDate: function(value) {
var date = new Date();
//date.setTime(value);
var month = date.getMonth() + 1;
var hours = date.getHours();
if (hours < 10)
hours = "0" + hours;
var minutes = date.getMinutes();
if (minutes < 10)
minutes = "0" + minutes;
var time = date.getFullYear() + "-" + month + "-" + date.getDate() +
" " + hours + ":" + minutes;
return time;
}
......
......@@ -277,7 +277,7 @@
}else{
uni.showToast({
icon:'none',
title:res.data.message
title:res.data
})
......@@ -289,6 +289,10 @@
uni.hideLoading()
console.log('最终请求 失败')
console.log(e)
uni.showToast({
icon:'none',
title:'最终请求失败'
})
}
})
},
......
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