Commit 22c85ca8 by chenyu

update: 页面优化

parent 3c6cf150
<template> <template>
<el-dialog title="新建分类" :visible.sync="addCateModal.dialogVisible" width="450px" @close="cancelSubmit('editInfoModal')"> <el-dialog title="新建分类" :visible.sync="addCateModal.dialogVisible" width="450px" @close="cancelSubmit('editInfoModal')">
<el-form :model="editInfoModal" ref="editInfoModal" :rules="modalRules"> <el-form :model="editInfoModal" ref="editInfoModal" :rules="modalRules">
<el-form-item label="分类名称" label-width="80px" prop="cateName"> <el-form-item label="分类名称" label-width="80px" prop="cateName" class="position-item">
<el-input type="text" v-model="editInfoModal.cateName" style="width:330px" @input="value => proNameLimit(value)"> </el-input> <el-input type="text" v-model="editInfoModal.cateName" style="width:330px" @input="value => proNameLimit(value)"> </el-input>
<span class="slot-num">{{ goodsInfo.cateNameLen }}/10</span>
</el-form-item> </el-form-item>
<span class="slot-num">{{ goodsInfo.cateNameLen }}/10</span>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button @click="cancelSubmit('editInfoModal')">取 消</el-button> <el-button @click="cancelSubmit('editInfoModal')">取 消</el-button>
...@@ -57,6 +57,7 @@ export default { ...@@ -57,6 +57,7 @@ export default {
request.post('/api-integral-mall/create-gift-category', qs.stringify(params)).then(res => { request.post('/api-integral-mall/create-gift-category', qs.stringify(params)).then(res => {
if (res.data.errorCode === 0) { if (res.data.errorCode === 0) {
this.$message.success('新增成功'); this.$message.success('新增成功');
this.goodsInfo.cateNameLen = 0;
this.addCateModal.dialogVisible = false; this.addCateModal.dialogVisible = false;
this.$emit('getCategoryOptions'); this.$emit('getCategoryOptions');
} else { } else {
...@@ -77,9 +78,13 @@ export default { ...@@ -77,9 +78,13 @@ export default {
}; };
</script> </script>
<style scoped> <style scoped>
.position-item {
position: relative;
}
.slot-num { .slot-num {
float: right; position: absolute;
margin-top: -20px; top: 0;
right: 8px;
font-size: 13px; font-size: 13px;
} }
</style> </style>
...@@ -76,17 +76,19 @@ ...@@ -76,17 +76,19 @@
</thead> </thead>
<tbody> <tbody>
<tr v-for="(item1, index1) in skuList" :key="index1"> <tr v-for="(item1, index1) in skuList" :key="index1">
<td v-for="(item2, index2) in item1" :key="index2" style="width:120px" v-if="item1.length - index2 > 1"> <template v-for="(item2, index2) in item1">
<!-- {{ item1[7] }} --> <td :key="index2" style="width:120px" v-if="item1.length - index2 > 1">
<span v-if="item1.length - index2 < 7"> <!-- {{ item1[7] }} -->
<el-input size="small" v-model.trim="item2.valueName" @blur="skuInput(item1, item2, index1, index2)" @input="setSkuValueName"></el-input> <span v-if="item1.length - index2 < 7">
</span> <el-input size="small" v-model.trim="item2.valueName" @blur="skuInput(item1, item2, index1, index2)" @input="setSkuValueName"></el-input>
</span>
<!-- <span v-else-if="item1.length === index2 + 1" style="color:red">{{ item2.valueName ? item2.valueName : '' }}</span> --> <!-- <span v-else-if="item1.length === index2 + 1" style="color:red">{{ item2.valueName ? item2.valueName : '' }}</span> -->
<span v-else>{{ item2.valueName ? item2.valueName : '' }}</span> <span v-else>{{ item2.valueName ? item2.valueName : '' }}</span>
</td> </td>
<!-- 最后一列存的skuId --> <!-- 最后一列存的skuId -->
<td v-else style="color:red;display:none">{{ item2.valueName }}</td> <td v-else :key="index2" style="color:red;display:none">{{ item2.valueName }}</td>
</template>
</tr> </tr>
</tbody> </tbody>
</table> </table>
...@@ -142,7 +144,11 @@ export default { ...@@ -142,7 +144,11 @@ export default {
searchStandard: '', searchStandard: '',
searchStandardValue: '', searchStandardValue: '',
// isStdImg: false // isStdImg: false
warnStatus: false warnStatus: false,
minIntergral: {
integralCost: '',
cashCost: ''
}
}; };
}, },
created() { created() {
...@@ -548,9 +554,37 @@ export default { ...@@ -548,9 +554,37 @@ export default {
//sku库存相加得spu库存 //sku库存相加得spu库存
addStock() { addStock() {
let temSum = 0; let temSum = 0;
let minIntergral = { integralCost: '', cashCost: '' };
for (let i in this.skuList) { for (let i in this.skuList) {
for (let j in this.skuList[i]) { for (let j in this.skuList[i]) {
if (this.skuList[i].length - j == 6) {
if (minIntergral.integralCost === '') {
minIntergral = Object.assign({}, minIntergral, {
integralCost: this.skuList[i][j].valueName,
cashCost: this.skuList[i][Number(j) + 1].valueName
});
}
if (Number(this.skuList[i][j].valueName) < Number(minIntergral.integralCost)) {
minIntergral = Object.assign({}, minIntergral, {
integralCost: this.skuList[i][j].valueName,
cashCost: this.skuList[i][Number(j) + 1].valueName
});
this.$emit('changeMinIntegral', minIntergral);
}
if (Number(this.skuList[i][j].valueName) == Number(minIntergral.integralCost)) {
minIntergral = Object.assign({}, minIntergral, {
integralCost: this.skuList[i][j].valueName,
cashCost: this.skuList[i][Number(j) + 1].valueName <= Number(minIntergral.cashCost) ? this.skuList[i][Number(j) + 1].valueName : minIntergral.cashCost
});
this.$emit('changeMinIntegral', minIntergral);
}
}
if (this.skuList[i].length - j == 5) {
if (Number(this.skuList[i][Number(j) - 1].valueName) <= Number(minIntergral.integralCost) && Number(this.skuList[i][j].valueName) <= Number(minIntergral.cashCost)) {
minIntergral = Object.assign({}, minIntergral, { integralCost: this.skuList[i][Number(j) - 1].valueName, cashCost: this.skuList[i][j].valueName });
this.$emit('changeMinIntegral', minIntergral);
}
}
if (this.skuList[i].length - j == 4) { if (this.skuList[i].length - j == 4) {
if (this.skuList[i][j].valueName !== '') temSum += Number(this.skuList[i][j].valueName); if (this.skuList[i][j].valueName !== '') temSum += Number(this.skuList[i][j].valueName);
} }
...@@ -583,6 +617,7 @@ export default { ...@@ -583,6 +617,7 @@ export default {
this.addStock(); this.addStock();
}, },
skuInput(item1, item2, index1, index2) { skuInput(item1, item2, index1, index2) {
console.log(1);
let reg = /^[0-9a-zA-Z]+?$/; let reg = /^[0-9a-zA-Z]+?$/;
if (item1.length - index2 === 6) { if (item1.length - index2 === 6) {
//积分 //积分
......
...@@ -9,10 +9,10 @@ ...@@ -9,10 +9,10 @@
<el-breadcrumb-item>积分商城</el-breadcrumb-item> <el-breadcrumb-item>积分商城</el-breadcrumb-item>
<el-breadcrumb-item>商品</el-breadcrumb-item> <el-breadcrumb-item>商品</el-breadcrumb-item>
<el-breadcrumb-item :to="{ path: '/gift' }">礼品</el-breadcrumb-item> <el-breadcrumb-item :to="{ path: '/gift' }">礼品</el-breadcrumb-item>
<el-breadcrumb-item>{{ giftId === '-1' ? '新建' : '编辑' }}礼品</el-breadcrumb-item> <el-breadcrumb-item>{{ giftId === '-1' ? '新建' : '编辑' }}{{ giftType === 1 ? '实物' : '虚拟' }}礼品</el-breadcrumb-item>
</el-breadcrumb> </el-breadcrumb>
<h3> <h3>
<span>{{ giftId === '-1' ? '新建' : '编辑' }}礼品</span> <span>{{ giftId === '-1' ? '新建' : '编辑' }}{{ giftType === 1 ? '实物' : '虚拟' }}礼品</span>
</h3> </h3>
</div> </div>
<div class="section" v-loading="submitLoading"> <div class="section" v-loading="submitLoading">
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
<i class="el-icon-zoom-in" @click="enlargeDialogImageUrl(index)"></i> <i class="el-icon-zoom-in" @click="enlargeDialogImageUrl(index)"></i>
<div class="dialog-img"></div> <div class="dialog-img"></div>
</div> </div>
<el-upload :action="uploadAction" :headers="headersUpload" list-type="picture-card" :on-preview="handlePictureCardPreview" :before-upload="beforeUpload" :on-success="uploadSuccess" with-credentials :show-file-list="false" v-show="uploadStatus" style="display: inline-block;vertical-align: top;"> <el-upload multiple :action="uploadAction" :headers="headersUpload" list-type="picture-card" :on-preview="handlePictureCardPreview" :before-upload="beforeUpload" :on-success="uploadSuccess" with-credentials :show-file-list="false" v-show="uploadStatus" style="display: inline-block;vertical-align: top;">
<i class="el-icon-plus"></i> <i class="el-icon-plus"></i>
</el-upload> </el-upload>
</div> </div>
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
<div class="section-content"> <div class="section-content">
<h3>销售信息</h3> <h3>销售信息</h3>
<el-form-item label="礼品规格" v-if="giftType === 1 || submitSkuJson.length"> <el-form-item label="礼品规格" v-if="giftType === 1 || submitSkuJson.length">
<addSku :giftId="giftId" :skuJson="giftProStandardJson" :giftType="giftType" @getSpuStock="getSpuStock" @getStandradList="getStandradList" @getSkuList="getSkuList" @IsAgreeUpload="IsAgreeUpload" :isStdImg="isStdImg" :skuList="skuList"></addSku> <addSku :giftId="giftId" :skuJson="giftProStandardJson" :giftType="giftType" @getSpuStock="getSpuStock" @getStandradList="getStandradList" @getSkuList="getSkuList" @IsAgreeUpload="IsAgreeUpload" :isStdImg="isStdImg" :skuList="skuList" @changeMinIntegral="changeMinIntegral"></addSku>
</el-form-item> </el-form-item>
<el-form-item label="礼品编码"> <el-form-item label="礼品编码">
<table class="spu-table"> <table class="spu-table">
...@@ -80,18 +80,23 @@ ...@@ -80,18 +80,23 @@
<tbody> <tbody>
<tr> <tr>
<td style="width:120px"> <td style="width:120px">
<!-- 礼品编码 -->
<el-input size="small" v-model.trim="giftForm.proCode" placeholder="请输入内容" @input="limitProCode" @blur="limitProCodeType"></el-input> <el-input size="small" v-model.trim="giftForm.proCode" placeholder="请输入内容" @input="limitProCode" @blur="limitProCodeType"></el-input>
</td> </td>
<td style="width:120px"> <td style="width:120px">
<!-- 积分 -->
<el-input size="small" v-model.trim="giftForm.integralCost" placeholder="请输入内容" @blur="limitCostType"></el-input> <el-input size="small" v-model.trim="giftForm.integralCost" placeholder="请输入内容" @blur="limitCostType"></el-input>
</td> </td>
<td style="width:120px"> <td style="width:120px">
<!-- 现金 -->
<el-input size="small" v-model.trim="giftForm.cashCost" placeholder="请输入内容" @blur="limitCash"></el-input> <el-input size="small" v-model.trim="giftForm.cashCost" placeholder="请输入内容" @blur="limitCash"></el-input>
</td> </td>
<td style="width:120px"> <td style="width:120px">
<!-- 库存 -->
<el-input size="small" v-model.trim="giftForm.virtualStock" placeholder="请输入内容" :disabled="stockDisabled" @blur="limitStock"></el-input> <el-input size="small" v-model.trim="giftForm.virtualStock" placeholder="请输入内容" :disabled="stockDisabled" @blur="limitStock"></el-input>
</td> </td>
<td style="width:120px"> <td style="width:120px">
<!-- 礼品条形码 -->
<el-input size="small" v-model.trim="giftForm.proCodeQuery" placeholder="请输入内容" @input="limintProCodeQuery" @blur="limitproCodeQueryType"></el-input> <el-input size="small" v-model.trim="giftForm.proCodeQuery" placeholder="请输入内容" @input="limintProCodeQuery" @blur="limitproCodeQueryType"></el-input>
</td> </td>
</tr> </tr>
...@@ -448,7 +453,7 @@ export default { ...@@ -448,7 +453,7 @@ export default {
getHours: getInputVal.getHours, getHours: getInputVal.getHours,
fixedWidth: document.documentElement.clientWidth - 200, fixedWidth: document.documentElement.clientWidth - 200,
projectName: 'integral-mall', projectName: 'integral-mall',
giftType: '', //礼品类型 giftType: '', //礼品类型 实物是1虚拟是0
mallProId: '', //礼品id mallProId: '', //礼品id
giftId: '', //礼品Id giftId: '', //礼品Id
linkIndex: 0, linkIndex: 0,
...@@ -1528,12 +1533,6 @@ export default { ...@@ -1528,12 +1533,6 @@ export default {
reader.onload = function(event) { reader.onload = function(event) {
let image = new Image(); let image = new Image();
image.onload = function() { image.onload = function() {
let width = this.width;
let height = this.height;
if (width < 700 || width > 1500 || width / height != 1) {
that.$message.error('请上传正确的图片尺寸');
reject();
}
resolve(); resolve();
}; };
image.src = event.target.result; image.src = event.target.result;
...@@ -1548,6 +1547,7 @@ export default { ...@@ -1548,6 +1547,7 @@ export default {
}, },
// 上传图片成功 // 上传图片成功
uploadSuccess(response, file, fileList) { uploadSuccess(response, file, fileList) {
console.log(response);
if (response.errorCode === 0) { if (response.errorCode === 0) {
this.giftForm.images.push({ this.giftForm.images.push({
imageUrl: response.result[0].qcloudImageUrl, imageUrl: response.result[0].qcloudImageUrl,
...@@ -1788,6 +1788,10 @@ export default { ...@@ -1788,6 +1788,10 @@ export default {
this.isStdImg = val; this.isStdImg = val;
this.IsAgreeUploadStatus = val; this.IsAgreeUploadStatus = val;
}, },
changeMinIntegral(val) {
this.giftForm.integralCost=val.integralCost||'';
this.giftForm.cashCost=val.cashCost||'';
},
//处理sku //处理sku
handleSku() { handleSku() {
let skuArr = copy(this.skuList); let skuArr = copy(this.skuList);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment