【订单确认】

1. 接入价格信息
2. 调整 address 的获取
pull/1/MERGE
YunaiV 2023-06-30 22:44:36 +08:00
parent fe955e9fb1
commit 1a8c321ca7
1 changed files with 125 additions and 126 deletions

View File

@ -3,13 +3,13 @@
<view class='order-submission'> <view class='order-submission'>
<view class="allAddress" :style="store_self_mention ? '':'padding-top:10rpx;'"> <view class="allAddress" :style="store_self_mention ? '':'padding-top:10rpx;'">
<view class="nav acea-row"> <view class="nav acea-row">
<view class="item font-color" :class="shippingType === 1 ? 'on' : 'on2'" <view class="item font-color" :class="deliveryType === 1 ? 'on' : 'on2'"
@tap="addressType(0)" v-if='store_self_mention' />
<view class="item font-color" :class="shippingType === 2 ? 'on' : 'on2'"
@tap="addressType(1)" v-if='store_self_mention' /> @tap="addressType(1)" v-if='store_self_mention' />
<view class="item font-color" :class="deliveryType === 2 ? 'on' : 'on2'"
@tap="addressType(2)" v-if='store_self_mention' />
</view> </view>
<!-- 收货地址的选择 --> <!-- 收货地址的选择 -->
<view class='address acea-row row-between-wrapper' @tap='onAddress' v-if='shippingType === 1' <view class='address acea-row row-between-wrapper' @tap='onAddress' v-if='deliveryType === 1'
:style="store_self_mention ? '':'border-top-left-radius: 14rpx;border-top-right-radius: 14rpx;'"> :style="store_self_mention ? '':'border-top-left-radius: 14rpx;border-top-right-radius: 14rpx;'">
<view class='addressCon' v-if="addressInfo.name"> <view class='addressCon' v-if="addressInfo.name">
<view class='name'>{{ addressInfo.name }} <view class='name'>{{ addressInfo.name }}
@ -47,6 +47,7 @@
</view> </view>
<view class="pad30"> <view class="pad30">
<orderGoods :cartInfo="cartInfo" /> <orderGoods :cartInfo="cartInfo" />
<!-- 优惠劵展示 -->
<view class='wrapper borRadius14'> <view class='wrapper borRadius14'>
<view class='item acea-row row-between-wrapper' @tap='couponTap' <view class='item acea-row row-between-wrapper' @tap='couponTap'
v-if="orderInfoVo.type === 1 && productType==='normal'"> v-if="orderInfoVo.type === 1 && productType==='normal'">
@ -55,29 +56,31 @@
<text class='iconfont icon-jiantou'></text> <text class='iconfont icon-jiantou'></text>
</view> </view>
</view> </view>
<!-- 积分展示 TODO -->
<view class='item acea-row row-between-wrapper' <view class='item acea-row row-between-wrapper' v-if="orderInfoVo.type === 1 && productType==='normal'">
v-if="orderInfoVo.type === 1 && productType==='normal'">
<view>积分抵扣</view> <view>积分抵扣</view>
<!-- -->
<view class='discount acea-row row-middle'> <view class='discount acea-row row-middle'>
<view> {{useIntegral ? "剩余积分":"当前积分"}} <view> {{pointStatus ? "剩余积分":"当前积分"}}
<text class='num font-color'>{{useIntegral ? orderInfoVo.surplusIntegral : orderInfoVo.userIntegral || 0}}</text> <text class='num font-color'>
{{pointStatus ? orderInfoVo.totalPoint - orderInfoVo.usedPoint : (orderInfoVo.totalPoint || 0) }}
</text>
</view> </view>
<checkbox-group @change="ChangeIntegral"> <checkbox-group @change="ChangeIntegral">
<checkbox :checked='useIntegral ? true : false' :disabled="orderInfoVo.userIntegral==0 && !useIntegral"/> <checkbox :checked='pointStatus' :disabled="orderInfoVo.totalPoint === 0 && !pointStatus"/>
</checkbox-group> </checkbox-group>
</view> </view>
</view> </view>
<!-- VIP 展示 TODO -->
<!-- <view class='item acea-row row-between-wrapper' <!-- <view class='item acea-row row-between-wrapper'
v-if="priceGroup.vipPrice > 0 && userInfo.vip && !pinkId && !BargainId && !combinationId && !seckillId"> v-if="priceGroup.vipPrice > 0 && userInfo.vip && !pinkId && !BargainId && !combinationId && !seckillId">
<view>会员优惠</view> <view>会员优惠</view>
<view class='discount'>-{{priceGroup.vipPrice}}</view> <view class='discount'>-{{priceGroup.vipPrice}}</view>
</view> --> </view> -->
<view class='item acea-row row-between-wrapper' v-if='shippingType === 1'> <!-- 配送展示 TODO -->
<view class='item acea-row row-between-wrapper' v-if='deliveryType === 1'>
<view>快递费用</view> <view>快递费用</view>
<view class='discount' v-if='parseFloat(orderInfoVo.freightFee) > 0'> <view class='discount' v-if='orderInfoVo.price.deliveryPrice > 0'>
+{{orderInfoVo.freightFee}} +{{ fen2yuan(orderInfoVo.price.deliveryPrice) }}
</view> </view>
<view class='discount' v-else></view> <view class='discount' v-else></view>
</view> </view>
@ -85,24 +88,26 @@
<view class="item acea-row row-between-wrapper"> <view class="item acea-row row-between-wrapper">
<view>联系人</view> <view>联系人</view>
<view class="discount textR"> <view class="discount textR">
<input type="text" placeholder="请填写您的联系姓名" placeholder-style="color:#ccc;" placeholder-class="placeholder" <input type="text" placeholder="请填写您的联系姓名" placeholder-style="color:#ccc;"
@blur='realName' /> placeholder-class="placeholder" @blur='realName' />
</view> </view>
</view> </view>
<view class="item acea-row row-between-wrapper"> <view class="item acea-row row-between-wrapper">
<view>联系电话</view> <view>联系电话</view>
<view class="discount textR"> <view class="discount textR">
<input type="text" placeholder="请填写您的联系电话" placeholder-style="color:#ccc;" placeholder-class="placeholder" <input type="text" placeholder="请填写您的联系电话" placeholder-style="color:#ccc;"
@blur='phone'></input> placeholder-class="placeholder" @blur='phone' />
</view> </view>
</view> </view>
</view> </view>
<view class='item' v-if="textareaStatus"> <view class='item' v-if="textareaStatus">
<view>备注信息</view> <view>备注信息</view>
<textarea v-if="coupon.coupon===false" placeholder-class='placeholder' @input='bindHideKeyboard' <textarea v-if="coupon.coupon === false" placeholder-class='placeholder'
value="" name="mark" placeholder='请添加备注150字以内'></textarea> @input='bindHideKeyboard' value="" name="mark" placeholder='请添加备注150字以内' />
</view> </view>
</view> </view>
<!-- TODO 芋艿支付方式 -->
<view class='wrapper borRadius14'> <view class='wrapper borRadius14'>
<view class='item'> <view class='item'>
<view>支付方式</view> <view>支付方式</view>
@ -121,29 +126,30 @@
</view> </view>
</view> </view>
</view> </view>
<!-- 各种价格 -->
<view class='moneyList borRadius14'> <view class='moneyList borRadius14'>
<view class='item acea-row row-between-wrapper'> <view class='item acea-row row-between-wrapper'>
<view>商品总价</view> <view>商品总价</view>
<view class='money'>{{orderInfoVo.proTotalFee || 0}}</view> <view class='money'>{{ fen2yuan(orderInfoVo.price.totalPrice || 0 ) }}</view>
</view> </view>
<view class='item acea-row row-between-wrapper' v-if="orderInfoVo.couponFee > 0"> <view class='item acea-row row-between-wrapper' v-if="orderInfoVo.price.couponPrice > 0">
<view>优惠券抵扣</view> <view>优惠券抵扣</view>
<view class='money'>-{{orderInfoVo.couponFee}}</view> <view class='money'>-{{ fen2yuan(orderInfoVo.price.couponPrice) }}</view>
</view> </view>
<view class='item acea-row row-between-wrapper' v-if="orderInfoVo.deductionPrice > 0"> <view class='item acea-row row-between-wrapper' v-if="orderInfoVo.price.pointPrice > 0">
<view>积分抵扣</view> <view>积分抵扣</view>
<view class='money'>-{{orderInfoVo.deductionPrice}}</view> <view class='money'>-{{ fen2yuan(orderInfoVo.price.pointPrice) }}</view>
</view> </view>
<view class='item acea-row row-between-wrapper' v-if="orderInfoVo.freightFee > 0"> <view class='item acea-row row-between-wrapper' v-if="orderInfoVo.price.deliveryPrice > 0">
<view>运费</view> <view>运费</view>
<view class='money'>+{{orderInfoVo.freightFee}}</view> <view class='money'>+{{ fen2yuan(orderInfoVo.price.deliveryPrice) }}</view>
</view> </view>
</view> </view>
<view style='height:120rpx;'></view> <view style='height:120rpx;'></view>
</view> </view>
<view class='footer acea-row row-between-wrapper'> <view class='footer acea-row row-between-wrapper'>
<view>合计: <view>合计:
<text class='font-color'>{{orderInfoVo.payFee || 0}}</text> <text class='font-color'>{{ fen2yuan(orderInfoVo.price.payPrice || 0) }}</text>
</view> </view>
<view class='settlement' style='z-index:100' @tap="SubOrder"></view> <view class='settlement' style='z-index:100' @tap="SubOrder"></view>
</view> </view>
@ -201,7 +207,10 @@
return { return {
items: [], // items: [], //
cartInfo: [], // cartInfo: [], //
orderInfoVo: {}, // orderInfoVo: { //
type: 1, //
price: {} //
},
// TODO // TODO
textareaStatus: true, textareaStatus: true,
@ -226,17 +235,10 @@
userInfo: {}, // userInfo: {}, //
mark: '', // mark: '', //
coupon_price: 0, //
useIntegral: false, //使
integral_price: 0, //
integral: 0,
status: 0, status: 0,
toPay: false, // toPay: false, //
contacts: '',
contactsTel: '',
priceGroup: {}, priceGroup: {},
animated: false, animated: false,
totalPrice: 0,
pagesUrl: "", pagesUrl: "",
payChannel: '', payChannel: '',
bargain: false, // bargain: false, //
@ -244,6 +246,12 @@
secKill: false, // secKill: false, //
preOrderNo: '', // preOrderNo: '', //
// TODO
totalPrice: 0,
// ========== ==========
pointStatus: false, //使
// ========== ========== // ========== ==========
couponId: 0, // id couponId: 0, // id
couponTitle: '请选择', // couponTitle: '请选择', //
@ -254,7 +262,7 @@
}, },
// ========== ========== // ========== ==========
shippingType: 1, // 1 - 2 - deliveryType: 1, // 1 - 2 -
addressId: 0, // param id addressId: 0, // param id
addressInfo: {}, // addressInfo: {}, //
address: { // address: { //
@ -268,6 +276,8 @@
store_self_mention: false, // store_self_mention: false, //
storeList: [], // storeList: [], //
system_store: {}, // system_store: {}, //
contacts: '', //
contactsTel: '', //
}; };
}, },
computed: mapGetters(['isLogin', 'systemPlatform', 'productType']), computed: mapGetters(['isLogin', 'systemPlatform', 'productType']),
@ -276,7 +286,6 @@
handler: function(newV, oldV) { handler: function(newV, oldV) {
if (newV) { if (newV) {
this.getloadPreOrder(); this.getloadPreOrder();
this.getaddressInfo();
} }
}, },
deep: true deep: true
@ -310,7 +319,6 @@
// address // address
this.addressId = options.addressId || 0; this.addressId = options.addressId || 0;
this.getaddressInfo();
// //
DeliveryApi.getDeliveryConfig().then(res => { DeliveryApi.getDeliveryConfig().then(res => {
this.store_self_mention = res.data.pickUpEnable && this.productType === 'normal'; this.store_self_mention = res.data.pickUpEnable && this.productType === 'normal';
@ -322,10 +330,6 @@
onShow: function() { onShow: function() {
let _this = this let _this = this
this.textareaStatus = true; this.textareaStatus = true;
//
if (this.isLogin && !this.toPay) {
this.getaddressInfo();
}
// goods_details_store/index.vue // goods_details_store/index.vue
uni.$on("handClick", res => { uni.$on("handClick", res => {
@ -343,15 +347,18 @@
getloadPreOrder: function() { getloadPreOrder: function() {
OrderApi.settlementOrder({ OrderApi.settlementOrder({
items: this.items, items: this.items,
addressId: this.address.addressId > 0 && this.shippingType === 1 ? this.address.addressId : undefined, deliveryType: this.deliveryType,
shippingType: parseInt() + 1, addressId: this.address.addressId > 0 && this.deliveryType === 1 ? this.address.addressId : undefined,
receiverName: this.deliveryType === 2 ? this.contacts : undefined,
receiverMobile: this.deliveryType === 2 ? this.contactsTel : undefined,
couponId: this.couponId > 0 ? this.couponId : undefined, couponId: this.couponId > 0 ? this.couponId : undefined,
pointStatus: this.pointStatus,
// TODO // TODO
}).then(res => { }).then(res => {
const orderInfoVo = res.data const orderInfoVo = res.data
this.orderInfoVo = orderInfoVo; this.orderInfoVo = orderInfoVo;
this.cartInfo = orderInfoVo.items; this.cartInfo = orderInfoVo.items;
this.address.addressId = this.addressId ? this.addressId :orderInfoVo.addressId; this.changeAddress(orderInfoVo.address);
// TODO // TODO
this.cartArr[1].title = '可用余额:' + orderInfoVo.userBalance; this.cartArr[1].title = '可用余额:' + orderInfoVo.userBalance;
@ -374,18 +381,18 @@
// //
computedPrice: function() { computedPrice: function() {
postOrderComputed({ postOrderComputed({
useIntegral: this.useIntegral, pointStatus: this.pointStatus,
preOrderNo: this.preOrderNo preOrderNo: this.preOrderNo
}).then(res => { }).then(res => {
let data = res.data; let data = res.data;
this.orderInfoVo.couponFee = data.couponFee; this.orderInfoVo.couponFee = data.couponFee;
//userIntegral surplusIntegral // userIntegral surplusIntegral
this.orderInfoVo.userIntegral = data.surplusIntegral; this.orderInfoVo.userIntegral = data.surplusIntegral;
this.orderInfoVo.deductionPrice = data.deductionPrice; this.orderInfoVo.deductionPrice = data.deductionPrice;
this.orderInfoVo.freightFee = data.freightFee; this.orderInfoVo.freightFee = data.freightFee;
this.orderInfoVo.payFee = data.payFee; this.orderInfoVo.payFee = data.payFee;
this.orderInfoVo.proTotalFee = data.proTotalFee; this.orderInfoVo.proTotalFee = data.proTotalFee;
this.orderInfoVo.useIntegral = data.useIntegral; this.orderInfoVo.pointStatus = data.pointStatus;
this.orderInfoVo.usedIntegral = data.usedIntegral; this.orderInfoVo.usedIntegral = data.usedIntegral;
this.orderInfoVo.surplusIntegral = data.surplusIntegral; this.orderInfoVo.surplusIntegral = data.surplusIntegral;
//this.orderInfoVo.userIntegral = data.userIntegral; //this.orderInfoVo.userIntegral = data.userIntegral;
@ -405,13 +412,6 @@
this.status = 0; this.status = 0;
this.$set(this.coupon, 'list', this.coupon.list); this.$set(this.coupon, 'list', this.coupon.list);
}, },
/**
* 使用积分抵扣
*/
ChangeIntegral: function() {
this.useIntegral = !this.useIntegral;
this.computedPrice();
},
bindHideKeyboard: function(e) { bindHideKeyboard: function(e) {
this.mark = e.detail.value; this.mark = e.detail.value;
}, },
@ -431,12 +431,6 @@
let that = this; let that = this;
that.animated = false; that.animated = false;
}, },
realName: function(e) {
this.contacts = e.detail.value;
},
phone: function(e) {
this.contactsTel = e.detail.value;
},
payment: function(data) { payment: function(data) {
let that = this; let that = this;
orderCreate(data).then(res => { orderCreate(data).then(res => {
@ -732,52 +726,56 @@
} }
}, },
SubOrder: function(e) { SubOrder: function(e) {
let that = this;
let that = this, if (!this.payType) {
data = {}; return this.$util.Tips({
title: '请选择支付方式'
if (!that.payType) return that.$util.Tips({ });
title: '请选择支付方式' }
}); //
if (!that.address.addressId && that.shippingType === 1) return that.$util.Tips({ if (!this.address.addressId && this.deliveryType === 1) {
title: '请选择收货地址' return this.$util.Tips({
}); title: '请选择收货地址'
if (that.shippingType == 2) { });
if (that.contacts == "" || that.contactsTel == "") { }
return that.$util.Tips({ if (this.deliveryType === 2) {
if (this.contacts === "" || this.contactsTel === "") {
return this.$util.Tips({
title: '请填写联系人或联系人电话' title: '请填写联系人或联系人电话'
}); });
} }
if (!/^1(3|4|5|7|8|9|6)\d{9}$/.test(that.contactsTel)) { if (!/^1(3|4|5|7|8|9|6)\d{9}$/.test(this.contactsTel)) {
return that.$util.Tips({ return this.$util.Tips({
title: '请填写正确的手机号' title: '请填写正确的手机号'
}); });
} }
if (!/^[\u4e00-\u9fa5\w]{2,16}$/.test(that.contacts)) { if (!/^[\u4e00-\u9fa5\w]{2,16}$/.test(this.contacts)) {
return that.$util.Tips({ return this.$util.Tips({
title: '请填写您的真实姓名' title: '请填写您的真实姓名'
}); });
} }
if (that.storeList.length == 0) return that.$util.Tips({ if (this.storeList.length === 0) {
title: '暂无门店,请选择其他方式' return this.$util.Tips({
}); title: '暂无门店,请选择其他方式'
});
}
} }
data = { const data = {
realName: that.contacts, realName: this.contacts,
phone: that.contactsTel, phone: this.contactsTel,
addressId: that.address.addressId, addressId: this.address.addressId,
couponId: that.couponId, couponId: this.couponId,
payType: that.payType, payType: this.payType,
useIntegral: that.useIntegral, pointStatus: this.pointStatus,
preOrderNo: that.preOrderNo, preOrderNo: this.preOrderNo,
mark: that.mark, mark: this.mark,
storeId: that.system_store.id || 0, storeId: this.system_store.id > 0 ? this.system_store.id : undefined,
shippingType: that.$util.$h.Add(that.shippingType, 1), deliveryType: this.deliveryType,
payChannel: that.payChannel payChannel: this.payChannel
}; };
if (data.payType == 'yue' && parseFloat(that.userInfo.nowMoney) < parseFloat(that.totalPrice)) if (data.payType == 'yue' && parseFloat(this.userInfo.nowMoney) < parseFloat(this.totalPrice))
return that.$util return this.$util
.Tips({ .Tips({
title: '余额不足!' title: '余额不足!'
}); });
@ -786,14 +784,23 @@
}); });
// #ifdef MP // #ifdef MP
openPaySubscribe().then(() => { openPaySubscribe().then(() => {
that.payment(data); this.payment(data);
}); });
// #endif // #endif
// #ifndef MP // #ifndef MP
that.payment(data); this.payment(data);
// #endif // #endif
}, },
// ========== ==========
/**
* 使用积分抵扣
*/
ChangeIntegral: function() {
this.pointStatus = !this.pointStatus;
this.getloadPreOrder();
},
// ========== ========== // ========== ==========
/** /**
* 获取当前金额可用优惠券 * 获取当前金额可用优惠券
@ -867,35 +874,21 @@
/** /**
* 选择地址后改变事件 * 选择地址后改变事件
*/ */
OnChangeAddress: function(e) { OnChangeAddress: function(address) {
this.addressInfo = e; this.changeAddress(address);
this.address.addressId = e.id;
this.textareaStatus = true; this.textareaStatus = true;
this.address.address = false; this.address.address = false;
this.getaddressInfo(); this.getloadPreOrder();
this.computedPrice();
}, },
/** /**
* 获取默认收货地址或者获取某条地址信息 * 选择地址
*/ */
getaddressInfo: function() { changeAddress: function (address) {
if (this.addressId) { if (!address) {
AddressApi.getAddress(this.addressId).then(res => { return;
if (res.data) {
this.addressInfo = res.data || {};
this.addressId = res.data.id || 0;
this.address.addressId = res.data.id || 0;
}
})
} else {
AddressApi.getDefaultUserAddress().then(res => {
if (res.data) {
this.addressInfo = res.data || {};
this.addressId = res.data.id || 0;
this.address.addressId = res.data.id || 0;
}
})
} }
this.addressInfo = address;
this.address.addressId = address.id;
}, },
/** /**
* 关闭地址弹窗 * 关闭地址弹窗
@ -909,10 +902,10 @@
/** /**
* 切换物流方式 * 切换物流方式
*/ */
addressType: function(shippingType) { addressType: function(deliveryType) {
this.shippingType = shippingType; this.deliveryType = deliveryType;
this.computedPrice(); this.getloadPreOrder();
if (shippingType === 2) { if (deliveryType === 2) {
this.getList(); this.getList();
} }
}, },
@ -945,6 +938,12 @@
}); });
}) })
}, },
realName: function(e) {
this.contacts = e.detail.value;
},
phone: function(e) {
this.contactsTel = e.detail.value;
},
fen2yuan(price) { fen2yuan(price) {
return Util.fen2yuan(price) return Util.fen2yuan(price)