diff --git a/src/components/order/item.vue b/src/components/order/item.vue index 281a765..2490b45 100644 --- a/src/components/order/item.vue +++ b/src/components/order/item.vue @@ -15,14 +15,16 @@ {{ order.orderId }} 复制 - - 服务分类: - {{ order.cate }} - - - 需求内容: - {{ order.content }} - + + + 服务分类: + {{ order.cate }} + + + 需求内容: + {{ order.content }} + + 下单时间: {{ order.createTime }} diff --git a/src/core/apis.js b/src/core/apis.js index 857b134..b9e162b 100644 --- a/src/core/apis.js +++ b/src/core/apis.js @@ -199,6 +199,11 @@ export default { t3: { url: "" }, + }, + chooseWorker: { + url: "/wxapp/orderb/chooseshifu", + showLoading: true, + auth: true, } } } diff --git a/src/core/models/order.js b/src/core/models/order.js index 5a7a9c4..307cfe5 100644 --- a/src/core/models/order.js +++ b/src/core/models/order.js @@ -121,9 +121,9 @@ export default { name: item.shifu.name, avatar: item.shifu.avatar, type: item.shifu.status, - times: item.shifu_date.count, - favorableRate: item.shifu_date.good, - grade: item.shifu_date.score, + times: item.shifu.shifu_date.count, + favorableRate: item.shifu.shifu_date.good, + grade: item.shifu.shifu_date.score, price: item.money, } } @@ -200,9 +200,9 @@ export default { if (prototype.$utils.isType(data.shifu, "object")) { order.worker = { id: data.shifu.id, + uid: data.shifu.uid, name: data.shifu.name, avatar: data.shifu.avatar, - type: data.shifu.status, price: data.money, } } @@ -211,6 +211,7 @@ export default { data.shifus.forEach(worker => { order.workerList.push({ id: worker.id, + uid: worker.uid, name: worker.name, avatar: worker.avatar, price: worker.money, @@ -243,4 +244,23 @@ export default { }); }); }, + /** + * 选择师傅 + */ + chooseWorker(id, workerId) { + return new Promise((resolve, reject) => { + prototype.$request({ + api: "order.chooseWorker", + data: { + id: id, + worker: workerId, + } + }).then(response => { + if (response.code == 1) { + return resolve(response.msg); + } + return reject(response.msg); + }).catch(e => { }); + }); + }, } diff --git a/src/pages/order/detail.vue b/src/pages/order/detail.vue index 6a18d00..813858c 100644 --- a/src/pages/order/detail.vue +++ b/src/pages/order/detail.vue @@ -24,27 +24,47 @@ > - - 暂无师傅报价 - - - - - - {{ item.createTime }} - - 报价金额 - ¥ {{ utils.formatNumber(item.price, 2) }} - - - - - - 选择师傅 + + + + + + + {{ item.createTime }} + + 报价金额 + ¥ {{ utils.formatNumber(item.price, 2) }} + + + + + + 选择师傅 + + + 当前暂无师傅报价 + + + + + 当前暂无师傅接单 + + + {{ order.worker.id }}-{{ order.worker.name }} + @@ -148,6 +168,8 @@ export default { order: { address: {}, }, + showDetail: false, + showList: false, }; }, components: { @@ -156,7 +178,7 @@ export default { ServiceInsurance, OrderAction, }, - onLoad(e) { + async onLoad(e) { this.pageConfig = getApp().globalData.pageConfig; if (e.id && e.id > 0) { @@ -174,7 +196,7 @@ export default { } else { this.switchTab(0); } - this.loadDetail(); + await this.loadDetail(); }, onShow() {}, onReady() {}, @@ -222,13 +244,22 @@ export default { /** * 选择师傅 */ - chooseWorker(id) { + chooseWorker(uid) { const that = this; uni.showModal({ title: "确认选择该师傅?", complete(res) { if (res.confirm) { - that.$utils.toast("你选择了师傅" + id); + that.$models.order + .chooseWorker(that.id, uid) + .then((msg) => { + that.$utils.toast(msg).then(() => { + that.loadDetail(); + }); + }) + .catch((e) => { + that.$utils.toast(e); + }); } }, }); @@ -236,8 +267,8 @@ export default { /** * 加载详情 */ - loadDetail() { - this.$models.order + async loadDetail() { + await this.$models.order .orderDetail({ request: { api: "order.detail." + this.listType, @@ -256,7 +287,10 @@ export default { this.stateText = stateText; this.stateDesc = stateDesc; this.stateTextColor = stateTextColor; - this.order = detail; + this.order = { + ...detail, + listType: this.listType, + }; this.$nextTick(() => { this.setTabHeight(); }); @@ -326,7 +360,7 @@ export default { } .detail-tab { width: 100%; - .no-worker { + .desc-text { color: #999999; font-size: 28rpx; line-height: 200rpx;