Authored by 陈峰

Merge branch 'storageDev' into 'release/3.0'

Storage dev

sellback

See merge request !38
... ... @@ -4,6 +4,7 @@ import prodReturn from './return';
import supplement from './supplement';
import invoice from './invoice';
import express from './express';
import sellback from './sellback';
export default {
diff,
... ... @@ -11,5 +12,6 @@ export default {
supplement,
prodReturn,
invoice,
express
express,
sellback
};
... ...
<template>
<Modal v-model="model"
width="800"
class-name="vertical-center-modal">
<div style="text-align: center; padding: 0;">
<template>
<Carousel v-model="carousel" v-if="showCarousel">
<Carousel-item v-for="list in items" :key="list.id">
<img :src="list.imagesPath"/>
</Carousel-item>
</Carousel>
</template>
</div>
<div slot="footer">
<Button type="primary" size="large" @click="close">关闭</Button>
</div>
</Modal>
</template>
<script>
import SellService from 'services/repository/sellback-service';
import _ from 'lodash';
export default {
name: 'edit-img',
created() {
this.sellService = new SellService();
},
data() {
return {
model: false,
showCarousel: false,
id: '',
shopId: '',
carousel: 0
};
},
methods: {
show(row) {
this.reset();
this.id = row.id;
this.shopId = row.shopId;
this.model = true;
this.getData();
},
close() {
this.reset();
this.model = false;
},
reset() {
this.carousel = 0;
this.showCarousel = false;
this.id = null;
this.shopId = null;
},
getData() {
this.sellService.imgDetail(this.shopId, this.id)
.then((result) => {
if (result.code === 200) {
this.items = result.data;
_.forEach(this.items, it => {
it.imagesPath = it.imagesPath.replace(/{width}x{height}/g, '800x600');
});
this.$nextTick(() => {
this.showCarousel = true;
});
}
});
}
}
};
</script>
<style lang="scss">
.vertical-center-modal {
display: flex;
align-items: center;
justify-content: center;
.ivu-modal {
top: 0;
}
}
.ivu-modal-close {
display: none;
}
</style>
... ...
<template>
<layout-body>
<layout-filter>
<filter-item :label="filters.orderCode.label">
<Input v-model.trim="filters.orderCode.model"
:placeholder="filters.orderCode.holder" maxlength="9" ></Input>
</filter-item>
<filter-item :label="filters.productSku.label">
<Input v-model.trim="filters.productSku.model"
:placeholder="filters.productSku.holder" maxlength="9"></Input>
</filter-item>
<filter-item>
<Button type="primary" @click="getSellBack">筛选</Button>
<Button @click="clearFilters">清空条件</Button>
</filter-item>
</layout-filter>
<layout-list>
<Table border :columns="tableCols" :data="tableData"></Table>
<Page :total="pageData.total" :current="pageData.current"
@on-change="pageChange" :page-size="20" show-total></Page>
</layout-list>
<edit-img ref="showImgEdit" @on-success="editSuccess"></edit-img>
</layout-body>
</template>
<script>
import store from './store';
import EditImg from './components/edit-img.vue';
import SellService from 'services/repository/sellback-service';
export default {
created() {
this.sellService = new SellService();
},
data() {
return store.call(this);
},
mounted() {
this.getSellBack();
},
methods: {
editImg(row) {
this.$refs.showImgEdit.show(row);
},
editSuccess() {
this.getImg();
},
clearFilters() {
this.filters.orderCode.model = null;
this.filters.productSku.model = null;
this.pageData.current = 1;
this.getSellBack();
},
pageChange(page) {
this.pageData.current = page;
this.getSellBack();
},
filtersParams() {
let params = {};
let orderCode = this.filters.orderCode.model;
let productSku = this.filters.productSku.model;
let pageNo = this.pageData.current;
let pageSize = this.pageData.pageSize;
if (this.filters.orderCode.model) {
if (this.isNumber(this.filters.orderCode.model)) {
params.orderCode = this.filters.orderCode.model;
} else {
return Promise.reject('订单号必须是数字');
}
}
if (this.filters.productSku.model) {
if (this.isNumber(this.filters.productSku.model)) {
params.productSku = this.filters.productSku.model;
} else {
return Promise.reject('sku必须是数字');
}
}
params.pageSize = this.pageData.pageSize;
params.pageNo = this.pageData.current;
return Promise.resolve({
params,
productSku,
orderCode,
pageNo,
pageSize
});
},
getSellBack() {
this.$Loading.start();
return this.filtersParams().then((params) => {
return this.sellService.list(params);
}).then((result) => {
if (result.code === 200) {
this.pageData.total = result.data.totalCount;
this.pageData.current = result.data.pageNo;
this.tableData = result.data.records;
}
this.$Loading.finish();
}).catch((err) => {
this.$Loading.finish();
this.$Message.error(err);
});
},
isNumber(numStr) {
const isNumber = /^[0-9]+$/;
return isNumber.test(numStr);
},
getImg() {
return this.filterParams().then((params) => {
return this.sellService.imgDetail(params).then((result) => {
if (result.code === 200) {
this.tableData = result.data;
}
});
});
},
},
components: {
EditImg
}
};
</script>
... ...
/**
* on sell page store
* @author: GeXuHui <qi.li@yoho.cn>
* @date: 2017/07/26
*/
import timeFormat from 'filters/time-format';
export default function() {
return {
tableCols: [{
title: '商品图片',
width: 120,
align: 'center',
render: (h, params) => {
let directives = [{name: 'prod-img', value: params.row.productSku, modifiers: {sku: true}}];
return (
<img {...{directives}}/>
);
}
},
{
title: '订单号',
key: 'orderCode',
align: 'center',
},
{
title: 'SKU',
key: 'productSku',
align: 'center'
},
{
title: '瑕疵类型',
key: 'typeName',
align: 'center'
},
{
title: '备注',
key: 'remark',
align: 'center'
},
{
title: '创建时间',
width: 150,
render: (h, params) => {
return (
<span>{timeFormat(params.row.createTime)}</span>
);
},
align: 'center'
},
{
title: '操作',
key: 'action',
align: 'center',
render: (h, params) => {
return (
<div class="action-btn-row">
<i-button type="success" size="small" onClick={() => this.editImg(params.row)}>
<i class="ivu-icon ivu-icon-eye" style="margin-right: 5px;vertical-align: top;font-size: 16px;"></i>
查看明细</i-button>
</div>
);
}
}],
tableData: [],
pageData: {
total: 0,
current: 1,
pageSize: 20
},
filters: {
orderCode: {
label: '订单号',
labelSpan: 6,
model: '',
holder: '',
fieldSpan: 18
},
productSku: {
label: 'SKU编码',
labelSpan: 6,
model: '',
holder: '',
fieldSpan: 18
}
}
};
}
... ...
/**
* Created by GeXuHui on 2017/7/26.
*/
import Service from '../service';
const apiUrl = {
defectGoodsList: '/erp/defectGoodsList',
defectGoodsImg: '/erp/defectGoodsImg',
};
class SellService extends Service {
list(params) {
return this.post(apiUrl.defectGoodsList, params);
}
imgDetail(shopId, id) {
return this.post(apiUrl.defectGoodsImg, {shopId, id});
}
}
export default SellService;
... ...
... ... @@ -49,7 +49,9 @@ let domainApis = {
exportSettlementDetail: '/erp-shop-web/export/exportSettlementDetail',
exportBalanceDetail: '/erp-shop-web/export/exportBalanceDetail',
balanceDetailSum: '/erp-shop-web/financeBill/balanceDetailSum',
settlementListSum: '/erp-shop-web/financeBill/settlementListSum'
settlementListSum: '/erp-shop-web/financeBill/settlementListSum',
defectGoodsList: '/erp-shop-web/defectGoods/list',
defectGoodsImg: '/erp-shop-web/defectGoods/detail'
},
platform: {
queryShopsByAdminPid: '/SellerShopController/queryShopsByAdminPid',
... ...