Commit c153124b authored by 黄奎's avatar 黄奎

页面修改

parent 53456d04
......@@ -50,9 +50,13 @@
vertical-align: bottom;
}
.goodlist .checkSpec {
border: 1px solid red !important;
}
</style>
<template>
<div class="flexOne companyManagement">
<div class="flexOne goodlist">
<div class="query-box">
<ul>
<li>
......@@ -158,8 +162,12 @@
<span
style="cursor:pointer;border:1px solid #dcdfe6;margin-left:5px;padding:4px;border-radius:5px"
v-for="(childItem,childIndex) in subItem.attr_list" :key="childIndex"
@click="chooseSpec(subIndex,childIndex),calcTotalPrice()">
{{childItem.attr_name}}</span>
@click="chooseSpec(subIndex,childIndex),calcTotalPrice()"
:class="{'checkSpec':subItem.checkId==childIndex}">
{{childItem.attr_name}}_
{{subItem.checkId}}_
{{childIndex}}
</span>
</td>
</tr>
</tbody>
......@@ -269,9 +277,11 @@
mallUserId: "", //用户Id
AddressId: 0, //收货地址Id
TotalPrice: 0, //总价格
specificationNameList: [], //规格列表
},
//当前选中商品
currentGoodsObj: {},
chooseAddressObj: {}, //选中的地址
};
},
methods: {
......@@ -283,6 +293,12 @@
this.orderMsg.mallUserId = "";
this.orderMsg.AddressId = 0;
this.orderMsg.TotalPrice = 0;
this.orderMsg.specificationNameList = [];
//清空临时对象
this.currentGoodsObj = {};
this.chooseAddressObj = {};
this.weChatData = [];
this.addressList = [];
},
//选择规格
chooseSpec(index, subIndex) {
......@@ -299,24 +315,28 @@
//计算总价格
calcTotalPrice() {
let sign = '';
let specificationNameList = [];
var tempSku = {};
if (this.currentGoodsObj.attr_groups && this.currentGoodsObj.attr_groups.length > 0) {
this.currentGoodsObj.attr_groups.forEach(x => {
if (x.checkId != -1) {
sign += (sign == '' ? '' : ':') + x.checkId;
this.currentGoodsObj.attr_groups.forEach(specItem => {
if (specItem.checkId != -1) {
sign += (sign == '' ? '' : ':') + specItem.checkId;
var subName = specItem.attr_group_name + ":" + specItem.checkName;
specificationNameList.push(subName);
}
});
}
if (this.currentGoodsObj.attr && this.currentGoodsObj.attr.length) {
this.currentGoodsObj.attr.forEach(x => {
if (x.sign_id == sign) {
tempSku = x;
this.currentGoodsObj.attr.forEach(specValue => {
if (specValue.sign_id == sign) {
tempSku = specValue;
}
});
}
if (tempSku != null && tempSku.price) {
this.orderMsg.GoodsId = this.currentGoodsObj.id;
this.orderMsg.SpecificationSort = tempSku.sign_id;
this.orderMsg.specificationNameList = specificationNameList;
this.orderMsg.TotalPrice = (parseFloat(tempSku.price) * parseFloat(this.orderMsg.Number)).toFixed(2);
}
},
......@@ -389,9 +409,18 @@
this.loading = false;
if (res.data.resultCode == 1) {
var tempArray = res.data.data.pageData;
if (tempArray && tempArray.length > 0) {
tempArray.forEach(item => {
if (item.attr_groups && item.attr_groups.length > 0) {
item.attr_groups.forEach(specItem => {
specItem.checkId = 0; //选择的规格索引
specItem.checkName = ""; //选择的规格名称
})
}
})
}
this.DataList = tempArray;
this.msg.total = res.data.data.count;
console.log("this.DataList", JSON.parse(JSON.stringify(this.DataList)));
}
});
},
......@@ -440,11 +469,46 @@
let addressObj = this.addressList.find(item => {
return item.Id === this.orderMsg.AddressId; //筛选出匹配数据
});
console.log("addressObj", addressObj);
this.chooseAddressObj = addressObj;
},
//下单
SaveOrder() {
console.log("orderMsg", this.orderMsg);
var DetailList = [{
SpecificationSort: this.orderMsg.SpecificationSort,
Number: this.orderMsg.Number,
GoodsId: this.orderMsg.GoodsId,
SpecificationList: this.orderMsg.specificationNameList
}];
let orderData = {
Consignee: this.chooseAddressObj.Name,
Mobile: this.chooseAddressObj.Mobile,
Province: this.chooseAddressObj.Province,
City: this.chooseAddressObj.City,
District: this.chooseAddressObj.District,
ShoppingAddress: this.chooseAddressObj.Address,
BuyerMessage: "", //买家留言
DeliveryMethod: 1, //1-快递配送,2-到店自提,3-同城配送
DetailList: DetailList,
User_Coupon_Id: 0,
CouponMoney: 0, //优惠金额
FreightMoney: 0, //运费
Income: this.orderMsg.TotalPrice,
IsFormShoppingCart: 2,
Use_Integral: 0,
ShoppingCartIdList: [], //购物车编号
AnchorName: "", //主播名称
NewUserId: this.orderMsg.mallUserId,
NewShopId: this.getLocalStorage().MallSmallShopsId
}
this.mallapipost("/api/AppletOrder/SetERPGoodsOrderInfo", orderData, res => {
if (res.data.resultCode == 1) {
this.Success("下单成功!");
this.clreaMsg();
this.getGoodList();
} else {
this.Error(res.data.message);
}
})
}
},
mounted() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment