commit message

This commit is contained in:
Chopper
2021-05-13 10:56:04 +08:00
commit ec3e958037
728 changed files with 132685 additions and 0 deletions

View File

@@ -0,0 +1,260 @@
<template>
<div class="search">
<Row>
<Col>
<Card>
<Row @keydown.enter.native="handleSearch">
<Form
ref="searchForm"
:model="searchForm"
inline
:label-width="70"
class="search-form"
>
<Form-item label="开始时间" prop="startDay">
<DatePicker
type="date"
v-model="searchForm.startDate"
format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择"
clearable
style="width: 200px"
></DatePicker>
</Form-item>
<Form-item label="结束时间" prop="endDate">
<DatePicker
type="date"
v-model="searchForm.endDate"
format="yyyy-MM-dd HH:mm:ss"
di
placeholder="请选择"
clearable
style="width: 200px"
></DatePicker>
</Form-item>
<Button @click="handleSearch" type="primary" icon="ios-search" class="search-btn">搜索</Button>
</Form>
</Row>
<Row class="padding-row">
<Table
:loading="loading"
border
:columns="columns"
:data="data"
ref="table"
sortable="custom"
@on-sort-change="changeSort"
@on-selection-change="changeSelect"
></Table>
</Row>
<Row type="flex" justify="end" class="page">
<Page
:current="searchForm.pageNumber"
:total="total"
:page-size="searchForm.pageSize"
@on-change="changePage"
@on-page-size-change="changePageSize"
:page-size-opts="[10, 20, 50]"
size="small"
show-total
show-elevator
show-sizer
></Page>
</Row>
</Card>
</Col>
</Row>
</div>
</template>
<script>
import * as API_Shop from "@/api/shops";
export default {
name: "accountStatementBill",
components: {},
data() {
return {
loading: true, // 表单加载状态
searchForm: {
// 搜索框初始化对象
pageNumber: 1, // 当前页数
pageSize: 10, // 页面大小
sort: "createTime", // 默认排序字段
order: "desc", // 默认排序方式
startDate: "", // 起始时间
endDate: "", // 终止时间
},
form: {
// 添加或编辑表单对象初始化数据
sn: "",
sellerName: "",
startTime: "",
endTime: "",
billPrice: "",
},
// 表单验证规则
formValidate: {},
submitLoading: false, // 添加或编辑提交状态
selectList: [], // 多选数据
selectCount: 0, // 多选计数
columns: [
{
title: "账单号",
key: "sn",
minWidth: 250,
tooltip: true },
{
title: "生成时间",
key: "createTime",
minWidth: 120,
},
{
title: "结算时间段",
key: "startTime",
width: 200,
tooltip: true,
render: (h, params) => {
return h('div', params.row.startTime +"~"+params.row.endTime)
}
},
{
title: "结算金额",
key: "billPrice",
minWidth: 100,
render: (h, params) => {
return h(
"div",
this.$options.filters.unitPrice(params.row.billPrice, "¥")
);
},
},
{
title: "状态",
key: "billStatus",
width: 100,
render: (h, params) => {
if (params.row.billStatus == "OUT") {
return h( "Badge", {props: { status: "success",text: "已出账" } })
} else if (params.row.billStatus == "EXAMINE") {
return h( "Badge", {props: { status: "success",text: "已审核" } })
} else if (params.row.billStatus == "CHECK") {
return h( "Badge", {props: { status: "success",text: "已对账" } })
} else if (params.row.billStatus == "PAY") {
return h( "Badge", {props: { status: "success",text: "已付款" } })
}else if (params.row.billStatus == "COMPLETE") {
return h( "Badge", {props: { status: "success",text: "已完成" } })
}
}
},
{
title: "操作",
key: "action",
align: "center",
width: 120,
render: (h, params) => {
return h("div", [
h(
"Button",
{
props: {
type: "info",
size: "small",
},
style: {
marginRight: "5px",
},
on: {
click: () => {
this.detail(params.row);
},
},
},
"查看"
),
]);
},
},
],
data: [], // 表单数据
total: 0, // 表单数据总数
};
},
methods: {
init() {
this.getDataList();
},
changePage(v) {
this.searchForm.pageNumber = v;
this.getDataList();
this.clearSelectAll();
},
changePageSize(v) {
this.searchForm.pageSize = v;
this.getDataList();
},
handleSearch() {
this.searchForm.pageNumber = 1;
this.searchForm.pageSize = 10;
this.getDataList();
},
changeSort(e) {
this.searchForm.sort = e.key;
this.searchForm.order = e.order;
if (e.order === "normal") {
this.searchForm.order = "";
}
this.getDataList();
},
clearSelectAll() {
this.$refs.table.selectAll(false);
},
changeSelect(e) {
this.selectList = e;
this.selectCount = e.length;
},
selectDateRange(v) {
if (v) {
this.searchForm.startDate = v[0];
this.searchForm.endDate = v[1];
}
},
getDataList() {
this.loading = true;
this.searchForm.billStatus = "OUT"
API_Shop.getBillPage(this.searchForm).then((res) => {
this.loading = false;
if (res.success) {
this.data = res.result.records;
this.total = res.result.total;
}
});
this.total = this.data.length;
this.loading = false;
},
detail(v) {
let id = v.id;
this.$router.push({
name: "bill-detail",
query: { id: id },
});
},
},
mounted() {
this.init();
},
};
</script>
<style lang="scss" scoped>
// 建议引入通用样式 可删除下面样式代码
@import "@/styles/table-common.scss";
/deep/ .ivu-col{
min-height: 100vh;
}
</style>

View File

