Authored by lzhy

commit

... ... @@ -48,6 +48,7 @@ export default {
watch: {
value: function(newValue) {
this.values = newValue.split('|');
console.log('disabel', this.disable);
}
}
};
... ...
<template>
<div class="select-colors">
<div class="color-item" @click="selectColor(color)" v-for="color in colors" :key="color.id"
<div class="color-item" @click="selectColor(color)" v-for="color in colors" :key="color.id"
:class="{
selected: color.selected,
disabled: color.disabled
... ... @@ -32,6 +32,10 @@ export default {
default() {
return [];
}
},
disable: { // 已上架商品不支持修改
type: Boolean,
default: false
}
},
created() {
... ... @@ -64,7 +68,7 @@ export default {
});
},
selectColor(color) {
if (color.disabled) {
if (color.disabled || this.disable) {
return;
}
color.selected = !color.selected;
... ...
<template>
<Checkbox-group :value="handleValue" @input="updateValue">
<Checkbox v-for="name in idNameList" :label="name.id" :key="name.id">
<Checkbox v-for="name in idNameList" :label="name.id" :key="name.id" :disabled="disable">
<span>{{name.text}}</span>
</Checkbox>
</Checkbox-group>
... ... @@ -21,6 +21,10 @@ export default {
default: function() {
return [];
}
},
disable: {
type: Boolean,
default: false
}
},
data() {
... ...
<template>
<Checkbox-group :value="updateValue" @on-change="selectSize">
<Checkbox v-for="size in sizes" :key="size.id" :label="size.id" :disabled="size.disabled">
<Checkbox v-for="size in sizes" :key="size.id" :label="size.id" :disabled="size.disabled || disable">
<span>{{size.sizeName}}</span>
</Checkbox>
</Checkbox-group>
... ... @@ -27,6 +27,10 @@ export default {
default() {
return [];
}
},
disable: {
type: Boolean,
default: false
}
},
created() {
... ...
... ... @@ -44,6 +44,7 @@ export default {
},
created() {
this.userService = new UserService();
console.log('user=', this.$user);
},
methods: {
logout() {
... ...
... ... @@ -8,11 +8,12 @@
</div>
<div class="upload-item" v-for="(image, imageIndex) in good.goodsImage" :key="imageIndex">
<div class="upload-item-img">
<div v-if="disable" class="disable-mask"></div>
<img v-if="imageIndex === 0 && image.imageUrl" :src="image.imageUrl"
alt=""
width="120px"
height="122px">
<drag-file-upload v-if="imageIndex > 0"
<drag-file-upload v-if="imageIndex > 0"
:default-file="image.imageUrl"
:id="{goodIndex, imageIndex}"
:skn="good.productSkn"
... ... @@ -37,6 +38,10 @@ export default {
default() {
return [];
}
},
disable: {
type: Boolean,
default: false
}
},
data() {
... ... @@ -91,6 +96,14 @@ export default {
height: 120px;
width: 120px;
box-sizing: border-box;
position: relative;
.disable-mask {
position: absolute;
width: 100%;
height: 100%;
z-index: 9;
}
img {
width: 100%;
... ...
... ... @@ -7,7 +7,7 @@
:maxlength="maxlength"
:class="{'input-ele': true}"
:value="currentValue"
@input="inputEvent"></Input>
@input="inputEvent" :disabled="disable"></Input>
<p class="input-txt">
<span>{{txtMsg}}</span>
</p>
... ... @@ -33,6 +33,10 @@ export default {
maxlength: {
type: Number,
default: 250
},
disable: {
type: Boolean,
default: false
}
},
computed: {
... ...
<template>
<Input :value="currentValue" v-bind="$attrs" v-on="$listeners" />
<Input :value="currentValue" v-bind="$attrs" v-on="$listeners" :disabled="disabled"/>
</template>
<script>
... ... @@ -7,7 +7,7 @@ import xss from 'util/xss';
export default {
name: 'input-safe',
props: ['value'],
props: ['value', 'disabled'],
created() {
this.$listeners.input = this.input;
},
... ...
... ... @@ -43,6 +43,7 @@
},
brandId(newValue) {
this.sellTypeService.getSellType({brandId: newValue}).then((result) => {
console.log(result);
if (result.code === 200) {
this.list = result.data;
... ...
<template>
<Table ref="sellerGoods"
class="table-good-size"
:data="table.data"
:columns="table.columns"
stripe
class="table-good-size"
:data="table.data"
:columns="table.columns"
stripe
border></Table>
</template>
... ... @@ -16,6 +16,10 @@ export default {
default() {
return [];
}
},
disable: {
type: Boolean,
default: false
}
},
data() {
... ... @@ -30,7 +34,8 @@ export default {
h('p', {}, this.table.data[params.index].goodsName.name),
h('Radio', {
props: {
value: this.table.data[params.index].goodsName.isDefault
value: this.table.data[params.index].goodsName.isDefault,
disabled: this.disable
},
on: {
'on-change': () => {
... ... @@ -52,7 +57,8 @@ export default {
if (this.isExist(params.index)) {
return h('input-safe', {
props: {
value: params.row.factoryGoodsName
value: params.row.factoryGoodsName,
disabled: this.disable,
},
attrs: {
placeholder: params.row.goodsName.name
... ... @@ -80,6 +86,7 @@ export default {
return (
<div class={{'table-upload-item': true}}>
{(this.disable) ? (<div class={{'disable-mask' : true}}></div>) : ''}
<drag-file-upload
id={{index: params.index}}
default-file={row.goodsColorImage.value}
... ... @@ -171,7 +178,7 @@ export default {
<input-safe
value={size.name}
onInput={val => (size.name = val)}
disabled={!params.row.operator[i].value}
disabled={!params.row.operator[i].value || this.disable}
placeholder="请输入..."
style={{width: '100%'}}
/>
... ... @@ -430,8 +437,17 @@ export default {
}
.table-upload-item {
position: relative;
text-align: center;
padding: 10px;
box-sizing: border-box;
.disable-mask {
position: absolute;
width: 100%;
height: 100%;
z-index: 10;
}
}
.example-pop {
... ...
... ... @@ -14,13 +14,13 @@
<span>{{product.smallSortName}}</span>
</Form-item>
<Form-item label="商品名称" prop="productName">
<input-safe v-model="product.productName" placeholder="请输入..." />
<input-safe v-model="product.productName" placeholder="请输入..." :disabled="isView" />
</Form-item>
<Form-item label="商品卖点">
<input-safe v-model="product.phrase" :maxlength="12" placeholder="最多12个字符"/>
<input-safe v-model="product.phrase" :maxlength="12" placeholder="最多12个字符" :disabled="isView"/>
</Form-item>
<Form-item label="商家商品编码" prop="factoryCode">
<input-safe v-model="product.factoryCode" placeholder="请输入..." />
<input-safe v-model="product.factoryCode" placeholder="请输入..." :disabled="isView" />
</Form-item>
<Form-item label="货品年">
<Date-picker :value="product.goodsYears && product.goodsYears.toString()" type="year" placeholder="选择年" disabled>
... ... @@ -30,35 +30,35 @@
<select-season v-model="product.goodsSeason" :disable="true"></select-season>
</Form-item>
<Form-item label="上市日期" prop="expectSaleTimeStr">
<Date-picker :value="product.expectSaleTimeStr" @on-change="clickSaleDate" type="date" placeholder="选择日期" style="width: 400px"></Date-picker>
<Date-picker :value="product.expectSaleTimeStr" @on-change="clickSaleDate" type="date" placeholder="选择日期" :disabled="isView" style="width: 400px"></Date-picker>
</Form-item>
<Form-item label="性别">
<radio-gender v-model="product.gender" :disable="true"></radio-gender>
</Form-item>
<Form-item label="适销季" prop="seasons">
<radio-season v-model="product.seasons" ></radio-season>
<radio-season v-model="product.seasons" :disable="isView"></radio-season>
</Form-item>
<Form-item label="年龄层" prop="ageLevel">
<checkbox-age v-model="product.ageLevel"></checkbox-age>
<checkbox-age v-model="product.ageLevel" :disable="disable || isView"></checkbox-age>
</Form-item>
<div class="create-item-title">商品规格
<span class="create-group-sub-title">(颜色名称只能填写中文,最多5个汉字。款型编码和条码只能填写英文和数字,不区分大小写)</span>
</div>
<Form-item label="颜色">
<checkbox-color v-model="colors"
<checkbox-color v-model="colors" :disable="disable || isView"
:select-colors="table.defaultSelectedColors" @on-add="addColor" @on-remove="removeColor">
</checkbox-color>
</Form-item>
<Form-item label="尺寸">
<checkbox-size v-model="sizes"
<checkbox-size v-model="sizes" :disable="disable || isView"
:sort-id="this.product.smallSortId" :select-sizes="table.defaultSelectedSizes"
@on-add="addSize" @on-remove="removeSize">
</checkbox-size>
</Form-item>
<Form-item>
<table-good-size ref="tableGood" v-model="table.data"
@on-upload="uploadGoodSzieSuccess"
@on-factory-name="onChangeFactoryCode"></table-good-size>
<table-good-size ref="tableGood" v-model="table.data"
@on-upload="uploadGoodSzieSuccess"
@on-factory-name="onChangeFactoryCode" :disable="disable || isView"></table-good-size>
</Form-item>
<div class="create-item-title">商品价格</div>
<Form-item label="吊牌价">
... ... @@ -77,18 +77,22 @@
<a href="javascript: void 0;" @click="onClickShowExample">查看色卡图片示例</a>
</span>
</div>
<image-goods-main v-model="product.goods"></image-goods-main>
<image-goods-main v-model="product.goods" :disable="isView"></image-goods-main>
<div class="create-item-title">商品推荐短语
<span class="create-group-sub-title">(默认在前台商品详情页显示)</span>
</div>
<div>
<input-length v-model="product.recommendPhrase" :maxlength="500" placeholder="最多500个字符"></input-length>
<input-length v-model="product.recommendPhrase" :disable="isView" :maxlength="500" placeholder="最多500个字符"></input-length>
</div>
<div class="create-item-title">商品描述
<span class="create-group-sub-title">(详情页内容)</span>
</div>
<editor :content="product.productIntro"
@change="updateProductDesc"></editor>
<div class="editor-container">
<div class="editor-mask" v-if="isView"></div>
<editor :content="product.productIntro"
@change="updateProductDesc"></editor>
</div>
<div class="create-item-title">商品属性
<span class="create-group-sub-title">(请认真选择所列的属性项,所填内容会对商品搜索、智能推荐等功能产生影响,从而影响商品曝光展示)</span>
</div>
... ... @@ -99,14 +103,14 @@
:key="attrIndex">
<template v-if="attr.inputType === 'select'">
<Select v-model="attr.model[0]"
:placeholder="'请选择' + attr.attributeName">
:placeholder="'请选择' + attr.attributeName" :disabled="isView">
<Option v-for="name in attr.idNameList" :value="name.id" :key="name.id">{{name.text}}</Option>
</Select>
</template>
<template v-else>
<Checkbox-group v-model="attr.model">
<Checkbox v-for="name in attr.idNameList" :label="name.id" :key="name.id">
<Checkbox v-for="name in attr.idNameList" :label="name.id" :key="name.id" :disabled="isView">
<span>{{name.text}}</span>
</Checkbox>
</Checkbox-group>
... ... @@ -114,12 +118,13 @@
</Form-item>
</div>
<Form-item v-if="model.productMaterial" :label="model.productMaterial.attributeName">
<checkbox-material v-model="product.materialList" :idNameList="model.productMaterial.idNameList">
<checkbox-material v-model="product.materialList" :idNameList="model.productMaterial.idNameList" :disable="isView">
</checkbox-material>
</Form-item>
<Form-item>
<div class="btn-fixed" :class="btnFixClass">
<Button type="primary" @click="submit" size="large" id="btnSave">保存</Button>
<Button type="primary" @click="backToList" size="large" v-if="isView">关闭</Button>
<Button type="primary" @click="submit" size="large" id="btnSave" v-else>保存</Button>
</div>
</Form-item>
<back-top-dom :bottom="100"></back-top-dom>
... ... @@ -143,6 +148,9 @@ export default {
this.productService = new ProductService();
this.productCreateService = new ProductCreateService();
this.from = this.$route.query.from || this.from;
this.viewType = this.$route.query.type || '';
this.disable = this.from !== 'product.offsale'; // 用于对已上架商品限制修改
this.isView = this.viewType === 'view';
this.productService.getProduct(this.$route.params.id).then((result) => {
if (result.code === 200) {
... ... @@ -596,6 +604,9 @@ export default {
go(from) {
this.$router.push({ name: from });
},
backToList() {
this.go(this.from);
},
submit() {
this.validate()
.then(([r1, r2]) => {
... ... @@ -711,4 +722,17 @@ export default {
margin-top: 20px;
}
.editor-container {
position: relative;
overflow: hidden;
.editor-mask {
position: absolute;
width: 100%;
height: 100%;
z-index: 1001;
background-color: rgba(240, 240, 240, 0.8)
}
}
</style>
... ...
... ... @@ -263,6 +263,19 @@
}
});
},
showProduct(skn) {
this.$router.push({
name: 'product.edit',
params: {
id: skn
},
query: {
from: 'product.onsale',
type: 'view',
page: this.pageData.current || 1
}
})
},
editProduct(skn) {
this.$router.push({
name: 'product.edit',
... ...
... ... @@ -126,6 +126,7 @@ export default function() {
align: 'center',
render: (h, params) => {
const row = params.row;
console.log('auditStatus:', row.auditStatus);
const disabled = row._disabled;
const status = row.auditStatus;
... ... @@ -133,11 +134,17 @@ export default function() {
<div>
<div class="cell-action-row">
<i-button type="primary" size="small"
onClick = {() => this.showProduct(row.productSkn)}>
</i-button>
</div>
<div class="cell-action-row">
<i-button type="primary" size="small"
onClick={() => this.editSize(row.productSkn)}>
尺码维护
</i-button>
</div>
{status !== 3 ? (
{status !== null ? (
<div class="cell-action-row">
<i-button type="primary" size="small"
onClick={() => this.editProduct(row.productSkn)}>
... ...
... ... @@ -30,6 +30,57 @@
<Form-item label="营业执照:">
<editor :content="shopData.businessLicense" @change="updateLicense"> </editor>
</Form-item>
<Form-item v-if="shopData.shopNature === 6" label="店铺地址:">
<!--省市区街道联动下拉框-->
<div class="address-select-container">
<Select v-model="addressSelected.province.value"
class="province-select"yar
placeholder="请选择省/直辖市"
:label-in-value="labelInValue"
@on-change="changeProvince"
data-type="province">
<Option v-for="prvOption in provinceList" :label="prvOption.name" :value="prvOption.value" :key="prvOption.value"></Option>
</Select>
<Select v-model="addressSelected.city.value"
class="city-select"
placeholder="请选择市"
:label-in-value="labelInValue"
@on-change="changeCity"
data-type="city">
<Option v-for="cityOption in cityList[addressSelected.province.value]" :label="cityOption.name" :value="cityOption.value" :key="cityOption.value"></Option>
</Select>
<Select v-model="addressSelected.district.value"
class="district-select"
placeholder="请选择区/县"
:label-in-value="labelInValue"
@on-change="changeDistrict"
data-type="district">
<Option v-for="disOption in districtList[addressSelected.city.value]" :label="disOption.name" :value="disOption.value" :key="disOption.value"></Option>
</Select>
<Select v-model="addressSelected.street.value"
class="street-select"
placeholder="请选择街道"
:label-in-value="labelInValue"
@on-change="changeStreet"
data-type="street">
<Option v-for="streetOption in streetList[addressSelected.district.value]" :label="streetOption.name" :value="streetOption.value" :key="streetOption.value"></Option>
</Select>
<Input v-model="addressDetail" placeholder="详细地址"></Input>
<p>注:店铺地址味店铺最新可联系到的地址</p>
</div>
</Form-item>
<Form-item v-if="shopData.shopNature === 6" label="店铺客服电话:">
<Input v-model="customerTel" placeholder="请填写电话" style="width: 150px"></Input>
</Form-item>
<Form-item v-if="shopData.shopNature === 6" label="支付宝帐号:">
<p>{{shopData.zfbAccount}}</p>
</Form-item>
<Form-item v-if="shopData.shopNature === 6" label="支付宝帐号名称:">
<p>{{shopData.zfbAccountName}}</p>
</Form-item>
<Form-item v-if="shopData.shopNature === 6" label="联系方式:">
<p>{{shopData.checkTel}}</p>
</Form-item>
<Form-item label="品牌-供应商:">
<Table :columns="tableCols" width="700" :data="tableData"></Table>
</Form-item>
... ... @@ -44,11 +95,13 @@
import xss from 'xss';
import _ from 'lodash';
import ShopService from 'services/shop/shop-service';
import AddressData from 'services/shop/regions.json';
const SHOPNATURE = {
1: '旗舰店',
2: '专卖店',
3: '初始状态(异常情况)',
6: '一件代发'
};
export default {
... ... @@ -71,6 +124,19 @@ export default {
],
tableData: null,
bucket: 'yhb-img01',
addressSelected: { // 下拉框选择的省市区
province: {value: '', label: ''},
city: {value: '', label: ''},
district: {value: '', label: ''},
street: {value: '', label: ''}
},
addressDetail: '', // 用户填写的地址
provinceList: [],
cityList: {},
districtList: {},
streetList: {},
labelInValue: true,
customerTel: ''
};
},
created() {
... ... @@ -78,14 +144,123 @@ export default {
this.shopService.getShop().then(
res => {
this.shopData = res.data;
console.log(this.shopData);
this.customerTel = this.shopData.customerTel || '';
if (res.data.shopsAddressInfo) {
setTimeout(this.manageAddress.bind(this), 1000, res.data.shopsAddressInfo)
}
this.tableData = JSON.parse(res.data.shopRelationList || '[]');
},
error => {
this.$Message.error(error.message);
}
);
this.getAddressData();
},
methods: {
getAddressData() { // 处理省市区数据
this.provinceList = [];
_.each(AddressData, (province) => {
let pro_item = { // 省份
name: province.label,
value: province.value
};
this.provinceList.push(pro_item);
this.cityList[province.value] = [];
_.each(province.children, (city) => { // 城市
let city_item = {
name: city.label,
value: city.value,
};
this.cityList[province.value].push(city_item);
this.districtList[city.value] = [];
_.each(city.children, (district) => { // 区划
let district_item = {
name: district.label,
value: district.value
};
this.districtList[city.value].push(district_item);
this.streetList[district.value] = [];
_.each(district.children, (street) => { // 街道
let street_item = {
name: street.label,
value: street.value
};
this.streetList[district.value].push(street_item);
});
});
})
});
},
clearAddress(clr1,clr2,clr3,clr4) {
if (clr1) {
this.addressSelected.province = {value: '', label: ''};
}
if (clr2) {
this.addressSelected.city = {value: '', label: ''};
}
if (clr3) {
this.addressSelected.district = {value: '', label: ''};
}
if (clr4) {
this.addressSelected.street = {value: '', label: ''};
}
},
manageAddress(address) { // 把接口返回的省市区数据从文字对应成value
if (address.province && this.provinceList.length > 0) {
let province = this.provinceList.filter(item => item.name === address.province);
if (province[0]) { // 找到省份对应的value
this.addressSelected.province = {value: province[0].value, label: province[0].name};
let city = this.cityList[province[0].value].filter(item => item.name === address.city);
if (city[0]) {
setTimeout(() => { // 找到城市对应的value,因为数据是级联绑定,需要setTimeout
this.addressSelected.city = {value: city[0].value, label: city[0].name};
let district = this.districtList[city[0].value].filter(item => item.name === address.county);
if (district[0]) { // 找到区划对应的value
setTimeout(() => {
this.addressSelected.district = {value: district[0].value, label: district[0].label};
let street = this.streetList[district[0].value].filter(item => item.name === address.street);
if (street[0]) { // 找到街道对应的value
setTimeout(() => {
this.addressSelected.street = {value: street[0].value, label: street[0].label};
})
}
}, 100);
}
}, 100);
}
}
}
this.addressDetail = address.detailAdd || '';
},
changeProvince(val) {
this.clearAddress(1, 1, 1, 1);
this.addressSelected.province = val;
},
changeCity(val) {
this.clearAddress(0, 1, 1, 1);
this.addressSelected.city = val;
},
changeDistrict(val) {
this.clearAddress(0, 0, 1, 1);
this.addressSelected.district = val;
},
changeStreet(val) {
this.clearAddress(0, 0, 0, 1);
this.addressSelected.street = val;
},
updateIntro(content) {
this.shopData.shopIntro = content;
},
... ... @@ -107,6 +282,12 @@ export default {
shopRelationList: this.shopData.shopRelationList,
shopsId: this.shopData.shopsId,
shopsType: this.shopData.shopsType,
province: this.addressSelected.province.label,
city: this.addressSelected.city.label,
county: this.addressSelected.district.label,
street: this.addressSelected.street.label,
detailAdd: this.addressDetail,
customerTel: this.customerTel,
shopIntro: xss(this.shopData.shopIntro),
businessLicense: xss(this.shopData.businessLicense),
};
... ... @@ -153,6 +334,24 @@ export default {
this.$Loading.start();
const newShop = this.beforeSubmit();
const regExp = /^([1]\d{10}|\d{2,4}-\d{0,3}[-]{0,1}\d{4,8})/;
if (newShop.shopNature === 6) {
if (!newShop.customerTel || !regExp.test(newShop.customerTel)) {
this.$Notice.error({
title: '保存错误',
desc: '请填写正确的客服电话',
});
return;
}
if (!newShop.province || !newShop.city || !newShop.detailAdd) {
this.$Notice.error({
title: '保存错误',
desc: '请选择并填写店铺地址',
});
return;
}
}
return this.shopService.saveBaseShopInfo(newShop).then(result => {
this.$Loading.finish();
... ... @@ -193,4 +392,23 @@ export default {
width: 124px;
box-sizing: border-box;
}
.address-select-container {
.ivu-select {
width: 180px;
}
.ivu-input-wrapper {
width: auto;
}
.ivu-input {
width: 300px;
}
p {
font-size: 12px;
color: red;
}
}
</style>
... ...
This diff could not be displayed because it is too large.
{
"name": "yoho-shop-manage",
"version": "1.2.5",
"version": "6.9.24-beta23",
"description": "",
"main": "app.js",
"scripts": {
... ...