Browse Source

服务评价 完善 回显问题

feature/feature-compatible
fengchengzhi 7 years ago
parent
commit
0fd0c54fe2
2 changed files with 133 additions and 126 deletions
  1. 8
      src/view/put-money.vue
  2. 251
      src/view/service-evaluation.vue

8
src/view/put-money.vue

@ -41,6 +41,8 @@
<script> <script>
import putMoney from "../models/put-money-model.js"; import putMoney from "../models/put-money-model.js";
import { Alert,Toast } from 'vux' import { Alert,Toast } from 'vux'
import configs from '../configs';
var locationUrl = configs.locationUrl;
export default{ export default{
data() { data() {
return { return {
@ -83,9 +85,9 @@
this.$router.push({path:'/put-money-success'}); this.$router.push({path:'/put-money-success'});
} else if (res.code == 666) { } else if (res.code == 666) {
this.$vux.toast.text(res.msg,'middle') this.$vux.toast.text(res.msg,'middle')
setTimeout(function(){
window.location.href='/mall/web/user/login'
},2000);
setTimeout(function () {
window.location.href = locationUrl + '/mall/web/user/login?callback=' + encodeURIComponent(window.location.href);
}, 1000);
} else { } else {
this.$vux.toast.text(res.msg,'middle') this.$vux.toast.text(res.msg,'middle')
} }

251
src/view/service-evaluation.vue

@ -10,10 +10,10 @@
<div class="line"></div> <div class="line"></div>
<div class="cleaners-news"> <div class="cleaners-news">
<p>保洁师 <p>保洁师
<span>{{name}}</span>
<span>{{cleanerName}}</span>
</p> </p>
<p>服务日期 <p>服务日期
<span>{{time}}</span>
<span>{{serviceTime}}</span>
</p> </p>
</div> </div>
<div class="line"></div> <div class="line"></div>
@ -81,135 +81,140 @@ import status from "./service-evaluation-status.vue";
import { Alert, Toast } from "vux"; import { Alert, Toast } from "vux";
export default { export default {
data() {
return {
//
name: "哇哈哈",
//
time: "2018-10-01 08:00-12:00",
tipShow: false,
timeScore: 0,
serviceScore: 0,
professionScore: 0,
content: "",
alertShow: false,
code: 4,
statusShow: false,
//
alertTip: "请完整填写评价",
//
isCanEvaluation: false
};
},
components: {
status,
Alert,
Toast
},
methods: {
//
showTips() {
this.tipShow = true;
data() {
return {
//
cleanerName: "哇哈哈",
//
serviceTime: "2018-10-01 08:00-12:00",
tipShow: false,
timeScore: 0,
serviceScore: 0,
professionScore: 0,
content: "",
alertShow: false,
code: 4,
statusShow: false,
//
alertTip: "请完整填写评价",
//
isCanEvaluation: false
};
}, },
//
closeTips() {
this.tipShow = false;
components: {
status,
Alert,
Toast
}, },
//
submit() {
if (!this.isCanEvaluation) return;
if (
this.timeScore == 0 ||
this.serviceScore == 0 ||
this.professionScore == 0
) {
this.alertTip = "请完整填写评价";
this.alertShow = true;
setTimeout(() => {
this.alertShow = false;
}, 3000);
} else {
var strCookie = document.cookie;
var cookieName = "1hjz_mall_login_access_token=";
var token = strCookie.slice(cookieName.length);
methods: {
//
showTips() {
this.tipShow = true;
},
//
closeTips() {
this.tipShow = false;
},
//
submit() {
if (!this.isCanEvaluation) return;
if (
this.timeScore == 0 ||
this.serviceScore == 0 ||
this.professionScore == 0
) {
this.alertTip = "请完整填写评价";
this.alertShow = true;
setTimeout(() => {
this.alertShow = false;
}, 3000);
} else {
var strCookie = document.cookie;
var cookieName = "1hjz_mall_login_access_token=";
var token = strCookie.slice(cookieName.length);
model
.add(
{
timeScore: this.timeScore,
serviceScore: this.serviceScore,
professionScore: this.professionScore,
content: this.content,
bookNo: this.getParam("bookNo")
},
token
)
.then(res => {
model
.add(
{
timeScore: this.timeScore,
serviceScore: this.serviceScore,
professionScore: this.professionScore,
content: this.content,
bookNo: this.getParam("bookNo")
},
token
)
.then(res => {
let code = res.code;
if (code == 0) {
//
this.code = 0;
this.statusShow = true;
} else if (code == 1) {
//
this.alertTip = res.msg;
this.alertShow = true;
setTimeout(() => {
this.alertShow = false;
}, 3000);
} else if (code == 2) {
//
this.code = 2;
this.statusShow = true;
} else if (code == 3) {
//
this.code = 3;
this.statusShow = true;
} else if (code == 4) {
//
this.code = 4;
this.statusShow = true;
}
});
}
},
getParam(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var url = window.location.href;
url = window.location.href.substring(url.indexOf("?") + 1, url.length);
var r = url.match(reg);
if (r != null) return unescape(r[2]);
return null;
},
//
goBack() {
history.go(-1);
}
},
mounted() {
//
model.getEvaluationNews({ bookNo: this.getParam("bookNo") }).then(res => {
let code = res.code; let code = res.code;
if (code == 0) { if (code == 0) {
//
this.code = 0;
this.statusShow = true;
//
if (!res.response.userId) {
this.alertTip = res.msg;
this.alertShow = true;
setTimeout(() => {
this.alertShow = false;
}, 3000);
} else {
this.isCanEvaluation = true;
this.cleanerName = res.response.cleanerName
var times = ''
if (res.response.timeType == 1) {
times = '8:00~12:00'
} else {
times = '14:00~16:00'
}
this.serviceTime = res.response.bookTime +' '+ times
}
} else if (code == 1) { } else if (code == 1) {
//
this.alertTip = res.msg;
this.alertShow = true;
setTimeout(() => {
this.alertShow = false;
}, 3000);
} else if (code == 2) {
//
this.code = 2;
this.statusShow = true;
} else if (code == 3) {
//
this.code = 3;
this.statusShow = true;
} else if (code == 4) {
//
this.code = 4;
this.statusShow = true;
this.code = 4;
this.statusShow = true;
} }
});
}
},
getParam(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var url = window.location.href;
url = window.location.href.substring(url.indexOf("?") + 1, url.length);
var r = url.match(reg);
if (r != null) return unescape(r[2]);
return null;
},
//
goBack() {
history.go(-1);
});
} }
},
mounted() {
this.name = this.getParam("name");
this.time = this.getParam("bookTime");
this.code = this.getParam("code");
//
model.getEvaluationNews({ bookNo: this.getParam("bookNo") }).then(res => {
let code = res.code;
if (code == 0) {
//
if (!res.response.userId) {
this.alertTip = res.msg;
this.alertShow = true;
setTimeout(() => {
this.alertShow = false;
}, 3000);
} else {
this.isCanEvaluation = true;
}
} else if (code == 1) {
this.code = 4;
this.statusShow = true;
}
});
}
}; };
</script> </script>
<style scoped> <style scoped>

Loading…
Cancel
Save