@@ -0,0 +1,632 @@
<template>
<div>
<template>
<Row>
<i-col span="24">
<Card>
<p slot="title">商家信息</p>
<div class="flex flex_align_item">
<p>店铺名称{{ bill.storeName }}</p>
<p>银行开户名{{ bill.bankAccountName }}</p>
<p>银行账号{{ bill.bankAccountNumber }}</p>
<p>开户行支行名称{{ bill.bankName }}</p>
<p>支行联行号{{ bill.bankCode }}</p>
</div>
</Card>
</i-col>
</Row>
</template>
<template>
<Row>
<i-col span="24">
<Card>
<p slot="title">账单详细</p>
<div class="tips-status">
<span>商品状态</span>
<span class="theme_color">{{
bill.billStatus | unixSellerBillStatus
}}</span>
<Button
v-if="bill.billStatus == 'OUT'"
size="mini"
@click="reconciliation()"
type="primary"
>对账</Button
>
</div>
<i-table :columns="columns" :data="data" stripe></i-table>
</Card>
</i-col>
</Row>
</template>
<template>
<Tabs active-key="tab" @on-click="clickTabs">
<Tab-pane label="订单列表" name="order">
<Card>
<Row>
<Table
:loading="loading"
border
:columns="orderColumns"
:data="orderData"
ref="table"
></Table>
</Row>
<Row type="flex" justify="end" class="page">
<Page
:current="orderParam.pageNumber"
:total="orderTotal"
:page-size="orderParam.pageSize"
@on-change="orderChangePage"
@on-page-size-change="orderChangePageSize"
size="small"
show-total
show-elevator
></Page>
</Row>
</Card>
</Tab-pane>
<Tab-pane label="退单列表" name="refund">
<Card>
<Row>
<Table
:loading="loading"
border
:columns="refundColumns"
:data="refundData"
ref="table"
></Table>
</Row>
<Row type="flex" justify="end" class="page">
<Page
:current="refundParam.pageNumber"
:total="refundTotal"
:page-size="refundParam.pageSize"
@on-change="refundChangePage"
@on-page-size-change="refundChangePageSize"
size="small"
show-total
show-elevator
></Page>
</Row>
</Card>
</Tab-pane>
<Tab-pane label="分销费用列表" name="distribution">
<Card>
<Row>
<Table
:loading="loading"
border
:columns="distributionColumns"
:data="distributionData"
ref="table"
></Table>
</Row>
<Row type="flex" justify="end" class="page">
<Page
:current="distributionParam.pageNumber"
:total="distributionTotal"
:page-size="distributionParam.pageSize"
@on-change="distributionChangePage"
@on-page-size-change="distributionChangePageSize"
size="small"
show-total
show-elevator
></Page>
</Row>
</Card>
</Tab-pane>
</Tabs>
</template>
</div>
</template>
<script>
import * as filters from "@/utils/filters";
import * as API_Shop from "@/api/shops";
export default {
name: "bill-detail",
data() {
return {
columns: [
{
title: "项目",
key: "name",
width: 250,
},
{
title: "值",
key: "value",
},
],
data: [ // 账单数据
{
name: "计算中",
value: 0,
},
{
name: "计算中",
value: 0,
},
{
name: "计算中",
value: 0,
},
{
name: "计算中",
value: 0,
},
{
name: "计算中",
value: 0,
},
{
name: "计算中",
value: 0,
},
{
name: "计算公式",
value: 0,
},
{
name: "计算中",
value: 0,
}
],
id: "", // 账单id
bill: {}, // 商家信息
orderParam: {
pageNumber: 1, // 当前页数
pageSize: 10, // 页面大小
sort: "id", // 默认排序字段
order: "desc", // 默认排序方式
flowType: "PAY",
},
orderColumns: [
{
title: "入账时间",
key: "createTime",
minWidth: 120
},
{
title: "订单编号",
key: "sn",
minWidth: 120
},
{
title: "订单金额",
key: "finalPrice",
minWidth: 120,
render: (h, params) => {
return h(
"div",
this.$options.filters.unitPrice(params.row.finalPrice, "¥")
);
},
},
{
title: "平台分佣",
key: "commissionPrice",
minWidth: 120,
render: (h, params) => {
return h(
"div",
this.$options.filters.unitPrice(params.row.commissionPrice, "¥")
);
},
},
{
title: "平台优惠券",
key: "siteCouponPrice",
minWidth: 120,
render: (h, params) => {
if(params.row.siteCouponPrice == null){
return h(
"div",
"-"
);
}else{
return h(
"div",
this.$options.filters.unitPrice(params.row.siteCouponPrice, "¥")
);
}
},
},
{
title: "分销金额",
key: "distributionRebate",
minWidth: 100,
render: (h, params) => {
if(params.row.distributionRebate == null){
return h(
"div",
"-"
);
}else{
return h(
"div",
this.$options.filters.unitPrice(params.row.distributionRebate, "¥")
);
}
},
},
{
title: "应结金额",
key: "billPrice",
minWidth: 120,
render: (h, params) => {
return h(
"div",
this.$options.filters.unitPrice(params.row.billPrice, "¥")
);
},
},
],
orderData: [], // 订单列表
orderTotal: 0, // 订单数量
//退单部分
refundParam: {
pageNumber: 1, // 当前页数
pageSize: 10, // 页面大小
sort: "id", // 默认排序字段
order: "desc", // 默认排序方式
flowType: "REFUND",
},
refundColumns: [
{
title: "退款时间",
key: "createTime",
minWidth: 120
},
{
title: "退款流水编号",
key: "sn",
minWidth: 130
},
{
title: "订单编号",
key: "sn",
minWidth: 120
},
{
title: "退款金额",
key: "finalPrice",
minWidth: 120,
render: (h, params) => {
return h(
"div",
this.$options.filters.unitPrice(params.row.finalPrice, "¥")
);
},
},
{
title: "退还佣金",
key: "commissionPrice",
minWidth: 120,
render: (h, params) => {
if(params.row.commissionPrice){
return h(
"div",
this.$options.filters.unitPrice(params.row.commissionPrice, "¥")
);
}else{
return h(
"div",
this.$options.filters.unitPrice(0, "¥")
);
}
},
},
{
title: "退还平台优惠券",
key: "siteCouponCommission",
minWidth: 140
},
{
title: "退还分销",
key: "distributionRebate",
minWidth: 120,
render: (h, params) => {
if(params.row.distributionRebate == null){
return h(
"div",
"-"
);
}else{
return h(
"div",
this.$options.filters.unitPrice(params.row.distributionRebate, "¥")
);
}
},
},
{
title: "合计金额",
key: "billPrice",
minWidth: 120,
render: (h, params) => {
if(params.row.billPrice == null){
return h(
"div",
"-"
);
}else{
return h(
"div",
this.$options.filters.unitPrice(params.row.billPrice, "¥")
);
}
},
},
],
refundData: [], // 退单数据
refundTotal: 0, // 退单数量
//分销佣金部分
distributionParam: {
pageNumber: 1, // 当前页数
pageSize: 10, // 页面大小
sort: "id", // 默认排序字段
order: "desc", // 默认排序方式
},
distributionColumns: [
{
title: "订单编号",
key: "sn",
minWidth: 120
},
{
title: "交易金额",
key: "finalPrice",
minWidth: 120
},
{
title: "商品名称",
key: "goodsName",
minWidth: 120,
tooltip: true
},
{
title: "规格",
key: "finalPrice",
minWidth: 120,
render: (h, params) => {
return h(
"div",
this.$options.filters.unitPrice(params.row.finalPrice, "¥")
);
},
},
{
title: "店铺名称",
key: "storeName",
minWidth: 120
},
{
title: "佣金",
key: "distributionRebate",
minWidth: 120,
render: (h, params) => {
if(params.row.flowType === "退款" ){
return h(
"div",
this.$options.filters.unitPrice("-"+params.row.distributionRebate, "¥")
);
}else{
if(params.row.distributionRebate){
return h(
"div",
this.$options.filters.unitPrice(params.row.distributionRebate, "¥")
);
}else{
return h(
"div",
this.$options.filters.unitPrice(0, "¥")
);
}
}
},
},
{
title: "时间",
key: "createTime",
minWidth: 120
},
],
distributionData: [], // 分销数据
distributionTotal: 0, // 分销总数
};
},
watch: {
'$route.query.id': function (val) {
this.id = val;
this.getBill();
}
},
methods: {
clickTabs(v) {
if (v == "order") {
this.orderParam.flowType = "PAY";
this.getOrderList()
} else if(v === "refund"){
this.orderParam.flowType = "REFUND";
this.getRefundList()
}else{
this.getDistributionList()
}
},
//核对结算单
reconciliation() {
this.$Modal.confirm({
title: "确认核对结算单",
// 记得确认修改此处
content: "您确认要核对此结算单么?",
loading: true,
onOk: () => {
API_Shop.reconciliation(this.id).then((res) => {
this.$Modal.remove();
if (res.code == 200) {
this.$Message.success("账单核对成功");
this.init();
}
});
}
});
},
init() {
this.id = this.$route.query.id;
this.getBill();
},
//订单列表部分
orderChangePage(v) {
this.orderParam.pageNumber = v;
this.getOrderList()
},
orderChangePageSize(v) {
this.orderParam.pageSize = v;
this.getOrderList()
},
getOrderList(){
API_Shop.getSellerFlow(this.id,this.orderParam).then((res) => {
if (res.success) {
this.orderData = res.result.records;
this.orderTotal = res.result.total;
}
});
},
//退单部分
refundChangePage(v) {
this.refundParam.pageNumber = v;
this.getRefundList()
},
refundChangePageSize(v) {
this.refundParam.pageSize = v;
this.getRefundList()
},
getRefundList() {
API_Shop.getSellerFlow(this.id, this.refundParam).then((res) => {
this.loading = false;
if (res.result) {
this.refundData = res.result.records;
this.refundTotal = res.result.total;
}
});
},
//分销费用列表
distributionChangePage(v) {
this.distributionParam.pageNumber = v;
this.getDistributionList()
},
distributionChangePageSize(v) {
this.distributionParam.pageSize = v;
this.getDistributionList()
},
getDistributionList() {
API_Shop.getDistributionFlow(this.id, this.distributionParam).then((res) => {
this.loading = false;
if (res.result) {
this.distributionData = res.result.records;
this.distributionTotal = res.result.total;
}
});
},
//获取结算单详细
getBill(){
API_Shop.getBillDetail(this.id).then((res) => {
if (res.success) {
this.bill = res.result;
//初始化表格
this.initTable();
//初始化订单信息
this.getOrderList();
}
});
},
initTable() {
let bill = this.bill;
this.data[0].name = "结算单号";
this.data[0].value = bill.sn;
this.data[1].name = "起止日期";
this.data[1].value = bill.startTime + "~" + bill.endTime;
this.data[2].name = "出帐日期";
this.data[2].value = bill.createTime;
this.data[3].name = "当前状态";
this.data[3].value = filters.unixSellerBillStatus(bill.billStatus);
this.data[4].name = "当前店铺";
this.data[4].value = bill.storeName;
this.data[5].name = "平台打款时间";
this.data[5].value = bill.payTime === null ? "未付款" : bill.payTime;
this.data[6].name = "结算金额";
this.data[6].value = filters.unitPrice(bill.billPrice?bill.billPrice:0, "¥");
this.data[7].name = "结算详细";
this.data[7].value =
"最终结算金额(" +
filters.unitPrice(bill.billPrice, "¥") +
") = 订单付款总金额(" +
filters.unitPrice(bill.orderPrice?bill.orderPrice:0, "¥") +
") - 退单金额(" +
filters.unitPrice(bill.refundPrice?bill.refundPrice:0, "¥") +
")" +
"- 平台收取佣金(" +
filters.unitPrice(bill.commissionPrice?bill.commissionPrice:0, "¥") +
") + 退单产生退还佣金金额(" +
filters.unitPrice(bill.refundCommissionPrice?bill.refundCommissionPrice:0, "¥") +
") - 分销返现支出(" +
filters.unitPrice(bill.distributionCommission?bill.distributionCommission:0, "¥") +
") + 退单分销返现返还(" +
filters.unitPrice(bill.distributionRefundCommission?bill.distributionRefundCommission:0, "¥") +
") - 平台优惠券支出(" +
filters.unitPrice(bill.siteCouponCommission?bill.siteCouponCommission:0, "¥") +
") + 退单平台优惠券返还(" +
filters.unitPrice(bill.siteCouponRefundCommission?bill.siteCouponRefundCommission:0, "¥") +
")";
},
},
mounted() {
this.init();
},
};
</script>
<style scoped lang="scss">
.flex {
justify-content: space-between;
flex-wrap: wrap;
> p {
width: 50%;
margin: 15px 0;
}
}
.tips-status {
padding: 18px;
> span {
font-weight: bold;
margin-right: 8px;
}
> span:nth-of-type(2) {
color: $theme_color;
}
}
</style>

