完成用户端评价
This commit is contained in:
parent
60fea0b715
commit
f0a4f02647
|
@ -291,13 +291,17 @@ export default {
|
||||||
count: {
|
count: {
|
||||||
service: {
|
service: {
|
||||||
url: "/wxapp/index/seeworkerevaluation",
|
url: "/wxapp/index/seeworkerevaluation",
|
||||||
showLoading: true,
|
},
|
||||||
|
worker: {
|
||||||
|
url: "/wxapp/orderb/seeworkerevaluation",
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
list: {
|
list: {
|
||||||
service: {
|
service: {
|
||||||
url: "/wxapp/index/goodsevaluation",
|
url: "/wxapp/index/goodsevaluation",
|
||||||
showLoading: true,
|
},
|
||||||
|
worker: {
|
||||||
|
url: "/wxapp/orderb/allevaluation",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -17,6 +17,21 @@ export default {
|
||||||
return reject(response.msg);
|
return reject(response.msg);
|
||||||
}).catch(e => { });
|
}).catch(e => { });
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
worker(id) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
prototype.$request({
|
||||||
|
api: "appraise.count.worker",
|
||||||
|
data: {
|
||||||
|
id: id,
|
||||||
|
}
|
||||||
|
}).then(response => {
|
||||||
|
if (response.code == 1) {
|
||||||
|
return resolve(response.data);
|
||||||
|
}
|
||||||
|
return reject(response.msg);
|
||||||
|
}).catch(e => { });
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
list: {
|
list: {
|
||||||
|
@ -50,6 +65,37 @@ export default {
|
||||||
return reject(response.msg);
|
return reject(response.msg);
|
||||||
}).catch(e => { });
|
}).catch(e => { });
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 师傅评价
|
||||||
|
*/
|
||||||
|
worker(data) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
prototype.$request({
|
||||||
|
api: "appraise.list.worker",
|
||||||
|
data: data
|
||||||
|
}).then(response => {
|
||||||
|
if (response.code == 1) {
|
||||||
|
let list = [];
|
||||||
|
response.data.forEach((data) => {
|
||||||
|
list.push({
|
||||||
|
id: data.id,
|
||||||
|
avatar: data.u_avatar,
|
||||||
|
nickname: data.u_name,
|
||||||
|
createTime: data.time,
|
||||||
|
tags: data.msg.split(","),
|
||||||
|
area: "-",
|
||||||
|
worker: data.wid,
|
||||||
|
grade: data.score,
|
||||||
|
images: data.img,
|
||||||
|
content: data.desc,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return resolve(list);
|
||||||
|
}
|
||||||
|
return reject(response.msg);
|
||||||
|
}).catch(e => { });
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,9 +7,12 @@ export default {
|
||||||
case 0: return ['待审核', '#ff0000'];
|
case 0: return ['待审核', '#ff0000'];
|
||||||
case 1: return ['普通师傅', '#bfbfbf'];
|
case 1: return ['普通师傅', '#bfbfbf'];
|
||||||
case 2: return ['入驻师傅', '#d9a019'];
|
case 2: return ['入驻师傅', '#d9a019'];
|
||||||
default: return ['未知'];
|
default: return ['未知', '#000000'];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* 师傅详情
|
||||||
|
*/
|
||||||
workerDetail(uid) {
|
workerDetail(uid) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
prototype.$request({
|
prototype.$request({
|
||||||
|
@ -18,7 +21,25 @@ export default {
|
||||||
uid: uid,
|
uid: uid,
|
||||||
}
|
}
|
||||||
}).then(response => {
|
}).then(response => {
|
||||||
console.log(response);
|
if (response.code == 1) {
|
||||||
|
let worker = {
|
||||||
|
times: response.data.count,
|
||||||
|
favorableRate: response.data.good,
|
||||||
|
grade: response.data.score,
|
||||||
|
worker: {},
|
||||||
|
}
|
||||||
|
if (prototype.$utils.isType(response.data.worker, "object")) {
|
||||||
|
worker.worker = {
|
||||||
|
id: response.data.worker.id,
|
||||||
|
uid: response.data.worker.uid,
|
||||||
|
name: response.data.worker.name,
|
||||||
|
type: response.data.worker.status,
|
||||||
|
avatar: response.data.worker.avatar,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return resolve(worker);
|
||||||
|
}
|
||||||
|
return reject(response.msg);
|
||||||
}).catch(e => { });
|
}).catch(e => { });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
<text class="title">报价金额</text>
|
<text class="title">报价金额</text>
|
||||||
<text class="number">¥ {{ utils.formatNumber(item.price, 2) }}</text>
|
<text class="number">¥ {{ utils.formatNumber(item.price, 2) }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="detail" @click="workerDetail(item.id)">
|
<view class="detail" @click="workerDetail(item.uid)">
|
||||||
<worker-item :data="item" :showPrice="false" />
|
<worker-item :data="item" :showPrice="false" />
|
||||||
</view>
|
</view>
|
||||||
<view class="action">
|
<view class="action">
|
||||||
|
@ -230,7 +230,7 @@ export default {
|
||||||
*/
|
*/
|
||||||
showWorker() {
|
showWorker() {
|
||||||
if (this.$utils.isType(this.order.worker, "object") && this.$utils.isType(this.order.worker.id, "number")) {
|
if (this.$utils.isType(this.order.worker, "object") && this.$utils.isType(this.order.worker.id, "number")) {
|
||||||
this.$utils.toPage("/pages/worker/detail?id=" + this.order.worker.id);
|
this.workerDetail(this.order.worker.uid);
|
||||||
} else {
|
} else {
|
||||||
this.switchTab(0);
|
this.switchTab(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,67 +3,150 @@
|
||||||
<view class="worker-header">
|
<view class="worker-header">
|
||||||
<view class="worker-base">
|
<view class="worker-base">
|
||||||
<view class="head">
|
<view class="head">
|
||||||
<image class="cover" :src="cover" mode="aspectFill" />
|
<image class="cover" :src="info.worker.avatar" mode="aspectFill" />
|
||||||
</view>
|
</view>
|
||||||
<view class="desc">
|
<view class="desc">
|
||||||
<view class="name">
|
<view class="name">
|
||||||
<text>{{ name }}</text>
|
<text>{{ info.worker.name }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="type" :style="{ color: models.worker.getWorkerTypeTextColor(type) }">
|
<view class="type" :style="{ color: typeTextColor }">
|
||||||
<text>{{ models.worker.getWorkerTypeText(type) }}</text>
|
<text>{{ typeText }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="service-info">
|
<view class="service-info">
|
||||||
<view class="section">
|
<view class="section">
|
||||||
服务:<text class="num">{{ times }}</text>
|
服务:<text class="num">{{ info.times }}</text>
|
||||||
<text class="unit">次</text>
|
<text class="unit">次</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="section">
|
<view class="section">
|
||||||
好评率:<text class="num">{{ favorable_rate }}</text>
|
好评率:<text class="num">{{ info.favorableRate }}</text>
|
||||||
<text class="unit">%</text>
|
<text class="unit">%</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="section">
|
<view class="section">
|
||||||
评分:<text class="num">{{ grade }}</text>
|
评分:<text class="num">{{ info.grade }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="appraise-body">
|
||||||
|
<app-appraise-section
|
||||||
|
:total="appraise.total"
|
||||||
|
:tags="appraise.tags"
|
||||||
|
:cate="appraise.cate"
|
||||||
|
@changeCate="changeAppraiseCate"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
</app-layout>
|
</app-layout>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import AppLayout from "@/components/layout/layout";
|
import AppLayout from "@/components/layout/layout";
|
||||||
|
import AppAppraiseSection from "@/components/appraise/section";
|
||||||
export default {
|
export default {
|
||||||
name: "worker-detail",
|
name: "worker-detail",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
models: this.$models,
|
models: this.$models,
|
||||||
id: 0,
|
typeText: "",
|
||||||
name: "",
|
typeTextColor: "",
|
||||||
type: 0,
|
info: {
|
||||||
cover: "",
|
times: 0,
|
||||||
times: 0,
|
favorableRate: 0,
|
||||||
favorable_rate: 0,
|
grade: 0,
|
||||||
grade: 0,
|
worker: {
|
||||||
|
uid: 0,
|
||||||
|
id: 0,
|
||||||
|
name: "",
|
||||||
|
type: 0,
|
||||||
|
avatar: "",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
currentAppraiseCateIndex: 0,
|
||||||
|
appraise: {
|
||||||
|
total: 0,
|
||||||
|
tags: [],
|
||||||
|
cate: [],
|
||||||
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
AppLayout,
|
AppLayout,
|
||||||
|
AppAppraiseSection,
|
||||||
},
|
},
|
||||||
onLoad(e) {
|
async onLoad(e) {
|
||||||
if (!e.id) {
|
if (!e.id) {
|
||||||
return this.$utils.tosat("参数错误").then(() => {
|
return this.$utils.tosat("参数错误").then(() => {
|
||||||
this.$utils.toPage("", "", "back");
|
this.$utils.toPage("", "", "back");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.id = e.id;
|
await this.$models.worker.workerDetail(e.id).then((data) => {
|
||||||
let [typeText, typeTextColor] = this.$models.worker.workerTypeText(this.data.type);
|
this.info = data;
|
||||||
|
let [typeText, typeTextColor] = this.$models.worker.workerTypeText(data.worker.type);
|
||||||
|
this.typeText = typeText;
|
||||||
|
this.typeTextColor = typeTextColor;
|
||||||
|
});
|
||||||
|
// 评价
|
||||||
|
await this.$models.appraise.count.worker(this.id).then((data) => {
|
||||||
|
data.tags.forEach((item) => {
|
||||||
|
this.appraise.tags.push({
|
||||||
|
count: item.count,
|
||||||
|
name: item.name,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
data.cate.forEach((item) => {
|
||||||
|
this.appraise.cate.push({
|
||||||
|
name: item.name,
|
||||||
|
count: item.count,
|
||||||
|
status: item.status,
|
||||||
|
page: 1,
|
||||||
|
more: true,
|
||||||
|
list: [],
|
||||||
|
});
|
||||||
|
});
|
||||||
|
this.appraise.total = this.appraise.cate[0].count;
|
||||||
|
this.changeAppraiseCate(this.appraise.cate[0], 0);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
onShow() {},
|
onShow() {},
|
||||||
onReady() {},
|
onReady() {},
|
||||||
onReachBottom() {},
|
onReachBottom() {
|
||||||
|
let currentCate = this.appraise.cate[this.currentAppraiseCateIndex];
|
||||||
|
if (currentCate.more) {
|
||||||
|
this.loadAppraiseData(currentCate);
|
||||||
|
}
|
||||||
|
},
|
||||||
onPullDownRefresh() {},
|
onPullDownRefresh() {},
|
||||||
methods: {},
|
methods: {
|
||||||
|
/**
|
||||||
|
* 切换评价分类
|
||||||
|
*/
|
||||||
|
changeAppraiseCate(currentCate, index) {
|
||||||
|
this.currentAppraiseCateIndex = index;
|
||||||
|
currentCate.list = [];
|
||||||
|
currentCate.more = true;
|
||||||
|
currentCate.page = 1;
|
||||||
|
this.loadAppraiseData(currentCate);
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 加载评价数据
|
||||||
|
*/
|
||||||
|
loadAppraiseData(currentCate) {
|
||||||
|
this.$models.appraise.list
|
||||||
|
.worker({
|
||||||
|
id: this.id,
|
||||||
|
status: currentCate.status,
|
||||||
|
page: currentCate.page,
|
||||||
|
})
|
||||||
|
.then((list) => {
|
||||||
|
if (list.length > 0) {
|
||||||
|
currentCate.page++;
|
||||||
|
currentCate.list = currentCate.list.concat(list);
|
||||||
|
} else {
|
||||||
|
currentCate.more = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue