|
|
@ -29,12 +29,12 @@ |
|
|
|
<view class="box"> |
|
|
|
<image |
|
|
|
class="image" |
|
|
|
src="https://img95.699pic.com/photo/50058/1378.jpg_wh860.jpg" |
|
|
|
:src="unit.pic" |
|
|
|
mode=""></image> |
|
|
|
|
|
|
|
<view class="info"> |
|
|
|
<view class="price"> |
|
|
|
¥<text>299</text>元 |
|
|
|
¥<text>{{ unit.depositPrice }}</text>元 |
|
|
|
</view> |
|
|
|
<view class="unit"> |
|
|
|
请选择规格 |
|
|
@ -53,10 +53,10 @@ |
|
|
|
</view> |
|
|
|
<view class="list"> |
|
|
|
<view :class="{act : unitIndex == index}" |
|
|
|
v-for="(item, index) in 10" |
|
|
|
v-for="(item, index) in detail.hotelGoodsSkuList" |
|
|
|
@click="selectUnit(item, index)" |
|
|
|
:key="index"> |
|
|
|
120*40*75【桌子尺寸】 |
|
|
|
{{ item.title }} |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -69,20 +69,28 @@ |
|
|
|
费用明细 |
|
|
|
</view> |
|
|
|
<view class="detail"> |
|
|
|
押金:¥200 |
|
|
|
押金:¥{{ unit.depositPrice }} |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<!-- 提交按钮 --> |
|
|
|
<view class="submit-btn"> |
|
|
|
{{ submiitTitle }} |
|
|
|
<view class="l" |
|
|
|
@click="addCart"> |
|
|
|
加入租赁车 |
|
|
|
</view> |
|
|
|
<view class="r" |
|
|
|
@click="orderPay"> |
|
|
|
{{ submiitTitle }} |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
<uv-popup ref="addressPopup" :round="30"> |
|
|
|
<addressList |
|
|
|
:addressList="addressList" |
|
|
|
ref="addressList" |
|
|
|
height="60vh" |
|
|
|
@select="selectAddress" |
|
|
|
/> |
|
|
|
</uv-popup> |
|
|
@ -93,52 +101,44 @@ |
|
|
|
import addressList from '../address/addressList.vue' |
|
|
|
export default { |
|
|
|
components : { |
|
|
|
addressList |
|
|
|
addressList, |
|
|
|
}, |
|
|
|
props : { |
|
|
|
submiitTitle : { |
|
|
|
default : '立即租赁', |
|
|
|
type : String, |
|
|
|
}, |
|
|
|
detail : { |
|
|
|
default : {} |
|
|
|
} |
|
|
|
}, |
|
|
|
data() { |
|
|
|
return { |
|
|
|
unitIndex : 0, |
|
|
|
addressList: [ |
|
|
|
{ |
|
|
|
id : 1, |
|
|
|
name : 'xx', |
|
|
|
phone : '1305xxxx802', |
|
|
|
address : '广东省广州市越秀区', |
|
|
|
addressDetail : '城南故事C3栋2802', |
|
|
|
}, |
|
|
|
{ |
|
|
|
id : 2, |
|
|
|
name : 'xx', |
|
|
|
phone : '1305xxxx802', |
|
|
|
address : '广东省广州市越秀区', |
|
|
|
addressDetail : '城南故事C3栋2802', |
|
|
|
}, |
|
|
|
{ |
|
|
|
id : 3, |
|
|
|
name : 'xx', |
|
|
|
phone : '1305xxxx802', |
|
|
|
address : '广东省广州市越秀区', |
|
|
|
addressDetail : '城南故事C3栋2802', |
|
|
|
}, |
|
|
|
], |
|
|
|
address : { |
|
|
|
name : '请选择联系人', |
|
|
|
addressDetail : '', |
|
|
|
}, |
|
|
|
num : 1, |
|
|
|
unit : {}, |
|
|
|
addressTotal : 0, |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
// 打开 |
|
|
|
open(){ |
|
|
|
this.$refs.popup.open('bottom') |
|
|
|
if(!this.unit.id){ |
|
|
|
this.selectUnit(this.detail.hotelGoodsSkuList[0], 0) |
|
|
|
} |
|
|
|
|
|
|
|
// 获取地址列表 |
|
|
|
this.$refs.addressList.getAddressList().then(res => { |
|
|
|
this.addressTotal = res.total |
|
|
|
if(this.addressTotal != 0){ |
|
|
|
this.address = res.records[0] |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 关闭 |
|
|
|
close(){ |
|
|
@ -146,9 +146,10 @@ |
|
|
|
}, |
|
|
|
// 打开选择地址 |
|
|
|
openAddress(){ |
|
|
|
if (!this.addressList.length) { |
|
|
|
if (this.addressTotal == 0) { |
|
|
|
this.$refs.popup.close() |
|
|
|
return uni.navigateTo({ |
|
|
|
url: '/pages_order/mine/address' |
|
|
|
url: '/pages_order/mine/address?type=back' |
|
|
|
}) |
|
|
|
} |
|
|
|
this.$refs.addressPopup.open('bottom') |
|
|
@ -163,6 +164,68 @@ |
|
|
|
this.unit = item |
|
|
|
this.unitIndex = index |
|
|
|
}, |
|
|
|
addCart(){ |
|
|
|
this.$api('cartAdd', { |
|
|
|
id : this.detail.id, |
|
|
|
skuId : this.unit.id, |
|
|
|
}, res => { |
|
|
|
if(res.code == 200){ |
|
|
|
uni.showToast({ |
|
|
|
title: '添加成功', |
|
|
|
}); |
|
|
|
this.$refs.popup.close() |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
orderPay(){ |
|
|
|
|
|
|
|
let data = { |
|
|
|
id : this.detail.id,//商品id |
|
|
|
skuId : this.unit.id,//规格id |
|
|
|
addressId : this.address.id,//地址id |
|
|
|
sku : this.unit.title,//规格 |
|
|
|
num : this.num, |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(this.$utils.verificationAll(data, { |
|
|
|
skuId : '请选择规格', |
|
|
|
addressId : '请选择地址', |
|
|
|
})){ |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
this.$api('orderPay', data, res => { |
|
|
|
if(res.code == 200){ |
|
|
|
|
|
|
|
uni.redirectTo({ |
|
|
|
url: '/pages/index/order' |
|
|
|
}) |
|
|
|
|
|
|
|
// uni.requestPayment({ |
|
|
|
// provider: 'wxpay', // 服务提提供商 |
|
|
|
// timeStamp: res.result.timeStamp, // 时间戳 |
|
|
|
// nonceStr: res.result.nonceStr, // 随机字符串 |
|
|
|
// package: res.result.packageValue, |
|
|
|
// signType: res.result.signType, // 签名算法 |
|
|
|
// paySign: res.result.paySign, // 签名 |
|
|
|
// success: function (res) { |
|
|
|
// console.log('支付成功',res); |
|
|
|
// uni.redirectTo({ |
|
|
|
// url: '/pages/index/order' |
|
|
|
// }) |
|
|
|
// }, |
|
|
|
// fail: function (err) { |
|
|
|
// console.log('支付失败',err); |
|
|
|
// uni.showToast({ |
|
|
|
// icon:'none', |
|
|
|
// title:"支付失败" |
|
|
|
// }) |
|
|
|
// } |
|
|
|
// }); |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
@ -273,7 +336,6 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
.submit-btn{ |
|
|
|
background: $uni-color; |
|
|
|
width: 600rpx; |
|
|
|
height: 80rpx; |
|
|
|
color: #fff; |
|
|
@ -283,6 +345,23 @@ |
|
|
|
display: flex; |
|
|
|
justify-content: center; |
|
|
|
align-items: center; |
|
|
|
border: 1rpx solid $uni-color; |
|
|
|
overflow: hidden; |
|
|
|
.l{ |
|
|
|
flex: 1; |
|
|
|
display: flex; |
|
|
|
justify-content: center; |
|
|
|
align-items: center; |
|
|
|
color: $uni-color; |
|
|
|
} |
|
|
|
.r{ |
|
|
|
background: $uni-color; |
|
|
|
flex: 1; |
|
|
|
height: 100%; |
|
|
|
display: flex; |
|
|
|
justify-content: center; |
|
|
|
align-items: center; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
</style> |