|
|
@@ -111,8 +111,8 @@ export default {
|
|
|
return list;
|
|
|
},
|
|
|
/**
|
|
|
- * 当前页面选中的商品列表
|
|
|
- */
|
|
|
+ * 当前页面选中的商品列表
|
|
|
+ */
|
|
|
selectList() {
|
|
|
return this.getSelectInfo[this.pageType] || [];
|
|
|
},
|
|
|
@@ -165,31 +165,17 @@ export default {
|
|
|
* */
|
|
|
allGoodsPrice() {
|
|
|
let price = 0;
|
|
|
- if (this.selectList.goodsStyleList) {
|
|
|
+ if (this.selectList) {
|
|
|
for (const item of this.selectList) {
|
|
|
- if(item.goodsStyle==0){
|
|
|
- price += item.bigCount * Number(item.price);
|
|
|
- }else{
|
|
|
- price += item.bigCount * Number(item.goodsStyleList[item.goodsStyleSelectIndex].price);
|
|
|
+ if(item.goodsStyle){
|
|
|
+ if(item.goodsStyle==0){
|
|
|
+ price += item.bigCount * Number(item.price);
|
|
|
+ }else{
|
|
|
+ price += item.bigCount * Number(item.goodsStyleList[item.goodsStyleSelectIndex].price);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
- return Math.round(price * 100) / 100;
|
|
|
- },
|
|
|
- allGoodsPriceFun() {
|
|
|
- let price = 0;
|
|
|
- for (const item of this.selectList) {
|
|
|
- if(item.goodsStyle==0){
|
|
|
- price += item.bigCount * Number(item.price);
|
|
|
- }else{
|
|
|
- price += item.bigCount * Number(item.goodsStyleList[item.goodsStyleSelectIndex].price);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
return Math.round(price * 100) / 100;
|
|
|
},
|
|
|
/**
|
|
|
@@ -203,8 +189,8 @@ export default {
|
|
|
return length;
|
|
|
},
|
|
|
/**
|
|
|
- * 当前选中商品列表中是否有没有库存的商品
|
|
|
- */
|
|
|
+ * 当前选中商品列表中是否有没有库存的商品
|
|
|
+ */
|
|
|
hasNoStock() {
|
|
|
let has = false;
|
|
|
if (this.selectList) {
|
|
|
@@ -234,8 +220,8 @@ export default {
|
|
|
methods: {
|
|
|
...mapActions(["setSelectInfoByType", "resetSelectInfoByType"]),
|
|
|
/**
|
|
|
- * 请求商品数据
|
|
|
- */
|
|
|
+ * 请求商品数据
|
|
|
+ */
|
|
|
async initGhsData(id,shopId) {
|
|
|
//extendInfo调用时的扩展参数 如 shopId
|
|
|
try {
|
|
|
@@ -247,10 +233,10 @@ export default {
|
|
|
const { data } = await getGhsProductList(params);
|
|
|
data.forEach(element => {
|
|
|
element.child &&
|
|
|
- element.child.forEach(child => {
|
|
|
- child.classId = element.classId;
|
|
|
- child.className = element.className;
|
|
|
- });
|
|
|
+ element.child.forEach(child => {
|
|
|
+ child.classId = element.classId;
|
|
|
+ child.className = element.className;
|
|
|
+ });
|
|
|
});
|
|
|
this.productInfo = data;
|
|
|
this.classIndex = 0;
|
|
|
@@ -272,10 +258,10 @@ export default {
|
|
|
const { data } = await getProductDataApi(params);
|
|
|
data.forEach(element => {
|
|
|
element.child &&
|
|
|
- element.child.forEach(child => {
|
|
|
- child.classId = element.classId;
|
|
|
- child.className = element.className;
|
|
|
- });
|
|
|
+ element.child.forEach(child => {
|
|
|
+ child.classId = element.classId;
|
|
|
+ child.className = element.className;
|
|
|
+ });
|
|
|
});
|
|
|
uni.setStorageSync('productInfoList',data);
|
|
|
this.productInfo = data;
|
|
|
@@ -286,8 +272,8 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
/**
|
|
|
- * 获取当前选中商品总价
|
|
|
- */
|
|
|
+ * 获取当前选中商品总价
|
|
|
+ */
|
|
|
getSelectItemPrice(item) {
|
|
|
let price = 0;
|
|
|
const { bigCount, smallCount, bigPrice, smallPrice } = item;
|
|
|
@@ -346,8 +332,8 @@ export default {
|
|
|
return price;
|
|
|
},
|
|
|
/**
|
|
|
- * 通过id获取当前选中的商品信息
|
|
|
- */
|
|
|
+ * 通过id获取当前选中的商品信息
|
|
|
+ */
|
|
|
getSelectItemById(id, classId) {
|
|
|
let info = {
|
|
|
bigCount: 0, //扎数
|
|
|
@@ -372,8 +358,8 @@ export default {
|
|
|
return info;
|
|
|
},
|
|
|
/**
|
|
|
- * 通过id获取当前选中的商品类别信息 左边菜单角标 当前选中该类别商品多少件
|
|
|
- */
|
|
|
+ * 通过id获取当前选中的商品类别信息 左边菜单角标 当前选中该类别商品多少件
|
|
|
+ */
|
|
|
getSelectClassById(classId) {
|
|
|
let info = {
|
|
|
bigCount: 0, //扎数
|
|
|
@@ -400,8 +386,8 @@ export default {
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
- * 添加商品
|
|
|
- */
|
|
|
+ * 添加商品
|
|
|
+ */
|
|
|
addEvent(item) {
|
|
|
const list = this.selectList;
|
|
|
let has = false;
|
|
|
@@ -469,7 +455,6 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
this.setSelectInfoByType({ type: this.pageType, info: list });
|
|
|
// this.$forceUpdate();
|
|
|
},
|
|
|
@@ -478,37 +463,37 @@ export default {
|
|
|
const list = this.selectList;
|
|
|
|
|
|
// if (!has) {}
|
|
|
- let info = { classId: item.classId, id: item.id };
|
|
|
+ let info = { classId: item.classId, id: item.id };
|
|
|
|
|
|
- const classInfo =
|
|
|
- this.productInfo &&
|
|
|
- this.productInfo.find(element => {
|
|
|
- return element.classId == item.classId && element.child;
|
|
|
- });
|
|
|
- if (classInfo) {
|
|
|
- info = classInfo.child.find(ele => {
|
|
|
- return ele.id == item.id;
|
|
|
- });
|
|
|
- }
|
|
|
+ const classInfo =
|
|
|
+ this.productInfo &&
|
|
|
+ this.productInfo.find(element => {
|
|
|
+ return element.classId == item.classId && element.child;
|
|
|
+ });
|
|
|
+ if (classInfo) {
|
|
|
+ info = classInfo.child.find(ele => {
|
|
|
+ return ele.id == item.id;
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
- let params = {
|
|
|
- ...info,
|
|
|
- bigCount: 0, //扎数
|
|
|
- smallCount: 0, //支数
|
|
|
- autoPrice: 0 //调价价格
|
|
|
- };
|
|
|
- list.push(params);
|
|
|
- if(type!='noAdd'){
|
|
|
- this.setSelectInfoByType({ type: this.pageType, info: list });
|
|
|
- }
|
|
|
+ let params = {
|
|
|
+ ...info,
|
|
|
+ bigCount: 0, //扎数
|
|
|
+ smallCount: 0, //支数
|
|
|
+ autoPrice: 0 //调价价格
|
|
|
+ };
|
|
|
+ list.push(params);
|
|
|
+ if(type!='noAdd'){
|
|
|
+ this.setSelectInfoByType({ type: this.pageType, info: list });
|
|
|
+ }
|
|
|
this.$nextTick(()=>{
|
|
|
this.customNum(params1)
|
|
|
})
|
|
|
// this.$forceUpdate();
|
|
|
},
|
|
|
/**
|
|
|
- * 减去商品
|
|
|
- */
|
|
|
+ * 减去商品
|
|
|
+ */
|
|
|
delEvent(item) {
|
|
|
const list = this.selectList;
|
|
|
let has = false;
|
|
|
@@ -712,8 +697,8 @@ export default {
|
|
|
this.setSelectInfoByType({ type: this.pageType, info: list });
|
|
|
},
|
|
|
/**
|
|
|
- * 更新商品
|
|
|
- */
|
|
|
+ * 更新商品
|
|
|
+ */
|
|
|
updateItemEvent(item) {
|
|
|
const list = this.selectList;
|
|
|
for (let index = 0; index < list.length; index++) {
|
|
|
@@ -748,8 +733,8 @@ export default {
|
|
|
// this.$forceUpdate();
|
|
|
},
|
|
|
/**
|
|
|
- * 切换左侧商品类别
|
|
|
- */
|
|
|
+ * 切换左侧商品类别
|
|
|
+ */
|
|
|
swichClass(e) {
|
|
|
let cur = e.currentTarget.dataset.current;
|
|
|
if (this.classIndex == cur) {
|
|
|
@@ -770,8 +755,8 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
/**
|
|
|
- * 搜索对应花材
|
|
|
- */
|
|
|
+ * 搜索对应花材
|
|
|
+ */
|
|
|
searchFn() {},
|
|
|
|
|
|
|