对接推广人员

master
yinliujing 6 years ago
parent a1959b8752
commit ff4c80d283

@ -33,8 +33,8 @@
<Table :columns="columns1" :data="data1" style="margin-top: 20px;"> <Table :columns="columns1" :data="data1" style="margin-top: 20px;">
<template slot-scope="{ row, index }" slot="qrCodeAction"> <template slot-scope="{ row, index }" slot="qrCodeAction">
<Button ghost type="primary" size="small" style="margin-right: 5px" @click="show(index)"></Button> <Button ghost type="primary" size="small" style="margin-right: 5px" @click="show(row)"></Button>
<Button ghost type="primary" size="small" @click="download(index)"></Button> <Button ghost type="primary" size="small" @click="download(row)"></Button>
</template> </template>
<template slot-scope="{ row, index }" slot="state"> <template slot-scope="{ row, index }" slot="state">
@ -61,7 +61,7 @@
<div slot="header">{{this.showStoreName}}</div> <div slot="header">{{this.showStoreName}}</div>
<img :src="qrCodeImage" style="width:200px;height:200px;"/> <img :src="qrCodeImage" style="width:200px;height:200px;"/>
<div style="text-align: center;"> <div style="text-align: center;">
<Button ghost type="primary"></Button> <Button ghost type="primary" @click="download(rowData)"></Button>
</div> </div>
</Modal> </Modal>
@ -124,12 +124,19 @@
</FormItem> </FormItem>
</Form> </Form>
</Modal> </Modal>
<div style="margin: 30px;overflow: hidden">
<div style="float: right;">
<Page :total="total" :current="pageNum" :pageSize="pageSize"></Page>
</div>
</div>
</div> </div>
</template> </template>
<script> <script>
import data from "../../utils/PhoneRegionData"; import data from "../../utils/PhoneRegionData";
import staff from "../../services/staff/staff";
export default { export default {
name: "IncreaseStaffManager", name: "IncreaseStaffManager",
data () { data () {
@ -141,10 +148,17 @@
isShowAdd: false, isShowAdd: false,
showStoreName: '', showStoreName: '',
qrCodeImage: '', qrCodeImage: '',
loading:true,
spuLoading:false,
//
total: 0,
pageSize: 15,
pageNum: 1,
selectedRegion: null, selectedRegion: null,
regionList: [], regionList: [],
selectedStore: null, selectedStore: null,
storeList: [], storeList: [],
rowData:{},
columns1: [ columns1: [
{ {
title: '序号', title: '序号',
@ -158,12 +172,12 @@
}, },
{ {
title: '员工ID', title: '员工ID',
key: 'code', key: 'staffCode',
width: 100 width: 100
}, },
{ {
title: '手机号码', title: '手机号码',
key: 'phone', key: 'mobil',
width: 160 width: 160
}, },
{ {
@ -184,6 +198,7 @@
{ {
title: '推广码', title: '推广码',
slot: 'qrCodeAction', slot: 'qrCodeAction',
key:'epWechatQrCode',
width: 150 width: 150
}, },
{ {
@ -197,48 +212,7 @@
slot: 'action', slot: 'action',
} }
], ],
data1: [ data1: [],
{
id: 1,
name: '王老吉',
code: 'D1',
phone: '13112345678',
storeName: '店铺1',
role: 1,
customerNum: 999,
qrCodeState: true
},
{
id: 2,
name: '王老吉2',
code: 'D2',
phone: '13112345678',
storeName: '店铺2',
role: 2,
customerNum: 999,
qrCodeState: true
},
{
id: 3,
name: '王老吉3',
code: 'D3',
phone: '13112345678',
storeName: '店铺3',
role: 3,
customerNum: 999,
qrCodeState: false
},
{
id: 4,
name: '王老吉4',
code: 'D4',
phone: '13112345678',
storeName: '店铺4',
role: 3,
customerNum: 999,
qrCodeState: false
}
],
// //
formValidate: { formValidate: {
staffCode: '', staffCode: '',
@ -270,20 +244,73 @@
} }
} }
}, },
mounted() {
this.listOfLogistics();
},
methods: { methods: {
changePage (page) {
this.pageNum = page;
this.listOfLogistics();
},
listOfLogistics() {
let that = this;
let request = {
userId: 1 ,
region: that.region,
shopId: that.store,
pageNum: that.pageNum,
pageSize: that.pageSize,
};
staff.getStaffList(request, function (data) {
data = data.data;
if(data.code == "0000") {
that.data1 = [];
let datas = data.results;
//
if (datas.total == null) {
that.total = 0;
} else {
that.total = datas.total;
}
if (datas.records == null) {
datas.records = [];
}
that.data1 = datas.records;
}
})
},
// //
onChangeDateLister: function () { onChangeDateLister: function () {
}, },
// //
show: function () { show: function (index) {
this.isShow = true; this.isShow = true;
this.showStoreName = '店铺1'; this.showStoreName = index.storeName;
this.qrCodeImage = '../static/img/logo-title.png'; this.qrCodeImage = index.epWechatQrCode;
this.rowData = index;
}, },
// //
download: function () { download: function (index) {
let name = index.staffCode+"-"+index.name
let image = new Image();
// Canvas
image.setAttribute("crossOrigin", "anonymous");
image.onload = function() {
let canvas = document.createElement("canvas");
canvas.width = image.width;
canvas.height = image.height;
let context = canvas.getContext("2d");
context.drawImage(image, 0, 0, image.width, image.height);
let url = canvas.toDataURL("image/png"); //base64
let a = document.createElement("a"); // a
let event = new MouseEvent("click"); //
a.download = name || "photo"; //
a.href = url; // URLa.href
a.dispatchEvent(event); // a
};
image.src = index.epWechatQrCode;
}, },
// 广 // 广
open: function (flag) { open: function (flag) {

@ -0,0 +1,21 @@
/**
* 登录 server层
* @author dexiang.jiang
* @date 2019/05/08 18:25
*/
import http from '../CommonHttp'
/**
* 店铺人员
* @param params 参数
* @param call 成功的回调
* @returns {Promise<any>} 返回Promise对象
*/
export function getStaffList(params, call) {
return http.get('/store/staff/list', params).then(call)
}
export default {
getStaffList
}
Loading…
Cancel
Save