Authored by htoooth

Merge branch 'release/1.0' of http://git.yoho.cn/fe/yoho-shop-manage into release/1.0

... ... @@ -20,6 +20,7 @@
<script>
export default {
name: 'CheckboxAge',
props: ['value'],
data() {
let _this = this;
... ...
import CheckboxAge from './checkbox-age';
export {
CheckboxAge
};
... ...
... ... @@ -18,16 +18,16 @@ export default {
};
},
created() {
_.remove(this.$router.beforeHooks, hook => hook.name === 'breadcrumb');
_.remove(this.$router.beforeHooks, hook => hook.name === 'breadcrumbHook');
let that = this;
this.$router.beforeEach(function breadcrumb(to, from, next) {
if (to.name.indexOf('error.') < 0) {
this.$router.beforeEach(function breadcrumbHook(to, from, next) {
setTimeout(() => {
that.showBreadcrumb = false;
that.$nextTick(() => { // Breadcrumb更新子组件的separator,如果不手动重建Breadcrumb周期,子组件separator不会得到更新
that.render(to);
});
}
}, 0);
return next();
});
this.render(_.get(this.$router, 'history.current'));
... ...
... ... @@ -29,7 +29,20 @@ export default {
};
},
created() {
let path = _.get(this.$router, 'history.current.path');
_.remove(this.$router.beforeHooks, hook => hook.name === 'menuHook');
let that = this;
this.$router.beforeEach(function menuHook(to, from, next) {
setTimeout(() => {
that.render(to);
}, 0);
return next();
});
this.render(_.get(this.$router, 'history.current'));
},
methods: {
render(to) {
let path = to.path;
let menu = _.find(this.$purviews, purview => purview.menu_url === path);
if (menu) {
... ... @@ -39,7 +52,6 @@ export default {
}
}
},
methods: {
open(menuId) {
let menu = _.find(this.$purviews, purview => purview.id === menuId);
... ...
import SizeEdit from './size-edit';
import ModalSizeEdit from './modal-size-edit';
export {
SizeEdit
ModalSizeEdit
};
... ...
... ... @@ -3,23 +3,14 @@
class="size-modal"
width="auto"
v-model="showModal"
:loading="saveing"
:saveLoading="saveLoading"
@on-ok="modalOK"
@on-cancel="modalCancel"
:title="title"
ok-text="保存">
<div class="size-edit">
<Spin v-if="showLoading" fix size="large"></Spin>
<Checkbox v-model="sizeImgFlag">隐藏测量方式图</Checkbox>
<Table ref="tableSize" :show-header="false" :data="data" :columns="columns" v-if="!showLoading">
<div class="" slot="header">
<div class="table-header">
<div :style="{width:column.width+'px', flex:column.width?'inherit':'1'}" class="table-th" v-for="column in columns">
<span>{{column.title}}</span>
<Checkbox v-model="column.noMeasure" v-if="column.sizeAttributeId">无需测量</Checkbox>
</div>
</div>
</div>
<Table ref="tableSize" v-if="loadingOk" :row-class-name="rowClassName" :show-header="false" :data="data" :columns="columns">
</Table>
</div>
</Modal>
... ... @@ -30,21 +21,21 @@ import productService from 'product-service';
import _ from 'lodash';
export default {
name: 'SizEdit',
name: 'ModalSizeEdit',
props: {
},
data() {
return {
showModal: false,
showLoading: true,
saveing: false,
saveLoading: true,
title: '编辑尺码信息',
sizeImgFlag: false,
skn: 0,
gender: '',
data: [],
columns: [{}],
noMeasureIds: {}
noMeasureIds: {},
loadingOk: false,
};
},
watch: {
... ... @@ -80,48 +71,71 @@ export default {
let attrs = sizeInfo.sizeRelationsList[0].prdSizeAttributeBoList;
columns.push({
title: '尺码',
width: 70,
key: 'sizeName'
render(row, col, index) {
if (index === 0) {
return '尺码';
} else {
return row.sizeName;
}
},
fixed: 'left'
});
columns.push({
title: `参考尺码(${sizeInfo.genderName})`,
width: 220,
render() {
render(row, col, index) {
if (index === 0) {
return `参考尺码(${sizeInfo.genderName})`;
} else {
return `<i-input class="size-inpt" v-model="row.referenceNameA"></i-input>/
<i-input class="size-inpt" width="50" v-model="row.referenceNameB"></i-input>`;
}
},
fixed: 'left'
});
_.each(attrs, (attr, index) => {
_.each(attrs, (attr, colIndex) => {
columns.push({
title: attr.sizeAttributeName,
noMeasure: _.some(noMeasureIds, id => +id === index + 2),
width: 120,
noMeasure: _.some(noMeasureIds, id => +id === attr.sizeAttributeId),
sizeAttributeId: attr.sizeAttributeId,
render() {
render(row, col, index) {
if (index === 0) {
return `<span>${attr.sizeAttributeName}</span>
<Checkbox v-model="column.noMeasure">无需测量</Checkbox>`;
} else {
return `<i-input class="size-inpt"
v-model="row.prdSizeAttributeBoList[${index}].sizeValue"
v-model="row.prdSizeAttributeBoList[${colIndex}].sizeValue"
:disabled="column.noMeasure"></i-input>`;
}
}
});
});
this.data = sizeInfo.sizeRelationsList;
this.columns = columns;
this.data = _.concat({}, sizeInfo.sizeRelationsList);
this.sizeImgFlag = sizeInfo.sizeImgFlag !== 0;
this.gender = sizeInfo.gender;
this.loadingOk = true;
}
this.showLoading = false;
});
},
getColumns() {
},
rowClassName(row, index) {
if (index === 0) {
return 'table-header';
}
},
modalOK() {
this.showLoading = true;
let data = this.$refs.tableSize.rebuildData;
let data = _.drop(this.$refs.tableSize.rebuildData, 1);
let columns = this.$refs.tableSize.cloneColumns;
let noMeasureIds = [],
sizeInfoList = [],
productSizeReferList = [];
_.each(this.columns, (col, index) => {
_.each(columns, col => {
if (col.sizeAttributeId && col.noMeasure) {
noMeasureIds.push(index);
noMeasureIds.push(col.sizeAttributeId);
}
});
sizeInfoList = _.concat([], ..._.map(data, row => {
... ... @@ -150,17 +164,16 @@ export default {
sizeImgFlag: this.sizeImgFlag ? 1 : 0
};
this.saveing = true;
productService.saveProdSizeInfo(postData).then(result => {
if (result.code === 200) {
this.loadingOk = false;
this.showModal = false;
this.showLoading = true;
}
});
},
modalCancel() {
this.showLoading = true;
this.loadingOk = false;
this.showModal = false;
}
}
};
... ... @@ -180,38 +193,16 @@ export default {
width: 70px;
}
.table-header {
width: 100%;
height: 48px;
display: flex;
.table-th {
flex: 1;
line-height: initial;
padding-left: 10px;
padding-right: 10px;
font-size: 12px;
font-weight: bold;
border-bottom: 1px solid #e3e8ee;
background-color: #f5f7f9;
display: flex;
flex-flow: column;
justify-content: center;
}
}
.ivu-table-wrapper {
table {
width: 100%;
}
.ivu-table-title {
table {
th {
td {
background-color: #f5f7f9;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
word-break: break-all;
}
}
background-color: #f5f7f9;
}
}
}
.size-modal {
.ivu-modal {
... ...
import RadioGender from './radio-gender';
import RadioSeason from './radio-season';
export {
RadioGender,
RadioSeason
};
... ...
... ... @@ -14,6 +14,7 @@
<script>
export default {
name: 'RadioGender',
props: ['value'],
data() {
let _this = this;
... ...
... ... @@ -17,6 +17,7 @@
<script>
export default {
name: 'RadioSeason',
props: ['value'],
data() {
let _this = this;
... ...
import SelectBrand from './select-brand';
import SelectCategory from './select-category';
import SelectSeason from './select-season';
export {
SelectBrand,
SelectCategory
SelectCategory,
SelectSeason
};
... ...
... ... @@ -11,7 +11,7 @@
<script>
export default {
name: 'product-goods-season',
name: 'SelectSeason',
props: ['value'],
data() {
let _this = this;
... ...
... ... @@ -44,6 +44,12 @@ export default {
this.userClass['user-collapse'] = !this.userClass['user-collapse'];
this.breadClass['bread-collapse'] = !this.breadClass['bread-collapse'];
this.layoutClass.collapse = !this.layoutClass.collapse;
setTimeout(() => {
let evtStart = document.createEvent('UIEvent');
evtStart.initUIEvent('resize', true, true);
window.dispatchEvent(evtStart);
}, 500);
},
shopChange() {
this.reload = false;
... ... @@ -121,7 +127,6 @@ body {
.ivu-table {
table {
width: 100% !important;
}
}
... ...
... ... @@ -70,7 +70,7 @@
<Row>
<Col span="8">
<Form-item label="货品季" prop="goodsSeason">
<product-goods-season v-model="product.goodsSeason"></product-goods-season>
<SelectSeason v-model="product.goodsSeason"></SelectSeason>
</Form-item>
</Col>
</Row>
... ... @@ -84,16 +84,16 @@
</Row>
<Form-item label="性别" prop="gender">
<product-gender v-model="product.gender"></product-gender>
<RadioGender v-model="product.gender"></RadioGender>
</Form-item>
<Form-item label="适销季" prop="seasons">
<product-season v-model="product.seasons"></product-season>
<RadioSeason v-model="product.seasons"></RadioSeason>
</Form-item>
<Form-item label="年龄层" prop="ageLevel">
<product-age v-model="product.ageLevel"></product-age>
<CheckboxAge v-model="product.ageLevel"></CheckboxAge>
</Form-item>
<Row>
... ... @@ -187,15 +187,12 @@
</template>
<script>
import _ from 'lodash';
import api from 'product-create/api';
import service from 'product-create/service';
const _ = require('lodash');
import Age from './age';
import Season from './season';
import Gender from './gender';
import GoodsSeason from './goods-season';
import {CheckboxAge} from 'components/checkbox';
import {RadioSeason, RadioGender} from 'components/radio';
import {SelectSeason} from 'components/select';
const makeColor = () => {
return {
... ... @@ -834,10 +831,10 @@ export default {
}
},
components: {
'product-age': Age,
'product-season': Season,
'product-gender': Gender,
'product-goods-season': GoodsSeason,
CheckboxAge,
RadioSeason,
RadioGender,
SelectSeason,
}
};
</script>
... ...
... ... @@ -88,6 +88,7 @@
this.tableCols = store.tableCols;
this.tableData = store.tableData;
this.pageData = store.pageData;
},
methods: {
editSize(skn) {
... ...
... ... @@ -51,11 +51,8 @@
export default {
created() {
service.getShop().then((res) => {
this.shopData = res.data;
this.tableData = JSON.parse(res.data.shopRelationList);
console.log('res=====');
console.log(res);
this.tableData = JSON.parse(res.data.shopRelationList || '[]');
}, (error) => {
this.$Message.error(error.message);
});
... ... @@ -77,15 +74,13 @@
align: 'center'
}
],
tableData: [],
tableData: null,
bucket: 'yhb-img01'
};
},
methods: {
updateData: function(content) {
this.shopData.shopIntro = content;
console.log('1this.shopData.shopIntro-------');
console.log(this.shopData.shopIntro);
},
uploadImageSuccess: function(attach, file) {
... ... @@ -108,17 +103,11 @@
shopIntro: this.shopData.shopIntro
};
console.log('2this.shopData.shopIntro-------');
console.log(this.shopData.shopIntro);
return result;
},
submit: function() {
let newShop = this.beforeSubmit();
console.log('3this.shopData.shopIntro-------');
console.log(this.shopData.shopIntro);
this.$Loading.start();
service.saveBaseShopInfo(newShop).then((result) => {
this.$Loading.finish();
... ...
... ... @@ -74,6 +74,9 @@ const plugin = {
// 加载核心组件
this.loadGlobalComponents(Vue);
// 兼容
this.compatible();
// 加载核心插件
Vue.use(iView);
Vue.use(Router);
... ...