Commit 777f0c1b authored by mengwenhao's avatar mengwenhao

feature:图片上传格式化

parent 58b89060
...@@ -77,7 +77,7 @@ exports.postSuccess = async ctx => { ...@@ -77,7 +77,7 @@ exports.postSuccess = async ctx => {
}; };
ctx.body = await req(ctx, opts); ctx.body = await req(ctx, opts);
}; };
// 检查商品名称是否被占用
exports.checkGoodsName = async ctx => { exports.checkGoodsName = async ctx => {
const opts = { const opts = {
url: `${GOODS_URI}/goods/background/check_goods_name`, url: `${GOODS_URI}/goods/background/check_goods_name`,
...@@ -85,9 +85,9 @@ exports.checkGoodsName = async ctx => { ...@@ -85,9 +85,9 @@ exports.checkGoodsName = async ctx => {
json: true, json: true,
body: ctx.request.body body: ctx.request.body
}; };
ctx.body = req(ctx, opts); ctx.body = await req(ctx, opts);
}; };
// 审核拒绝
exports.auditReject = async ctx => { exports.auditReject = async ctx => {
const opts = { const opts = {
url: `${GOODS_URI}/goods/background/audit_reject`, url: `${GOODS_URI}/goods/background/audit_reject`,
...@@ -98,3 +98,11 @@ exports.auditReject = async ctx => { ...@@ -98,3 +98,11 @@ exports.auditReject = async ctx => {
console.log("审核驳回操作", ctx.request.body); console.log("审核驳回操作", ctx.request.body);
ctx.body = await req(ctx, opts); ctx.body = await req(ctx, opts);
}; };
exports.getShopsList = async ctx => {
const opts = {
url: `${GOODS_URI}/shop/background/shop_list`,
method: "GET",
qs: ctx.request.query
};
ctx.body = await req(ctx, opts);
};
...@@ -45,7 +45,8 @@ router.post(`${API_VERSION}/goods/background/offline`, goods.putOffline); ...@@ -45,7 +45,8 @@ router.post(`${API_VERSION}/goods/background/offline`, goods.putOffline);
router.get(`${API_VERSION}/goods/background/get_goods_info`, goods.getGoodsInfo); router.get(`${API_VERSION}/goods/background/get_goods_info`, goods.getGoodsInfo);
router.post(`${API_VERSION}/goods/background/audit_pass`, goods.postSuccess); router.post(`${API_VERSION}/goods/background/audit_pass`, goods.postSuccess);
router.post(`${API_VERSION}/goods/background/check_goods_name`, goods.checkGoodsName); router.post(`${API_VERSION}/goods/background/check_goods_name`, goods.checkGoodsName);
router.post(`${API_VERSION}/goods/background/audit_reject`, goods.auditReject) router.post(`${API_VERSION}/goods/background/audit_reject`, goods.auditReject);
router.get(`${API_VERSION}/shop/background/shop_list`, goods.getShopsList)
//生活号 //生活号
......
...@@ -97,13 +97,14 @@ ...@@ -97,13 +97,14 @@
<el-upload <el-upload
:disabled="$route.params.operation !== 'EDIT'" :disabled="$route.params.operation !== 'EDIT'"
ref="detailUpload" ref="detailUpload"
action="#" :action="uploadUrl"
:on-preview="previewImage" :on-preview="previewImage"
:auto-upload="false" :auto-upload="true"
:data="{ scenario: `goods` }"
:limit="9" :limit="9"
list-type="picture-card" list-type="picture-card"
multiple multiple
:on-change="handleDetailChange" :on-success="handleDetailChange"
:on-remove="removeDetailFiles" :on-remove="removeDetailFiles"
:file-list="descPicUrlList" :file-list="descPicUrlList"
> >
...@@ -196,13 +197,14 @@ ...@@ -196,13 +197,14 @@
> >
<template #default="scope"> <template #default="scope">
<span>经度:{{ scope.row.longitude }}</span> <span>经度:{{ scope.row.longitude }}</span>
&nbsp; &nbsp; <br />
<span>纬度:{{ scope.row.latitude }}</span> <span>纬度:{{ scope.row.latitude }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
label="操作" label="操作"
align="center" align="center"
fixed="right"
> >
<template #default="scope"> <template #default="scope">
<el-button <el-button
...@@ -217,46 +219,104 @@ ...@@ -217,46 +219,104 @@
placement="bottom" placement="bottom"
:width="600" :width="600"
trigger="click" trigger="click"
v-model:visible="addShopDialog"
> >
<template #reference> <template #reference>
<el-button <el-button
@click="getShops"
type="primary" type="primary"
style="border-radius:20px;margin:20px 0 0 50%;transform: translate(-50%,0);" style="border-radius:20px;margin:20px 0 0 50%;transform: translate(-50%,0);"
>添加门店 >门店列表
</el-button> </el-button>
</template> </template>
<!-- 门店列表 -->
<el-table :data="shopsList.result">
<el-table-column
type="selection"
width="55"
> </el-table-column>
<el-table-column
align="center"
prop="shop_name"
label="门店名称"
></el-table-column>
<el-table-column
align="center"
prop="phone"
label="联系电话"
></el-table-column>
<el-table-column
align="center"
prop="address"
label="地址"
></el-table-column>
<el-table-column
align="center"
label="地理定位"
>
<template #default="scope">
<span>经度:{{ scope.row.longitude }}</span>
<br />
<span>纬度:{{ scope.row.latitude }}</span>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<el-pagination
style="margin-top:20px"
background
@current-change="changeShopListPage"
v-model:currentPage="shopCurrentPage"
:page-size="5"
layout="total, prev, pager, next"
:total="shopsList.count"
>
</el-pagination>
<!-- 添加门店弹窗 --> <!-- 添加门店弹窗 -->
<el-form <el-popover
label-position="right" placement="bottom"
label-width="100px" :width="600"
:model="shopForm" trigger="click"
> >
<el-form-item label="门店名称:"> <template #reference>
<el-input v-model="shopForm.shop_name"></el-input> <el-button
</el-form-item> type="primary"
<el-form-item label="联系电话:"> style="border-radius:20px;margin:20px 0 0 50%;transform: translate(-50%,0);"
<el-input v-model="shopForm.connect_phone"></el-input> >添加门店
</el-form-item> </el-button>
<el-form-item label="地址:"> </template>
<el-input v-model="shopForm.address"></el-input> <!-- 添加门店表单 -->
</el-form-item> <el-form
<el-form-item label-position="right"
label="地理定位:" label-width="100px"
class="deep_place" :model="shopForm"
> >
<el-input v-model="shopForm.deep_place"></el-input> <el-form-item label="门店名称:">
<a <el-input v-model="shopForm.shop_name"></el-input>
style="" </el-form-item>
target="_blank" <el-form-item label="联系电话:">
href="https://lbs.amap.com/tools/picker" <el-input v-model="shopForm.connect_phone"></el-input>
>高德获取定位</a> </el-form-item>
</el-form-item> <el-form-item label="地址:">
</el-form> <el-input v-model="shopForm.address"></el-input>
<section style="display:flex;justify-content:center;"> </el-form-item>
<el-button type="primary">保存</el-button> <el-form-item
<el-button @click="addShopDialog = false">取消</el-button> label="地理定位:"
</section> class="deep_place"
>
<el-input v-model="shopForm.deep_place"></el-input>
<a
style=""
target="_blank"
href="https://lbs.amap.com/tools/picker"
>高德获取定位</a>
</el-form-item>
</el-form>
<section style="display:flex;justify-content:center;">
<el-button type="primary">保存</el-button>
</section>
</el-popover>
</el-popover> </el-popover>
</section> </section>
<section class="width50p"> <section class="width50p">
...@@ -270,10 +330,16 @@ ...@@ -270,10 +330,16 @@
</el-form-item> --> </el-form-item> -->
<el-form-item label="售价"> <el-form-item label="售价">
<el-input v-model="goodsObj.price"></el-input> <el-input
v-model="goodsObj.price"
@input="salePrice"
></el-input>
</el-form-item> </el-form-item>
<el-form-item label="原价"> <el-form-item label="原价">
<el-input v-model="goodsObj.original_price"></el-input> <el-input
v-model="goodsObj.original_price"
@input="perPrice"
></el-input>
</el-form-item> </el-form-item>
<h4 style="margin:20px 0">库存信息</h4> <h4 style="margin:20px 0">库存信息</h4>
<el-form-item label="剩余库存量:"> <el-form-item label="剩余库存量:">
...@@ -326,14 +392,8 @@ ...@@ -326,14 +392,8 @@
</el-form-item> </el-form-item>
<el-form-item label="使用日期:"> <el-form-item label="使用日期:">
<el-radio-group v-model="goodsObj.rule_date_type"> <el-radio-group v-model="goodsObj.rule_date_type">
<el-radio <el-radio :label="1">周末、节假日通用</el-radio>
label="周末、节假日通用" <el-radio :label="2">仅工作日可用</el-radio>
:value="1"
></el-radio>
<el-radio
label="仅工作日可用"
:value="2"
></el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="使用时间:"> <el-form-item label="使用时间:">
...@@ -471,9 +531,12 @@ import { ...@@ -471,9 +531,12 @@ import {
getGoodsList, getGoodsList,
postSuccess, postSuccess,
auditReject, auditReject,
checkGoodsName checkGoodsName,
getShopsList
} from "@/service/Goods/goods"; } from "@/service/Goods/goods";
import { GOODS_URI } from "../../../../server/config.js";
export default { export default {
name: "GoodsDetail", name: "GoodsDetail",
...@@ -519,8 +582,10 @@ export default { ...@@ -519,8 +582,10 @@ export default {
watch: { watch: {
goodsObj (val) { goodsObj (val) {
this.optionsValue = [val.category_1_id, val.category_2_id]; this.optionsValue = [val.category_1_id, val.category_2_id];
this.useTime = this.formatDate(val.rule_start_time, val.rule_end_time); this.rulesForm.useTime = this.formatDate(
console.log("初始化时间", this.useTime); val.rule_start_time,
val.rule_end_time
);
} }
}, },
...@@ -541,11 +606,16 @@ export default { ...@@ -541,11 +606,16 @@ export default {
optionList: [], // 商品分类选项 optionList: [], // 商品分类选项
optionsValue: [], // 商品分类的值 optionsValue: [], // 商品分类的值
// 商品回显信息 // 商品回显信息
goodsObj: {}, goodsObj: {
descPicUrlList: [], // 商品详情图列表 introduce: ""
introducePicUrlList: [], // 商品介绍图列表 },
descPicUrlList: [], // 商品详情图回显列表
introducePicUrlList: [], // 商品介绍图回显列表
recordList: [], // 提交记录 recordList: [], // 提交记录
uploadFileList: [], // 上传图片列表
detailUploadList: [], // 上传图片列表
inventoryNumber: 0, // 库存数量 inventoryNumber: 0, // 库存数量
// 使用规则表单 // 使用规则表单
...@@ -571,7 +641,10 @@ export default { ...@@ -571,7 +641,10 @@ export default {
reason: "" reason: ""
}, },
// 门店表单 shopsList: [], // 门店列表
shopCurrentPage: 1, // 门店列表当前页
// 新增门店表单
shopForm: { shopForm: {
shop_name: "", shop_name: "",
connect_phone: "", connect_phone: "",
...@@ -579,10 +652,16 @@ export default { ...@@ -579,10 +652,16 @@ export default {
deep_place: "" deep_place: ""
}, },
shopList: [], // 门店列表
addShopDialog: false, // 添加门店弹框 addShopDialog: false, // 添加门店弹框
rejectVisible: false, // 驳回原因弹框展示状态 showShopDialog: false, // 是否展示门店列表
popoverImage: "", // 放大显示图 popoverImage: "", // 放大显示图
isShowPopver: false // 是否展示图片框
rejectVisible: false, // 驳回原因弹框展示状态
isShowPopver: false, // 是否展示图片框
uploadUrl: `${GOODS_URI}/merchant/lifeinner/upload` // 金山云上传地址
}; };
}, },
...@@ -610,25 +689,66 @@ export default { ...@@ -610,25 +689,66 @@ export default {
this.recordLits = record_list; this.recordLits = record_list;
// 格式化商品详情照片 // 格式化商品详情照片
goods_info.desc_pic_url_list.forEach(item => { this.formatPicture(goods_info.desc_pic_url_list, this.descPicUrlList);
const obj = new Object();
obj.url = item;
this.descPicUrlList.push(obj);
});
// 格式化商品介绍照片 // 格式化商品介绍照片
goods_info.introduce_pic_url_list.forEach(item => { this.formatPicture(
const obj = new Object(); goods_info.introduce_pic_url_list,
obj.url = item; this.introducePicUrlList
this.introducePicUrlList.push(obj); );
});
// 格式化文件上传列表
this.formatUploadPictureList(
goods_info.desc_pic_url_list,
this.detailUploadList
);
// 格式化初始日期 // 格式化初始日期
} catch (error) { } catch (error) {
console.error(error); console.error(error);
} }
}, },
// 格式化照片列表
formatPicture (willFormat, willStorage) {
willFormat.forEach(item => {
const obj = new Object();
obj.url = item;
willStorage.push(obj);
});
},
// 格式化上传照片列表
formatUploadPictureList (willFormat, willStorage) {
// 格式化上传文件列表
for (let i = 0; i < willFormat.length; i++) {
if (willFormat.length === 0) {
return (this.detailUploadList = []);
}
const objectUrl = new URL(willFormat[i]);
console.log(objectUrl);
const bucketName = objectUrl.hostname;
const objectId = objectUrl.pathname;
willStorage.push(`${bucketName}${objectId}`);
}
},
// 获取门店列表
async getShops () {
const query = {
// this.goodsObj.life_account_id
life_account_id: "9233473057619969",
page: this.shopCurrentPage,
page_size: 5
};
const res = await getShopsList(query);
if (res.code !== 0) return this.$message.error(res.reason);
this.shopsList = res;
},
// 商品列表换页
changeShopListPage (page) {
this.shopCurrentPage = page;
this.getShops();
},
// 格式化日期 // 格式化日期
formatDate (startTime, endTime) { formatDate (startTime, endTime) {
const nowTime = new Date(); const nowTime = new Date();
...@@ -639,12 +759,20 @@ export default { ...@@ -639,12 +759,20 @@ export default {
const endTimeArray = endTime.split(":"); const endTimeArray = endTime.split(":");
const startHour = parseInt(startTimeArray[0]); const startHour = parseInt(startTimeArray[0]);
const startMinute = parseInt(startTimeArray[1]); const startMinute = parseInt(startTimeArray[1]);
const startSecond = parseInt(startTimeArray[2]);
const endHour = parseInt(endTimeArray[0]); const endHour = parseInt(endTimeArray[0]);
const endMinute = parseInt(endTimeArray[1]); const endMinute = parseInt(endTimeArray[1]);
const endSecond = parseInt(endTimeArray[2]);
return [ return [
new Date(nowYear, nowMonth, nowDate, startHour, startMinute), new Date(
new Date(nowYear, nowMonth, nowDate, endHour, endMinute) nowYear,
nowMonth,
nowDate,
startHour,
startMinute,
startSecond
),
new Date(nowYear, nowMonth, nowDate, endHour, endMinute, endSecond)
]; ];
}, },
...@@ -657,7 +785,7 @@ export default { ...@@ -657,7 +785,7 @@ export default {
async checkSameName () { async checkSameName () {
const res = await checkGoodsName({ const res = await checkGoodsName({
life_account_id: this.goodsObj.life_account_id, life_account_id: this.goodsObj.life_account_id,
name: this.goodsObj.goods_name, goods_name: this.goodsObj.goods_name,
goods_spu_id: this.goodsObj.goods_spu_id goods_spu_id: this.goodsObj.goods_spu_id
}); });
console.log(res); console.log(res);
...@@ -665,9 +793,14 @@ export default { ...@@ -665,9 +793,14 @@ export default {
this.$message.success("商品名称未被占用"); this.$message.success("商品名称未被占用");
}, },
// 商品详情图更改 // 商品详情图上传成功时
handleDetailChange (file, fileList) { handleDetailChange (res, file, fileList) {
console.log(fileList); console.log("返回结果", res);
console.log("文件", file);
console.log("文件列表", fileList);
const newFile = `${res.result.bucket}/${res.result.object_id}`;
this.detailUploadList.push(newFile);
console.log("上传成功了的一个小小的无所谓的bucket+objectid", this.detailUploadList);
}, },
// 商品详情图删除完成后的钩子 // 商品详情图删除完成后的钩子
...@@ -695,10 +828,6 @@ export default { ...@@ -695,10 +828,6 @@ export default {
deleteShops (shopId) { deleteShops (shopId) {
console.log(shopId); console.log(shopId);
}, },
// 更改已选门店
handleSelectionChange (value) {
console.log(value);
},
// 选择时间 // 选择时间
pickerTime (time) { pickerTime (time) {
...@@ -708,6 +837,20 @@ export default { ...@@ -708,6 +837,20 @@ export default {
console.log("时间节点", dateTime1, dateTime2); console.log("时间节点", dateTime1, dateTime2);
}, },
// 更改售价
salePrice (value) {
if (value.length === 0) value = 0;
this.goodsObj.price = parseFloat(value).toFixed(2);
console.log("售价", this.goodsObj.price);
},
// 更改原价
perPrice (value) {
if (value.length === 0) value = 0;
this.goodsObj.original_price = parseFloat(value).toFixed(2);
console.log("原价", this.goodsObj.original_price);
},
// 审核通过 // 审核通过
async onSuccess () { async onSuccess () {
const res = await postSuccess(this.$route.params.spuId); const res = await postSuccess(this.$route.params.spuId);
...@@ -718,14 +861,15 @@ export default { ...@@ -718,14 +861,15 @@ export default {
// 审核拒绝 // 审核拒绝
async onDefault () { async onDefault () {
if (!this.rejectReason.reason) return this.$message.error("审核驳回时,驳回原因不能为空"); if (!this.rejectReason.reason)
return this.$message.error("审核驳回时,驳回原因不能为空");
const query = { const query = {
goods_spu_id: this.goodsObj.goods_spu_id, goods_spu_id: this.goodsObj.goods_spu_id,
refuse_reason: this.rejectReason.reason rejected_reason: this.rejectReason.reason
}; };
const res = await auditReject(query); const res = await auditReject(query);
if (res.code !== 0) return this.$message.error(res.reason); if (res.code !== 0) return this.$message.error(res.reason);
this.$message.danger("审核驳回成功!"); this.$message.warning("审核驳回成功!");
this.$router.replace({ name: "GoodsList" }); this.$router.replace({ name: "GoodsList" });
}, },
......
.list { .goods {
margin-top: 30px; width: 100%;
} height: 100%;
.list .goods {
margin-top: 30px;
padding: 0 30px; padding: 0 30px;
} }
.list .goods .search_condition { .goods .search_condition {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
flex-wrap: wrap; flex-wrap: wrap;
align-items: center; align-items: center;
} }
.list .goods .search_condition .search_button { .goods .search_condition .search_button {
display: flex; display: flex;
align-items: center; align-items: center;
justify-self: flex-end; justify-self: flex-end;
} }
.list .goods .search_condition .search_button .el-form-item__content { .goods .search_condition .search_button .el-form-item__content {
display: flex; display: flex;
justify-content: space-around; justify-content: space-around;
} }
.list .goods .commodity_list { .goods .commodity_list {
margin-top: 30px; margin-top: 30px;
} }
.list .goods .pagination { .goods .pagination {
margin-top: 30px; margin-top: 30px;
} }
.list { .goods {
margin-top: 30px; width: 100%;
.goods { height: 100%;
margin-top: 30px; padding: 0 30px;
padding: 0 30px; .search_condition {
.search_condition { display: flex;
justify-content: space-between;
flex-wrap: wrap;
align-items: center;
.search_button {
display: flex; display: flex;
justify-content: space-between;
flex-wrap: wrap;
align-items: center; align-items: center;
.search_button { justify-self: flex-end;
.el-form-item__content {
display: flex; display: flex;
align-items: center; justify-content: space-around;
justify-self: flex-end;
.el-form-item__content {
display: flex;
justify-content: space-around;
}
} }
} }
.commodity_list { }
margin-top: 30px; .commodity_list {
} margin-top: 30px;
.pagination { }
margin-top: 30px; .pagination {
} margin-top: 30px;
} }
} }
<template> <template>
<div class="list"> <el-card class="goods">
<el-card class="goods"> <!-- 筛选区 -->
<!-- 筛选区 --> <el-form
<el-form inline
inline class="search_condition"
class="search_condition" >
> <!-- 商品id -->
<!-- 商品id --> <el-form-item label="商品id">
<el-form-item label="商品id"> <el-input v-model="searchProps.goods_spu_id"></el-input>
<el-input v-model="searchProps.goods_spu_id"></el-input> </el-form-item>
</el-form-item> <!-- 商品名称 -->
<!-- 商品名称 --> <el-form-item label="商品名称">
<el-form-item label="商品名称"> <el-input v-model="searchProps.goods_name"></el-input>
<el-input v-model="searchProps.goods_name"></el-input> </el-form-item>
</el-form-item> <!-- 所属分类 -->
<!-- 所属分类 --> <el-form-item label="所属分类">
<el-form-item label="所属分类"> <el-cascader
<el-cascader @change="handleTypeChange"
@change="handleTypeChange" :options="labelOptions"
:options="labelOptions" :props="cascaderProps"
:props="cascaderProps" collapse-tags
collapse-tags clearable
clearable ></el-cascader>
></el-cascader> </el-form-item>
</el-form-item> <!-- 生活号ID -->
<!-- 生活号ID --> <el-form-item label="生活号id">
<el-form-item label="生活号id"> <el-input v-model="searchProps.life_account_id"></el-input>
<el-input v-model="searchProps.life_account_id"></el-input> </el-form-item>
</el-form-item> <!-- 生活号名称 -->
<!-- 生活号名称 --> <el-form-item label="生活号名称">
<el-form-item label="生活号名称"> <el-input v-model="searchProps.life_account_name"></el-input>
<el-input v-model="searchProps.life_account_name"></el-input> </el-form-item>
</el-form-item> <!-- 商品状态 -->
<!-- 商品状态 --> <el-form-item label="商品状态">
<el-form-item label="商品状态"> <el-select
<el-select v-model="audit_status"
v-model="audit_status" multiple
multiple collapse-tags
collapse-tags @change="handleStatusChange"
@change="handleStatusChange"
>
<el-option
v-for="item in stateOption"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="上架状态">
<el-select
v-model="onlineStatus"
multiple
collapse-tags
@change="handleOnlineStatusChange"
>
<el-option
v-for="item in onlineStateOptions"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
<!-- 按钮操作 -->
<el-form-item style="justify-self: flex-end;">
<el-button
@click="searchList"
type="primary"
>搜索</el-button>
<el-button @click="resetList">重置</el-button>
</el-form-item>
</el-form>
<!-- 列表区 -->
<el-table
class="goods_list"
:data="goodsList"
border
stripe
>
<el-table-column
label="商品id"
prop="goods_spu_id"
align="center"
></el-table-column>
<el-table-column
label="商品名称"
prop="goods_name"
align="center"
></el-table-column>
<el-table-column
label="一级分类"
prop="category_1_name"
align="center"
></el-table-column>
<el-table-column
label="二级分类"
prop="category_2_name"
align="center"
></el-table-column>
<el-table-column
label="生活号id"
prop="life_account_id"
align="center"
></el-table-column>
<el-table-column
label="生活号名称"
prop="life_account_name"
align="center"
></el-table-column>
<el-table-column
label="发布者"
prop="publish_user_id"
align="center"
></el-table-column>
<el-table-column
label="状态"
align="center"
> >
<template #default="scope"> <el-option
<span v-for="item in stateOption"
v-if="scope.row.audit_status == 0" :key="item.value"
style="color:#FF982C;" :label="item.label"
>待审核</span> :value="item.value"
<span ></el-option>
v-if="scope.row.audit_status == 1" </el-select>
style="color:#5CC247;" </el-form-item>
>审核通过</span> <el-form-item label="上架状态">
<span <el-select
v-if="scope.row.audit_status == 2" v-model="onlineStatus"
style="color:#FD6B6F;" multiple
>审核驳回</span> collapse-tags
&nbsp;&nbsp;&nbsp; @change="handleOnlineStatusChange"
<span
v-if="scope.row.online_status == 0"
style="color:#FF982C;"
>未上架</span>
<span
v-if="scope.row.online_status == 1"
style="color:#5CC247;"
>已上架</span>
<span
v-if="scope.row.online_status == 2"
style="color:#FD6B6F;"
>已下架</span>
</template>
</el-table-column>
<el-table-column
label="状态更新时间"
prop="update_time"
align="center"
></el-table-column>
<el-table-column
label="商品创建时间"
prop="create_time"
align="center"
></el-table-column>
<!-- 操作快捷键 -->
<el-table-column
label="操作"
align="center"
fixed="right"
width="200"
> >
<template #default="scope"> <el-option
<el-button v-for="item in onlineStateOptions"
type="text" :key="item.value"
@click="goDetail(`EDIT`,scope.row.goods_spu_id)" :label="item.label"
>编辑</el-button> :value="item.value"
></el-option>
</el-select>
</el-form-item>
<!-- 按钮操作 -->
<el-form-item style="justify-self: flex-end;">
<el-button
@click="searchList"
type="primary"
>搜索</el-button>
<el-button @click="resetList">重置</el-button>
</el-form-item>
</el-form>
<!-- 列表区 -->
<el-table
class="goods_list"
:data="goodsList"
border
stripe
>
<el-table-column
label="商品id"
prop="goods_spu_id"
align="center"
></el-table-column>
<el-table-column
label="商品名称"
prop="goods_name"
align="center"
></el-table-column>
<el-table-column
label="一级分类"
prop="category_1_name"
align="center"
></el-table-column>
<el-table-column
label="二级分类"
prop="category_2_name"
align="center"
></el-table-column>
<el-table-column
label="生活号id"
prop="life_account_id"
align="center"
></el-table-column>
<el-table-column
label="生活号名称"
prop="life_account_name"
align="center"
></el-table-column>
<el-table-column
label="发布者"
prop="publish_user_id"
align="center"
></el-table-column>
<el-table-column
label="状态"
align="center"
>
<template #default="scope">
<span
v-if="scope.row.audit_status == 0"
style="color:#FF982C;"
>待审核</span>
<span
v-if="scope.row.audit_status == 1"
style="color:#5CC247;"
>审核通过</span>
<span
v-if="scope.row.audit_status == 2"
style="color:#FD6B6F;"
>审核驳回</span>
&nbsp;&nbsp;&nbsp;
<span
v-if="scope.row.online_status == 0"
style="color:#FF982C;"
>未上架</span>
<span
v-if="scope.row.online_status == 1"
style="color:#5CC247;"
>已上架</span>
<span
v-if="scope.row.online_status == 2"
style="color:#FD6B6F;"
>已下架</span>
</template>
</el-table-column>
<el-table-column
label="状态更新时间"
prop="update_time"
align="center"
></el-table-column>
<el-table-column
label="商品创建时间"
prop="create_time"
align="center"
></el-table-column>
<!-- 操作快捷键 -->
<el-table-column
label="操作"
align="center"
fixed="right"
width="200"
>
<template #default="scope">
<el-button
type="text"
@click="goDetail(`EDIT`,scope.row.goods_spu_id)"
>编辑</el-button>
<el-button <el-button
v-if="scope.row.audit_status == 0" v-if="scope.row.audit_status == 0"
type="text" type="text"
@click="goDetail(`AUDIT`,scope.row.goods_spu_id)" @click="goDetail(`AUDIT`,scope.row.goods_spu_id)"
>审核</el-button> >审核</el-button>
<!-- v-if="scope.row.audit_status == 1 && scope.row.online_status == 2 || scope.row.audit_status == 1 && scope.row.online_status == 0" --> <!-- v-if="scope.row.audit_status == 1 && scope.row.online_status == 2 || scope.row.audit_status == 1 && scope.row.online_status == 0" -->
<el-popconfirm <el-popconfirm
title="您确定要上架该商品吗?" title="您确定要上架该商品吗?"
cancelButtonType="default" cancelButtonType="default"
@confirm="changeGoodsState('GROUNDING', scope.row.goods_spu_id)" @confirm="changeGoodsState('GROUNDING', scope.row.goods_spu_id)"
> >
<template #reference> <template #reference>
<el-button type="text">上架</el-button> <el-button type="text">上架</el-button>
</template> </template>
</el-popconfirm> </el-popconfirm>
<!-- v-if="scope.row.online_status == 1" --> <!-- v-if="scope.row.online_status == 1" -->
<el-popconfirm <el-popconfirm
title="您确定要下架该商品吗?" title="您确定要下架该商品吗?"
cancelButtonType="default" cancelButtonType="default"
@confirm=" @confirm="
changeGoodsState('UNDERCARRIAGE', scope.row.goods_spu_id) changeGoodsState('UNDERCARRIAGE', scope.row.goods_spu_id)
" "
> >
<template #reference> <template #reference>
<el-button type="text">下架</el-button> <el-button type="text">下架</el-button>
</template> </template>
</el-popconfirm> </el-popconfirm>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<!-- 页码区 --> <!-- 页码区 -->
<el-pagination <el-pagination
class="pagination" class="pagination"
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
v-model:currentPage="searchProps.page" v-model:currentPage="searchProps.page"
:page-size="searchProps.page_size" :page-size="searchProps.page_size"
layout="total,prev, pager, next, jumper" layout="total,prev, pager, next, jumper"
:total="totalCount" :total="totalCount"
> >
</el-pagination> </el-pagination>
</el-card> </el-card>
</div>
</template> </template>
<style lang="less" src="./index.less" scope></style> <style lang="less" src="./index.less" scope></style>
......
...@@ -53,3 +53,8 @@ export async function checkGoodsName (params) { ...@@ -53,3 +53,8 @@ export async function checkGoodsName (params) {
); );
return res; return res;
} }
// 获取门店表单
export async function getShopsList (params) {
const res = await axios.get("api/v1/shop/background/shop_list", { params });
return res;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment