修复新增商品后编辑回显错误的bug

This commit is contained in:
weipengfei 2023-10-20 17:39:57 +08:00
parent 1f1bf15860
commit 6f692eb4d9
7 changed files with 104 additions and 18 deletions

View File

@ -228,7 +228,7 @@
// editGoodsDetils = getStorage('editGoodsDetils');
// console.log('',editGoodsDetils);
Object.keys(this.addGoodsSecoundData).forEach(item => {
console.log(item, editGoodsDetils[item]);
// console.log(item, editGoodsDetils[item]);
this.addGoodsSecoundData[item] = editGoodsDetils[item];
});

View File

@ -18,7 +18,7 @@
</view>
</view>
<view class="photo_count">
<text class="photo_size">建议图片尺寸为750*750px</text>
<text class="photo_size">建议图片尺寸为750*750px, 上传2张以上</text>
<view class="input_content_photo">
<view class="input_content_photo_adPh" v-for="(item, index) in setFormData.imageList" :key="index">
<image :src="item" class="myimg2 photos" @click="pop(item)"></image>
@ -586,7 +586,7 @@
}
productDetail(this.merId, this.product_id).then(res => {
setStorage('editGoodsDetils', res.data);
if(res.data.content_arr) res.data.content = res.data.content_arr;
if(res.data.content_arr.length>0) res.data.content = res.data.content_arr;
this.$store.commit('setStorage', res.data);
let editGoodsDetils = res.data;
Object.keys(this.setFormData).forEach(item => {

View File

@ -263,16 +263,16 @@
Object.keys(info).forEach(key=>{
postData[key]=info[key];
})
postData.stock = postData.attrValue[0].stock;
postData.stock = postData.attrValue[0]?.stock;
// console.log(postData);
if(!postData.store_name||postData.store_name?.trim().length<=0)return Toast('请输入商品名称');
if(!postData.imageList||postData.imageList.length<=0)return Toast('请上传商品图片');
if(postData.cate_name?.trim().length<=0)return Toast('请选择平台分类');
if(postData.unit_name?.trim().length<=0)return Toast('请输入商品单位');
if(!postData.attrValue[0].price||postData.attrValue[0].price<0)return Toast('价格不能小于0');
if(!postData.imageList||postData.imageList?.length<2)return Toast('请上传2张以上商品图片');
if(!postData.cate_name||postData.cate_name?.trim().length<=0)return Toast('请选择平台分类');
if(!postData.unit_name||postData.unit_name?.trim().length<=0)return Toast('请输入商品单位');
if(!postData.attrValue[0]?.price||postData.attrValue[0]?.price<0)return Toast('价格不能小于0');
if(!postData.stock||postData.stock<0)return Toast('库存不能小于0');
if(!postData.content.title||postData.content.title?.trim().length<=0)return Toast('请输入商品详情');
if(!postData.content.image||postData.content.image?.length<=0)return Toast('请上传商品图片');
// if(!postData.content.title||postData.content.title?.trim().length<=0)return Toast('');
// if(!postData.content.image||postData.content.image?.length<=0)return Toast('');
// return Toast('');
if (getStorage('addGoodsFormData').spec_type == 0) {
// postData.attr = [getStorage('singleSpecification')];

View File

@ -1213,7 +1213,6 @@
payment: function(data) {
let that = this;
createOrder(data).then(res => {
console.log('测试', res);
let status = res.data.status,
orderId = res.data.result.order_id,
callback_key = res.data.result.pay_key,

View File

@ -5,7 +5,7 @@ import {
import {
LOGIN_STATUS,
UID,
USER_INFO
USER_INFO
} from '../../config/cache';
import Cache from '../../utils/cache';
// #ifdef APP-PLUS
@ -16,7 +16,7 @@ const state = {
location: Cache.get('LOCATION_DATA', true) || {},
token: Cache.get(LOGIN_STATUS) || null,
backgroundColor: "#fff",
userInfo: Cache.get(USER_INFO) || null,
userInfo: Cache.get(USER_INFO)||null,
uid: Cache.get(UID) || null,
globalData: uni.getStorageSync('GLOBAL_DATA') || {},
homeActive: false,
@ -37,10 +37,10 @@ const mutations = {
Cache.set(LOGIN_STATUS, opt.token, opt.time);
uni.removeStorageSync('auth_token');
},
SET_USERINFO(state, opt) {
state.userInfo = opt;
Cache.set(USER_INFO, opt);
},
SET_USERINFO(state, opt){
state.userInfo = opt;
Cache.set(USER_INFO, opt);
},
SETUID(state, val) {
state.uid = val;
Cache.set(UID, val);
@ -105,6 +105,62 @@ const actions = {
}).catch(() => {
});
},
async INIT_CONFIG({
state,
commit
}, data = false) {
const wgt_v = uni.getStorageSync('wgt_version') || '1.0.0';
// #ifdef APP-PLUS
let os = uni.getSystemInfoSync();
let apptype;
if (os.osName == 'ios') {
apptype = 2
} else {
apptype = 1
}
Appversion({
version: os.appWgtVersion,
type: apptype,
phone_brand:os.brand
}).then((res) => {
if (Object.keys(res.data.appInfo).length > 0) {
// if(res.data.appInfo.version) uni.showLoading({
// title: '检查更新中'
// })
// 版本更新
if (compareVersions(res.data.appInfo.version, os.appWgtVersion || wgt_v) == 1 &&
compareVersions(res.data.appInfo.version,
wgt_v) == 1) {
try {
let info = res.data.appInfo || {};
let version = {
title: info.title || '发现新版本',
content: info.content || '修复了部分BUG',
versionName: info.version || '1.0.1',
brand:res.data.appInfo.phone_brand,
downUrl: info.dow_url || '',
force: info.force == 1 ? true : false, // 是否强制更新
quiet: info.quiet == 1 ? true : false // 是否静默更新
}
Updater.update(version,res.data.appInfo);
} catch (e) {
console.log(e);
}
// uni.hideLoading();
}
}
}).catch((err) => {
// console.log(err)
})
// #endif
}
};

View File

@ -8,6 +8,8 @@
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
import app from "./app";
import storage from "./storage.js";
export default {
app
app,
storage
};

29
store/modules/storage.js Normal file
View File

@ -0,0 +1,29 @@
import {
getUserInfo,
Appversion
} from "../../api/user.js";
import {
LOGIN_STATUS,
UID,
USER_INFO
} from '../../config/cache';
import Cache from '../../utils/cache';
const state = {
storage: {},
};
const mutations = {
setStorage(state, data) {
state.storage = data;
},
};
const actions = {
};
export default {
state,
mutations,
actions
};