完善订单列表、选择师傅
This commit is contained in:
parent
9fff9695b3
commit
03af516279
|
@ -15,14 +15,16 @@
|
|||
<text class="text">{{ order.orderId }}</text>
|
||||
<text class="copy" @click.stop="copyOrderId(order.orderId)">复制</text>
|
||||
</view>
|
||||
<view class="order-desc-row">
|
||||
<text class="title">服务分类:</text>
|
||||
<text class="text">{{ order.cate }}</text>
|
||||
</view>
|
||||
<view class="order-desc-row limit-line clamp-1">
|
||||
<text class="title">需求内容:</text>
|
||||
<text class="text">{{ order.content }}</text>
|
||||
</view>
|
||||
<block v-if="order.listType != 't3'">
|
||||
<view class="order-desc-row">
|
||||
<text class="title">服务分类:</text>
|
||||
<text class="text">{{ order.cate }}</text>
|
||||
</view>
|
||||
<view class="order-desc-row limit-line clamp-1">
|
||||
<text class="title">需求内容:</text>
|
||||
<text class="text">{{ order.content }}</text>
|
||||
</view>
|
||||
</block>
|
||||
<view class="order-desc-row">
|
||||
<text class="title">下单时间:</text>
|
||||
<text class="text">{{ order.createTime }}</text>
|
||||
|
|
|
@ -199,6 +199,11 @@ export default {
|
|||
t3: {
|
||||
url: ""
|
||||
},
|
||||
},
|
||||
chooseWorker: {
|
||||
url: "/wxapp/orderb/chooseshifu",
|
||||
showLoading: true,
|
||||
auth: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 => { });
|
||||
});
|
||||
},
|
||||
}
|
||||
|
|
|
@ -24,27 +24,47 @@
|
|||
>
|
||||
<swiper-item>
|
||||
<view class="detail-tab tab0">
|
||||
<block v-if="listType == 't2' && order.orderType == 2 && order.workerList.length == 0">
|
||||
<view class="no-worker"> 暂无师傅报价 </view>
|
||||
</block>
|
||||
<!-- 报价订单未选择师傅,展示师傅列表 -->
|
||||
<block v-if="utils.isType(order.workerList, 'array') && order.workerList.length > 0">
|
||||
<view class="worker-group">
|
||||
<view class="worker-item" v-for="(item, index) in order.workerList" :key="index">
|
||||
<view class="datetime">{{ item.createTime }}</view>
|
||||
<view class="price">
|
||||
<text class="title">报价金额</text>
|
||||
<text class="number">¥ {{ utils.formatNumber(item.price, 2) }}</text>
|
||||
</view>
|
||||
<view class="detail" @click="workerDetail(item.id)">
|
||||
<worker-item :data="item" :showPrice="false" />
|
||||
</view>
|
||||
<view class="action">
|
||||
<view class="btn" @click="chooseWorker(item.id)">选择师傅</view>
|
||||
<!-- 不存在具体师傅时,判断服务师傅展示方式 -->
|
||||
<block v-if="utils.isType(order.worker, 'object') && !utils.isType(order.worker.id, 'number')">
|
||||
<!-- 报价订单如果列表不为空则展示师傅列表 -->
|
||||
<block v-if="order.listType == 't2' && order.orderType == 2">
|
||||
<view
|
||||
v-if="utils.isType(order.workerList, 'array') && order.workerList.length > 0"
|
||||
class="worker-group"
|
||||
>
|
||||
<view class="worker-item" v-for="(item, index) in order.workerList" :key="index">
|
||||
<view class="datetime">{{ item.createTime }}</view>
|
||||
<view class="price">
|
||||
<text class="title">报价金额</text>
|
||||
<text class="number">¥ {{ utils.formatNumber(item.price, 2) }}</text>
|
||||
</view>
|
||||
<view class="detail" @click="workerDetail(item.id)">
|
||||
<worker-item :data="item" :showPrice="false" />
|
||||
</view>
|
||||
<view class="action">
|
||||
<view class="btn" @click="chooseWorker(item.uid)">选择师傅</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
v-if="utils.isType(order.workerList, 'array') && order.workerList.length == 0"
|
||||
class="desc-text"
|
||||
>
|
||||
当前暂无师傅报价
|
||||
</view>
|
||||
</block>
|
||||
<!-- 购买订单、一口价订单展示暂无师傅 -->
|
||||
<view
|
||||
v-if="(order.listType == 't1' || order.listType == 't2') && order.orderType == 1"
|
||||
class="desc-text"
|
||||
>
|
||||
当前暂无师傅接单
|
||||
</view>
|
||||
</block>
|
||||
<!-- 存在师傅信息,展示师傅详情 -->
|
||||
<block v-if="utils.isType(order.worker, 'object') && utils.isType(order.worker.id, 'number')">
|
||||
<view class="desc-text">{{ order.worker.id }}-{{ order.worker.name }}</view>
|
||||
</block>
|
||||
</view>
|
||||
</swiper-item>
|
||||
<swiper-item>
|
||||
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue