|
@@ -51,6 +51,11 @@ var shoppingConfirm = new Vue({
|
|
|
productParam: Object.assign({}, defaultProductParam), // 商品立即购买确认订单参数
|
|
|
postageParam: Object.assign({}, defaultPostageParam), // 邮费计算参数
|
|
|
confirmParam: Object.assign({}, defaultConfirmParam), // 提交订单参数
|
|
|
+ supportParm:{// 组合商品立即购买确认订单参数
|
|
|
+ productInfo:'',
|
|
|
+ source:2, // 来源:1WWW 2小程序
|
|
|
+ userId:0 // 用户Id
|
|
|
+ },
|
|
|
address: {
|
|
|
id: '',
|
|
|
townId: '',
|
|
@@ -118,6 +123,9 @@ var shoppingConfirm = new Vue({
|
|
|
couponList:[], // 可用优惠券列表
|
|
|
isCouponShow:false,
|
|
|
svipReducedPrice: 0, //超级会员优惠金额
|
|
|
+ isModelAlert:false, // 订单不足提示弹窗
|
|
|
+ isModelAlertText:'',
|
|
|
+ isShowConfirm:true
|
|
|
},
|
|
|
computed: {
|
|
|
|
|
@@ -161,34 +169,18 @@ var shoppingConfirm = new Vue({
|
|
|
if(_self.userId ===0){return;}
|
|
|
OrderApi.ProductCreateOrderInfo(_self.productParam,function(response){
|
|
|
if (response.code === 0 ) {
|
|
|
- var data = response.data;
|
|
|
- _self.listData = data.list;
|
|
|
- _self.totalPrice = data.totalPrice;
|
|
|
- _self.reducedPrice = data.reducedPrice;
|
|
|
- _self.totalCount = data.totalCount;
|
|
|
- _self.kindCount = data.kindCount;
|
|
|
- _self.balance.userMoney = data.userMoney;
|
|
|
- _self.balance.originUserMoney = data.userMoney;
|
|
|
- _self.hanldShouldPayFee = data.totalPrice;
|
|
|
- _self.svipReducedPrice = data.svipReducedPrice;
|
|
|
- _self.postageParam.productIds = _self.getProductIds(data.list); // 获取订单商品id列表 以 , 隔开
|
|
|
- console.log('邮费接口数据', _self.postageParam)
|
|
|
- _self.getAddressList(_self.userId,20);
|
|
|
- if( data.couponList && data.couponList.length>0){
|
|
|
- _self.isCouponShow = true;
|
|
|
- _self.couponAmount = data.couponList[0].couponAmount;
|
|
|
- _self.confirmParam.clubCouponId = data.couponList[0].clubCouponId;
|
|
|
- data.couponList.forEach((el) => {
|
|
|
- _self.couponList.push(Object.assign(el,{ischecked:false}))
|
|
|
- })
|
|
|
- _self.couponList[0].ischecked = true;
|
|
|
- _self.hanldShouldPayFee = data.totalPrice - _self.couponAmount;
|
|
|
- }
|
|
|
- _self.totalDiscountAmount = _self.reducedPrice + _self.couponAmount;
|
|
|
- if(data.invoice){
|
|
|
- data.invoice.type = 0;
|
|
|
- _self.orderInvoice = data.invoice;
|
|
|
- }
|
|
|
+ _self.setCreatDataInfo(response.data)
|
|
|
+ }else{
|
|
|
+ CAIMEI.Alert(r.msg, '确定', false);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ OrderClubProductSupporting:function(){// 组合商品确认订单初始化
|
|
|
+ var _self = this;
|
|
|
+ if(_self.userId ===0){return;}
|
|
|
+ OrderApi.OrderClubProductSupporting(_self.supportParm,function(response){
|
|
|
+ if (response.code === 0 ) {
|
|
|
+ _self.setCreatDataInfo(response.data)
|
|
|
}else{
|
|
|
CAIMEI.Alert(r.msg, '确定', false);
|
|
|
}
|
|
@@ -199,39 +191,42 @@ var shoppingConfirm = new Vue({
|
|
|
if(_self.userId ===0){return;}
|
|
|
OrderApi.GetOrderConfirmInfo(_self.cartParam,function(response){
|
|
|
if (response.code === 0 ) {
|
|
|
- var data = response.data;
|
|
|
- _self.listData = data.list;
|
|
|
- _self.totalPrice = data.totalPrice;
|
|
|
- _self.reducedPrice = data.reducedPrice;
|
|
|
- _self.totalCount = data.totalCount;
|
|
|
- _self.kindCount = data.kindCount;
|
|
|
- _self.balance.userMoney = data.userMoney;
|
|
|
- _self.balance.originUserMoney = data.userMoney;
|
|
|
- _self.hanldShouldPayFee = data.totalPrice;
|
|
|
- _self.svipReducedPrice = data.svipReducedPrice;
|
|
|
- _self.postageParam.productIds = _self.getProductIds(data.list); // 获取订单商品id列表 以 , 隔开
|
|
|
- _self.getAddressList(_self.userId,20);
|
|
|
- console.log('邮费接口数据', _self.postageParam)
|
|
|
- if( data.couponList && data.couponList.length>0){
|
|
|
- _self.isCouponShow = true;
|
|
|
- _self.couponAmount = data.couponList[0].couponAmount;
|
|
|
- _self.confirmParam.clubCouponId = data.couponList[0].clubCouponId;
|
|
|
- data.couponList.forEach((el) => {
|
|
|
- _self.couponList.push(Object.assign(el,{ischecked:false}))
|
|
|
- })
|
|
|
- _self.couponList[0].ischecked = true;
|
|
|
- _self.hanldShouldPayFee = data.totalPrice - _self.couponAmount;
|
|
|
- }
|
|
|
- _self.totalDiscountAmount = _self.reducedPrice + _self.couponAmount;
|
|
|
- if(data.invoice){
|
|
|
- data.invoice.type = 0;
|
|
|
- _self.orderInvoice = data.invoice;
|
|
|
- }
|
|
|
+ _self.setCreatDataInfo(response.data)
|
|
|
}else{
|
|
|
CAIMEI.Alert(r.msg, '确定', false);
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ setCreatDataInfo(data){
|
|
|
+ var _self = this;
|
|
|
+ _self.listData = data.list;
|
|
|
+ _self.totalPrice = data.totalPrice;
|
|
|
+ _self.reducedPrice = data.reducedPrice;
|
|
|
+ _self.totalCount = data.totalCount;
|
|
|
+ _self.kindCount = data.kindCount;
|
|
|
+ _self.balance.userMoney = data.userMoney;
|
|
|
+ _self.balance.originUserMoney = data.userMoney;
|
|
|
+ _self.hanldShouldPayFee = data.totalPrice;
|
|
|
+ _self.svipReducedPrice = data.svipReducedPrice;
|
|
|
+ _self.postageParam.productIds = _self.getProductIds(data.list); // 获取订单商品id列表 以 , 隔开
|
|
|
+ _self.getAddressList(_self.userId,20);
|
|
|
+ console.log('邮费接口数据', _self.postageParam)
|
|
|
+ if( data.couponList && data.couponList.length>0){
|
|
|
+ _self.isCouponShow = true;
|
|
|
+ _self.couponAmount = data.couponList[0].couponAmount;
|
|
|
+ _self.confirmParam.clubCouponId = data.couponList[0].clubCouponId;
|
|
|
+ data.couponList.forEach((el) => {
|
|
|
+ _self.couponList.push(Object.assign(el,{ischecked:false}))
|
|
|
+ })
|
|
|
+ _self.couponList[0].ischecked = true;
|
|
|
+ _self.hanldShouldPayFee = data.totalPrice - _self.couponAmount;
|
|
|
+ }
|
|
|
+ _self.totalDiscountAmount = _self.reducedPrice + _self.couponAmount;
|
|
|
+ if(data.invoice){
|
|
|
+ data.invoice.type = 0;
|
|
|
+ _self.orderInvoice = data.invoice;
|
|
|
+ }
|
|
|
+ },
|
|
|
getFreight: function(){// 获取邮费
|
|
|
var _self = this;
|
|
|
console.log(_self.postageParam, '邮费接口调用')
|
|
@@ -662,8 +657,18 @@ var shoppingConfirm = new Vue({
|
|
|
n=(r1>=r2)?r1:r2;
|
|
|
return ((arg1*m-arg2*m)/m).toFixed(n);
|
|
|
},
|
|
|
- submitOrder: function(){
|
|
|
+ submitOrder: function(){// 提交按钮点击
|
|
|
+ var _self = this;
|
|
|
+ if( _self.hanldShouldPayFee<1000){
|
|
|
+ _self.isModelAlert = true;
|
|
|
+ _self.isModelAlertText = '采购金额过小,将扣除500采美豆。建议您使用微信扫描 以下二维码,进入采美旗下“呵呵商城”小程序购买小额 商品。';
|
|
|
+ }else{
|
|
|
+ _self.handleClickOrderSubmitMit()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleClickOrderSubmitMit:function () {// 提交订单
|
|
|
var _self = this;
|
|
|
+ _self.isModelAlert = false;
|
|
|
if(_self.submitLoading){return false;}
|
|
|
if(!_self.confirmParam.addressId){
|
|
|
CAIMEI.dialog('请先添加收货地址~');
|
|
@@ -726,7 +731,7 @@ var shoppingConfirm = new Vue({
|
|
|
_self.confirmParam.orderInvoice = _self.orderInvoice;
|
|
|
}
|
|
|
var hanldPostageFlag =
|
|
|
- _self.confirmParam.payInfo.postage = parseInt(_self.hanldPostage).toFixed(2);
|
|
|
+ _self.confirmParam.payInfo.postage = parseInt(_self.hanldPostage).toFixed(2);
|
|
|
_self.confirmParam.payInfo.postageFlag = parseInt(_self.hanldPostageFlag);
|
|
|
_self.confirmParam.payInfo.orderShouldPayFee = parseFloat(_self.hanldShouldPayFee).toFixed(2);
|
|
|
_self.confirmParam.payInfo = JSON.stringify(_self.confirmParam.payInfo);
|
|
@@ -743,15 +748,23 @@ var shoppingConfirm = new Vue({
|
|
|
window.location.href = '/pay/success.html?pageType=www&type=success&payAmount='+data.payTotalFee;
|
|
|
}else{//余额抵扣部分订单金额或者未支付的
|
|
|
var order = {
|
|
|
- orderId:data.orderId,
|
|
|
- orderNo:data.orderNo,
|
|
|
- orderMark:data.orderMark,
|
|
|
- payableAmount:data.payableAmount
|
|
|
- };
|
|
|
+ orderId:data.orderId,
|
|
|
+ orderNo:data.orderNo,
|
|
|
+ orderMark:data.orderMark,
|
|
|
+ payableAmount:data.payableAmount
|
|
|
+ };
|
|
|
CAIMEI.Storage.removeItem('confirmOrderInfo');
|
|
|
CAIMEI.Storage.setItem('confirmOrderInfo',JSON.stringify({data:order}));
|
|
|
window.location.href = '/pay/caimei-paycash.html?type=confirm&orderId='+data.orderId;
|
|
|
}
|
|
|
+ }else if(res.code === -3){
|
|
|
+ _self.isModelAlert = true;
|
|
|
+ _self.isShowConfirm = false;
|
|
|
+ _self.submitLoading = false;
|
|
|
+ _self.isModelAlertText = res.msg;
|
|
|
+ _self.confirmParam.payInfo = JSON.parse(_self.confirmParam.payInfo);
|
|
|
+ _self.confirmParam.orderInfo = JSON.parse(_self.confirmParam.orderInfo);
|
|
|
+ _self.confirmParam.orderInvoice = JSON.parse(_self.confirmParam.orderInvoice);
|
|
|
}else{
|
|
|
CAIMEI.Alert(res.msg,'确定',true, function(){
|
|
|
setTimeout(function(){
|
|
@@ -764,6 +777,10 @@ var shoppingConfirm = new Vue({
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ handleCloseModel:function () {
|
|
|
+ this.isModelAlert = false;
|
|
|
+ this.isShowConfirm= true;
|
|
|
+ },
|
|
|
getProductIds: function(list){// 获取订单商品id列表
|
|
|
var productIds = [];
|
|
|
list.forEach(function(supplier){
|
|
@@ -778,27 +795,28 @@ var shoppingConfirm = new Vue({
|
|
|
created: function () {
|
|
|
var _self = this;
|
|
|
var urlType = getUrlParam("type") ? getUrlParam("type")*1 : "";
|
|
|
- console.log('urlType',urlType)
|
|
|
if(globalUserData){
|
|
|
- _self.userId = _self.productParam.userId = _self.cartParam.userId = _self.postageParam.userId = globalUserData.userId;
|
|
|
+ _self.userId = _self.productParam.userId = _self.cartParam.userId = _self.postageParam.userId = _self.supportParm.userId = globalUserData.userId;
|
|
|
_self.confirmParam.clubId = globalUserData.clubId
|
|
|
_self.userIdentity = globalUserData.identity;
|
|
|
_self.userToken = globalUserData.token;
|
|
|
// type:(1购物车提交[对应表cm_cart],2直接购买提交, 3协销下单)
|
|
|
if(urlType === 1) {//购物车提交
|
|
|
_self.confirmParam.cartType = 1;
|
|
|
- // _self.cartParam.productIds = _self.postageParam.productIds = _self.productIds = window.localStorage.getItem("shoppingProductIds");
|
|
|
_self.cartParam.productIds = _self.productIds = window.localStorage.getItem("shoppingProductIds");
|
|
|
// 获取列表数据
|
|
|
_self.getCartCreateOrderInfo();
|
|
|
}else if(urlType === 2){//立即购买
|
|
|
_self.confirmParam.cartType = 2;
|
|
|
- // _self.productParam.productId = _self.postageParam.productIds = _self.productIds = getUrlParam("productId");
|
|
|
_self.productParam.productId = _self.productIds = getUrlParam("productId");
|
|
|
_self.productParam.productCount = getUrlParam("count");
|
|
|
if(_self.productParam.productId && _self.productParam.productCount) {
|
|
|
_self.getProductCreateOrderInfo();
|
|
|
}
|
|
|
+ }else if(urlType === 3){// 组合商品立即购买
|
|
|
+ _self.supportParm.productInfo = CAIMEI.Storage.getItem("KEY_SUPPORE");
|
|
|
+ _self.OrderClubProductSupporting()
|
|
|
+ console.log('_self.supportParm.productInfo',_self.supportParm.productInfo)
|
|
|
}
|
|
|
}
|
|
|
},
|