Commit 035e7412 by 萱草

Merge branch 'feature/福利中心-礼品管理' of http://git.gicdev.com/dm4/welfare into feature/福利中心-礼品管理

# Conflicts:
#	src/api/gift.js
parents 559e626f 7567ac82
......@@ -43,7 +43,9 @@ let realGift = {
batchUpdate: {
url: '/gift/batch-update',
method: 'post'
}
},
getPickupList: '/pickup/get-pickup-list', // 获取自提点列表
getGiftShopList: '/gift/get-gift-shop-list', // 获取当前礼品的自提点
};
realGift = getFetch(realGift, welfarePrefix);
......
<template>
<div>
<!-- 穿梭框 -->
<el-transfer
filterable
filter-placeholder="请输入自提点名称"
v-model="checked.shopCodeList"
:filter-method="(query, item) => (typeof item.name == 'string' && item.name.indexOf(query) >= 0)"
:props="{ key: 'storeCode', label: 'name' }"
:data="pickupList">
</el-transfer>
<!-- 导入 -->
<dm-upload-file
:action="`${origin}${api.giftShopListUpload}`"
accept=".xls,.xlsx"
with-credentials
:on-success="onUploadSucc">
</dm-upload-file>
</div>
</template>
<script>
/**
* 所有自提点
* 部分自提点
* 获取所有自提点
* 回显时根据礼品id获取当前礼品的所有自提点
* 批量导入
* 上传礼品自提点列表
* 部分自提点时的回显,只需要回显导入的数量
* 新增时需要回显导入的数量,和导入的文件名称
*/
// 组件的返回结果
/**
* 点击穿梭框下面的确定按钮或者文件上传完成后返回如下数据
* {
* type: 1,
* shopCodeList: [],
* uuid: 123
* }
*/
import { origin } from '@/config/index.js';
import api from '@/api/gift.js';
const { getPickupList, getGiftShopList } = api;
export default {
name: 'SelectPickupStore',
props: {
giftId: String, // 礼品id
type: String, // 门店自提类型
sum: Number, // 批量导入的数量
},
data() {
return {
api: {
// method: 'post',
// useFormData: true
giftShopListUpload: '/gift-shop-list-upload', // 上传礼品自提点列表EXCEL
giftShopListDownload: '/gift-shop-list-download', // 下载礼品自提点列表EXCEL
downloadGiftTemplate: '/gift/template-download', // 下载模板
},
pickupList: [], // 所有自提点
giftPickupList: [], // 礼品的自提点
// 选择自提点相关的数据
checked: {
shopCodeList: [],
uuid: ''
},
};
},
created() {
this.init();
},
methods: {
init() {
// 获取所有自提点
// TODO 考虑分页加载
this.pickupList = [];
getPickupList({ currentPage: 1, pageSize: 20 }).then(res => {
const { result } = res.result || {};
this.pickupList = this.pickupList.concat(result);
});
// 编辑而且是部分自提点时,获取礼品自提点
getGiftShopList().then(res => {
this.giftPickupList = res.result || [];
});
},
// 自提点上传
onUploadSucc(resp) {
const { uuid, errorList } = resp.result;
console.log(uuid, errorList);
},
// 自提点下载
downloadPickup() {
window.location.href = `${origin}${this.api.giftShopListDownload}?id=${this.giftId}`;
},
// 向外传递数据
onChange() {
this.$emit('change', this.checked);
}
}
};
</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