Compare commits

..

No commits in common. "579e4d860ee21a374590f80c97b02847c8d41a2e" and "637303fc1a3f96f578854cb53026fa332eaade2f" have entirely different histories.

4 changed files with 1519 additions and 24058 deletions

View File

@ -54,8 +54,8 @@
"jsencrypt": "3.0.0-rc.1", "jsencrypt": "3.0.0-rc.1",
"mockjs": "^1.1.0", "mockjs": "^1.1.0",
"nprogress": "0.2.0", "nprogress": "0.2.0",
"obj-modal": "^1.2.0", "obj-modal": "^1.1.2",
"obj-table-plus": "^2.3.0", "obj-table-plus": "^2.2.1",
"quill": "1.3.7", "quill": "1.3.7",
"screenfull": "5.0.2", "screenfull": "5.0.2",
"signature_pad": "^3.0.0-beta.4", "signature_pad": "^3.0.0-beta.4",

View File

@ -2,108 +2,89 @@ import $http from "@/utils/httpRequest.js";
import city_data from "@/utils/country-level2-data.js"; import city_data from "@/utils/country-level2-data.js";
export const mer_admin = { export const mer_admin = {
/** /**
* 登录 * 登录
* @param {object} params LoginParam * @param {object} params LoginParam
* @param {number} params.type * @param {number} params.type
* @param {string} params.role * @param {string} params.role
* @param {string} params.username * @param {string} params.username
* @param {string} params.password * @param {string} params.password
* @param {string} params.mobile * @param {string} params.mobile
* @param {string} params.code * @param {string} params.code
* @returns * @returns
*/ */
loginByAccount: (params) => { loginByAccount: (params) => {
return $http.post(`/auth/login`, { return $http.post(`/auth/login`, {
...params, ...params,
type: 1 type: 1,
}) });
}, },
loginByMobile: (params) => { loginByMobile: (params) => {
return $http.post(`/merchant-api/auth/sms/login`, { return $http.post(`/merchant-api/auth/sms/login`, {
...params, ...params,
type: 2 type: 2,
}) });
}, },
getYZM(mobile) { getYZM(mobile) {
return $http.get(`/merchant-api/auth/login/code?mobile=${mobile}`); return $http.get(`/merchant-api/auth/login/code?mobile=${mobile}`);
}, },
getInfo() { getInfo() {
return $http.get(`/merchant-api/auth/info`); return $http.get(`/merchant-api/auth/info`);
}, },
//商品管理 //商品管理
//保存商品信息 //保存商品信息
saveProduct: (data) => { saveProduct: (data) => {
return $http.post(`/merchant-api/product/save`, data); return $http.post(`/merchant-api/product/save`, data);
}, },
//保存商品基本信息 //保存商品基本信息
saveProductBase: (data) => { saveProductBase: (data) => {
return $http.post(`/merchant-api/product/save/basic`, data); return $http.post(`/merchant-api/product/save/basic`, data);
}, },
//返回商品分类以及列表(聚合) //返回商品分类以及列表(聚合)
getPolyProduct: (data) => { getPolyProduct: (data) => {
return $http.post(`/merchant-api/product/polymerization/list`, data); return $http.post(`/merchant-api/product/polymerization/list`, data);
}, },
//商品分页 //商品分页
getProductPage: (data) => { getProductPage: (data) => {
return $http.post(`/merchant-api/product/page`, data); return $http.post(
}, `/merchant-api/product/page?pageNumber=${data.p.pageNumber}&pageSize=${data.p.pageSize}`,
//商户商品分类 data
getProductCategory: () => { );
return $http.get(`/merchant-api/product/category/list?shopId=${JSON.parse(sessionStorage.getItem('userInfo')).shopId}`); },
}, //商户商品分类
//获取销售单位 getProductCategory: () => {
getSaleUnit: (data) => { return $http.get(
return $http.request({ url: `/merchant-api/product/unit/list`, method: 'get', params: data }); `/merchant-api/product/category/list?shopId=${
}, JSON.parse(sessionStorage.getItem("userInfo")).shopId
//文件上传 }`
uploadFile: () => { );
return `${window.SITE_CONFIG['baseUrl']}/merchant-api/file/upload` },
}, //批量删除商品
//直接获取城市数据 BatchDeleteProducts: (data) => {
getCityOptions: () => { return $http.post(`/merchant-api/product/batch/delete`, data);
return city_data; },
}, //打折扣
//省市县数据 setDiscounts: (data) => {
getCity: () => { return $http.post(`merchant-api/activity/save`, data);
return $http.get(`/merchant-api/common/pca`); },
}, //上架或下架商品
//添加运费模板 putOnShelvesProducts: (data) => {
addShippingTemplate: (data) => { return $http.post(`/merchant-api/product/batch/update/status`, data);
return $http.post(`/merchant-api/shippingTemplates/add`, data); },
}, //获取销售单位
//删除模板 getSaleUnit: (data) => {
removeShippingTemplate: (id) => { return $http.request({
return $http.post(`/merchant-api/shippingTemplates/delete`, { url: `/merchant-api/product/unit/list`,
id method: "get",
}) params: data,
}, });
//更新模板 },
updateShippingTemplate: (data) => { //文件上传
return $http.post(`/merchant-api/shippingTemplates/update`, data); uploadFile: () => {
}, return `${window.SITE_CONFIG["baseUrl"]}/merchant-api/file/upload`;
//获取模板分页 },
getShippingTemplatePage: (data) => { //直接获取城市数据
return $http.request({ getCityOptions: () => {
method: 'get', return city_data;
url: '/merchant-api/shippingTemplates/page', },
params: data };
})
},
//获取配送模板列表
getShippingTemplateList: (data) => {
return $http.request({
method: 'get',
url: '/merchant-api/shippingTemplates/list',
params: data
})
},
//获取模板详情
getShippingTemplateInfo: (id) => {
return $http.request({
method: 'get',
url: '/merchant-api/shippingTemplates/list',
params: { id }
})
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,636 +1,156 @@
<template> <template>
<div> <div>
<obj-modal <obj-modal class="obj-modal" ref="modal" labelWidth="100px" :modalCols="modalCols" :modalConfig="modalConfig"
class="obj-modal" :modalData="modalData" :modalHandles="modalHandles">
ref="modal" <template slot="dialog__before">
labelWidth="100px" <!-- <el-tabs v-model="currentPanel">
:modalCols="modalCols"
:modalConfig="modalConfig"
:modalData="modalData"
:modalHandles="modalHandles"
>
<template slot="dialog__before">
<!-- <el-tabs v-model="currentPanel">
<el-tab-pane label="基础信息" name="基础信息"></el-tab-pane> <el-tab-pane label="基础信息" name="基础信息"></el-tab-pane>
<el-tab-pane label="销售信息" name="销售信息"></el-tab-pane> <el-tab-pane label="销售信息" name="销售信息"></el-tab-pane>
<el-tab-pane label="其他信息" name="其他信息"></el-tab-pane> <el-tab-pane label="其他信息" name="其他信息"></el-tab-pane>
</el-tabs> --> </el-tabs> -->
</template> </template>
</obj-modal> </obj-modal>
</div> </div>
</template> </template>
<script> <script>
import { debounce, cloneDeep } from "lodash"; import { debounce, cloneDeep } from "lodash";
const BASE_DATA = {
calculateMethod: "按重量",
fareConfig: "全国包邮",
//
shippingTemplatesRegionList: [
{
//
cityCodes: "0",
//
first: "",
//
firstPrice: "",
//
renewal: "",
//
renewalPrice: "",
},
],
//
shippingTemplatesRegionListAppend: [],
//
shippingTemplatesConditionList: [
// {
// cityCodes: "",
// price: "",
// number: "",
// },
],
};
export default { export default {
data() { data() {
return { return {
currentPanel: "基础信息", currentPanel: "基础信息",
modalData: {}, modalData: {
modalConfig: { },
title: "添加运费模板", modalConfig: {
show: false, title: "添加运费模板",
width: "1300px", show: false,
fullscreen: true, width: "1300px",
}, fullscreen: true,
fileList: [], // },
place: "", // fileList: [], //
}; place: "", //
}, };
mounted() {},
methods: {
toggle(e) {
if (this.modalConfig.show == false) {
this.modalConfig.show = true;
} else {
this.modalConfig.show = false;
}
if (e) {
console.log(e);
this.init(cloneDeep(e.row));
}
return {
add: (item) => {
console.log(item);
this.$nextTick(() => {
this.modalData = BASE_DATA;
});
this.isAdd = true;
},
update: (row) => {
this.modalData = row;
this.isAdd = false;
},
};
}, },
init(row) {}, mounted() { },
}, methods: {
computed: { toggle(e) {
modalCols() { if (this.modalConfig.show == false) {
return [ this.modalConfig.show = true;
{ } else {
label: "模板名称", this.modalConfig.show = false;
prop: "templateName", }
type: "Input", if (e) {
maxlength: "30", console.log(e);
placeholder: "请输入模板名称", this.init(cloneDeep(e.row));
rules: { }
required: true, return {
message: "请输入模板名称", add: (item) => {
trigger: "blur,change", console.log(item);
}, this.$nextTick(() => {
}, this.modalData = {
{ };
label: "计价方式", });
prop: "calculateMethod", this.isAdd = true;
type: "jsx",
rules: {
required: true,
message: "请选择计价方式",
trigger: "blur",
},
render: () => {
return (
<el-radio-group v-model={this.modalData.calculateMethod}>
<el-radio label="按重量">按重量</el-radio>
<el-radio label="按件数">按件数</el-radio>
</el-radio-group>
);
},
},
{
label: "运费配置",
prop: "fareConfig",
type: "jsx",
required: true,
rules: {
required: true,
message: "请选择计价方式",
trigger: "blur",
},
render: () => {
return (
<el-radio-group v-model={this.modalData.fareConfig}>
<el-radio label="全国包邮">全国包邮</el-radio>
<el-radio label="自定义运费">自定义运费</el-radio>
</el-radio-group>
);
},
},
{
label: "自定义运费配置",
type: "jsx-out",
show: this.modalData.fareConfig == "自定义运费",
render: () => {
const tableCols = [
{
title: "运送到",
width: "300px",
field: "cityCodes",
type: "jsx",
render: ({ row }) => {
const change = (e) => {
console.log(e);
};
return (
<el-cascader
style="width:100%;"
v-model={row.cityCodes}
onChange={change}
options={this.$api.mer_admin.getCityOptions()}
show-all-levels={false}
collapse-tags={true}
props={{
props: {
multiple: true,
checkStrictly: false,
emitPath: true,
label: "name",
value: "code",
},
}}
clearable
filterable
></el-cascader>
);
}, },
}, update: (row) => {
{ this.modalData = row;
title: "首重kg", this.isAdd = false;
field: "first",
type: "jsx",
render: ({ row }) => {
return (
<el-input-number
style="width:100%;"
min={0}
controls={false}
precision={2}
v-model={row.first}
></el-input-number>
);
}, },
},
{
title: "首费(元)",
field: "firstPrice",
type: "jsx",
render: ({ row }) => {
return (
<el-input-number
style="width:100%;"
min={0}
controls={false}
precision={2}
v-model={row.firstPrice}
></el-input-number>
);
},
},
{
title: "续重kg",
field: "renewal",
type: "jsx",
render: ({ row }) => {
return (
<el-input-number
style="width:100%;"
min={0}
controls={false}
precision={2}
v-model={row.renewal}
></el-input-number>
);
},
},
{
title: "续费(元)",
field: "renewalPrice",
type: "jsx",
render: ({ row }) => {
return (
<el-input-number
style="width:100%;"
min={0}
max={row.firstPrice}
controls={false}
precision={2}
v-model={row.renewalPrice}
></el-input-number>
);
},
},
{
title: "操作",
type: "jsx",
render: (e) => {
const remove = () => {
console.log(e);
this.modalData.shippingTemplatesRegionListAppend.splice(
e.rowIndex,
1
);
};
const add = () => {
console.log(e);
this.modalData.shippingTemplatesRegionListAppend.splice(
e.rowIndex + 1,
0,
{
//
cityCodes: "",
//
first: "",
//
firstPrice: "",
//
renewal: "",
//
renewalPrice: "",
}
);
};
return (
<div>
<el-button type="primary" size="mini" onClick={add}>
向下添加
</el-button>
<el-button type="danger" size="mini" onClick={remove}>
删除
</el-button>
</div>
);
},
},
];
const addAreaFare = () => {
this.modalData.shippingTemplatesRegionListAppend.push({
//
cityCodes: "",
//
first: "",
//
firstPrice: "",
//
renewal: "",
//
renewalPrice: "",
});
}; };
return (
<div>
<div class="d-flex no-warp justify-start items-center">
<el-form-item
prop="shippingTemplatesRegionList[0].first"
rules={{
required: true,
message: "请填写默认运费",
trigger: "change",
}}
label="默认运费"
>
<el-input
v-model={
this.modalData.shippingTemplatesRegionList[0].first
}
></el-input>
</el-form-item>
<span style="transform:translateY(-12px);">
&nbsp;kg内&nbsp;
</span>
<el-form-item
label-width="0"
prop="shippingTemplatesRegionList[0].firstPrice"
rules={{
required: true,
message: "请填写默认运费",
trigger: "change",
}}
label=""
>
<el-input
v-model={
this.modalData.shippingTemplatesRegionList[0].firstPrice
}
></el-input>
</el-form-item>
<span style="transform:translateY(-12px);">
&nbsp;每增加&nbsp;
</span>
<el-form-item
label-width="0"
prop="shippingTemplatesRegionList[0].renewal"
rules={{
required: true,
message: "请填写默认运费",
trigger: "change",
}}
label=""
>
<el-input
v-model={
this.modalData.shippingTemplatesRegionList[0].renewal
}
></el-input>
</el-form-item>
<span style="transform:translateY(-12px);">
&nbsp;kg增加运费&nbsp;
</span>
<el-form-item
label-width="0"
prop="shippingTemplatesRegionList[0].renewalPrice"
rules={{
required: true,
message: "请填写默认运费",
trigger: "change",
}}
label=""
>
<el-input
v-model={
this.modalData.shippingTemplatesRegionList[0]
.renewalPrice
}
></el-input>
</el-form-item>
<span style="transform:translateY(-12px);">
&nbsp;&nbsp;
</span>
</div>
<div>
<obj-table-plus
style="height:50vh;"
enable-auto-query={false}
v-model={this.modalData.shippingTemplatesRegionListAppend}
tableCols={tableCols}
isPagination={false}
>
<template slot="empty">
<el-button
onClick={addAreaFare}
type="text"
icon="el-icon-plus"
>
为指定地区城市设置运费除指定地区外其余地区的运费按照默认运费
</el-button>
</template>
</obj-table-plus>
</div>
</div>
);
},
}, },
// init(row) { },
{ },
label: "", computed: {
prop: "", modalCols() {
type: "jsx-out", return [
show: this.modalData.fareConfig == "自定义运费", {
render: () => { label: "模板名称",
const tableCols = [ prop: "templateName",
{ required: true,
title: "运送到", type: "Input",
width: "300px", maxlength:"30",
field: "cityCodes", placeholder: "请输入模板名称"
type: "jsx",
render: ({ row }) => {
const change = (e) => {
console.log(e);
};
return (
<el-cascader
style="width:100%;"
v-model={row.cityCodes}
onChange={change}
options={this.$api.mer_admin.getCityOptions()}
show-all-levels={false}
collapse-tags={true}
props={{
props: {
multiple: true,
checkStrictly: false,
emitPath: true,
label: "name",
value: "code",
},
}}
clearable
filterable
></el-cascader>
);
}, },
}, {
{ label: "计价方式",
title: "包邮条件", prop: "calculateMethod",
field: "conditions", type: "jsx",
type: "jsx", required: true,
render: ({ row }) => { rules: {
const _conditionMapper = { required: true,
件数: ( message: "请选择计价方式",
<div> trigger: "blur",
<el-input-number },
style="width:150px;" render: () => {
min={0} return (
controls={false} <el-radio-group v-model={this.modalData.calculateMethod}>
precision={0} <el-radio label="按重量">按重量</el-radio>
v-model={row.number} <el-radio label="按件数">按件数</el-radio>
></el-input-number> </el-radio-group>
<span>&nbsp;件包邮&nbsp;</span> );
</div> },
),
金额: (
<div>
<el-input-number
style="width:150px;"
min={0}
controls={false}
precision={2}
v-model={row.price}
></el-input-number>
<span>&nbsp;元包邮&nbsp;</span>
</div>
),
"件数+金额": (
<div>
<el-input-number
style="width:150px;"
min={0}
controls={false}
precision={0}
v-model={row.number}
></el-input-number>
<span>&nbsp;&nbsp;</span>
<el-input-number
style="width:150px;"
min={0}
controls={false}
precision={2}
v-model={row.price}
></el-input-number>
<span>&nbsp;元以上包邮&nbsp;</span>
</div>
),
};
return (
<div class="flex justify-start items-center">
<el-select
style="width:80px;"
v-model={row.conditionType}
>
<el-option label="件数" value="件数"></el-option>
<el-option label="金额" value="金额"></el-option>
<el-option
label="件数+金额"
value="件数+金额"
></el-option>
</el-select>
<span>&nbsp;&nbsp;</span>
{_conditionMapper[row.conditionType]}
</div>
);
}, },
}, {
{ label: "运费配置",
title: "操作", prop: "fareConfig",
width: "200px", type: "jsx",
type: "jsx", required: true,
render: (e) => { rules: {
const remove = () => { required: true,
console.log(e); message: "请选择计价方式",
this.modalData.shippingTemplatesConditionList.splice( trigger: "blur",
e.rowIndex, },
1 render: () => {
); return (
}; <el-radio-group v-model={this.modalData.fareConfig}>
const add = () => { <el-radio label="全国包邮">全国包邮</el-radio>
console.log(e); <el-radio label="自定义运费">自定义运费</el-radio>
this.modalData.shippingTemplatesConditionList.splice( </el-radio-group>
e.rowIndex + 1, );
0, },
{ }
cityCodes: "",
price: "",
number: "",
conditionType: "件数",
}
);
};
return (
<div>
<el-button type="primary" size="mini" onClick={add}>
向下添加
</el-button>
<el-button type="danger" size="mini" onClick={remove}>
删除
</el-button>
</div>
);
},
},
]; ];
const addAreaFare = () => {
this.modalData.shippingTemplatesConditionList.push({
cityCodes: "",
price: "",
number: "",
conditionType: "件数",
});
};
return (
<obj-table-plus
class="mt-5"
style="height:50vh;"
enable-auto-query={false}
v-model={this.modalData.shippingTemplatesConditionList}
tableCols={tableCols}
isPagination={false}
>
<template slot="empty">
<el-button
onClick={addAreaFare}
type="text"
icon="el-icon-plus"
>
添加其他地区/其他包邮条件
</el-button>
</template>
</obj-table-plus>
);
},
}, },
]; modalHandles() {
}, return [
modalHandles() { {
return [ label: "关闭",
{ type: "",
label: "关闭", handle: debounce(() => {
type: "", this.toggle();
handle: debounce(() => { }, 300),
this.toggle(); },
}, 300), {
label: "确认",
type: "primary",
loading: this.isLoading,
submit: true,
handle: debounce(() => {
}, 300),
}
];
}, },
{ },
label: "确认", asyncComputed: {
type: "primary", async getProductCategory() {
loading: this.isLoading, let res = await this.$api.mer_admin.getProductCategory();
submit: true, return res.data.data;
handle: debounce(() => {}, 300),
}, },
]; async getSaleUnit() {
}, let res = await this.$api.mer_admin.getSaleUnit({
}, shopId: JSON.parse(sessionStorage.getItem("userInfo")).shopId,
asyncComputed: { });
async getCityOptions() { console.log(res);
let res = await this.$api.mer_admin.getCity();
return res.data.data;
},
async getProductCategory() {
let res = await this.$api.mer_admin.getProductCategory();
return res.data.data;
},
async getSaleUnit() {
let res = await this.$api.mer_admin.getSaleUnit({
shopId: JSON.parse(sessionStorage.getItem("userInfo")).shopId,
});
console.log(res);
return res.data.data; return res.data.data;
},
}, },
},
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.obj-modal ::v-deep { .obj-modal ::v-deep {
.el-dialog__body { .el-dialog__body {
padding: 0 30px; padding: 0 30px;
} }
} }
</style> </style>