Merge remote-tracking branch 'origin/feat-config-0609-xwk' into msb_prod

merge-requests/1/head
ch 2 years ago
commit 8dd6bddb50

@ -0,0 +1,14 @@
import request from '@/utils/request.js';
export const search = () => {
return request({
url: '/mall/base/orderConfig/getOrderConfig',
method: 'get',
});
};
export const update = (data) => {
return request({
url: '/mall/base/orderConfig/saveOrUpdate',
method: 'post',
data,
});
};

@ -0,0 +1,29 @@
import * as api from '@/api/config/order.js';
import { ElMessage } from '@/plugins/element-plus';
const state = () => ({});
const getters = {};
const mutations = {};
const actions = {
search: async () => {
let res = await api.search();
if (!res) {
ElMessage.error('查询订单配置失败');
}
return res;
},
update: async (context, data) => {
let res = await api.update(data);
if (res) {
ElMessage.success('保存订单配置成功');
} else {
ElMessage.error('保存订单配置失败');
}
return res;
},
};
export default {
state,
getters,
mutations,
actions,
};

@ -0,0 +1,133 @@
<template>
<div class="list-container">
<el-form ref="refsForm" v-loading="state.loading" label-width="150px" :model="state.form" :rules="state.rules">
<el-form-item label="订单创建超过" prop="orderPayExpire">
<el-input-number v-model="state.form.orderPayExpire" :clearable="false" :controls="false" :min="1" />
<div class="unit"></div>
<p>未付款订单自动关闭</p>
</el-form-item>
<el-form-item label="订单发货超过" prop="automaticReceipt">
<el-input-number v-model="state.form.automaticReceipt" :clearable="false" :controls="false" :min="1" />
<p class="unit"></p>
<p>未收货订单自动完成</p>
</el-form-item>
<el-form-item label="订单完成超过" prop="afterSalesExpire">
<el-input-number v-model="state.form.afterSalesExpire" :clearable="false" :controls="false" :min="1" />
<p class="unit"></p>
<p>自动结束交易不能申请售后</p>
</el-form-item>
<el-form-item label="订单完成超过" prop="automaticPraise">
<el-input-number v-model="state.form.automaticPraise" :clearable="false" :controls="false" :min="1" />
<p class="unit"></p>
<p>自动五星好评</p>
</el-form-item>
<el-form-item label="售后申请超过" prop="afterSalesApplicationExpire">
<el-input-number
v-model="state.form.afterSalesApplicationExpire"
:clearable="false"
:controls="false"
:min="1"
/>
<p class="unit"></p>
<p>商家未处理自动通过审核</p>
</el-form-item>
<el-form-item label="退货订单超过" prop="merchantReceiptExpire">
<el-input-number
v-model="state.form.merchantReceiptExpire"
:clearable="false"
:controls="false"
:min="1"
/>
<p class="unit"></p>
<p>未填写物流自动取消售后</p>
</el-form-item>
<el-form-item label="填写退货物流超过" prop="returnGoodsExpire">
<el-input-number v-model="state.form.returnGoodsExpire" :clearable="false" :controls="false" :min="1" />
<p class="unit"></p>
<p>商家未处理自动通过退货</p>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleUpdate"></el-button>
</el-form-item>
</el-form>
</div>
</template>
<script setup>
const { proxy } = getCurrentInstance();
const store = useStore();
const refsForm = ref(null);
const state = reactive({
loading: false,
form: {
orderPayExpire: 30,
automaticReceipt: 7,
afterSalesExpire: 15,
automaticPraise: 7,
afterSalesApplicationExpire: 7,
merchantReceiptExpire: 7,
returnGoodsExpire: 7,
},
rules: {
orderPayExpire: [{ required: true, message: '订单创建超时自动关闭不能为空' }],
automaticReceipt: [{ required: true, message: '订单发货超时自动完成不能为空' }],
afterSalesExpire: [{ required: true, message: '订单完成超时自动结束交易不能为空' }],
automaticPraise: [{ required: true, message: '订单完成超时自动五星好评不能为空' }],
afterSalesApplicationExpire: [{ required: true, message: '售后申请超时自动审核通过不能为空' }],
merchantReceiptExpire: [{ required: true, message: '退货订单填写物流超时自动取消售后不能为空' }],
returnGoodsExpire: [{ required: true, message: '填写退货物流超时自动通过退货不能为空' }],
},
});
const handleSearch = async () => {
state.loading = true;
let res = await store.dispatch('orderConfig/search');
Object.assign(state.form, res);
state.loading = false;
};
handleSearch();
const handleUpdate = async () => {
state.loading = true;
try {
await proxy.$validate(refsForm);
await store.dispatch('orderConfig/update', state.form);
} catch (e) {
console.info('取消保存', e);
}
state.loading = false;
};
</script>
<style lang="less" scoped>
.list-container {
display: flex;
justify-content: center;
align-items: center;
.el-form {
:deep(.el-form-item__content) {
flex-wrap: nowrap;
.el-input-number {
width: 60px;
input {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
text-align: center;
}
}
.unit {
margin: 0;
padding: 0 @layout-space;
background: #f1f1f1;
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
position: relative;
left: -1px;
box-shadow: 0 0 0 1px #dcdfe6 inset;
}
p {
min-width: max-content;
margin-left: @layout-space;
}
}
}
}
</style>
Loading…
Cancel
Save