Commit 3bef55dc by chenxin

fix: 通用配置

parent 062d60f5
...@@ -63,9 +63,35 @@ let realGift = { ...@@ -63,9 +63,35 @@ let realGift = {
useFormData: true, useFormData: true,
}, // 虚拟礼品卡密卡号上传 }, // 虚拟礼品卡密卡号上传
}; };
realGift = getFetch(realGift, welfarePrefix);
export default { ...realGift }; // 通用配置
let setting = {
updateConfig: {
url: '/config/update-config',
method: 'post',
headers: { 'Content-Type': 'application/json' }
},
getConfigDetail: '/config/get-config-detail',
getAddressList: '/address/get-address-list',
getAddressDetails: 'address/get-address-details',
delAddress: '/address/del-address',
insertOrUpdateAddress: { // 新增或修改退货地址
url: '/address/insert-or-update-address',
method: 'post',
headers: { 'Content-Type': 'application/json' }
},
pickupList: '/pickup/get-pickup-list',
getPickupDetails: '/pickup/get-pickup-details',
delPickup: '/pickup/del-pickup',
insertPickupStore: { // 新增或修改自提点
url: '/pickup/insert-pickup-store',
method: 'post',
headers: { 'Content-Type': 'application/json' }
},
};
realGift = getFetch(realGift, welfarePrefix);
setting = getFetch(setting, welfarePrefix);
export default { ...realGift, ...setting };
export const getGiftLoginUser = config.api + commonPrefix + '/user/get-login-user'; // 获取商户名称 export const getGiftLoginUser = config.api + commonPrefix + '/user/get-login-user'; // 获取商户名称
This source diff could not be displayed because it is too large. You can view the blob instead.
import Layout from '@/components/layout/layout';
export default [
{
path: '/gift-manage', // 库存记录
component: Layout,
redirect: '/gift-manage/stock-record',
children: [
{
path: 'stock-record',
component: () => import('@/views/gift-manage/stock-record.vue'),
},
// {
// path: 'virtual-gift-detail',
// component: () => import('@/views/gift-manage/virtual-gift-detail.vue'),
// }
],
},
// ****通用配置开始****
{
path: '/setting',
component: Layout,
redirect: '/setting/sales-return-setting',
children: [
{
path: 'sales-return-setting', // 退货单设置
component: () => import('@/views/gift-manage/sales-return-setting.vue'),
},
{
path: 'address-lib-list', // 地址库管理
component: () => import('@/views/gift-manage/address-lib-list.vue'),
},
{
path: 'address-lib-add', // 新建地址库
component: () => import('@/views/gift-manage/address-lib-form.vue'),
meta: {
type: 'add',
path: '/settinge/address-lib-list'
}
},
{
path: 'address-lib-edit', // 编辑地址库
component: () => import('@/views/gift-manage/address-lib-form.vue'),
meta: {
type: 'edit',
path: '/settinge/address-lib-list'
}
},
{
path: 'pickup-list', // 自提点管理列表
component: () => import('@/views/gift-manage/pickup-list.vue'),
},
{
path: 'pickup-add', // 新建自提点
component: () => import('@/views/gift-manage/pickup-form.vue'),
meta: {
type: 'add',
path: '/settinge/pickup-list'
}
},
{
path: 'pickup-edit', // 编辑自提点
component: () => import('@/views/gift-manage/pickup-form.vue'),
meta: {
type: 'edit',
path: '/settinge/pickup-list'
}
},
],
},
// ****通用配置结束****
];
\ No newline at end of file
...@@ -4,14 +4,14 @@ import cardPackage from './card-package'; ...@@ -4,14 +4,14 @@ import cardPackage from './card-package';
import realGift from './real-gift'; import realGift from './real-gift';
import Layout from '@/components/layout/layout'; import Layout from '@/components/layout/layout';
import virtualGift from './virtual-gift'; import virtualGift from './virtual-gift';
import stockRecord from './stock-record'; import giftOther from './gift-other';
export const asyncRoutes = [ export const asyncRoutes = [
...gicCard, ...gicCard,
...cardPackage, ...cardPackage,
...realGift, ...realGift,
...virtualGift, ...virtualGift,
...stockRecord, ...giftOther,
]; ];
......
import Layout from '@/components/layout/layout';
export default [
{
path: '/gift-manage',
component: Layout,
redirect: '/gift-manage/stock-record',
children: [
{
path: 'stock-record',
component: () => import('@/views/gift-manage/stock-record.vue'),
},
// {
// path: 'virtual-gift-detail',
// component: () => import('@/views/gift-manage/virtual-gift-detail.vue'),
// }
],
},
];
\ No newline at end of file
...@@ -177,3 +177,51 @@ export const toLog = (appCode, id, name, ecuId) => { ...@@ -177,3 +177,51 @@ export const toLog = (appCode, id, name, ecuId) => {
// return year + '-' + month + '-' + date + ' ' + hour + ':' + minute + ':' + second; // return year + '-' + month + '-' + date + ' ' + hour + ':' + minute + ':' + second;
// }; // };
//
/**
* 时间戳转换成时分秒
* @param {String} time 时间
* @returns {String}
*/
export const getSeconds = (time) => {
if (!isNaN(time)) time = Number(time);
let now = new Date(time);
let hour = now.getHours();
hour >= 10 && (hour = '0' + hour); // 判断小于10的时的情况
let minute = now.getMinutes();
minute >= 10 && (minute = '0' + minute); // 判断小于10的分的情况
let second = now.getSeconds();
second >= 10 && (second = '0' + second); // 判断小于10的秒的情况
return hour + ':' + minute + ':' + second;
};
/**
* 时间戳转换成时分08:10
* @param {String} time 时间
* @returns {String}
*/
export const getHours = (time) => {
if (!isNaN(time)) time = Number(time);
let now = new Date(time);
let hour = now.getHours();
hour >= 10 && (hour = '0' + hour); // 判断小于10的时的情况
let minute = now.getMinutes();
minute >= 10 && (minute = '0' + minute); // 判断小于10的分的情况
return hour + ':' + minute;
};
/**
* 时间戳转换成时分8:10
* @param {String} time 时间
* @returns {String}
*/
export const getHours2 = (time) => {
if (!isNaN(time)) time = Number(time);
let now = new Date(time);
let hour = now.getHours();
// hour >= 10 ? (hour = hour) : (hour = '0' + hour); //判断小于10的时的情况
let minute = now.getMinutes();
// minute >= 10 ? (minute = minute) : (minute = '0' + minute); //判断小于10的分的情况
return hour + ':' + minute;
};
\ No newline at end of file
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
<el-form-item> <el-form-item>
<el-button type="primary" v-if="isAdd" @click="addForm">确认新建</el-button> <el-button type="primary" v-if="isAdd" @click="addForm">确认新建</el-button>
<el-button type="primary" :disabled="ruleForm.packageStock == info.packageStock" v-else @click="editForm">保存</el-button> <el-button type="primary" :disabled="ruleForm.packageStock == info.packageStock" v-else @click="editForm">保存</el-button>
<el-button @click="$router.go(-1)">返回</el-button>
</el-form-item> </el-form-item>
<el-form-item v-if="!isAdd" class="is-required"> <el-form-item v-if="!isAdd" class="is-required">
<el-tooltip content="若添加的卡券为固定有效期,仅允许添加和有效期限时间重合的卡券" placement="bottom" slot="label" open-delay="200"> <el-tooltip content="若添加的卡券为固定有效期,仅允许添加和有效期限时间重合的卡券" placement="bottom" slot="label" open-delay="200">
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.useCouponSize }}/{{ scope.row.totalCouponSize }} {{ scope.row.useCouponSize }}/{{ scope.row.totalCouponSize }}
<el-tooltip content="存在已过期或已删除的卡券" placement="top" open-delay="200" v-if="scope.row.totalCouponSize > scope.row.useCouponSize"> <el-tooltip content="存在已过期或已删除的卡券" placement="top" open-delay="200" v-if="scope.row.totalCouponSize > scope.row.useCouponSize">
<i class="el-icon-warning ml5"></i> <i class="el-icon-warning ml5 danger-color cursor"></i>
</el-tooltip> </el-tooltip>
</template> </template>
</el-table-column> </el-table-column>
......
...@@ -157,7 +157,6 @@ ...@@ -157,7 +157,6 @@
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="submitForm" v-if="!isInfo">保存</el-button> <el-button type="primary" @click="submitForm" v-if="!isInfo">保存</el-button>
<el-button @click="$router.go(-1)">返回</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
......
...@@ -135,7 +135,6 @@ export default { ...@@ -135,7 +135,6 @@ export default {
this.formatterTimeFunc('giveBeginTime', 'giveEndTime', 'yyyy-MM-dd', 'dateTime'); this.formatterTimeFunc('giveBeginTime', 'giveEndTime', 'yyyy-MM-dd', 'dateTime');
this.formatterTimeFunc('receiveBeginTime', 'receiveEndTime', 'yyyy-MM-dd', 'dateTime2'); this.formatterTimeFunc('receiveBeginTime', 'receiveEndTime', 'yyyy-MM-dd', 'dateTime2');
let params = { ...this.listParams, memberCardId: this.currentAreaId }; let params = { ...this.listParams, memberCardId: this.currentAreaId };
// TODO: search
giveLogList(params).then(res => { giveLogList(params).then(res => {
this.loading = false; this.loading = false;
const data = res.result; const data = res.result;
......
<template>
<div class="p20">
<el-form ref="ruleForm" :model="ruleForm" label-width="120px" :rules="rules" style="width:600px;">
<el-form-item prop="type" label="地址类型">
<el-radio-group v-model="ruleForm.type">
<el-radio :label="1">退货地址</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item prop="defaultFlag" label="是否默认">
<el-switch :active-value="1" :inactive-value="0" v-model="ruleForm.defaultFlag"></el-switch>
</el-form-item>
<el-form-item prop="contact" label="联系人">
<el-input v-model="ruleForm.contact" :maxlength="20" show-word-limit></el-input>
</el-form-item>
<el-form-item prop="phone" label="手机号">
<dm-input-phone style="width:100%;" v-model="ruleForm.phone" show-word-limit></dm-input-phone>
</el-form-item>
<el-form-item prop="tel" label="电话">
<el-input v-model="tel1" :maxlength="20" style="width:120px;" placeholder="请填写区号"></el-input><span class="ml5 mr5 gray02">-</span>
<el-input v-model="tel2" :maxlength="20" style="width:120px;" placeholder="请填写座机号"></el-input><span class="ml5 mr5 gray02">-</span>
<el-input v-model="tel3" :maxlength="20" style="width:120px;" placeholder="请填写分机号"></el-input>
</el-form-item>
<el-form-item prop="cityIds" label="所在地区">
<el-cascader v-model="cityIds" style="width:100%;" :options="cityList"></el-cascader>
</el-form-item>
<el-form-item prop="address" label="详细地址">
<el-input type="textarea" placeholder="请不要重复填写省市区" v-model="ruleForm.address" :maxlength="50" show-word-limit></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm()">{{ addressId ? '保存' : '确认新建' }}</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
import api from '@/api/gift.js';
import cityList from '@/assets/city.json';
import { isEmpty } from '@/utils/index';
const { getAddressDetails, insertOrUpdateAddress } = api;
export default {
data() {
let phoneValidator = (rule, value, callback) => {
let reg = /^1[34578]\d{9}$/;
if (value !== '') {
if (!reg.test(value)) {
callback(new Error('手机号码不符合规则'));
} else {
callback();
}
} else {
callback();
}
};
let cityValidator = (rule, value, callback) => {
if(this.cityIds.length == 0) {
callback(new Error('请填写省市区'));
return;
}
callback();
};
let telValidator = (rule, value, callback) => {
const { tel1, tel2, tel3 } = this;
const arr = [ tel1, tel2, tel3 ];
if(arr.filter(v => isEmpty(v)).length == 3) {
// 可以都不填
callback();
return;
}
if(arr.some(v => isEmpty(v))) {
callback(new Error('电话填写不完整'));
return;
}
if(arr.some(v => !/^[0-9]*$/.test(v))) {
callback(new Error('请输入数字'));
return;
}
callback();
};
return {
loading: false,
addressId: this.$route.query.id,
ruleForm: {
type: 1,
defaultFlag: 0,
contact: '',
phone: '',
address: ''
},
rules: {
contact: [ { required: true, message: '联系人不能为空', trigger: 'blur' } ],
phone: [ { validator: phoneValidator, trigger: 'blur' } ],
cityIds: [ { required: true, validator: cityValidator, trigger: 'change' } ],
address: [ { required: true, message: '详细地址不能为空', trigger: 'blur' } ],
tel: [ { validator: telValidator, trigger: 'blur' } ],
},
tel1: '',
tel2: '',
tel3: '',
cityIds: [],
cityList
};
},
mounted() {
if(this.addressId) {
this.getInfo();
}
},
created() {
this.$emit('updateBread', [ { breadName: '福利中心' }, { breadName: '通用设置' }, { breadName: '地址库管理', breadPath: '/setting/address-lib-list' }, { breadName: (this.addressId ? '编辑' : '新建') + '地址库' } ]);
},
methods: {
submitForm() {
this.$refs.ruleForm.validate((valid) => {
if (!valid) {
return;
} else {
if (this.ruleForm.phone === '' && this.tel1 == '') {
this.$message.error('手机号码和电话至少填写一个');
return;
}
this.loading = true;
const { type, defaultFlag, contact, phone, address } = this.ruleForm;
let params = {
type,
defaultFlag,
contact,
phone,
address,
provinceId: this.cityIds[0],
cityId: this.cityIds[1],
countyId: this.cityIds[2],
tel: this.tel1 ? `${this.tel1},${this.tel2},${this.tel3}` : ''
};
if(this.addressId) {
params.addressId = this.addressId;
}
insertOrUpdateAddress(params).then(res => {
this.loading = false;
this.$tips({ message: '操作成功', type: 'success' });
this.$router.push('/setting/address-lib-list');
}).catch(() => {
this.loading = false;
});
}
});
},
getInfo() {
this.loading = true;
getAddressDetails().then(res => {
Object.keys(this.ruleForm).map(key => {
const info = res.result || {};
if (key in res.result) {
this.ruleForm[key] = info[key];
}
if(info.tel) {
const tel = info.tel.join(',');
this.tel1 = tel[0];
this.tel2 = tel[1];
this.tel3 = tel[2];
}
this.cityIds = [ info.provinceId, info.cityId, info.countyId ];
});
this.loading = false;
}).catch(() => {
this.loading = false;
});
},
}
};
</script>
<template>
<div class="p20" v-loading="loading">
<div class="pb20 clearfix flex-center">
<el-button type="primary" class="mlAuto" @click="$router.push('/setting/address-lib-add')">新建地址</el-button>
</div>
<el-table tooltip-effect="dark" :data="tableList" style="width:100%">
<el-table-column prop="contact" label="联系人"> </el-table-column>
<el-table-column prop="phone" label="联系方式"> </el-table-column>
<el-table-column prop="address" label="地址"> </el-table-column>
<el-table-column label="地址类型">
<template slot-scope="scope">
<el-tag v-if="scope.row.defaultFlag" class="mr5">默认</el-tag>
{{ scope.row.type == 1 ? '退款地址' : '--' }}
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button type="text" @click="$router.push(`/setting/address-lib-add?id=${scope.row.addressId}`)">编辑</el-button>
<dm-delete @confirm="del(scope.row)" tips="确认删除?">
<el-button type="text">删除</el-button>
</dm-delete>
</template>
</el-table-column>
</el-table>
</div>
</template>
<script>
import { page } from '@/mixins/table.js';
import fetch from '@/api/gift.js';
const { getAddressList, delAddress } = fetch;
export default {
name: 'AddressLibList',
mixins: [ page ],
data() {
return {
loading: false,
listParams: {
currentPage: 1,
pageSize: 20,
},
total: 0,
tableList: [],
dialogVisible: false,
addressId: '',
};
},
created() {
this.$emit('updateBread', [ { breadName: '福利中心' }, { breadName: '通用设置' }, { breadName: '地址库管理' } ]);
},
mounted() {
this.getTableList();
},
methods: {
del({ addressId }) {
this.loading = true;
delAddress({ addressId: addressId })
.then(res => {
this.loading = false;
this.$tips({ type: 'success', message: '删除成功' });
this.getTableList();
})
.finally(() => {
this.loading = false;
});
},
getTableList() {
if(this.loading) {
return;
}
this.loading = true;
getAddressList().then(res => {
this.loading = false;
this.tableList = res.result || []; // 无分页
}).finally(() => {
this.loading = false;
});
},
},
};
</script>
<template>
<el-dialog :title="`${addressId ? '编辑' : '新建'}地址`" :visible.sync="dialogVisible" width="600px" @close="close">
<el-form ref="ruleForm" :model="ruleForm" label-width="120px" :rules="rules" class="pr10">
<el-form-item prop="type" label="地址类型">
<el-radio-group v-model="ruleForm.type">
<el-radio :label="1">退货地址</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item prop="defaultFlag" label="是否默认">
<el-switch :active-value="1" :inactive-value="0" v-model="ruleForm.defaultFlag"></el-switch>
</el-form-item>
<el-form-item prop="contact" label="联系人">
<el-input v-model="ruleForm.contact" :maxlength="20" show-word-limit></el-input>
</el-form-item>
<el-form-item prop="phone" label="手机号">
<dm-input-phone style="width:100%;" v-model="ruleForm.phone" show-word-limit></dm-input-phone>
</el-form-item>
<el-form-item prop="tel" label="电话">
<el-input v-model="tel1" :maxlength="20" style="width:120px;" placeholder="请填写区号"></el-input><span class="ml5 mr5 gray02">-</span>
<el-input v-model="tel2" :maxlength="20" style="width:120px;" placeholder="请填写座机号"></el-input><span class="ml5 mr5 gray02">-</span>
<el-input v-model="tel3" :maxlength="20" style="width:120px;" placeholder="请填写分机号"></el-input>
</el-form-item>
<el-form-item prop="cityIds" label="所在地区">
<el-cascader v-model="cityIds" style="width:100%;" :options="cityList"></el-cascader>
</el-form-item>
<el-form-item prop="address" label="详细地址">
<el-input type="textarea" placeholder="请不要重复填写省市区" v-model="ruleForm.address" :maxlength="50" show-word-limit></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="close">取消</el-button>
<el-button type="primary" @click="submitForm()">{{ addressId ? '保存' : '确认新建' }}</el-button>
</div>
</el-dialog>
</template>
<script>
import api from '@/api/gift.js';
import cityList from '@/assets/city.json';
import { isEmpty } from '@/utils/index';
const { getAddressDetails, insertOrUpdateAddress } = api;
const defaultForm = {
type: 1,
defaultFlag: 0,
contact: '',
phone: '',
address: ''
};
export default {
props: {
dialogVisible: {
type: Boolean,
default() {
return {};
}
},
addressId: {
type: String,
default: ''
}
},
data() {
let phoneValidator = (rule, value, callback) => {
let reg = /^1[34578]\d{9}$/;
if (value !== '') {
if (!reg.test(value)) {
callback(new Error('手机号码不符合规则'));
} else {
callback();
}
} else {
callback();
}
};
let cityValidator = (rule, value, callback) => {
if(this.cityIds.length == 0) {
callback(new Error('请填写省市区'));
return;
}
callback();
};
let telValidator = (rule, value, callback) => {
const { tel1, tel2, tel3 } = this;
const arr = [ tel1, tel2, tel3 ];
if(arr.filter(v => isEmpty(v)).length == 3) {
// 可以都不填
callback();
return;
}
if(arr.some(v => isEmpty(v))) {
callback(new Error('电话填写不完整'));
return;
}
if(arr.some(v => !/^[0-9]*$/.test(v))) {
callback(new Error('请输入数字'));
return;
}
callback();
};
return {
loading: false,
ruleForm: {
...defaultForm
},
rules: {
contact: [ { required: true, message: '联系人不能为空', trigger: 'blur' } ],
phone: [ { validator: phoneValidator, trigger: 'blur' } ],
cityIds: [ { required: true, validator: cityValidator, trigger: 'change' } ],
address: [ { required: true, message: '详细地址不能为空', trigger: 'blur' } ],
tel: [ { validator: telValidator, trigger: 'blur' } ],
},
tel1: '',
tel2: '',
tel3: '',
cityIds: [],
cityList
};
},
methods: {
close() {
this.$emit('update:dialogVisible', false);
this.$emit('update:dialogVisible', false);
this.ruleForm = { ...defaultForm };
this.tel1 = '';
this.tel2 = '';
this.tel3 = '';
this.cityIds = [];
},
submitForm() {
this.$refs.ruleForm.validate((valid) => {
if (!valid) {
return;
} else {
if (this.ruleForm.phone === '' && this.tel1 == '') {
this.$message.error('手机号码和电话至少填写一个');
return;
}
this.loading = true;
const { type, defaultFlag, contact, phone, address } = this.ruleForm;
let params = {
type,
defaultFlag,
contact,
phone,
address,
provinceId: this.cityIds[0],
cityId: this.cityIds[1],
countyId: this.cityIds[2],
tel: this.tel1 ? `${this.tel1},${this.tel2},${this.tel3}` : ''
};
if(this.addressId) {
params.addressId = this.addressId;
}
insertOrUpdateAddress(params).then(res => {
this.loading = false;
this.$tips({ message: '操作成功', type: 'success' });
this.close();
this.$emit('refresh');
}).catch(() => {
this.loading = false;
});
}
});
},
getInfo() {
this.loading = true;
getAddressDetails().then(res => {
Object.keys(this.ruleForm).map(key => {
const info = res.result || {};
if (key in res.result) {
this.ruleForm[key] = info[key];
}
if(info.tel) {
const tel = info.tel.join(',');
this.tel1 = tel[0];
this.tel2 = tel[1];
this.tel3 = tel[2];
}
this.cityIds = [ info.provinceId, info.cityId, info.countyId ];
});
this.loading = false;
}).catch(() => {
this.loading = false;
});
},
},
watch: {
dialogVisible(val) {
if(val && this.addressId) {
this.getInfo();
}
}
}
};
</script>
<template>
<div class="p20" v-loading="loading">
<div class="pb20 clearfix flex-center">
<el-input prefix-icon="el-icon-search" v-model="listParams.name" @change="refresh" class="w400 mrAuto" clearable placeholder="请输入自提点名称进行搜索"></el-input>
<el-select class="more-select mr10" @change="mutiOption" placeholder="批量操作">
<el-option :disabled="!selectList.length" :value="0">批量设置</el-option>
<el-option :disabled="!selectList.length" :value="1">批量删除</el-option>
</el-select>
<el-button type="default">导出自提点</el-button>
<el-button type="primary" @click="$router.push('/setting/pickup-add')">新建自提点</el-button>
</div>
<el-table tooltip-effect="dark" :data="tableList" style="width:100%" @selection-change="(list) => { selectList = list; }">
<el-table-column type="selection" width="55"> </el-table-column>
<el-table-column label="自提点名称" prop="name" min-width="180px;"> </el-table-column>
<el-table-column label="自提点地址" prop="address" min-width="180px;"> </el-table-column>
<el-table-column label="联系电话" prop="phone" min-width="140px;"> </el-table-column>
<el-table-column label="自提时间可选" min-width="120px;">
<template slot-scope="scope">
<p v-if="scope.row.openChooseTime === 0" class="address-type">不可选</p>
<p v-if="scope.row.openChooseTime === 1" class="address-type">可选</p>
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button type="text" @click="$router.push(`setting/pickup-edit?id=${scope.row.pickupId}`)">编辑</el-button>
<dm-delete @confirm="del(scope.row.pickupId)" tips="确认删除?">
<el-button type="text">删除</el-button>
</dm-delete>
</template>
</el-table-column>
</el-table>
<div class="clearfix">
<dm-pagination class="fr mb0" v-if="tableList.length" background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="listParams.currentPage" :page-sizes="[20, 40, 60, 80]" :page-size="listParams.pageSize" layout="total, sizes, prev, pager, next" :total="total"></dm-pagination>
</div>
</div>
</template>
<script>
import { page } from '@/mixins/table.js';
import fetch from '@/api/gift.js';
const { pickupList, delPickup } = fetch;
export default {
name: 'PickupList',
mixins: [ page ],
data() {
return {
loading: false,
listParams: {
name: '',
currentPage: 1,
pageSize: 20,
},
total: 0,
tableList: [],
pickedForm: {
dialogVisible: false,
selectIdList: [], // 复选框选中的数据的id
list: [ { timeRange: [] } ] // 初始数据
},
selectList: [],
};
},
created() {
this.$emit('updateBread', [ { breadName: '福利中心' }, { breadName: '通用设置' }, { breadName: '地址库管理' } ]);
},
mounted() {
this.getTableList();
},
methods: {
mutiOption(val) {
if(val == 0) {
// 批量设置
}
if(val == 1) {
// 批量删除
this.del(this.selectList.map(v => v.pickupId).join(','));
}
},
del(pickupIds) {
this.loading = true;
delPickup({ pickupIds: pickupIds })
.then(res => {
this.loading = false;
this.$tips({ type: 'success', message: '操作成功' });
this.getTableList();
})
.finally(() => {
this.loading = false;
});
},
getTableList() {
if(this.loading) {
return;
}
this.loading = true;
pickupList().then(res => {
this.loading = false;
const data = res.result;
this.tableList = data.result || [];
this.total = data.totalCount;
// 删除至最后一页没数据的情况,页码-1
if (this.tableList.length === 0 && this.listParams.currentPage !== 1) {
this.listParams.currentPage -= 1;
this.getTableList();
}
}).finally(() => {
this.loading = false;
});
},
},
};
</script>
<template>
<div class="p20" v-loading="loading">
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="150px" style="min-height:400px;">
<el-form-item label="收货自动加库存" prop="backStockFlag">
<el-switch :active-value="1" :inactive-value="0" v-model="ruleForm.backStockFlag"></el-switch>
<div class="gray03 fz12">开启自动加库存后,在退货单同意收货后,福利中心可占库存将会增加</div>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm">保存</el-button>
<span class="ml10 gray02" v-if="ruleForm.updateTime">最近修改:{{formatDateTimeByType(ruleForm.updateTime, 'yyyy-MM-dd HH:mm:ss')}}</span>
</el-form-item>
</el-form>
</div>
</template>
<script>
import { formatDateTimeByType } from '@/utils/index';
import api from '@/api/gift';
const { updateConfig, getConfigDetail } = api;
export default {
name: 'SalesReturnSetting',
data() {
return {
loading: false,
ruleForm: {
configId: '',
backStockFlag: 0, // 是否收货自动加库存 0否1是
createTime: '',
updateTime: ''
},
rules: {},
};
},
created() {
this.$emit('updateBread', [ { breadName: '福利中心' }, { breadName: '通用设置' }, { breadName: '退货单设置' } ]);
},
mounted() {
this.getDetail();
},
methods: {
formatDateTimeByType,
submitForm() {
if (this.loading) {
return;
}
this.loading = true;
updateConfig({
configId: this.ruleForm.configId, // 新建不需要传
backStockFlag: this.ruleForm.backStockFlag
}).then(res => {
this.loading = false;
this.getDetail();
this.$tips({ message: '保存成功', type: 'success' });
}).finally(() => {
this.loading = false;
});
},
// 获取配置详情
getDetail() {
getConfigDetail().then(res => {
this.ruleForm = { ...this.ruleForm, ...res.result };
});
}
},
};
</script>
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