|
@@ -2,19 +2,16 @@ const defaultProductParam = {
|
|
|
productCount:0, // 商品数量
|
|
|
productId:0, // 商品Id
|
|
|
skuId:0,
|
|
|
+ townId:null, //地址ID
|
|
|
source:1, // 来源:1WWW 2小程序
|
|
|
userId:0 // 用户Id
|
|
|
};
|
|
|
const defaultCartParam = {
|
|
|
skuIds:0, // 商品SkuId(逗号隔开)
|
|
|
source:1, // 来源:1WWW 2小程序
|
|
|
+ townId:null, //地址ID
|
|
|
userId:0 // 用户Id
|
|
|
};
|
|
|
-const defaultPostageParam = {
|
|
|
- skuIds:0, // skuId(逗号隔开)
|
|
|
- userId:0, // 用户Id
|
|
|
- townId:0 // 地区Id
|
|
|
-};
|
|
|
const defaultConfirmParam = {
|
|
|
cartType:1, // 购买类型:(1自主下单, 3协销下单)
|
|
|
orderMiniType:0, // 订单提交状态 0初始提交 1 继续提交
|
|
@@ -25,11 +22,10 @@ const defaultConfirmParam = {
|
|
|
orderInfo:[], // 订单商品数据 // 订单发票信息
|
|
|
orderInvoice:{ type: 0 }, // 订单发票信息
|
|
|
payInfo:{ // 订单金额数据
|
|
|
- isColdChina:0, //是否勾选冷链费
|
|
|
orderShouldPayFee: 0, // 订单最终支付金额
|
|
|
balancePayFlag: 0, // 勾选余额的状态(1使用,0不使用)
|
|
|
clauseId:0, // 条款Id
|
|
|
- postage: 0, // 运费金额
|
|
|
+ postage: '0.00', // 运费金额
|
|
|
postageFlag: 0, // 运费类型
|
|
|
userBeans: 0, // 抵扣采美豆数量
|
|
|
rebateFlag:0 // 是否返佣订单
|
|
@@ -37,6 +33,7 @@ const defaultConfirmParam = {
|
|
|
};
|
|
|
var shoppingConfirm = new Vue({
|
|
|
el: "#shoppingConfirm",
|
|
|
+ mixins: [conMixins],
|
|
|
data: {
|
|
|
userId: 0,
|
|
|
userIdentity: '',
|
|
@@ -47,16 +44,14 @@ var shoppingConfirm = new Vue({
|
|
|
kindCount: 0,
|
|
|
totalCount: 0,
|
|
|
totalPrice: 0,
|
|
|
- reducedPrice: 0, // 满减金额
|
|
|
- couponAmount:0, // 优惠券金额
|
|
|
- totalDiscountAmount:0, // 共减金额
|
|
|
cartParam: Object.assign({}, defaultCartParam), // 购物车立即结算确认订单参数
|
|
|
productParam: Object.assign({}, defaultProductParam), // 商品立即购买确认订单参数
|
|
|
- postageParam: Object.assign({}, defaultPostageParam), // 邮费计算参数
|
|
|
+ // postageParam: Object.assign({}, defaultPostageParam), // 邮费计算参数
|
|
|
confirmParam: Object.assign({}, defaultConfirmParam), // 提交订单参数
|
|
|
supportParm:{// 组合商品立即购买确认订单参数
|
|
|
productInfo:'',
|
|
|
source:2, // 来源:1WWW 2小程序
|
|
|
+ townId:'', //地址ID
|
|
|
userId:0 // 用户Id
|
|
|
},
|
|
|
address: {
|
|
@@ -76,7 +71,7 @@ var shoppingConfirm = new Vue({
|
|
|
orderInvoice:{ // 订单发票信息
|
|
|
id:0,
|
|
|
type: 0,
|
|
|
- invoiceTitleType: 0, // 发票抬头类型 1企业 0个人
|
|
|
+ headingType: 0, // 发票抬头类型 1企业 0个人
|
|
|
invoiceTitle: '', // 单位名称
|
|
|
corporationTaxNum:'', // 纳税人识别号
|
|
|
registeredAddress: '',// 单位地址
|
|
@@ -105,19 +100,10 @@ var shoppingConfirm = new Vue({
|
|
|
name: '^[a-zA-Z\\u4e00-\\u9fa5]{2,}$',
|
|
|
mobile: '^\\d{6,12}$'
|
|
|
},
|
|
|
- balance: {
|
|
|
- isFreight:false, //使用采美豆抵扣运费
|
|
|
- flag: false, //使用余额抵扣
|
|
|
- originUserMoney: 0, //初始化后不能改变,用于还原余额抵扣
|
|
|
- userMoney: 0, //显示可使用余额
|
|
|
- deductMoney: 0, //显示已使用的余额
|
|
|
- surplusMoney: 0 //显示勾选后的剩余抵扣
|
|
|
- },
|
|
|
isBeansShow:false,
|
|
|
userBeans:0,
|
|
|
hanldPostage:0,
|
|
|
hanldPostageFlag:0,
|
|
|
- hanldShouldPayFee:0,
|
|
|
freightBeansMoney:0,
|
|
|
freightMoney:0,
|
|
|
deductionBeans:0,
|
|
@@ -147,23 +133,14 @@ var shoppingConfirm = new Vue({
|
|
|
}
|
|
|
},
|
|
|
TypeFormat:function(value) {
|
|
|
- switch (value) {
|
|
|
- case 0:
|
|
|
- return '活动券';
|
|
|
- break;
|
|
|
- case 1:
|
|
|
- return '品类券';
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- return '用户专享券';
|
|
|
- break;
|
|
|
- case 3:
|
|
|
- return '店铺券';
|
|
|
- break;
|
|
|
- case 4:
|
|
|
- return '新用户券';
|
|
|
- break;
|
|
|
+ const map = {
|
|
|
+ 0:'活动券',
|
|
|
+ 1:'品类券',
|
|
|
+ 2:'用户专享券',
|
|
|
+ 3:'店铺券',
|
|
|
+ 4:'新用户券',
|
|
|
}
|
|
|
+ return map[value]
|
|
|
}
|
|
|
},
|
|
|
watch:{
|
|
@@ -180,79 +157,14 @@ var shoppingConfirm = new Vue({
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- handleCheckboxChange: function(){
|
|
|
+ handleCheckboxChange(){
|
|
|
console.log(this.agreementActive)
|
|
|
},
|
|
|
- blurHandle: function(event) {
|
|
|
+ blurHandle(event) {
|
|
|
var el = event.currentTarget;
|
|
|
verifyHandle(el);
|
|
|
},
|
|
|
- getProductCreateOrderInfo(){// 商品立即购买确认订单初始化
|
|
|
- var _self = this;
|
|
|
- if(_self.userId ===0){return;}
|
|
|
- OrderApi.ProductCreateOrderInfo(_self.productParam,function(response){
|
|
|
- if (response.code === 0 ) {
|
|
|
- _self.setCreatDataInfo(response.data)
|
|
|
- }else{
|
|
|
- CAIMEI.Alert(response.msg, '确定', false);
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- OrderClubProductSupporting(){// 组合商品确认订单初始化
|
|
|
- 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);
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- getCartCreateOrderInfo () {// 购物车去结算确认订单初始化
|
|
|
- var _self = this;
|
|
|
- if(_self.userId ===0){return;}
|
|
|
- OrderApi.GetOrderConfirmInfo(_self.cartParam,function(response){
|
|
|
- if (response.code === 0 ) {
|
|
|
- _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.skuIds = _self.getProductIds(data.list); // 获取订单商品id列表 以 , 隔开
|
|
|
- _self.getAddressList(_self.userId,20);
|
|
|
- _self.returnGoodsStutas = data.returnGoodsStutas === 2 // 当前商品是否为特殊商品 1不是 2是
|
|
|
- _self.helpContent = data.helpContent
|
|
|
- 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(){// 获取邮费
|
|
|
+ getFreight(){// 获取邮费
|
|
|
var _self = this;
|
|
|
console.log(_self.postageParam, '邮费接口调用')
|
|
|
OrderApi.GetOrderPostage(_self.postageParam,function (r) {
|
|
@@ -303,8 +215,8 @@ var shoppingConfirm = new Vue({
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- getAddressList: function(userId,pageSize){ // 获取收货地址
|
|
|
- var _self = this;
|
|
|
+ getAddressList(userId,pageSize){ // 获取收货地址
|
|
|
+ const _self = this;
|
|
|
OrderApi.GetAddressList({
|
|
|
userId:userId,
|
|
|
pageNum:1,
|
|
@@ -316,7 +228,9 @@ var shoppingConfirm = new Vue({
|
|
|
_self.address.id = res.data.list[0].addressId;
|
|
|
_self.confirmParam.addressId = res.data.list[0].addressId;
|
|
|
_self.address.townId = res.data.list[0].townId;
|
|
|
- _self.postageParam.townId = res.data.list[0].townId;
|
|
|
+ _self.productParam.townId = res.data.list[0].townId;
|
|
|
+ _self.cartParam.townId = res.data.list[0].townId;
|
|
|
+ _self.supportParm.townId = res.data.list[0].townId;
|
|
|
_self.address.cityId = res.data.list[0].cityId;
|
|
|
_self.address.provinceId = res.data.list[0].provinceId;
|
|
|
_self.address.name = res.data.list[0].receiver;
|
|
@@ -327,7 +241,6 @@ var shoppingConfirm = new Vue({
|
|
|
_self.address.province = res.data.list[0].province;
|
|
|
_self.address.default = true;
|
|
|
_self.address.selectedId = res.data.list[0].addressId;
|
|
|
- _self.getFreight(_self.address.townId);
|
|
|
}else{
|
|
|
_self.createAddress();
|
|
|
}
|
|
@@ -338,8 +251,8 @@ var shoppingConfirm = new Vue({
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- getProvinceOptions: function(){ // 获取全部省份
|
|
|
- var _self = this;
|
|
|
+ getProvinceOptions(){ // 获取全部省份
|
|
|
+ const _self = this;
|
|
|
OrderApi.GetAddressSelect({},function(res){
|
|
|
if(res.code === 0 && res.data){
|
|
|
_self.provinceOptions =res.data;
|
|
@@ -348,8 +261,8 @@ var shoppingConfirm = new Vue({
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- getCityOptions: function(parentId,callback){// 获取地区
|
|
|
- var _self = this;
|
|
|
+ getCityOptions(parentId,callback){// 获取地区
|
|
|
+ const _self = this;
|
|
|
if(parentId && parentId>0){
|
|
|
_self.cityOptions = [];
|
|
|
_self.townOptions = [];
|
|
@@ -365,8 +278,8 @@ var shoppingConfirm = new Vue({
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
- getTownOptions: function(parentId, callback){
|
|
|
- var _self = this;
|
|
|
+ getTownOptions(parentId, callback){
|
|
|
+ const _self = this;
|
|
|
if(parentId && parentId>0){
|
|
|
_self.townOptions = [];
|
|
|
_self.addressForm.townId = '';
|
|
@@ -380,19 +293,19 @@ var shoppingConfirm = new Vue({
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
- showAddressBox: function(){// 显示地址弹窗
|
|
|
+ showAddressBox(){// 显示地址弹窗
|
|
|
this.isShowAddressList = true;
|
|
|
if(!isPC){fixedBody();}
|
|
|
},
|
|
|
- closeAddressBox: function(){// 关闭地址弹窗
|
|
|
+ closeAddressBox(){// 关闭地址弹窗
|
|
|
this.isShowAddressList = false;
|
|
|
if(!isPC){looseBody();}
|
|
|
},
|
|
|
- hideAddressForm: function(){// 隐藏地址表单
|
|
|
+ hideAddressForm(){// 隐藏地址表单
|
|
|
this.isShowAddressForm = false;
|
|
|
if(!isPC){looseBody();}
|
|
|
},
|
|
|
- createAddress: function(){// 新建地址
|
|
|
+ createAddress(){// 新建地址
|
|
|
this.isShowAddressForm = true;
|
|
|
this.addressForm.name= '';
|
|
|
this.addressForm.mobile= '';
|
|
@@ -406,16 +319,16 @@ var shoppingConfirm = new Vue({
|
|
|
this.getProvinceOptions();
|
|
|
if(!isPC){fixedBody();}
|
|
|
},
|
|
|
- updateAddress: function(){// 更新选择地址
|
|
|
- var _self = this;
|
|
|
- _self.isShowAddressForm = true;
|
|
|
- _self.addressForm.id = _self.address.id;
|
|
|
- _self.addressForm.name = _self.address.name;
|
|
|
- _self.addressForm.mobile = _self.address.mobile;
|
|
|
- _self.addressForm.default = _self.address.default;
|
|
|
- _self.addressForm.desc = _self.address.desc;
|
|
|
- _self.addressForm.provinceId = _self.address.provinceId;
|
|
|
- _self.getCityOptions(_self.address.provinceId, function(){
|
|
|
+ updateAddress(){// 更新选择地址
|
|
|
+ const _self = this;
|
|
|
+ this.isShowAddressForm = true;
|
|
|
+ this.addressForm.id = this.address.id;
|
|
|
+ this.addressForm.name = this.address.name;
|
|
|
+ this.addressForm.mobile = this.address.mobile;
|
|
|
+ this.addressForm.default = this.address.default;
|
|
|
+ this.addressForm.desc = _self.address.desc;
|
|
|
+ this.addressForm.provinceId = this.address.provinceId;
|
|
|
+ this.getCityOptions(_self.address.provinceId, function(){
|
|
|
_self.addressForm.cityId = _self.address.cityId;
|
|
|
_self.getTownOptions(_self.address.cityId,function(){
|
|
|
_self.addressForm.townId = _self.address.townId;
|
|
@@ -423,9 +336,9 @@ var shoppingConfirm = new Vue({
|
|
|
});
|
|
|
if(!isPC){fixedBody();}
|
|
|
},
|
|
|
- saveAddressForm: function(){// 更新保存地址
|
|
|
- var _self = this;
|
|
|
- var pass = verifyForm();
|
|
|
+ saveAddressForm(){// 更新保存地址
|
|
|
+ const _self = this;
|
|
|
+ const pass = verifyForm();
|
|
|
if (_self.saveLoading) { return false; }
|
|
|
this.$nextTick(function() {
|
|
|
if (!pass) {return false;}
|
|
@@ -448,22 +361,52 @@ var shoppingConfirm = new Vue({
|
|
|
_self.saveAddress(params);
|
|
|
});
|
|
|
},
|
|
|
- saveAddress: function(params){// 更新保存地址
|
|
|
- var _self = this;
|
|
|
- OrderApi.AddSaveAddress(params,function(r){
|
|
|
- if(r.code === 0){
|
|
|
- CAIMEI.dialog('保存成功');
|
|
|
+ saveAddress(params){// 更新保存地址
|
|
|
+ const _self = this;
|
|
|
+ OrderApi.AddSaveAddress(params,function(res){
|
|
|
+ if(res.code === 0){
|
|
|
_self.saveLoading = false;
|
|
|
- _self.isShowAddressForm = false;
|
|
|
+ CAIMEI.dialog('保存成功');
|
|
|
+ let data = res.data
|
|
|
// 重新获取地址列表
|
|
|
_self.getAddressList(_self.userId,20);
|
|
|
+ // 重新请求查询运费
|
|
|
+ setTimeout(()=>{
|
|
|
+ _self.confirmParam.addressId = data.addressId
|
|
|
+ _self.productParam.townId = data.townId
|
|
|
+ _self.cartParam.townId = data.townId
|
|
|
+ _self.supportParm.townId = data.townId
|
|
|
+ if(_self.urlType === 1) {//购物车提交
|
|
|
+ _self.balance.flag = false
|
|
|
+ _self.getCartCreateOrderInfo()
|
|
|
+ }
|
|
|
+ if(_self.urlType === 2) {//商品提交
|
|
|
+ _self.balance.flag = false
|
|
|
+ _self.getProductCreateOrderInfo()
|
|
|
+ }
|
|
|
+ if(this.urlType === 3) {//配套商品提交
|
|
|
+ _self.balance.flag = false
|
|
|
+ _self.OrderClubProductSupporting()
|
|
|
+ }
|
|
|
+ _self.address.townId = data.townId;
|
|
|
+ _self.address.cityId = data.cityId;
|
|
|
+ _self.address.provinceId = data.provinceId;
|
|
|
+ _self.address.name = data.receiver;
|
|
|
+ _self.address.mobile = data.mobile;
|
|
|
+ _self.address.desc = data.address;
|
|
|
+ _self.address.town = data.town;
|
|
|
+ _self.address.city = data.city;
|
|
|
+ _self.address.province = data.province;
|
|
|
+ _self.address.default = (data.defaultFlag > 0);
|
|
|
+ },500)
|
|
|
+ _self.isShowAddressForm = false;
|
|
|
}else{
|
|
|
- CAIMEI.Alert(r.msg,'确定',false);
|
|
|
+ CAIMEI.Alert(res.msg,'确定',false);
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- setDefaultAddress: function(addressId){// 列表直接设为默认地址
|
|
|
- var _self = this;
|
|
|
+ setDefaultAddress(addressId){// 列表直接设为默认地址
|
|
|
+ const _self = this;
|
|
|
OrderApi.DefaultAddress({addressId:addressId,userId:_self.userId},function (r) {
|
|
|
if(r.code === 0 ){
|
|
|
// 重新获取地址列表
|
|
@@ -473,8 +416,8 @@ var shoppingConfirm = new Vue({
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- deleteAddress: function(addressId){// 列表删除单个地址
|
|
|
- var _self = this;
|
|
|
+ deleteAddress(addressId){// 列表删除单个地址
|
|
|
+ const _self = this;
|
|
|
CAIMEI.Modal('确定要删除该地址?','取消','确定',function () {
|
|
|
OrderApi.DeleteAddress({addressId:addressId,userId:_self.userId},function (r) {
|
|
|
if(r.code === 0 ){
|
|
@@ -487,17 +430,20 @@ var shoppingConfirm = new Vue({
|
|
|
})
|
|
|
});
|
|
|
},
|
|
|
- chooseAddress: function(selectedId){
|
|
|
- this.address.selectedId = selectedId;
|
|
|
+ chooseAddress(address){//选择地址
|
|
|
+ this.address.selectedId = address.addressId
|
|
|
},
|
|
|
- confirmAddress: function(){// 确认地址并查询邮费
|
|
|
- var _self = this;
|
|
|
- _self.addressList.forEach(function(item){
|
|
|
- if (_self.address.selectedId==item.addressId){
|
|
|
+ // 确认地址并重新查运费
|
|
|
+ confirmAddress(){
|
|
|
+ const _self = this;
|
|
|
+ this.addressList.forEach(function(item){
|
|
|
+ if (_self.address.selectedId===item.addressId){
|
|
|
_self.address.id = item.addressId;
|
|
|
_self.confirmParam.addressId = item.addressId;
|
|
|
_self.address.townId = item.townId;
|
|
|
- _self.postageParam.townId = item.townId;
|
|
|
+ _self.productParam.townId = item.townId;
|
|
|
+ _self.cartParam.townId = item.townId;
|
|
|
+ _self.supportParm.townId = item.townId;
|
|
|
_self.address.cityId = item.cityId;
|
|
|
_self.address.provinceId = item.provinceId;
|
|
|
_self.address.name = item.receiver;
|
|
@@ -507,17 +453,28 @@ var shoppingConfirm = new Vue({
|
|
|
_self.address.city = item.city;
|
|
|
_self.address.province = item.province;
|
|
|
_self.address.default = (item.defaultFlag > 0);
|
|
|
- _self.getFreight();
|
|
|
}
|
|
|
});
|
|
|
+ if(this.urlType === 1) {//购物车提交
|
|
|
+ this.balance.flag = false
|
|
|
+ this.getCartCreateOrderInfo()
|
|
|
+ }
|
|
|
+ if(this.urlType === 2) {//购物车提交
|
|
|
+ this.balance.flag = false
|
|
|
+ this.getProductCreateOrderInfo()
|
|
|
+ }
|
|
|
+ if(this.urlType === 3) {//购物车提交
|
|
|
+ this.balance.flag = false
|
|
|
+ this.OrderClubProductSupporting()
|
|
|
+ }
|
|
|
this.closeAddressBox();
|
|
|
},
|
|
|
- checkedCoupon:function(idx){// 选择优惠券
|
|
|
- var _self = this;
|
|
|
+ checkedCoupon(idx){// 选择优惠券
|
|
|
+ const _self = this;
|
|
|
var coupon = { couponAmount:0,clubCouponId:0 };
|
|
|
- _self.checkedIndex = idx;
|
|
|
- _self.couponList.forEach((el,index) => {
|
|
|
- if(_self.checkedIndex == index){
|
|
|
+ this.checkedIndex = idx;
|
|
|
+ this.couponList.forEach((el,index) => {
|
|
|
+ if(_self.checkedIndex === index){
|
|
|
el.ischecked = !el.ischecked;
|
|
|
}else{
|
|
|
el.ischecked = false;
|
|
@@ -527,14 +484,14 @@ var shoppingConfirm = new Vue({
|
|
|
coupon.clubCouponId = el.clubCouponId;
|
|
|
}
|
|
|
})
|
|
|
- _self.couponAmount = coupon.couponAmount;
|
|
|
- _self.totalDiscountAmount = _self.reducedPrice + _self.couponAmount;
|
|
|
- _self.confirmParam.clubCouponId = coupon.clubCouponId;
|
|
|
- _self.changeDeductibleFreight();
|
|
|
- _self.useUserMoney();
|
|
|
- },
|
|
|
- toggleThisLadder: function(event){
|
|
|
- var el = event.currentTarget;
|
|
|
+ this.couponAmount = coupon.couponAmount;
|
|
|
+ this.totalDiscountAmount = this.reducedPrice + this.couponAmount;
|
|
|
+ this.confirmParam.clubCouponId = coupon.clubCouponId;
|
|
|
+ // this.changeDeductibleFreight();
|
|
|
+ this.attributePallPrice();
|
|
|
+ },
|
|
|
+ toggleThisLadder(event){
|
|
|
+ const el = event.currentTarget;
|
|
|
if($(el).hasClass("on")){
|
|
|
$(el).removeClass("on").siblings('.mFixed').hide();
|
|
|
if(!isPC){looseBody();}
|
|
@@ -543,13 +500,13 @@ var shoppingConfirm = new Vue({
|
|
|
if(!isPC){fixedBody();}
|
|
|
}
|
|
|
},
|
|
|
- hideThisLadder: function(event){
|
|
|
+ hideThisLadder(event){
|
|
|
var el = event.currentTarget;
|
|
|
$(el).parents('.priceTag').find('.tag').removeClass("on").siblings('.mFixed').hide();
|
|
|
if(!isPC){looseBody();}
|
|
|
},
|
|
|
- useUserMoney: function(){//勾选余额抵扣
|
|
|
- var _self = this;
|
|
|
+ useUserMoney(){//勾选余额抵扣
|
|
|
+ const _self = this;
|
|
|
if(this.balance.userMoney>0){
|
|
|
this.$nextTick(function() {
|
|
|
var total = _self.totalPrice + _self.hanldPostage - _self.couponAmount; // 订单总金额 + 邮费金额
|
|
@@ -594,77 +551,77 @@ var shoppingConfirm = new Vue({
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
- changeDeductibleFreight: function(){//选择采美豆抵扣邮费
|
|
|
- var _self = this;
|
|
|
- var total = _self.totalPrice + _self.hanldPostage - _self.couponAmount;
|
|
|
- if(_self.balance.isFreight){//判断是否勾选运费
|
|
|
- if(_self.confirmParam.payInfo.postageFlag == 1){//有邮费
|
|
|
- _self.confirmParam.payInfo.userBeans = _self.freightBeansMoney*100;
|
|
|
- if( _self.userBeans > 0 ){// 判断采美豆大于0
|
|
|
- if(_self.balance.flag) {// 勾选了余额抵扣
|
|
|
+ changeDeductibleFreight(){//选择采美豆抵扣邮费
|
|
|
+ const _self = this;
|
|
|
+ const total = this.totalPrice + this.hanldPostage - this.couponAmount;
|
|
|
+ if(this.balance.isFreight){//判断是否勾选运费
|
|
|
+ if(this.confirmParam.payInfo.postageFlag === 1){//有邮费
|
|
|
+ this.confirmParam.payInfo.userBeans = this.freightBeansMoney*100;
|
|
|
+ if( this.userBeans > 0 ){// 判断采美豆大于0
|
|
|
+ if(this.balance.flag) {// 勾选了余额抵扣
|
|
|
console.log('订单总额',total)
|
|
|
- if(_self.balance.userMoney>=total){ // 全部抵扣
|
|
|
- _self.hanldShouldPayFee = 0;
|
|
|
- _self.balance.deductMoney = _self.totalPrice - _self.couponAmount; // 抵扣使用金额 = 订单总金额
|
|
|
- _self.balance.surplusMoney = _self.repiceNumSub(_self.balance.userMoney,_self.balance.deductMoney); // 抵扣后剩余余额 = 余额总额 - 抵扣使用金额
|
|
|
+ if(this.balance.userMoney>=total){ // 全部抵扣
|
|
|
+ this.hanldShouldPayFee = 0;
|
|
|
+ this.balance.deductMoney = this.totalPrice - this.couponAmount; // 抵扣使用金额 = 订单总金额
|
|
|
+ this.balance.surplusMoney = this.repiceNumSub(this.balance.userMoney,this.balance.deductMoney); // 抵扣后剩余余额 = 余额总额 - 抵扣使用金额
|
|
|
console.log('有勾选余额抵扣全抵',_self.hanldShouldPayFee)
|
|
|
}else{ // 部分抵扣
|
|
|
- _self.hanldShouldPayFee = _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.hanldShouldPayFee)
|
|
|
+ this.hanldShouldPayFee = this.repiceNumSub(this.totalPrice,this.balance.userMoney) - this.couponAmount;
|
|
|
+ this.balance.deductMoney = this.balance.userMoney; // 抵扣使用金额 = 余额总额
|
|
|
+ this.balance.surplusMoney = this.repiceNumSub(this.balance.userMoney,this.balance.deductMoney); // 抵扣后剩余余额 = 余额总额 - 抵扣使用金额
|
|
|
+ console.log('有勾选余额抵扣部分抵',this.hanldShouldPayFee)
|
|
|
}
|
|
|
}else{
|
|
|
- _self.hanldShouldPayFee = ((_self.totalPrice*100 + _self.hanldPostage*100 - _self.freightBeansMoney*100)/100) - _self.couponAmount;
|
|
|
- console.log('无余额抵扣',_self.hanldShouldPayFee)
|
|
|
+ this.hanldShouldPayFee = ((this.totalPrice*100 + this.hanldPostage*100 - this.freightBeansMoney*100)/100) - this.couponAmount;
|
|
|
+ console.log('无余额抵扣',this.hanldShouldPayFee)
|
|
|
}
|
|
|
}
|
|
|
- }else if(_self.confirmParam.payInfo.postageFlag == -1){// 到付
|
|
|
- _self.confirmParam.payInfo.userBeans = _self.freightBeansMoney*100;
|
|
|
- if(_self.balance.flag) {// 勾选了余额抵扣
|
|
|
- if(_self.balance.userMoney >= total){ // 全部抵扣
|
|
|
- _self.hanldShouldPayFee = 0;
|
|
|
- _self.balance.deductMoney = _self.totalPrice - _self.couponAmount; // 抵扣使用金额 = 订单总金额
|
|
|
- _self.balance.surplusMoney = _self.repiceNumSub(_self.balance.userMoney,_self.balance.deductMoney); // 抵扣后剩余余额 = 余额总额 - 抵扣使用金额
|
|
|
- console.log('到付有勾选余额抵扣全抵',_self.hanldShouldPayFee)
|
|
|
+ }else if(this.confirmParam.payInfo.postageFlag == -1){// 到付
|
|
|
+ this.confirmParam.payInfo.userBeans = this.freightBeansMoney*100;
|
|
|
+ if(this.balance.flag) {// 勾选了余额抵扣
|
|
|
+ if(this.balance.userMoney >= total){ // 全部抵扣
|
|
|
+ this.hanldShouldPayFee = 0;
|
|
|
+ this.balance.deductMoney = this.totalPrice - this.couponAmount; // 抵扣使用金额 = 订单总金额
|
|
|
+ this.balance.surplusMoney = this.repiceNumSub(this.balance.userMoney,this.balance.deductMoney); // 抵扣后剩余余额 = 余额总额 - 抵扣使用金额
|
|
|
+ console.log('到付有勾选余额抵扣全抵',this.hanldShouldPayFee)
|
|
|
}else{ // 部分抵扣
|
|
|
- _self.hanldShouldPayFee =_self.hanldShouldPayFee = _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.hanldShouldPayFee)
|
|
|
+ this.hanldShouldPayFee =this.hanldShouldPayFee = this.repiceNumSub(this.totalPrice,this.balance.userMoney) - this.couponAmount;
|
|
|
+ this.balance.deductMoney = this.balance.userMoney; // 抵扣使用金额 = 余额总额
|
|
|
+ this.balance.surplusMoney = this.repiceNumSub(this.balance.userMoney,this.balance.deductMoney); // 抵扣后剩余余额 = 余额总额 - 抵扣使用金额
|
|
|
+ console.log('到付有勾选余额抵扣部分抵',this.hanldShouldPayFee)
|
|
|
}
|
|
|
}else{
|
|
|
- _self.hanldShouldPayFee = _self.totalPrice - _self.couponAmount ;
|
|
|
- console.log('到付未勾选余额抵扣',_self.hanldShouldPayFee)
|
|
|
+ this.hanldShouldPayFee = this.totalPrice - this.couponAmount ;
|
|
|
+ console.log('到付未勾选余额抵扣',this.hanldShouldPayFee)
|
|
|
}
|
|
|
}else{
|
|
|
- _self.confirmParam.payInfo.userBeans = 0;
|
|
|
- _self.hanldShouldPayFee = _self.totalPrice - _self.couponAmount ;
|
|
|
- console.log('其他',_self.hanldShouldPayFee)
|
|
|
+ this.confirmParam.payInfo.userBeans = 0;
|
|
|
+ this.hanldShouldPayFee = this.totalPrice - this.couponAmount ;
|
|
|
+ console.log('其他',this.hanldShouldPayFee)
|
|
|
}
|
|
|
}else{
|
|
|
console.log('未勾选采美豆抵扣')
|
|
|
- _self.confirmParam.payInfo.userBeans = 0;
|
|
|
- if(_self.balance.flag) {//如果勾选了余额抵扣
|
|
|
- if(_self.balance.userMoney>=total) { // 全部抵扣
|
|
|
+ this.confirmParam.payInfo.userBeans = 0;
|
|
|
+ if(this.balance.flag) {//如果勾选了余额抵扣
|
|
|
+ if(this.balance.userMoney>=total) { // 全部抵扣
|
|
|
console.log('勾选采美豆抵扣=========》',total)
|
|
|
- _self.hanldShouldPayFee = 0 ;
|
|
|
- _self.balance.deductMoney = total; // 抵扣使用金额 = (订单总金额+邮费金额-优惠券价格)
|
|
|
- _self.balance.surplusMoney = _self.repiceNumSub(_self.balance.userMoney,_self.balance.deductMoney); // 抵扣后剩余余额 = 余额总额 - 抵扣使用金额
|
|
|
- console.log('余额全抵抵未勾选采美豆抵扣',_self.hanldShouldPayFee)
|
|
|
+ this.hanldShouldPayFee = 0 ;
|
|
|
+ this.balance.deductMoney = total; // 抵扣使用金额 = (订单总金额+邮费金额-优惠券价格)
|
|
|
+ this.balance.surplusMoney = this.repiceNumSub(this.balance.userMoney,this.balance.deductMoney); // 抵扣后剩余余额 = 余额总额 - 抵扣使用金额
|
|
|
+ console.log('余额全抵抵未勾选采美豆抵扣',this.hanldShouldPayFee)
|
|
|
}else{
|
|
|
console.log('未勾选采美豆抵扣=========》',total)
|
|
|
- _self.hanldShouldPayFee = _self.repiceNumSub(total,_self.balance.userMoney);
|
|
|
- _self.balance.deductMoney = _self.balance.userMoney; // 抵扣使用金额 = (订单总金额+邮费金额)
|
|
|
- _self.balance.surplusMoney = _self.repiceNumSub(_self.balance.userMoney,_self.balance.deductMoney); // 抵扣后剩余余额 = 余额总额 - 抵扣使用金额
|
|
|
- console.log('余额部分抵未勾选采美豆抵扣',_self.hanldShouldPayFee)
|
|
|
+ this.hanldShouldPayFee = this.repiceNumSub(total,this.balance.userMoney);
|
|
|
+ this.balance.deductMoney = this.balance.userMoney; // 抵扣使用金额 = (订单总金额+邮费金额)
|
|
|
+ this.balance.surplusMoney = this.repiceNumSub(this.balance.userMoney,this.balance.deductMoney); // 抵扣后剩余余额 = 余额总额 - 抵扣使用金额
|
|
|
+ console.log('余额部分抵未勾选采美豆抵扣',this.hanldShouldPayFee)
|
|
|
}
|
|
|
}else{
|
|
|
- _self.hanldShouldPayFee = (_self.totalPrice + _self.hanldPostage) - _self.couponAmount;
|
|
|
+ this.hanldShouldPayFee = (this.totalPrice + this.hanldPostage) - this.couponAmount;
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- repiceNumSub: function(arg1, arg2) {//减法精确,arg2:被减数,arg1:减数
|
|
|
+ repiceNumSub(arg1, arg2) {//减法精确,arg2:被减数,arg1:减数
|
|
|
var r1,r2,m,n;
|
|
|
try{
|
|
|
r1=arg1.toString().split(".")[1].length
|
|
@@ -690,55 +647,56 @@ var shoppingConfirm = new Vue({
|
|
|
}
|
|
|
},
|
|
|
handleClickOrderSubmitMit() {// 提交订单
|
|
|
- var _self = this;
|
|
|
- _self.isModelAlert = false;
|
|
|
- if(_self.submitLoading){return false;}
|
|
|
- if(!_self.confirmParam.addressId){
|
|
|
+ const _self = this;
|
|
|
+ this.isModelAlert = false;
|
|
|
+ if(this.submitLoading){return false;}
|
|
|
+ if(!this.confirmParam.addressId){
|
|
|
CAIMEI.dialog('请先添加收货地址~');
|
|
|
return false;
|
|
|
}
|
|
|
- if(_self.orderInvoice.type*1 === 1){
|
|
|
+ if(this.orderInvoice.type*1 === 1){
|
|
|
// 普通发票
|
|
|
- if(!_self.orderInvoice.invoiceTitle){
|
|
|
+ if(!this.orderInvoice.invoiceTitle){
|
|
|
CAIMEI.dialog('请输入个人抬头');return false;
|
|
|
}
|
|
|
- if(_self.orderInvoice.invoiceTitleType===1 && !_self.orderInvoice.corporationTaxNum){
|
|
|
+ if(this.orderInvoice.invoiceTitleType===1 && !_self.orderInvoice.corporationTaxNum){
|
|
|
CAIMEI.dialog('请输入纳税人识别号');return false;
|
|
|
}
|
|
|
- }else if(_self.orderInvoice.type*1 === 2){
|
|
|
+ }else if(this.orderInvoice.type*1 === 2){
|
|
|
// 增值税发票
|
|
|
- if(!_self.orderInvoice.invoiceTitle){
|
|
|
+ if(!this.orderInvoice.invoiceTitle){
|
|
|
CAIMEI.dialog('请输入个人抬头');return false;
|
|
|
}
|
|
|
- if(!_self.orderInvoice.corporationTaxNum){
|
|
|
+ if(!this.orderInvoice.corporationTaxNum){
|
|
|
CAIMEI.dialog('请输入纳税人识别号');return false;
|
|
|
}
|
|
|
- if(!_self.orderInvoice.registeredAddress){
|
|
|
+ if(!this.orderInvoice.registeredAddress){
|
|
|
CAIMEI.dialog('请输入单位地址');return false;
|
|
|
}
|
|
|
- if(!_self.orderInvoice.registeredPhone){
|
|
|
+ if(!this.orderInvoice.registeredPhone){
|
|
|
CAIMEI.dialog('请输入注册电话');return false;
|
|
|
}
|
|
|
- if(!_self.orderInvoice.openBank){
|
|
|
+ if(!this.orderInvoice.openBank){
|
|
|
CAIMEI.dialog('请输入开户银行');return false;
|
|
|
}
|
|
|
- if(!_self.orderInvoice.bankAccountNo){
|
|
|
+ if(!this.orderInvoice.bankAccountNo){
|
|
|
CAIMEI.dialog('请输入银行账号');return false;
|
|
|
}
|
|
|
}
|
|
|
// 禁用按钮
|
|
|
- _self.submitLoading = true;
|
|
|
+ this.submitLoading = true;
|
|
|
// 发票信息
|
|
|
- if(_self.confirmParam.orderInvoice.type*1 === 0){
|
|
|
- _self.confirmParam.orderInvoice = Object.assign(_self.confirmParam.orderInvoice,'',{type:0});
|
|
|
- }else if(_self.confirmParam.orderInvoice.type*1 === 1){
|
|
|
- _self.confirmParam.orderInvoice = Object.assign(_self.confirmParam.orderInvoice,'',{type:1, invoiceContent: '商品明细'});
|
|
|
- }else if(_self.confirmParam.orderInvoice.type*1 === 2){
|
|
|
- _self.confirmParam.orderInvoice = Object.assign(_self.confirmParam.orderInvoice,'',{type:2});
|
|
|
+ if(this.confirmParam.orderInvoice.type*1 === 0){
|
|
|
+ this.confirmParam.orderInvoice = Object.assign(this.confirmParam.orderInvoice,'',{type:0});
|
|
|
+ }else if(this.confirmParam.orderInvoice.type*1 === 1){
|
|
|
+ this.confirmParam.orderInvoice = Object.assign(this.confirmParam.orderInvoice,'',{type:1, invoiceContent: '商品明细'});
|
|
|
+ }else if(this.confirmParam.orderInvoice.type*1 === 2){
|
|
|
+ this.confirmParam.orderInvoice = Object.assign(this.confirmParam.orderInvoice,'',{type:2});
|
|
|
}
|
|
|
//商品信息
|
|
|
- _self.confirmParam.orderInfo = _self.listData.map(el => {
|
|
|
- var productInfo = [];
|
|
|
+ this.confirmParam.orderInfo = this.listData.map(el => {
|
|
|
+ const productInfo = [];
|
|
|
+ el.postageFlag = el.handlePostageFlag
|
|
|
el.cartList.forEach(cart => {
|
|
|
productInfo.push({
|
|
|
skuId:cart.skuId,
|
|
@@ -748,55 +706,39 @@ var shoppingConfirm = new Vue({
|
|
|
productType:cart.giftType
|
|
|
})
|
|
|
})
|
|
|
- return {splitCode:el.splitCode,shopId:el.shopId,note:el.note?el.note:'',productInfo:productInfo}
|
|
|
+ return {
|
|
|
+ splitCode:el.splitCode,
|
|
|
+ shopId:el.shopId,
|
|
|
+ note:el.note ? el.note : '',
|
|
|
+ postage:parseInt(el.postage).toFixed(2),
|
|
|
+ postageFlag: parseInt(el.postageFlag),
|
|
|
+ isColdChina:el.isColdChina ? 1 : 0,
|
|
|
+ productInfo:productInfo
|
|
|
+ }
|
|
|
});
|
|
|
- if(_self.orderInvoice.type!=0){
|
|
|
- _self.orderInvoice.type = parseInt(_self.orderInvoice.type)
|
|
|
- _self.confirmParam.orderInvoice = _self.orderInvoice;
|
|
|
+ if(this.orderInvoice.type!==0){
|
|
|
+ this.orderInvoice.type = parseInt(this.orderInvoice.type)
|
|
|
+ this.confirmParam.orderInvoice = this.orderInvoice;
|
|
|
}
|
|
|
- _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);
|
|
|
- _self.confirmParam.orderInfo = JSON.stringify(_self.confirmParam.orderInfo);
|
|
|
- _self.confirmParam.orderInvoice = JSON.stringify(_self.confirmParam.orderInvoice);
|
|
|
- console.log('confirmParam',_self.confirmParam);
|
|
|
- _self.handleConfirmOrder();
|
|
|
- },
|
|
|
- createdOrderVerify(params) {// 还原提交订单参数格式
|
|
|
- const _self = this;
|
|
|
- OrderApi.createdOrderVerify(params,function (res) {
|
|
|
- if (res.data.code === -1) {
|
|
|
-
|
|
|
- }else{
|
|
|
- _self.handleConfirmOrder();
|
|
|
- }
|
|
|
- })
|
|
|
+ this.confirmParam.payInfo.orderShouldPayFee = parseFloat(this.hanldShouldPayFee).toFixed(2);
|
|
|
+ this.confirmParam.payInfo = JSON.stringify(this.confirmParam.payInfo);
|
|
|
+ this.confirmParam.orderInfo = JSON.stringify(this.confirmParam.orderInfo);
|
|
|
+ this.confirmParam.orderInvoice = JSON.stringify(this.confirmParam.orderInvoice);
|
|
|
+ console.log('confirmParam',this.confirmParam);
|
|
|
+ this.handleConfirmOrder();
|
|
|
},
|
|
|
handleConfirmOrder(){// 提交
|
|
|
const _self = this;
|
|
|
OrderApi.ConfirmOrder(_self.confirmParam,function (res) {
|
|
|
if(res.code === 0){
|
|
|
- var data = res.data;
|
|
|
+ const data = res.data;
|
|
|
if(data.code === 1){//余额抵扣全部订单金额
|
|
|
- var Amount = { payableAmount: _self.deductMoney };
|
|
|
+ const Amount = {payableAmount: _self.deductMoney};
|
|
|
CAIMEI.Storage.removeItem('confirmOrderInfo');
|
|
|
CAIMEI.Storage.setItem('confirmOrderInfo',JSON.stringify({data:Amount}));
|
|
|
window.location.href = '/pay/success.html?pageType=www&type=success&payAmount='+data.payTotalFee;
|
|
|
}else{//余额抵扣部分订单金额或者未支付的
|
|
|
- if(data.onlinePayFlag === 1){// 走线下支付
|
|
|
- window.location.href = '/pay/caimei-payunder.html?orderId='+data.orderId;
|
|
|
- }else{
|
|
|
- var order = {
|
|
|
- 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-paylist.html?orderId='+data.orderId;
|
|
|
- }
|
|
|
+ window.location.href = '/pay/caimei-paylist.html?orderId='+data.orderId;
|
|
|
}
|
|
|
}else {
|
|
|
_self.handleError(res)
|
|
@@ -806,29 +748,29 @@ var shoppingConfirm = new Vue({
|
|
|
handleError(data){// 异常处理弹窗
|
|
|
const _self = this;
|
|
|
if(data.code === -5) {
|
|
|
- _self.isModelAlert = true;
|
|
|
- _self.isShowConfirm = 1;
|
|
|
- _self.submitLoading = false;
|
|
|
- _self.isModelAlertText = '采购金额过小,将扣除500采美豆。建议您使用微信扫描 以下二维码,进入采美旗下“颜选美学”小程序购买小额 商品。';
|
|
|
- _self.formatConfirmParam();
|
|
|
+ this.isModelAlert = true;
|
|
|
+ this.isShowConfirm = 1;
|
|
|
+ this.submitLoading = false;
|
|
|
+ this.isModelAlertText = '采购金额过小,将扣除500采美豆。建议您使用微信扫描 以下二维码,进入采美旗下“颜选美学”小程序购买小额 商品。';
|
|
|
+ this.formatConfirmParam();
|
|
|
}else if(data.code === -6){
|
|
|
- _self.isModelAlert = true;
|
|
|
- _self.isShowConfirm = 2;
|
|
|
- _self.submitLoading = false;
|
|
|
- _self.isModelAlertText = '订单内存在械字号三类商品,需要拥有医疗执业许可证的医美机构才能购买。建议升级医美机构后再下单,否则会导致订单退款或影响发货。';
|
|
|
- _self.formatConfirmParam();
|
|
|
+ this.isModelAlert = true;
|
|
|
+ this.isShowConfirm = 2;
|
|
|
+ this.submitLoading = false;
|
|
|
+ this.isModelAlertText = '订单内存在械字号三类商品,需要拥有医疗执业许可证的医美机构才能购买。建议升级医美机构后再下单,否则会导致订单退款或影响发货。';
|
|
|
+ this.formatConfirmParam();
|
|
|
}else if(data.code === -3){
|
|
|
- _self.isModelAlert = true;
|
|
|
- _self.isShowConfirm = 3;
|
|
|
- _self.submitLoading = false;
|
|
|
- _self.isModelAlertText = '您已有2个采购金额过小的订单,本次不能再进行采购。您可使用微信扫描以下二维码,进入采美旗下“颜选美学”小程序购买小额商品。';
|
|
|
- _self.formatConfirmParam();
|
|
|
+ this.isModelAlert = true;
|
|
|
+ this.isShowConfirm = 3;
|
|
|
+ this.submitLoading = false;
|
|
|
+ this.isModelAlertText = '您已有2个采购金额过小的订单,本次不能再进行采购。您可使用微信扫描以下二维码,进入采美旗下“颜选美学”小程序购买小额商品。';
|
|
|
+ this.formatConfirmParam();
|
|
|
}else if(data.code === -4){
|
|
|
- _self.isModelAlert = true;
|
|
|
- _self.isShowConfirm = 4;
|
|
|
- _self.submitLoading = false;
|
|
|
- _self.isModelAlertText = '采美豆不足,不能提交订单。您可使用微信扫描以下二维码,进入采美旗下“颜选美学”小程序购买小额商品。';
|
|
|
- _self.formatConfirmParam();
|
|
|
+ this.isModelAlert = true;
|
|
|
+ this.isShowConfirm = 4;
|
|
|
+ this.submitLoading = false;
|
|
|
+ this.isModelAlertText = '采美豆不足,不能提交订单。您可使用微信扫描以下二维码,进入采美旗下“颜选美学”小程序购买小额商品。';
|
|
|
+ this.formatConfirmParam();
|
|
|
}else{
|
|
|
CAIMEI.Alert(data.msg,'确定',true, function(){
|
|
|
setTimeout(function(){
|
|
@@ -868,37 +810,46 @@ var shoppingConfirm = new Vue({
|
|
|
return skuIds.join(',');
|
|
|
}
|
|
|
},
|
|
|
- created: function () {
|
|
|
- var _self = this;
|
|
|
- var urlType = getUrlParam("type") ? getUrlParam("type")*1 : "";
|
|
|
+ mounted: function () {
|
|
|
+ const _self = this;
|
|
|
+ this.urlType = getUrlParam("type") ? getUrlParam("type") * 1 : "";
|
|
|
if(globalUserData){
|
|
|
- _self.userId = _self.productParam.userId = _self.cartParam.userId = _self.postageParam.userId = _self.supportParm.userId = globalUserData.userId;
|
|
|
- _self.confirmParam.unionId = globalUserData.unionId ? globalUserData.unionId : '';
|
|
|
- _self.confirmParam.clubId = globalUserData.clubId
|
|
|
- _self.userIdentity = globalUserData.identity;
|
|
|
- _self.userToken = globalUserData.token;
|
|
|
+ this.userId = this.productParam.userId = this.cartParam.userId = this.supportParm.userId = globalUserData.userId;
|
|
|
+ this.confirmParam.unionId = globalUserData.unionId ? globalUserData.unionId : '';
|
|
|
+ this.confirmParam.clubId = globalUserData.clubId
|
|
|
+ this.userIdentity = globalUserData.identity;
|
|
|
+ this.userToken = globalUserData.token;
|
|
|
// type:(1购物车提交[对应表cm_cart],2直接购买提交, 3协销下单)
|
|
|
- if(urlType === 1) {//购物车提交
|
|
|
- _self.confirmParam.cartType = 1;
|
|
|
- _self.cartParam.skuIds = _self.productIds = window.localStorage.getItem("shoppingSkuIds");
|
|
|
- // 获取列表数据
|
|
|
- _self.getCartCreateOrderInfo();
|
|
|
- }else if(urlType === 2){//立即购买
|
|
|
- _self.confirmParam.cartType = 2;
|
|
|
- _self.productParam.productId = _self.productIds = getUrlParam("productId");
|
|
|
- _self.productParam.productCount = getUrlParam("count");
|
|
|
- _self.productParam.skuId = getUrlParam("skuId");
|
|
|
- if(_self.productParam.productId && _self.productParam.productCount) {
|
|
|
- _self.getProductCreateOrderInfo();
|
|
|
+ if(this.urlType === 1) {//购物车提交
|
|
|
+ this.confirmParam.cartType = 1;
|
|
|
+ this.cartParam.skuIds = this.productIds = window.localStorage.getItem("shoppingSkuIds");
|
|
|
+ this.getAddressList(this.userId,20);
|
|
|
+ console.log('cartParam',this.cartParam)
|
|
|
+ setTimeout(()=>{
|
|
|
+ this.getCartCreateOrderInfo();
|
|
|
+ },500)
|
|
|
+ }else if(this.urlType === 2){//立即购买
|
|
|
+ this.confirmParam.cartType = 2;
|
|
|
+ this.productParam.productId = this.productIds = getUrlParam("productId");
|
|
|
+ this.productParam.productCount = getUrlParam("count");
|
|
|
+ this.productParam.skuId = getUrlParam("skuId");
|
|
|
+ this.getAddressList(this.userId,20);
|
|
|
+ console.log('productParam',this.productParam)
|
|
|
+ if(this.productParam.productId && this.productParam.productCount) {
|
|
|
+ setTimeout(()=>{
|
|
|
+ this.getProductCreateOrderInfo();
|
|
|
+ },500)
|
|
|
}
|
|
|
- }else if(urlType === 3){// 组合商品立即购买
|
|
|
- _self.confirmParam.cartType = 2;
|
|
|
- _self.supportParm.productInfo = CAIMEI.Storage.getItem("KEY_SUPPORE");
|
|
|
- _self.OrderClubProductSupporting()
|
|
|
+ }else if(this.urlType === 3){// 组合商品立即购买
|
|
|
+ this.confirmParam.cartType = 2;
|
|
|
+ this.supportParm.productInfo = CAIMEI.Storage.getItem("KEY_SUPPORE");
|
|
|
+ this.getAddressList(this.userId,20);
|
|
|
+ console.log('supportParm',this.supportParm)
|
|
|
+ setTimeout(()=>{
|
|
|
+ this.OrderClubProductSupporting();
|
|
|
+ },500)
|
|
|
}
|
|
|
}
|
|
|
- },
|
|
|
- mounted: function () {
|
|
|
// 底部导航栏悬浮
|
|
|
$(window).on('scroll', function(){
|
|
|
if($(window).scrollTop() + window.innerHeight > $('footer').offset().top){
|
|
@@ -908,7 +859,7 @@ var shoppingConfirm = new Vue({
|
|
|
}
|
|
|
})
|
|
|
// 底部导航栏高度不一致问题
|
|
|
- var height = $('#shoppingConfirm .summaryWrap').height() + 'px'
|
|
|
+ const height = $('#shoppingConfirm .summaryWrap').height() + 'px';
|
|
|
if(isPC){
|
|
|
$('#shoppingConfirm .summary-wrapper').css('height', height)
|
|
|
}else{
|