Commit 14324871 authored by liwenhong's avatar liwenhong

add:商品上架时间

parent b4b18033
......@@ -56,6 +56,17 @@ exports.putOffline = async ctx => {
};
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 => {
const url = `${GOODS_URI}/goods/background/get_goods_info`;
......
......@@ -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.post(`${API_VERSION}/goods/background/online`, goods.putOnline);
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.post(`${API_VERSION}/goods/background/audit_pass`, goods.postSuccess);
router.post(`${API_VERSION}/goods/background/check_goods_name`, goods.checkGoodsName);
......
......@@ -17,6 +17,9 @@
}
}
}
.pick-time {
margin-left: 10px;
}
.commodity_list {
margin-top: 30px;
}
......
......@@ -146,7 +146,7 @@
></el-table-column>
<el-table-column
label="上架时间"
prop="create_time"
prop="online_start_time"
align="center"
></el-table-column>
<!-- 操作快捷键 -->
......@@ -199,37 +199,40 @@
>
<el-button
type="text"
@click="checkedAddTime.showAddTime = true"
@click="handleGoodOnline(scope.row.goods_spu_id)"
>上架配置</el-button
>
</template>
</el-table-column>
</el-table>
<el-dialog title="上架时间配置" width="50%" top="10%" v-model="checkedAddTime.showAddTime">
<el-form-item label="上架时间:">
<el-radio-group v-model="checkedAddTime.addType">
<el-dialog title="上架时间配置" width="50%" top="10%" center v-model="showGoodsAddTime">
<el-form-item>
上架时间:
<el-radio-group v-model="checkedAddTime.online_type">
<el-radio :label="1">立即上架</el-radio>
<el-radio :label="2">
定点上架
<!-- <el-input v-model="checkedAddTime.addTime"></el-input> -->
<span class="pick-time">
<el-date-picker
v-model="checkedAddTime.addTime"
type="datetimerange"
start-placeholder="开始日期"
end-placeholder="结束日期"
format="YYYY-MM-DD HH:mm:ss"
value-format="YYYY-MM-DD HH:mm:ss"
@change="pickerStartTime"
>
</el-date-picker>
v-model="addTimeRange"
type="datetimerange"
start-placeholder="开始日期"
end-placeholder="结束日期"
format="YYYY-MM-DD HH:mm:ss"
value-format="YYYY-MM-DD HH:mm:ss"
@change="pickerStartTime"
:disabled="checkedAddTime.online_type!=2"
>
</el-date-picker>
</span>
</el-radio>
<el-radio :label="3">暂不上架</el-radio>
</el-radio-group>
</el-form-item>
<template #footer>
<span>
<el-button @click="handleConfirmRefund">确认</el-button>
<el-button type="primary" @click="goodsAddTime = false">返回</el-button>
<el-button type="primary" @click="handleConfirmRefund">确认</el-button>
<el-button @click="showGoodsAddTime = false">返回</el-button>
</span>
</template>
</el-dialog>
......@@ -254,7 +257,8 @@ import {
getGoodsList,
getList,
putOnline,
putOffline
putOffline,
putOnlineSite
} from "@/service/Goods/goods";
import Layout from "../layout/index.vue";
export default {
......@@ -319,10 +323,13 @@ export default {
goodsList: [],
totalCount: 0, // 总条数
showGoodsAddTime: false, //商品添加弹窗
addTimeRange: [],
checkedAddTime: {
showAddTime: false,
addType: 1,
addTime: '',
online_start_time: '',
online_end_time: '',
online_type: 1,
goods_spu_id: ''
}
};
},
......@@ -428,6 +435,25 @@ export default {
goDetail(operation, spuId) {
console.log(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) {
});
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) {
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