View File

@@ -0,0 +1,264 @@
<template>
<div class="search">
<Row>
<Col>
<Card>
<Row @keydown.enter.native="handleSearch">
<Form
ref="searchForm"
:model="searchForm"
inline
:label-width="70"
class="search-form"
>
<Form-item label="开始时间" prop="startDay">
<DatePicker
type="date"
v-model="searchForm.startDate"
format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择"
clearable
style="width: 200px"
></DatePicker>
</Form-item>
<Form-item label="结束时间" prop="endDate">
<DatePicker
type="date"
v-model="searchForm.endDate"
format="yyyy-MM-dd HH:mm:ss"
di
placeholder="请选择"
clearable
style="width: 200px"
></DatePicker>
</Form-item>
<Form-item label="状态" prop="orderStatus">
<Select v-model="searchForm.billStatus" placeholder="请选择" clearable style="width: 200px">
<Option value="OUT">已出账</Option>
<Option value="CHECK">已对账</Option>
<Option value="COMPLETE">已完成</Option>
</Select>
</Form-item>
<Button @click="handleSearch" type="primary" icon="ios-search" class="search-btn">搜索</Button>
</Form>
</Row>
<Row class="padding-row">
<Table
:loading="loading"
border
:columns="columns"
:data="data"
ref="table"
sortable="custom"
@on-sort-change="changeSort"
@on-selection-change="changeSelect"
></Table>
</Row>
<Row type="flex" justify="end" class="page">
<Page
:current="searchForm.pageNumber"
:total="total"
:page-size="searchForm.pageSize"
@on-change="changePage"
@on-page-size-change="changePageSize"
:page-size-opts="[10, 20, 50]"
size="small"
show-total
show-elevator
show-sizer
></Page>
</Row>
</Card>
</Col>
</Row>
</div>
</template>
<script>
import * as API_Shop from "@/api/shops";
export default {
name: "storeBill",
components: {},
data() {
return {
loading: true, // 表单加载状态
searchForm: {
// 搜索框初始化对象
pageNumber: 1, // 当前页数
pageSize: 10, // 页面大小
sort: "createTime", // 默认排序字段
order: "desc", // 默认排序方式
startDate: "", // 起始时间
endDate: "", // 终止时间
},
form: {
// 添加或编辑表单对象初始化数据
sn: "",
sellerName: "",
startTime: "",
endTime: "",
billPrice: "",
},
// 表单验证规则
formValidate: {},
submitLoading: false, // 添加或编辑提交状态
selectList: [], // 多选数据
selectCount: 0, // 多选计数
columns: [
{
title: "账单号",
key: "sn",
minWidth: 250,
tooltip: true },
{
title: "生成时间",
key: "createTime",
minWidth: 120,
},
{
title: "结算时间段",
key: "startTime",
width: 200,
tooltip: true,
render: (h, params) => {
return h('div', params.row.startTime +"~"+params.row.endTime)
}
},
{
title: "结算金额",
key: "billPrice",
minWidth: 100,
render: (h, params) => {
return h(
"div",
this.$options.filters.unitPrice(params.row.billPrice, "¥")
);
},
},
{
title: "状态",
key: "billStatus",
width: 100,
render: (h, params) => {
if (params.row.billStatus == "OUT") {
return h( "Badge", {props: { status: "success",text: "已出账" } })
} else if (params.row.billStatus == "EXAMINE") {
return h( "Badge", {props: { status: "success",text: "已审核" } })
} else if (params.row.billStatus == "CHECK") {
return h( "Badge", {props: { status: "success",text: "已对账" } })
} else if (params.row.billStatus == "PAY") {
return h( "Badge", {props: { status: "success",text: "已付款" } })
}else if (params.row.billStatus == "COMPLETE") {
return h( "Badge", {props: { status: "success",text: "已完成" } })
}
}
},
{
title: "操作",
key: "action",
align: "center",
width: 120,
render: (h, params) => {
return h("div", [
h(
"Button",
{
props: {
type: "info",
size: "small",
},
style: {
marginRight: "5px",
},
on: {
click: () => {
this.detail(params.row);
},
},
},
"查看"
),
]);
},
},
],
data: [], // 表单数据
total: 0, // 表单数据总数
};
},
methods: {
init() {
this.getDataList();
},
changePage(v) {
this.searchForm.pageNumber = v;
this.getDataList();
this.clearSelectAll();
},
changePageSize(v) {
this.searchForm.pageSize = v;
this.getDataList();
},
handleSearch() {
this.searchForm.pageNumber = 1;
this.searchForm.pageSize = 10;
this.getDataList();
},
changeSort(e) {
this.searchForm.sort = e.key;
this.searchForm.order = e.order;
if (e.order === "normal") {
this.searchForm.order = "";
}
this.getDataList();
},
clearSelectAll() {
this.$refs.table.selectAll(false);
},
changeSelect(e) {
this.selectList = e;
this.selectCount = e.length;
},
selectDateRange(v) {
if (v) {
this.searchForm.startDate = v[0];
this.searchForm.endDate = v[1];
}
},
getDataList() {
this.loading = true;
API_Shop.getBillPage(this.searchForm).then((res) => {
this.loading = false;
if (res.success) {
this.data = res.result.records;
this.total = res.result.total;
}
});
this.total = this.data.length;
this.loading = false;
},
detail(v) {
let id = v.id;
this.$router.push({
name: "bill-detail",
query: { id: id },
});
},
},
mounted() {
this.init();
},
};
</script>
<style lang="scss" scoped>
// 建议引入通用样式 可删除下面样式代码
@import "@/styles/table-common.scss";
</style>

