回滚商品中的分期配置功能
This commit is contained in:
parent
94d3c4fd55
commit
35936a5919
|
@ -532,63 +532,63 @@
|
|||
</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item class="proCoupon" label="是否可分期:" >
|
||||
<el-switch :disabled="isDisabled" v-model="orderType" class="drawer-switch switch-margin" active-color="#13ce66" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="18" v-if="orderType">
|
||||
<el-col v-for="(config, index) in formValidate.installmentConfigs" :key="index">
|
||||
<el-col :xl="6" :lg="9" :md="9" :sm="24" :xs="24">
|
||||
<el-form-item label="分期数:">
|
||||
<el-select disabled v-model="config.installmentNumber" placeholder="请选择" style="width: 80%">
|
||||
<el-option v-for="item in installmentNumberTreeData" :key="item" :label="item" :value="item">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<span>期</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :xl="6" :lg="9" :md="9" :sm="24" :xs="24">
|
||||
<el-form-item label="价格:">
|
||||
<el-input disabled v-model="config.price" placeholder="请输入价格" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-if="!isDisabled" :xl="6" :lg="6" :md="6" :sm="24" :xs="24">
|
||||
<el-form-item class="noLeft">
|
||||
<el-button @click="offInstallment(index)">取消</el-button>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-col>
|
||||
</el-col>
|
||||
<el-col :span="18" v-if="orderType">
|
||||
<el-col v-for="(config, index) in newInstallmentConfigs" :key="index">
|
||||
<el-col :xl="6" :lg="9" :md="9" :sm="24" :xs="24">
|
||||
<el-form-item label="分期数:">
|
||||
<el-select v-model="config.installmentNumber" placeholder="请选择" style="width: 80%">
|
||||
<el-option v-for="item in installmentNumberTreeData" :key="item" :label="item" :value="item">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<span>期</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :xl="6" :lg="9" :md="9" :sm="24" :xs="24">
|
||||
<el-form-item label="价格:">
|
||||
<el-input v-model="config.price" placeholder="请输入价格" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-if="!isDisabled" :xl="6" :lg="6" :md="6" :sm="24" :xs="24">
|
||||
<el-form-item class="noLeft">
|
||||
<el-button v-if="index === newInstallmentConfigs.length - 1" type="primary" class="mr15" @click="saveNewInstallmentConfig()">确定</el-button>
|
||||
<el-button @click="offNewInstallment(index)">取消</el-button>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-col>
|
||||
</el-col>
|
||||
<el-col v-show="orderType" v-if="!isDisabled" :span="24">
|
||||
<el-form-item >
|
||||
<el-button type="primary" icon="md-add" class="mr15" @click="addInstallmentConfig">添加分期配置</el-button>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- <el-col :span="24">-->
|
||||
<!-- <el-form-item class="proCoupon" label="是否可分期:" >-->
|
||||
<!-- <el-switch :disabled="isDisabled" v-model="orderType" class="drawer-switch switch-margin" active-color="#13ce66" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- <el-col :span="18" v-if="orderType">-->
|
||||
<!-- <el-col v-for="(config, index) in formValidate.installmentConfigs" :key="index">-->
|
||||
<!-- <el-col :xl="6" :lg="9" :md="9" :sm="24" :xs="24">-->
|
||||
<!-- <el-form-item label="分期数:">-->
|
||||
<!-- <el-select disabled v-model="config.installmentNumber" placeholder="请选择" style="width: 80%">-->
|
||||
<!-- <el-option v-for="item in installmentNumberTreeData" :key="item" :label="item" :value="item">-->
|
||||
<!-- </el-option>-->
|
||||
<!-- </el-select>-->
|
||||
<!-- <span>期</span>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- <el-col :xl="6" :lg="9" :md="9" :sm="24" :xs="24">-->
|
||||
<!-- <el-form-item label="价格:">-->
|
||||
<!-- <el-input disabled v-model="config.price" placeholder="请输入价格" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- <el-col v-if="!isDisabled" :xl="6" :lg="6" :md="6" :sm="24" :xs="24">-->
|
||||
<!-- <el-form-item class="noLeft">-->
|
||||
<!-- <el-button @click="offInstallment(index)">取消</el-button>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- <el-col :span="18" v-if="orderType">-->
|
||||
<!-- <el-col v-for="(config, index) in newInstallmentConfigs" :key="index">-->
|
||||
<!-- <el-col :xl="6" :lg="9" :md="9" :sm="24" :xs="24">-->
|
||||
<!-- <el-form-item label="分期数:">-->
|
||||
<!-- <el-select v-model="config.installmentNumber" placeholder="请选择" style="width: 80%">-->
|
||||
<!-- <el-option v-for="item in installmentNumberTreeData" :key="item" :label="item" :value="item">-->
|
||||
<!-- </el-option>-->
|
||||
<!-- </el-select>-->
|
||||
<!-- <span>期</span>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- <el-col :xl="6" :lg="9" :md="9" :sm="24" :xs="24">-->
|
||||
<!-- <el-form-item label="价格:">-->
|
||||
<!-- <el-input v-model="config.price" placeholder="请输入价格" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- <el-col v-if="!isDisabled" :xl="6" :lg="6" :md="6" :sm="24" :xs="24">-->
|
||||
<!-- <el-form-item class="noLeft">-->
|
||||
<!-- <el-button v-if="index === newInstallmentConfigs.length - 1" type="primary" class="mr15" @click="saveNewInstallmentConfig()">确定</el-button>-->
|
||||
<!-- <el-button @click="offNewInstallment(index)">取消</el-button>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- <el-col v-show="orderType" v-if="!isDisabled" :span="24">-->
|
||||
<!-- <el-form-item >-->
|
||||
<!-- <el-button type="primary" icon="md-add" class="mr15" @click="addInstallmentConfig">添加分期配置</el-button>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
</el-row>
|
||||
<el-form-item>
|
||||
<el-button v-show="currentTab > 0" class="submission priamry_border" @click="handleSubmitUp"
|
||||
|
@ -638,8 +638,8 @@ const defaultObj = {
|
|||
isBenefit: false,
|
||||
isNew: false,
|
||||
isGood: false,
|
||||
orderType: true,
|
||||
installmentConfigs:[],
|
||||
// orderType: true,
|
||||
// installmentConfigs:[],
|
||||
isHot: false,
|
||||
isBest: false,
|
||||
tempId: '',
|
||||
|
@ -738,11 +738,11 @@ export default {
|
|||
attrsVal: '',
|
||||
},
|
||||
isBtn: false,
|
||||
isInstallmentBtn: false,
|
||||
installmentNumberTreeData: [3,6,9,12,18,24,36],
|
||||
newInstallmentConfigs:[{installmentNumber:null,price:null}],
|
||||
orderType: true,
|
||||
newInstallment: { installmentNumber: null, price: null },//用于添加新分期配置的对象
|
||||
// isInstallmentBtn: false,
|
||||
// installmentNumberTreeData: [3,6,9,12,18,24,36],
|
||||
// newInstallmentConfigs:[{installmentNumber:null,price:null}],
|
||||
// orderType: true,
|
||||
// newInstallment: { installmentNumber: null, price: null },//用于添加新分期配置的对象
|
||||
manyFormValidate: [],
|
||||
currentTab: 0,
|
||||
isChoice: '',
|
||||
|
@ -754,14 +754,14 @@ export default {
|
|||
xs: 24,
|
||||
},
|
||||
ruleValidate: {
|
||||
// storeName: [{ required: true, message: '请输入商品名称', trigger: 'blur' }],
|
||||
// cateIds: [{ required: true, message: '请选择商品分类', trigger: 'change', type: 'array', min: '1' }],
|
||||
// keyword: [{ required: true, message: '请输入商品关键字', trigger: 'blur' }],
|
||||
// unitName: [{ required: true, message: '请输入单位', trigger: 'blur' }],
|
||||
// tempId: [{ required: true, message: '请选择运费模板', trigger: 'change' }],
|
||||
// image: [{ required: true, message: '请上传商品图', trigger: 'change' }],
|
||||
// sliderImages: [{ required: true, message: '请上传商品轮播图', type: 'array', trigger: 'change' }],
|
||||
// specType: [{ required: true, message: '请选择商品规格', trigger: 'change' }],
|
||||
storeName: [{ required: true, message: '请输入商品名称', trigger: 'blur' }],
|
||||
cateIds: [{ required: true, message: '请选择商品分类', trigger: 'change', type: 'array', min: '1' }],
|
||||
keyword: [{ required: true, message: '请输入商品关键字', trigger: 'blur' }],
|
||||
unitName: [{ required: true, message: '请输入单位', trigger: 'blur' }],
|
||||
tempId: [{ required: true, message: '请选择运费模板', trigger: 'change' }],
|
||||
image: [{ required: true, message: '请上传商品图', trigger: 'change' }],
|
||||
sliderImages: [{ required: true, message: '请上传商品轮播图', type: 'array', trigger: 'change' }],
|
||||
specType: [{ required: true, message: '请选择商品规格', trigger: 'change' }],
|
||||
},
|
||||
attrInfo: {},
|
||||
tableFrom: {
|
||||
|
@ -1107,39 +1107,39 @@ export default {
|
|||
this.clearAttr();
|
||||
this.isBtn = true;
|
||||
},
|
||||
// 添加分期配置
|
||||
addInstallmentConfig() {
|
||||
this.newInstallmentConfigs.push({ ...this.newInstallment });
|
||||
// 判断是否有选择分期数和输入价格
|
||||
},
|
||||
saveNewInstallmentConfig: function () {
|
||||
//判断newInstallmentConfigs数组是否有值,
|
||||
//如果有值则将newInstallmentConfigs数组里的对象,一个个添加到installmentConfigs数组中
|
||||
// 判断 newInstallmentConfigs 数组是否有值且里面的对象不是都是空值
|
||||
this.newInstallmentConfigs.forEach((config) => {
|
||||
if (!config.installmentNumber || !config.price || config.price <= 0) {
|
||||
this.$message.error('分期数和价格不能为空且价格必须大于0');
|
||||
return;
|
||||
}
|
||||
});
|
||||
if (
|
||||
this.newInstallmentConfigs.length > 0 &&
|
||||
this.newInstallmentConfigs.every((config) =>
|
||||
Object.values(config).every((value) => value !== '' && value !== null)
|
||||
)
|
||||
) {
|
||||
// 将非空对象逐个添加到 installmentConfigs 数组中
|
||||
this.newInstallmentConfigs.forEach((config) => {
|
||||
if (Object.values(config).some((value) => value !== '' && value !== null)) {
|
||||
config.price = Number(config.price);
|
||||
this.formValidate.installmentConfigs.push(config);
|
||||
}
|
||||
});
|
||||
|
||||
// 清空 newInstallmentConfigs 数组
|
||||
this.newInstallmentConfigs = [];
|
||||
}
|
||||
},
|
||||
// // 添加分期配置
|
||||
// addInstallmentConfig() {
|
||||
// this.newInstallmentConfigs.push({ ...this.newInstallment });
|
||||
// // 判断是否有选择分期数和输入价格
|
||||
// },
|
||||
// saveNewInstallmentConfig: function () {
|
||||
// //判断newInstallmentConfigs数组是否有值,
|
||||
// //如果有值则将newInstallmentConfigs数组里的对象,一个个添加到installmentConfigs数组中
|
||||
// // 判断 newInstallmentConfigs 数组是否有值且里面的对象不是都是空值
|
||||
// this.newInstallmentConfigs.forEach((config) => {
|
||||
// if (!config.installmentNumber || !config.price || config.price <= 0) {
|
||||
// this.$message.error('分期数和价格不能为空且价格必须大于0');
|
||||
// return;
|
||||
// }
|
||||
// });
|
||||
// if (
|
||||
// this.newInstallmentConfigs.length > 0 &&
|
||||
// this.newInstallmentConfigs.every((config) =>
|
||||
// Object.values(config).every((value) => value !== '' && value !== null)
|
||||
// )
|
||||
// ) {
|
||||
// // 将非空对象逐个添加到 installmentConfigs 数组中
|
||||
// this.newInstallmentConfigs.forEach((config) => {
|
||||
// if (Object.values(config).some((value) => value !== '' && value !== null)) {
|
||||
// config.price = Number(config.price);
|
||||
// this.formValidate.installmentConfigs.push(config);
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// // 清空 newInstallmentConfigs 数组
|
||||
// this.newInstallmentConfigs = [];
|
||||
// }
|
||||
// },
|
||||
// 取消
|
||||
offAttrName() {
|
||||
this.isBtn = false;
|
||||
|
@ -1248,8 +1248,8 @@ export default {
|
|||
selectRule: info.selectRule,
|
||||
isSub: info.isSub,
|
||||
content: this.$selfUtil.replaceImgSrcHttps(info.content),
|
||||
installmentConfigs: info.storeProductInstallmentsList ==null?[]:info.storeProductInstallmentsList,
|
||||
orderType: info.orderType,
|
||||
// installmentConfigs: info.storeProductInstallmentsList ==null?[]:info.storeProductInstallmentsList,
|
||||
// orderType: info.orderType,
|
||||
specType: info.specType,
|
||||
id: info.id,
|
||||
giveIntegral: info.giveIntegral,
|
||||
|
@ -1414,14 +1414,14 @@ export default {
|
|||
// 提交
|
||||
handleSubmit: Debounce(function (name) {
|
||||
this.onChangeGroup();
|
||||
this.saveNewInstallmentConfig();
|
||||
this.newInstallmentConfigs.forEach((config) => {
|
||||
if (!config.installmentNumber || !config.price || config.price <= 0) {
|
||||
this.$message.error('分期数和价格不能为空且价格必须大于0');
|
||||
return;
|
||||
}
|
||||
});
|
||||
console.log("this.formValidate----------"+JSON.stringify(this.formValidate))
|
||||
// this.saveNewInstallmentConfig();
|
||||
// this.newInstallmentConfigs.forEach((config) => {
|
||||
// if (!config.installmentNumber || !config.price || config.price <= 0) {
|
||||
// this.$message.error('分期数和价格不能为空且价格必须大于0');
|
||||
// return;
|
||||
// }
|
||||
// });
|
||||
// console.log("this.formValidate----------"+JSON.stringify(this.formValidate))
|
||||
if (this.formValidate.specType && this.formValidate.attr.length < 1)
|
||||
return this.$message.warning('请填写多规格属性!');
|
||||
this.formValidate.cateId = this.formValidate.cateIds.join(',');
|
||||
|
@ -1461,7 +1461,7 @@ export default {
|
|||
this.$refs[name].validate((valid) => {
|
||||
if (valid) {
|
||||
this.fullscreenLoading = true;
|
||||
this.formValidate.orderType = this.orderType;
|
||||
// this.formValidate.orderType = this.orderType;
|
||||
this.$route.params.id
|
||||
? productUpdateApi(this.formValidate)
|
||||
.then(async (res) => {
|
||||
|
|
Loading…
Reference in New Issue
Block a user