Commit 14324871 authored by liwenhong's avatar liwenhong

add:商品上架时间

parent b4b18033
...@@ -56,6 +56,17 @@ exports.putOffline = async ctx => { ...@@ -56,6 +56,17 @@ exports.putOffline = async ctx => {
}; };
ctx.body = await req(ctx, opts); ctx.body = await req(ctx, opts);
}; };
// 设置商品上架
exports.putOnlineSite = async ctx => {
const url = `${GOODS_URI}/goods/background/online_site`;
const opts = {
url,
method: "POST",
json: true,
body: ctx.request.body
};
ctx.body = await req(ctx, opts);
};
// 获取商品详情列表 // 获取商品详情列表
exports.getGoodsInfo = async ctx => { exports.getGoodsInfo = async ctx => {
const url = `${GOODS_URI}/goods/background/get_goods_info`; const url = `${GOODS_URI}/goods/background/get_goods_info`;
......
...@@ -48,6 +48,7 @@ router.get(`${API_VERSION}/get_goods_category_list`, goods.getCategoryList); ...@@ -48,6 +48,7 @@ router.get(`${API_VERSION}/get_goods_category_list`, goods.getCategoryList);
router.get(`${API_VERSION}/goods/background/get_goods_list`, goods.getList); router.get(`${API_VERSION}/goods/background/get_goods_list`, goods.getList);
router.post(`${API_VERSION}/goods/background/online`, goods.putOnline); router.post(`${API_VERSION}/goods/background/online`, goods.putOnline);
router.post(`${API_VERSION}/goods/background/offline`, goods.putOffline); router.post(`${API_VERSION}/goods/background/offline`, goods.putOffline);
router.post(`${API_VERSION}/goods/background/putOnlineSite`, goods.putOnlineSite);
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);
......
...@@ -17,6 +17,9 @@ ...@@ -17,6 +17,9 @@
} }
} }
} }
.pick-time {
margin-left: 10px;
}
.commodity_list { .commodity_list {
margin-top: 30px; margin-top: 30px;
} }
......
...@@ -146,7 +146,7 @@ ...@@ -146,7 +146,7 @@
></el-table-column> ></el-table-column>
<el-table-column <el-table-column
label="上架时间" label="上架时间"
prop="create_time" prop="online_start_time"
align="center" align="center"
></el-table-column> ></el-table-column>
<!-- 操作快捷键 --> <!-- 操作快捷键 -->
...@@ -199,37 +199,40 @@ ...@@ -199,37 +199,40 @@
> >
<el-button <el-button
type="text" type="text"
@click="checkedAddTime.showAddTime = true" @click="handleGoodOnline(scope.row.goods_spu_id)"
>上架配置</el-button >上架配置</el-button
> >
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-dialog title="上架时间配置" width="50%" top="10%" v-model="checkedAddTime.showAddTime"> <el-dialog title="上架时间配置" width="50%" top="10%" center v-model="showGoodsAddTime">
<el-form-item label="上架时间:"> <el-form-item>
<el-radio-group v-model="checkedAddTime.addType"> 上架时间:
<el-radio-group v-model="checkedAddTime.online_type">
<el-radio :label="1">立即上架</el-radio> <el-radio :label="1">立即上架</el-radio>
<el-radio :label="2"> <el-radio :label="2">
定点上架 定点上架
<!-- <el-input v-model="checkedAddTime.addTime"></el-input> --> <span class="pick-time">
<el-date-picker <el-date-picker
v-model="checkedAddTime.addTime" v-model="addTimeRange"
type="datetimerange" type="datetimerange"
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" end-placeholder="结束日期"
format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD HH:mm:ss"
value-format="YYYY-MM-DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss"
@change="pickerStartTime" @change="pickerStartTime"
> :disabled="checkedAddTime.online_type!=2"
</el-date-picker> >
</el-date-picker>
</span>
</el-radio> </el-radio>
<el-radio :label="3">暂不上架</el-radio> <el-radio :label="3">暂不上架</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<template #footer> <template #footer>
<span> <span>
<el-button @click="handleConfirmRefund">确认</el-button> <el-button type="primary" @click="handleConfirmRefund">确认</el-button>
<el-button type="primary" @click="goodsAddTime = false">返回</el-button> <el-button @click="showGoodsAddTime = false">返回</el-button>
</span> </span>
</template> </template>
</el-dialog> </el-dialog>
...@@ -254,7 +257,8 @@ import { ...@@ -254,7 +257,8 @@ import {
getGoodsList, getGoodsList,
getList, getList,
putOnline, putOnline,
putOffline putOffline,
putOnlineSite
} from "@/service/Goods/goods"; } from "@/service/Goods/goods";
import Layout from "../layout/index.vue"; import Layout from "../layout/index.vue";
export default { export default {
...@@ -319,10 +323,13 @@ export default { ...@@ -319,10 +323,13 @@ export default {
goodsList: [], goodsList: [],
totalCount: 0, // 总条数 totalCount: 0, // 总条数
showGoodsAddTime: false, //商品添加弹窗
addTimeRange: [],
checkedAddTime: { checkedAddTime: {
showAddTime: false, online_start_time: '',
addType: 1, online_end_time: '',
addTime: '', online_type: 1,
goods_spu_id: ''
} }
}; };
}, },
...@@ -428,6 +435,25 @@ export default { ...@@ -428,6 +435,25 @@ export default {
goDetail(operation, spuId) { goDetail(operation, spuId) {
console.log(spuId); console.log(spuId);
this.$router.push({ name: "GoodsDetail", params: { operation, spuId } }); this.$router.push({ name: "GoodsDetail", params: { operation, spuId } });
},
handleGoodOnline(id) {
this.showGoodsAddTime = true;
this.checkedAddTime.goods_spu_id = id;
},
async handleConfirmRefund() {
this.checkedAddTime.online_start_time = this.addTimeRange[0];
this.checkedAddTime.online_end_time = this.addTimeRange[1];
let res = await putOnlineSite(this.checkedAddTime);
if (res.code !== 0) return this.$message.error(res.reason);
this.showGoodsAddTime = false;
this.addTimeRange = [];
this.checkedAddTime = {
online_start_time: '',
online_end_time: '',
online_type: 1,
goods_spu_id: ''
}
return this.$message.success('操作成功');
} }
} }
}; };
......
...@@ -26,6 +26,11 @@ export async function putOffline (query) { ...@@ -26,6 +26,11 @@ export async function putOffline (query) {
}); });
return res; return res;
} }
// 设置商品上架
export async function putOnlineSite (params) {
const res = await axios.post("/api/v1/goods/background/putOnlineSite", params);
return res;
}
// 获取商品详情列表 // 获取商品详情列表
export async function getGoodsInfo (params) { export async function getGoodsInfo (params) {
const res = await axios.get("/api/v1/goods/background/get_goods_info", { const res = await axios.get("/api/v1/goods/background/get_goods_info", {
......
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