提交 b25f8892 authored 作者: huaxinzhu's avatar huaxinzhu

Merge branch 'dev_hxz' into test

...@@ -67,6 +67,10 @@ ...@@ -67,6 +67,10 @@
} }
} }
} }
},
// 禁止粘贴图片
clipboard: {
matchers: [[Node.ELEMENT_NODE, this.handleCustomMatcher]]
} }
} }
}, },
...@@ -81,6 +85,21 @@ ...@@ -81,6 +85,21 @@
}, },
watch: {}, watch: {},
methods: { methods: {
handleCustomMatcher(node, Delta) {
let ops = []
//debugger
console.log(123);
Delta.ops.forEach(op => {
if (op.insert && typeof op.insert === 'string') {// 如果粘贴了图片,这里会是一个对象,所以可以这样处理
ops.push({
insert: op.insert,
})
}
})
Delta.ops = ops
return Delta
},
/** 初始化 商品详情 */ /** 初始化 商品详情 */
initInfo() { initInfo() {
this.goodsDeForm.description = ''; this.goodsDeForm.description = '';
...@@ -121,7 +140,7 @@ ...@@ -121,7 +140,7 @@
}else { }else {
this.$message({ message:'上传失败,请重新上传',type:'error'}); this.$message({ message:'上传失败,请重新上传',type:'error'});
} }
this.loading = false; //this.loading = false;
}) })
}); });
}, },
......
...@@ -224,7 +224,7 @@ ...@@ -224,7 +224,7 @@
this.goodsInfoForm.categoryList = this.goodsinfodata.categoryList; this.goodsInfoForm.categoryList = this.goodsinfodata.categoryList;
} }
// 获取 省 // 获取 省
this.getArea(); //this.getArea();
// 获取 商品品牌 // 获取 商品品牌
this.getBrands(); this.getBrands();
}, },
...@@ -235,18 +235,24 @@ ...@@ -235,18 +235,24 @@
this.goodsImgFileList = []; this.goodsImgFileList = [];
}, },
// 获取 省 // 获取 省
getArea() { // getArea() {
let limboNode = { // let limboNode = {
pid: 0 // pid: 0
}; // };
NewGetCategory(limboNode).then( res=> { // NewGetCategory(limboNode).then( res=> {
if(res.data) { // if(res.data && res.data.length > 0) {
this.areaOptions = res.data; // res.data.forEach( item => {
}else { // let obj = { value: '', label: '' };
this.areaOptions = []; // obj.value = item.id;
} // obj.label = item.label;
}); // this.areaOptions.push(obj);
}, // });
// //this.areaOptions = res.data;
// }else {
// this.areaOptions = [];
// }
// });
// },
// 获取 商品品牌 // 获取 商品品牌
getBrands() { getBrands() {
getBrandsInf().then( res => { getBrandsInf().then( res => {
...@@ -272,46 +278,66 @@ ...@@ -272,46 +278,66 @@
const level = node.level; const level = node.level;
let limboNode = {}; let limboNode = {};
if(level === 0) { if(level === 0) {
//debugger limboNode = {id: 0}
limboNode = {pid: 0}
} }
if(level === 1) { if(level === 1) {
//debugger limboNode = { id: node.value };
limboNode = { pid: node.value };
} }
if(level === 2) { if(level === 2) {
limboNode = { pid: node.value }; limboNode = { id: node.value };
} }
//this.loading = true;
NewGetCategory(limboNode).then(res => { NewGetCategory(limboNode).then(res => {
let result = {}; let result = {};
//debugger
if (level === 0) { if (level === 0) {
result = res.data result = res.data
result.forEach(item => { result.forEach(item => {
item.value = item.id; item.value = item.id;
item.label = item.name; item.label = item.label;
item.children=[]; item.children = [];
item.leaf = 0; // 可以控制 是否有下级 值为true都不行,必须等于0 item.leaf = 0; // 可以控制 是否有下级 值为true都不行,必须等于0
}) })
} }
if (level === 1) { if (level === 1) {
result = res.data for(let i = 0; i < res.data.length; i++) {
if( limboNode.id === res.data[i].id ) {
result = res.data[i].children;
break;
}
}
result.forEach(item => { result.forEach(item => {
item.value = item.id; item.value = item.id;
item.label = item.name item.label = item.label
item.children=[]; item.children=[];
//这句代码表示当点击最后一级的时候 label后面不会转圈圈 并把相关值赋值到选择器上 //这句代码表示当点击最后一级的时候 label后面不会转圈圈 并把相关值赋值到选择器上
item.leaf = 0 item.leaf = 0
}) })
} }
if (level === 2) { if (level === 2) {
result = res.data for(let i = 0; i < res.data.length; i++) {
if( res.data[i].children.length > 0) {
for(let j = 0; j < res.data[i].children.length; j++) {
if( limboNode.id === res.data[i].children[j].id ) {
result = res.data[i].children[j].children;
break;
}
}
}
}
result.forEach(item => { result.forEach(item => {
item.value = item.id; item.value = item.id;
item.label = item.name item.label = item.label
item.leaf = 1; item.leaf = 1;
}) })
} }
resolve(result) resolve(result)
//this.loading = false;
}); });
}, },
SSQGoodsChange(value) { SSQGoodsChange(value) {
......
...@@ -142,7 +142,6 @@ ...@@ -142,7 +142,6 @@
<!-- 查看各类价格说明 --> <!-- 查看各类价格说明 -->
<el-dialog <el-dialog
v-loading="loading"
title="各类价格说明" title="各类价格说明"
:visible.sync="isViewPriceExp" :visible.sync="isViewPriceExp"
width="40%" width="40%"
......
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
:disabled="multiple" :disabled="multiple"
size="mini" size="mini"
@click="handleUpsale('9','up','all')" @click="handleUpsale('9','up','all')"
>批量上架 >批量申请上架
</el-button> </el-button>
<el-button <el-button
v-if='radiomodel==4' v-if='radiomodel==4'
...@@ -164,7 +164,7 @@ ...@@ -164,7 +164,7 @@
size="mini" size="mini"
type="text" type="text"
@click="handleUpsale(scope.row,'up','one')" @click="handleUpsale(scope.row,'up','one')"
>上架 >申请上架
</el-button> </el-button>
<el-button <el-button
v-if="radiomodel==4" v-if="radiomodel==4"
...@@ -437,8 +437,11 @@ ...@@ -437,8 +437,11 @@
// }); // });
}); });
}, },
// 下架/申请上架
handleUpsale(row, status, isall) { //上下架 handleUpsale(row, status, isall) { //上下架
//debugger //debugger
//console.log(442,row);
let good_id, is_onsale, title, message let good_id, is_onsale, title, message
if (isall == 'one') { if (isall == 'one') {
good_id = [row.goods_id] good_id = [row.goods_id]
......
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
</div> </div>
</template> </template>
<script> <script>
import { MessageBox } from 'element-ui';
import {getShopInf} from "@/api/module/entry" import {getShopInf} from "@/api/module/entry"
import { goodsjdAddress,goodsimport} from "@/api/module/goodsgement"; import { goodsjdAddress,goodsimport} from "@/api/module/goodsgement";
import { dateFormat } from "@/utils"; import { dateFormat } from "@/utils";
...@@ -98,7 +99,7 @@ export default { ...@@ -98,7 +99,7 @@ export default {
let urlarr let urlarr
if (this.form.desc) { if (this.form.desc) {
urlarr = this.form.desc.split(',') urlarr = this.form.desc.split(',')
debugger //debugger
if (urlarr.length > 0 && urlarr.length <= 10) { if (urlarr.length > 0 && urlarr.length <= 10) {
if( Number(urlarr.length) > Number(this.collect_num)) { if( Number(urlarr.length) > Number(this.collect_num)) {
this.$message({type: 'warning',message:'您好,准备导入的商品条数过多,当前剩余次数不足,请重新输入'}); this.$message({type: 'warning',message:'您好,准备导入的商品条数过多,当前剩余次数不足,请重新输入'});
...@@ -127,23 +128,57 @@ export default { ...@@ -127,23 +128,57 @@ export default {
return false return false
} }
console.log(this.el_value)
let data = { let data = {
category_id: this.el_value[2], category_id: this.el_value[2],
third_url: urlarr third_url: urlarr
} }
goodsimport(data).then(res => { goodsimport(data).then(res => {
if (res.code == 1) { let sucCount = 0;
this.$message({ let allCount = Number(urlarr.length);
message: res.message, //let failCount = 0;
type: 'success' let msg = '';
}); if (res.code === 1) {
// 单条导入 提示语
if( allCount === 1 ) {
if( Number(res.data) === 1 ) {
this.$message({ type:'success', message: '您好,商品已导入成功,请在仓库中进行编辑后申请上架' });
} else {
this.$message({ type:'error', message: '您好,商品导入失败,请您重新导入' });
}
} else if ( allCount > 1) {
sucCount = Number( res.data );
//failCount = this.minus( allCount, sucCount )
msg = "您好,一共导入" + allCount + "条商品," + sucCount + "条导入成功,请在仓库中进行编辑后申请上架";
this.$message({ type:'warning', message: msg })
}
this.el_value = [] this.el_value = []
this.form.desc = '' this.form.desc = ''
this.info() this.info()
} }
}) })
}, },
// 自定义高精度浮点数运算
// 加法
add(arg1, arg2) {
let r1, r2, m, result;
try {
//取小数位长度
r1 = arg1.toString().split(".")[1].length;
r2 = arg2.toString().split(".")[1].length;
} catch (e) {
r1 = 0;
r2 = 0;
}
m = Math.pow(10, Math.max(r1, r2)); //计算因子
result = (arg1 * m + arg2 * m) / m;
result = result.toFixed(2);
return result;
},
// 减法
minus(arg1, arg2) {
return this.add(arg1, -arg2);
},
elvalueclick() { elvalueclick() {
// this.goodsonly() // this.goodsonly()
}, },
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论