Commit 9ce6b662 by caoyanzhi

add: 自提点组件

parent a71e6622
......@@ -51,7 +51,7 @@
<el-popover trigger="click" placement="right" popper-class="upload-popper">
<el-button slot="reference" type="text">查看导入规则</el-button>
<div class="upload-tip-text">
<p>1. 自提点code请至自提设置中导出;<el-button type="text" @click="$router.push('/setting/pickup-list')">前去设置</el-button></p>
<p>1. 自提点code请至自提设置中导出;<el-button type="text" @click="toSetting">前去设置</el-button></p>
<p>2. 重新导入后将会覆盖原有全部门店;</p>
<p>3. 上传完整仅支持.xlsx .xls文件的导入,填充数据不超过“5000”条。</p>
</div>
......@@ -165,24 +165,30 @@ export default {
},
mounted() {
document.addEventListener('click', this.onClosePopover, true);
document.addEventListener('visibilitychange', this.init);
},
beforeDestroy() {
document.removeEventListener('click', this.onClosePopover, true);
document.removeEventListener('visibilitychange', this.init);
},
methods: {
init() {
if (document.visibilityState != 'visible') return;
// 获取所有自提点
// TODO 考虑分页加载
this.pickupList = [];
getPickupList({ currentPage: 1, pageSize: 20 }).then(res => {
const { result } = res.result || {};
if (Array.isArray(result) && result.length > 0) {
this.pickupList = this.pickupList.concat(result.map(el => {
el.nameIsOverflow = this.getOffsetWidth(el.name) > 129;
return el;
}));
}
});
const getList = (currentPage) => {
getPickupList({ currentPage, pageSize: 20 }).then(res => {
const { result } = res.result || {};
if (Array.isArray(result) && result.length > 0) {
this.pickupList = this.pickupList.concat(result.map(el => {
el.nameIsOverflow = this.getOffsetWidth(el.name) > 129;
return el;
}));
getList(currentPage + 1);
}
});
};
getList(1);
},
// 获取字符串的offsetWidth宽度
getOffsetWidth(str) {
......@@ -218,6 +224,10 @@ export default {
this.isFocus = false;
}
},
// 去设置自提点code
toSetting() {
window.open(`${origin}/welfare/setting/pickup-list`);
},
// 自提点上传-模板下载
onDownloadTemplate() {
window.location.href = `${origin}${this.api.downloadGiftTemplate}`;
......
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