chengkun
2025-09-04 0ea78440cb53b7ecf0ef715e3f51d88918c5821d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
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
117
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
234
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
var goods_id = $("#goods_id").val();
const App = {
 
  mixins: [sharedMixin], /////共用的方法/////
  data() {
    return {
      // loading: true,
      dialog: {
        setGoodsDisInfo: false,
      },
      loading: {
        loading: false,
        goodsDisInfo: true,
      },
      kd_review_comments: '',
      set_nopass_reason_title: '商品刊登审核',
      dialogVisible_reason: false,
      goods_id: goods_id,
      categoryList: [], /////商品分类数据//////
 
      uploadFileForm: {
        atta_type: 1,
      },
      create_goods_form: {
        categoryid: ["29", "2901", "290101"],
        warehouse_mode: 1, //////商品仓库模式:自建仓
        docking_way: 0, /////对接系统:无
        price_method: 0, ////定价方式
        sales_form: 1, ////销售形式:单品
      },
      goodsInfoForm: { istemp: 0, },////////商品信息////// 
      goodsBrandList: [],///////商品品牌列表//////      
      publishOrderPictureList: [],////////商品图片列表//////
      previewImageUrl: '',////预览图片地址//////
      dialogVisible_Picture: false,////预览图片弹窗//////
      goodsPictureCount: {},//////商品图片数量//////
      current_goods_distribution_area: {},
      screenHeight: 0,
      goodsDisInfo: {
        goodsSpecInfo: {},
        goodsAttributeInfo: {},
        goodsAttributExtendList: [],
        goodsRetailPriceLimitList: [],
        goodsLabelList: [],
 
      },
      disAreaList: [],
      disStockList: [],
      disReturnGoodsList: [],
      goods_spec_info: [],
      pictureStatuslist: { 0: true, 1: false, 2: false, 3: false, 4: false, 5: false, 6: false, 7: false },
      picture_type: [],
      goodsPictureList: [],
      catelist: [],
 
    };
  },
  mounted() {
    this.loading.loading = true;
    Promise.all([
      this.getGoodsInfo(),
      this.getGoodsDisInfo(),
      this.updateScreenHeight(),
      // this.getCategoryList(),
    ]).then(() => {
      // setTimeout(() => {
 
      // }, 500);
    }).catch((error) => {
      this.loading.loading = false;
 
    });
  },
  created() { },
  methods: {
    showReviewGoodsKD() {
      this.kd_review_comments = '';
      this.dialogVisible_reason = true;
    },
    reviewGoodsKD(status) {
      let that = this;
      let { id } = that.goodsInfoForm;
 
      if (status == 2 && that.kd_review_comments == '') {
        that.$notify.error({
          title: '错误',
          position: 'top-left',
          message: '请填写审核不通过原因'
        });
        return false;
      }
 
      let url = "/admin/goodskd/reviewGoodsKD.html"
      postRequest(url, { id: id, status: status, kd_review_comments: that.kd_review_comments }).then(res => {
        if (res.data.code == 200) {
          that.$notify({
            title: '成功',
            message: res.data.message,
            position: 'top-left',
            type: 'success',
            duration: 1000,
            onClose: () => {
              if (status == 2) {
                that.dialogVisible_reason = false;
              }
              document.location.href = '/admin/goodskd/index.html';
            }
          });
          if (status == 2) {
            that.dialogVisible_reason = false;
          }
        }
        else {
          that.$notify.error({
            title: '错误',
            position: 'top-left',
            message: res.data.message
          });
 
        }
      })
        .catch((error) => {
          console.log(error)
        });
    },
    setPictureStatus(val) {
      if (val === 0) {
        this.pictureStatuslist = { 0: true, 1: false, 2: false, 3: false, 4: false, 5: false, 6: false, 7: false }
        this.picture_type = [];
      }
      else {
        this.pictureStatuslist[0] = false;
        this.pictureStatuslist[val] = !this.pictureStatuslist[val];
        if (this.pictureStatuslist[val]) {
          this.picture_type.push(val);
        }
        else {
          this.picture_type = this.picture_type.filter(item => item != val);
        }
        if (this.picture_type.length === 0) {
          this.pictureStatuslist[0] = true;
        }
      }
      this.getGoodsPictureList();
    },
    getGoodsPictureList() {
      const that = this;
      const url = "/admin/goods/getGoodsPictureList.html";
      postRequest(url, { goods_id: that.goodsDisInfo.id, picture_type: that.picture_type }).then((res) => {
 
        if (res.data.code === 200) {
          that.goodsPictureList = res.data.list;
        }
        else {
          that.goodsPictureList = [];
        }
      }).catch((error) => {
        // 处理请求失败的情况
 
      });
    },
    getGoodsPictureCount() {
      const that = this;
      const url = "/admin/goods/getGoodsPictureCount.html";
      postRequest(url, { goods_id: that.goodsDisInfo.id }).then((res) => {
 
        if (res.data.code === 200) {
          that.goodsPictureCount = res.data.goodsPictureCount;
        }
        else {
          that.goodsPictureCount = {};
        }
      }).catch((error) => {
        // 处理请求失败的情况
 
      });
    },
    updateScreenHeight() {
      this.screenHeight = window.innerHeight;
    },
    getGoodsDisInfo() {
      const that = this;
      const url = "/admin/goodskd/getGoodsDisInfo.html";
 
 
      postRequest(url, { id: that.goods_id }).then((res) => {
        this.loading.goodsDisInfo = false;
        if (res.data.code === 200) {
          that.catelist = res.data.catelist;
          that.goodsDisInfo = res.data.info;
          that.disAreaList = res.data.disAreaList;
          that.disStockList = res.data.disStockList;
          that.disPriceList = res.data.disPriceList;
          that.disReturnGoodsList = res.data.disReturnGoodsList;
          that.getGoodsPictureList()
          this.getGoodsPictureCount();
 
        }
        else {
          return;
        }
      }).catch((error) => {
        this.loading.goodsDisInfo = false;
        // 错误处理逻辑,例如弹窗提示
 
      });;
    },
    ///取商品基本信息数据
    getGoodsInfo() {
      const that = this;
      const url = "/admin/goodskd/getGoodsInfo.html";
      postRequest(url, { id: that.goods_id }).then((res) => {
        this.loading.loading = false;
        if (res.data.code === 200) {
          that.goodsInfoForm.id = res.data.info.id;
          that.goodsInfoForm.first_cate_code = res.data.info.first_cate_code;
          that.goodsInfoForm.second_cate_code = res.data.info.second_cate_code;
          that.goodsInfoForm.three_cate_code = res.data.info.three_cate_code;
          that.goodsInfoForm.cate_code = res.data.info.cate_code;
          that.goodsInfoForm.brand_code = res.data.info.brand_code;
 
          that.goodsInfoForm.goods_title_en = res.data.goods_desc.goods_title_en;
          that.goodsInfoForm.goods_title_cn = res.data.goods_desc.goods_title_cn;
 
          that.goodsInfoForm.goods_desc_en = res.data.goods_desc_content.goods_desc_en;
          that.goodsInfoForm.goods_desc_cn = res.data.goods_desc_content.goods_desc_cn;
 
          if (that.goodsInfoForm.goods_desc_en != null) {
            tinymce.get('tinymce-en-1').setContent(that.goodsInfoForm.goods_desc_en);
          }
          if (that.goodsInfoForm.goods_desc_cn != null) {
            tinymce.get('tinymce-cn-1').setContent(that.goodsInfoForm.goods_desc_cn);
          }
        }
        else {
          return;
        }
      }).catch((error) => {
        this.loading.loading = false;
        // 错误处理逻辑,例如弹窗提示
 
      });;
    },
    // 预览图片
    previewPictureCard(file) {
      this.previewImageUrl = file.url
      this.dialogVisible_Picture = true
    },
 
 
    //获取分类数据
    getCategoryList() {
      const that = this;
      const url = "/admin/goods/getCategoryList.html";
      postRequest(url, {}).then((res) => {
        console.log(res.data)
        if (res.data.code === 200) {
          that.categoryList = res.data.list;
        }
      }).catch((error) => {
        // 处理请求失败的情况
 
      })
    },
  },
};
const app = Vue.createApp(App);
const iconList = ['Menu', 'QuestionFilled'];
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  if (iconList.includes(key)) {
    app.component('custom-' + key.toLowerCase(), component);
  }
  else {
    app.component(key, component);
  }
}
app.use(ElementPlus, {
  locale: ElementPlusLocaleZhCn,
});
app.mount("#vue_item");