0309 听书

This commit is contained in:
@fawn-nine
2023-03-09 17:13:31 +08:00
parent aeed8684b1
commit 45cb5d66f7
8 changed files with 367 additions and 197 deletions

View File

@@ -39,7 +39,7 @@
<view class="itemPrice">
<text>{{item.price*item.productAmount}}</text>
<u-number-box v-model="item.productAmount" @change="valChange($event, item)" :input-width="50"
:input-height="20" :min="1" :max="item.productStock" integer @overlimit='overlimit'></u-number-box>
:input-height="20" :min="1" :max="item.productStock" integer ></u-number-box>
</view>
</view>
</view>
@@ -72,29 +72,39 @@
<view class="zhif_radio">
<u-radio-group v-model="payType">
<view style="width: 100%;">
<view v-for="(item, index) in paylist" @click="choseType(item.id)" class="zhif_xuanx">
<view v-for="(item, index) in paylist" class="zhif_xuanx">
<image :src="item.img"></image>
{{item.title}}
<span v-if="item.id == 4" style="color: #bbb; margin-left: 10px;">{{userMes.peanutCoin}}疯币可用</span>
<span @click.stop="buPoint" style="color: #bf0c0c; margin-left: 10px;" v-if="item.id == 4" class="chongBtn">去充值</span>
<u-radio :key="index" activeColor="#fe6e09" :name='item.id'
style="float: right;margin-top: 5rpx;"></u-radio>
style="float: right;margin-top: 5rpx;" ></u-radio>
</view>
</view>
</u-radio-group>
</view>
</view>
<view class="footer">
<view class="commodityPrice">
<view class="footer" >
<view class="commodityPrice" v-if="payType != 4">
<span style="color: #666;margin-right: 10rpx; font-size: 15px;">实付款: </span>
<span></span>{{realPrice}}
</view>
<view class="operate" @click="goBuyJie">
<view class="commodityPrice" v-if="payType == 4">
<span style="color: #666;margin-right: 10rpx; font-size: 15px;">实付款: </span>
{{realPrice}}<span>疯币</span>
</view>
<view class="operate" @click="goBuyJie" v-if="payType != 4">
<view class="goBuy">
立即支付
</view>
</view>
</view>
<view class="operate" @click="goPoinBuy" v-if="payType == 4">
<view class="goBuy">
立即支付
</view>
</view>
</view>
<!-- 地址弹出 -->
<u-popup :show="dizhiShow" :round="10" @close="dizhiShow=false">
<view class="tanchu">
@@ -185,6 +195,7 @@
shangIDNum: 0,
cartIDNum: [],
cartList: [],
userMes:{}, // 用户信息
amount:null, // 商品总价
addressList: [],
adressMoRen: {},
@@ -206,7 +217,12 @@
title: '支付宝',
id: 1,
img: '../../static/icon/pay_1.png'
}
},
{
title: '疯币购买',
id: 4,
img: '../../static/icon/oder_chong.png'
}
// {
// title: '微信',
// id: 2,
@@ -231,19 +247,41 @@
// this.getYunFei()
},
onShow() {
onShow() {
if (this.typeId == 1) {
this.getCartList()
} else if (this.typeId == 0) {
this.getShangList(this.shangIDNum);
}
// this.getUserAddress()
this.getData()
},
computed: {
...mapState(['userInfo']),
},
methods: {
// 充值疯币
buPoint() {
uni.navigateTo({
url: '../peanut/reCharge'
});
},
getData() {
let that = this
// 获取个人信息
// 用户详情
if (this.userInfo.id != undefined) {
this.$http
.post('book/user/info/' + this.userInfo.id)
.then(res => {
this.userMes = res.user
// consol.log(this.userMes.peanutCoin,'呼呼')
if (this.userMes.vip != 0) {
this.typeFen = 2
}
});
}
},
// 获取地址列表
getUserAddress() {
this.$http
@@ -264,7 +302,18 @@
}
})
},
goPoinBuy(){
if(this.realPrice > this.userMes.peanutCoin){
uni.showToast({
title:'疯币不足,请充值',
icon: 'error',
duration: 2000
})
return
}else{
this.goBuyJie()
}
},
// 获取优惠券列表
getCourpe() {
let proId = ''
@@ -470,7 +519,7 @@
city: this.adressMoRen.areaidpathtext.split(' ')[1], //市
district: this.adressMoRen.areaidpathtext.split(' ')[2], //区
address: this.adressMoRen.useraddress, //地址
paymentMethod: this.payType, //支付方式 1支付宝,2微信3ios内购
paymentMethod: this.payType, //支付方式 2支付宝,1微信3ios内购 4疯币购买
orderMoney: this.totalPrice, //订单金额
realMoney: this.realPrice, //实收金额
shippingMoney: this.farePrice, //运费
@@ -482,8 +531,7 @@
products: xiaBiao, //订单列表
orderType: "order", //订单类型
addressId:this.adressMoRen.addressid // 地址ID
}
}
$http.request({
url: "book/buyorder/save",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
@@ -500,6 +548,8 @@
image: '../../static/icon/ic_close.png'
});
} else {
if(this.payType != 4){
// 常规支付
uni.showToast({
title: "正在支付",
icon: "loading"
@@ -534,6 +584,18 @@
}, 1000)
}
})
}else{
// 疯币支付
uni.showToast({
title: "购买成功",
icon: "success"
});
setTimeout(() => {
uni.navigateTo({
url: './orderList'
});
}, 1000)
}
}
@@ -875,4 +937,13 @@
border-color: #fd6004;
}
}
.chongBtn {
background-color: #54a966;
color: #fff !important;
margin-left: 20rpx;
border-radius: 10rpx;
padding: 2rpx 10rpx;
font-size: 20rpx;
display: inline-block;
}
</style>