提交 6fb7e418 authored 作者: huaxinzhu's avatar huaxinzhu

添加商品优化

上级 1f1201d7
...@@ -21,20 +21,20 @@ ...@@ -21,20 +21,20 @@
<el-form-item label="手续费"> <el-form-item label="手续费">
当前手续费为{{newFee}} 当前手续费为{{newFee}}
</el-form-item> </el-form-item>
<el-form-item label="银行卡" prop="bankId"> <el-form-item label="银行卡" prop="bank_id">
<el-select v-model="form.bankId" placeholder="选择到账银行卡" style="width:260px;"> <el-select v-model="form.bank_id" placeholder="选择到账银行卡" style="width:260px;">
<el-option v-for="item in banklist" :key="item.Id" <el-option v-for="item in banklist" :key="item.Id"
:label="item.BankAccountName?item.BankAccountName:item.ZfbAccountName" :label="item.bank_name ? item.bank_name : bank_account_name"
:value="item.Id?item.Id:item.Id"></el-option> :value="item.id ? item.id : item.Id"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="提现金额" prop="money"> <el-form-item label="提现金额" prop="amount">
<el-input v-model="form.money" <el-input v-model="form.amount"
@blur="onInputBlur($event)" @blur="onInputBlur($event)"
placeholder="提现金额大于等于100" placeholder="提现金额大于等于100"
style="width:260px;"/> style="width:260px;"/>
</el-form-item> </el-form-item>
<el-form-item label="短信验证码" prop="verifycode"> <el-form-item label="短信验证码" prop="verifycode" class="spe-code-con-item">
<el-input v-model="form.verifycode" placeholder="验证码" style="width:260px;"> <el-input v-model="form.verifycode" placeholder="验证码" style="width:260px;">
<template slot="append"> <template slot="append">
<span v-show="show" @click="getCheckCodeFn">获取验证码</span> <span v-show="show" @click="getCheckCodeFn">获取验证码</span>
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
count: '', count: '',
timer: null, timer: null,
//提现金额 //提现金额
money: 0, amount: 0,
// 遮罩层 // 遮罩层
loading: true, loading: true,
// 选中数组 // 选中数组
...@@ -85,13 +85,13 @@ ...@@ -85,13 +85,13 @@
open: true, open: true,
// 表单参数 // 表单参数
form: { form: {
bankId: '', bank_id: '',
money: '' amount: ''
}, },
// 表单校验 // 表单校验
rules: { rules: {
bankId: [{required: true, message: "请选择要提现的银行卡", trigger: "change"}], bank_id: [{required: true, message: "请选择要提现的银行卡", trigger: "change"}],
money: [{required: true, message: "提现金额不能为空", trigger: "blur"}], amount: [{required: true, message: "提现金额不能为空", trigger: "blur"}],
verifycode: [{required: true, message: "短信验证码不能为空", trigger: "blur"}], verifycode: [{required: true, message: "短信验证码不能为空", trigger: "blur"}],
pwd: [{required: true, message: "支付密码必须填写", trigger: "blur"}] pwd: [{required: true, message: "支付密码必须填写", trigger: "blur"}]
} }
...@@ -144,19 +144,19 @@ ...@@ -144,19 +144,19 @@
}, },
getCheckCodeFn() { getCheckCodeFn() {
let numRegExp = /^[0-9]+(.[0-9]{2})?$/; let numRegExp = /^[0-9]+(.[0-9]{2})?$/;
let numberMoney = Number(this.form.money); let numberMoney = Number(this.form.amount);
let numberCash = Number(this.drawableCash); let numberCash = Number(this.drawableCash);
if(this.form.bankId === '') { if(this.form.bank_id === '') {
this.$refs.form.validateField("bankId"); this.$refs.form.validateField("bank_id");
return; return;
} }
if(this.form.money === '') { if(this.form.amount === '') {
this.$refs.form.validateField("money"); this.$refs.form.validateField("amount");
return; return;
} }
if(!numRegExp.test(this.form.money)) { if(!numRegExp.test(this.form.amount)) {
this.$message({ type: 'warning',message: '提现金额只能输入大于 0 的数字'}); this.$message({ type: 'warning',message: '提现金额只能输入大于 0 的数字'});
return; return;
} }
...@@ -186,27 +186,27 @@ ...@@ -186,27 +186,27 @@
onInputBlur(event) { onInputBlur(event) {
let fee = 0.006; let fee = 0.006;
this.form.money = event.target.value; this.form.amount = event.target.value;
let numRegExp = /^[0-9]+(.[0-9]{2})?$/; let numRegExp = /^[0-9]+(.[0-9]{2})?$/;
let numberMoney = Number(this.form.money); let numberMoney = Number(this.form.amount);
//debugger //debugger
let numberCash = Number(this.drawableCash); let numberCash = Number(this.drawableCash);
if(this.form.money !== '') { if(this.form.amount !== '') {
if(!numRegExp.test(this.form.money)) { if(!numRegExp.test(this.form.amount)) {
this.$message({ type: 'warning',message: '提现金额只能输入大于 0 的数字'}); this.$message({ type: 'warning',message: '提现金额只能输入大于 0 的数字'});
return; return;
} }
if (Number(this.form.money) > Number(this.drawableCash)) { if (Number(this.form.amount) > Number(this.drawableCash)) {
this.$message({type: 'warning',message:'提现金额不足!'}); this.$message({type: 'warning',message:'提现金额不足!'});
return; return;
} }
if (Number(this.form.money) < 100) { if (Number(this.form.amount) < 100) {
this.$message({type: 'warning',message:'提现金额需大于或者等于 100'}); this.$message({type: 'warning',message:'提现金额需大于或者等于 100'});
return; return;
} }
this.newFee = (this.form.money * fee + 1).toFixed(2); this.newFee = (this.form.amount * fee + 1).toFixed(2);
} }
}, },
//获取商户的信息 //获取商户的信息
...@@ -246,7 +246,7 @@ ...@@ -246,7 +246,7 @@
submitForm() { submitForm() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
let numberMoney = Number(this.form.money); let numberMoney = Number(this.form.amount);
let numberCash = Number(this.drawableCash); let numberCash = Number(this.drawableCash);
this.form.sellerId = this.sellerId; this.form.sellerId = this.sellerId;
// 再次校验 提现信息 // 再次校验 提现信息
...@@ -263,13 +263,14 @@ ...@@ -263,13 +263,14 @@
return; return;
} }
// this.form.verifycode = Number(this.form.verifycode); this.form.amount = Number(this.form.amount);
addWithdrawlog(this.form).then(response => { addWithdrawlog(this.form).then(response => {
if (response.code == 0) { if (response.code === 1) {
this.msgSuccess(response.msg); this.msgSuccess(response.message);
this.getList(); this.getList();
} else { }
this.$message({type: 'error',message: response.msg}); else {
this.$message({type: 'error',message: response.message});
} }
}); });
} }
...@@ -283,4 +284,8 @@ ...@@ -283,4 +284,8 @@
width: 500px; width: 500px;
margin: 20px 0 0 120px; margin: 20px 0 0 120px;
} }
/deep/.spe-code-con-item .el-input-group__append {
cursor: pointer;
}
</style> </style>
...@@ -4,49 +4,62 @@ ...@@ -4,49 +4,62 @@
<el-link class="edit-type-span el-icon-search" type="primary" :underline="false">查看各类价格说明</el-link> <el-link class="edit-type-span el-icon-search" type="primary" :underline="false">查看各类价格说明</el-link>
<span class="tip-span">所有商品价格均为含税价,必须开具发票</span> <span class="tip-span">所有商品价格均为含税价,必须开具发票</span>
</p> </p>
<div v-for="(item,index) in goodsPamPreList" :key="index" class="single-spe-con"> <div v-for="(item,index) in orgGoodsPam.pamTableList" :key="index" class="single-spe-con">
<p style="margin: 10px 0;color: #333;font-size: 14px;font-weight: 400;"> <p style="margin: 10px 0;color: #333;font-size: 14px;font-weight: 400;">
<span style="font-size: 12px;color: #909399;margin: 0 8px 0 0">{{ index + 1 }}个规格</span> <!-- <span v-html="preTableTitle[index]">-->
<span style="margin-right: 20px;" v-for="(itemGS,indexGS) in item" :key="itemGS"> <!-- {{ preTableTitle[index] }}-->
<span>{{ goodsSpecNameList[indexGS] }}</span> <!-- </span>-->
<span>{{ itemGS }}</span> <span v-for="(itemv,indexv) in orgGoodsPam.pamDataList[index]" style="margin-right:20px;">
{{orgGoodsPam.pamNameList[indexv]['specName']}}
<span></span>
{{itemv[0]}}
</span> </span>
</p> </p>
<el-table <el-table
border border
size="small" size="small"
:data="goodsPamPreTable" :data="item"
style="width: 80%" style="width: 80%"
> >
<el-table-column align="center" prop="hh1" label="协议价"> <el-table-column align="center" prop="hh1" label="协议价">
<!-- <template slot-scope="scope">--> <template slot-scope="scope">
<!-- <span>{{ scope.row.agreementPrice/100 }}</span>--> <el-input size="mini" style="width:90%" v-model="scope.row.hh1" placeholder="请输入协议价"></el-input>
<!-- </template>--> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" prop="hh2" label="结算价"> <el-table-column align="center" prop="hh2" label="结算价">
<!-- <template slot-scope="scope">--> <template slot-scope="scope">
<!-- <span>{{ scope.row.guidePrice/100 }}</span>--> <el-input size="mini" style="width:90%" v-model="scope.row.hh2" :disabled="true" placeholder="根据结算价自动计算"></el-input>
<!-- </template>--> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" prop="hh3" label="指导价"> <el-table-column align="center" prop="hh3" label="指导价">
<!-- <template slot-scope="scope">--> <template slot-scope="scope">
<!-- <el-input v-model="scope.row.salePrice" size="mini"/>--> <el-input size="mini" style="width:90%" v-model="scope.row.hh3" placeholder="请输入指导价"></el-input>
<!-- </template>--> </template>
</el-table-column>
<el-table-column align="center" prop="hh4" label="市场价">
<template slot-scope="scope">
<el-input size="mini" style="width:90%" v-model="scope.row.hh4" placeholder="请输入市场价"></el-input>
</template>
</el-table-column>
<el-table-column align="center" prop="hh5" label="库存量">
<template slot-scope="scope">
<el-input size="mini" style="width:90%" v-model="scope.row.hh5" placeholder="请输入库存量"></el-input>
</template>
</el-table-column> </el-table-column>
<el-table-column align="center" prop="hh7" label="市场价"> <el-table-column align="center" prop="hh6" label="库存预警">
<!-- <template slot-scope="scope">--> <template slot-scope="scope">
<!-- <el-input v-model="scope.row.salePrice" size="mini"/>--> <el-input size="mini" style="width:90%" v-model="scope.row.hh6" placeholder="请输入预警值"></el-input>
<!-- </template>--> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" prop="hh4" label="库存量"> <el-table-column align="center" prop="hh7" label="图片">
<!-- <template slot-scope="scope">--> <template slot-scope="scope">
<!-- <span>{{ (scope.row.salePrice*100 + scope.row.freight - scope.row.agreementPrice)/100 }}</span>-->
<!-- </template>--> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" prop="hhh5" label="库存预警"></el-table-column>
<el-table-column align="center" prop="hh6" label="图片"></el-table-column>
</el-table> </el-table>
</div> </div>
</div> </div>
</template> </template>
...@@ -62,46 +75,67 @@ export default { ...@@ -62,46 +75,67 @@ export default {
}, },
data() { data() {
return { return {
goodsPam: [], orgGoodsPam: {},
preTableTitle: [],
// 规格名称数组 // 规格名称数组
goodsSpecNameList: [], // goodsSpecNameList: [],
// 每一个规格,都是一张表格 // // 每一个规格,都是一张表格
goodsPamPreList:[], // goodsPam:[
goodsPamPreTable: [ // {
{ // speNameList:[ '颜色','尺码' ],
hh1: '', // goodsParametersList: [],
hh2: '', // goodsPamPreTable: [{
hh3: '', // hh1: '',
hh4: '', // hh2: '',
hh5: '', // hh3: '',
hh6: '', // hh4: '',
} // hh5: '',
], // hh6: '',
// hh7: '',
// }],
// },
// {
// speNameList:[ '颜色','尺码' ],
// goodsParametersList: [],
// goodsPamPreTable: [ {
// hh1: '',
// hh2: '',
// hh3: '',
// hh4: '',
// hh5: '',
// hh6: '',
// hh7: '',
// } ]}
// ],
// goodsPamPreTable: [],
// goodsPamPreObj: // goodsPamPreObj:
} // return end } // return end
}, },
watch:{ watch:{
'parameterdata.hu1': function(val) { 'parameterdata': function(val) {
this.goodsSpecNameList = val; this.orgGoodsPam = val;
}, this.preTableTitle = [];
'parameterdata.hu2':function(val) {
console.log(100000,val)
this.goodsPamPreList = [];
this.goodsPamPreList = val;
} this.orgGoodsPam.pamDataList.forEach((item)=> {
let preTitle = '';
if (!Array.isArray(item)) {
preTitle = this.orgGoodsPam.pamNameList[0].specName + ':' + item;
}else {
item.forEach((itemI,indexI)=> {
preTitle += (this.orgGoodsPam.pamNameList[indexI].specName + " " + itemI) + " ";
});
}
this.preTableTitle.push(preTitle);
});
},
}, },
created() { created() {
//this.goodsSpecNameList = this.parameterdata //this.orgGoodsPam = this.parameterdata;
// _this.$Bus.$on("calcSpeTable",function(val) {
// console.log(37,val);
// _this.goodsSpecNameList = val.hu1;
// _this.goodsPamPreList = val.hu2;
// this.$forceUpdate()
// });
}, },
mounted() { mounted() {
console.log("9999",this.goodsPamPreList); //console.log("9999",this.goodsPamPreList);
}, },
methods: { methods: {
......
...@@ -113,7 +113,9 @@ export default { ...@@ -113,7 +113,9 @@ export default {
type: 'warning' type: 'warning'
}).then(async() => { }).then(async() => {
this.speData.splice(index,1); this.speData.splice(index,1);
this.speNameListChange(); //this.speNameListChange();
this.paramNameInputBlur();
}).catch(() => {}) }).catch(() => {})
}, },
// 规格名称,下拉选值时触发 // 规格名称,下拉选值时触发
...@@ -123,9 +125,11 @@ export default { ...@@ -123,9 +125,11 @@ export default {
// 规格名称,有变化时 // 规格名称,有变化时
speNameListChange() { speNameListChange() {
this.speNameList = []; this.speNameList = [];
this.speData.forEach((item)=> { this.speData.forEach((item,)=> {
let obj = {specName: ''};
if(item.specName) { if(item.specName) {
this.speNameList.push(item.specName); obj.specName = item.specName;
this.speNameList.push(obj);
} }
}); });
}, },
...@@ -138,6 +142,7 @@ export default { ...@@ -138,6 +142,7 @@ export default {
deleteSpeParam(index,indexSV) { deleteSpeParam(index,indexSV) {
this.speData[index].specValue.splice(indexSV,1); this.speData[index].specValue.splice(indexSV,1);
//console.log(119,this.speData[index].specValue); //console.log(119,this.speData[index].specValue);
this.paramNameInputBlur();
}, },
/** /**
* 规格名称 下拉框 出现/隐藏 触发 * 规格名称 下拉框 出现/隐藏 触发
...@@ -190,22 +195,67 @@ export default { ...@@ -190,22 +195,67 @@ export default {
paramNameInputBlur() { paramNameInputBlur() {
// 商品规格原始数据 // 商品规格原始数据
let orgSpeData = this.deepClone(this.speData); let orgSpeData = this.deepClone(this.speData);
//debugger
// 进行数据处理后的数据, // 进行数据处理后的数据,
let proSpeData = this.processData(orgSpeData); let proSpeData = this.processData(orgSpeData);
// 笛卡尔积 生成所有规格组合数据 // 笛卡尔积 生成所有规格组合数据
let goodsParametersList = this.cartesian(proSpeData); if(proSpeData.length > 0) {
let goodsParametersList = this.cartesian(proSpeData);
// 组织数据 结构
if(this.speNameList.length > 0 && goodsParametersList.length > 0) {
// 所有数据
let goodsPam = {
pamNameList: [],
pamDataList: [],
pamTableList: [],
};
goodsPam.pamNameList = this.speNameList;
goodsPam.pamDataList = goodsParametersList;
goodsParametersList.forEach((item)=> {
let prePamTable = [
{ hh1:'', hh2:'', hh3:'', hh4:'', hh5:'', hh6:'', hh7:'' }
];
goodsPam.pamTableList.push(prePamTable)
});
//console.log("最终结果",goodsPam);
this.$emit('calcSpeTable',goodsPam);
// goodsParametersList.forEach((item)=> {
// let goodsPrePam = {
// pamTitleList: [],
// pamTabList: []
// };
// let tableSingle = [{hh1: '', hh2: '', hh3: '', hh4: '', hh5: '', hh6: '', hh7: ''}];
// // let preTitle = '';
// // if (!Array.isArray(item)) {
// // preTitle = this.speNameList[0].specName + ':' + item;
// // }else {
// // item.forEach((itemI,indexI)=> {
// // preTitle += (this.speNameList[indexI].specName + itemI);
// // });
// // }
// // goodsPrePam.pamTitleList.push(preTitle);
// goodsPrePam.pamTabList.push(tableSingle);
//
// goodsPamList.push(goodsPrePam);
// });
if(this.speNameList.length > 0 && goodsParametersList.length > 0) {
let hufei = { //this.$emit('calcSpeTable',goodsPamList);
hu1: [], // console.log("规格名称:",goodsPamList);
hu2: []
} }
hufei.hu1 = this.speNameList;
hufei.hu2 = goodsParametersList;
this.$emit('calcSpeTable',hufei);
// console.log("规格名称:",hufei);
}
}
}, },
/** 数据处理为,二维数组,供笛卡尔积算法方法使用,对空数据进行过滤 */ /** 数据处理为,二维数组,供笛卡尔积算法方法使用,对空数据进行过滤 */
...@@ -233,20 +283,40 @@ export default { ...@@ -233,20 +283,40 @@ export default {
}, },
/** 笛卡尔积算法 */ /** 笛卡尔积算法 */
cartesian(arr) { cartesian(arr) {
// if(arr.length < 2) {
// let res = [];
// arr.forEach((item) => {
// res.push(item);
// });
// return res
// }else {
// return [].reduce.call(arr, function(col, set) {
// let res = [];
// col.forEach( c => {
// set.forEach(s => {
// let t = [].concat(Array.isArray(c) ? c : [c]);
// t.push(s);
// res.push(t);
// });
// });
// return res
// });
// }
if(arr.length < 2) { if(arr.length < 2) {
return arr[0] || []; return arr[0] || [];
} }else {
return [].reduce.call(arr, function(col, set) { return [].reduce.call(arr, function(col, set) {
let res = []; let res = [];
col.forEach( c => { col.forEach( c => {
set.forEach(s => { set.forEach(s => {
let t = [].concat(Array.isArray(c) ? c : [c]); let t = [].concat(Array.isArray(c) ? c : [c]);
t.push(s); t.push(s);
res.push(t); res.push(t);
});
}); });
return res
}); });
return res }
});
} }
}, // methods end }, // methods end
......
...@@ -148,22 +148,8 @@ ...@@ -148,22 +148,8 @@
methods: { methods: {
// 规格子组件,传给父组件的数据 // 规格子组件,传给父组件的数据
calcSpeTable(data) { calcSpeTable(data) {
let data1 = data; this.parameterdata = data;
this.parameterdata = data1; //console.log(153,this.parameterdata);
console.log(153,this.parameterdata);
this.parameterdata['']
let obj = {
hh1: '',
hh2: '',
hh3: '',
hh4: '',
hh5: '',
hh6: '',
}
// for(let i = 0; i < this.data1.hu2.length; i++) {
// this.data1.hu2[i]['obj'] = obj;
// }
}, },
// 只有点击完最后一级,才会有值 // 只有点击完最后一级,才会有值
SSQChange() { SSQChange() {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论