View File

@@ -0,0 +1,225 @@
<template>
<div class="search">
<Row>
<Col>
<Card>
<Row>
<Table
:loading="loading"
border
:columns="columns"
:data="data"
ref="table"
sortable="custom"
@on-sort-change="changeSort"
@on-selection-change="changeSelect"
></Table>
</Row>
</Card>
</Col>
</Row>
</div>
</template>
<script>
import * as API_Shop from "@/api/shops";
export default {
name: "logistics",
components: {},
data() {
return {
loading: true, // 表单加载状态
searchForm: {
// 搜索框初始化对象
pageNumber: 1, // 当前页数
pageSize: 10, // 页面大小
sort: "createTime", // 默认排序字段
order: "desc", // 默认排序方式
},
form: {
// 添加或编辑表单对象初始化数据
sn: "",
sellerName: "",
startTime: "",
endTime: "",
billPrice: "",
},
// 表单验证规则
formValidate: {},
submitLoading: false, // 添加或编辑提交状态
selectList: [], // 多选数据
selectCount: 0, // 多选计数
columns: [
{
title: "物流公司",
key: "name",
minWidth: 120,
sortable: false,
},
{
title: "状态",
key: "selected",
minWidth: 120,
sortable: true,
render: (h, params) => {
if (params.row.selected === null || params.row.selected === "") {
return h( "Badge", {props: { status: "error",text: "关闭" } })
} else if (params.row.selected !== "") {
return h( "Badge", {props: { status: "success",text: "开启" } })
}
}
},
{
title: "操作",
key: "action",
align: "center",
width: 200,
render: (h, params) => {
if(params.row.selected === null){
return h("div", [
h(
"Button",
{
props: {
type: "success",
size: "small",
},
style: {
marginRight: "5px",
},
on: {
click: () => {
this.checked(params.row);
},
},
},
"开启"
),
]);
}else{
return h("div", [
h(
"Button",
{
props: {
type: "error",
size: "small",
},
style: {
marginRight: "5px",
},
on: {
click: () => {
this.unChecked(params.row);
},
},
},
"关闭"
),
]);
}
},
},
],
data: [], // 表单数据
};
},
methods: {
init() {
this.getDataList();
},
changeSort(e) {
this.searchForm.sort = e.key;
this.searchForm.order = e.order;
if (e.order === "normal") {
this.searchForm.order = "";
}
this.getDataList();
},
changeSelect(e) {
this.selectList = e;
this.selectCount = e.length;
},
getDataList() {
this.loading = true;
API_Shop.getLogistics().then((res) => {
this.loading = false;
if (res.success) {
this.data = res.result;
}
});
this.loading = false;
},
//物流公司选中
checked(v) {
this.$Modal.confirm({
title: "确认开启",
// 记得确认修改此处
content: "您确认开启此物流公司?",
loading: true,
onOk: () => {
API_Shop.logisticsChecked(v.id).then((res) => {
this.$Modal.remove();
if (res.code == 200) {
this.$Message.success("物流公司开启成功");
this.init();
}
});
}
});
},
//物流公司取消选中
unChecked(v){
this.$Modal.confirm({
title: "确认关闭",
// 记得确认修改此处
content: "您确认关闭此物流公司?",
loading: true,
onOk: () => {
API_Shop.logisticsUnChecked(v.selected).then((res) => {
this.$Modal.remove();
if (res.code == 200) {
this.$Message.success("物流公司关闭成功");
this.init();
}
});
}
});
}
},
mounted() {
this.init();
},
};
</script>
<style lang="scss">
// 建议引入通用样式 可删除下面样式代码
// @import "@/styles/table-common.scss";
.search {
.operation {
margin-bottom: 2vh;
}
.select-count {
font-weight: 600;
color: #40a9ff;
}
.select-clear {
margin-left: 10px;
}
.page {
margin-top: 2vh;
}
.drop-down {
margin-left: 5px;
}
}
</style>

View File

