parent
24fbcb6826
commit
96b7cb11ec
@ -1,5 +1,7 @@
|
|||||||
VITE_APP_BASE_URL = 'http://localhost:8080/'
|
VITE_APP_BASE_URL = 'http://localhost:8080/'
|
||||||
|
|
||||||
|
VITE_APP_BACKEND_URL = 'http://localhost:8080/adm/'
|
||||||
|
|
||||||
VITE_APP_IMG_URL = 'http://localhost:8080/'
|
VITE_APP_IMG_URL = 'http://localhost:8080/'
|
||||||
|
|
||||||
VITE_APP_API_URL = 'http://localhost:8080/adminapi/v1'
|
VITE_APP_API_URL = 'http://localhost:8080/adminapi/v1'
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
VITE_APP_BASE_URL = 'http://localhost:8080/'
|
VITE_APP_BASE_URL = 'http://localhost:8080/'
|
||||||
|
|
||||||
|
VITE_APP_BACKEND_URL = 'http://localhost:8080/adm/'
|
||||||
|
|
||||||
VITE_APP_IMG_URL = 'http://localhost:8080/'
|
VITE_APP_IMG_URL = 'http://localhost:8080/'
|
||||||
|
|
||||||
VITE_APP_API_URL = 'http://localhost:8080/adminapi/v1'
|
VITE_APP_API_URL = 'http://localhost:8080/adminapi/v1'
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
VITE_APP_BASE_URL = 'https://shop.h888.fun/'
|
VITE_APP_BASE_URL = 'https://shop.h888.fun/'
|
||||||
|
|
||||||
|
VITE_APP_BACKEND_URL = 'https://shop.h888.fun/adm/'
|
||||||
|
|
||||||
VITE_APP_IMG_URL = 'https://shop.h888.fun/'
|
VITE_APP_IMG_URL = 'https://shop.h888.fun/'
|
||||||
|
|
||||||
VITE_APP_API_URL = 'https://shop.h888.fun/adminapi/v1'
|
VITE_APP_API_URL = 'https://shop.h888.fun/adminapi/v1'
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
VITE_APP_BASE_URL = 'https://shop.slash1000.com/'
|
VITE_APP_BASE_URL = 'https://shop.slash1000.com/'
|
||||||
|
|
||||||
|
VITE_APP_BACKEND_URL = 'https://shop.slash1000.com/adm/'
|
||||||
|
|
||||||
VITE_APP_IMG_URL = 'https://shop.slash1000.com/'
|
VITE_APP_IMG_URL = 'https://shop.slash1000.com/'
|
||||||
|
|
||||||
VITE_APP_API_URL = 'https://shop.slash1000.com/adminapi/v1'
|
VITE_APP_API_URL = 'https://shop.slash1000.com/adminapi/v1'
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
VITE_APP_BASE_URL = 'https://shop.slash1000.com/'
|
VITE_APP_BASE_URL = 'https://shop.slash1000.com/'
|
||||||
|
|
||||||
|
VITE_APP_BACKEND_URL = 'https://shop.slash1000.com/adm/'
|
||||||
|
|
||||||
VITE_APP_IMG_URL = 'https://shop.slash1000.com/'
|
VITE_APP_IMG_URL = 'https://shop.slash1000.com/'
|
||||||
|
|
||||||
VITE_APP_API_URL = 'https://shop.slash1000.com/adminapi/v1'
|
VITE_APP_API_URL = 'https://shop.slash1000.com/adminapi/v1'
|
||||||
|
|||||||
@ -0,0 +1,19 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh-TW">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<title>{$lang.cp_home}{if $ur_here} - {$ur_here}{/if}</title>
|
||||||
|
<!-- Google Font: Source Sans Pro -->
|
||||||
|
<link
|
||||||
|
rel="stylesheet"
|
||||||
|
href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback"
|
||||||
|
/>
|
||||||
|
<link href="https://dev.iconly.io/public/x2OLQFwf8Nev/iconly.css" rel="stylesheet"/>
|
||||||
|
</head>
|
||||||
|
<body class="hold-transition login-page">
|
||||||
|
<!-- /.login-box -->
|
||||||
|
<div id="app"></div>
|
||||||
|
<script type="module" src="/src/pages/goods/category/main.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@ -0,0 +1,146 @@
|
|||||||
|
<template>
|
||||||
|
<el-drawer
|
||||||
|
v-model="drawer"
|
||||||
|
:destroy-on-close="true"
|
||||||
|
:direction="direction"
|
||||||
|
size="50%"
|
||||||
|
@close="handleClose"
|
||||||
|
>
|
||||||
|
<template #header>
|
||||||
|
<h4>編輯物流方式</h4>
|
||||||
|
</template>
|
||||||
|
<template #default>
|
||||||
|
<div v-loading="loading">
|
||||||
|
<el-form :model="form" label-width="120px">
|
||||||
|
<el-form-item label="物流方式代碼">
|
||||||
|
{{ form.shipping_code }}
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="環境設置">
|
||||||
|
<el-radio-group v-model="form.is_test" class="ml-4">
|
||||||
|
<el-radio :label="0" size="large">測試環境</el-radio>
|
||||||
|
<el-radio :label="1" size="large">正式環境</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="物流方式名稱">
|
||||||
|
<el-input v-model="form.shipping_name" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="物流方式描述">
|
||||||
|
<el-input v-model="form.shipping_desc" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="運費">
|
||||||
|
<el-input v-model="form.shipping_fee" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="貨到付款">
|
||||||
|
<el-radio-group v-model="form.support_cod" class="ml-4">
|
||||||
|
<el-radio :label="0" size="large">否</el-radio>
|
||||||
|
<el-radio :label="1" size="large">是</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item :label="v.name" v-for="(v, i) in config_field" :key="i">
|
||||||
|
<el-input v-model="shipping_config[v.key]" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="是否有效">
|
||||||
|
<el-switch
|
||||||
|
v-model="form.enabled"
|
||||||
|
class="ml-2"
|
||||||
|
style="
|
||||||
|
--el-switch-on-color: #13ce66;
|
||||||
|
--el-switch-off-color: #ff4949;
|
||||||
|
"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template #footer>
|
||||||
|
<div style="flex: auto">
|
||||||
|
<el-button @click="handleClose">關閉</el-button>
|
||||||
|
<el-button type="primary" @click="handleSubmit">送出</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-drawer>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, watch } from "vue";
|
||||||
|
import { getShipping, updateShipping } from "@/api/shipping";
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
visible: Boolean,
|
||||||
|
editid: Number,
|
||||||
|
});
|
||||||
|
|
||||||
|
const loading = ref(false);
|
||||||
|
const direction = ref("rtl");
|
||||||
|
|
||||||
|
const drawer = ref(false);
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.visible,
|
||||||
|
(val) => {
|
||||||
|
drawer.value = val;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
const form = ref({});
|
||||||
|
|
||||||
|
const config_field = ref([]);
|
||||||
|
|
||||||
|
const shipping_config = ref(null);
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.editid,
|
||||||
|
async (val) => {
|
||||||
|
if (val) {
|
||||||
|
loading.value = true;
|
||||||
|
let res = await getShipping(val);
|
||||||
|
if (res.code === 200) {
|
||||||
|
form.value = res.data;
|
||||||
|
form.value.enabled = res.data.enabled === 1 ? true : false;
|
||||||
|
config_field.value = JSON.parse(res.data.shipping_config_field);
|
||||||
|
|
||||||
|
if (res.data.shipping_config_field) {
|
||||||
|
if (res.data.shipping_config) {
|
||||||
|
shipping_config.value = JSON.parse(res.data.shipping_config);
|
||||||
|
} else {
|
||||||
|
shipping_config.value = config_field.value.reduce((pv, cv, i) => {
|
||||||
|
if (cv.key) {
|
||||||
|
pv[cv.key] = "";
|
||||||
|
}
|
||||||
|
return pv;
|
||||||
|
}, {});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
const emit = defineEmits(["close", "update"]);
|
||||||
|
|
||||||
|
const handleClose = () => {
|
||||||
|
form.value = {};
|
||||||
|
shipping_config.value = {};
|
||||||
|
emit("close", true);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleSubmit = async () => {
|
||||||
|
form.value.shipping_config = JSON.stringify(shipping_config.value);
|
||||||
|
|
||||||
|
loading.value = true;
|
||||||
|
let res = await updateShipping(form.value);
|
||||||
|
if (res.code === 200) {
|
||||||
|
ElMessage("更新成功");
|
||||||
|
emit("update");
|
||||||
|
handleClose();
|
||||||
|
} else {
|
||||||
|
ElMessage.error("更新失敗,請重新操作");
|
||||||
|
}
|
||||||
|
loading.value = false;
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
||||||
@ -0,0 +1,178 @@
|
|||||||
|
<template>
|
||||||
|
<div class="main">
|
||||||
|
<div class="breadcrumb">
|
||||||
|
<el-breadcrumb separator="/">
|
||||||
|
<el-breadcrumb-item :to="{ path: '/' }"
|
||||||
|
>電商管理中心</el-breadcrumb-item
|
||||||
|
>
|
||||||
|
<el-breadcrumb-item><a href="/">商品分類</a></el-breadcrumb-item>
|
||||||
|
</el-breadcrumb>
|
||||||
|
</div>
|
||||||
|
<hr />
|
||||||
|
<el-card>
|
||||||
|
<el-table :data="tableData" style="width: 100%">
|
||||||
|
<el-table-column prop="shipping_code" label="分類名稱" width="180" />
|
||||||
|
<el-table-column prop="shipping_name" label="商品數量" width="180" />
|
||||||
|
<el-table-column prop="shipping_desc" label="價格分級" width="180" />
|
||||||
|
<el-table-column label="排序" width="80">
|
||||||
|
<template #default="scope">
|
||||||
|
<i
|
||||||
|
class="action-icon icon-arrow-drop-up"
|
||||||
|
@click="handleSortChange(0, scope.$index, scope.row)"
|
||||||
|
v-if="scope.$index !== 0"
|
||||||
|
/>
|
||||||
|
<i
|
||||||
|
class="action-icon icon-arrow-drop-down"
|
||||||
|
@click="handleSortChange(1, scope.$index, scope.row)"
|
||||||
|
v-if="scope.$index < total - 1"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="狀態" width="80">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-switch
|
||||||
|
v-model="scope.row.enabled"
|
||||||
|
:active-value="1"
|
||||||
|
:inactive-value="0"
|
||||||
|
@change="handleSwitch($event, scope.row.shipping_id, scope.row)"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" width="100">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button size="small" @click="handleEdit(scope.$index, scope.row)"
|
||||||
|
>編輯</el-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
<edit-form
|
||||||
|
:editid="editId"
|
||||||
|
:visible="showEditForm"
|
||||||
|
@close="onEditClose"
|
||||||
|
@update="onFormUpdate"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, onMounted } from "vue";
|
||||||
|
import { getList, updateEnabled, updateOrder } from "@/api/shipping";
|
||||||
|
|
||||||
|
import EditForm from "./components/EditForm.vue";
|
||||||
|
|
||||||
|
const total = ref(0);
|
||||||
|
const tableData = ref([]);
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
genList();
|
||||||
|
});
|
||||||
|
|
||||||
|
const genList = async () => {
|
||||||
|
let res = await getList();
|
||||||
|
|
||||||
|
if (res.code === 200) {
|
||||||
|
total.value = res.data.total;
|
||||||
|
tableData.value = res.data.data;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
//列表操作
|
||||||
|
//是否有效
|
||||||
|
const handleSwitch = async (event, id) => {
|
||||||
|
let res = await updateEnabled({ shipping_id: id, enabled: event });
|
||||||
|
let enabled;
|
||||||
|
if (res.code !== 200) {
|
||||||
|
ElMessage.error("更新失敗,請重新操作");
|
||||||
|
enabled = !event;
|
||||||
|
} else {
|
||||||
|
enabled = event;
|
||||||
|
}
|
||||||
|
enabled = enabled ? 1 : 0;
|
||||||
|
tableData.value = tableData.value.map((item) => {
|
||||||
|
if (item.shipping_id === id) {
|
||||||
|
item.enabled = enabled;
|
||||||
|
}
|
||||||
|
return item;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
//交換排序
|
||||||
|
const handleSortChange = async (type, index, row) => {
|
||||||
|
//找出tableData中的shipping_order值大於row.shipping_sort的第一個值
|
||||||
|
let target;
|
||||||
|
if (type === 0) {
|
||||||
|
target = tableData.value[index - 1];
|
||||||
|
} else {
|
||||||
|
target = tableData.value[index + 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
//交換shipping_order值
|
||||||
|
let temp = row.shipping_order;
|
||||||
|
row.shipping_order = target.shipping_order;
|
||||||
|
target.shipping_order = temp;
|
||||||
|
|
||||||
|
//更新至後端
|
||||||
|
let params = [
|
||||||
|
{ shipping_id: row.shipping_id, shipping_order: row.shipping_order },
|
||||||
|
{ shipping_id: target.shipping_id, shipping_order: target.shipping_order },
|
||||||
|
];
|
||||||
|
|
||||||
|
let res = await updateOrder(params);
|
||||||
|
|
||||||
|
if (res.code !== 200) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//重新排序
|
||||||
|
tableData.value = tableData.value.sort((a, b) => {
|
||||||
|
return a.shipping_order - b.shipping_order;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
//編輯
|
||||||
|
const showEditForm = ref(false);
|
||||||
|
const editId = ref(null);
|
||||||
|
|
||||||
|
const handleEdit = (index, row) => {
|
||||||
|
showEditForm.value = true;
|
||||||
|
editId.value = row.shipping_id;
|
||||||
|
};
|
||||||
|
|
||||||
|
const onEditClose = () => {
|
||||||
|
showEditForm.value = false;
|
||||||
|
editId.value = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
const onFormUpdate = () => {
|
||||||
|
genList();
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped>
|
||||||
|
.main {
|
||||||
|
background-color: #ffffff;
|
||||||
|
.breadcrumb {
|
||||||
|
margin: 0 0 10px;
|
||||||
|
padding: 10px 10px;
|
||||||
|
line-height: 1.2;
|
||||||
|
font-weight: 500;
|
||||||
|
|
||||||
|
:deep(.el-breadcrumb) {
|
||||||
|
font-size: 16px;
|
||||||
|
color: #606266;
|
||||||
|
.el-breadcrumb__inner {
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: middle;
|
||||||
|
.el-breadcrumb__separator {
|
||||||
|
color: #c0c4cc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.action-icon {
|
||||||
|
font-size: 24px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
import { createApp } from 'vue'
|
||||||
|
import App from './index.vue'
|
||||||
|
|
||||||
|
import '@/assets/css/normalize.less'
|
||||||
|
import '@/assets/css/common.less'
|
||||||
|
|
||||||
|
createApp(App).mount('#app')
|
||||||
@ -1,13 +1,11 @@
|
|||||||
import { createApp } from 'vue'
|
import { createApp } from 'vue'
|
||||||
import App from './App.vue'
|
import App from './App.vue'
|
||||||
import router from './router/index.js'
|
// import router from './router/index.js'
|
||||||
|
|
||||||
import CKEditor from '@ckeditor/ckeditor5-vue'
|
|
||||||
|
|
||||||
import '@/assets/css/normalize.less'
|
import '@/assets/css/normalize.less'
|
||||||
import '@/assets/css/common.less'
|
import '@/assets/css/common.less'
|
||||||
|
|
||||||
const app = createApp(App)
|
const app = createApp(App)
|
||||||
app.use(CKEditor)
|
|
||||||
app.use(router)
|
// app.use(router)
|
||||||
app.mount('#app')
|
app.mount('#app')
|
||||||
|
|||||||
Loading…
Reference in new issue