|
|
|
@ -56,14 +56,16 @@ |
|
|
|
|
<view class="item"> |
|
|
|
|
<view class="a">服务时间</view> |
|
|
|
|
<view class="b" @click="openPage(1)"> |
|
|
|
|
<view class="select">{{server_time?server_time:'请选择预约到店时间'}}</view> |
|
|
|
|
<view class="select" :class="server_time?'select-on':''">{{server_time?server_time:'请选择预约到店时间'}}</view> |
|
|
|
|
<u-icon style="margin-left: 10rpx;" name="arrow-right"></u-icon> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
<view class="item"> |
|
|
|
|
<view class="a">优惠券</view> |
|
|
|
|
<view class="b" @click="openPage(2)"> |
|
|
|
|
<view class="select" :class="couponIndex >= 0?'select-on':''">{{couponIndex >= 0? couponList[couponIndex].name:'暂无优惠券'}}</view> |
|
|
|
|
<view class="select" :class="couponIndex >= 0?'select-on':''"> |
|
|
|
|
{{couponIndex >= 0? couponList[couponIndex].name:(couponList.length > 0?'请选择优惠券':'暂无优惠券')}} |
|
|
|
|
</view> |
|
|
|
|
<u-icon style="margin-left: 10rpx;" name="arrow-right"></u-icon> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
@ -94,19 +96,28 @@ |
|
|
|
|
<view class="item" v-if="tabIndex == 3"> |
|
|
|
|
<view class="a">发件地址</view> |
|
|
|
|
<view class="b"> |
|
|
|
|
<picker mode="region"> |
|
|
|
|
<picker mode="region"> |
|
|
|
|
<view class="select">请选择所在人城市</view> |
|
|
|
|
</picker> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
<view class="item" v-if="type == 1"> |
|
|
|
|
<view class="a">发件地址</view> |
|
|
|
|
<view class="a">所在城市</view> |
|
|
|
|
<view class="b"> |
|
|
|
|
<picker :value="region" @change="changeRegion" mode="region"> |
|
|
|
|
<view class="select">请选择所在人城市</view> |
|
|
|
|
<picker @change="changeRegion" mode="region"> |
|
|
|
|
<view class="select" :class="region.length>0?'select-on':''"> |
|
|
|
|
{{ |
|
|
|
|
region.length > 0?region[0]+region[1]+region[2]:'请选择所在人城市' |
|
|
|
|
}}</view> |
|
|
|
|
</picker> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
<view class="item" v-if="type == 1"> |
|
|
|
|
<view class="a">详细地址</view> |
|
|
|
|
<view class="b"> |
|
|
|
|
<input class="box" v-model="address" type="text" placeholder="例:12幢1单元102室" /> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
<view class="item" v-if="tabIndex == 3"> |
|
|
|
|
<view class="a">门牌号</view> |
|
|
|
|
<view class="b"> |
|
|
|
@ -133,9 +144,9 @@ |
|
|
|
|
<view class="remark" style="margin-top: 20rpx;"> |
|
|
|
|
<view class="name">备注 :</view> |
|
|
|
|
<view class="xu"> |
|
|
|
|
<view class="li">可提前来</view> |
|
|
|
|
<view class="li">来之前打电话</view> |
|
|
|
|
<view class="li">请尽快联系我</view> |
|
|
|
|
<view class="li" @click="openPage(5,'可提前来')">可提前来</view> |
|
|
|
|
<view class="li" @click="openPage(5,'来之前打电话')">来之前打电话</view> |
|
|
|
|
<view class="li" @click="openPage(5,'请尽快联系我')">请尽快联系我</view> |
|
|
|
|
</view> |
|
|
|
|
<view class="content"> |
|
|
|
|
<u-input v-model="remake" height="260" type="textarea" placeholder="请输入您的留言,最多可留言100字" :border="true" /> |
|
|
|
@ -146,8 +157,10 @@ |
|
|
|
|
<view class="recycling-fd"> |
|
|
|
|
<view class="a" v-if="type==2">免支付预购</view> |
|
|
|
|
<view class="c" v-else style="color: #FE483B;font-size: 30rpx;">¥{{pay_price}}元</view> |
|
|
|
|
<view class="b" @click="openPage(2)">提交订单</view> |
|
|
|
|
<view class="b" @click="openPage(3)">提交订单</view> |
|
|
|
|
</view> |
|
|
|
|
<!-- 微信支付方式 --> |
|
|
|
|
<u-action-sheet :list="list2" v-model="show2" @click="clickPay" @close="closeAction"></u-action-sheet> |
|
|
|
|
<!-- 选择优惠券 --> |
|
|
|
|
<u-popup v-model="isShow" mode="bottom" border-radius="12" mask-close-able="false" closeable> |
|
|
|
|
<view class="recycling-classify"> |
|
|
|
@ -155,7 +168,7 @@ |
|
|
|
|
<view class="recycling-classify-bd"> |
|
|
|
|
<scroll-view scroll-y class="m"> |
|
|
|
|
<view class="item" @click="tabMItem('-9999')"><view :class="couponIndex == -9999?'item-on':''">不使用</view></view> |
|
|
|
|
<view class="item" v-for="(a,i) in couponList" @click="tabMItem(i)"><view :class="couponIndex == i?'item-on':''">{{a.name}}</view></view> |
|
|
|
|
<view class="item" v-for="(a,i) in couponList" :key="i" @click="tabMItem(a,i)"><view :class="couponIndex == i?'item-on':''">{{a.name}}</view></view> |
|
|
|
|
</scroll-view> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
@ -177,11 +190,16 @@ |
|
|
|
|
minute: true, |
|
|
|
|
second: true |
|
|
|
|
}, |
|
|
|
|
userInfo: {}, |
|
|
|
|
orderInfo: {}, |
|
|
|
|
list2: [], |
|
|
|
|
pay_price: 0, |
|
|
|
|
show2: true, |
|
|
|
|
isShow: false, |
|
|
|
|
show: false, |
|
|
|
|
info: {}, |
|
|
|
|
type: 1, |
|
|
|
|
isClick: true, |
|
|
|
|
radioValue: "男士", |
|
|
|
|
couponIndex: -9999, |
|
|
|
|
tabIndex: 1, |
|
|
|
@ -199,7 +217,8 @@ |
|
|
|
|
server_time: "", |
|
|
|
|
region: [], |
|
|
|
|
couponList: [], |
|
|
|
|
server_id: "" |
|
|
|
|
server_id: "", |
|
|
|
|
order_id: "" |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
onLoad(o) { |
|
|
|
@ -210,8 +229,23 @@ |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
tabMItem(i) { |
|
|
|
|
clickPay(i){ |
|
|
|
|
if(this.list2[i].method == "balance"){ |
|
|
|
|
console.log(this.orderInfo.pay_price <= this.userInfo.balance) |
|
|
|
|
console.log(this.orderInfo.pay_price , this.userInfo.balance) |
|
|
|
|
if(Number(this.orderInfo.pay_price) <= Number(this.userInfo.balance)){ |
|
|
|
|
this.toPay() |
|
|
|
|
}else{ |
|
|
|
|
uni.showToast({ |
|
|
|
|
icon: "none", |
|
|
|
|
title: "余额不足,请选择其他支付方式" |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
tabMItem(a,i) { |
|
|
|
|
this.couponIndex = i |
|
|
|
|
this.coupon_id = a.coupon_id |
|
|
|
|
this.isShow = false; |
|
|
|
|
this.getServerCheckOrder(1) |
|
|
|
|
}, |
|
|
|
@ -224,38 +258,161 @@ |
|
|
|
|
if(status == 200){ |
|
|
|
|
this.info = data.info |
|
|
|
|
this.couponList= data.coupon_list; |
|
|
|
|
if(data.coupon_list && data.coupon_list.length > 0){ |
|
|
|
|
if(!type){ |
|
|
|
|
this.couponIndex = 0 |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
this.couponIndex = -9999 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.coupon_id= data.coupon_id |
|
|
|
|
this.coupon_money= data.coupon_money |
|
|
|
|
this.pay_price= data.pay_price |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
closeAction() { |
|
|
|
|
uni.redirectTo({ |
|
|
|
|
url: "/pages/news/recycling/order" |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
confirm(e){ |
|
|
|
|
this.server_time = e.year+"-"+e.month+'-'+e.day+" "+e.hour+"-"+e.minute+'-'+e.second |
|
|
|
|
}, |
|
|
|
|
changeRegion(e) { |
|
|
|
|
this.region = e |
|
|
|
|
console.log(e) |
|
|
|
|
this.region = e.detail.value |
|
|
|
|
}, |
|
|
|
|
tabItem(i) { |
|
|
|
|
this.tabIndex = i |
|
|
|
|
}, |
|
|
|
|
openPage(i){ |
|
|
|
|
openPage(i,a){ |
|
|
|
|
if(i == 1){ |
|
|
|
|
this.show = true |
|
|
|
|
}else if(i == 2) { |
|
|
|
|
this.isShow = true |
|
|
|
|
}else if(i == 3) { |
|
|
|
|
if(this.orderInfo.pay_price){ |
|
|
|
|
this.show2 = true |
|
|
|
|
return ; |
|
|
|
|
} |
|
|
|
|
if(!this.server_time){ |
|
|
|
|
uni.showToast({ |
|
|
|
|
icon: "none", |
|
|
|
|
title: "服务时间不能为空" |
|
|
|
|
}) |
|
|
|
|
return ; |
|
|
|
|
} |
|
|
|
|
if(!this.username){ |
|
|
|
|
uni.showToast({ |
|
|
|
|
icon: "none", |
|
|
|
|
title: "联系人不能为空" |
|
|
|
|
}) |
|
|
|
|
return ; |
|
|
|
|
} |
|
|
|
|
if(!this.mobile){ |
|
|
|
|
uni.showToast({ |
|
|
|
|
icon: "none", |
|
|
|
|
title: "联系号码不能为空" |
|
|
|
|
}) |
|
|
|
|
return ; |
|
|
|
|
} |
|
|
|
|
if(this.region.length == 0){ |
|
|
|
|
uni.showToast({ |
|
|
|
|
icon: "none", |
|
|
|
|
title: "请选择所在城市" |
|
|
|
|
}) |
|
|
|
|
return ; |
|
|
|
|
} |
|
|
|
|
if(!this.address){ |
|
|
|
|
uni.showToast({ |
|
|
|
|
icon: "none", |
|
|
|
|
title: "详细地址不能为空" |
|
|
|
|
}) |
|
|
|
|
return ; |
|
|
|
|
} |
|
|
|
|
if(this.isClick == false){ |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
this.isClick = false; |
|
|
|
|
this.toServerCreateOrder(); |
|
|
|
|
}else if(i == 5){ |
|
|
|
|
this.remake = a |
|
|
|
|
}else { |
|
|
|
|
uni.redirectTo({ |
|
|
|
|
url: "/pages/news/recycling/order" |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
//去支付 |
|
|
|
|
async toPay() { |
|
|
|
|
const {status, message} = await newFunApi.serverOrderPay({ |
|
|
|
|
order_id: this.order_id, |
|
|
|
|
method: 'balance', |
|
|
|
|
client: "MP-WEIXIN", |
|
|
|
|
}) |
|
|
|
|
if(status == 200) { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: "支付成功" |
|
|
|
|
}) |
|
|
|
|
setTimeout(()=>{ |
|
|
|
|
uni.redirectTo({ |
|
|
|
|
url: "/pages/news/recycling/order" |
|
|
|
|
}) |
|
|
|
|
},1000) |
|
|
|
|
}else{ |
|
|
|
|
uni.showToast({ |
|
|
|
|
icon: "none", |
|
|
|
|
title: message |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
//创建订单 |
|
|
|
|
async toServerCreateOrder() { |
|
|
|
|
let {status, data, message } = await newFunApi.serverCreateOrder({ |
|
|
|
|
server_id: this.server_id, |
|
|
|
|
client: 'MP-WEIXIN', |
|
|
|
|
server_address: this.region[0]+this.region[1]+this.region[2]+this.address, |
|
|
|
|
server_time: this.server_time, |
|
|
|
|
coupon_id: this.coupon_id, |
|
|
|
|
remake: this.remake, |
|
|
|
|
username: this.username, |
|
|
|
|
mobile: this.mobile, |
|
|
|
|
}) |
|
|
|
|
if(status == 200){ |
|
|
|
|
this.isClick = true |
|
|
|
|
this.order_id = data.order_id |
|
|
|
|
this.toServerOrder(data.order_id) |
|
|
|
|
}else{ |
|
|
|
|
this.isClick = true |
|
|
|
|
uni.showToast({ |
|
|
|
|
icon: "none", |
|
|
|
|
title: message |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
//创建支付方式信息 |
|
|
|
|
async toServerOrder(order_id) { |
|
|
|
|
let {status, data, message } = await newFunApi.serverOrderInfo({ |
|
|
|
|
client: 'MP-WEIXIN', |
|
|
|
|
order_id |
|
|
|
|
}) |
|
|
|
|
if(status == 200){ |
|
|
|
|
this.isClick = true |
|
|
|
|
this.userInfo = data.personal |
|
|
|
|
this.orderInfo = data.order |
|
|
|
|
if(data.paymentMethods && data.paymentMethods.length > 0){ |
|
|
|
|
data.paymentMethods.map(a=>{ |
|
|
|
|
if(a.method=='wechat'){ |
|
|
|
|
a.text = "微信支付" |
|
|
|
|
}else if(a.method=='balance'){ |
|
|
|
|
a.text = "余额支付"+"(余额:"+data.personal.balance+"元)" |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
this.list2 = data.paymentMethods; |
|
|
|
|
this.show2 = true; |
|
|
|
|
}else{ |
|
|
|
|
this.isClick = true |
|
|
|
|
uni.showToast({ |
|
|
|
|
icon: "none", |
|
|
|
|
title: message |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
</script> |
|
|
|
|