@@ -0,0 +1,583 @@
<template>
<div class="search">
<Row>
<Col>
<Card>
<Row>
<Button @click="refresh" >刷新</Button>
<Button @click="add" type="primary">添加</Button>
</Row>
<Tabs @on-click="handleClickType" v-model="currentTab" style="margin-top: 10px">
<TabPane label="运费模板" name="INFO">
<table class="ncsc-default-table order m-b-30" :key="index" v-for="(item,index) in shipInfo">
<tbody>
<tr>
<td class="sep-row" colspan="20"></td>
</tr>
<tr>
<th colspan="20"><h3>{{item.name}}</h3>
<span class="fr m-r-5">
<time style="margin-right: 20px" title="最后编辑时间">
<i class="icon-time"></i>{{item.updateTime}}
</time>
<Button @click="edit(item)" type="info" >修改</Button>
<Button @click="remove(item.id)" type="error">删除</Button>
</span>
</th>
</tr>
<tr>
<td class="w10 bdl"></td>
<td class="cell-area tl">运送到</td>
<td class="w150">首件()
</td>
<td class="w150">运费</td>
<td class="w150">续件()
</td>
<td class="w150 bdr">运费</td>
</tr>
<tr v-for="(children,index) in item.freightTemplateChildList">
<td class="bdl"></td>
<td class="cell-area tl" style="width: 60%">{{children.area}}</td>
<td>
{{children.firstCompany}}
</td>
<td>
<span class="yuan"></span><span class="integer">{{children.firstPrice}}</span>
</td>
<td>
{{children.continuedCompany}}
</td>
<td class="bdr">
<span class="yuan"></span><span class="integer">{{children.continuedPrice}}</span>
</td>
</tr>
</tbody>
</table>
</TabPane>
<TabPane v-if="csTab" :label=title :name=operation>
<Form ref="form" :model="form" :label-width="100" :rules="formValidate">
<FormItem label="模板名称" prop="name">
<Input v-model="form.name" maxlength="10" clearable style="width: 20%"/>
</FormItem>
<FormItem label="计价方式" prop="pricingMethod">
<RadioGroup v-model="form.pricingMethod">
<Radio label="WEIGHT">按重量</Radio>
<Radio label="NUM">按件数</Radio>
</RadioGroup>
</FormItem>
<FormItem label="详细设置">
<div class="ncsu-trans-type" data-delivery="TRANSTYPE">
<div class="entity">
<div class="tbl-except">
<table cellspacing="0" class="ncsc-default-table">
<thead>
<tr style="border-bottom: 1px solid #ddd;">
<th class="w10"></th>
<th class="tl">运送到</th>
<th class="w10"></th>
<th class="w50">首件()</th>
<th class="w110">首费</th>
<th class="w50">续件()</th>
<th class="w110">续费</th>
<th class="w150">操作</th>
</tr>
</thead>
<tbody>
<tr class="bd-line" data-group="n1" v-for="(item,index) in form.freightTemplateChildList">
<td></td>
<td class="tl cell-area">
<span class="area-group">
<p style="display:inline-block">{{item.area}}</p></span>
</td>
<td></td>
<td>
<Input class="text w40" type="text" v-model="item.firstCompany" maxlength="3" clearable/>
</td>
<td>
<Input class="text w60" type="text" v-model="item.firstPrice" maxlength="6" clearable/><em
class="add-on">
</em>
</td>
<td>
<Input class="text w40" type="text" v-model="item.continuedCompany" maxlength="6"
clearable/>
</td>
<td>
<Input class="text w60" type="text" v-model="item.continuedPrice" maxlength="6"
clearable/><em class="add-on">
</em>
</td>
<td class="nscs-table-handle">
<Button
@click="editRegion(item)"
type="info"
size="small"
style="margin-bottom: 5px"
>修改
</Button>
<Button
@click="removeTemplateChildren(index)"
:loading="submitLoading"
type="error"
size="small"
style="margin-bottom: 5px"
>删除
</Button>
</td>
</tr>
</tbody>
</table>
</div>
<div class="tbl-attach p-5">
<div class="div-error" v-if="saveError">
<i class="fa fa-exclamation-circle" aria-hidden="true"></i>
<Icon type="ios-information-circle-outline"/>
指定地区城市为空或指定错误
<Icon type="ios-information-circle-outline"/>
首费应输入正确的金额
<Icon type="ios-information-circle-outline"/>
续费应输入正确的金额
<Icon type="ios-information-circle-outline"/>
()()费应输入大于0的整数
</div>
<Button
@click="addShipTemplateChildren(index)"
:loading="submitLoading"
type="info"
size="small"
icon="ios-create-outline"
style="margin-bottom: 5px"
>为指定城市设置运费模板
</Button>
</div>
</div>
</div>
</FormItem>
<Form-item>
<Button
@click="handleSubmit"
:loading="submitLoading"
type="primary"
style="margin-right:5px"
>保存
</Button>
</Form-item>
</Form>
</TabPane>
</Tabs>
</Card>
</Col>
</Row>
<multiple-region ref="region" @selected="handleSelect" @closed="handleClose">
</multiple-region>
</div>
</template>
<script>
import * as API_Shop from "@/api/shops";
import multipleRegion from "@/views/lili-components/multiple-region";
export default {
name: "shipTemplate",
components: {
multipleRegion
},
data() {
return {
item: "", //运费模板子模板
shipInfo: {}, // 运费模板数据
title: "添加运费模板", // 模态框标题
operation: "add", // 操作状态
currentTab: "", // 当前模板tab
saveError: false, // 是否显示错误提示
csTab: false, // 添加运费模板显示
form: {
// 添加或编辑表单对象初始化数据
name: "",
pricingMethod: "WEIGHT"
},
formValidate: {
name: [
{
required: true,
message: "请输入模板名称",
trigger: "blur",
},
],
pricingMethod: [ // 计费方式
{
required: true,
message: "请选择计费方式",
trigger: "blur",
},
],
},
};
},
methods: {
init() {
this.getData();
},
//切换tabPane
handleClickType(v) {
if (v == "INFO") {
this.getData();
this.csTab = false
}
},
//添加运费模板
add() {
this.title = "添加运费模板"
this.csTab = true
this.operation = "ADD"
this.currentTab = "ADD"
this.saveError = false;
this.form = {
pricingMethod: "WEIGHT",
name: "",
freightTemplateChildList: [{
area: "",
areaId: "",
firstCompany: "1",
firstPrice: "",
continuedCompany: "1",
continuedPrice: ""
}]
}
},
//修改运费模板
edit(item) {
this.title = "修改运费模板"
this.csTab = true
this.operation = "EDIT"
this.currentTab = "EDIT"
this.saveError = false;
//给form赋值
this.form = item
},
//选择地区
editRegion(item){
this.item = item
this.$refs.region.open(item)
},
//刷细数据
refresh() {
this.csTab = false
this.operation = "INFO"
this.currentTab = "INFO"
this.getData()
},
//运费模板数据
getData() {
API_Shop.getShipTemplate().then((res) => {
this.shipInfo = res.result
});
},
handleSelect(v) {
let area = ""
let areaId= ""
if(v != ""){
v.forEach((child, index) => {
if(child.selectedList!=""){
child.selectedList.forEach((child, index) => {
area+=child.name +","
areaId+=child.id +","
})
}
})
}
this.item.area = area
this.item.areaId= areaId
},
//添加或者修改运费模板
handleSubmit() {
const headers = {
"Content-Type": "application/json;charset=utf-8"
}
this.$refs.form.validate((valid) => {
const regNumber = /^\+?[1-9][0-9]*$/;
const regMoney = /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/
if (valid) {
//校验运费模板详细信息
for (let i = 0; i < this.form.freightTemplateChildList.length; i++) {
if (this.form.freightTemplateChildList[i].area == ""
|| this.form.freightTemplateChildList[i].firstCompany == ""
|| this.form.freightTemplateChildList[i].firstPrice == ""
|| this.form.freightTemplateChildList[i].continuedCompany == ""
|| this.form.freightTemplateChildList[i].continuedPrice == "") {
this.saveError = true;
return
}
if (regNumber.test(this.form.freightTemplateChildList[i].firstCompany) == false
|| regNumber.test(this.form.freightTemplateChildList[i].continuedCompany) == false
|| regMoney.test(this.form.freightTemplateChildList[i].firstPrice) == false
|| regMoney.test(this.form.freightTemplateChildList[i].continuedPrice) == false) {
this.saveError = true;
return;
}
}
if (this.operation == "ADD") {
API_Shop.addShipTemplate(this.form, headers).then((res) => {
if (res.success) {
this.$Message.success("新增成功");
this.operation = "INFO"
this.currentTab = "INFO"
this.csTab = false
this.getData()
}
});
} else {
API_Shop.editShipTemplate(this.form.id, this.form, headers).then((res) => {
if (res.success) {
this.$Message.success("新增成功");
this.operation = "INFO"
this.currentTab = "INFO"
this.csTab = false
this.getData()
}
});
}
}
})
},
//添加子模板
addShipTemplateChildren() {
const params = {
area: '',
areaId: "",
firstCompany: '1',
firstPrice: '',
continuedCompany: '1',
continuedPrice: ''
}
this.form.freightTemplateChildList.push(params)
},
//删除一个子模板
removeTemplateChildren(index) {
if (Object.keys(this.form.freightTemplateChildList).length == 1) {
this.$Message.success("必须保留一个子模板");
return
}
this.form.freightTemplateChildList.splice(index, 1);
},
//删除运费模板
remove(id) {
this.$Modal.confirm({
title: "确认删除",
// 记得确认修改此处
content: "您确认要删除此运费模板 ?",
loading: true,
onOk: () => {
API_Shop.deleteShipTemplate(id).then((res) => {
if (res.success) {
this.$Message.success("删除成功");
}
this.$Modal.remove();
this.getData();
});
}
});
}
},
mounted() {
this.init();
},
};
</script>
<style lang="scss" scoped>
.ncsc-default-table thead th {
line-height: 20px;
color: #555;
background-color: #FAFAFA;
text-align: center;
height: 20px;
padding: 9px 0;
border-bottom: solid 1px #DDD;
}
.ncsc-default-table {
line-height: 20px;
width: 100%;
border-collapse: collapse;
tbody th {
background-color: #FAFAFA;
border: solid #E6E6E6;
border-width: 1px 0;
padding: 4px 0;
}
tbody td {
color: #999;
background-color: #FFF;
text-align: center;
padding: 6px 0;
}
}
.order tbody tr td {
border-bottom: 1px solid #E6E6E6;
vertical-align: top;
}
.order tbody tr td.bdr {
border-right: 1px solid #E6E6E6;
}
.order tbody tr th {
border: solid 1px #DDD;
}
.order tbody tr td.sep-row {
height: 14px;
border: 0;
}
.w10 {
width: 10px !important;
}
.tl {
text-align: left !important;
}
.order tbody tr td.bdl {
border-left: 1px solid #E6E6E6;
}
.order tbody tr th h3 {
font-size: 14px;
line-height: 20px;
color: #555;
vertical-align: middle;
display: inline-block;
margin: 0 10px;
}
.m-r-5 {
margin-right: 5px !important;
}
.fr {
float: right !important;
}
.m-b-30 {
margin-bottom: 10px !important;
}
Button {
margin: 3px 5px 0px 5px;
}
thead {
display: table-header-group;
vertical-align: middle;
border-color: inherit;
}
tr {
display: table-row;
vertical-align: inherit;
border-color: inherit;
}
caption, th {
text-align: left;
}
.tl {
text-align: left !important;
}
colgroup {
display: table-column-group;
}
button, input, select, textarea {
font-family: inherit;
font-size: inherit;
line-height: inherit;
}
.bd-line td {
border-bottom: solid 1px #EEE;
}
.w40 {
width: 60px !important;
}
.w60 {
width: 80px !important;
}
Input[type="text"], Input[type="password"], Input.text, Input.password {
display: inline-block;
min-height: 20px;
padding: 10px;
border: solid 1px #E6E9EE;
outline: 0 none;
}
.add-on {
line-height: 28px;
background-color: #F6F7Fb;
vertical-align: top;
display: inline-block;
text-align: center;
width: 30px;
height: 30px;
border: solid #E6E9EE;
border-width: 1px 1px 1px 0;
}
ncsc-default-table {
line-height: 20px;
width: 100%;
border-collapse: collapse;
clear: both;
}
.ncsu-trans-type {
background-color: #FFF;
border: solid #DDD 1px;
}
i, cite, em {
font-style: normal;
}
.cell-area {
width: 50%;
}
.div-error {
margin-left: 7px;
margin-bottom: -8px;
font-size: 15px;
color: #F00;
}
</style>

