|
|
@@ -1,12 +1,12 @@
|
|
|
<template>
|
|
|
<view class="app-content">
|
|
|
<!-- 加载状态 -->
|
|
|
- <view v-if="loading" class="loading-overlay">
|
|
|
+ <!-- <view v-if="loading" class="loading-overlay">
|
|
|
<view class="loading-content">
|
|
|
<view class="loading-spinner"></view>
|
|
|
<text class="loading-text">加载中...</text>
|
|
|
</view>
|
|
|
- </view>
|
|
|
+ </view> -->
|
|
|
|
|
|
<form @submit="commitForm">
|
|
|
<view class="module-com input-line-wrap">
|
|
|
@@ -145,14 +145,14 @@ import TuiListCell from "@/components/plugin/list-cell";
|
|
|
import AppUploader from "@/components/app-uploader";
|
|
|
const form = require("@/utils/formValidation.js");
|
|
|
import { getClass } from "@/api/category";
|
|
|
-import { addGoodsData, getGoodsDetail } from "@/api/goods"
|
|
|
+import { addGoodsData } from "@/api/goods"
|
|
|
import htzImageUpload from '@/components/htz-image-upload/htz-image-upload.vue'
|
|
|
-import productMins from "@/mixins/product";
|
|
|
+//import productMins from "@/mixins/product"; //复制页面代码时,没去掉
|
|
|
import inputRestore from "@/mixins/inputRestore";
|
|
|
export default {
|
|
|
name: "add",
|
|
|
components: { TuiListCell, AppUploader,htzImageUpload },
|
|
|
- mixins: [productMins, inputRestore],
|
|
|
+ mixins: [inputRestore], //productMins,
|
|
|
data() {
|
|
|
return {
|
|
|
headers:{token:''},
|
|
|
@@ -186,7 +186,6 @@ export default {
|
|
|
onLoad() {
|
|
|
const token = uni.getStorageSync('token')
|
|
|
this.headers.token = token
|
|
|
- this.init()
|
|
|
},
|
|
|
computed: {
|
|
|
// 根据上传的图片数量动态生成封面选项
|
|
|
@@ -197,8 +196,6 @@ export default {
|
|
|
return this.form.shopImg;
|
|
|
}
|
|
|
},
|
|
|
- watch:{
|
|
|
- },
|
|
|
methods: {
|
|
|
changeKind(){
|
|
|
this.pageTo({url:'/admin/goods/selectKind?style=2&flower=1'})
|
|
|
@@ -352,11 +349,13 @@ export default {
|
|
|
} else {
|
|
|
formData.cover = '';
|
|
|
}
|
|
|
+ if(formData.stockSet === '0'){
|
|
|
+ formData.stock = 9999;
|
|
|
+ }
|
|
|
|
|
|
addGoodsData({ status: this.status, ...formData }).then(res => {
|
|
|
uni.hideLoading()
|
|
|
- this.$msg("添加成功")
|
|
|
- this.removeFromSaveDirect()
|
|
|
+ // this.removeFromSaveDirect()
|
|
|
|
|
|
// 把新增的商品添加到商品列表页的商品数组的第一项
|
|
|
if (res.code === 1 && res.data) {
|
|
|
@@ -379,6 +378,7 @@ export default {
|
|
|
prevPage.$vm.list.data.unshift(newGoodsItem);
|
|
|
prevPage.$vm.list.total = (prevPage.$vm.list.total || 0) + 1;
|
|
|
}
|
|
|
+ this.$msg("添加成功")
|
|
|
} catch (error) {
|
|
|
console.log('更新列表页数据失败:', error);
|
|
|
}
|