Authored by lzhy

commit

@@ -48,6 +48,7 @@ export default { @@ -48,6 +48,7 @@ export default {
48 watch: { 48 watch: {
49 value: function(newValue) { 49 value: function(newValue) {
50 this.values = newValue.split('|'); 50 this.values = newValue.split('|');
  51 + console.log('disabel', this.disable);
51 } 52 }
52 } 53 }
53 }; 54 };
1 <template> 1 <template>
2 <div class="select-colors"> 2 <div class="select-colors">
3 - <div class="color-item" @click="selectColor(color)" v-for="color in colors" :key="color.id" 3 + <div class="color-item" @click="selectColor(color)" v-for="color in colors" :key="color.id"
4 :class="{ 4 :class="{
5 selected: color.selected, 5 selected: color.selected,
6 disabled: color.disabled 6 disabled: color.disabled
@@ -32,6 +32,10 @@ export default { @@ -32,6 +32,10 @@ export default {
32 default() { 32 default() {
33 return []; 33 return [];
34 } 34 }
  35 + },
  36 + disable: { // 已上架商品不支持修改
  37 + type: Boolean,
  38 + default: false
35 } 39 }
36 }, 40 },
37 created() { 41 created() {
@@ -64,7 +68,7 @@ export default { @@ -64,7 +68,7 @@ export default {
64 }); 68 });
65 }, 69 },
66 selectColor(color) { 70 selectColor(color) {
67 - if (color.disabled) { 71 + if (color.disabled || this.disable) {
68 return; 72 return;
69 } 73 }
70 color.selected = !color.selected; 74 color.selected = !color.selected;
1 <template> 1 <template>
2 <Checkbox-group :value="handleValue" @input="updateValue"> 2 <Checkbox-group :value="handleValue" @input="updateValue">
3 - <Checkbox v-for="name in idNameList" :label="name.id" :key="name.id"> 3 + <Checkbox v-for="name in idNameList" :label="name.id" :key="name.id" :disabled="disable">
4 <span>{{name.text}}</span> 4 <span>{{name.text}}</span>
5 </Checkbox> 5 </Checkbox>
6 </Checkbox-group> 6 </Checkbox-group>
@@ -21,6 +21,10 @@ export default { @@ -21,6 +21,10 @@ export default {
21 default: function() { 21 default: function() {
22 return []; 22 return [];
23 } 23 }
  24 + },
  25 + disable: {
  26 + type: Boolean,
  27 + default: false
24 } 28 }
25 }, 29 },
26 data() { 30 data() {
1 <template> 1 <template>
2 <Checkbox-group :value="updateValue" @on-change="selectSize"> 2 <Checkbox-group :value="updateValue" @on-change="selectSize">
3 - <Checkbox v-for="size in sizes" :key="size.id" :label="size.id" :disabled="size.disabled"> 3 + <Checkbox v-for="size in sizes" :key="size.id" :label="size.id" :disabled="size.disabled || disable">
4 <span>{{size.sizeName}}</span> 4 <span>{{size.sizeName}}</span>
5 </Checkbox> 5 </Checkbox>
6 </Checkbox-group> 6 </Checkbox-group>
@@ -27,6 +27,10 @@ export default { @@ -27,6 +27,10 @@ export default {
27 default() { 27 default() {
28 return []; 28 return [];
29 } 29 }
  30 + },
  31 + disable: {
  32 + type: Boolean,
  33 + default: false
30 } 34 }
31 }, 35 },
32 created() { 36 created() {
@@ -44,6 +44,7 @@ export default { @@ -44,6 +44,7 @@ export default {
44 }, 44 },
45 created() { 45 created() {
46 this.userService = new UserService(); 46 this.userService = new UserService();
  47 + console.log('user=', this.$user);
47 }, 48 },
48 methods: { 49 methods: {
49 logout() { 50 logout() {
@@ -8,11 +8,12 @@ @@ -8,11 +8,12 @@
8 </div> 8 </div>
9 <div class="upload-item" v-for="(image, imageIndex) in good.goodsImage" :key="imageIndex"> 9 <div class="upload-item" v-for="(image, imageIndex) in good.goodsImage" :key="imageIndex">
10 <div class="upload-item-img"> 10 <div class="upload-item-img">
  11 + <div v-if="disable" class="disable-mask"></div>
11 <img v-if="imageIndex === 0 && image.imageUrl" :src="image.imageUrl" 12 <img v-if="imageIndex === 0 && image.imageUrl" :src="image.imageUrl"
12 alt="" 13 alt=""
13 width="120px" 14 width="120px"
14 height="122px"> 15 height="122px">
15 - <drag-file-upload v-if="imageIndex > 0" 16 + <drag-file-upload v-if="imageIndex > 0"
16 :default-file="image.imageUrl" 17 :default-file="image.imageUrl"
17 :id="{goodIndex, imageIndex}" 18 :id="{goodIndex, imageIndex}"
18 :skn="good.productSkn" 19 :skn="good.productSkn"
@@ -37,6 +38,10 @@ export default { @@ -37,6 +38,10 @@ export default {
37 default() { 38 default() {
38 return []; 39 return [];
39 } 40 }
  41 + },
  42 + disable: {
  43 + type: Boolean,
  44 + default: false
40 } 45 }
41 }, 46 },
42 data() { 47 data() {
@@ -91,6 +96,14 @@ export default { @@ -91,6 +96,14 @@ export default {
91 height: 120px; 96 height: 120px;
92 width: 120px; 97 width: 120px;
93 box-sizing: border-box; 98 box-sizing: border-box;
  99 + position: relative;
  100 +
  101 + .disable-mask {
  102 + position: absolute;
  103 + width: 100%;
  104 + height: 100%;
  105 + z-index: 9;
  106 + }
94 107
95 img { 108 img {
96 width: 100%; 109 width: 100%;
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 :maxlength="maxlength" 7 :maxlength="maxlength"
8 :class="{'input-ele': true}" 8 :class="{'input-ele': true}"
9 :value="currentValue" 9 :value="currentValue"
10 - @input="inputEvent"></Input> 10 + @input="inputEvent" :disabled="disable"></Input>
11 <p class="input-txt"> 11 <p class="input-txt">
12 <span>{{txtMsg}}</span> 12 <span>{{txtMsg}}</span>
13 </p> 13 </p>
@@ -33,6 +33,10 @@ export default { @@ -33,6 +33,10 @@ export default {
33 maxlength: { 33 maxlength: {
34 type: Number, 34 type: Number,
35 default: 250 35 default: 250
  36 + },
  37 + disable: {
  38 + type: Boolean,
  39 + default: false
36 } 40 }
37 }, 41 },
38 computed: { 42 computed: {
1 <template> 1 <template>
2 - <Input :value="currentValue" v-bind="$attrs" v-on="$listeners" /> 2 + <Input :value="currentValue" v-bind="$attrs" v-on="$listeners" :disabled="disabled"/>
3 </template> 3 </template>
4 4
5 <script> 5 <script>
@@ -7,7 +7,7 @@ import xss from 'util/xss'; @@ -7,7 +7,7 @@ import xss from 'util/xss';
7 7
8 export default { 8 export default {
9 name: 'input-safe', 9 name: 'input-safe',
10 - props: ['value'], 10 + props: ['value', 'disabled'],
11 created() { 11 created() {
12 this.$listeners.input = this.input; 12 this.$listeners.input = this.input;
13 }, 13 },
@@ -43,6 +43,7 @@ @@ -43,6 +43,7 @@
43 }, 43 },
44 brandId(newValue) { 44 brandId(newValue) {
45 this.sellTypeService.getSellType({brandId: newValue}).then((result) => { 45 this.sellTypeService.getSellType({brandId: newValue}).then((result) => {
  46 + console.log(result);
46 if (result.code === 200) { 47 if (result.code === 200) {
47 this.list = result.data; 48 this.list = result.data;
48 49
1 <template> 1 <template>
2 <Table ref="sellerGoods" 2 <Table ref="sellerGoods"
3 - class="table-good-size"  
4 - :data="table.data"  
5 - :columns="table.columns"  
6 - stripe 3 + class="table-good-size"
  4 + :data="table.data"
  5 + :columns="table.columns"
  6 + stripe
7 border></Table> 7 border></Table>
8 </template> 8 </template>
9 9
@@ -16,6 +16,10 @@ export default { @@ -16,6 +16,10 @@ export default {
16 default() { 16 default() {
17 return []; 17 return [];
18 } 18 }
  19 + },
  20 + disable: {
  21 + type: Boolean,
  22 + default: false
19 } 23 }
20 }, 24 },
21 data() { 25 data() {
@@ -30,7 +34,8 @@ export default { @@ -30,7 +34,8 @@ export default {
30 h('p', {}, this.table.data[params.index].goodsName.name), 34 h('p', {}, this.table.data[params.index].goodsName.name),
31 h('Radio', { 35 h('Radio', {
32 props: { 36 props: {
33 - value: this.table.data[params.index].goodsName.isDefault 37 + value: this.table.data[params.index].goodsName.isDefault,
  38 + disabled: this.disable
34 }, 39 },
35 on: { 40 on: {
36 'on-change': () => { 41 'on-change': () => {
@@ -52,7 +57,8 @@ export default { @@ -52,7 +57,8 @@ export default {
52 if (this.isExist(params.index)) { 57 if (this.isExist(params.index)) {
53 return h('input-safe', { 58 return h('input-safe', {
54 props: { 59 props: {
55 - value: params.row.factoryGoodsName 60 + value: params.row.factoryGoodsName,
  61 + disabled: this.disable,
56 }, 62 },
57 attrs: { 63 attrs: {
58 placeholder: params.row.goodsName.name 64 placeholder: params.row.goodsName.name
@@ -80,6 +86,7 @@ export default { @@ -80,6 +86,7 @@ export default {
80 86
81 return ( 87 return (
82 <div class={{'table-upload-item': true}}> 88 <div class={{'table-upload-item': true}}>
  89 + {(this.disable) ? (<div class={{'disable-mask' : true}}></div>) : ''}
83 <drag-file-upload 90 <drag-file-upload
84 id={{index: params.index}} 91 id={{index: params.index}}
85 default-file={row.goodsColorImage.value} 92 default-file={row.goodsColorImage.value}
@@ -171,7 +178,7 @@ export default { @@ -171,7 +178,7 @@ export default {
171 <input-safe 178 <input-safe
172 value={size.name} 179 value={size.name}
173 onInput={val => (size.name = val)} 180 onInput={val => (size.name = val)}
174 - disabled={!params.row.operator[i].value} 181 + disabled={!params.row.operator[i].value || this.disable}
175 placeholder="请输入..." 182 placeholder="请输入..."
176 style={{width: '100%'}} 183 style={{width: '100%'}}
177 /> 184 />
@@ -430,8 +437,17 @@ export default { @@ -430,8 +437,17 @@ export default {
430 } 437 }
431 438
432 .table-upload-item { 439 .table-upload-item {
  440 + position: relative;
433 text-align: center; 441 text-align: center;
434 padding: 10px; 442 padding: 10px;
  443 + box-sizing: border-box;
  444 +
  445 + .disable-mask {
  446 + position: absolute;
  447 + width: 100%;
  448 + height: 100%;
  449 + z-index: 10;
  450 + }
435 } 451 }
436 452
437 .example-pop { 453 .example-pop {
@@ -14,13 +14,13 @@ @@ -14,13 +14,13 @@
14 <span>{{product.smallSortName}}</span> 14 <span>{{product.smallSortName}}</span>
15 </Form-item> 15 </Form-item>
16 <Form-item label="商品名称" prop="productName"> 16 <Form-item label="商品名称" prop="productName">
17 - <input-safe v-model="product.productName" placeholder="请输入..." /> 17 + <input-safe v-model="product.productName" placeholder="请输入..." :disabled="isView" />
18 </Form-item> 18 </Form-item>
19 <Form-item label="商品卖点"> 19 <Form-item label="商品卖点">
20 - <input-safe v-model="product.phrase" :maxlength="12" placeholder="最多12个字符"/> 20 + <input-safe v-model="product.phrase" :maxlength="12" placeholder="最多12个字符" :disabled="isView"/>
21 </Form-item> 21 </Form-item>
22 <Form-item label="商家商品编码" prop="factoryCode"> 22 <Form-item label="商家商品编码" prop="factoryCode">
23 - <input-safe v-model="product.factoryCode" placeholder="请输入..." /> 23 + <input-safe v-model="product.factoryCode" placeholder="请输入..." :disabled="isView" />
24 </Form-item> 24 </Form-item>
25 <Form-item label="货品年"> 25 <Form-item label="货品年">
26 <Date-picker :value="product.goodsYears && product.goodsYears.toString()" type="year" placeholder="选择年" disabled> 26 <Date-picker :value="product.goodsYears && product.goodsYears.toString()" type="year" placeholder="选择年" disabled>
@@ -30,35 +30,35 @@ @@ -30,35 +30,35 @@
30 <select-season v-model="product.goodsSeason" :disable="true"></select-season> 30 <select-season v-model="product.goodsSeason" :disable="true"></select-season>
31 </Form-item> 31 </Form-item>
32 <Form-item label="上市日期" prop="expectSaleTimeStr"> 32 <Form-item label="上市日期" prop="expectSaleTimeStr">
33 - <Date-picker :value="product.expectSaleTimeStr" @on-change="clickSaleDate" type="date" placeholder="选择日期" style="width: 400px"></Date-picker> 33 + <Date-picker :value="product.expectSaleTimeStr" @on-change="clickSaleDate" type="date" placeholder="选择日期" :disabled="isView" style="width: 400px"></Date-picker>
34 </Form-item> 34 </Form-item>
35 <Form-item label="性别"> 35 <Form-item label="性别">
36 <radio-gender v-model="product.gender" :disable="true"></radio-gender> 36 <radio-gender v-model="product.gender" :disable="true"></radio-gender>
37 </Form-item> 37 </Form-item>
38 <Form-item label="适销季" prop="seasons"> 38 <Form-item label="适销季" prop="seasons">
39 - <radio-season v-model="product.seasons" ></radio-season> 39 + <radio-season v-model="product.seasons" :disable="isView"></radio-season>
40 </Form-item> 40 </Form-item>
41 <Form-item label="年龄层" prop="ageLevel"> 41 <Form-item label="年龄层" prop="ageLevel">
42 - <checkbox-age v-model="product.ageLevel"></checkbox-age> 42 + <checkbox-age v-model="product.ageLevel" :disable="disable || isView"></checkbox-age>
43 </Form-item> 43 </Form-item>
44 <div class="create-item-title">商品规格 44 <div class="create-item-title">商品规格
45 <span class="create-group-sub-title">(颜色名称只能填写中文,最多5个汉字。款型编码和条码只能填写英文和数字,不区分大小写)</span> 45 <span class="create-group-sub-title">(颜色名称只能填写中文,最多5个汉字。款型编码和条码只能填写英文和数字,不区分大小写)</span>
46 </div> 46 </div>
47 <Form-item label="颜色"> 47 <Form-item label="颜色">
48 - <checkbox-color v-model="colors" 48 + <checkbox-color v-model="colors" :disable="disable || isView"
49 :select-colors="table.defaultSelectedColors" @on-add="addColor" @on-remove="removeColor"> 49 :select-colors="table.defaultSelectedColors" @on-add="addColor" @on-remove="removeColor">
50 </checkbox-color> 50 </checkbox-color>
51 </Form-item> 51 </Form-item>
52 <Form-item label="尺寸"> 52 <Form-item label="尺寸">
53 - <checkbox-size v-model="sizes" 53 + <checkbox-size v-model="sizes" :disable="disable || isView"
54 :sort-id="this.product.smallSortId" :select-sizes="table.defaultSelectedSizes" 54 :sort-id="this.product.smallSortId" :select-sizes="table.defaultSelectedSizes"
55 @on-add="addSize" @on-remove="removeSize"> 55 @on-add="addSize" @on-remove="removeSize">
56 </checkbox-size> 56 </checkbox-size>
57 </Form-item> 57 </Form-item>
58 <Form-item> 58 <Form-item>
59 - <table-good-size ref="tableGood" v-model="table.data"  
60 - @on-upload="uploadGoodSzieSuccess"  
61 - @on-factory-name="onChangeFactoryCode"></table-good-size> 59 + <table-good-size ref="tableGood" v-model="table.data"
  60 + @on-upload="uploadGoodSzieSuccess"
  61 + @on-factory-name="onChangeFactoryCode" :disable="disable || isView"></table-good-size>
62 </Form-item> 62 </Form-item>
63 <div class="create-item-title">商品价格</div> 63 <div class="create-item-title">商品价格</div>
64 <Form-item label="吊牌价"> 64 <Form-item label="吊牌价">
@@ -77,18 +77,22 @@ @@ -77,18 +77,22 @@
77 <a href="javascript: void 0;" @click="onClickShowExample">查看色卡图片示例</a> 77 <a href="javascript: void 0;" @click="onClickShowExample">查看色卡图片示例</a>
78 </span> 78 </span>
79 </div> 79 </div>
80 - <image-goods-main v-model="product.goods"></image-goods-main> 80 + <image-goods-main v-model="product.goods" :disable="isView"></image-goods-main>
81 <div class="create-item-title">商品推荐短语 81 <div class="create-item-title">商品推荐短语
82 <span class="create-group-sub-title">(默认在前台商品详情页显示)</span> 82 <span class="create-group-sub-title">(默认在前台商品详情页显示)</span>
83 </div> 83 </div>
84 <div> 84 <div>
85 - <input-length v-model="product.recommendPhrase" :maxlength="500" placeholder="最多500个字符"></input-length> 85 + <input-length v-model="product.recommendPhrase" :disable="isView" :maxlength="500" placeholder="最多500个字符"></input-length>
86 </div> 86 </div>
87 <div class="create-item-title">商品描述 87 <div class="create-item-title">商品描述
88 <span class="create-group-sub-title">(详情页内容)</span> 88 <span class="create-group-sub-title">(详情页内容)</span>
89 </div> 89 </div>
90 - <editor :content="product.productIntro"  
91 - @change="updateProductDesc"></editor> 90 + <div class="editor-container">
  91 + <div class="editor-mask" v-if="isView"></div>
  92 + <editor :content="product.productIntro"
  93 + @change="updateProductDesc"></editor>
  94 + </div>
  95 +
92 <div class="create-item-title">商品属性 96 <div class="create-item-title">商品属性
93 <span class="create-group-sub-title">(请认真选择所列的属性项,所填内容会对商品搜索、智能推荐等功能产生影响,从而影响商品曝光展示)</span> 97 <span class="create-group-sub-title">(请认真选择所列的属性项,所填内容会对商品搜索、智能推荐等功能产生影响,从而影响商品曝光展示)</span>
94 </div> 98 </div>
@@ -99,14 +103,14 @@ @@ -99,14 +103,14 @@
99 :key="attrIndex"> 103 :key="attrIndex">
100 <template v-if="attr.inputType === 'select'"> 104 <template v-if="attr.inputType === 'select'">
101 <Select v-model="attr.model[0]" 105 <Select v-model="attr.model[0]"
102 - :placeholder="'请选择' + attr.attributeName"> 106 + :placeholder="'请选择' + attr.attributeName" :disabled="isView">
103 <Option v-for="name in attr.idNameList" :value="name.id" :key="name.id">{{name.text}}</Option> 107 <Option v-for="name in attr.idNameList" :value="name.id" :key="name.id">{{name.text}}</Option>
104 </Select> 108 </Select>
105 </template> 109 </template>
106 110
107 <template v-else> 111 <template v-else>
108 <Checkbox-group v-model="attr.model"> 112 <Checkbox-group v-model="attr.model">
109 - <Checkbox v-for="name in attr.idNameList" :label="name.id" :key="name.id"> 113 + <Checkbox v-for="name in attr.idNameList" :label="name.id" :key="name.id" :disabled="isView">
110 <span>{{name.text}}</span> 114 <span>{{name.text}}</span>
111 </Checkbox> 115 </Checkbox>
112 </Checkbox-group> 116 </Checkbox-group>
@@ -114,12 +118,13 @@ @@ -114,12 +118,13 @@
114 </Form-item> 118 </Form-item>
115 </div> 119 </div>
116 <Form-item v-if="model.productMaterial" :label="model.productMaterial.attributeName"> 120 <Form-item v-if="model.productMaterial" :label="model.productMaterial.attributeName">
117 - <checkbox-material v-model="product.materialList" :idNameList="model.productMaterial.idNameList"> 121 + <checkbox-material v-model="product.materialList" :idNameList="model.productMaterial.idNameList" :disable="isView">
118 </checkbox-material> 122 </checkbox-material>
119 </Form-item> 123 </Form-item>
120 <Form-item> 124 <Form-item>
121 <div class="btn-fixed" :class="btnFixClass"> 125 <div class="btn-fixed" :class="btnFixClass">
122 - <Button type="primary" @click="submit" size="large" id="btnSave">保存</Button> 126 + <Button type="primary" @click="backToList" size="large" v-if="isView">关闭</Button>
  127 + <Button type="primary" @click="submit" size="large" id="btnSave" v-else>保存</Button>
123 </div> 128 </div>
124 </Form-item> 129 </Form-item>
125 <back-top-dom :bottom="100"></back-top-dom> 130 <back-top-dom :bottom="100"></back-top-dom>
@@ -143,6 +148,9 @@ export default { @@ -143,6 +148,9 @@ export default {
143 this.productService = new ProductService(); 148 this.productService = new ProductService();
144 this.productCreateService = new ProductCreateService(); 149 this.productCreateService = new ProductCreateService();
145 this.from = this.$route.query.from || this.from; 150 this.from = this.$route.query.from || this.from;
  151 + this.viewType = this.$route.query.type || '';
  152 + this.disable = this.from !== 'product.offsale'; // 用于对已上架商品限制修改
  153 + this.isView = this.viewType === 'view';
146 154
147 this.productService.getProduct(this.$route.params.id).then((result) => { 155 this.productService.getProduct(this.$route.params.id).then((result) => {
148 if (result.code === 200) { 156 if (result.code === 200) {
@@ -596,6 +604,9 @@ export default { @@ -596,6 +604,9 @@ export default {
596 go(from) { 604 go(from) {
597 this.$router.push({ name: from }); 605 this.$router.push({ name: from });
598 }, 606 },
  607 + backToList() {
  608 + this.go(this.from);
  609 + },
599 submit() { 610 submit() {
600 this.validate() 611 this.validate()
601 .then(([r1, r2]) => { 612 .then(([r1, r2]) => {
@@ -711,4 +722,17 @@ export default { @@ -711,4 +722,17 @@ export default {
711 margin-top: 20px; 722 margin-top: 20px;
712 } 723 }
713 724
  725 +.editor-container {
  726 + position: relative;
  727 + overflow: hidden;
  728 +
  729 + .editor-mask {
  730 + position: absolute;
  731 + width: 100%;
  732 + height: 100%;
  733 + z-index: 1001;
  734 + background-color: rgba(240, 240, 240, 0.8)
  735 + }
  736 +}
  737 +
714 </style> 738 </style>
@@ -263,6 +263,19 @@ @@ -263,6 +263,19 @@
263 } 263 }
264 }); 264 });
265 }, 265 },
  266 + showProduct(skn) {
  267 + this.$router.push({
  268 + name: 'product.edit',
  269 + params: {
  270 + id: skn
  271 + },
  272 + query: {
  273 + from: 'product.onsale',
  274 + type: 'view',
  275 + page: this.pageData.current || 1
  276 + }
  277 + })
  278 + },
266 editProduct(skn) { 279 editProduct(skn) {
267 this.$router.push({ 280 this.$router.push({
268 name: 'product.edit', 281 name: 'product.edit',
@@ -126,6 +126,7 @@ export default function() { @@ -126,6 +126,7 @@ export default function() {
126 align: 'center', 126 align: 'center',
127 render: (h, params) => { 127 render: (h, params) => {
128 const row = params.row; 128 const row = params.row;
  129 + console.log('auditStatus:', row.auditStatus);
129 const disabled = row._disabled; 130 const disabled = row._disabled;
130 const status = row.auditStatus; 131 const status = row.auditStatus;
131 132
@@ -133,11 +134,17 @@ export default function() { @@ -133,11 +134,17 @@ export default function() {
133 <div> 134 <div>
134 <div class="cell-action-row"> 135 <div class="cell-action-row">
135 <i-button type="primary" size="small" 136 <i-button type="primary" size="small"
  137 + onClick = {() => this.showProduct(row.productSkn)}>
  138 +
  139 + </i-button>
  140 + </div>
  141 + <div class="cell-action-row">
  142 + <i-button type="primary" size="small"
136 onClick={() => this.editSize(row.productSkn)}> 143 onClick={() => this.editSize(row.productSkn)}>
137 尺码维护 144 尺码维护
138 </i-button> 145 </i-button>
139 </div> 146 </div>
140 - {status !== 3 ? ( 147 + {status !== null ? (
141 <div class="cell-action-row"> 148 <div class="cell-action-row">
142 <i-button type="primary" size="small" 149 <i-button type="primary" size="small"
143 onClick={() => this.editProduct(row.productSkn)}> 150 onClick={() => this.editProduct(row.productSkn)}>
@@ -30,6 +30,57 @@ @@ -30,6 +30,57 @@
30 <Form-item label="营业执照:"> 30 <Form-item label="营业执照:">
31 <editor :content="shopData.businessLicense" @change="updateLicense"> </editor> 31 <editor :content="shopData.businessLicense" @change="updateLicense"> </editor>
32 </Form-item> 32 </Form-item>
  33 + <Form-item v-if="shopData.shopNature === 6" label="店铺地址:">
  34 + <!--省市区街道联动下拉框-->
  35 + <div class="address-select-container">
  36 + <Select v-model="addressSelected.province.value"
  37 + class="province-select"yar
  38 + placeholder="请选择省/直辖市"
  39 + :label-in-value="labelInValue"
  40 + @on-change="changeProvince"
  41 + data-type="province">
  42 + <Option v-for="prvOption in provinceList" :label="prvOption.name" :value="prvOption.value" :key="prvOption.value"></Option>
  43 + </Select>
  44 + <Select v-model="addressSelected.city.value"
  45 + class="city-select"
  46 + placeholder="请选择市"
  47 + :label-in-value="labelInValue"
  48 + @on-change="changeCity"
  49 + data-type="city">
  50 + <Option v-for="cityOption in cityList[addressSelected.province.value]" :label="cityOption.name" :value="cityOption.value" :key="cityOption.value"></Option>
  51 + </Select>
  52 + <Select v-model="addressSelected.district.value"
  53 + class="district-select"
  54 + placeholder="请选择区/县"
  55 + :label-in-value="labelInValue"
  56 + @on-change="changeDistrict"
  57 + data-type="district">
  58 + <Option v-for="disOption in districtList[addressSelected.city.value]" :label="disOption.name" :value="disOption.value" :key="disOption.value"></Option>
  59 + </Select>
  60 + <Select v-model="addressSelected.street.value"
  61 + class="street-select"
  62 + placeholder="请选择街道"
  63 + :label-in-value="labelInValue"
  64 + @on-change="changeStreet"
  65 + data-type="street">
  66 + <Option v-for="streetOption in streetList[addressSelected.district.value]" :label="streetOption.name" :value="streetOption.value" :key="streetOption.value"></Option>
  67 + </Select>
  68 + <Input v-model="addressDetail" placeholder="详细地址"></Input>
  69 + <p>注:店铺地址味店铺最新可联系到的地址</p>
  70 + </div>
  71 + </Form-item>
  72 + <Form-item v-if="shopData.shopNature === 6" label="店铺客服电话:">
  73 + <Input v-model="customerTel" placeholder="请填写电话" style="width: 150px"></Input>
  74 + </Form-item>
  75 + <Form-item v-if="shopData.shopNature === 6" label="支付宝帐号:">
  76 + <p>{{shopData.zfbAccount}}</p>
  77 + </Form-item>
  78 + <Form-item v-if="shopData.shopNature === 6" label="支付宝帐号名称:">
  79 + <p>{{shopData.zfbAccountName}}</p>
  80 + </Form-item>
  81 + <Form-item v-if="shopData.shopNature === 6" label="联系方式:">
  82 + <p>{{shopData.checkTel}}</p>
  83 + </Form-item>
33 <Form-item label="品牌-供应商:"> 84 <Form-item label="品牌-供应商:">
34 <Table :columns="tableCols" width="700" :data="tableData"></Table> 85 <Table :columns="tableCols" width="700" :data="tableData"></Table>
35 </Form-item> 86 </Form-item>
@@ -44,11 +95,13 @@ @@ -44,11 +95,13 @@
44 import xss from 'xss'; 95 import xss from 'xss';
45 import _ from 'lodash'; 96 import _ from 'lodash';
46 import ShopService from 'services/shop/shop-service'; 97 import ShopService from 'services/shop/shop-service';
  98 +import AddressData from 'services/shop/regions.json';
47 99
48 const SHOPNATURE = { 100 const SHOPNATURE = {
49 1: '旗舰店', 101 1: '旗舰店',
50 2: '专卖店', 102 2: '专卖店',
51 3: '初始状态(异常情况)', 103 3: '初始状态(异常情况)',
  104 + 6: '一件代发'
52 }; 105 };
53 106
54 export default { 107 export default {
@@ -71,6 +124,19 @@ export default { @@ -71,6 +124,19 @@ export default {
71 ], 124 ],
72 tableData: null, 125 tableData: null,
73 bucket: 'yhb-img01', 126 bucket: 'yhb-img01',
  127 + addressSelected: { // 下拉框选择的省市区
  128 + province: {value: '', label: ''},
  129 + city: {value: '', label: ''},
  130 + district: {value: '', label: ''},
  131 + street: {value: '', label: ''}
  132 + },
  133 + addressDetail: '', // 用户填写的地址
  134 + provinceList: [],
  135 + cityList: {},
  136 + districtList: {},
  137 + streetList: {},
  138 + labelInValue: true,
  139 + customerTel: ''
74 }; 140 };
75 }, 141 },
76 created() { 142 created() {
@@ -78,14 +144,123 @@ export default { @@ -78,14 +144,123 @@ export default {
78 this.shopService.getShop().then( 144 this.shopService.getShop().then(
79 res => { 145 res => {
80 this.shopData = res.data; 146 this.shopData = res.data;
  147 + console.log(this.shopData);
  148 + this.customerTel = this.shopData.customerTel || '';
  149 + if (res.data.shopsAddressInfo) {
  150 + setTimeout(this.manageAddress.bind(this), 1000, res.data.shopsAddressInfo)
  151 + }
81 this.tableData = JSON.parse(res.data.shopRelationList || '[]'); 152 this.tableData = JSON.parse(res.data.shopRelationList || '[]');
82 }, 153 },
83 error => { 154 error => {
84 this.$Message.error(error.message); 155 this.$Message.error(error.message);
85 } 156 }
86 ); 157 );
  158 + this.getAddressData();
87 }, 159 },
88 methods: { 160 methods: {
  161 + getAddressData() { // 处理省市区数据
  162 + this.provinceList = [];
  163 + _.each(AddressData, (province) => {
  164 + let pro_item = { // 省份
  165 + name: province.label,
  166 + value: province.value
  167 + };
  168 + this.provinceList.push(pro_item);
  169 +
  170 + this.cityList[province.value] = [];
  171 + _.each(province.children, (city) => { // 城市
  172 + let city_item = {
  173 + name: city.label,
  174 + value: city.value,
  175 + };
  176 + this.cityList[province.value].push(city_item);
  177 +
  178 + this.districtList[city.value] = [];
  179 + _.each(city.children, (district) => { // 区划
  180 + let district_item = {
  181 + name: district.label,
  182 + value: district.value
  183 + };
  184 + this.districtList[city.value].push(district_item);
  185 +
  186 + this.streetList[district.value] = [];
  187 + _.each(district.children, (street) => { // 街道
  188 + let street_item = {
  189 + name: street.label,
  190 + value: street.value
  191 + };
  192 + this.streetList[district.value].push(street_item);
  193 + });
  194 + });
  195 + })
  196 + });
  197 + },
  198 + clearAddress(clr1,clr2,clr3,clr4) {
  199 + if (clr1) {
  200 + this.addressSelected.province = {value: '', label: ''};
  201 + }
  202 + if (clr2) {
  203 + this.addressSelected.city = {value: '', label: ''};
  204 + }
  205 +
  206 + if (clr3) {
  207 + this.addressSelected.district = {value: '', label: ''};
  208 + }
  209 +
  210 + if (clr4) {
  211 + this.addressSelected.street = {value: '', label: ''};
  212 + }
  213 + },
  214 + manageAddress(address) { // 把接口返回的省市区数据从文字对应成value
  215 + if (address.province && this.provinceList.length > 0) {
  216 + let province = this.provinceList.filter(item => item.name === address.province);
  217 + if (province[0]) { // 找到省份对应的value
  218 + this.addressSelected.province = {value: province[0].value, label: province[0].name};
  219 +
  220 + let city = this.cityList[province[0].value].filter(item => item.name === address.city);
  221 + if (city[0]) {
  222 + setTimeout(() => { // 找到城市对应的value,因为数据是级联绑定,需要setTimeout
  223 + this.addressSelected.city = {value: city[0].value, label: city[0].name};
  224 +
  225 + let district = this.districtList[city[0].value].filter(item => item.name === address.county);
  226 +
  227 + if (district[0]) { // 找到区划对应的value
  228 + setTimeout(() => {
  229 + this.addressSelected.district = {value: district[0].value, label: district[0].label};
  230 +
  231 + let street = this.streetList[district[0].value].filter(item => item.name === address.street);
  232 +
  233 + if (street[0]) { // 找到街道对应的value
  234 + setTimeout(() => {
  235 + this.addressSelected.street = {value: street[0].value, label: street[0].label};
  236 + })
  237 + }
  238 + }, 100);
  239 + }
  240 + }, 100);
  241 +
  242 + }
  243 + }
  244 + }
  245 +
  246 + this.addressDetail = address.detailAdd || '';
  247 + },
  248 + changeProvince(val) {
  249 + this.clearAddress(1, 1, 1, 1);
  250 + this.addressSelected.province = val;
  251 + },
  252 + changeCity(val) {
  253 + this.clearAddress(0, 1, 1, 1);
  254 + this.addressSelected.city = val;
  255 + },
  256 + changeDistrict(val) {
  257 + this.clearAddress(0, 0, 1, 1);
  258 + this.addressSelected.district = val;
  259 + },
  260 + changeStreet(val) {
  261 + this.clearAddress(0, 0, 0, 1);
  262 + this.addressSelected.street = val;
  263 + },
89 updateIntro(content) { 264 updateIntro(content) {
90 this.shopData.shopIntro = content; 265 this.shopData.shopIntro = content;
91 }, 266 },
@@ -107,6 +282,12 @@ export default { @@ -107,6 +282,12 @@ export default {
107 shopRelationList: this.shopData.shopRelationList, 282 shopRelationList: this.shopData.shopRelationList,
108 shopsId: this.shopData.shopsId, 283 shopsId: this.shopData.shopsId,
109 shopsType: this.shopData.shopsType, 284 shopsType: this.shopData.shopsType,
  285 + province: this.addressSelected.province.label,
  286 + city: this.addressSelected.city.label,
  287 + county: this.addressSelected.district.label,
  288 + street: this.addressSelected.street.label,
  289 + detailAdd: this.addressDetail,
  290 + customerTel: this.customerTel,
110 shopIntro: xss(this.shopData.shopIntro), 291 shopIntro: xss(this.shopData.shopIntro),
111 businessLicense: xss(this.shopData.businessLicense), 292 businessLicense: xss(this.shopData.businessLicense),
112 }; 293 };
@@ -153,6 +334,24 @@ export default { @@ -153,6 +334,24 @@ export default {
153 this.$Loading.start(); 334 this.$Loading.start();
154 335
155 const newShop = this.beforeSubmit(); 336 const newShop = this.beforeSubmit();
  337 + const regExp = /^([1]\d{10}|\d{2,4}-\d{0,3}[-]{0,1}\d{4,8})/;
  338 +
  339 + if (newShop.shopNature === 6) {
  340 + if (!newShop.customerTel || !regExp.test(newShop.customerTel)) {
  341 + this.$Notice.error({
  342 + title: '保存错误',
  343 + desc: '请填写正确的客服电话',
  344 + });
  345 + return;
  346 + }
  347 + if (!newShop.province || !newShop.city || !newShop.detailAdd) {
  348 + this.$Notice.error({
  349 + title: '保存错误',
  350 + desc: '请选择并填写店铺地址',
  351 + });
  352 + return;
  353 + }
  354 + }
156 355
157 return this.shopService.saveBaseShopInfo(newShop).then(result => { 356 return this.shopService.saveBaseShopInfo(newShop).then(result => {
158 this.$Loading.finish(); 357 this.$Loading.finish();
@@ -193,4 +392,23 @@ export default { @@ -193,4 +392,23 @@ export default {
193 width: 124px; 392 width: 124px;
194 box-sizing: border-box; 393 box-sizing: border-box;
195 } 394 }
  395 +
  396 +.address-select-container {
  397 + .ivu-select {
  398 + width: 180px;
  399 + }
  400 +
  401 + .ivu-input-wrapper {
  402 + width: auto;
  403 + }
  404 +
  405 + .ivu-input {
  406 + width: 300px;
  407 + }
  408 +
  409 + p {
  410 + font-size: 12px;
  411 + color: red;
  412 + }
  413 +}
196 </style> 414 </style>
This diff could not be displayed because it is too large.
1 { 1 {
2 "name": "yoho-shop-manage", 2 "name": "yoho-shop-manage",
3 - "version": "1.2.5", 3 + "version": "6.9.24-beta23",
4 "description": "", 4 "description": "",
5 "main": "app.js", 5 "main": "app.js",
6 "scripts": { 6 "scripts": {