View File

@@ -0,0 +1,362 @@
<template>
<div class="search">
<Row>
<Col>
<Card>
<Row class="operation">
<Button @click="add" type="primary">添加</Button>
</Row>
<Row>
<Table
:loading="loading"
border
:columns="columns"
:data="data"
ref="table"
sortable="custom"
@on-selection-change="changeSelect"
></Table>
</Row>
<Row type="flex" justify="end" class="page">
<Page
:current="searchForm.pageNumber"
:total="total"
:page-size="searchForm.pageSize"
@on-change="changePage"
@on-page-size-change="changePageSize"
:page-size-opts="[10, 20, 50]"
size="small"
show-total
show-elevator
show-sizer
></Page>
</Row>
</Card>
</Col>
</Row>
<Modal
:title="modalTitle"
v-model="modalVisible"
:mask-closable="false"
:width="500"
>
<Form ref="form" :model="form" :label-width="100" :rules="formValidate">
<FormItem label="名称" prop="addressName">
<Input v-model="form.addressName" clearable style="width: 90%"/>
</FormItem>
<FormItem label="详细地址" prop="address">
<Input v-model="form.address" @on-focus="$refs.liliMap.showMap = true" clearable style="width: 90%"/>
</FormItem>
<FormItem label="联系电话" prop="mobile">
<Input v-model="form.mobile" clearable style="width: 90%" maxlength="11"/>
</FormItem>
</Form>
<div slot="footer">
<Button type="text" @click="modalVisible = false">取消</Button>
<Button type="primary" :loading="submitLoading" @click="handleSubmit"
>提交
</Button
>
</div>
</Modal>
<liliMap ref="liliMap" @getAddress="getAddress"></liliMap>
</div>
</template>
<script>
import * as API_Shop from "@/api/shops";
import { validateMobile } from "@/libs/validate";
import liliMap from "@/views/my-components/map/index";
export default {
name: "shopAddress",
components: {
liliMap
},
data() {
return {
loading: true, // 表单加载状态
modalType: 0, // 添加或编辑标识
modalVisible: false, // 添加或编辑显示
modalTitle: "", // 添加或编辑标题
searchForm: {
// 搜索框初始化对象
pageNumber: 1, // 当前页数
pageSize: 10, // 页面大小
},
selectDate: null,
form: {
// 添加或编辑表单对象初始化数据
addressName: "",
center: "",
address:"",//详细地址
mobile:"",//手机号码
},
// 表单验证规则
formValidate: {
addressName: [
{
required: true,
message: "请输入地址名称",
trigger: "blur",
},
],
longitude: [
{
required: true,
message: "请输入地址经度",
trigger: "blur",
},
],
latitude: [
{
required: true,
message: "请输入地址纬度",
trigger: "blur",
},
],
mobile: [
{
required: true,
message: "请输入地址纬度",
trigger: "blur",
},
{ validator: validateMobile,
trigger: "blur"
}
],
address: [
{
required: true,
message: " ",
trigger: "blur",
},
],
},
submitLoading: false, // 添加或编辑提交状态
selectList: [], // 多选数据
selectCount: 0, // 多选计数
columns: [
// 表头
{
title: "自提点名称",
key: "addressName",
minWidth: 120,
sortable: false,
},
{
title: "详细地址",
key: "address",
minWidth: 280
},
{
title: "创建时间",
key: "createTime",
minWidth: 120,
sortable: true,
},
{
title: "操作",
key: "action",
align: "center",
width: 200,
render: (h, params) => {
return h("div", [
h(
"Button",
{
props: {
type: "success",
size: "small",
},
style: {
marginRight: "5px",
},
on: {
click: () => {
this.edit(params.row);
},
},
},
"修改"
),
h(
"Button",
{
props: {
type: "error",
size: "small",
},
style: {
marginRight: "5px",
},
on: {
click: () => {
this.deleteSubmit(params.row);
},
},
},
"删除"
)
]);
},
},
],
data: [], // 表单数据
total: 0, // 表单数据总数
};
},
methods: {
init() {
this.getDataList();
},
changePage(v) {
this.searchForm.pageNumber = v;
this.getDataList();
this.clearSelectAll();
},
changePageSize(v) {
this.searchForm.pageSize = v;
this.getDataList();
},
handleSearch() {
this.searchForm.pageNumber = 1;
this.searchForm.pageSize = 10;
this.getDataList();
},
handleReset() {
this.$refs.searchForm.resetFields();
this.searchForm.pageNumber = 1;
this.searchForm.pageSize = 10;
// 重新加载数据
this.getDataList();
},
clearSelectAll() {
this.$refs.table.selectAll(false);
},
changeSelect(e) {
this.selectList = e;
this.selectCount = e.length;
},
//获取地址
getAddress(item){
this.$set(this.form, 'address', item.addr)
this.form.address = item.address
this.form.center = item.position.lat + "," + item.position.lng
},
getDataList() {
this.loading = true;
API_Shop.getShopAddress(this.searchForm).then((res) => {
this.loading = false;
if (res.success) {
this.data = res.result.records;
this.total = res.result.total;
}
});
this.total = this.data.length;
this.loading = false;
},
//添加弹出框
add() {
this.$refs.form.resetFields()
this.modalVisible = true
this.modalTitle = "添加自提地址"
},
//修改弹出框
edit(v) {
this.modalType = 1
this.modalVisible = true
this.modalTitle = "修改自提地址"
this.form.id = v.id
this.form.address = v.address
this.form.addressName = v.addressName
this.form.mobile = v.mobile
this.form.center = v.center
this.form.longitude = v.center.split(',')[0]
this.form.latitude = v.center.split(',')[1]
},
//保存或者编辑
handleSubmit() {
this.$refs.form.validate((valid) => {
if (valid) {
this.submitLoading = true;
if (this.modalType == 0) {
// 添加
delete this.form.id;
API_Shop.addShopAddress(this.form).then((res) => {
this.submitLoading = false;
if (res.success) {
this.$Message.success("添加成功");
this.getDataList();
this.modalVisible = false;
}
});
} else {
// 编辑
API_Shop.editShopAddress(this.form.id, this.form).then((res) => {
this.submitLoading = false;
if (res.success) {
this.$Message.success("修改成功");
this.getDataList();
this.modalVisible = false;
}
});
}
}
});
},
//删除提交
deleteSubmit(v){
this.$Modal.confirm({
title: "确认删除",
// 记得确认修改此处
content: "确认删除自提地址么?",
loading: true,
onOk: () => {
API_Shop.deleteShopAddress(v.id).then((res) => {
this.$Modal.remove();
if (res.code == 200) {
this.$Message.success("此自自提地址已删除");
this.init();
}
});
}
});
}
},
mounted() {
this.init();
},
};
</script>
<style lang="scss">
// 建议引入通用样式 可删除下面样式代码
// @import "@/styles/table-common.scss";
.search {
.operation {
margin-bottom: 2vh;
}
.select-count {
font-weight: 600;
color: #40a9ff;
}
.select-clear {
margin-left: 10px;
}
.page {
margin-top: 2vh;
}
.drop-down {
margin-left: 5px;
}
}
</style>

