7.14
This commit is contained in:
@@ -26,7 +26,8 @@
|
||||
<view class="name u-line-2">{{ goods.goods_name }}</view>
|
||||
<view class="cart-info">
|
||||
<view class="price">¥{{ goods.goods_price }}</view>
|
||||
<u-number-box :input-width="38" :input-height="39" :size="22" bg-color="#FFFFFF" color="#FF780F" :index="g_index" v-model="goods.goods_num"></u-number-box>
|
||||
<!-- <u-number-box :input-width="38" :input-height="39" :size="22" bg-color="#FFFFFF" color="#FF780F" :index="g_index" v-model="goods.goods_num" :disabled="true"></u-number-box> -->
|
||||
<view>×{{ goods.goods_num }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -73,7 +74,7 @@
|
||||
</view>
|
||||
<view class="right">
|
||||
<view class="num">共件{{ orderInfo.store_cart_list | setTotalNumber }}商品</view>
|
||||
<view class="btn" @click="settlement">结算</view>
|
||||
<view class="btn" @click="sendOrder">结算</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -103,9 +104,10 @@ export default {
|
||||
let num = 0;
|
||||
for (const key in data) {
|
||||
if (data.hasOwnProperty(key)) {
|
||||
const element = data[key][0];
|
||||
console.log(element);
|
||||
num += element.goods_num;
|
||||
const element = data[key];
|
||||
element.forEach(item => {
|
||||
num += item.goods_num;
|
||||
})
|
||||
}
|
||||
}
|
||||
return num;
|
||||
@@ -115,18 +117,38 @@ export default {
|
||||
console.log(JSON.parse(option.info));
|
||||
this.orderInfo = JSON.parse(option.info);
|
||||
this.addressInfo = this.orderInfo.address_info;
|
||||
this.showTotalPrice();
|
||||
this.getFreight();
|
||||
},
|
||||
methods: {
|
||||
sendOrder() {
|
||||
// 拼接后端需要的数据形式
|
||||
let id = [], temp = '';
|
||||
const object = this.orderInfo.store_cart_list;
|
||||
for (const key in object) {
|
||||
if (object.hasOwnProperty(key)) {
|
||||
const element = object[key];
|
||||
element.forEach(item => {
|
||||
temp = item.cart_id + '|' + item.goods_num;
|
||||
id.push(temp);
|
||||
temp = '';
|
||||
})
|
||||
}
|
||||
}
|
||||
this.$u.api.sendOrder({
|
||||
ifcart: 1,
|
||||
// cart_id: ,
|
||||
address_id: this.addressInfo.area_id,
|
||||
cart_id: id,
|
||||
address_id: this.addressInfo.address_id,
|
||||
buy_city_id: this.addressInfo.city_id,
|
||||
}).then(res => {
|
||||
|
||||
if(res.errCode == 0) {
|
||||
this.$u.route({
|
||||
url: '/pageC/cart/cashier',
|
||||
params: {
|
||||
pay_sn: res.data.pay_sn,
|
||||
price: res.data.order_total_amount,
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
getFreight() {
|
||||
@@ -198,6 +220,7 @@ export default {
|
||||
.main {
|
||||
margin-bottom: 50rpx;
|
||||
> view {
|
||||
margin-bottom: 20rpx;
|
||||
.goods-info {
|
||||
background-color: #ffffff;
|
||||
padding: 30rpx;
|
||||
|
||||
188
pageC/cart/cashier.vue
Normal file
188
pageC/cart/cashier.vue
Normal file
@@ -0,0 +1,188 @@
|
||||
<template>
|
||||
<view class="cashier">
|
||||
<view class="top">
|
||||
<view class="title">支付金额</view>
|
||||
<view class="price">¥{{ price }}</view>
|
||||
</view>
|
||||
<view class="pay-view">
|
||||
<u-radio-group v-model="pay_way" @change="radioGroupChange" size="16">
|
||||
<view v-for="(item, index) in payLiat" :key="index" class="pay-item">
|
||||
<view class="pay-way">
|
||||
<image :src="item.icon"></image>
|
||||
<text class="name">{{ item.pay_way }}</text>
|
||||
</view>
|
||||
<view class="radio-view" :class="pay_way == item.name ? 'active' : 'default'">
|
||||
<u-radio :name="item.name" active-color="#FF780F" :disabled="item.disabled"></u-radio>
|
||||
</view>
|
||||
</view>
|
||||
</u-radio-group>
|
||||
</view>
|
||||
<view class="pay-btn" @click="sendPay">去支付</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
payLiat: [
|
||||
{
|
||||
name: 'wxpay_app',
|
||||
icon: '/static/image/common/14.png',
|
||||
pay_way: '微信支付',
|
||||
disabled: false,
|
||||
},
|
||||
{
|
||||
name: 'alipay_app',
|
||||
icon: '/static/image/common/13.png',
|
||||
pay_way: '支付宝',
|
||||
disabled: false,
|
||||
}
|
||||
],
|
||||
pay_way: '',
|
||||
pay_sn: '',
|
||||
price: '',
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
this.pay_sn = option.pay_sn;
|
||||
this.price = option.price;
|
||||
},
|
||||
methods: {
|
||||
radioGroupChange(e) {
|
||||
// console.log(e);
|
||||
},
|
||||
// getProvider() {
|
||||
// uni.getProvider({service: 'payment'})
|
||||
// },
|
||||
// 支付宝支付
|
||||
payByAlipay (orderInfo) {
|
||||
uni.requestPayment({
|
||||
provider: 'alipay',
|
||||
orderInfo: orderInfo, //支付宝订单数据
|
||||
success: function (res) {
|
||||
console.log('success:' + JSON.stringify(res));
|
||||
},
|
||||
fail: function (err) {
|
||||
console.log('fail:' + JSON.stringify(err));
|
||||
}
|
||||
});
|
||||
},
|
||||
// 微信支付
|
||||
payByWxpay (orderInfo) {
|
||||
uni.requestPayment({
|
||||
provider: 'wxpay',
|
||||
orderInfo: orderInfo, //微信订单数据
|
||||
success: function (res) {
|
||||
console.log('success:' + JSON.stringify(res));
|
||||
},
|
||||
fail: function (err) {
|
||||
console.log('fail:' + JSON.stringify(err));
|
||||
}
|
||||
});
|
||||
},
|
||||
sendPay() {
|
||||
this.$u.api.sendPay({
|
||||
pay_sn: this.pay_sn,
|
||||
payment_code: this.pay_way,
|
||||
}).then(res => {
|
||||
if(res.errCode == 0) {
|
||||
// this.$u.toast(res.message);
|
||||
// uni.navigateBack();
|
||||
const orderInfo = JSON.parse(res.data.content);
|
||||
console.log(orderInfo);
|
||||
this.pay_way == 'wxpay_app' ? this.payByWxpay(orderInfo) : this.payByAlipay(orderInfo);
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.cashier {
|
||||
min-height: calc(100vh - var(--window-top));
|
||||
background-color: #ECECEC;
|
||||
padding-top: 1rpx;
|
||||
.top {
|
||||
margin-bottom: 20rpx;
|
||||
height: 240rpx;
|
||||
background:rgba(255,255,255,1);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
.title {
|
||||
font-size: 32rpx;
|
||||
color: rgba(51,51,51,1);
|
||||
margin-bottom: 50rpx;
|
||||
}
|
||||
.price {
|
||||
font-size: 42rpx;
|
||||
font-weight: 500;
|
||||
color: rgba(243,13,13,1);
|
||||
}
|
||||
}
|
||||
.pay-view {
|
||||
/deep/ .u-radio-group {
|
||||
width: 100%;
|
||||
flex-direction: column;
|
||||
.radio-view {
|
||||
padding: 6rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.active {
|
||||
border: 2rpx solid rgba(255,120,15,1);
|
||||
}
|
||||
.default {
|
||||
border: 2rpx solid rgba(219,219,219,1);
|
||||
}
|
||||
.u-radio {
|
||||
.u-icon {
|
||||
border-color: rgba(219,219,219,1);
|
||||
background-color: rgba(219,219,219,1);
|
||||
.u-icon__icon::before {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
.pay-item {
|
||||
height: 98rpx;
|
||||
background: rgba(255,255,255,1);
|
||||
padding: 24rpx 30rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 2rpx;
|
||||
.pay-way {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
> image {
|
||||
width: 50rpx;
|
||||
height: 50rpx;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
.name {
|
||||
font-size: 30rpx;
|
||||
color: rgba(51,51,51,1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.pay-btn {
|
||||
z-index: 9;
|
||||
position: fixed;
|
||||
bottom: 200rpx;
|
||||
left: 30rpx;
|
||||
width: 690rpx;
|
||||
height: 98rpx;
|
||||
background: rgba(255,120,15,1);
|
||||
border-radius: 49rpx;
|
||||
font-size: 36rpx;
|
||||
font-weight: 500;
|
||||
color: rgba(255,255,255,1);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -26,6 +26,9 @@
|
||||
</view>
|
||||
</view>
|
||||
</u-checkbox-group>
|
||||
<view class="empty-view">
|
||||
<u-empty mode="car" v-if="!list.length" :margin-top="240"></u-empty>
|
||||
</view>
|
||||
<view class="balance">
|
||||
<u-checkbox-group>
|
||||
<u-checkbox v-model="checkedAll" shape="circle" active-color="#FF780F" icon-size="35" label-size="30" @change="totalChange">
|
||||
@@ -85,6 +88,7 @@ export default {
|
||||
},
|
||||
// 结算
|
||||
settlementOrder() {
|
||||
if(!this.checkedGoods.length) return false;
|
||||
// 拼接后端需要的数据形式
|
||||
let id = [], temp = '';
|
||||
this.checkedGoods.forEach(item => {
|
||||
@@ -194,7 +198,6 @@ export default {
|
||||
onNavigationBarButtonTap(btn) {
|
||||
// console.log(btn);
|
||||
// #ifdef H5
|
||||
this.status = '完成';
|
||||
if(this.status == '编辑'){
|
||||
this.status = "完成";
|
||||
}else{
|
||||
@@ -227,6 +230,8 @@ export default {
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.cart {
|
||||
min-height: calc(100vh - var(--window-top));
|
||||
position: relative;
|
||||
padding-bottom: 100rpx;
|
||||
.cart-main {
|
||||
display: block;
|
||||
@@ -336,6 +341,12 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
.empty-view {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -100%);
|
||||
}
|
||||
.balance {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
|
||||
Reference in New Issue
Block a user