This commit is contained in:
parent
3fee32805d
commit
d3e8fe6c96
|
@ -9,8 +9,8 @@ let httpApiThree
|
||||||
let wsApi
|
let wsApi
|
||||||
|
|
||||||
// 在打包之前请检查当前环境是否正确
|
// 在打包之前请检查当前环境是否正确
|
||||||
const env = 'dev'; // 开发
|
// const env = 'dev'; // 开发
|
||||||
// const env = 'prod'; // 生产
|
const env = 'prod'; // 生产
|
||||||
// const env = 'prew'; // 预上线
|
// const env = 'prew'; // 预上线
|
||||||
|
|
||||||
switch (env) {
|
switch (env) {
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
"name" : "惠农商户平台",
|
"name" : "惠农商户平台",
|
||||||
"appid" : "__UNI__1EE148C",
|
"appid" : "__UNI__1EE148C",
|
||||||
"description" : "",
|
"description" : "",
|
||||||
"versionName" : "1.0.9",
|
"versionName" : "1.1.2",
|
||||||
"versionCode" : 109,
|
"versionCode" : 112,
|
||||||
"transformPx" : false,
|
"transformPx" : false,
|
||||||
/* 5+App特有相关 */
|
/* 5+App特有相关 */
|
||||||
"app-plus" : {
|
"app-plus" : {
|
||||||
|
|
|
@ -70,9 +70,9 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- <view class="popup_group_item">
|
<!-- <view class="popup_group_item">
|
||||||
<view class="popup_group_item_label">商品单位</view>
|
<view class="popup_group_item_label">商品规格</view>
|
||||||
<view class="popup_group_item_value"><input v-model="setFormData.unit_name" type="text"
|
<view class="popup_group_item_value"><input v-model="setFormData.unit_name" type="text"
|
||||||
placeholder="请填写商品单位" /></view>
|
placeholder="请填写商品规格" /></view>
|
||||||
</view> -->
|
</view> -->
|
||||||
|
|
||||||
|
|
||||||
|
@ -107,13 +107,22 @@
|
||||||
<u-modal :show="showSpecType" title="温馨提示" content="切换后商品原有规格将失效,是否继续?" show-cancel-button confirm-text="继续"
|
<u-modal :show="showSpecType" title="温馨提示" content="切换后商品原有规格将失效,是否继续?" show-cancel-button confirm-text="继续"
|
||||||
@confirm="changeSpecType2" @cancel="showSpecType=false"></u-modal>
|
@confirm="changeSpecType2" @cancel="showSpecType=false"></u-modal>
|
||||||
</picker>
|
</picker>
|
||||||
<priceComponent v-if="setFormData.spec_type==0" :tips="tips1" :datas="setFormData.attrValue[0]" ref="priceRef"
|
<block v-if="setFormData.spec_type==0">
|
||||||
:product_id="product_id" :bar_code="code" :sku="'件'" @updateCode="updateCode">
|
<view v-for="(item, index) in setFormData.attrValue" v-show="!item.is_d_show" :key="index" class="head_close" style="margin-top: 20rpx;">
|
||||||
</priceComponent>
|
<view style="height: 1rpx;"></view>
|
||||||
<view style="height: 1rpx;"></view>
|
<priceComponent :datas="item" ref="priceRef"
|
||||||
<priceComponent v-if="setFormData.spec_type==0" :tips="tips2" :datas="setFormData.attrValue[1]" ref="priceRef2"
|
:product_id="product_id" :bar_code="code" @updateCode="updateCode">
|
||||||
:product_id="product_id" :bar_code="code" :sku="'个'" @updateCode="updateCode">
|
</priceComponent>
|
||||||
</priceComponent>
|
<view v-if="setFormData.attrValue.length>1" class="delete_btn" @click="deleteByIndex(index)">
|
||||||
|
<image style="width: 50%;height: 50%;" src="../static/images/close.png"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view @click="pushAttrValue(setFormData.attrValue.length-1)" style="width: 710rpx;margin: 20rpx auto;text-align: center;background-color: #fff;padding: 20rpx 0;border-radius: 14rpx;">
|
||||||
|
+ 添加规格
|
||||||
|
</view>
|
||||||
|
<u-modal title="警告" content="删除后数据不可恢复,是否确认删除?" :show="showDelete" show-cancel-button @cancel="showDelete=false"
|
||||||
|
@confirm="deleteAttr()"></u-modal>
|
||||||
|
</block>
|
||||||
<view v-else class="popup_group" style="margin-top: 0;border-top: 1rpx solid #eeeeee;">
|
<view v-else class="popup_group" style="margin-top: 0;border-top: 1rpx solid #eeeeee;">
|
||||||
<view class="popup_group_item" @click="navToSpecGood()">
|
<view class="popup_group_item" @click="navToSpecGood()">
|
||||||
<view class="popup_group_item_label" style="flex: 1; text-align: center;">
|
<view class="popup_group_item_label" style="flex: 1; text-align: center;">
|
||||||
|
@ -238,12 +247,16 @@
|
||||||
code: '', //商品条码
|
code: '', //商品条码
|
||||||
show: false, //是否预览图片
|
show: false, //是否预览图片
|
||||||
image: false, //预览的图
|
image: false, //预览的图
|
||||||
|
showDelete: false, // 删除规格弹窗
|
||||||
|
deleteIndex: 0,
|
||||||
setFormData: {
|
setFormData: {
|
||||||
store_name: '',
|
store_name: '',
|
||||||
imageList: [],
|
imageList: [],
|
||||||
attrValue: [],
|
attrValue: [
|
||||||
|
{}
|
||||||
|
],
|
||||||
cate_name: '', //平台名称
|
cate_name: '', //平台名称
|
||||||
unit_name: '', //商品单位
|
unit_name: '', //商品规格
|
||||||
cate_id: '', // 平台分类id
|
cate_id: '', // 平台分类id
|
||||||
mer_cate_id: '', // 店铺分类
|
mer_cate_id: '', // 店铺分类
|
||||||
mer_cate_name: '', // 店铺分类名称
|
mer_cate_name: '', // 店铺分类名称
|
||||||
|
@ -370,6 +383,22 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 追加规格
|
||||||
|
pushAttrValue(index){
|
||||||
|
let obj = JSON.parse(JSON.stringify(this.$refs['priceRef'][index].singleSpecification));
|
||||||
|
obj.sku = '';
|
||||||
|
this.setFormData.attrValue.push(obj);
|
||||||
|
},
|
||||||
|
// 预删除
|
||||||
|
deleteByIndex(index) {
|
||||||
|
this.deleteIndex = +index;
|
||||||
|
this.showDelete = true;
|
||||||
|
},
|
||||||
|
// 删除规格
|
||||||
|
deleteAttr() {
|
||||||
|
this.setFormData.attrValue[this.deleteIndex].is_d_show = true;
|
||||||
|
this.showDelete = false;
|
||||||
|
},
|
||||||
// 查询详情数据
|
// 查询详情数据
|
||||||
initDataEditData() {
|
initDataEditData() {
|
||||||
this.setFormData = {
|
this.setFormData = {
|
||||||
|
@ -387,7 +416,7 @@
|
||||||
cate_name: '', // 平台名称
|
cate_name: '', // 平台名称
|
||||||
mer_cate_id: '', // 店铺分类
|
mer_cate_id: '', // 店铺分类
|
||||||
mer_cate_name: '', // 店铺分类名称
|
mer_cate_name: '', // 店铺分类名称
|
||||||
unit_name: '', // 商品单位
|
unit_name: '', // 商品规格
|
||||||
spec_type: '0', // 0.默认规格 1:自定义规格
|
spec_type: '0', // 0.默认规格 1:自定义规格
|
||||||
attr: [], // 商品规格
|
attr: [], // 商品规格
|
||||||
specifica: '', // 商品规格名称
|
specifica: '', // 商品规格名称
|
||||||
|
@ -419,23 +448,9 @@
|
||||||
if (res.data.content && typeof res.data.content == 'string') res.data.content = JSON.parse(res.data
|
if (res.data.content && typeof res.data.content == 'string') res.data.content = JSON.parse(res.data
|
||||||
.content);
|
.content);
|
||||||
this.setFormData.once_min_count <= 0 ? this.setFormData.once_min_count = '' : null;
|
this.setFormData.once_min_count <= 0 ? this.setFormData.once_min_count = '' : null;
|
||||||
if(res.data.attr.length==1&&res.data.attr[0].value=='单位'&&res.data.attr[0].detail.length==2){ // 供应链默认规格时页面改成默认规格
|
if(res.data.attr.length==1&&res.data.attr[0].value=='规格'){ // 供应链默认规格时页面改成默认规格
|
||||||
this.setFormData.spec_type = 0;
|
this.setFormData.spec_type = 0;
|
||||||
}
|
}
|
||||||
if(res.data.attr.length==1&&res.data.attr[0].value=='单位'){
|
|
||||||
if(res.data.attrValue[0].sku=='件'||res.data.attrValue[1].sku=='个') {
|
|
||||||
this.tips1 = '提供给B端商户';
|
|
||||||
this.tips2 = '提供给C端用户';
|
|
||||||
}
|
|
||||||
else if(res.data.attrValue[0].sku=='个'||res.data.attrValue[1].sku=='件') {
|
|
||||||
this.tips1 = '提供给C端用户';
|
|
||||||
this.tips2 = '提供给B端商户';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.tips1 = '';
|
|
||||||
this.tips2 = '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//向组件注入数据
|
//向组件注入数据
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs.commodityRef.setDatas({
|
this.$refs.commodityRef.setDatas({
|
||||||
|
@ -452,10 +467,10 @@
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// 默认规格
|
// 默认规格
|
||||||
if (this.setFormData.spec_type == 0) {
|
// if (this.setFormData.spec_type == 0) {
|
||||||
this.$refs.priceRef.setDatas(res.data.attrValue[0]);
|
// this.$refs.priceRef.setDatas(res.data.attrValue[0]);
|
||||||
this.$refs.priceRef2.setDatas(res.data.attrValue[1]);
|
// this.$refs.priceRef2.setDatas(res.data.attrValue[1]);
|
||||||
}
|
// }
|
||||||
})
|
})
|
||||||
editGoodsDetils.temp && (this.setFormData.tempName = editGoodsDetils.temp.name);
|
editGoodsDetils.temp && (this.setFormData.tempName = editGoodsDetils.temp.name);
|
||||||
hideLoading();
|
hideLoading();
|
||||||
|
@ -636,9 +651,9 @@
|
||||||
// return console.log('商品规格', this.setFormData.spec_type);
|
// return console.log('商品规格', this.setFormData.spec_type);
|
||||||
console.log('是否推荐', this.$refs.commodityRef.addGoodsSecoundData);
|
console.log('是否推荐', this.$refs.commodityRef.addGoodsSecoundData);
|
||||||
console.log('商品详情', this.$refs.commodityRef.goodsDis, this.$refs.commodityRef.store_name);
|
console.log('商品详情', this.$refs.commodityRef.goodsDis, this.$refs.commodityRef.store_name);
|
||||||
if (this.setFormData.spec_type == 0) {
|
// if (this.setFormData.spec_type == 0) {
|
||||||
console.log('价格库存', this.$refs.priceRef.singleSpecification);
|
// console.log('价格库存', this.$refs.priceRef.singleSpecification);
|
||||||
}
|
// }
|
||||||
let postData = {
|
let postData = {
|
||||||
...this.setFormData,
|
...this.setFormData,
|
||||||
...this.$refs.commodityRef.addGoodsSecoundData,
|
...this.$refs.commodityRef.addGoodsSecoundData,
|
||||||
|
@ -649,21 +664,30 @@
|
||||||
video_link: this.$refs.commodityRef.addGoodsSecoundData.video_link,
|
video_link: this.$refs.commodityRef.addGoodsSecoundData.video_link,
|
||||||
};
|
};
|
||||||
if (this.setFormData.spec_type == 0) {
|
if (this.setFormData.spec_type == 0) {
|
||||||
postData.attrValue = [this.$refs.priceRef.singleSpecification, this.$refs.priceRef2.singleSpecification];
|
// console.log(this.$refs.priceRef);
|
||||||
|
let listarr = [];
|
||||||
|
this.$refs.priceRef.forEach((item, index)=>{
|
||||||
|
if(!this.setFormData.attrValue[index].is_d_show){
|
||||||
|
// console.log(item.singleSpecification, index);
|
||||||
|
listarr.push(item.singleSpecification);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
postData.attrValue = listarr;
|
||||||
} else postData.attrValue = this.setFormData.attrValue;
|
} else postData.attrValue = this.setFormData.attrValue;
|
||||||
postData.stock = postData.attrValue[0]?.stock || 0;
|
postData.stock = postData.attrValue[0]?.stock || 0;
|
||||||
if (!postData.store_name || postData.store_name?.trim().length <= 0) return Toast('请输入商品名称');
|
if (!postData.store_name || postData.store_name?.trim().length <= 0) return Toast('请输入商品名称');
|
||||||
if (!postData.imageList || postData.imageList?.length < 2) return Toast('请上传2张以上商品图片');
|
if (!postData.imageList || postData.imageList?.length < 2) return Toast('请上传2张以上商品图片');
|
||||||
if (!postData.cate_name || postData.cate_name?.trim().length <= 0) return Toast('请选择平台分类');
|
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.unit_name || postData.unit_name?.trim().length <= 0) return Toast('请输入商品规格');
|
||||||
let userInfo = this.$store.state.app.userInfo;
|
let userInfo = this.$store.state.app.userInfo;
|
||||||
if (typeof userInfo == 'string') userInfo = JSON.parse(userInfo);
|
if (typeof userInfo == 'string') userInfo = JSON.parse(userInfo);
|
||||||
let showFlag = '';
|
let showFlag = '';
|
||||||
postData.attrValue.forEach(t => {
|
postData.attrValue.forEach(t => {
|
||||||
if (userInfo?.mer_info?.type_code == "TypeSupplyChain" && (!t.procure_price || +t.procure_price <= 0)) {
|
if (userInfo?.mer_info?.type_code == "TypeSupplyChain" && (!t.procure_price || +t.procure_price <= 0)) {
|
||||||
showFlag = '批发价不能小于0'
|
showFlag = '结算价不能小于0'
|
||||||
}
|
}
|
||||||
if (!t.price || +t.price <= 0) showFlag = '零售价不能小于0';
|
if (!t.price || +t.price <= 0) showFlag = '零售价不能小于0';
|
||||||
|
if (!t.single_number || +t.single_number <= 0) showFlag = '零售价不能小于0';
|
||||||
if (!t.stock || +t.stock <= 0) showFlag = '库存不能小于0';
|
if (!t.stock || +t.stock <= 0) showFlag = '库存不能小于0';
|
||||||
// if (!t.cost || +t.cost <= 0) showFlag = '成本价不能小于0';
|
// if (!t.cost || +t.cost <= 0) showFlag = '成本价不能小于0';
|
||||||
})
|
})
|
||||||
|
@ -675,20 +699,18 @@
|
||||||
if(this.setFormData.spec_type == 0){
|
if(this.setFormData.spec_type == 0){
|
||||||
postData.unit_name = '无'
|
postData.unit_name = '无'
|
||||||
postData.attr = [{
|
postData.attr = [{
|
||||||
value: '单位',
|
value: '规格',
|
||||||
detail: [
|
detail: []
|
||||||
postData.attrValue[0].sku,
|
|
||||||
postData.attrValue[1].sku,
|
|
||||||
]
|
|
||||||
}]
|
}]
|
||||||
postData.attrValue[0].detail = {
|
postData.attr[0].detail = postData.attrValue.map(item=>item.sku);
|
||||||
"单位": postData.attrValue[0].sku
|
postData.attrValue.forEach(item=>{
|
||||||
},
|
item.detail = {
|
||||||
postData.attrValue[1].detail = {
|
"规格": item.sku
|
||||||
"单位": postData.attrValue[1].sku
|
}
|
||||||
},
|
})
|
||||||
postData.spec_type = 1; //供应链商家必须使用多规格
|
postData.spec_type = 1; //供应链商家必须使用多规格
|
||||||
}
|
}
|
||||||
|
if(postData.attrValue.length==0)return Toast('请填写规格')
|
||||||
if (this.product_id) {
|
if (this.product_id) {
|
||||||
productUpdate(this.merId, this.product_id, postData)
|
productUpdate(this.merId, this.product_id, postData)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
|
@ -736,7 +758,9 @@
|
||||||
changeSpecType2() {
|
changeSpecType2() {
|
||||||
this.showSpecType = false;
|
this.showSpecType = false;
|
||||||
this.setFormData.spec_type = this.spec_type + '';
|
this.setFormData.spec_type = this.spec_type + '';
|
||||||
this.setFormData.attrValue = [];
|
this.setFormData.attrValue = [
|
||||||
|
{}
|
||||||
|
];
|
||||||
this.setFormData.attr = [];
|
this.setFormData.attr = [];
|
||||||
},
|
},
|
||||||
// 跳转自定义规格页面
|
// 跳转自定义规格页面
|
||||||
|
@ -772,4 +796,23 @@
|
||||||
height: 20px;
|
height: 20px;
|
||||||
margin: 30px auto;
|
margin: 30px auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.head_close {
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
.delete_btn {
|
||||||
|
position: absolute;
|
||||||
|
top: -15rpx;
|
||||||
|
right: 10rpx;
|
||||||
|
width: 40rpx;
|
||||||
|
height: 40rpx;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
background-color: red;
|
||||||
|
color: #fff;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
</style>
|
</style>
|
|
@ -34,10 +34,11 @@
|
||||||
cost: '', // 成本价
|
cost: '', // 成本价
|
||||||
stock: '', // 库存
|
stock: '', // 库存
|
||||||
ot_price: '', // 市场价
|
ot_price: '', // 市场价
|
||||||
procure_price: '', // 批发价
|
procure_price: '', // 结算价
|
||||||
bar_code: '', // 商品条码
|
bar_code: '', // 商品条码
|
||||||
weight: '', // 重量
|
weight: '', // 重量
|
||||||
volume: '', // 体积
|
volume: '', // 体积
|
||||||
|
single_number: '', // 单件数量
|
||||||
// image: '',
|
// image: '',
|
||||||
extension_one: '',
|
extension_one: '',
|
||||||
extension_two: ''
|
extension_two: ''
|
||||||
|
@ -46,10 +47,10 @@
|
||||||
formList: [
|
formList: [
|
||||||
{
|
{
|
||||||
id: 0,
|
id: 0,
|
||||||
label: '单位',
|
label: '规格',
|
||||||
type: 'input',
|
type: 'input',
|
||||||
model: 'sku',
|
model: 'sku',
|
||||||
holder: '请填写单位',
|
holder: '请填写规格名称',
|
||||||
require: true,
|
require: true,
|
||||||
}, {
|
}, {
|
||||||
id: 1,
|
id: 1,
|
||||||
|
@ -146,15 +147,14 @@
|
||||||
// this.singleSpecification = this.$props.datas;
|
// this.singleSpecification = this.$props.datas;
|
||||||
// this.$set(this, 'singleSpecification', this.$props.datas);
|
// this.$set(this, 'singleSpecification', this.$props.datas);
|
||||||
Object.keys(this.singleSpecification).forEach((key)=>{
|
Object.keys(this.singleSpecification).forEach((key)=>{
|
||||||
this.singleSpecification[key] = this.$props.datas[key]
|
this.singleSpecification[key] = this.$props.datas[key] || ''
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
console.log(this.singleSpecification.sku);
|
// console.log(this.singleSpecification.sku);
|
||||||
if(!this.singleSpecification.sku) this.singleSpecification.sku = this.$props.sku + '';
|
|
||||||
|
|
||||||
let userInfo = this.$store.state.app.userInfo;
|
let userInfo = this.$store.state.app.userInfo;
|
||||||
if(typeof userInfo == 'string') userInfo = JSON.parse(userInfo);
|
if(typeof userInfo == 'string') userInfo = JSON.parse(userInfo);
|
||||||
// 市级供应链才需填写批发价
|
// 市级供应链才需填写结算价
|
||||||
// if(userInfo.mer_info?.type_code=="TypeSupplyChain"){
|
// if(userInfo.mer_info?.type_code=="TypeSupplyChain"){
|
||||||
// let list = []
|
// let list = []
|
||||||
// this.formList = [...list, ...this.formList]
|
// this.formList = [...list, ...this.formList]
|
||||||
|
|
|
@ -416,10 +416,10 @@
|
||||||
flag = false;
|
flag = false;
|
||||||
str = '库存不能小于等于0';
|
str = '库存不能小于等于0';
|
||||||
}
|
}
|
||||||
else if (!item.cost||+item.cost<=0) {
|
// else if (!item.cost||+item.cost<=0) {
|
||||||
flag = false;
|
// flag = false;
|
||||||
str = '成本价不能小于等于0';
|
// str = '成本价不能小于等于0';
|
||||||
}
|
// }
|
||||||
else if ((!item.procure_price||+item.procure_price<=0) && this.userInfo.mer_info.type_code == 'TypeSupplyChain') {
|
else if ((!item.procure_price||+item.procure_price<=0) && this.userInfo.mer_info.type_code == 'TypeSupplyChain') {
|
||||||
flag = false;
|
flag = false;
|
||||||
str = '批发价不能小于等于0';
|
str = '批发价不能小于等于0';
|
||||||
|
|
Loading…
Reference in New Issue