回滚商品中的分期配置功能

This commit is contained in:
邱贞招 2023-12-23 17:47:02 +08:00
parent 94d3c4fd55
commit 35936a5919

View File

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