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

添加商品优化

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