Commit f68b9f3a authored by liwenhong's avatar liwenhong

Merge branch 'feature/merchant-managemet'

parents 7fa45289 fdd89408
......@@ -9,6 +9,7 @@
"prod": "sh ./bin/start.sh production",
"koa": "nodemon app.js",
"web-dev": "cross-env NODE_ENV=development vue-cli-service serve",
"web-dev-test": "cross-env NODE_ENV=test vue-cli-service serve",
"web-test": "cross-env NODE_ENV=test vue-cli-service build",
"web-build": "cross-env NODE_ENV=production vue-cli-service build",
"web-build-report": "cross-env NODE_ENV=production vue-cli-service build --report",
......
......@@ -11,8 +11,8 @@ const PANDORA_URI = {
};
const API_INTERNAL_URI = {
test: "http://bp-dev.ini.yidian-inc.com",
development: "http://bp-test.ini.yidian-inc.com",
test: "http://bp-test.ini.yidian-inc.com",
development: "http://bp-dev.ini.yidian-inc.com",
production: "http://bp.int.yidian-inc.com",
preprod: "http://bp.pre.int.yidian-inc.com",
};
......
......@@ -233,6 +233,67 @@ exports.colonelAudit = async (ctx) => {
ctx.body = res;
};
// 商家列表
exports.otaList = async (ctx) => {
const url = `${GOODS_URI}/goods/background/ota_list`;
const opts = {
url,
method: "POST",
json: true,
body: ctx.request.body,
};
const res = await req(ctx, opts);
ctx.body = res;
};
// 商家列表-add
exports.addOta = async (ctx) => {
const url = `${GOODS_URI}/goods/background/add_ota`;
const opts = {
url,
method: "POST",
json: true,
body: ctx.request.body,
};
const res = await req(ctx, opts);
ctx.body = res;
};
// 商家列表-禁用
exports.deleteOta = async (ctx) => {
const url = `${GOODS_URI}/goods/background/delete_ota`;
const opts = {
url,
method: "POST",
json: true,
body: ctx.request.body,
};
const res = await req(ctx, opts);
ctx.body = res;
};
// 商家列表-修改
exports.updateOta = async (ctx) => {
const url = `${GOODS_URI}/goods/background/update_ota`;
const opts = {
url,
method: "POST",
json: true,
body: ctx.request.body,
};
const res = await req(ctx, opts);
ctx.body = res;
};
//商家列表-取消禁用
exports.undeleteOta = async (ctx) => {
const url = `${GOODS_URI}/goods/background/undelete_ota`;
const opts = {
url,
method: "POST",
json: true,
body: ctx.request.body,
};
const res = await req(ctx, opts);
ctx.body = res;
};
//团长获取自提点信息
exports.colonelApplyPoint = async (ctx) => {
const url = `${GOODS_URI}/marketing/background/colonel_show_apply_point`;
......
......@@ -66,6 +66,12 @@ router.post(`${API_VERSION}/get_addmarketing_list`, goods.getAddMarketingList);
router.post(`${API_VERSION}/get_find_goods_list`, goods.getFindGoodsList);
router.post(`${API_VERSION}/get_marketing_info`, goods.getMarketingInfo);
router.post(`${API_VERSION}/update_marketing_list`, goods.updateMarketingList);
router.post(`${API_VERSION}/otaList`, goods.otaList);
//商家管理
router.post(`${API_VERSION}/addOta`, goods.addOta);
router.post(`${API_VERSION}/deleteOta`, goods.deleteOta);
router.post(`${API_VERSION}/updateOta`, goods.updateOta);
router.post(`${API_VERSION}/undeleteOta`, goods.undeleteOta);
router.post(`${API_VERSION}/coloneList`, goods.coloneList);
router.post(`${API_VERSION}/coloneApplyList`, goods.coloneApplyList);
router.post(`${API_VERSION}/colonelAudit`, goods.colonelAudit);
......
......@@ -331,7 +331,7 @@
// 获取商家
async getBusinessListMet() {
let params = { ota_name: "", offset: "", limit: "" };
let params = { ota_name: "", offset: "", limit: "", is_normal: 1 };
try {
const res = await getBusinessList(params);
this.businessOpt = [{ ota_id: "", ota_name: "全部" }, ...res.result.list];
......
......@@ -15,6 +15,10 @@ const headerConfig = [
path: "/op/groupmeal/distrib",
name: "配送员管理",
},
{
path: "/op/groupmeal/merchantManagement",
name: "商家管理",
},
{
path: "/op/groupmeal/marketing",
name: "营销中心",
......
.goods {
width: 100%;
height: 100%;
padding: 0 30px;
.header {
display: flex;
justify-content: flex-end;
margin-bottom: 30px;
}
.dioFor {
margin-left: 5%;
width: 70%;
}
.locationstyle {
display: flex;
}
.location {
margin-bottom: 10px;
// margin-left: 10%;
}
.diotab {
margin-left: 5%;
margin-top: 10px;
}
.dialog-footer {
display: flex;
align-items: center;
justify-content: center;
}
.commodity_list {
margin-top: 30px;
}
.pagination {
margin-top: 30px;
}
/deep/ .mapDialog {
margin-top: 10vh !important;
height: 80%;
display: flex !important;
flex-direction: column !important;
/deep/ .el-dialog__body {
height: 90%;
}
}
}
<template>
<Layout>
<el-card class="goods" v-loading="pageLoading">
<div class="header">
<el-button type="primary" @click="modifyMerchant">添加商家</el-button>
</div>
<el-table :data="merchantList" border stripe fit style="width: 100%">
<el-table-column align="center" prop="ota_name" label="商家"></el-table-column>
<el-table-column align="center" prop="printer_sn" label="打印机SN"></el-table-column>
<el-table-column align="center" prop="printer_key" label="打印机KEY"></el-table-column>
<el-table-column align="center" prop="label_printer_sn" label="标签机SN"></el-table-column>
<el-table-column align="center" prop="label_printer_key" label="标签机KEY"></el-table-column>
<el-table-column align="center" prop="state" label="状态">
<template #default="scope">{{ ["正常", "已禁用"][scope.row.status] }}</template>
</el-table-column>
<el-table-column align="center" prop="operation" label="操作">
<template #default="scope">
<el-button type="text" :disabled="scope.row.status == 1" @click="modifyMerchant(scope.row.ota_id, scope.$index)">
修改
</el-button>
<el-button type="text" @click="handleDisable(scope.row)">
{{ scope.row.status == 1 ? "启用" : "禁用" }}
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 添加商家弹窗 -->
<el-dialog title="商家编辑" v-model="merchantAdd" :before-close="resetDate" width="70%" :show-close="false">
<el-form class="dioFor" :model="addMerchant" :rules="rules">
<el-form-item label="商家名称" label-width="100px" prop="ota_name">
<el-input maxlength="30" show-word-limit clearable autocomplete="off" v-model="addMerchant.ota_name"></el-input>
</el-form-item>
<el-form-item label="打印机SN" label-width="100px" prop="printer_sn">
<el-input type="text" show-word-limit clearable autocomplete="off" v-model="addMerchant.printer_sn"></el-input>
</el-form-item>
<el-form-item label="打印机KEY" label-width="100px" prop="printer_key">
<el-input type="text" show-word-limit clearable autocomplete="off" v-model="addMerchant.printer_key"></el-input>
</el-form-item>
<el-form-item label="标签机SN" label-width="100px" prop="label_printer_sn">
<el-input type="text" show-word-limit clearable autocomplete="off" v-model="addMerchant.label_printer_sn"></el-input>
</el-form-item>
<el-form-item label="标签机KEY" label-width="100px" prop="label_printer_key">
<el-input type="text" show-word-limit clearable autocomplete="off" v-model="addMerchant.label_printer_key"></el-input>
</el-form-item>
<el-form-item label="位置" label-width="100px" prop="location">
<div class="locationstyle">
<el-input
type="text"
show-word-limit
clearable
autocomplete="off"
v-model="addMerchant.location"
:disabled="true"
></el-input>
<el-button type="text" @click="mapDialogVisible = true">从高德获取坐标</el-button>
</div>
<p class="location">{{ addMerchant.location }}</p>
</el-form-item>
<el-form-item label="详细地址" label-width="100px" prop="address">
<el-input type="text" show-word-limit clearable autocomplete="off" v-model="addMerchant.address"></el-input>
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="addCancel">取 消</el-button>
<el-button type="primary" @click="saveMerchant">保 存</el-button>
</span>
</template>
</el-dialog>
<!-- 地图 dialog -->
<el-dialog custom-class="mapDialog" v-model="mapDialogVisible" width="100%">
<my-map class="my-map" @getMapInfo="getMapInfo" @hideMapDialog="mapDialogVisible = false" />
</el-dialog>
</el-card>
</Layout>
</template>
<script>
import Layout from "../layout/index.vue";
import myMap from "@/pages/Activity/releaseProduc/components/myMap";
import { otaList, addOta, deleteOta, updateOta, undeleteOta } from "@/service/Goods/goods";
export default {
name: "merchantManagement",
components: {
Layout,
myMap,
},
created() {
this.getOtaList();
},
data() {
return {
mapDialogVisible: false,
rules: {
name: [{ required: true, message: "请输入商家名称", trigger: "blur" }],
},
//弹窗初始:关闭
merchantAdd: false,
addMerchant: {
ota_name: "",
printer_sn: "",
printer_key: "",
label_printer_sn: "",
label_printer_key: "",
location: "",
address: "",
},
// 列表
merchantList: [],
deep: true,
};
},
methods: {
modifyMerchant(id, index) {
if (typeof id == "number") {
this.addMerchant = JSON.parse(JSON.stringify(this.merchantList[index]));
}
//点击“添加商家”按钮,弹窗打开
this.merchantAdd = true;
},
async getOtaList() {
const { result, code, reason } = await otaList();
if (code !== 0) return this.$message.error(reason);
this.merchantList = result.list;
},
//保存
async saveMerchant() {
let { result, code, reason } = this.addMerchant.ota_id ? await updateOta(this.addMerchant) : await addOta(this.addMerchant);
if (code !== 0) return this.$message.error(reason);
await this.getOtaList();
//点击保存时,弹窗关闭
this.resetDate();
},
// 取消
addCancel() {
//点击取消时,弹窗关闭
this.resetDate();
},
resetDate() {
this.addMerchant = {};
this.merchantAdd = false;
},
//禁用
async handleDisable(item) {
let res = item.status == 0 ? await deleteOta({ ota_id: item.ota_id }) : await undeleteOta({ ota_id: item.ota_id });
if (res.code !== 0) return this.$message.error(res.reason);
this.getOtaList();
},
// 获取地图信息
getMapInfo(mapInfo) {
console.log(mapInfo);
this.addMerchant.location = mapInfo.address;
this.addMerchant.longitude = mapInfo.lng; // longitude latitude contactor
this.addMerchant.latitude = mapInfo.lat;
},
},
};
</script>
<style lang="less" src="./index.less" scope></style>
......@@ -19,6 +19,11 @@ const groupmealRouters = [
name: "Distrib",
component: () => import(/* webpackChunkName: "goods" */ "@/pages/Groupmeal/Distrib"),
},
{
path: "/op/groupmeal/merchantManagement",
name: "merchantManagement",
component: () => import(/* webpackChunkName: "goods" */ "@/pages/Groupmeal/merchantManagement"),
},
{
path: "/op/groupmeal/marketing",
name: "MarketingCenter",
......
......@@ -97,6 +97,33 @@ export async function updateMarketingList(params) {
return res;
}
// 商家列表
export async function otaList(params) {
const res = await axios.post("/api/v1/otaList", params);
return res;
}
// 商家列表-add
export async function addOta(params) {
const res = await axios.post("/api/v1/addOta", params);
return res;
}
// 商家列表-禁用
export async function deleteOta(params) {
const res = await axios.post("/api/v1/deleteOta", params);
return res;
}
// 商家列表-修改
export async function updateOta(params) {
const res = await axios.post("/api/v1/updateOta", params);
return res;
}
// 商家列表-取消禁用
export async function undeleteOta(params) {
const res = await axios.post("/api/v1/undeleteOta", params);
return res;
}
// 团长列表
export async function ColoneList(params) {
const res = await axios.post("/api/v1/coloneList", params);
......
......@@ -29,7 +29,7 @@ const CDN = {
module.exports = {
outputDir: isDev ? "./dist" : path.resolve("./public/dist/"),
publicPath: isDev ? "/" : "/dist",
lintOnSave: isDev,
lintOnSave: false,
productionSourceMap: false, // 去掉生成环境的 sourceMap
devServer: {
proxy: "http://127.0.0.1:8055", //http://localhost:8055
......
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