|
@@ -123,7 +123,7 @@ var shoppingConfirm = new Vue({
|
|
|
var el = event.currentTarget;
|
|
|
verifyHandle(el);
|
|
|
},
|
|
|
- getConfirmList: function (productCount) {
|
|
|
+ getConfirmList: function (productCount) {// 初始化确认订单信息
|
|
|
var _self = this;
|
|
|
if(this.userId ===0){return;}
|
|
|
OrderApi.GetOrderConfirmInfo({
|
|
@@ -135,31 +135,29 @@ var shoppingConfirm = new Vue({
|
|
|
var data = response.data;
|
|
|
_self.listData = data.list;
|
|
|
_self.totalPrice = data.totalPrice;
|
|
|
- _self.reducedPrice = data.reducedPrice;
|
|
|
+ _self.totalDiscountAmount = _self.reducedPrice = data.reducedPrice;
|
|
|
_self.totalCount = data.totalCount;
|
|
|
- _self.couponList = data.couponList;
|
|
|
_self.kindCount = data.kindCount;
|
|
|
_self.balance.userMoney = data.userMoney;
|
|
|
_self.balance.originUserMoney = data.userMoney;
|
|
|
_self.payInfo.orderShouldPayFee = data.totalPrice;
|
|
|
- if(_self.couponList.length>0){
|
|
|
+ _self.getAddressList(_self.userId,20);
|
|
|
+ if( data.couponList && data.couponList.length>0){
|
|
|
_self.isCouponShow = true;
|
|
|
- _self.couponList.forEach((el,index) => {
|
|
|
- _self.dataList.push(Object.assign({},el,{ischecked:false}))
|
|
|
+ data.couponList.forEach((el) => {
|
|
|
+ _self.couponList.push(Object.assign(el,{ischecked:false}))
|
|
|
})
|
|
|
}
|
|
|
if(data.invoice){
|
|
|
data.invoice.type = 0;
|
|
|
_self.invoice = data.invoice;
|
|
|
}
|
|
|
- _self.getAddressList(_self.userId,20);
|
|
|
}else{
|
|
|
CAIMEI.Alert(r.msg, '确定', false);
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- // 获取邮费
|
|
|
- getFreight: function(townId){
|
|
|
+ getFreight: function(townId){// 获取邮费
|
|
|
var _self = this;
|
|
|
OrderApi.GetOrderPostage({
|
|
|
userId: this.userId,
|
|
@@ -214,8 +212,7 @@ var shoppingConfirm = new Vue({
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- // 获取收货地址
|
|
|
- getAddressList: function(userId,pageSize){
|
|
|
+ getAddressList: function(userId,pageSize){ // 获取收货地址
|
|
|
var _self = this;
|
|
|
OrderApi.GetAddressList({
|
|
|
userID:userId,
|
|
@@ -248,8 +245,7 @@ var shoppingConfirm = new Vue({
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- // 获取全部省份
|
|
|
- getProvinceOptions: function(){
|
|
|
+ getProvinceOptions: function(){ // 获取全部省份
|
|
|
var _self = this;
|
|
|
PublicApi.GetProvince({},function(r){
|
|
|
if(r.code === 0 && r.data){
|
|
@@ -259,7 +255,7 @@ var shoppingConfirm = new Vue({
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- getCityOptions: function(provinceId,callback){
|
|
|
+ getCityOptions: function(provinceId,callback){// 获取地区
|
|
|
var _self = this;
|
|
|
if(provinceId && provinceId>0){
|
|
|
_self.cityOptions = [];
|
|
@@ -291,19 +287,19 @@ var shoppingConfirm = new Vue({
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
- showAddressBox: function(){
|
|
|
+ showAddressBox: function(){// 显示地址弹窗
|
|
|
this.isShowAddressList = true;
|
|
|
if(!isPC){fixedBody();}
|
|
|
},
|
|
|
- closeAddressBox: function(){
|
|
|
+ closeAddressBox: function(){// 关闭地址弹窗
|
|
|
this.isShowAddressList = false;
|
|
|
if(!isPC){looseBody();}
|
|
|
},
|
|
|
- hideAddressForm: function(){
|
|
|
+ hideAddressForm: function(){// 隐藏地址表单
|
|
|
this.isShowAddressForm = false;
|
|
|
if(!isPC){looseBody();}
|
|
|
},
|
|
|
- createAddress: function(){
|
|
|
+ createAddress: function(){// 新建地址
|
|
|
this.isShowAddressForm = true;
|
|
|
this.addressForm.name= '';
|
|
|
this.addressForm.mobile= '';
|
|
@@ -315,7 +311,7 @@ var shoppingConfirm = new Vue({
|
|
|
this.getProvinceOptions();
|
|
|
if(!isPC){fixedBody();}
|
|
|
},
|
|
|
- updateAddress: function(){
|
|
|
+ updateAddress: function(){// 更新选择地址
|
|
|
this.isShowAddressForm = true;
|
|
|
this.addressForm.id = this.address.id;
|
|
|
this.addressForm.name = this.address.name;
|
|
@@ -332,7 +328,7 @@ var shoppingConfirm = new Vue({
|
|
|
});
|
|
|
if(!isPC){fixedBody();}
|
|
|
},
|
|
|
- saveAddressForm: function(){
|
|
|
+ saveAddressForm: function(){// 更新保存地址
|
|
|
var _self = this;
|
|
|
var pass = verifyForm();
|
|
|
if (_self.saveLoading) { return false; }
|
|
@@ -358,7 +354,7 @@ var shoppingConfirm = new Vue({
|
|
|
_self.saveAddress(params);
|
|
|
});
|
|
|
},
|
|
|
- saveAddress: function(params){
|
|
|
+ saveAddress: function(params){// 更新保存地址
|
|
|
var _self = this;
|
|
|
OrderApi.AddSaveAddress(params,function(r){
|
|
|
if(r.code === 0){
|
|
@@ -372,8 +368,7 @@ var shoppingConfirm = new Vue({
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- // 列表直接设为默认地址
|
|
|
- setDefaultAddress: function(addressId){
|
|
|
+ setDefaultAddress: function(addressId){// 列表直接设为默认地址
|
|
|
var _self = this;
|
|
|
OrderApi.DefaultAddress({addressId:addressId,userId:_self.userId},function (r) {
|
|
|
if(r.code === 0 ){
|
|
@@ -384,8 +379,7 @@ var shoppingConfirm = new Vue({
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- // 列表删除单个地址
|
|
|
- deleteAddress: function(addressId){
|
|
|
+ deleteAddress: function(addressId){// 列表删除单个地址
|
|
|
var _self = this;
|
|
|
CAIMEI.Modal('确定要删除该地址?','取消','确定',function () {
|
|
|
OrderApi.DeleteAddress({addressID:addressId,userID:_self.userId},function (r) {
|
|
@@ -402,7 +396,7 @@ var shoppingConfirm = new Vue({
|
|
|
chooseAddress: function(selectedId){
|
|
|
this.address.selectedId = selectedId;
|
|
|
},
|
|
|
- confirmAddress: function(){
|
|
|
+ confirmAddress: function(){// 确认地址并查询邮费
|
|
|
var _self = this;
|
|
|
this.addressList.forEach(function(item){
|
|
|
if (_self.address.selectedId==item.addressID){
|
|
@@ -422,7 +416,7 @@ var shoppingConfirm = new Vue({
|
|
|
});
|
|
|
this.closeAddressBox();
|
|
|
},
|
|
|
- checkedCoupon:function(coupon,idx){// 选择优惠券
|
|
|
+ checkedCoupon:function(idx){// 选择优惠券
|
|
|
var _self = this;
|
|
|
var coupon = { couponAmount:0,clubCouponId:0 };
|
|
|
_self.checkedIndex = idx;
|
|
@@ -437,9 +431,12 @@ var shoppingConfirm = new Vue({
|
|
|
coupon.clubCouponId = el.clubCouponId;
|
|
|
}
|
|
|
})
|
|
|
+ console.log('couponList',_self.couponList);
|
|
|
_self.couponAmount = coupon.couponAmount;
|
|
|
_self.totalDiscountAmount = _self.reducedPrice + _self.couponAmount;
|
|
|
_self.clubCouponId = coupon.clubCouponId;
|
|
|
+ _self.changeDeductibleFreight();
|
|
|
+ _self.useUserMoney();
|
|
|
console.log('couponAmount',_self.couponAmount)
|
|
|
console.log('totalDiscountAmount',_self.totalDiscountAmount)
|
|
|
console.log('clubCouponId',_self.clubCouponId)
|
|
@@ -469,22 +466,22 @@ var shoppingConfirm = new Vue({
|
|
|
if(_self.balance.userMoney>=total){ // 全部抵扣
|
|
|
_self.payInfo.orderShouldPayFee = 0;
|
|
|
if(_self.balance.isFreight){// 勾选了采美豆丢运费
|
|
|
- _self.balance.deductMoney = _self.totalPrice; // 抵扣使用金额 = 订单总金额
|
|
|
+ _self.balance.deductMoney = _self.totalPrice - _self.couponAmount; // 抵扣使用金额 = 订单总金额
|
|
|
_self.balance.surplusMoney = _self.repiceNumSub(_self.balance.userMoney,_self.totalPrice); // 抵扣后剩余余额 = 余额总额 - (订单总金额+邮费金额)
|
|
|
console.log('余额全部抵扣勾选了采美豆运费',_self.balance.surplusMoney)
|
|
|
}else{
|
|
|
- _self.balance.deductMoney = total; // 抵扣使用金额 = 订单总金额 + 邮费金额
|
|
|
+ _self.balance.deductMoney = total - _self.couponAmount; // 抵扣使用金额 = 订单总金额 + 邮费金额 - 优惠券金额
|
|
|
_self.balance.surplusMoney = _self.repiceNumSub(_self.balance.userMoney,_self.balance.deductMoney); // 抵扣后剩余余额 = 余额总额 - 抵扣使用金额
|
|
|
console.log('余额全部抵扣未勾选了采美豆运费',_self.balance.surplusMoney)
|
|
|
}
|
|
|
}else{ // 部分抵扣
|
|
|
if(_self.balance.isFreight){// 勾选了采美豆丢运费
|
|
|
- _self.payInfo.orderShouldPayFee = _self.repiceNumSub(_self.totalPrice,_self.balance.userMoney); // 最终订单总价 = 订单总金额 - 余额总额
|
|
|
+ _self.payInfo.orderShouldPayFee = _self.repiceNumSub(_self.totalPrice,_self.balance.userMoney) - _self.couponAmount; // 最终订单总价 = 订单总金额 - 余额总额
|
|
|
_self.balance.deductMoney = _self.balance.userMoney; // 抵扣使用金额 = 余额总额
|
|
|
_self.balance.surplusMoney = 0; // 抵扣后剩余余额 = 0
|
|
|
console.log('部分抵扣勾选了采美豆运费',_self.payInfo.orderShouldPayFee)
|
|
|
}else{
|
|
|
- _self.payInfo.orderShouldPayFee = _self.repiceNumSub(total,_self.balance.userMoney); // 最终订单总价 = 订单总金额 - 余额总额
|
|
|
+ _self.payInfo.orderShouldPayFee = _self.repiceNumSub(total,_self.balance.userMoney) - _self.couponAmount; // 最终订单总价 = 订单总金额 - 余额总额
|
|
|
_self.balance.deductMoney = _self.balance.userMoney; // 抵扣使用金额 = 余额总额
|
|
|
_self.balance.surplusMoney = 0; // 抵扣后剩余余额 = 0
|
|
|
console.log('部分抵扣没有勾选了采美豆运费',_self.payInfo.orderShouldPayFee)
|
|
@@ -496,9 +493,9 @@ var shoppingConfirm = new Vue({
|
|
|
_self.balance.deductMoney = 0;
|
|
|
_self.balance.surplusMoney = _self.balance.originUserMoney;
|
|
|
if(_self.balance.isFreight){//判断是否有采美豆抵扣运费
|
|
|
- _self.payInfo.orderShouldPayFee = _self.totalPrice; // 最终订单总价 = 订单总金额
|
|
|
+ _self.payInfo.orderShouldPayFee = _self.totalPrice - _self.couponAmount; // 最终订单总价 = 订单总金额
|
|
|
}else{
|
|
|
- _self.payInfo.orderShouldPayFee = total; // 最终订单总价 = 订单总金额 + 邮费金额
|
|
|
+ _self.payInfo.orderShouldPayFee = total - _self.couponAmount; // 最终订单总价 = 订单总金额 + 邮费金额
|
|
|
}
|
|
|
console.log('取消余额抵扣',_self.payInfo.orderShouldPayFee)
|
|
|
}
|
|
@@ -520,14 +517,14 @@ var shoppingConfirm = new Vue({
|
|
|
_self.balance.surplusMoney = _self.repiceNumSub(_self.balance.userMoney,_self.balance.deductMoney); // 抵扣后剩余余额 = 余额总额 - 抵扣使用金额
|
|
|
console.log('有勾选余额抵扣全抵',_self.payInfo.orderShouldPayFee)
|
|
|
}else{ // 部分抵扣
|
|
|
- _self.payInfo.orderShouldPayFee = _self.repiceNumSub(_self.totalPrice,_self.balance.userMoney);
|
|
|
+ _self.payInfo.orderShouldPayFee = _self.repiceNumSub(_self.totalPrice,_self.balance.userMoney) - _self.couponAmount;
|
|
|
_self.balance.deductMoney = _self.balance.userMoney; // 抵扣使用金额 = 余额总额
|
|
|
_self.balance.surplusMoney = _self.repiceNumSub(_self.balance.userMoney,_self.balance.deductMoney); // 抵扣后剩余余额 = 余额总额 - 抵扣使用金额
|
|
|
console.log('有勾选余额抵扣部分抵',_self.payInfo.orderShouldPayFee)
|
|
|
}
|
|
|
}else{
|
|
|
console.log('订单总额2222222',total)
|
|
|
- _self.payInfo.orderShouldPayFee = (_self.totalPrice*100 + _self.payInfo.freight*100 - _self.freightBeansMoney*100)/100;
|
|
|
+ _self.payInfo.orderShouldPayFee = ((_self.totalPrice*100 + _self.payInfo.freight*100 - _self.freightBeansMoney*100)/100) - _self.couponAmount;
|
|
|
console.log('无余额抵扣',_self.payInfo.orderShouldPayFee)
|
|
|
}
|
|
|
}
|
|
@@ -540,18 +537,18 @@ var shoppingConfirm = new Vue({
|
|
|
_self.balance.surplusMoney = _self.repiceNumSub(_self.balance.userMoney,_self.balance.deductMoney); // 抵扣后剩余余额 = 余额总额 - 抵扣使用金额
|
|
|
console.log('到付有勾选余额抵扣全抵',_self.payInfo.orderShouldPayFee)
|
|
|
}else{ // 部分抵扣
|
|
|
- _self.payInfo.orderShouldPayFee = _self.repiceNumSub(_self.totalPrice,_self.balance.userMoney);
|
|
|
+ _self.payInfo.orderShouldPayFee = _self.repiceNumSub(_self.totalPrice,_self.balance.userMoney) - _self.couponAmount;
|
|
|
_self.balance.deductMoney = _self.balance.userMoney; // 抵扣使用金额 = 余额总额
|
|
|
_self.balance.surplusMoney = _self.repiceNumSub(_self.balance.userMoney,_self.balance.deductMoney); // 抵扣后剩余余额 = 余额总额 - 抵扣使用金额
|
|
|
console.log('到付有勾选余额抵扣部分抵',_self.payInfo.orderShouldPayFee)
|
|
|
}
|
|
|
}else{
|
|
|
- _self.payInfo.orderShouldPayFee = _self.totalPrice ;
|
|
|
+ _self.payInfo.orderShouldPayFee = _self.totalPrice - _self.couponAmount ;
|
|
|
console.log('到付未勾选余额抵扣',_self.payInfo.orderShouldPayFee)
|
|
|
}
|
|
|
}else{
|
|
|
_self.hanldUserBeans = 0;
|
|
|
- _self.payInfo.orderShouldPayFee = _self.totalPrice ;
|
|
|
+ _self.payInfo.orderShouldPayFee = _self.totalPrice - _self.couponAmount ;
|
|
|
console.log('其他',_self.payInfo.orderShouldPayFee)
|
|
|
}
|
|
|
}else{
|
|
@@ -566,13 +563,13 @@ var shoppingConfirm = new Vue({
|
|
|
console.log('余额全抵抵未勾选采美豆抵扣',_self.payInfo.orderShouldPayFee)
|
|
|
}else{
|
|
|
console.log('未勾选采美豆抵扣=========》',total)
|
|
|
- _self.payInfo.orderShouldPayFee = _self.repiceNumSub(total,_self.balance.userMoney) ;
|
|
|
+ _self.payInfo.orderShouldPayFee = _self.repiceNumSub(total,_self.balance.userMoney) - _self.couponAmount;
|
|
|
_self.balance.deductMoney = _self.balance.userMoney; // 抵扣使用金额 = (订单总金额+邮费金额)
|
|
|
_self.balance.surplusMoney = _self.repiceNumSub(_self.balance.userMoney,_self.balance.deductMoney); // 抵扣后剩余余额 = 余额总额 - 抵扣使用金额
|
|
|
console.log('余额部分抵未勾选采美豆抵扣',_self.payInfo.orderShouldPayFee)
|
|
|
}
|
|
|
}else{
|
|
|
- _self.payInfo.orderShouldPayFee = _self.totalPrice + _self.payInfo.freight;
|
|
|
+ _self.payInfo.orderShouldPayFee = (_self.totalPrice + _self.payInfo.freight) - _self.couponAmount;
|
|
|
}
|
|
|
}
|
|
|
},
|