Commit 84df9113 authored by Morson's avatar Morson

页面逻辑调整

parent d48597dc
......@@ -30,7 +30,7 @@ npm run build:mp-weixin // 运行生产环境
[图片上传参考](https://ext.dcloud.net.cn/plugin?id=822)
### 自定义配置
......@@ -68,4 +68,21 @@ npm run build:mp-weixin // 运行生产环境
```
### 引用token
1. 方式一,存放在vuex的token,假设使用了uView封装的vuex方式
// 见:https://uviewui.com/components/globalVariable.html
// config.header.token = vm.token;
2. 方式二,如果没有使用uView封装的vuex方法,那么需要使用$store.state获取
// config.header.token = vm.$store.state.token;
3. 方式三,如果token放在了globalData,通过getApp().globalData获取
// config.header.token = getApp().globalData.username;
4. 方式四,如果token放在了Storage本地存储中,拦截是每次请求都执行的
// 所以哪怕您重新登录修改了Storage,下一次的请求将会是最新值
// const token = uni.getStorageSync('token');
// config.header.token = token;
PS: 当前项目使用了:方式一,具体情况可以参考state目录下代码
vm.vuex_token
......@@ -4,11 +4,10 @@ import { AnalysysAgent } from "@/utils/analysys_paas.js";
import util from "@/utils/util.js";
import login from "@/utils/login.js";
export default {
globalData: {
globalData: {
jumpLoginStatus: true,
// 开发环境
uniEnv: process.uniEnv,
// 登录凭证
token: "",
// 微信小程序平台编号,空--家维广场,1--自营平台
wxAppNo: 1,
......@@ -80,10 +79,10 @@ export default {
AnalysysAgent.registerSuperProperty("platform", "self-support");
this.getSystemInfo()
// 版本更新
this.updateApp();
await this.updateApp();
// 系统自动登录
this.autoLogin();
await this.autoLogin();
},
onShow: async function () {
// 应用启动,或从后台进入前台显示
......@@ -177,7 +176,7 @@ export default {
},
/* 版本更新 */
updateApp() {
async updateApp() {
// 版本更新
const updateManager = uni.getUpdateManager();
......
......@@ -16,10 +16,7 @@ const install = (Vue, vm) => {
function toLoginPage(){
const app = getApp()
let jumpLoginStatus
if(app && app.globalData){
jumpLoginStatus = app.globalData.jumpLoginStatus
}
let jumpLoginStatus = app && app.globalData && app.globalData.jumpLoginStatus
if(!jumpLoginStatus){
return
}
......
......@@ -29,11 +29,11 @@
<view class="select-time u-p-t-50">
<view class="u-flex u-row-between">
<view class="txt">选择时间:</view>
<view class="txt active">{{ currentTimeTxt }}</view>
<view class="txt active">{{ appointRangeText }}</view>
</view>
<view class="u-p-t-30 u-flex u-flex-wrap time-list">
<view
:class="{'time-item':true,'active': index===currentTime}" v-for="(item,index) in timeList"
:class="{'time-item':true,'active': item.pkey===appointRange}" v-for="(item,index) in timeList"
:key="item.pkey">
<button class="time" :plain="true"
:disabled="item.disabled" :hair-line="false"
......@@ -63,6 +63,7 @@
return "预约时间"
}
},
dateList: {
type: Array,
default(){
......@@ -96,30 +97,21 @@
},
data() {
return {
currentDay: null,
currentTime: null,
appointTime: null,
appointRange: "",
appointRange: null,
appointRangeText: '',
num: 0,
hasLast: false
}
},
watch: {
title() {
this.currentDay = null
this.currentTime = null
this.appointTime = null
this.appointRange = ""
this.appointRange = null
this.appointRangeText = ''
}
},
computed: {
currentTimeTxt() {
if(this.currentTime != null) {
return this.timeList[this.currentTime].name
}
return ''
},
},
computed: {},
methods: {
getDateList() {
// 获取日期
......@@ -130,10 +122,9 @@
index,
list,
}
this.currentDay = index
this.appointTime = item.day
this.currentTime = null
this.appointRange = ""
this.appointRange = null
this.appointRangeText = ''
this.$emit('date-change', data)
},
timeChange(item, index, list) {
......@@ -142,8 +133,8 @@
index,
list,
}
this.currentTime = index
this.appointRange = item.pkey
this.appointRangeText = item.name
this.$emit('time-change', data)
},
weekChange(item, index, list) {
......@@ -246,8 +237,6 @@
}
&.active {
// background-color: #2272FF;
.day {
color: #2272FF;
......
......@@ -118,8 +118,8 @@ export default {
appointTitle: '预约时间',
appoint: ['下次联系时间', '预约时间'],
trace: {
reasonType: '报', // 反馈类型
reasonRelegation: '', // 反馈归属
reasonType: '报', // 反馈类型
reasonRelegation: '客户', // 反馈归属
reason: '', // 反馈原因
appointmentDatetime: null, // 预约时间
appointmentDatetimeRange: '', // 预约时间段类型
......@@ -146,13 +146,15 @@ export default {
computed: {
disabledSubmit() {
let self = this;
if (self.trace.reasonType && self.trace.reasonType == '报备') {
if (self.trace.reasonRelegation && self.trace.reason && self.trace.nextTraceDatetime && self.trace.appointmentDatetimeRange) {
return false;
}
} else if (self.trace.reasonType && self.trace.reasonType == '改约') {
if (self.trace.reasonRelegation && self.trace.reason && self.trace.appointmentDatetime && self.trace.appointmentDatetimeRange) {
return false;
if(self.trace.reasonRelegation && self.trace.reason) {
if (self.trace.reasonType == '改约') {
if (self.trace.appointmentDatetime && self.trace.appointmentDatetimeRange) {
return false;
}
} else {
if (self.trace.nextTraceDatetime && self.trace.appointmentDatetimeRange) {
return false;
}
}
}
......@@ -197,7 +199,7 @@ export default {
configs[index] = { name: tab, owns: [] };
if(tab == '改约') {
self.appoint[index] = '预约时间'
} else if(tab == '报备') {
} else {
self.appoint[index] = '下次联系时间'
}
owns.forEach(function(own, key) {
......@@ -220,6 +222,9 @@ export default {
self.trace.reason = tabList['owns'][self.curOwn]['types'][0];
self.appointTitle = self.appoint[self.curTab]
self.trace.remark = '';
self.trace.appointmentDatetime = null;
self.trace.appointmentDatetimeRange = null;
self.trace.nextTraceDatetime = null;
if (self.trace.reasonType == '改约') {
self.showRemark = true;
if (self.dateList && self.timeList) {
......@@ -298,13 +303,7 @@ export default {
console.log(data, 'week-data');
let self = this;
self.dateItem = data.item
if (self.trace.reasonType == '报备') {
self.trace.appointmentDatetime = null;
self.trace.nextTraceDatetime = data.item.day;
self.timeList.map((item, index) => {
item.disabled = false;
});
} else if (self.trace.reasonType == '改约') {
if (self.trace.reasonType == '改约') {
self.trace.appointmentDatetime = data.item.day;
self.trace.nextTraceDatetime = null;
self.timeList.map((item, index) => {
......@@ -314,6 +313,12 @@ export default {
item.disabled = false;
}
});
} else {
self.trace.appointmentDatetime = null;
self.trace.nextTraceDatetime = data.item.day;
self.timeList.map((item, index) => {
item.disabled = false;
});
}
self.trace.appointmentDatetimeRange = '';
},
......@@ -334,8 +339,28 @@ export default {
}
self.submiting = true;
let res = await self.$u.api.traceAndAppointment(self.trace, self.orderId);
let params = this.$u.deepClone(self.trace);
if(self.trace.reasonType != '改约') {
params.appointmentDatetimeRange = null
params.appointmentDatetime = null
if(self.timeItem && self.timeItem.pkey && params.nextTraceDatetime){
let traceDate = self.moment(params.nextTraceDatetime);
let timeArr = self.timeItem.pkey.split("_")
let hours = timeArr && timeArr.length && timeArr.pop()
let traceDateTime = traceDate.clone().add(Number(hours), 'hours');
params.nextTraceDatetime = traceDateTime.unix() * 1000
}
}
let res = await self.$u.api.traceAndAppointment(params, self.orderId);
self.submiting = false;
if(res && res.code == 200) {
self.$u.route({
url: 'pages/order/detail',
params: {
id: self.orderId
}
})
}
}
}
};
......@@ -493,4 +518,11 @@ export default {
.width-320 {
width: 320rpx;
}
/deep/ button[plain] {
border: none;
}
button[disabled]:not([type]) {
background: #d1d4d4;
color: #ffffff;
}
</style>
......@@ -2,21 +2,21 @@ var t = function(t) {
return (t = t.toString())[1] ? t : "0" + t;
};
const getToken = function(){
const app = getApp()
let token = app && app.globalData && app.globalData.token || ''
if(!token){
token = uni.getStorageSync('token')
}
return token
}
const setToken = function(token){
const app = getApp()
uni.setStorageSync('token',token)
if(app && app.globalData){
app.globalData.token = token
}
}
// const getToken = function(){
// const app = getApp()
// let token = app && app.globalData && app.globalData.token || ''
// if(!token){
// token = uni.getStorageSync('token')
// }
// return token
// }
// const setToken = function(token){
// const app = getApp()
// uni.setStorageSync('token',token)
// if(app && app.globalData){
// app.globalData.token = token
// }
// }
const getOpenid = function(){
const app = getApp()
......@@ -54,8 +54,8 @@ module.exports = {
o = o.substring(0, e), e = (i = 60 * i + "").indexOf("."), i = i.substring(0, e + 4),
i = parseFloat(i).toFixed(0)) : 1 == n && (o = parseFloat(o).toFixed(6))), 2 == n ? r + "°" + o + "′" + i + "″" : 1 == n ? r + "°" + o + "′" : void 0;
},
getToken,
setToken,
// getToken,
// setToken,
getOpenid,
setOpenid,
};
\ No newline at end of file
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