View File

@@ -0,0 +1,311 @@
<template>
<div class="search">
<Row>
<Col>
<Card style="margin-left: 10px">
<Tabs @on-click="handleClickType">
<TabPane label="基本信息" name="INFO">
<Form ref="form" :model="form" :label-width="100" :rules="formValidate">
<FormItem label="店铺名称">
<Input v-model="storeName" disabled clearable style="width: 20%" />
</FormItem>
<FormItem label="店铺地址" prop="address">
<Input v-model="form.address" @on-focus="$refs.liliMap.showMap = true" clearable style="width: 20%" />
</FormItem>
<FormItem label="详细地址" prop="shopAddressDetail">
<Input v-model="form.storeAddressDetail" clearable style="width: 20%" maxlength="50" />
</FormItem>
<FormItem label="店铺LOGO">
<upload-pic-thumb v-model="form.storeLogo" :multiple="false"></upload-pic-thumb>
</FormItem>
<FormItem label="店铺简介" prop="content" class="wangEditor">
<editor v-model="form.storeDesc" style="width: 30%"></editor>
</FormItem>
<Form-item>
<Button @click="handleSubmit" :loading="submitLoading" type="primary" style="margin-right:5px">修改
</Button>
</Form-item>
</Form>
</TabPane>
<TabPane label="退货地址" name="REFUND_GOODS_ADDRESS">
<Form ref="addressForm" :model="addressForm" :label-width="100" :rules="afterFormValidate">
<FormItem label="收货人" prop="salesConsigneeName">
<Input v-model="addressForm.salesConsigneeName" maxlength="11" clearable style="width: 20%" />
</FormItem>
<FormItem label="收货人电话" prop="salesConsigneeMobile">
<Input v-model="addressForm.salesConsigneeMobile" maxlength="11" style="width: 20%" />
</FormItem>
<FormItem label="售后地址">
<Input v-model="region" disabled style="width: 20%" v-if="showRegion == false" />
<Button v-if="showRegion == false" @click="regionClick" :loading="submitLoading" type="primary" style="margin-left:8px">修改
</Button>
<region style="width: 20%" @selected="selectedRegion" v-if="showRegion == true" />
</FormItem>
<FormItem label="详细地址" prop="salesConsigneeDetail">
<Input v-model="addressForm.salesConsigneeDetail" clearable style="width: 20%" maxlength="50" />
</FormItem>
<Form-item>
<Button @click="afterHandleSubmit" :loading="submitLoading" type="primary" style="margin-right:5px">修改
</Button>
</Form-item>
</Form>
</TabPane>
<TabPane label="库存预警" name="STOCK_WARNING">
<Form ref="stockWarningForm" :model="stockWarningForm" :label-width="100" :rules="stockWarningFormValidate">
<FormItem label="预警数" prop="stockWarning">
<Input v-model="stockWarningForm.stockWarning" type="number" maxlength="6" clearable style="width: 20%" />
</FormItem>
<Form-item>
<Button @click="stockWarningHandleSubmit" :loading="submitLoading" type="primary" style="margin-right:5px">修改
</Button>
</Form-item>
</Form>
</TabPane>
</Tabs>
</Card>
</Col>
</Row>
<liliMap ref="liliMap" @getAddress="getAddress"></liliMap>
</div>
</template>
<script>
import * as API_Shop from "@/api/shops";
import { validateMobile } from "@/libs/validate";
import uploadPicThumb from "@/views/my-components/lili/upload-pic-thumb";
import editor from "@/views/my-components/lili/editor";
import liliMap from "@/views/my-components/map/index";
import region from "@/views/lili-components/region";
import * as RegExp from "@/libs/RegExp.js";
import Cookies from 'js-cookie'
export default {
name: "shopSetting",
components: {
uploadPicThumb,
editor,
liliMap,
region,
},
data() {
return {
showRegion: false, // 选择地址模态框显隐
storeName: "", //店铺名称
region: [], // 地区名称
regionId: [], // 地区id
addressForm: { // 退货地址
salesConsigneeName: "", // 收货人姓名
salesConsigneeMobile: "", // 收货人电话
salesConsigneeAddressId: "", // 售后地址id,逗号分割
salesConsigneeAddressPath: "",// 售后地址,逗号分割
salesConsigneeDetail: "", // 详细地址
},
//库存预警form
stockWarningForm: {
stockWarning: "", // 库存预警数量
},
stockWarningFormValidate: {
stockWarning: [
{ required: true, message: "请输入库存预警数", trigger: "blur" },
],
},
afterFormValidate: {
salesConsigneeMobile: [
{ required: true, message: "手机号不能为空", trigger: "blur" },
{
pattern: RegExp.mobile,
trigger: "blur",
message: "请输入正确的手机号",
},
],
salesConsigneeName: [
{ required: true, message: "请输入收货人", trigger: "blur" },
],
salesConsigneeDetail: [
{ required: true, message: "请输入详细地址", trigger: "blur" },
],
},
form: {
// 添加或编辑表单对象初始化数据
storeAddressPath: "", // 店铺地址中文
center: "", // 经度 + 纬度
longitude: "", //经度
latitude: "", //纬度
storeAddressDetail: "", //详细地址
storeAddressIdPath: "", //地址
storeDesc: "", // 店铺描述
},
// 表单验证规则
formValidate: {
addressName: [
{
required: true,
message: "请输入地址名称",
trigger: "blur",
},
],
longitude: [
{
required: true,
message: "请输入地址经度",
trigger: "blur",
},
],
latitude: [
{
required: true,
message: "请输入地址纬度",
trigger: "blur",
},
],
mobile: [
{
required: true,
message: "请输入地址纬度",
trigger: "blur",
},
{
validator: validateMobile,
trigger: "blur",
},
],
storeAddressDetail: [
{
required: true,
message: "请输入详细地址",
trigger: "blur",
},
],
},
submitLoading: false, // 添加或编辑提交状态
};
},
methods: {
init() {
this.getShopInfo();
},
//获取店铺信息
getShopInfo() {
this.loading = true;
API_Shop.getShopInfo().then((res) => {
this.loading = false;
if (res.success) {
this.form = res.result;
this.$set(this.form, "address", res.result.storeAddressPath);
this.storeName = res.result.storeName;
this.form.center = res.result.storeCenter;
Cookies.set("userInfo", JSON.stringify(res.result));
//库存预警数赋值
this.$nextTick(() => {
this.stockWarningForm.stockWarning = res.result.stockWarning+"";
});
}
});
},
//修改售后地址
regionClick() {
this.showRegion = true;
this.regionId = "";
},
//重置
handleReset() {
this.$refs.form.resetFields();
},
//提交保存
handleSubmit() {
this.$refs.form.validate((valid) => {
if (valid) {
this.submitLoading = true;
API_Shop.saveShopInfo(this.form).then((res) => {
this.submitLoading = false;
if (res.success) {
this.$Message.success("修改成功");
this.getShopInfo();
}
});
}
});
},
//修改库存预警数
stockWarningHandleSubmit() {
this.$refs.stockWarningForm.validate((valid) => {
if (valid) {
this.submitLoading = true;
API_Shop.updateStockWarning(this.stockWarningForm).then((res) => {
this.submitLoading = false;
if (res.success) {
this.$Message.success("修改成功");
this.getShopInfo();
}
});
}
});
},
// 选中的地址
selectedRegion(val) {
this.region = val[1];
this.regionId = val[0];
},
//tab切换
handleClickType(v) {
//退款
if (v == "INFO") {
this.getShopInfo();
}
//退货
if (v == "REFUND_GOODS_ADDRESS") {
this.getRefundGoodsAddress();
}
},
//获取商家退货地址
getRefundGoodsAddress() {
API_Shop.getRefundGoodsAddress().then((res) => {
if (res.result != null) {
this.addressForm = res.result;
this.regionId = res.result.salesConsigneeAddressId;
this.region = res.result.salesConsigneeAddressPath;
}
});
},
//提交保存
afterHandleSubmit() {
if (this.regionId == "") {
this.$Message.error("请选择地址");
return;
}
this.$refs.addressForm.validate((valid) => {
if (valid) {
this.addressForm.salesConsigneeAddressPath = this.region;
this.addressForm.salesConsigneeAddressId = this.regionId;
this.submitLoading = true;
API_Shop.saveRefundGoodsAddress(this.addressForm).then((res) => {
this.submitLoading = false;
if (res.success) {
this.$Message.success("修改成功");
this.getRefundGoodsAddress();
this.showRegion = false;
}
});
}
});
},
//获取地址
getAddress(item) {
this.$set(this.form, "address", item.addr);
this.form.storeAddressPath = item.addr;
this.form.storeAddressIdPath = item.addrId;
this.form.center = item.position.lat + "," + item.position.lng;
},
},
mounted() {
this.init();
},
};
</script>