Blame view

admin-web-master/src/views/renovation/commoditySystem/addCommodity.vue 8.99 KB
3f535f30   杨鑫   '初始'
1
2
3
4
5
6
  <template>
    <el-dialog :close-on-click-modal="false" title="详情" width="74%" :visible.sync="visible">
      <div>
        <el-card class="box-card" >
         <div style="display:flex;justify-content: space-between;">
           <div class="addTitle">商品详情</div>
65478d1d   杨鑫   '最新'
7
           <div><el-button class="buttonHover"
3f535f30   杨鑫   '初始'
8
               style="color: #606266;border: 1px solid #dddfe5;background-color: #fff;" @click="back">关闭</el-button>
65478d1d   杨鑫   '最新'
9
           <el-button v-if="productItem.shelveState === 2" style="background-color: #3F9B6A;color: #fff" @click="examineShow(productData)">审核</el-button></div>
3f535f30   杨鑫   '初始'
10
11
12
13
14
15
16
17
         </div>
        </el-card>
        <el-card class="box-card">
          <label>商品详情</label>
          <div class="GoodBox">
            <el-row class="detail-box">
              <el-col :span="12">
                <div>商品名称:{{ productItem.productName }}</div>
a18f16a9   杨鑫   提交1
18
                <div style="padding:0 10px 0 0;white-space: nowrap; overflow: hidden;text-overflow: ellipsis;">商品卖点:{{ productItem.productBrief }}</div>
3f535f30   杨鑫   '初始'
19
20
                <div>
                  商品图片:
65478d1d   杨鑫   '最新'
21
                  <div >
3f535f30   杨鑫   '初始'
22
23
24
25
                    <img
                      v-for="(item, index) in productItem.images"
                      :key="index"
                      class="proImage"
65478d1d   杨鑫   '最新'
26
                      :src="$baseURL+item.imgPath"
3f535f30   杨鑫   '初始'
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
                      alt=""
                      @click="handlePictureCardPreview(item)"
                    >
                  </div>
                </div>
                <div>商品款式:</div>
              </el-col>
              <el-col :span="12">
                <div>官方分类:{{ productItem.classifyName }}</div>
                <div>商家分组:{{ productItem.shopGroupName }}</div>
                <div>商家名称:{{ productItem.shopName }}</div>
                <div>
                  商品状态:
                  <span v-if="productItem.shelveState == 0">已下架 </span>
                  <span v-if="productItem.shelveState == 1">已上架</span>
                  <span v-if="productItem.shelveState == 2">待审核</span>
                  <span v-if="productItem.shelveState == 3">审核失败</span>
                </div>
8dca79c8   杨鑫   1
45
46
47
48
  			  <div v-if="productItem.combinationName !=''">
  			    商品组合:
  			    <span >{{productItem.combinationName}} </span>
  			  </div>
3f535f30   杨鑫   '初始'
49
50
51
52
53
54
55
56
57
              </el-col>
            </el-row>
            <el-row class="detail-box">
              <el-col :span="24">
                <el-table
                  :data="productItem.skuList"
                 :header-cell-style="{fontSize: '14px',color:'#0009',fontWeight: 'normal',backgroundColor:'#F2F3F5'}"
                >
                  <el-table-column
a8cf1417   杨鑫   '最新'
58
                   label="规格"
3f535f30   杨鑫   '初始'
59
                  >
a8cf1417   杨鑫   '最新'
60
61
62
  		<!-- 		v-for="(skuAttr, index) in skuAttrName"
  				:key="index"
  				:label="skuAttr.skuName" -->
3f535f30   杨鑫   '初始'
63
                    <template slot-scope="scope">
a8cf1417   杨鑫   '最新'
64
65
66
67
68
69
70
71
72
73
74
  					 <div  v-for="(skuAttr, index) in skuAttrName"
                    :key="index"
                    >
  				  {{skuAttr.skuName}}
  				 <!-- {{
  				    scope.row.skuAttrCodeDTOList &&
  				      scope.row.skuAttrCodeDTOList[index]
  				      | attrValueFilter(productItem.skuAttrList)
  				  }} -->
  				  </div>
                      
3f535f30   杨鑫   '初始'
75
76
                    </template>
                  </el-table-column>
a8cf1417   杨鑫   '最新'
77
                  <el-table-column label="售价(/元)">
3f535f30   杨鑫   '初始'
78
79
80
81
82
83
84
85
86
                    <template slot-scope="scope">
                      <el-input
                        v-model="scope.row.price"
                        type="number"
                        disabled
                        oninput="value=value.replace(/-/, '')"
                      />
                    </template>
                  </el-table-column>
a8cf1417   杨鑫   '最新'
87
                  <el-table-column label="原价(/元)">
