var goods_id = $("#goods_id").val();
|
const App = {
|
|
mixins: [sharedMixin], /////共用的方法/////
|
data() {
|
return {
|
// loading: true,
|
dialog: {
|
setGoodsDisInfo: false,
|
},
|
loading: {
|
loading: false,
|
goodsDisInfo: true,
|
},
|
kd_review_comments: '',
|
set_nopass_reason_title: '商品刊登审核',
|
dialogVisible_reason: false,
|
goods_id: goods_id,
|
categoryList: [], /////商品分类数据//////
|
|
uploadFileForm: {
|
atta_type: 1,
|
},
|
create_goods_form: {
|
categoryid: ["29", "2901", "290101"],
|
warehouse_mode: 1, //////商品仓库模式:自建仓
|
docking_way: 0, /////对接系统:无
|
price_method: 0, ////定价方式
|
sales_form: 1, ////销售形式:单品
|
},
|
goodsInfoForm: { istemp: 0, },////////商品信息//////
|
goodsBrandList: [],///////商品品牌列表//////
|
publishOrderPictureList: [],////////商品图片列表//////
|
previewImageUrl: '',////预览图片地址//////
|
dialogVisible_Picture: false,////预览图片弹窗//////
|
goodsPictureCount: {},//////商品图片数量//////
|
current_goods_distribution_area: {},
|
screenHeight: 0,
|
goodsDisInfo: {
|
goodsSpecInfo: {},
|
goodsAttributeInfo: {},
|
goodsAttributExtendList: [],
|
goodsRetailPriceLimitList: [],
|
goodsLabelList: [],
|
|
},
|
disAreaList: [],
|
disStockList: [],
|
disReturnGoodsList: [],
|
goods_spec_info: [],
|
pictureStatuslist: { 0: true, 1: false, 2: false, 3: false, 4: false, 5: false, 6: false, 7: false },
|
picture_type: [],
|
goodsPictureList: [],
|
catelist: [],
|
|
};
|
},
|
mounted() {
|
this.loading.loading = true;
|
Promise.all([
|
this.getGoodsInfo(),
|
this.getGoodsDisInfo(),
|
this.updateScreenHeight(),
|
// this.getCategoryList(),
|
]).then(() => {
|
// setTimeout(() => {
|
|
// }, 500);
|
}).catch((error) => {
|
this.loading.loading = false;
|
|
});
|
},
|
created() { },
|
methods: {
|
showReviewGoodsKD() {
|
this.kd_review_comments = '';
|
this.dialogVisible_reason = true;
|
},
|
reviewGoodsKD(status) {
|
let that = this;
|
let { id } = that.goodsInfoForm;
|
|
if (status == 2 && that.kd_review_comments == '') {
|
that.$notify.error({
|
title: '错误',
|
position: 'top-left',
|
message: '请填写审核不通过原因'
|
});
|
return false;
|
}
|
|
let url = "/admin/goodskd/reviewGoodsKD.html"
|
postRequest(url, { id: id, status: status, kd_review_comments: that.kd_review_comments }).then(res => {
|
if (res.data.code == 200) {
|
that.$notify({
|
title: '成功',
|
message: res.data.message,
|
position: 'top-left',
|
type: 'success',
|
duration: 1000,
|
onClose: () => {
|
if (status == 2) {
|
that.dialogVisible_reason = false;
|
}
|
document.location.href = '/admin/goodskd/index.html';
|
}
|
});
|
if (status == 2) {
|
that.dialogVisible_reason = false;
|
}
|
}
|
else {
|
that.$notify.error({
|
title: '错误',
|
position: 'top-left',
|
message: res.data.message
|
});
|
|
}
|
})
|
.catch((error) => {
|
console.log(error)
|
});
|
},
|
setPictureStatus(val) {
|
if (val === 0) {
|
this.pictureStatuslist = { 0: true, 1: false, 2: false, 3: false, 4: false, 5: false, 6: false, 7: false }
|
this.picture_type = [];
|
}
|
else {
|
this.pictureStatuslist[0] = false;
|
this.pictureStatuslist[val] = !this.pictureStatuslist[val];
|
if (this.pictureStatuslist[val]) {
|
this.picture_type.push(val);
|
}
|
else {
|
this.picture_type = this.picture_type.filter(item => item != val);
|
}
|
if (this.picture_type.length === 0) {
|
this.pictureStatuslist[0] = true;
|
}
|
}
|
this.getGoodsPictureList();
|
},
|
getGoodsPictureList() {
|
const that = this;
|
const url = "/admin/goods/getGoodsPictureList.html";
|
postRequest(url, { goods_id: that.goodsDisInfo.id, picture_type: that.picture_type }).then((res) => {
|
|
if (res.data.code === 200) {
|
that.goodsPictureList = res.data.list;
|
}
|
else {
|
that.goodsPictureList = [];
|
}
|
}).catch((error) => {
|
// 处理请求失败的情况
|
|
});
|
},
|
getGoodsPictureCount() {
|
const that = this;
|
const url = "/admin/goods/getGoodsPictureCount.html";
|
postRequest(url, { goods_id: that.goodsDisInfo.id }).then((res) => {
|
|
if (res.data.code === 200) {
|
that.goodsPictureCount = res.data.goodsPictureCount;
|
}
|
else {
|
that.goodsPictureCount = {};
|
}
|
}).catch((error) => {
|
// 处理请求失败的情况
|
|
});
|
},
|
updateScreenHeight() {
|
this.screenHeight = window.innerHeight;
|
},
|
getGoodsDisInfo() {
|
const that = this;
|
const url = "/admin/goodskd/getGoodsDisInfo.html";
|
|
|
postRequest(url, { id: that.goods_id }).then((res) => {
|
this.loading.goodsDisInfo = false;
|
if (res.data.code === 200) {
|
that.catelist = res.data.catelist;
|
that.goodsDisInfo = res.data.info;
|
that.disAreaList = res.data.disAreaList;
|
that.disStockList = res.data.disStockList;
|
that.disPriceList = res.data.disPriceList;
|
that.disReturnGoodsList = res.data.disReturnGoodsList;
|
that.getGoodsPictureList()
|
this.getGoodsPictureCount();
|
|
}
|
else {
|
return;
|
}
|
}).catch((error) => {
|
this.loading.goodsDisInfo = false;
|
// 错误处理逻辑,例如弹窗提示
|
|
});;
|
},
|
///取商品基本信息数据
|
getGoodsInfo() {
|
const that = this;
|
const url = "/admin/goodskd/getGoodsInfo.html";
|
postRequest(url, { id: that.goods_id }).then((res) => {
|
this.loading.loading = false;
|
if (res.data.code === 200) {
|
that.goodsInfoForm.id = res.data.info.id;
|
that.goodsInfoForm.first_cate_code = res.data.info.first_cate_code;
|
that.goodsInfoForm.second_cate_code = res.data.info.second_cate_code;
|
that.goodsInfoForm.three_cate_code = res.data.info.three_cate_code;
|
that.goodsInfoForm.cate_code = res.data.info.cate_code;
|
that.goodsInfoForm.brand_code = res.data.info.brand_code;
|
|
that.goodsInfoForm.goods_title_en = res.data.goods_desc.goods_title_en;
|
that.goodsInfoForm.goods_title_cn = res.data.goods_desc.goods_title_cn;
|
|
that.goodsInfoForm.goods_desc_en = res.data.goods_desc_content.goods_desc_en;
|
that.goodsInfoForm.goods_desc_cn = res.data.goods_desc_content.goods_desc_cn;
|
|
if (that.goodsInfoForm.goods_desc_en != null) {
|
tinymce.get('tinymce-en-1').setContent(that.goodsInfoForm.goods_desc_en);
|
}
|
if (that.goodsInfoForm.goods_desc_cn != null) {
|
tinymce.get('tinymce-cn-1').setContent(that.goodsInfoForm.goods_desc_cn);
|
}
|
}
|
else {
|
return;
|
}
|
}).catch((error) => {
|
this.loading.loading = false;
|
// 错误处理逻辑,例如弹窗提示
|
|
});;
|
},
|
// 预览图片
|
previewPictureCard(file) {
|
this.previewImageUrl = file.url
|
this.dialogVisible_Picture = true
|
},
|
|
|
//获取分类数据
|
getCategoryList() {
|
const that = this;
|
const url = "/admin/goods/getCategoryList.html";
|
postRequest(url, {}).then((res) => {
|
console.log(res.data)
|
if (res.data.code === 200) {
|
that.categoryList = res.data.list;
|
}
|
}).catch((error) => {
|
// 处理请求失败的情况
|
|
})
|
},
|
},
|
};
|
const app = Vue.createApp(App);
|
const iconList = ['Menu', 'QuestionFilled'];
|
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
if (iconList.includes(key)) {
|
app.component('custom-' + key.toLowerCase(), component);
|
}
|
else {
|
app.component(key, component);
|
}
|
}
|
app.use(ElementPlus, {
|
locale: ElementPlusLocaleZhCn,
|
});
|
app.mount("#vue_item");
|