提交 f7708415 authored 作者: 刘旭's avatar 刘旭

解决所以需求,等待测试

上级 546a84f2
......@@ -91,6 +91,7 @@ import config from '@/utils/config';
import categoryPopup from './components/categoryPopup.vue';
import goodsSku from '@/pages/goods/goodsSku.vue';
import setTitle from './components/setTitle.vue';
import _ from 'lodash'
let store = useLineStore();
let specStore = useSpecStore()
......@@ -111,6 +112,7 @@ let lineEdit = ref(); // 记录产品线修改的数据
let flow = ref(false) // 流向 默认 左到右
let flowFlag = ref(false) // 流向开关
let body = ref(false) // 线体 默认 单线体
let lineListCopy: any;
let options = ref([
{
icon: star.value ? 'star-filled' : 'star',
......@@ -194,11 +196,9 @@ let initCategory = (data: any) => {
// // 保存到产品线
let addProduct = (data: any, productId: number, specifications: any, specificationCustom: any) => {
flowFlag.value = true // 禁用选择流向
let index = lineList.value.length - 1
// console.log(index, 'index');
getLineSpecification([data.goods_id]).then((res: any) => {
if (res.data.code === 200) {
matchSpecifications(res.data.data, data.goods_id, specifications).then((res: any) => {
matchSpecifications(res.data.data, data.goods_id, specifications).then((spec: any) => {
let obj = {
name: data.goods_name,
url: data.image,
......@@ -211,42 +211,24 @@ let addProduct = (data: any, productId: number, specifications: any, specificati
status: 1,
}
if (typeof sheetData.value.delIndex != 'undefined') {
let data = JSON.parse(JSON.stringify(lineList.value))
lineListCopy[sheetData.value.delIndex] = obj
if (JSON.stringify(spec) != '{}')
for (const k in spec)
lineListCopy[sheetData.value.delIndex][k] = spec[k]
lineList.value = lineListCopy
store.$patch({
lineData: data,
lineData: lineListCopy,
});
setTimeout(() => {
data.map((item: any, i: number) => {
console.log(i, sheetData.value.delIndex);
if (sheetData.value.delIndex === i) {
console.log(item, obj);
item = JSON.parse(JSON.stringify(obj))
}
})
if (JSON.stringify(res) != '{}')
for (const k in res)
data[sheetData.value.delIndex][k] = res[k]
lineList.value = data
sheetData.value.delIndex = undefined
store.$patch({
lineData: data,
});
console.log(data[sheetData.value.delIndex - 1]);
console.log(data[sheetData.value.delIndex]);
console.log(lineList.value, 'store.lineData');
goodsSkuRef.value.skuKey = false;
console.log(data, 'data');
}, 100);
sheetData.value.delIndex = undefined
} else {
lineList.value.push(JSON.parse(JSON.stringify(obj)))
if (JSON.stringify(res) != '{}')
for (const k in res)
lineList.value[lineList.value.length - 1][k] = res[k]
lineList.value.push(obj)
if (JSON.stringify(spec) != '{}')
for (const k in spec)
lineList.value[lineList.value.length - 1][k] = spec[k]
store.$patch({
lineData: lineList.value,
});
console.log(lineList.value, 'store.lineData');
goodsSkuRef.value.skuKey = false;
}
})
......@@ -430,13 +412,11 @@ let clickSheet = (index: number) => {
// 产品修改
let sheetEdit = (index: number) => {
console.log(index);
editFlag.value = true;
let data = lineList.value[index];
if (lineId.value) {
data.updateTime = null;
lineEdit.value = data;
// console.log(lineEdit.value, 'xiugaua');
if (lineEdit.value.deleted && !lineEdit.value.isSubmit)
return uni.showToast({
title: '请勿修改失效商品',
......@@ -456,6 +436,7 @@ let sheetEdit = (index: number) => {
})
// 是否含有自定义规格
if (data.productId === 0) specStore.$patch({ specificationCustom: data.specificationCustom || [] })
lineListCopy = _.cloneDeep(lineList.value)
initDetails(data.goodsId);
};
......@@ -704,12 +685,9 @@ let handleClose = (val: Boolean) => {
let onStart = () => {
}
//拖拽结束事件
let onEnd = () => {
console.log(lineList.value, 'onend');
store.$patch({
let onEnd = () => store.$patch({
lineData: lineList.value
});
}
});
let uploadLine = () => {
uni.chooseFile({
......@@ -727,6 +705,7 @@ let uploadLine = () => {
header: { Authorization: uni.getStorageSync('token') },
success(uploadFileRes: any) {
uni.hideLoading()
flowFlag.value = true
let fileRes = JSON.parse(uploadFileRes.data)
if (fileRes.code === 501 || fileRes.code === 911) return uni.reLaunch({
url: '/pages/login/login',
......@@ -744,7 +723,7 @@ let uploadLine = () => {
store.title = '';
setTitleRef.value.title = store.title;
lineId.value = null
console.log(fileRes.data);
// console.log(fileRes.data);
let dataArr = [] as any[]
// 集合goodsId数组
fileRes.data.cartList.map((item: any) => {
......@@ -876,6 +855,11 @@ let selectFlowDirection = () => {
icon: false
})
if (!flowFlag.value) flow.value = !flow.value
else if (isUpload.value) uToastRef.value.show({
title: '导入产品线,不可重新选择流向',
type: 'warning',
icon: false
})
else uToastRef.value.show({
title: '如需选择流向,请点击重置,重新选择产品线',
type: 'warning',
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论