更新
This commit is contained in:
parent
94457705ae
commit
413b6141a8
@ -75,6 +75,12 @@ export function templateLsitApi () {
|
||||
export function productLstApi (data) {
|
||||
return request.get(`store/product/lst`, data)
|
||||
}
|
||||
/**
|
||||
* @description 云商品列表 -- 列表
|
||||
*/
|
||||
export function cloudProductList (data) {
|
||||
return request.get(`store/product/cloud_product_list`, data)
|
||||
}
|
||||
/**
|
||||
* @description 导入商品列表 -- 列表
|
||||
*/
|
||||
@ -93,6 +99,12 @@ export function productDeleteApi (id) {
|
||||
export function spikeProductDeleteApi (id) {
|
||||
return request.delete(`store/seckill_product/delete/${id}`)
|
||||
}
|
||||
/**
|
||||
* @description 云商品 -- 添加
|
||||
*/
|
||||
export function addCloudProduct (data) {
|
||||
return request.post(`store/product/add_cloud_product`, data)
|
||||
}
|
||||
/**
|
||||
* @description 商品列表 -- 添加
|
||||
*/
|
||||
|
@ -101,6 +101,15 @@ const productRouter =
|
||||
},
|
||||
component: () => import('@/views/product/productImport')
|
||||
},
|
||||
{
|
||||
path: 'cloudList',
|
||||
name: `cloudList`,
|
||||
meta: {
|
||||
title: '云商品列表',
|
||||
noCache: true
|
||||
},
|
||||
component: () => import('@/views/product/productCloud')
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
|
195
src/views/product/productCloud/goodsList.vue
Normal file
195
src/views/product/productCloud/goodsList.vue
Normal file
@ -0,0 +1,195 @@
|
||||
<template>
|
||||
<el-dialog v-if="dialogVisible" title="商品信息" :visible.sync="dialogVisible" width="1200px">
|
||||
<div class="divBox">
|
||||
<div class="header clearfix">
|
||||
<div class="container">
|
||||
<el-form size="small" inline label-width="100px">
|
||||
<el-form-item label="商品分类:" class="width100">
|
||||
<el-select
|
||||
v-model="tableFrom.mer_cate_id"
|
||||
placeholder="请选择"
|
||||
class="filter-item selWidth mr20"
|
||||
clearable
|
||||
@change="getList()"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in merCateList"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品搜索:" class="width100">
|
||||
<el-input
|
||||
v-model="tableFrom.keyword"
|
||||
placeholder="请输入商品名称,关键字,产品编号"
|
||||
class="selWidth"
|
||||
clearable
|
||||
@keyup.enter.native="getList"
|
||||
>
|
||||
<el-button slot="append" icon="el-icon-search" class="el-button-solt" @click="getList" />
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
<el-alert
|
||||
title="注:添加为预售商品后,原普通商品会下架;如该商品已开启其它营销活动,请勿选择!"
|
||||
type="warning"
|
||||
v-if="resellShow"
|
||||
show-icon>
|
||||
</el-alert>
|
||||
<el-table v-loading="listLoading" :data="tableData.data" style="width: 100%;margin-top:10px;" size="mini">
|
||||
<el-table-column width="55">
|
||||
<template slot-scope="scope">
|
||||
<el-radio
|
||||
v-model="templateRadio"
|
||||
:label="scope.row.product_id"
|
||||
@change.native="getTemplateRow(scope.row)"
|
||||
> </el-radio>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="product_id" label="ID" min-width="50" />
|
||||
<el-table-column label="商品图" min-width="80">
|
||||
<template slot-scope="scope">
|
||||
<div class="demo-image__preview">
|
||||
<el-image
|
||||
style="width: 36px; height: 36px"
|
||||
:src="scope.row.image"
|
||||
:preview-src-list="[scope.row.image]"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="store_name" label="商品名称" min-width="200" />
|
||||
<el-table-column prop="stock" label="库存" min-width="80" />
|
||||
</el-table>
|
||||
<div class="block mb20">
|
||||
<el-pagination
|
||||
:page-sizes="[20, 40, 60, 80]"
|
||||
:page-size="tableFrom.limit"
|
||||
:current-page="tableFrom.page"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="tableData.total"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="pageChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
import { productLstApi, categorySelectApi } from '@/api/product'
|
||||
import { roterPre } from '@/settings'
|
||||
export default {
|
||||
name: 'GoodsList',
|
||||
props:{
|
||||
resellShow:{
|
||||
type:Boolean,
|
||||
default:false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
templateRadio: 0,
|
||||
merCateList: [],
|
||||
roterPre: roterPre,
|
||||
listLoading: true,
|
||||
tableData: {
|
||||
data: [],
|
||||
total: 0
|
||||
},
|
||||
tableFrom: {
|
||||
page: 1,
|
||||
limit: 20,
|
||||
cate_id: '',
|
||||
store_name: '',
|
||||
keyword: '',
|
||||
is_gift_bag: 0,
|
||||
status: 1,
|
||||
},
|
||||
multipleSelection: {},
|
||||
checked: []
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getList()
|
||||
this.getCategorySelect()
|
||||
window.addEventListener('unload', (e) => this.unloadHandler(e))
|
||||
},
|
||||
methods: {
|
||||
getTemplateRow(row) {
|
||||
this.multipleSelection = { src: row.image, id: row.product_id, store_name: row.store_name }
|
||||
this.dialogVisible = false
|
||||
this.$emit('getProduct', this.multipleSelection)
|
||||
},
|
||||
// 商户分类;
|
||||
getCategorySelect() {
|
||||
categorySelectApi()
|
||||
.then((res) => {
|
||||
this.merCateList = res.data
|
||||
})
|
||||
.catch((res) => {
|
||||
this.$message.error(res.message)
|
||||
})
|
||||
},
|
||||
// 列表
|
||||
getList() {
|
||||
this.listLoading = true
|
||||
productLstApi(this.tableFrom)
|
||||
.then((res) => {
|
||||
this.tableData.data = res.data.list
|
||||
this.tableData.total = res.data.count
|
||||
// this.checked =
|
||||
// window.form_create_helper.get(this.$route.query.field) || [];
|
||||
// this.tableData.data.forEach((item) => {
|
||||
// this.checked.forEach((element) => {
|
||||
// if (Number(item.product_id) === Number(element.id)) {
|
||||
// this.$nextTick(() => {
|
||||
// this.$refs.multipleTable.toggleRowSelection(item, true);
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
this.listLoading = false
|
||||
})
|
||||
.catch((res) => {
|
||||
this.listLoading = false
|
||||
this.$message.error(res.message)
|
||||
})
|
||||
},
|
||||
pageChange(page) {
|
||||
this.tableFrom.page = page
|
||||
this.getList()
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
this.tableFrom.limit = val
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.selWidth {
|
||||
width: 360px !important;
|
||||
}
|
||||
.seachTiele {
|
||||
line-height: 35px;
|
||||
}
|
||||
.fr {
|
||||
float: right;
|
||||
}
|
||||
</style>
|
839
src/views/product/productCloud/index.vue
Normal file
839
src/views/product/productCloud/index.vue
Normal file
@ -0,0 +1,839 @@
|
||||
<template>
|
||||
<div class="divBox">
|
||||
<el-card class="box-card">
|
||||
<div slot="header" class="clearfix">
|
||||
<el-button size="small" type="primary" @click="showPopup()">添加商品</el-button>
|
||||
</div>
|
||||
<el-table
|
||||
v-loading="listLoading"
|
||||
:data="tableData.data"
|
||||
style="width: 100%"
|
||||
size="mini"
|
||||
:row-class-name="tableRowClassName"
|
||||
:row-key="
|
||||
(row) => {
|
||||
return row.product_id;
|
||||
}
|
||||
"
|
||||
@selection-change="handleSelectionChange"
|
||||
@rowclick.stop="closeEdit"
|
||||
>
|
||||
<el-table-column
|
||||
type="selection"
|
||||
:reserve-selection="true"
|
||||
width="55"
|
||||
/>
|
||||
<el-table-column type="expand">
|
||||
<template slot-scope="props">
|
||||
<el-form
|
||||
label-position="left"
|
||||
inline
|
||||
class="demo-table-expand demo-table-expand1"
|
||||
>
|
||||
<el-form-item label="平台分类:">
|
||||
<span>{{
|
||||
props.row.storeCategory
|
||||
? props.row.storeCategory.cate_name
|
||||
: "-"
|
||||
}}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品分类:">
|
||||
<template v-if="props.row.merCateId.length">
|
||||
<span
|
||||
v-for="(item, index) in props.row.merCateId"
|
||||
:key="index"
|
||||
class="mr10"
|
||||
>{{ item.category.cate_name }}</span
|
||||
>
|
||||
</template>
|
||||
<span v-else>-</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="品牌:">
|
||||
<span class="mr10">{{
|
||||
props.row.brand ? props.row.brand.brand_name : "-"
|
||||
}}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="市场价格:">
|
||||
<span>{{ props.row.ot_price | filterEmpty }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="成本价:">
|
||||
<span>{{ props.row.cost | filterEmpty }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="收藏:">
|
||||
<span>{{ props.row.care_count | filterEmpty }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
v-if="tableFrom.type === '7'"
|
||||
key="1"
|
||||
label="未通过原因:"
|
||||
>
|
||||
<span>{{ props.row.refusal }}</span>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="product_id" label="ID" min-width="50" />
|
||||
<el-table-column label="商品图" min-width="80">
|
||||
<template slot-scope="scope">
|
||||
<div class="demo-image__preview">
|
||||
<el-image
|
||||
:src="scope.row.image"
|
||||
:preview-src-list="[scope.row.image]"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="store_name" label="商品名称" min-width="200">
|
||||
<template slot-scope="scope">
|
||||
<div v-if="scope.row.attrValue && scope.row.attrValue.length > 1">
|
||||
<span style="color: #fe8c51; font-size: 10px; margin-right: 4px"
|
||||
>[多规格]</span
|
||||
>{{ scope.row.store_name }}
|
||||
</div>
|
||||
<span v-else>{{ scope.row.store_name }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="price" label="商品售价" min-width="90" />
|
||||
<!-- <el-table-column prop="price" label="批发价" min-width="90">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.attrValue[0]">
|
||||
{{ scope.row.attrValue[0].procure_price || "-" }}</span
|
||||
>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<!-- <el-table-column prop="svip_price" label="会员价" min-width="90">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.svip_price || "-" }}</span>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column prop="sales" label="销量" min-width="90" />
|
||||
<el-table-column prop="stock" label="库存" min-width="70" />
|
||||
<!-- <el-table-column prop="integral_total" label="积分抵扣" min-width="70" />
|
||||
<el-table-column prop="integral_price_total" label="积分抵扣金额" min-width="90" /> -->
|
||||
<el-table-column prop="sort" align="center" label="排序" min-width="80">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.index === tabClickIndex">
|
||||
<el-input
|
||||
v-model.number="scope.row['sort']"
|
||||
type="number"
|
||||
maxlength="300"
|
||||
size="mini"
|
||||
autofocus
|
||||
@blur="inputBlur(scope)"
|
||||
/>
|
||||
</span>
|
||||
<span v-else @dblclick.stop="tabClick(scope.row)">{{
|
||||
scope.row["sort"]
|
||||
}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="Number(tableFrom.type) < 5"
|
||||
key="1"
|
||||
prop="status"
|
||||
label="上/下架"
|
||||
min-width="150"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-switch
|
||||
v-model="scope.row.is_show"
|
||||
:active-value="1"
|
||||
:inactive-value="0"
|
||||
active-text="上架"
|
||||
inactive-text="下架"
|
||||
@change="onchangeIsShow(scope.row)"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="stock" label="商品状态" min-width="90">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.us_status | productStatusFilter }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column prop="stock" label="标签" min-width="90">
|
||||
<template slot-scope="scope">
|
||||
<div
|
||||
v-for="(item, index) in scope.row.mer_labels"
|
||||
:key="index"
|
||||
class="label-list"
|
||||
>
|
||||
{{ item.name }}
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column prop="create_time" label="创建时间" min-width="150" />
|
||||
</el-table>
|
||||
<div class="block">
|
||||
<el-pagination
|
||||
:page-sizes="[20, 40, 60, 80]"
|
||||
:page-size="tableFrom.limit"
|
||||
:current-page="tableFrom.page"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="tableData.total"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="pageChange"
|
||||
/>
|
||||
</div>
|
||||
</el-card>
|
||||
<el-dialog
|
||||
v-if="show"
|
||||
title="云商品添加"
|
||||
:visible.sync="show"
|
||||
width="600px"
|
||||
>
|
||||
<el-form :model="importInfo">
|
||||
<el-form-item label="商品" label-width="100px">
|
||||
<div class="upLoadPicBox" @click="changeGoods">
|
||||
<div v-if="addShopInfo.img" class="pictrue">
|
||||
<img :src="addShopInfo.img">
|
||||
</div>
|
||||
<div v-else class="upLoad">
|
||||
<i class="el-icon-camera cameraIconfont" />
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品名称" label-width="100px">
|
||||
<el-input v-model="addShopInfo.store_name" placeholder="" readonly></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="送达时间" label-width="100px">
|
||||
<el-radio-group
|
||||
v-model="addShopInfo.type"
|
||||
>
|
||||
<el-radio label="two" class="radio">次日达</el-radio>
|
||||
<el-radio label="three">三日达</el-radio>
|
||||
<el-radio label="seven">七日达</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div style="display: flex;justify-content: flex-end;"><el-button size="small" type="primary" @click="add">添加</el-button></div>
|
||||
</el-dialog>
|
||||
<!--选择商品-->
|
||||
<goods-list ref="goodsList" @getProduct="getProduct" />
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
import {
|
||||
cloudProductList,
|
||||
productDeleteApi,
|
||||
categorySelectApi,
|
||||
lstFilterApi,
|
||||
statusApi,
|
||||
categoryListApi,
|
||||
destoryApi,
|
||||
restoreApi,
|
||||
productSort,
|
||||
getProductLabelApi,
|
||||
updatetProductLabel,
|
||||
batchesOnOffApi,
|
||||
productConfigApi,
|
||||
batchesLabelsApi,
|
||||
shippingListApi,
|
||||
batchesTempApi,
|
||||
productBathExtApi,
|
||||
productBathSvipApi,
|
||||
importProduct,
|
||||
importImages,
|
||||
addCloudProduct
|
||||
} from "@/api/product";
|
||||
import { roterPre } from "@/settings";
|
||||
import SettingMer from "@/libs/settingMer"
|
||||
import { Message } from 'element-ui';
|
||||
import goodsList from "./goodsList.vue"
|
||||
export default {
|
||||
name: "ProductList",
|
||||
components: {goodsList},
|
||||
data () {
|
||||
return {
|
||||
props: {
|
||||
emitPath: false
|
||||
},
|
||||
show: false,
|
||||
addShopInfo: {
|
||||
img: '',
|
||||
store_name: '',
|
||||
type: ''
|
||||
},
|
||||
roterPre: roterPre,
|
||||
BASE_URL: SettingMer.https,
|
||||
headeNum: [],
|
||||
labelList: [],
|
||||
tempList: [],
|
||||
listLoading: true,
|
||||
tableData: {
|
||||
data: [],
|
||||
total: 0
|
||||
},
|
||||
tableFrom: {
|
||||
page: 1,
|
||||
limit: 20,
|
||||
mer_cate_id: "",
|
||||
cate_id: "",
|
||||
keyword: "",
|
||||
temp_id: "",
|
||||
type: this.$route.query.type ? this.$route.query.type : "1",
|
||||
is_gift_bag: "",
|
||||
us_status: "",
|
||||
mer_labels: "",
|
||||
svip_price_type: "",
|
||||
product_id: this.$route.query.id ? this.$route.query.id : "",
|
||||
product_type: ''
|
||||
},
|
||||
categoryList: [], // 平台
|
||||
merCateList: [], // 商户分类筛选
|
||||
modals: false,
|
||||
tabClickIndex: "",
|
||||
multipleSelection: [],
|
||||
productStatusList: [
|
||||
{ label: "上架显示", value: 1 },
|
||||
{ label: "下架", value: 0 },
|
||||
{ label: "平台关闭", value: -1 }
|
||||
],
|
||||
|
||||
tempRule: {
|
||||
temp_id: [
|
||||
{ required: true, message: "请选择运费模板", trigger: "change" }
|
||||
]
|
||||
},
|
||||
commisionRule: {
|
||||
extension_one: [
|
||||
{ required: true, message: "请输入一级佣金", trigger: "change" }
|
||||
],
|
||||
extension_two: [
|
||||
{ required: true, message: "请输入二级佣金", trigger: "change" }
|
||||
]
|
||||
},
|
||||
importInfo: {}, //导入商品的信息
|
||||
commisionForm: { extension_one: 0, extension_two: 0 },
|
||||
svipForm: { svip_price_type: 0 },
|
||||
goodsId: "",
|
||||
previewKey: "",
|
||||
product_id: "",
|
||||
previewVisible: false,
|
||||
dialogLabel: false,
|
||||
dialogFreight: false,
|
||||
dialogCommision: false,
|
||||
dialogSvip: false,
|
||||
dialogImport: false,
|
||||
dialogImportImg: false,
|
||||
is_audit: false,
|
||||
deliveryType: [],
|
||||
deliveryList: [],
|
||||
labelForm: {},
|
||||
tempForm: {},
|
||||
isBatch: false,
|
||||
open_svip: false,
|
||||
product: '',
|
||||
merchantType: {
|
||||
type_code: ''
|
||||
}
|
||||
};
|
||||
},
|
||||
mounted () {
|
||||
this.merchantType = this.$store.state.user.merchantType;
|
||||
let typeName = this.merchantType.type_name;
|
||||
if (typeName !== "市级供应链") {
|
||||
this.product = 0;
|
||||
this.tableFrom.product_type = ''
|
||||
} else {
|
||||
this.product = 98;
|
||||
this.tableFrom.product_type = 98
|
||||
}
|
||||
console.log(this.product);
|
||||
this.getLstFilterApi();
|
||||
this.getCategorySelect();
|
||||
this.getCategoryList();
|
||||
this.getList(1);
|
||||
this.getLabelLst();
|
||||
this.getTempLst();
|
||||
this.productCon();
|
||||
},
|
||||
updated () {
|
||||
|
||||
},
|
||||
methods: {
|
||||
showPopup(){
|
||||
this.show=true;
|
||||
},
|
||||
// 添加商品
|
||||
add(){
|
||||
addCloudProduct(this.addShopInfo).then((res)=>{
|
||||
Message.success(res.message);
|
||||
this.getList();
|
||||
this.$nextTick(()=>{
|
||||
this.show = false;
|
||||
})
|
||||
}).catch(e => {
|
||||
Message.error(e);
|
||||
})
|
||||
},
|
||||
changeGoods(){
|
||||
this.$refs.goodsList.dialogVisible = true;
|
||||
},
|
||||
getProduct(data) {
|
||||
this.addShopInfo.product_id = data.id;
|
||||
this.addShopInfo.img = data.src;
|
||||
this.addShopInfo.store_name = data.store_name;
|
||||
},
|
||||
// 把每一行的索引放进row
|
||||
tableRowClassName ({ row, rowIndex }) {
|
||||
row.index = rowIndex;
|
||||
},
|
||||
// 添加明细原因 row 当前行 column 当前列
|
||||
tabClick (row) {
|
||||
this.tabClickIndex = row.index;
|
||||
},
|
||||
// 失去焦点初始化
|
||||
inputBlur (scope) {
|
||||
if (!scope.row.sort || scope.row.sort < 0) scope.row.sort = 0;
|
||||
productSort(scope.row.product_id, { sort: scope.row.sort })
|
||||
.then(res => {
|
||||
this.closeEdit();
|
||||
})
|
||||
.catch(res => { });
|
||||
},
|
||||
closeEdit () {
|
||||
this.tabClickIndex = null;
|
||||
},
|
||||
handleSelectionChange (val) {
|
||||
this.multipleSelection = val;
|
||||
const data = [];
|
||||
this.multipleSelection.map(item => {
|
||||
data.push(item.product_id);
|
||||
});
|
||||
this.product_ids = data;
|
||||
},
|
||||
productCon () {
|
||||
productConfigApi()
|
||||
.then(res => {
|
||||
this.is_audit = res.data.is_audit;
|
||||
this.open_svip =
|
||||
res.data.mer_svip_status == 1 && res.data.svip_switch_status == 1;
|
||||
this.deliveryType = res.data.delivery_way.map(String);
|
||||
if (this.deliveryType.length == 2) {
|
||||
this.deliveryList = [
|
||||
{ value: "1", name: "到店自提" },
|
||||
{ value: "2", name: "快递配送" }
|
||||
];
|
||||
} else {
|
||||
if (this.deliveryType.length == 1 && this.deliveryType[0] == "1") {
|
||||
this.deliveryList = [{ value: "1", name: "到店自提" }];
|
||||
} else {
|
||||
this.deliveryList = [{ value: "2", name: "快递配送" }];
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(res => {
|
||||
this.$message.error(res.message);
|
||||
});
|
||||
},
|
||||
getSuccess () {
|
||||
this.getLstFilterApi();
|
||||
this.getList(1);
|
||||
},
|
||||
handleClose () {
|
||||
this.dialogLabel = false;
|
||||
},
|
||||
handleFreightClose () {
|
||||
this.dialogFreight = false;
|
||||
},
|
||||
// 添加淘宝商品成功
|
||||
onClose () {
|
||||
this.modals = false;
|
||||
},
|
||||
// 复制淘宝
|
||||
onCopy () {
|
||||
// this.$refs.taoBao.modals = true
|
||||
// this.$refs.taoBao.soure_link = ''
|
||||
// this.$refs.taoBao.formValidate = {}
|
||||
// this.$refs.taoBao.isData = false
|
||||
this.$router.push({
|
||||
path: this.roterPre + "/product/list/addProduct",
|
||||
query: { type: 1 }
|
||||
});
|
||||
},
|
||||
// 获取标签项
|
||||
getLabelLst () {
|
||||
getProductLabelApi()
|
||||
.then(res => {
|
||||
this.labelList = res.data;
|
||||
})
|
||||
.catch(res => {
|
||||
this.$message.error(res.message);
|
||||
});
|
||||
},
|
||||
// 获取运费模板
|
||||
getTempLst () {
|
||||
shippingListApi()
|
||||
.then(res => {
|
||||
this.tempList = res.data;
|
||||
})
|
||||
.catch(res => {
|
||||
this.$message.error(res.message);
|
||||
});
|
||||
},
|
||||
// 免审编辑
|
||||
onAuditFree (row) {
|
||||
this.$refs.editAttr.getAttrDetail(row.product_id);
|
||||
},
|
||||
// 批量设置佣金
|
||||
batchCommision () {
|
||||
if (this.multipleSelection.length === 0)
|
||||
return this.$message.warning("请先选择商品");
|
||||
this.dialogCommision = true;
|
||||
},
|
||||
// 批量设置会员价
|
||||
batchSvip () {
|
||||
if (this.multipleSelection.length === 0)
|
||||
return this.$message.warning("请先选择商品");
|
||||
this.dialogSvip = true;
|
||||
},
|
||||
submitCommisionForm (name) {
|
||||
this.$refs[name].validate(valid => {
|
||||
if (valid) {
|
||||
this.commisionForm.ids = this.product_ids;
|
||||
productBathExtApi(this.commisionForm).then(({ message }) => {
|
||||
this.$message.success(message);
|
||||
this.getList("");
|
||||
this.dialogCommision = false;
|
||||
});
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
});
|
||||
},
|
||||
// 提交会员价
|
||||
submitSvipForm (name) {
|
||||
this.svipForm.ids = this.product_ids;
|
||||
productBathSvipApi(this.svipForm).then(({ message }) => {
|
||||
this.$message.success(message);
|
||||
this.getList("");
|
||||
this.dialogSvip = false;
|
||||
});
|
||||
},
|
||||
// 批量上架
|
||||
batchShelf () {
|
||||
if (this.multipleSelection.length === 0)
|
||||
return this.$message.warning("请先选择商品");
|
||||
let data = { status: 1, ids: this.product_ids };
|
||||
batchesOnOffApi(data)
|
||||
.then(res => {
|
||||
this.$message.success(res.message);
|
||||
this.getLstFilterApi();
|
||||
this.getList("");
|
||||
})
|
||||
.catch(res => {
|
||||
this.$message.error(res.message);
|
||||
});
|
||||
},
|
||||
// 批量下架
|
||||
batchOff () {
|
||||
if (this.multipleSelection.length === 0)
|
||||
return this.$message.warning("请先选择商品");
|
||||
let data = { status: 0, ids: this.product_ids };
|
||||
batchesOnOffApi(data)
|
||||
.then(res => {
|
||||
this.$message.success(res.message);
|
||||
this.getLstFilterApi();
|
||||
this.getList("");
|
||||
})
|
||||
.catch(res => {
|
||||
this.$message.error(res.message);
|
||||
});
|
||||
},
|
||||
// 批量设置标签
|
||||
batchLabel () {
|
||||
this.labelForm = {
|
||||
mer_labels: [],
|
||||
ids: this.product_ids
|
||||
};
|
||||
this.isBatch = true;
|
||||
this.dialogLabel = true;
|
||||
},
|
||||
// 批量设置运费模板
|
||||
batchFreight () {
|
||||
this.dialogFreight = true;
|
||||
},
|
||||
submitTempForm (name) {
|
||||
this.$refs[name].validate(valid => {
|
||||
if (valid) {
|
||||
this.tempForm.ids = this.product_ids;
|
||||
batchesTempApi(this.tempForm).then(({ message }) => {
|
||||
this.$message.success(message);
|
||||
this.getList("");
|
||||
this.dialogFreight = false;
|
||||
});
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
});
|
||||
},
|
||||
handleRestore (id) {
|
||||
this.$modalSure("恢复商品").then(() => {
|
||||
restoreApi(id)
|
||||
.then(res => {
|
||||
this.$message.success(res.message);
|
||||
this.getLstFilterApi();
|
||||
this.getList("");
|
||||
})
|
||||
.catch(res => {
|
||||
this.$message.error(res.message);
|
||||
});
|
||||
});
|
||||
},
|
||||
// 预览
|
||||
handlePreview (id) {
|
||||
console.log(id);
|
||||
console.log("123");
|
||||
this.previewVisible = true;
|
||||
this.goodsId = id;
|
||||
this.previewKey = "";
|
||||
},
|
||||
// 商户分类;
|
||||
getCategorySelect () {
|
||||
categorySelectApi()
|
||||
.then(res => {
|
||||
this.merCateList = res.data;
|
||||
})
|
||||
.catch(res => {
|
||||
this.$message.error(res.message);
|
||||
});
|
||||
},
|
||||
// 平台分类;
|
||||
getCategoryList () {
|
||||
categoryListApi()
|
||||
.then(res => {
|
||||
this.categoryList = res.data;
|
||||
})
|
||||
.catch(res => {
|
||||
this.$message.error(res.message);
|
||||
});
|
||||
},
|
||||
// 列表表头;
|
||||
getLstFilterApi () {
|
||||
// lstFilterApi()
|
||||
// .then(res => {
|
||||
// this.headeNum = res.data;
|
||||
// })
|
||||
// .catch(res => {
|
||||
// this.$message.error(res.message);
|
||||
// });
|
||||
},
|
||||
// 列表
|
||||
getList (num) {
|
||||
this.listLoading = true;
|
||||
this.tableFrom.page = num || this.tableFrom.page;
|
||||
cloudProductList(this.tableFrom)
|
||||
.then(res => {
|
||||
this.tableData.data = res.data.list;
|
||||
this.tableData.total = res.data.count;
|
||||
this.listLoading = false;
|
||||
})
|
||||
.catch(res => {
|
||||
this.listLoading = false;
|
||||
this.$message.error(res.message);
|
||||
});
|
||||
this.getLstFilterApi();
|
||||
},
|
||||
pageChange (page) {
|
||||
this.tableFrom.page = page;
|
||||
this.getList("");
|
||||
},
|
||||
handleSizeChange (val) {
|
||||
this.tableFrom.limit = val;
|
||||
this.getList("");
|
||||
},
|
||||
// 删除
|
||||
handleDelete (id, idx) {
|
||||
this.$modalSure(
|
||||
this.tableFrom.type !== "5" ? "加入回收站" : "删除该商品"
|
||||
).then(() => {
|
||||
this.tableFrom.type === "5"
|
||||
? destoryApi(id)
|
||||
.then(({ message }) => {
|
||||
this.$message.success(message);
|
||||
this.getList("");
|
||||
this.getLstFilterApi();
|
||||
})
|
||||
.catch(({ message }) => {
|
||||
this.$message.error(message);
|
||||
})
|
||||
: productDeleteApi(id)
|
||||
.then(({ message }) => {
|
||||
this.$message.success(message);
|
||||
this.getList("");
|
||||
this.getLstFilterApi();
|
||||
})
|
||||
.catch(({ message }) => {
|
||||
this.$message.error(message);
|
||||
});
|
||||
});
|
||||
},
|
||||
// 编辑标签
|
||||
onEditLabel (row) {
|
||||
this.dialogLabel = true;
|
||||
this.product_id = row.product_id;
|
||||
if (row.mer_labels && row.mer_labels.length) {
|
||||
const arrNew = row.mer_labels.map(item => {
|
||||
return item.product_label_id;
|
||||
});
|
||||
this.labelForm = {
|
||||
mer_labels: arrNew
|
||||
};
|
||||
} else {
|
||||
this.labelForm = {
|
||||
mer_labels: []
|
||||
};
|
||||
}
|
||||
},
|
||||
submitForm (name) {
|
||||
this.$refs[name].validate(valid => {
|
||||
if (valid) {
|
||||
this.isBatch
|
||||
? batchesLabelsApi(this.labelForm).then(({ message }) => {
|
||||
this.$message.success(message);
|
||||
this.getList("");
|
||||
this.dialogLabel = false;
|
||||
this.isBatch = false;
|
||||
})
|
||||
: updatetProductLabel(this.product_id, this.labelForm).then(
|
||||
({ message }) => {
|
||||
this.$message.success(message);
|
||||
this.getList("");
|
||||
this.dialogLabel = false;
|
||||
}
|
||||
);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
});
|
||||
},
|
||||
onchangeIsShow (row) {
|
||||
statusApi(row.product_id, row.is_show)
|
||||
.then(({ message }) => {
|
||||
this.$message.success(message);
|
||||
this.getList("");
|
||||
this.getLstFilterApi();
|
||||
})
|
||||
.catch(({ message }) => {
|
||||
this.$message.error(message);
|
||||
});
|
||||
},
|
||||
// 导入商品
|
||||
importShort () {
|
||||
this.dialogImport = true;
|
||||
},
|
||||
importClose () {
|
||||
this.dialogImport = false;
|
||||
},
|
||||
// 导入商品图片
|
||||
importShortImg () {
|
||||
this.dialogImportImg = true;
|
||||
},
|
||||
importCloseImg () {
|
||||
this.dialogImportImg = false;
|
||||
},
|
||||
// 上传文档
|
||||
async importXlsUpload (options) {
|
||||
console.log('上传', options);
|
||||
const file = options.file;
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
importProduct(formData).then((res) => {
|
||||
Message.success(res.message);
|
||||
}).catch(e => {
|
||||
Message.error(e);
|
||||
})
|
||||
// const chunkSize = 2 * 1024 * 1024; // 每个分片的大小,这里设置为2MB
|
||||
|
||||
// // 计算文件总共需要分成多少个分片
|
||||
// const totalChunks = Math.ceil(file.size / chunkSize);
|
||||
|
||||
// try {
|
||||
// // 循环上传每个分片
|
||||
// for (let i = 0; i < totalChunks; i++) {
|
||||
// const start = i * chunkSize;
|
||||
// const end = Math.min((i + 1) * chunkSize, file.size);
|
||||
// const chunk = file.slice(start, end);
|
||||
|
||||
// // 构建FormData对象,用于传输分片数据
|
||||
// const formData = new FormData();
|
||||
// formData.append('file', chunk);
|
||||
// formData.append('chunkIndex', i);
|
||||
// formData.append('totalChunks', totalChunks);
|
||||
// formData.append('filename', file.name);
|
||||
|
||||
// // 使用axios发送分片请求
|
||||
// await axios.post('store/import/product', formData);
|
||||
// }
|
||||
|
||||
// // 分片上传完成后,在这里进行合并操作
|
||||
// // ...
|
||||
|
||||
// Message.success('文件上传成功!');
|
||||
// } catch (error) {
|
||||
// Message.error('文件上传失败!');
|
||||
// }
|
||||
},
|
||||
// 上传图片压缩包
|
||||
async importZipUpload (options) {
|
||||
console.log('上传', options);
|
||||
const file = options.file;
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
importImages(formData).then((res) => {
|
||||
Message.success(res.message);
|
||||
}).catch(e => {
|
||||
Message.error(e);
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.bg {
|
||||
z-index: 100;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
.goods_detail .goods_detail_wrapper {
|
||||
z-index: -10;
|
||||
}
|
||||
/deep/ table.el-input__inner {
|
||||
padding: 0;
|
||||
}
|
||||
.demo-table-expand {
|
||||
font-size: 0;
|
||||
}
|
||||
.demo-table-expand1 {
|
||||
/deep/ label {
|
||||
width: 77px !important;
|
||||
color: #99a9bf;
|
||||
}
|
||||
}
|
||||
.demo-table-expand .el-form-item {
|
||||
margin-right: 0;
|
||||
margin-bottom: 0;
|
||||
width: 33.33%;
|
||||
}
|
||||
.selWidth {
|
||||
width: 350px !important;
|
||||
}
|
||||
.seachTiele {
|
||||
line-height: 35px;
|
||||
}
|
||||
</style>
|
@ -1073,8 +1073,6 @@ export default {
|
||||
},
|
||||
// 预览
|
||||
handlePreview (id) {
|
||||
console.log(id);
|
||||
console.log("123");
|
||||
this.previewVisible = true;
|
||||
this.goodsId = id;
|
||||
this.previewKey = "";
|
||||
|
Loading…
x
Reference in New Issue
Block a user