|
@@ -32,14 +32,17 @@
|
|
|
<containerTitle title="商品规格"></containerTitle>
|
|
|
<basic-container style="margin-bottom: 10px">
|
|
|
<avue-crud
|
|
|
+ v-model="obj"
|
|
|
:data="sftData"
|
|
|
:option="sftOption"
|
|
|
@row-save="rowSave"
|
|
|
@row-del="rowSftDel"
|
|
|
+ @row-update="rowUpdateBankOfDeposit"
|
|
|
>
|
|
|
-<!-- <template slot-scope="{row}" slot="cnameForm">-->
|
|
|
-<!-- <el-checkbox v-model="row.cname">显示</el-checkbox>-->
|
|
|
-<!-- </template>-->
|
|
|
+ <template slot-scope="scope" slot="goodsNameForm">
|
|
|
+ {{obj.goodsName}}
|
|
|
+ <el-button type="text" @click="dialogVisible = !dialogVisible">选择</el-button>
|
|
|
+ </template>
|
|
|
<template slot="menu" slot-scope="{ row, index }">
|
|
|
<el-button
|
|
|
size="small"
|
|
@@ -109,6 +112,55 @@
|
|
|
<avue-ueditor v-model="form.details" :options="options"></avue-ueditor>
|
|
|
</basic-container>
|
|
|
</div>
|
|
|
+ <el-dialog
|
|
|
+ title="导入商品"
|
|
|
+ append-to-body
|
|
|
+ class="el-dialogDeep"
|
|
|
+ :visible.sync="dialogVisible"
|
|
|
+ width="60%"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ :destroy-on-close="true"
|
|
|
+ :close-on-press-escape="false"
|
|
|
+ top="10vh"
|
|
|
+ >
|
|
|
+ <span>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="5">
|
|
|
+ <div>
|
|
|
+ <el-scrollbar>
|
|
|
+ <basic-container style="margin-top:45px">
|
|
|
+ <avue-tree :option="treeOption" @node-click="nodeClick" />
|
|
|
+ </basic-container>
|
|
|
+ </el-scrollbar>
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="19">
|
|
|
+ <avue-crud
|
|
|
+ :option="goodsOption"
|
|
|
+ :table-loading="loading"
|
|
|
+ :data="goodsList"
|
|
|
+ ref="goodsCrud"
|
|
|
+ @refresh-change="refreshChange"
|
|
|
+ @selection-change="selectionChange"
|
|
|
+ @row-click="rowClick"
|
|
|
+ :page.sync="page"
|
|
|
+ @on-load="onLoad"
|
|
|
+ @saveColumn="saveGoodsColumn"
|
|
|
+ ></avue-crud>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </span>
|
|
|
+
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="dialogVisible = false">取 消</el-button>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ @click="importGoods"
|
|
|
+ :disabled="selectionList.length == 0"
|
|
|
+ >导入</el-button
|
|
|
+ >
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
@@ -116,6 +168,8 @@ import {getDetail, updateDetail, getDeptTree, priceDelete} from "@/api/mallManag
|
|
|
import sftOption from "./configuration/specification.json";
|
|
|
import imgUploadList from "./configuration/imgUploadList.json";
|
|
|
import productParameters from "./configuration/productParameters.json";
|
|
|
+import {getDeptLazyTree, getGoods} from "@/api/exportTrade/purchaseContract";
|
|
|
+import goodsOption from "./configuration/commodity.json";
|
|
|
export default {
|
|
|
name: "detailsPage",
|
|
|
data() {
|
|
@@ -123,7 +177,16 @@ export default {
|
|
|
form: {
|
|
|
details:'<h1 class="ql-align-center" style="text-align: center;"><a href="https://avuejs.com/doc/plugins/ueditor-plugins" target="_blank" style="font-weight: bold; color: rgb(194, 79, 74);">欢迎使用Avue富文本编辑器</a></h1><p class="ql-align-center" style="text-align: center;"><span style="font-weight: bold; color: rgb(194, 79, 74);"><img src="https://avuejs.com/images/logo-bg.jpg" height="200" width="200"></span></p>'
|
|
|
},
|
|
|
+ page: {
|
|
|
+ pageSize: 10,
|
|
|
+ currentPage: 1,
|
|
|
+ total: 0
|
|
|
+ },
|
|
|
+ selectionList:[],
|
|
|
+ dialogVisible:false,
|
|
|
+ obj:{},
|
|
|
sftData: [],
|
|
|
+ goodsOption: goodsOption,
|
|
|
sftOption: sftOption,
|
|
|
imgUploadList: imgUploadList,
|
|
|
productParameters: productParameters,
|
|
@@ -137,10 +200,37 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
disabled: false,
|
|
|
+ loading: false,
|
|
|
+ goodsList: [],
|
|
|
userDialog: false,//供应商导入窗口
|
|
|
imgUploadData: [],
|
|
|
dicData: [],
|
|
|
sftDataParameters: [],
|
|
|
+ treeOption: {
|
|
|
+ nodeKey: "id",
|
|
|
+ lazy: true,
|
|
|
+ treeLoad: function(node, resolve) {
|
|
|
+ const parentId = node.level === 0 ? 0 : node.data.id;
|
|
|
+ getDeptLazyTree(parentId).then(res => {
|
|
|
+ resolve(
|
|
|
+ res.data.data.map(item => {
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ leaf: !item.hasChildren
|
|
|
+ };
|
|
|
+ })
|
|
|
+ );
|
|
|
+ });
|
|
|
+ },
|
|
|
+ addBtn: false,
|
|
|
+ menu: false,
|
|
|
+ size: "small",
|
|
|
+ props: {
|
|
|
+ label: "title",
|
|
|
+ value: "value",
|
|
|
+ children: "children"
|
|
|
+ }
|
|
|
+ },
|
|
|
detailsSelect: {},
|
|
|
option: {
|
|
|
menuBtn: false,
|
|
@@ -208,15 +298,52 @@ export default {
|
|
|
this.dicData = res.data.data;
|
|
|
});
|
|
|
if (this.$route.query.id) {
|
|
|
- getDetail(JSON.parse(this.$route.query.id)).then(res => {
|
|
|
- this.form = res.data.data
|
|
|
- this.sftData = res.data.data.itemsList
|
|
|
- })
|
|
|
+ this.query(JSON.parse(this.$route.query.id))
|
|
|
} else {
|
|
|
this.$set(this.form, "goodsTypeId", this.$route.query.treeDeptId)
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ importGoods() {
|
|
|
+ this.selectionList.forEach((item,index) => {
|
|
|
+ console.log(item);
|
|
|
+ this.obj.goodsName = item.cname
|
|
|
+ this.obj.goodsCode = item.typeno
|
|
|
+ });
|
|
|
+ this.dialogVisible = false;
|
|
|
+ },
|
|
|
+ async saveGoodsColumn() {
|
|
|
+ const inSave = await this.saveColumnData(
|
|
|
+ this.getColumnName(27),
|
|
|
+ this.goodsOption
|
|
|
+ );
|
|
|
+ if (inSave) {
|
|
|
+ this.$message.success("保存成功");
|
|
|
+ //关闭窗口
|
|
|
+ this.$refs.goodsCrud.$refs.dialogColumn.columnBox = false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //费用查询
|
|
|
+ onLoad(page, params = {}) {
|
|
|
+ this.loading = true;
|
|
|
+ getGoods(page.currentPage, page.pageSize, this.treeDeptId).then(res => {
|
|
|
+ const data = res.data.data;
|
|
|
+ this.page.total = data.total;
|
|
|
+ this.goodsList = data.records;
|
|
|
+ this.loading = false;
|
|
|
+ if (this.page.total) {
|
|
|
+ this.goodsOption.height = window.innerHeight - 550;
|
|
|
+ } else {
|
|
|
+ this.goodsOption.height = window.innerHeight - 475;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ rowClick(row) {
|
|
|
+ this.$refs.goodsCrud.toggleSelection([this.goodsList[row.$index]]);
|
|
|
+ },
|
|
|
+ selectionChange(list) {
|
|
|
+ this.selectionList = list;
|
|
|
+ },
|
|
|
// 商品图片上传保存
|
|
|
imgUploadSave(row, done, loading) {
|
|
|
console.log(row);
|
|
@@ -276,10 +403,11 @@ export default {
|
|
|
}
|
|
|
} else {
|
|
|
const width = 750;
|
|
|
- const height = 1000;
|
|
|
- isSize = img.width === width && img.height <= height;
|
|
|
+ const height = 750;
|
|
|
+ console.log(img.width,img.height)
|
|
|
+ isSize = img.width === img.height
|
|
|
if (!isSize) {
|
|
|
- this.$message.error("商品详情轮播图宽为750,高不能超过1000");
|
|
|
+ this.$message.error("商品详情轮播图宽为"+width+",高不能超过"+width+"或小于"+width);
|
|
|
}
|
|
|
}
|
|
|
if (is2M && isType && isSize) {
|
|
@@ -291,14 +419,6 @@ export default {
|
|
|
img.src = _URL.createObjectURL(file);
|
|
|
},
|
|
|
addSftRow() {
|
|
|
- this.sftData.push({
|
|
|
- $cellEdit: true,
|
|
|
- cname: null,
|
|
|
- texture: null,
|
|
|
- colour: null,
|
|
|
- describe: null,
|
|
|
- remarks: null
|
|
|
- });
|
|
|
},
|
|
|
parameterAddition() {
|
|
|
this.sftDataParameters.push({
|
|
@@ -317,12 +437,30 @@ export default {
|
|
|
rowPurchaseCell(row, index) {
|
|
|
this.$refs.crudPurchase.rowCell(row, index)
|
|
|
},
|
|
|
+ nodeClick(data) {
|
|
|
+ this.treeDeptId = data.id;
|
|
|
+ this.page.currentPage = 1;
|
|
|
+ this.onLoad(this.page);
|
|
|
+ },
|
|
|
+ //修改商品规格触发
|
|
|
+ rowUpdateBankOfDeposit(row, index, done, loading) {
|
|
|
+ done(row);
|
|
|
+ },
|
|
|
//修改提交触发
|
|
|
editProductInfo() {
|
|
|
this.$refs["form"].validate((valid) => {
|
|
|
//校验明细列表
|
|
|
if (valid) {
|
|
|
console.log(this.form);
|
|
|
+ this.form.picture = JSON.stringify(this.imgUploadData)
|
|
|
+ let data = this.sftData
|
|
|
+ // if (typeof data == )
|
|
|
+ data.forEach((item,index)=>{
|
|
|
+ console.log(typeof item.goodsTitel)
|
|
|
+ if ('object' == typeof item.goodsTitel) item.goodsTitel = item.goodsTitel.join(',')
|
|
|
+ if ('object' == typeof item.serviceTitel) item.serviceTitel = item.serviceTitel.join(',')
|
|
|
+ })
|
|
|
+ this.form.itemsList = data
|
|
|
const params = {
|
|
|
...this.form,
|
|
|
type: 0,
|
|
@@ -330,6 +468,7 @@ export default {
|
|
|
updateDetail(params).then(res => {
|
|
|
if (res.data.success) {
|
|
|
this.$message.success("操作成功!")
|
|
|
+ this.query(this.form.id)
|
|
|
}
|
|
|
})
|
|
|
} else {
|
|
@@ -337,6 +476,20 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ query(id){
|
|
|
+ getDetail(id).then(res => {
|
|
|
+ this.form = res.data.data
|
|
|
+ if (this.form.picture) this.imgUploadData = JSON.parse(this.form.picture)
|
|
|
+ if (res.data.data.itemsList) {
|
|
|
+ res.data.data.itemsList.forEach((item,index)=>{
|
|
|
+ item.goodsTitel = item.goodsTitel.split(',')
|
|
|
+ item.serviceTitel = item.serviceTitel.split(',')
|
|
|
+ })
|
|
|
+ this.sftData = res.data.data.itemsList
|
|
|
+ }
|
|
|
+ delete this.form.itemsList
|
|
|
+ })
|
|
|
+ },
|
|
|
//返回列表
|
|
|
backToList() {
|
|
|
this.$router.$avueRouter.closeTag();
|