订单加导入
This commit is contained in:
@@ -67,20 +67,16 @@ export async function updateUser(data) {
|
||||
* @param id 用户id
|
||||
*/
|
||||
export async function removeUser(id) {
|
||||
const res = await request.delete('/institution/organizationUser/' + id);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
return removeUsers([id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除用户
|
||||
* @param data 用户id集合
|
||||
* @param ids 用户id集合
|
||||
*/
|
||||
export async function removeUsers(data) {
|
||||
export async function removeUsers(ids) {
|
||||
const res = await request.delete('/institution/organizationUser/batch', {
|
||||
data
|
||||
data: { ids }
|
||||
});
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
|
||||
@@ -119,20 +119,16 @@ export async function updateActivityCoupon(data) {
|
||||
* @param id 活动id
|
||||
*/
|
||||
export async function removeActivity(id) {
|
||||
const res = await request.delete('/sylive/activity/' + id);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
return removeActivitys([id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除活动
|
||||
* @param data 活动id集合
|
||||
* @param ids 活动id集合
|
||||
*/
|
||||
export async function removeActivitys(data) {
|
||||
export async function removeActivitys(ids) {
|
||||
const res = await request.delete('/sylive/activity/batch', {
|
||||
data
|
||||
data: { ids }
|
||||
});
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
|
||||
@@ -27,3 +27,18 @@ export async function exportGroupsOrder(params) {
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入订单
|
||||
* @param file excel文件
|
||||
*/
|
||||
export async function importGroupsOrder(file, activityId) {
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
formData.append('activityId', activityId);
|
||||
const res = await request.post('/sylive/groupsOrder/import', formData);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
@@ -69,20 +69,16 @@ export async function updateUser(data) {
|
||||
* @param id 用户id
|
||||
*/
|
||||
export async function removeUser(id) {
|
||||
const res = await request.delete('/system/user/' + id);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
return removeUsers([id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除用户
|
||||
* @param data 用户id集合
|
||||
*/
|
||||
export async function removeUsers(data) {
|
||||
export async function removeUsers(ids) {
|
||||
const res = await request.delete('/system/user/batch', {
|
||||
data
|
||||
data: { ids }
|
||||
});
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
|
||||
@@ -86,47 +86,6 @@
|
||||
<el-form-item label="收款账户:" prop="mchId">
|
||||
<activity-mch-id-select v-model="form.mchId" />
|
||||
</el-form-item>
|
||||
<el-form-item label="支付方式:" v-show="false">
|
||||
<el-select
|
||||
clearable
|
||||
v-model="form.pay.way"
|
||||
placeholder="请选择"
|
||||
class="ele-fluid"
|
||||
>
|
||||
<el-option label="厂商支付" :value="1" />
|
||||
<el-option label="经销商支付" :value="2" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="支付价格:" v-show="false">
|
||||
<el-input
|
||||
clearable
|
||||
:maxlength="30"
|
||||
v-model="form.pay.price"
|
||||
placeholder="请输入支付价格"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="支付图片:" v-show="false">
|
||||
<ele-image-upload
|
||||
v-model="form.pay.img"
|
||||
:limit="1"
|
||||
:drag="true"
|
||||
:multiple="false"
|
||||
:upload-handler="payImgHandler"
|
||||
@upload="onUpload"
|
||||
/>
|
||||
<div class="ele-text-secondary">建议尺寸750X1500</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="直播图片:" v-show="false">
|
||||
<ele-image-upload
|
||||
v-model="form.channelImg"
|
||||
:limit="1"
|
||||
:drag="true"
|
||||
:multiple="false"
|
||||
:upload-handler="channelImgHandler"
|
||||
@upload="onUpload"
|
||||
/>
|
||||
<div class="ele-text-secondary">建议尺寸690X330</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="banner:">
|
||||
<ele-image-upload
|
||||
v-model="form.banner"
|
||||
@@ -391,7 +350,6 @@
|
||||
shareTitle: [''],
|
||||
shareImg: [],
|
||||
bgImg: [],
|
||||
channelImg: [],
|
||||
banner: [],
|
||||
sharePhoto: [],
|
||||
organizationId: null,
|
||||
@@ -404,9 +362,8 @@
|
||||
bottoms: [],
|
||||
blacklist: 0,
|
||||
button: { title: '' },
|
||||
signBespeak: { status: 0, title: '', content: '', itemId: '' },
|
||||
barrage: { color: 0, title: '' },
|
||||
pay: { way: 1, price: '', img: [] }
|
||||
signBespeak: { status: 0, title: '', content: '', itemId: 0 },
|
||||
barrage: { color: 0, title: '' }
|
||||
};
|
||||
return {
|
||||
goodsList: [],
|
||||
@@ -593,27 +550,6 @@
|
||||
this.form.banner.push(item);
|
||||
this.onUpload(item);
|
||||
},
|
||||
channelImgHandler(file) {
|
||||
const item = {
|
||||
file,
|
||||
uid: file.uid,
|
||||
name: file.name,
|
||||
progress: 0,
|
||||
status: null
|
||||
};
|
||||
if (!file.type.startsWith('image')) {
|
||||
this.$message.error('只能选择图片');
|
||||
return;
|
||||
}
|
||||
if (file.size / 1024 / 1024 > 2) {
|
||||
this.$message.error('大小不能超过 2MB');
|
||||
return;
|
||||
}
|
||||
item.url = window.URL.createObjectURL(file);
|
||||
// 关键就是这里要自己 push 添加数据而不是靠 v-modal 自动更新
|
||||
this.form.channelImg.push(item);
|
||||
this.onUpload(item);
|
||||
},
|
||||
sharePhotoHandler(file) {
|
||||
const item = {
|
||||
file,
|
||||
|
||||
@@ -91,7 +91,9 @@
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item command="activity">修改活动</el-dropdown-item>
|
||||
<el-dropdown-item command="goods">修改商品</el-dropdown-item>
|
||||
<el-dropdown-item command="groups">修改分组</el-dropdown-item>
|
||||
<el-dropdown-item v-if="row.groups == 1" command="groups">
|
||||
修改分组
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item command="copy">复制活动</el-dropdown-item>
|
||||
<el-dropdown-item command="draw">抽奖配置</el-dropdown-item>
|
||||
<el-dropdown-item command="visitTag">回访标签</el-dropdown-item>
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
<!-- 导入弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
width="520px"
|
||||
title="导入订单"
|
||||
:visible="visible"
|
||||
@update:visible="updateVisible"
|
||||
>
|
||||
<el-upload
|
||||
drag
|
||||
action=""
|
||||
class="ele-block"
|
||||
v-loading="loading"
|
||||
accept=".xls,.xlsx"
|
||||
:show-file-list="false"
|
||||
:before-upload="doUpload"
|
||||
>
|
||||
<i class="el-icon-upload"></i>
|
||||
<div class="el-upload__text">将文件拖到此处, 或 <em>点击上传</em></div>
|
||||
<template v-slot:tip>
|
||||
<div class="el-upload__tip ele-text-center">
|
||||
<span>只能上传xls、xlsx文件, </span>
|
||||
<el-link
|
||||
download
|
||||
:href="url"
|
||||
type="primary"
|
||||
:underline="false"
|
||||
style="vertical-align: baseline"
|
||||
>
|
||||
下载模板
|
||||
</el-link>
|
||||
</div>
|
||||
</template>
|
||||
</el-upload>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { importGroupsOrder } from '@/api/sylive/groups-order';
|
||||
import { API_BASE_URL } from '@/config/setting';
|
||||
|
||||
export default {
|
||||
props: {
|
||||
// 是否打开弹窗
|
||||
visible: Boolean
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 导入请求状态
|
||||
loading: false,
|
||||
// 导入模板下载地址
|
||||
url: API_BASE_URL.replace('api', '') + 'temp/order.xlsx'
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
/* 上传 */
|
||||
doUpload(file) {
|
||||
if (
|
||||
![
|
||||
'application/vnd.ms-excel',
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
||||
].includes(file.type)
|
||||
) {
|
||||
this.$message.error('只能选择 excel 文件');
|
||||
return false;
|
||||
}
|
||||
if (file.size / 1024 / 1024 > 5) {
|
||||
this.$message.error('大小不能超过 5MB');
|
||||
return false;
|
||||
}
|
||||
this.loading = true;
|
||||
const activityId = this.$route.query.id;
|
||||
importGroupsOrder(file, activityId)
|
||||
.then((msg) => {
|
||||
this.loading = false;
|
||||
this.$message.success(msg);
|
||||
this.updateVisible(false);
|
||||
this.$emit('done');
|
||||
})
|
||||
.catch((e) => {
|
||||
this.loading = false;
|
||||
this.$message.error(e.message);
|
||||
});
|
||||
return false;
|
||||
},
|
||||
/* 更新visible */
|
||||
updateVisible(value) {
|
||||
this.$emit('update:visible', value);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.ele-block {
|
||||
:deep(.el-upload),
|
||||
:deep(.el-upload-dragger) {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -21,9 +21,19 @@
|
||||
>
|
||||
导出
|
||||
</el-button>
|
||||
<el-button
|
||||
size="small"
|
||||
icon="el-icon-upload2"
|
||||
class="ele-btn-icon"
|
||||
@click="openImport"
|
||||
>
|
||||
导入
|
||||
</el-button>
|
||||
</template>
|
||||
</ele-pro-table>
|
||||
</el-card>
|
||||
<!-- 导入弹窗 -->
|
||||
<gro-order-import :visible.sync="showImport" @done="reload" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -36,22 +46,28 @@
|
||||
exportGroupsOrder
|
||||
} from '@/api/sylive/groups-order';
|
||||
import { utils, writeFile } from 'xlsx';
|
||||
import GroOrderImport from './components/gro-order-import';
|
||||
const ROUTE_PATH = '/sylive/groups-order';
|
||||
|
||||
export default {
|
||||
name: 'syliveGroupsOrder',
|
||||
components: { GroOrderSearch },
|
||||
components: { GroOrderSearch, GroOrderImport },
|
||||
data() {
|
||||
return {
|
||||
activityId: null,
|
||||
// 加载状态
|
||||
title: '权益订单',
|
||||
loading: true,
|
||||
showImport: false,
|
||||
// 表格列配置
|
||||
columns: []
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
/* 打开导入弹窗 */
|
||||
openImport() {
|
||||
this.showImport = true;
|
||||
},
|
||||
/* 表格数据源 */
|
||||
async datasource({ page, limit, where, order }) {
|
||||
const result = await listGroupsOrder({
|
||||
|
||||
Reference in New Issue
Block a user