提交 77569b97 authored 作者: huaxinzhu's avatar huaxinzhu

商品 bug修复,其他优化,编辑器,不能粘贴图片,

上级 a60e00d9
......@@ -67,6 +67,10 @@
}
}
}
},
// 禁止粘贴图片
clipboard: {
matchers: [[Node.ELEMENT_NODE, this.handleCustomMatcher]]
}
}
},
......@@ -81,6 +85,21 @@
},
watch: {},
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() {
this.goodsDeForm.description = '';
......@@ -121,7 +140,7 @@
}else {
this.$message({ message:'上传失败,请重新上传',type:'error'});
}
this.loading = false;
//this.loading = false;
})
});
},
......
......@@ -142,7 +142,6 @@
<!-- 查看各类价格说明 -->
<el-dialog
v-loading="loading"
title="各类价格说明"
:visible.sync="isViewPriceExp"
width="40%"
......
......@@ -90,7 +90,7 @@
:disabled="multiple"
size="mini"
@click="handleUpsale('9','up','all')"
>批量上架
>批量申请上架
</el-button>
<el-button
v-if='radiomodel==4'
......@@ -164,7 +164,7 @@
size="mini"
type="text"
@click="handleUpsale(scope.row,'up','one')"
>上架
>申请上架
</el-button>
<el-button
v-if="radiomodel==4"
......@@ -437,8 +437,11 @@
// });
});
},
// 下架/申请上架
handleUpsale(row, status, isall) { //上下架
//debugger
//console.log(442,row);
let good_id, is_onsale, title, message
if (isall == 'one') {
good_id = [row.goods_id]
......
......@@ -51,6 +51,7 @@
</div>
</template>
<script>
import { MessageBox } from 'element-ui';
import {getShopInf} from "@/api/module/entry"
import { goodsjdAddress,goodsimport} from "@/api/module/goodsgement";
import { dateFormat } from "@/utils";
......@@ -98,7 +99,7 @@ export default {
let urlarr
if (this.form.desc) {
urlarr = this.form.desc.split(',')
debugger
//debugger
if (urlarr.length > 0 && urlarr.length <= 10) {
if( Number(urlarr.length) > Number(this.collect_num)) {
this.$message({type: 'warning',message:'您好,准备导入的商品条数过多,当前剩余次数不足,请重新输入'});
......@@ -127,23 +128,57 @@ export default {
return false
}
console.log(this.el_value)
let data = {
category_id: this.el_value[2],
third_url: urlarr
}
goodsimport(data).then(res => {
if (res.code == 1) {
this.$message({
message: res.message,
type: 'success'
});
let sucCount = 0;
let allCount = Number(urlarr.length);
//let failCount = 0;
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.form.desc = ''
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() {
// this.goodsonly()
},
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论