|
@@ -1,12 +1,5 @@
|
|
|
<template>
|
|
<template>
|
|
|
<view class="app-content">
|
|
<view class="app-content">
|
|
|
- <!-- 加载状态 -->
|
|
|
|
|
- <!-- <view v-if="loading" class="loading-overlay">
|
|
|
|
|
- <view class="loading-content">
|
|
|
|
|
- <view class="loading-spinner"></view>
|
|
|
|
|
- <text class="loading-text">加载中...</text>
|
|
|
|
|
- </view>
|
|
|
|
|
- </view> -->
|
|
|
|
|
|
|
|
|
|
<form @submit="formSubmit">
|
|
<form @submit="formSubmit">
|
|
|
<view class="module-com input-line-wrap">
|
|
<view class="module-com input-line-wrap">
|
|
@@ -60,6 +53,7 @@
|
|
|
<view class="btn-group">
|
|
<view class="btn-group">
|
|
|
<button class="admin-button-com middle" :class="[form.priceType === '0' ? '' : 'default']" @click="setPriceType('0')">无价</button>
|
|
<button class="admin-button-com middle" :class="[form.priceType === '0' ? '' : 'default']" @click="setPriceType('0')">无价</button>
|
|
|
<button class="admin-button-com middle" :class="[form.priceType === '1' ? '' : 'default']" @click="setPriceType('1')">有价</button>
|
|
<button class="admin-button-com middle" :class="[form.priceType === '1' ? '' : 'default']" @click="setPriceType('1')">有价</button>
|
|
|
|
|
+ <text v-if="sn && Number(sn)>0" style="margin-left:10upx;color:#078c4a;font-size:42upx;">#{{ sn }}</text>
|
|
|
</view>
|
|
</view>
|
|
|
</tui-list-cell>
|
|
</tui-list-cell>
|
|
|
|
|
|
|
@@ -113,8 +107,8 @@
|
|
|
<tui-list-cell class="line-cell" :hover="false">
|
|
<tui-list-cell class="line-cell" :hover="false">
|
|
|
<view class="tui-title">运费</view>
|
|
<view class="tui-title">运费</view>
|
|
|
<view class="btn-group">
|
|
<view class="btn-group">
|
|
|
- <button class="admin-button-com middle" :class="[form.freightType === '0' ? '' : 'default']" @click="freightChange({detail:{value:'0'}})">不包运费</button>
|
|
|
|
|
<button class="admin-button-com middle" :class="[form.freightType === '1' ? '' : 'default']" @click="freightChange({detail:{value:'1'}})">包运费</button>
|
|
<button class="admin-button-com middle" :class="[form.freightType === '1' ? '' : 'default']" @click="freightChange({detail:{value:'1'}})">包运费</button>
|
|
|
|
|
+ <button class="admin-button-com middle" :class="[form.freightType === '0' ? '' : 'default']" @click="freightChange({detail:{value:'0'}})">不包运费</button>
|
|
|
</view>
|
|
</view>
|
|
|
</tui-list-cell>
|
|
</tui-list-cell>
|
|
|
|
|
|
|
@@ -137,8 +131,8 @@
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
|
<view class="app-footer">
|
|
<view class="app-footer">
|
|
|
- <button class="admin-button-com middle default" @click="goBack" :disabled="loading">取消</button>
|
|
|
|
|
- <button class="admin-button-com middle blue" formType="submit" :disabled="loading">{{ loading ? '保存中...' : '保存' }}</button>
|
|
|
|
|
|
|
+ <button class="admin-button-com middle default" @click="goBack">取消</button>
|
|
|
|
|
+ <button class="admin-button-com middle blue" formType="submit">保存</button>
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
|
</form>
|
|
</form>
|
|
@@ -148,7 +142,7 @@
|
|
|
import TuiListCell from "@/components/plugin/list-cell";
|
|
import TuiListCell from "@/components/plugin/list-cell";
|
|
|
const form = require("@/utils/formValidation.js");
|
|
const form = require("@/utils/formValidation.js");
|
|
|
import { getClass } from "@/api/category";
|
|
import { getClass } from "@/api/category";
|
|
|
-import { getGoodsDetail, updateGoodsData } from "@/api/goods";
|
|
|
|
|
|
|
+import { getGoodsDetail, updateGoodsData,createSn } from "@/api/goods";
|
|
|
import { delImages } from "@/api/pic-text";
|
|
import { delImages } from "@/api/pic-text";
|
|
|
//图片上传插件来源:https://ext.dcloud.net.cn/plugin?id=2922 已改造,不能再升级 shish 20211228
|
|
//图片上传插件来源:https://ext.dcloud.net.cn/plugin?id=2922 已改造,不能再升级 shish 20211228
|
|
|
import htzImageUpload from '@/components/htz-image-upload/htz-image-upload.vue'
|
|
import htzImageUpload from '@/components/htz-image-upload/htz-image-upload.vue'
|
|
@@ -167,8 +161,6 @@ export default {
|
|
|
currentImgData: [],
|
|
currentImgData: [],
|
|
|
// 收集待删除的小图URL,提交时批量删除
|
|
// 收集待删除的小图URL,提交时批量删除
|
|
|
delImgQueue: [],
|
|
delImgQueue: [],
|
|
|
- loading: false, // 添加加载状态
|
|
|
|
|
-
|
|
|
|
|
form: {
|
|
form: {
|
|
|
id:0,
|
|
id:0,
|
|
|
name: "",
|
|
name: "",
|
|
@@ -179,7 +171,7 @@ export default {
|
|
|
categoryIdList: [],
|
|
categoryIdList: [],
|
|
|
autoRise: "1",
|
|
autoRise: "1",
|
|
|
needSend: "0",
|
|
needSend: "0",
|
|
|
- freightType: "0",
|
|
|
|
|
|
|
+ freightType: "1",
|
|
|
shopImg: [],
|
|
shopImg: [],
|
|
|
status: "1",
|
|
status: "1",
|
|
|
flower:1,
|
|
flower:1,
|
|
@@ -190,7 +182,8 @@ export default {
|
|
|
shortCover: ""
|
|
shortCover: ""
|
|
|
},
|
|
},
|
|
|
categoryData:[],
|
|
categoryData:[],
|
|
|
- categoryIds:[]
|
|
|
|
|
|
|
+ categoryIds:[],
|
|
|
|
|
+ sn:0
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
onLoad() {
|
|
onLoad() {
|
|
@@ -315,7 +308,7 @@ export default {
|
|
|
this.form.needSend = e;
|
|
this.form.needSend = e;
|
|
|
},
|
|
},
|
|
|
getDetail() {
|
|
getDetail() {
|
|
|
- this.loading = true;
|
|
|
|
|
|
|
+ let that = this
|
|
|
return getGoodsDetail({ id: this.option.id }) .then(res => {
|
|
return getGoodsDetail({ id: this.option.id }) .then(res => {
|
|
|
if (this.$util.isEmpty(res.data)) {
|
|
if (this.$util.isEmpty(res.data)) {
|
|
|
this.$msg('商品信息不存在');
|
|
this.$msg('商品信息不存在');
|
|
@@ -371,23 +364,17 @@ export default {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- }).catch(err => {
|
|
|
|
|
- console.error('获取分类失败:', err);
|
|
|
|
|
- this.$msg('获取分类信息失败');
|
|
|
|
|
- }).finally(() => {
|
|
|
|
|
- this.loading = false;
|
|
|
|
|
})
|
|
})
|
|
|
- }).catch(err => {
|
|
|
|
|
- console.error('获取商品详情失败:', err);
|
|
|
|
|
- this.$msg('获取商品信息失败');
|
|
|
|
|
- this.loading = false;
|
|
|
|
|
|
|
+
|
|
|
|
|
+ //如果没有商品编号,生成商品编号
|
|
|
|
|
+ this.sn = res.data.sn?res.data.sn:0
|
|
|
|
|
+ if(Number(this.sn)<=0){
|
|
|
|
|
+ createSn({id:that.option.id})
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
formSubmit(e) {
|
|
formSubmit(e) {
|
|
|
- // 防止重复提交
|
|
|
|
|
- if (this.loading) {
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
let rules = [
|
|
let rules = [
|
|
|
{
|
|
{
|
|
@@ -491,7 +478,6 @@ export default {
|
|
|
return false
|
|
return false
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- this.loading = true;
|
|
|
|
|
let form = JSON.parse(JSON.stringify(this.form))
|
|
let form = JSON.parse(JSON.stringify(this.form))
|
|
|
// 修复封面处理逻辑
|
|
// 修复封面处理逻辑
|
|
|
if (this.form.shopImg.length > 0) {
|
|
if (this.form.shopImg.length > 0) {
|
|
@@ -565,12 +551,7 @@ export default {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
uni.navigateBack({})
|
|
uni.navigateBack({})
|
|
|
- }).catch(err => {
|
|
|
|
|
- console.error('保存商品失败:', err);
|
|
|
|
|
- this.$msg('保存失败,请重试');
|
|
|
|
|
- }).finally(() => {
|
|
|
|
|
- this.loading = false;
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ })
|
|
|
},
|
|
},
|
|
|
selCategoryFn(item) {
|
|
selCategoryFn(item) {
|
|
|
let index = this.form.categoryIdList.findIndex(e => e == item.id);
|
|
let index = this.form.categoryIdList.findIndex(e => e == item.id);
|
|
@@ -631,44 +612,6 @@ export default {
|
|
|
padding-bottom: 100upx;
|
|
padding-bottom: 100upx;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-/* 加载状态样式 */
|
|
|
|
|
-.loading-overlay {
|
|
|
|
|
- position: fixed;
|
|
|
|
|
- top: 0;
|
|
|
|
|
- left: 0;
|
|
|
|
|
- right: 0;
|
|
|
|
|
- bottom: 0;
|
|
|
|
|
- background-color: rgba(0, 0, 0, 0.5);
|
|
|
|
|
- display: flex;
|
|
|
|
|
- justify-content: center;
|
|
|
|
|
- align-items: center;
|
|
|
|
|
- z-index: 999999;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-.loading-content {
|
|
|
|
|
- background-color: #fff;
|
|
|
|
|
- border-radius: 20upx;
|
|
|
|
|
- padding: 40upx;
|
|
|
|
|
- display: flex;
|
|
|
|
|
- flex-direction: column;
|
|
|
|
|
- align-items: center;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-.loading-spinner {
|
|
|
|
|
- width: 60upx;
|
|
|
|
|
- height: 60upx;
|
|
|
|
|
- border: 4upx solid #f3f3f3;
|
|
|
|
|
- border-top: 4upx solid #09C567;
|
|
|
|
|
- border-radius: 50%;
|
|
|
|
|
- animation: spin 1s linear infinite;
|
|
|
|
|
- margin-bottom: 20upx;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-.loading-text {
|
|
|
|
|
- font-size: 28upx;
|
|
|
|
|
- color: #666;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
@keyframes spin {
|
|
@keyframes spin {
|
|
|
0% { transform: rotate(0deg); }
|
|
0% { transform: rotate(0deg); }
|
|
|
100% { transform: rotate(360deg); }
|
|
100% { transform: rotate(360deg); }
|