3f535f30   杨鑫   '初始'
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
                    <template slot-scope="scope">
                      <el-input
                        v-model="scope.row.originalPrice"
                        type="number"
                        disabled
                        oninput="value=value.replace(/-/, '')"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column label="库存">
                    <template slot-scope="scope">
                      <el-input
                        v-model="scope.row.stockNumber"
                        type="number"
                        disabled
                        oninput="value=value.replace(/[^\d]/g,'')"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column label="重量(KG)">
                    <template slot-scope="scope">
                      <el-input
                        v-model="scope.row.weight"
                        type="number"
                        disabled
                        oninput="value=value.replace(/-/, '')"
                      />
                    </template>
                  </el-table-column>
a8cf1417   杨鑫   '最新'
117
                  <el-table-column label="国际条码">
3f535f30   杨鑫   '初始'
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
                    <template slot-scope="scope">
                      <el-input v-model="scope.row.sku" disabled />
                    </template>
                  </el-table-column>
                </el-table>
              </el-col>
            </el-row>
          </div>
        </el-card>
  
        <el-card class="box-card">
          <label>商品简介</label>
          <!-- <Tinymce
          ref="content"
          v-model="productItem.productText"
          class="tinymce-wrap"
          :height="180"
        /> -->
          <br>
          <br>
          <div v-html="productItem.productText" />
        </el-card>
  
        <el-dialog
          :visible.sync="dialogVisible"
          append-to-body
          class="check-image-dialog"
          title="查看图片"
          center="center"
        >
          <div class="img">
            <img width="80%" height="80%" :src="dialogImageUrl" alt>
          </div>
        </el-dialog>
      </div>
    </el-dialog>
  </template>
  
  <script>
  // import Tinymce from '@/components/Tinymce';
  import { getProductById } from '@/api/commodity';
  // import { uploadUrl } from '@/utils/request';
  // import StyleInformation from './addComponent';
  export default {
    name: 'AddCommodity',
    components: {
      // Tinymce,
      // StyleInformation,
    },
    filters: {
      attrValueFilter (map, list) {
        const hasChilds =
          list &&
          list.filter((skuAttr) => {
            const hasChild = skuAttr.values.some((attr) => {
              return attr.skuValue;
            });
            return skuAttr.skuName && hasChild;
          });
        if (!map) {
          return '';
        }
        const { code, valueCode } = map;
        let codeStr = '';
        hasChilds.map((item) => {
          const { values } = item;
          values &&
            values.some((attr) => {
              const isSome = item.code === code && attr.valueCode === valueCode;
              if (isSome) {
                codeStr = attr.skuValue;
              }
              return isSome;
            });
        });
        return codeStr;
      },
    },
    props: {
      examineShow: {
        type: Function,
        default: null
      }
    },
    data () {
      return {
        visible: false,
        dialogVisible: false,
        dialogImageUrl: '',
        productItem: {},
        productData: {
          productId: 0,
          isDetail: true
        }
      };
    },
    computed: {
      skuAttrName () {
        return (
          this.productItem.skuAttrList &&
          this.productItem.skuAttrList.filter((skuAttr) => {
            const hasChilds = skuAttr.values.some((attr) => {
              return attr.skuValue;
            });
            return skuAttr.skuName && hasChilds;
          })
        );
      },
    },
    methods: {
      show (id) {
        this.visible = true
        this.productData.productId = id
        this.details()
      },
      handlePictureCardPreview (item) {
65478d1d   杨鑫   '最新'
234
        this.dialogImageUrl = this.$baseURL+item.imgPath;
3f535f30   杨鑫   '初始'
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
        this.dialogVisible = true;
      },
  
      // 返回
      back () {
        this.visible = false
      },
      // 获取详情
      async details () {
        const res = await getProductById({ productId: this.productData.productId });
        console.log(res);
        this.productItem = res.data;
        this.productItem.skuAttrList = res.data.names;
        this.productItem.skuAttrList.forEach((item) => {
          var data = {};
          var arr = Object.keys(data);
          if (arr.length === 0) {
            item.needImg = false;
          }
        });
        console.log(this.productItem.skuAttrList, 'skuAttrList');
        this.productItem.skuList = this.productItem.skus;
      },
    },
  };
  </script>
  
  <style scoped lang='scss'>
  @import url("../../../styles/elDialog.scss");
  .box-card {
    margin: 20px;
  }
  .btnList {
    float: right;
    padding: 3px 0;
    width: 100px;
    height: 48px;
    border-radius: 4px;
    margin-right: 30px;
  }
  .addTitle {
    font-size: 16px;
    color: #333333;
    line-height: 50px;
  }
  
  .GoodBox {
    padding: 40px;
    .detail-box {
      div {
        line-height: 60px;
        .proImage {
          margin-right: 20px;
          width: 80px;
          height: 80px;
        }
      }
    }
  }
  .tinymce-wrap {
    margin-top: 10px;
  }
  .check-image-dialog {
    margin-top: -100px;
    text-align: center;
    .img {
      text-align: center;
    }
  }
     ::v-deep .buttonHover:hover{
         color:#3f9b6a !important;
         border-color: #c5e1d2 !important;
         background-color: #ecf5f0 !important;
         outline: none;
       }
  </style>