-
-
+
+
@@ -291,7 +284,12 @@
categorySonList,
productSave,
getShareList,
- productEdit
+ productEdit,
+ productDelete,
+ productisMust,
+ productisPush,
+ productUp,
+ productDown
} from "@/api/app";
import addType from "./addType.vue";
import editDictType from "./editDictType.vue";
@@ -408,7 +406,7 @@
{
title: "图片",
key: "productPicture",
- minWidth: 160,
+ minWidth: 60,
render: (h, params) => {
return h("img", {
attrs: {
@@ -432,12 +430,12 @@
{
title: "名称",
key: "productName",
- minWidth: 160,
+ minWidth: 60,
},
{
title: "起售数量",
key: "startPayNum",
- width: 150,
+ width: 100,
},
// {
// title: "状态",
@@ -470,10 +468,82 @@
{
title: "操作",
key: "action",
- width: 150,
+ width: 350,
align: "center",
fixed: "right",
render: (h, params) => {
+ let enableOrdelFlag = "";
+ if(params.row.delFlag ==0){
+ enableOrdelFlag = h(
+ "a", {
+ on: {
+ click: () => {
+ this.upDown(params.row,1);
+ },
+ },
+ },
+ "上架"
+ );
+ }else{
+ enableOrdelFlag = h(
+ "a", {
+ on: {
+ click: () => {
+ this.upDown(params.row,0);
+ },
+ },
+ },
+ "下架"
+ );
+ }
+ let enableOrisPush = "";
+ if(params.row.isPush ==0){
+ enableOrisPush = h(
+ "a", {
+ on: {
+ click: () => {
+ this.isPush(params.row,1);
+ },
+ },
+ },
+ "设为推荐"
+ );
+ }else{
+ enableOrisPush = h(
+ "a", {
+ on: {
+ click: () => {
+ this.isPush(params.row,0);
+ },
+ },
+ },
+ "取消推荐"
+ );
+ }
+ let enableOrisMust = "";
+ if(params.row.isMust ==0){
+ enableOrisMust = h(
+ "a", {
+ on: {
+ click: () => {
+ this.isMust(params.row,1);
+ },
+ },
+ },
+ "设为必点"
+ );
+ }else{
+ enableOrisMust = h(
+ "a", {
+ on: {
+ click: () => {
+ this.isMust(params.row,0);
+ },
+ },
+ },
+ "取消必点"
+ );
+ }
return h("div", [
h(
"a", {
@@ -490,6 +560,26 @@
type: "vertical",
},
}),
+ enableOrdelFlag,
+ h("Divider", {
+ props: {
+ type: "vertical",
+ },
+ }),
+
+ enableOrisPush,
+ h("Divider", {
+ props: {
+ type: "vertical",
+ },
+ }),
+
+ enableOrisMust,
+ h("Divider", {
+ props: {
+ type: "vertical",
+ },
+ }),
h(
"a", {
on: {
@@ -521,6 +611,12 @@
// 获取表单数据
// this.getDataList();
},
+ changePrice(index){
+ this.specValueArr[index].specPrice = this.addGoodsForm.attributeListPrice[index].specPrice
+ },
+ changeCount(index){
+ this.specValueArr[index].specNum = this.addGoodsForm.attributeListPrice[index].specNum
+ },
getGoodsType() {
this.treeLoading = true;
goodsType({
@@ -529,9 +625,35 @@
this.treeLoading = false;
if (res.success) {
this.treeData = res.result;
+ let bidain ={
+ "id": "bidian",
+ "delFlag": 0,
+ "categoryName": '必点',
+ "shopId": this.shopId,
+ "count": 0,
+ "stockCount": 0,
+ "minusStockCount": null,
+ "sort": null,
+ "title": '必点',
+ "nodeKey": 0
+ }
+ let tuijian ={
+ "id": "tuijian",
+ "delFlag": 0,
+ "categoryName": '推荐',
+ "shopId": this.shopId,
+ "count": 0,
+ "stockCount": 0,
+ "minusStockCount": null,
+ "sort": null,
+ "title": '推荐',
+ "nodeKey": 0
+ }
for (let i = 0; i < this.treeData.length; i++) {
this.treeData[i].title = this.treeData[i].categoryName
}
+ this.treeData.unshift(bidain)
+ this.treeData.unshift(tuijian)
}
});
},
@@ -586,15 +708,17 @@
},
deldantiaoguige(index){
for (var m = 0; m < this.specValueArr.length; m++) {
- if(this.specValueArr[m].title == this.addGoodsForm.attributeListPrice[index].specName){
+ if(this.specValueArr[m].id == this.addGoodsForm.attributeListPrice[index].id){
this.specValueArr.splice(m,1)
this.addGoodsForm.attributeListPrice.splice(index,1)
+ console.log("11",this.addGoodsForm.attributeListPrice)
if(this.addGoodsForm.attributeListPrice.length == 1){
- this.addGoodsForm.attributeListPrice = {
+ this.addGoodsForm.attributeListPrice = []
+ this.addGoodsForm.attributeListPrice.push({
specName:"",
specPrice:'',
specNum:9999
- }
+ })
this.specValueArr = []
}
this.$forceUpdate()
@@ -634,21 +758,21 @@
}).then((res) => {
if(res.code == 200){
this.categorySonData = res.result.content
-
+ console.log("this.modalclassType",this.modalclassType)
+ console.log("this.categorySonData",this.categorySonData)
if(this.modalclassType == 'shuxing'){
- console.log('属性',this.attrValueArr)
- if(this.attrValueArr == ""){
- this.attrValueArr = this.addGoodsForm.attributeListPrice
- }
for (var i = 0; i < this.categorySonData.length; i++) {
if(this.attrValueArr.length>0){
+ let index1 = false
for (var m = 0; m < this.attrValueArr.length; m++) {
- if(this.attrValueArr[m].id == this.categorySonData[i].id){
+ if(this.attrValueArr[m].title == this.categorySonData[i].title){
+ index1 = true
this.categorySonData[i].checked = true
- }else{
- this.categorySonData[i].checked = false
}
}
+ if(index1){
+ this.categorySonData[i].checked = true
+ }
}else{
this.categorySonData[i].checked = false
}
@@ -691,6 +815,8 @@
},
checkSpecValue(index){
//this.typeToAttrName = res.result.content[this.categoryIndex].title
+ console.log("this.categorySonData[index]",this.categorySonData[index])
+ console.log("this.modalclassType",this.modalclassType)
this.categorySonData[index].checked = !this.categorySonData[index].checked
if(this.modalclassType == 'shuxing'){
if(this.categorySonData[index].checked == true){
@@ -698,7 +824,7 @@
this.attrValueArr.push(this.categorySonData[index])
}else{
for(let i=0;i {
+ for(let i = 0;i {
if (valid) {
+
this.submitLoading = true;
if (this.modalType == 0) {
// 添加 避免编辑后传入id等数据 记得删除
@@ -987,6 +1161,7 @@
this.submitLoading = false;
if (res.success) {
this.$Message.success("操作成功");
+ this.getDataList();
this.modalVisible = false;
}
});
@@ -1000,7 +1175,7 @@
this.submitLoading = false;
if (res.success) {
this.$Message.success("操作成功");
- // this.getDataList();
+ this.getDataList();
this.modalVisible = false;
}
});
@@ -1011,23 +1186,75 @@
remove(v) {
this.$Modal.confirm({
title: "确认删除",
- content: "您确认要删除 " + v.title + " ?",
+ content: "您确认要删除 " + v.productName + " ?",
loading: true,
onOk: () => {
// 删除
- deleteData({
- ids: v.id
+ productDelete({
+ id: v.id
}).then((res) => {
this.$Modal.remove();
if (res.success) {
this.clearSelectAll();
this.$Message.success("操作成功");
- // this.getDataList();
+ this.getDataList();
}
});
},
});
},
+ upDown(v,value) {
+ if(value == 0){
+ productDown({
+ id: v.id
+ }).then((res) => {
+ this.$Modal.remove();
+ if (res.success) {
+ this.clearSelectAll();
+ this.$Message.success("操作成功");
+ this.getDataList();
+ }
+ });
+ }else{
+ productUp({
+ id: v.id
+ }).then((res) => {
+ this.$Modal.remove();
+ if (res.success) {
+ this.clearSelectAll();
+ this.$Message.success("操作成功");
+ this.getDataList();
+ }
+ });
+ }
+
+ },
+ isPush(v,value) {
+ productisPush({
+ id: v.id,
+ isPush:value
+ }).then((res) => {
+ this.$Modal.remove();
+ if (res.success) {
+ this.clearSelectAll();
+ this.$Message.success("操作成功");
+ this.getDataList();
+ }
+ });
+ },
+ isMust(v,value) {
+ productisMust({
+ id: v.id,
+ isMust:value
+ }).then((res) => {
+ this.$Modal.remove();
+ if (res.success) {
+ this.clearSelectAll();
+ this.$Message.success("操作成功");
+ this.getDataList();
+ }
+ });
+ },
delAll() {
if (this.selectList.length <= 0) {
this.$Message.warning("您还未选择要删除的数据");
diff --git a/src/views/app/shop/editDictType.vue b/src/views/app/shop/editDictType.vue
index c736bd6..23cd72f 100644
--- a/src/views/app/shop/editDictType.vue
+++ b/src/views/app/shop/editDictType.vue
@@ -51,12 +51,7 @@
required: true,
message: "请输入",
trigger: "blur"
- }],
- sort: [{
- required: true,
- message: "请输入排序值",
- trigger: "blur",
- }, ],
+ }]
},
};
},
diff --git a/src/views/app/shop/shop.vue b/src/views/app/shop/shop.vue
index 34b4177..d12d455 100644
--- a/src/views/app/shop/shop.vue
+++ b/src/views/app/shop/shop.vue
@@ -380,7 +380,7 @@
},
},
},
- "新增商品"
+ "管理商品"
),
]);
},