|
@@ -32,6 +32,22 @@
|
|
|
|
|
|
</template>
|
|
|
|
|
|
+ <!-- 添加商品插槽 -->
|
|
|
+ <template slot="goodsForm">
|
|
|
+ <avue-crud :option="goodsTableOption"
|
|
|
+ :data="tableData"
|
|
|
+ ref="crudGoods">
|
|
|
+ <template #menu="{row,index,size}">
|
|
|
+ <el-button type="danger"
|
|
|
+ size="mini"
|
|
|
+ @click="rowDelGoods(row,index)">删除</el-button>
|
|
|
+ </template>
|
|
|
+ <template slot="grouponPrice" slot-scope="scope" >
|
|
|
+ <avue-input-number precision="2" v-model="scope.row.grouponPrice"></avue-input-number>
|
|
|
+ </template>
|
|
|
+ </avue-crud>
|
|
|
+ </template>
|
|
|
+
|
|
|
</avue-crud>
|
|
|
</basic-container>
|
|
|
</template>
|
|
@@ -39,10 +55,13 @@
|
|
|
<script>
|
|
|
import {getList, getDetail, add, update, remove, perfect} from "@/api/groupon/groupon";
|
|
|
import {mapGetters} from "vuex";
|
|
|
+ import {goodsTableOption} from "../../option/groupon/grouponPerfact"
|
|
|
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
+ goodsTableOption: goodsTableOption,
|
|
|
+ tableData: [],
|
|
|
form: {},
|
|
|
query: {},
|
|
|
loading: true,
|
|
@@ -172,6 +191,16 @@
|
|
|
},
|
|
|
action: "/api/blade-resource/oss/endpoint/put-file-attach"
|
|
|
},
|
|
|
+ {
|
|
|
+ label: "团购商品",
|
|
|
+ prop: "goods",
|
|
|
+ labelWidth: 120,
|
|
|
+ span: 24,
|
|
|
+ fromslot: true,
|
|
|
+ // editDisplay: false,
|
|
|
+ // viewDisplay: false,
|
|
|
+ hide: true
|
|
|
+ },
|
|
|
]
|
|
|
},
|
|
|
data: []
|
|
@@ -210,6 +239,11 @@
|
|
|
});
|
|
|
},
|
|
|
rowUpdate(row, index, done, loading) {
|
|
|
+ this.tableData.forEach(e => {
|
|
|
+ e.sort = e.$index;
|
|
|
+ })
|
|
|
+ console.log("2--", this.tableData)
|
|
|
+ row.goodsList = this.tableData;
|
|
|
perfect(row).then(() => {
|
|
|
this.onLoad(this.page);
|
|
|
this.$message({
|
|
@@ -263,8 +297,22 @@
|
|
|
},
|
|
|
beforeOpen(done, type) {
|
|
|
if (["edit", "view"].includes(type)) {
|
|
|
+ this.tableData = [];
|
|
|
getDetail(this.form.id).then(res => {
|
|
|
this.form = res.data.data;
|
|
|
+ res.data.data.goodsList.forEach(e => {
|
|
|
+ let goods = {
|
|
|
+ id: e.id,
|
|
|
+ goodsId: e.id,
|
|
|
+ goodsName: e.goodsName,
|
|
|
+ goodsCover: e.goodsCover,
|
|
|
+ goodsSpec: e.goodsSpec,
|
|
|
+ supplierName: e.supplierName,
|
|
|
+ grouponPrice: e.grouponPrice
|
|
|
+ }
|
|
|
+ this.tableData.push(goods)
|
|
|
+ })
|
|
|
+ console.log("1--", this.tableData)
|
|
|
});
|
|
|
}
|
|
|
done();
|
|
@@ -309,6 +357,14 @@
|
|
|
this.$message.error('上传失败:' + error)
|
|
|
console.log(error, column)
|
|
|
},
|
|
|
+ /**
|
|
|
+ * 删除商品
|
|
|
+ * @param row
|
|
|
+ * @param index
|
|
|
+ */
|
|
|
+ rowDelGoods(row, index) {
|
|
|
+ this.tableData.splice(index, 1);
|
|
|
+ },
|
|
|
}
|
|
|
};
|
|
|
</script>
|