增加订单时分选择和判断

This commit is contained in:
TOP糯米 2023-04-01 10:53:33 +08:00
parent cc22cacd4b
commit 4aca6defd4
3 changed files with 37 additions and 7 deletions

View File

@ -391,6 +391,13 @@ export default {
* 发布报价
*/
submit() {
if (!this.addressId) {
return this.$utils.toast("请选择地址");
}
if (!this.date || !this.time) {
return this.$utils.toast("请选择时间和日期");
}
let datetime = this.date + " " + this.time;
this.$models.service
.createDemandOrder({
cates: this.cateId,
@ -398,7 +405,7 @@ export default {
desc: this.content,
img: this.uploadImages,
addid: this.addressId,
times: this.date + " " + this.time,
times: datetime,
baoxian: this.insurance ? 1 : 0,
money: this.price,
})

View File

@ -16,10 +16,21 @@
</view>
<view class="widget-item">
<text class="iconfont icon-shijian icon"></text>
<picker mode="date" :value="datetime" @change="bindDateChange" class="picker">
<picker mode="date" @change="bindDateChange" class="picker">
<text class="title">
<text class="text limit-line clamp-1">
{{ datetime ? datetime : "选择期望上门时间" }}
{{ date ? date : "选择期望上门日期" }}
</text>
</text>
</picker>
<text class="iconfont icon-jinru more"></text>
</view>
<view class="widget-item">
<text class="iconfont icon-shijian icon"></text>
<picker mode="time" @change="bindTimeChange" class="picker">
<text class="title">
<text class="limit-line clamp-1">
{{ time ? time : "选择期望上门时间" }}
</text>
</text>
</picker>
@ -72,7 +83,8 @@ export default {
pageConfig: {},
addressId: 0,
addressText: "",
datetime: "",
date: "",
time: "",
content: "",
insurance: false,
isAgree: false,
@ -126,7 +138,10 @@ export default {
onPullDownRefresh() {},
methods: {
bindDateChange(e) {
this.datetime = e.detail.value;
this.date = e.detail.value;
},
bindTimeChange(e) {
this.time = e.detail.value;
},
/**
* 选择地址
@ -164,11 +179,15 @@ export default {
});
return;
}
if (!this.date || !this.time) {
return this.$utils.toast("请选择时间和日期");
}
let datetime = this.date + " " + this.time;
this.$models.order
.createOrder({
ids: this.orderData,
addid: this.addressId,
times: this.datetime,
times: datetime,
baoxian: this.insurance ? 1 : 0,
desc: this.content,
})

View File

@ -201,12 +201,16 @@ export default {
* 提交订单
*/
submit() {
if (!this.date || !this.time) {
return this.$utils.toast("请选择时间和日期");
}
let datetime = this.date + " " + this.time;
this.$models.service
.createDistributionOrder({
car: this.carTypeId,
address: this.pickupAddressId,
addressb: this.unloadAddressId,
starttime: this.date + " " + this.time,
starttime: datetime,
sendtime: 0,
distance: this.distance,
})