Commit f10de6ce authored by 黄奎's avatar 黄奎

页面修改

parent d07b7d63
......@@ -57,8 +57,9 @@
<ul>
<li>
<span>
<em>分类</em>
<el-select v-model="showCategoryName" placeholder="请选择" multiple clearable collapse-tags @change="selectChange">
<em>商品分类</em>
<el-select v-model="showCategoryName" placeholder="请选择" multiple clearable collapse-tags
@change="selectChange">
<el-option :value="chooseCategroyArray" style="height: auto">
<el-tree :data="CategoryList" show-checkbox node-key="Id" ref="tree" highlight-current
:props="defaultProps" @check-change="categoryCheckChange"></el-tree>
......@@ -68,7 +69,7 @@
</li>
<li>
<span>
<em>名称</em>
<em>商品名称</em>
<el-input v-model="msg.Name" class="w150" clearable></el-input>
</span>
</li>
......@@ -84,6 +85,7 @@
<thead>
<tr>
<th style="width:100px;">编号</th>
<th>分类</th>
<th style="width:250px;">
商品名称
</th>
......@@ -109,6 +111,13 @@
<td>
{{item.id}}
</td>
<td>
<template
v-if="item.erpgoodobj&&item.erpgoodobj.goods&&item.erpgoodobj.goods.cats&&item.erpgoodobj.goods.cats.length>0">
<span v-for="(subItem,subIndex) in item.erpgoodobj.goods.cats" :key="subIndex">{{subItem.CategoryName}}
</span>
</template>
</td>
<td>
{{item.name}}
</td>
......@@ -129,9 +138,89 @@
</template>
</td>
<td>
<a style="cursor:pointer;color:blue;">
下单
</a>
<el-popover placement="left" width="450" trigger="click">
<table>
<thead>
<tr>
<td colspan="2">
{{item.name}}
</td>
</tr>
</thead>
<tbody v-for="(subItem,subIndex) in item.attr_groups" :key="subIndex">
<tr>
<td colspan="2">
{{subItem.attr_group_name}}
</td>
</tr>
<tr>
<td colspan="2">
<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>
</td>
</tr>
</tbody>
<tbody>
<tr>
<td>
购买数量:
</td>
<td>
<el-input-number @change="calcTotalPrice()" v-model="orderMsg.Number" :min="1" :max="10"
label="请输入购买数量"></el-input-number>
</td>
</tr>
<tr>
<td>
选择用户:
</td>
<td>
<el-select v-model="orderMsg.mallUserId" filterable remote reserve-keyword placeholder="请输入微信昵称"
:remote-method="getWechatData" @change="weChatChange">
<el-option v-for="wItem in weChatData" :key="wItem.Id" :label="wItem.Name" :value="wItem.Id">
<span style="float: left">{{ wItem.Name }}
<template v-if="wItem.ShopId>0">
<span style="color:red;">{{ wItem.ShopName }}</span>
</template>
</span>
</el-option>
</el-select>
</td>
</tr>
<tr>
<td>
收货地址:
</td>
<td>
<el-select v-model="orderMsg.AddressId" placeholder="请选择">
<el-option v-for="aItem in addressList" :key="aItem.Id" :label="aItem.Name" :value="aItem.Id">
<span style="float: left">{{ aItem.Name }}【{{aItem.DistrictAddress}}{{aItem.Address}}】</span>
</el-option>
</el-select>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<td>
价格:
</td>
<td>
¥ {{orderMsg.TotalPrice}} 元
</td>
</tr>
</tfoot>
</table>
<p class="alcenter mt10">
<input type="button" :value="$t('pub.saveBtn')" @click="SaveOrder()" class="normalBtn" />
</p>
<el-button type="primary" icon="iconfont icon-beizhu" slot="reference"
style="background:#AD9AF6; border-color:#AD9AF6; border-radius: 0;" @click="currentGoodsObj=item">下单
</el-button>
</el-popover>
</td>
</tr>
</tbody>
......@@ -164,15 +253,63 @@
total: 0,
pageIndex: 1,
pageSize: 10,
Name: "", //商品名称
Name: "优质", //商品名称
CategoryIds: "", //商品分类
IsGetShare: 1, //获取分销
ERPUserId: 0, //商城用户Id
ERPSmallShopId: 0, //用户店铺Id
},
weChatData: [], //微信用户列表
addressList: [], //收货地址列表
orderMsg: {
GoodsId: 0, //商品编号
Number: 1, //商品数量
SpecificationSort: "", //规格
mallUserId: "", //用户Id
AddressId: 0, //收货地址Id
TotalPrice: 0, //总价格
},
//当前选中商品
currentGoodsObj: {},
};
},
methods: {
//选择规格
chooseSpec(index, subIndex) {
var tempObj = this.currentGoodsObj.attr_groups[index].attr_list[subIndex];
if (this.currentGoodsObj.attr_groups[index].checkId != tempObj.attr_id) {
this.currentGoodsObj.attr_groups[index].checkId = tempObj.attr_id;
this.currentGoodsObj.attr_groups[index].checkName = tempObj.attr_name;
} else {
this.currentGoodsObj.attr_groups[index].checkId = 0;
this.currentGoodsObj.attr_groups[index].checkName = this.currentGoodsObj.attr_groups[index]
.attr_group_name;
}
},
//计算总价格
calcTotalPrice() {
let sign = '';
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;
}
});
}
if (this.currentGoodsObj.attr && this.currentGoodsObj.attr.length) {
this.currentGoodsObj.attr.forEach(x => {
if (x.sign_id == sign) {
tempSku = x;
}
});
}
if (tempSku != null && tempSku.price) {
this.orderMsg.GoodsId = this.currentGoodsObj.id;
this.orderMsg.SpecificationSort = tempSku.sign_id;
this.orderMsg.TotalPrice = (parseFloat(tempSku.price) * parseFloat(this.orderMsg.Number)).toFixed(2);
}
},
//下拉框改变
selectChange(e) {
var arrNew = [];
......@@ -219,7 +356,6 @@
},
//获取商品列表
getGoodList() {
this.msg.CategoryIds = "";
var tempCategory = "";
if (this.chooseCategroyArray && this.chooseCategroyArray.length > 0) {
......@@ -241,11 +377,11 @@
this.msg,
res => {
this.loading = false;
//console.log("res.data.data", res.data.data);
if (res.data.resultCode == 1) {
var tempArray = res.data.data.pageData;
this.DataList = tempArray;
this.msg.total = res.data.data.count;
console.log("this.DataList", JSON.parse(JSON.stringify(this.DataList)));
}
});
},
......@@ -260,6 +396,39 @@
this.msg.currentPage = 1;
this.getGoodList();
},
//获取微信用户列表
getWechatData(keyWords) {
this.weChatData = [];
this.addressList = [];
var qMsg = {
Name: keyWords
};
this.mallapipost(
"/api/User/GetMemberUserListExt",
qMsg,
res => {
if (res.data.resultCode == 1) {
this.weChatData = res.data.data;
}
});
},
//获取用户收货地址
weChatChange() {
this.addressList = [];
this.mallapipost(
"/api/User/GetShippingAddressList", {
NewUserId: this.orderMsg.mallUserId
},
res => {
if (res.data.resultCode == 1) {
this.addressList = res.data.data;
}
});
},
//下单
SaveOrder() {
console.log("orderMsg", this.orderMsg);
}
},
mounted() {
this.getCategroy();
......
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