|
@ -1,11 +1,64 @@ |
|
|
<template> |
|
|
<template> |
|
|
<view class="page"> |
|
|
<view class="page"> |
|
|
<!-- 导航栏 --> |
|
|
<!-- 导航栏 --> |
|
|
<navbar title="确认订单" leftClick @leftClick="$utils.navigateBack" bgColor="#E3441A" color="#fff" /> |
|
|
|
|
|
|
|
|
<navbar :title="titleMap[type]" leftClick @leftClick="$utils.navigateBack" bgColor="#E3441A" color="#fff" /> |
|
|
|
|
|
|
|
|
<view class="bac"></view> |
|
|
<view class="bac"></view> |
|
|
|
|
|
|
|
|
<view class="box"> |
|
|
<view class="box"> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 送礼 --> |
|
|
|
|
|
<view class="give-type" v-if="type == 'give'"> |
|
|
|
|
|
<view class="tab-box"> |
|
|
|
|
|
<view class="tab-item" :class="{'active': isGive === 1}" |
|
|
|
|
|
@click="isGive = 1"> |
|
|
|
|
|
<text>单人礼包</text> |
|
|
|
|
|
<text class="desc">送给1位好友,可同时送多件礼品</text> |
|
|
|
|
|
</view> |
|
|
|
|
|
<view class="tab-item" :class="{'active': isGive === 2}" |
|
|
|
|
|
@click="isGive = 2"> |
|
|
|
|
|
<text>多人礼包</text> |
|
|
|
|
|
<text class="desc">送给多位好友,每人1件礼品</text> |
|
|
|
|
|
</view> |
|
|
|
|
|
<view class="tab-item" :class="{'active': isGive === 3}" |
|
|
|
|
|
@click="isGive = 3"> |
|
|
|
|
|
<text>抽奖礼包</text> |
|
|
|
|
|
<text class="desc">好友抽奖,中奖者获得礼品</text> |
|
|
|
|
|
</view> |
|
|
|
|
|
</view> |
|
|
|
|
|
<!-- <view class="tips"> |
|
|
|
|
|
<text>支付后分享给好友收礼</text> |
|
|
|
|
|
<text class="guide" @click="$refs.popup.open('gift_guide')">指南</text> |
|
|
|
|
|
</view> --> |
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 多人礼包人数 --> |
|
|
|
|
|
<view class="cell-item" v-if="type == 'give' && isGive === 2"> |
|
|
|
|
|
<view class="cell-item-left"> |
|
|
|
|
|
<uv-icon name="gift" size="40" color="#E3441A"></uv-icon> |
|
|
|
|
|
<view class="user-name">礼包份数</view> |
|
|
|
|
|
</view> |
|
|
|
|
|
<view class="cell-item-right"> |
|
|
|
|
|
<view class="stepper"> |
|
|
|
|
|
<text class="minus" :class="{disabled: multiNum <= multiMinNum}" |
|
|
|
|
|
@click="multiNum > multiMinNum && multiNum--">-</text> |
|
|
|
|
|
<text class="num">{{multiNum}}</text> |
|
|
|
|
|
<text class="plus" :class="{disabled: multiNum >= multiMaxNum}" |
|
|
|
|
|
@click="multiNum < multiMaxNum && multiNum++">+</text> |
|
|
|
|
|
</view> |
|
|
|
|
|
</view> |
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 抽奖礼包说明 --> |
|
|
|
|
|
<view class="lucky-box" v-if="type == 'give' && isGive === 3"> |
|
|
|
|
|
<view class="title">抽奖规则</view> |
|
|
|
|
|
<view class="tips-list"> |
|
|
|
|
|
<view class="tip-item">• 好友参与抽奖</view> |
|
|
|
|
|
<view class="tip-item">• 系统随机抽取中奖者</view> |
|
|
|
|
|
<view class="tip-item">• 中奖者填写地址领取礼品</view> |
|
|
|
|
|
</view> |
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
|
<!-- 商品详情 --> |
|
|
<!-- 商品详情 --> |
|
|
<view class="product-item" v-for="item in payOrderProduct" :key="item.id"> |
|
|
<view class="product-item" v-for="item in payOrderProduct" :key="item.id"> |
|
|
<view class="img-box"> |
|
|
<view class="img-box"> |
|
@ -50,7 +103,7 @@ |
|
|
<image src="@/pages_order/static/createOrder/account.png" mode="widthFix" class="cell-icon"> |
|
|
<image src="@/pages_order/static/createOrder/account.png" mode="widthFix" class="cell-icon"> |
|
|
</image> |
|
|
</image> |
|
|
<view class="user-name">账户余额</view> |
|
|
<view class="user-name">账户余额</view> |
|
|
<view class="descript">(余额: {{ userInfo.money }})</view> |
|
|
|
|
|
|
|
|
<view class="descript">(余额: {{ riceInfo.balance }})</view> |
|
|
</view> |
|
|
</view> |
|
|
<view class="cell-item-right"> |
|
|
<view class="cell-item-right"> |
|
|
<uv-radio activeColor="#E3441A" |
|
|
<uv-radio activeColor="#E3441A" |
|
@ -162,6 +215,15 @@ |
|
|
agreement: false, |
|
|
agreement: false, |
|
|
coupon: {}, |
|
|
coupon: {}, |
|
|
payMethod : 0, |
|
|
payMethod : 0, |
|
|
|
|
|
isGive : 0, |
|
|
|
|
|
type : '', |
|
|
|
|
|
titleMap : { |
|
|
|
|
|
def : '确认订单', |
|
|
|
|
|
give : '送礼清单', |
|
|
|
|
|
}, |
|
|
|
|
|
multiNum: 2, // 多人礼包人数 |
|
|
|
|
|
multiMinNum: 2, // 最小人数 |
|
|
|
|
|
multiMaxNum: 100, // 最大人数 |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
computed: { |
|
|
computed: { |
|
@ -180,7 +242,11 @@ |
|
|
}, |
|
|
}, |
|
|
...mapState(['userInfo', 'payOrderProduct']), |
|
|
...mapState(['userInfo', 'payOrderProduct']), |
|
|
}, |
|
|
}, |
|
|
onLoad() { |
|
|
|
|
|
|
|
|
onLoad(args) { |
|
|
|
|
|
this.type = args.type || 'def' |
|
|
|
|
|
if(this.type == 'give'){ |
|
|
|
|
|
this.isGive = 1 |
|
|
|
|
|
} |
|
|
this.$store.commit('getUserInfo') |
|
|
this.$store.commit('getUserInfo') |
|
|
}, |
|
|
}, |
|
|
onShow() { |
|
|
onShow() { |
|
@ -292,6 +358,8 @@ |
|
|
num: this.payOrderProduct[0].num, |
|
|
num: this.payOrderProduct[0].num, |
|
|
shopId: this.payOrderProduct[0].id, |
|
|
shopId: this.payOrderProduct[0].id, |
|
|
payType : this.payMethod, |
|
|
payType : this.payMethod, |
|
|
|
|
|
isGive : this.isGive, |
|
|
|
|
|
memberNum : 1, |
|
|
} |
|
|
} |
|
|
api = 'createOrder' |
|
|
api = 'createOrder' |
|
|
// } |
|
|
// } |
|
@ -299,6 +367,9 @@ |
|
|
if(this.coupon.id){ |
|
|
if(this.coupon.id){ |
|
|
data.couponId = this.coupon.id |
|
|
data.couponId = this.coupon.id |
|
|
} |
|
|
} |
|
|
|
|
|
if(this.isGive == 2){ |
|
|
|
|
|
data.memberNum = this.multiNum |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
this.$api(api, data, res => { |
|
|
this.$api(api, data, res => { |
|
|
if (res.code == 200) { |
|
|
if (res.code == 200) { |
|
@ -308,41 +379,38 @@ |
|
|
title: '下单成功', |
|
|
title: '下单成功', |
|
|
icon: 'none' |
|
|
icon: 'none' |
|
|
}) |
|
|
}) |
|
|
setTimeout(uni.redirectTo, 700, { |
|
|
|
|
|
url: '/pages/index/order' |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
this.paySuccess(res) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
uni.requestPaymentWxPay(res) |
|
|
uni.requestPaymentWxPay(res) |
|
|
.then(res => { |
|
|
|
|
|
uni.showToast({ |
|
|
|
|
|
title: '下单成功', |
|
|
|
|
|
icon: 'none' |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
setTimeout(uni.redirectTo, 700, { |
|
|
|
|
|
url: '/pages/index/order' |
|
|
|
|
|
}) |
|
|
|
|
|
}).catch(n => { |
|
|
|
|
|
setTimeout(uni.redirectTo, 700, { |
|
|
|
|
|
url: '/pages/index/order' |
|
|
|
|
|
}) |
|
|
|
|
|
}) |
|
|
|
|
|
} else if (res.code == 902) { |
|
|
|
|
|
uni.showModal({ |
|
|
|
|
|
title: res.message, |
|
|
|
|
|
success(e) { |
|
|
|
|
|
if (e.confirm) { |
|
|
|
|
|
uni.redirectTo({ |
|
|
|
|
|
url: '/pages/index/order' |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
.then(res => { |
|
|
|
|
|
uni.showToast({ |
|
|
|
|
|
title: '下单成功', |
|
|
|
|
|
icon: 'none' |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
this.paySuccess(res) |
|
|
|
|
|
}).catch(n => { |
|
|
|
|
|
setTimeout(uni.redirectTo, 700, { |
|
|
|
|
|
url: '/pages/index/order' |
|
|
|
|
|
}) |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
|
|
|
paySuccess(res){ |
|
|
|
|
|
if(this.type == 'def'){ |
|
|
|
|
|
setTimeout(uni.redirectTo, 700, { |
|
|
|
|
|
url: '/pages/index/order' |
|
|
|
|
|
}) |
|
|
|
|
|
}else{ |
|
|
|
|
|
setTimeout(uni.redirectTo, 700, { |
|
|
|
|
|
url: `/pages_order/order/instantGift?id=${res.message}` |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
// 删除购物车 |
|
|
// 删除购物车 |
|
|
deleteCart(ids) { |
|
|
deleteCart(ids) { |
|
|
this.$api('deleteCart', { |
|
|
this.$api('deleteCart', { |
|
@ -362,6 +430,59 @@ |
|
|
background: $uni-color; |
|
|
background: $uni-color; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.give-type { |
|
|
|
|
|
background: #fff; |
|
|
|
|
|
border-radius: 20rpx; |
|
|
|
|
|
padding: 30rpx; |
|
|
|
|
|
margin-bottom: 20rpx; |
|
|
|
|
|
|
|
|
|
|
|
.tab-box { |
|
|
|
|
|
display: flex; |
|
|
|
|
|
justify-content: space-between; |
|
|
|
|
|
|
|
|
|
|
|
.tab-item { |
|
|
|
|
|
width: 30%; |
|
|
|
|
|
background: #F8F8F8; |
|
|
|
|
|
border-radius: 20rpx; |
|
|
|
|
|
padding: 20rpx; |
|
|
|
|
|
text-align: center; |
|
|
|
|
|
|
|
|
|
|
|
text { |
|
|
|
|
|
display: block; |
|
|
|
|
|
|
|
|
|
|
|
&.desc { |
|
|
|
|
|
font-size: 24rpx; |
|
|
|
|
|
color: #999; |
|
|
|
|
|
margin-top: 10rpx; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
&.active { |
|
|
|
|
|
background: rgba($uni-color, 0.1); |
|
|
|
|
|
color: $uni-color; |
|
|
|
|
|
|
|
|
|
|
|
.desc { |
|
|
|
|
|
color: $uni-color; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.tips { |
|
|
|
|
|
margin-top: 20rpx; |
|
|
|
|
|
font-size: 26rpx; |
|
|
|
|
|
color: #999; |
|
|
|
|
|
display: flex; |
|
|
|
|
|
align-items: center; |
|
|
|
|
|
justify-content: space-between; |
|
|
|
|
|
|
|
|
|
|
|
.guide { |
|
|
|
|
|
color: $uni-color; |
|
|
|
|
|
text-decoration: underline; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
.box { |
|
|
.box { |
|
|
padding: 20rpx; |
|
|
padding: 20rpx; |
|
|
margin-top: -150rpx; |
|
|
margin-top: -150rpx; |
|
@ -475,6 +596,35 @@ |
|
|
width: 10%; |
|
|
width: 10%; |
|
|
display: flex; |
|
|
display: flex; |
|
|
justify-content: flex-end; |
|
|
justify-content: flex-end; |
|
|
|
|
|
|
|
|
|
|
|
.stepper { |
|
|
|
|
|
display: flex; |
|
|
|
|
|
align-items: center; |
|
|
|
|
|
|
|
|
|
|
|
text { |
|
|
|
|
|
display: flex; |
|
|
|
|
|
align-items: center; |
|
|
|
|
|
justify-content: center; |
|
|
|
|
|
width: 44rpx; |
|
|
|
|
|
height: 44rpx; |
|
|
|
|
|
|
|
|
|
|
|
&.minus, &.plus { |
|
|
|
|
|
background: #F8F8F8; |
|
|
|
|
|
border-radius: 50%; |
|
|
|
|
|
font-size: 32rpx; |
|
|
|
|
|
|
|
|
|
|
|
&.disabled { |
|
|
|
|
|
color: #ccc; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
&.num { |
|
|
|
|
|
margin: 0 20rpx; |
|
|
|
|
|
color: $uni-color; |
|
|
|
|
|
font-size: 28rpx; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -564,5 +714,59 @@ |
|
|
color: #ffffff; |
|
|
color: #ffffff; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
.multi-box, .lucky-box { |
|
|
|
|
|
background: #fff; |
|
|
|
|
|
border-radius: 20rpx; |
|
|
|
|
|
padding: 30rpx; |
|
|
|
|
|
margin-bottom: 20rpx; |
|
|
|
|
|
|
|
|
|
|
|
.title { |
|
|
|
|
|
font-size: 28rpx; |
|
|
|
|
|
font-weight: 500; |
|
|
|
|
|
margin-bottom: 20rpx; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.multi-box { |
|
|
|
|
|
.stepper { |
|
|
|
|
|
display: flex; |
|
|
|
|
|
align-items: center; |
|
|
|
|
|
justify-content: center; |
|
|
|
|
|
|
|
|
|
|
|
text { |
|
|
|
|
|
display: flex; |
|
|
|
|
|
align-items: center; |
|
|
|
|
|
justify-content: center; |
|
|
|
|
|
width: 60rpx; |
|
|
|
|
|
height: 60rpx; |
|
|
|
|
|
|
|
|
|
|
|
&.minus, &.plus { |
|
|
|
|
|
background: #F8F8F8; |
|
|
|
|
|
border-radius: 50%; |
|
|
|
|
|
font-size: 36rpx; |
|
|
|
|
|
|
|
|
|
|
|
&.disabled { |
|
|
|
|
|
color: #ccc; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
&.num { |
|
|
|
|
|
margin: 0 40rpx; |
|
|
|
|
|
color: $uni-color; |
|
|
|
|
|
font-size: 32rpx; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.lucky-box { |
|
|
|
|
|
.tips-list { |
|
|
|
|
|
.tip-item { |
|
|
|
|
|
font-size: 26rpx; |
|
|
|
|
|
color: #666; |
|
|
|
|
|
line-height: 2; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
</style> |
|
|
</style> |