|
@@ -40,11 +40,14 @@
|
|
|
<view class="choose-item">
|
|
|
<view class="item" @click="intoChooseCoupon">
|
|
|
<text>优惠卷</text>
|
|
|
- <view class="right">
|
|
|
+ <view v-if="checkedCoupon" class="right">
|
|
|
<u-icon name="gift" color="rgb(255,0,0)" size="32"></u-icon>
|
|
|
<text class="coopon">9.8元洗车券(¥-9.8)</text>
|
|
|
<u-icon name="arrow-right" color="rgb(255,0,0)" size="32"></u-icon>
|
|
|
</view>
|
|
|
+ <view v-else class="right">
|
|
|
+ <text >暂无可用优惠券</text>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
<view class="item phone">
|
|
|
<text>手机号码</text>
|
|
@@ -64,25 +67,24 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="step-footer">
|
|
|
- <button class="next-button" @click="nextStep" v-if="stepIndex!=2" type="warn">下一步</button>
|
|
|
- <view v-else class="pay">
|
|
|
- <text>合计:</text>
|
|
|
- <text class="amount">¥{{finalAmount}}</text>
|
|
|
- <view class="">
|
|
|
- <button :disabled="isRead!='read'" @click="toPay" type="warn">去付款</button>
|
|
|
- </view>
|
|
|
+ </view>
|
|
|
+ <view class="step-footer">
|
|
|
+ <button class="next-button" @click="nextStep" v-if="stepIndex!=2" type="warn">下一步</button>
|
|
|
+ <view v-else class="pay">
|
|
|
+ <text>合计:</text>
|
|
|
+ <text class="amount">¥{{finalAmount}}</text>
|
|
|
+ <view class="">
|
|
|
+ <button @click="handleSubmit" type="warn">去付款</button>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
-
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import uniSteps from '@/components/uni-steps/uni-steps.vue'
|
|
|
import {getUserInfo} from '@/api/login.js'
|
|
|
- import {getStoreItems, saveOrder} from '@/api/order.js'
|
|
|
+ import {getStoreItems, saveOrder, signPay} from '@/api/order.js'
|
|
|
export default {
|
|
|
components: {
|
|
|
uniSteps
|
|
@@ -268,8 +270,12 @@
|
|
|
url: '/pages/agreement/agreement'
|
|
|
})
|
|
|
},
|
|
|
- // 去付款
|
|
|
- toPay (){
|
|
|
+ // 去付款 保存订单
|
|
|
+ handleSubmit (){
|
|
|
+ if (this.isRead !='read') {
|
|
|
+ this.toashMsg('请先阅读并同意无人洗车《注意事项及服务协议》!')
|
|
|
+ return
|
|
|
+ }
|
|
|
uni.showLoading({
|
|
|
title: '请求中...',
|
|
|
mask: true
|
|
@@ -277,6 +283,7 @@
|
|
|
let item = this.itemList[this.serverIndex]
|
|
|
let params = {
|
|
|
"itemId": item.itemId, // 服务id
|
|
|
+ "itemCode": item.itemCode,
|
|
|
"storeId": 100000, // 门店id
|
|
|
"deviceId": 100000, // 设备id
|
|
|
"orderTime": this.$u.timeFormat(Date.now(), 'yyyy-mm-dd hh:MM:ss'),
|
|
@@ -284,19 +291,48 @@
|
|
|
"paymentAmount": this.finalAmount // 实收金额 即优惠后金额
|
|
|
}
|
|
|
saveOrder(params).then(res =>{
|
|
|
- uni.hideLoading()
|
|
|
if (res.status==200) {
|
|
|
+ let data = res.data
|
|
|
+ let orderId = res.data.id
|
|
|
+ // 保存成功后 请求预支付返回吊起微信支付所需参数
|
|
|
+ // this.getPayData(orderId)
|
|
|
// 付款成功后开始洗车
|
|
|
uni.redirectTo({
|
|
|
- url:"/pages/work/index/index"
|
|
|
+ url:`/pages/work/index/index?washCarType=${data.itemCode}&orderNo=${data.orderNo}`
|
|
|
})
|
|
|
} else {
|
|
|
+ uni.hideLoading()
|
|
|
// 刷新服务项
|
|
|
this.getServerList()
|
|
|
this.toashMsg(res.message)
|
|
|
}
|
|
|
})
|
|
|
-
|
|
|
+ },
|
|
|
+ // 预支付 返回微信支付所需参数
|
|
|
+ getPayData (id) {
|
|
|
+ signPay({orderId:id}).then(res =>{
|
|
|
+ console.log(res,'11111111')
|
|
|
+ uni.hideLoading()
|
|
|
+ if (res.status == 200) {
|
|
|
+ let data = res.data
|
|
|
+ uni.requestPayment({
|
|
|
+ provider: 'wxpay',
|
|
|
+ timeStamp: data.timeStamp,
|
|
|
+ nonceStr: data.nonceStr,
|
|
|
+ package: data.package,
|
|
|
+ signType: data.signType,
|
|
|
+ paySign: data.paySign,
|
|
|
+ success: function (res) {
|
|
|
+ console.log('success:' + JSON.stringify(res));
|
|
|
+ },
|
|
|
+ fail: function (err) {
|
|
|
+ console.log('fail:' + JSON.stringify(err));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.toashMsg(res.message)
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -327,23 +363,26 @@
|
|
|
align-items: center;
|
|
|
flex: 1;
|
|
|
}
|
|
|
+ // 第一步
|
|
|
.step-one{
|
|
|
text{
|
|
|
color: #999;
|
|
|
margin: 40rpx 0;
|
|
|
}
|
|
|
}
|
|
|
+ // 第二步
|
|
|
.step-two{
|
|
|
background-color: #F8F8F8;
|
|
|
+ justify-content: space-around;
|
|
|
.item{
|
|
|
background-color: #fff;
|
|
|
width: 80%;
|
|
|
- height: 40%;
|
|
|
+ height: 45%;
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
align-items: center;
|
|
|
- margin-top: 20rpx;
|
|
|
- padding-top: 20rpx;
|
|
|
+ // margin-top: 20rpx;
|
|
|
+ // padding-top: 20rpx;
|
|
|
image{
|
|
|
width: 80%;
|
|
|
flex: 1;
|
|
@@ -353,7 +392,7 @@
|
|
|
text{
|
|
|
color: #df928e;
|
|
|
font-size: 24rpx;
|
|
|
- margin-bottom: 20rpx;
|
|
|
+ // margin-top: 20rpx;
|
|
|
}
|
|
|
.care{
|
|
|
padding: 10rpx 20rpx;
|
|
@@ -361,16 +400,19 @@
|
|
|
border-radius: 30rpx;
|
|
|
color: #fff;
|
|
|
font-size: 24rpx;
|
|
|
- margin-bottom: 10rpx;
|
|
|
+ margin-bottom: 20rpx;
|
|
|
}
|
|
|
}
|
|
|
.bottom{
|
|
|
text{
|
|
|
font-size: 24rpx;
|
|
|
color: #333;
|
|
|
+ padding-top: 20rpx;
|
|
|
+ // margin-top: 20rpx;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ // 第三步 下单
|
|
|
.step-three{
|
|
|
.choose{
|
|
|
width: 100%;
|
|
@@ -452,33 +494,32 @@
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- .step-footer{
|
|
|
+ }
|
|
|
+ .step-footer{
|
|
|
+ width: 100%;
|
|
|
+ background-color: #fff;
|
|
|
+ .next-button{
|
|
|
+ margin: 0;
|
|
|
+ border-radius: 0;
|
|
|
+ padding: 10rpx 0;
|
|
|
+ }
|
|
|
+ .pay{
|
|
|
width: 100%;
|
|
|
- background-color: #fff;
|
|
|
- .next-button{
|
|
|
- margin: 0;
|
|
|
- border-radius: 0;
|
|
|
- padding: 10rpx 0;
|
|
|
+ height: 100%;
|
|
|
+ padding: 10rpx;
|
|
|
+ border-top: 1px solid #eee;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: flex-end;
|
|
|
+ .amount{
|
|
|
+ color: rgb(255,0,0);
|
|
|
+ font-size: 36rpx;
|
|
|
+ margin-right: 40rpx;
|
|
|
}
|
|
|
- .pay{
|
|
|
- width: 100%;
|
|
|
- height: 100%;
|
|
|
- padding: 10rpx;
|
|
|
- border-top: 1px solid #eee;
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- justify-content: flex-end;
|
|
|
- .amount{
|
|
|
- color: rgb(255,0,0);
|
|
|
- font-size: 36rpx;
|
|
|
- margin-right: 40rpx;
|
|
|
- }
|
|
|
- button{
|
|
|
- width: 200rpx;
|
|
|
- }
|
|
|
+ button{
|
|
|
+ width: 200rpx;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
</style>
|