|
|
@@ -3,10 +3,10 @@ import { mapGetters, mapActions } from "vuex";
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
- pageType: "bill", //下单类别 用于区分不同功能的数据
|
|
|
+ pageType: "bill", //选择商品页面类别 用于区分不同功能的数据
|
|
|
|
|
|
productInfo: [], //商品信息
|
|
|
- classIndex: 0, //商品类别小标
|
|
|
+ classIndex: 0, //当前商品类别下标
|
|
|
py: "", //拼音搜索条件
|
|
|
type: "", //库存预警时,固定为waring,其他情况不传或者传空
|
|
|
autoLoad: true //自动获取商品信息
|
|
|
@@ -26,7 +26,7 @@ export default {
|
|
|
computed: {
|
|
|
...mapGetters(["getSelectInfo"]),
|
|
|
/**
|
|
|
- * 选中的商品
|
|
|
+ * 当前页面选中的商品列表
|
|
|
*/
|
|
|
selectList() {
|
|
|
return this.getSelectInfo[this.pageType] || [];
|
|
|
@@ -58,6 +58,9 @@ export default {
|
|
|
allCount() {
|
|
|
return this.selectList.length;
|
|
|
},
|
|
|
+ /**
|
|
|
+ * 当前选中商品列表中是否有没有库存的商品
|
|
|
+ */
|
|
|
hasNoStock() {
|
|
|
let has = false;
|
|
|
if (this.selectList) {
|
|
|
@@ -86,7 +89,10 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
...mapActions(["setSelectInfoByType", "resetSelectInfoByType"]),
|
|
|
- async initData(extendInfo, clear) {
|
|
|
+ /**
|
|
|
+ * 请求商品数据
|
|
|
+ */
|
|
|
+ async initData(extendInfo) {
|
|
|
//extendInfo调用时的扩展参数 如 shopId
|
|
|
try {
|
|
|
let params = {
|
|
|
@@ -124,6 +130,9 @@ export default {
|
|
|
// });
|
|
|
// return info;
|
|
|
// },
|
|
|
+ /**
|
|
|
+ * 获取当前选中商品总价
|
|
|
+ */
|
|
|
getSelectItemPrice(item) {
|
|
|
let price = 0;
|
|
|
const { bigCount, smallCount, bigPrice, smallPrice } = item;
|
|
|
@@ -134,7 +143,7 @@ export default {
|
|
|
return price;
|
|
|
},
|
|
|
/**
|
|
|
- * 通过id获取当前选中的该商品信息
|
|
|
+ * 通过id获取当前选中的商品信息
|
|
|
*/
|
|
|
getSelectItemById(id, classId) {
|
|
|
let info = {
|
|
|
@@ -158,7 +167,7 @@ export default {
|
|
|
return info;
|
|
|
},
|
|
|
/**
|
|
|
- * 通过id获取当前选中的该商品信息
|
|
|
+ * 通过id获取当前选中的商品类别信息 左边菜单角标 当前选中该类别商品多少件
|
|
|
*/
|
|
|
getSelectClassById(classId) {
|
|
|
let info = {
|
|
|
@@ -295,7 +304,7 @@ export default {
|
|
|
// this.$forceUpdate();
|
|
|
},
|
|
|
// /**
|
|
|
- // * 减去商品
|
|
|
+ // * 删除商品
|
|
|
// */
|
|
|
// removeEvent(item) {
|
|
|
// const list = this.selectList;
|
|
|
@@ -341,6 +350,9 @@ export default {
|
|
|
this.setSelectInfoByType({ type: this.pageType, info: list });
|
|
|
// this.$forceUpdate();
|
|
|
},
|
|
|
+ /**
|
|
|
+ * 切换左侧商品类别
|
|
|
+ */
|
|
|
swichClass(e) {
|
|
|
let cur = e.currentTarget.dataset.current;
|
|
|
if (this.classIndex == cur) {
|