Commit ec4dbd01 by chenyu

Merge branch 'feature/10月迭代' of http://git.gicdev.com/integralMall/integral-mall

parents 33ccd922 8d484b2c
......@@ -24,6 +24,7 @@
"vue": "2.6.6",
"vue-axios": "^2.1.1",
"vue-clipboard2": "^0.2.1",
"vuedraggable": "^2.24.3",
"vuex": "^3.0.1"
},
"devDependencies": {
......
<template>
<el-dialog title="新建分类" :visible.sync="addCateModal.dialogVisible" width="450px" @close="cancelSubmit('editInfoModal')">
<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>
<span class="slot-num">{{ goodsInfo.cateNameLen }}/10</span>
</el-form-item>
<span class="slot-num">{{ goodsInfo.cateNameLen }}/10</span>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancelSubmit('editInfoModal')">取 消</el-button>
......@@ -57,6 +57,7 @@ export default {
request.post('/api-integral-mall/create-gift-category', qs.stringify(params)).then(res => {
if (res.data.errorCode === 0) {
this.$message.success('新增成功');
this.goodsInfo.cateNameLen = 0;
this.addCateModal.dialogVisible = false;
this.$emit('getCategoryOptions');
} else {
......@@ -77,9 +78,14 @@ export default {
};
</script>
<style scoped>
.position-item {
position: relative;
}
.slot-num {
float: right;
margin-top: -20px;
position: absolute;
bottom: 0;
right: 8px;
font-size: 13px;
color: #c0c4cc;
}
</style>
......@@ -200,6 +200,9 @@ export default {
}
}
}
if (this.intergralModal.type === 'cash') {
this.addStock();
}
//积分
},
confirmStockModal() {
......@@ -208,6 +211,7 @@ export default {
let intergral = []; //积分
let stock = []; //库存
if (this.intergralModal.tableSkuData.length) {
console.log(this.intergralModal.tableSkuData);
for (let j in this.intergralModal.tableSkuData) {
let index = this.intergralModal.tableSkuData[0].length - 1;
let index1 = this.intergralModal.tableSkuData[0].length - 2;
......@@ -315,6 +319,34 @@ export default {
},
cancelStockModal() {
this.intergralModal.dialogVisible = false;
},
addStock() {
let minIntergral = { integralCost: '', cashCost: '' };
console.log(this.intergralModal.tableSkuData);
for (let i in this.intergralModal.tableSkuData) {
for (let j in this.intergralModal.tableSkuData[i]) {
// 积分
if (this.intergralModal.tableSkuData[i].length - j == 2) {
// console.log(minIntergral);
if (minIntergral.integralCost === '' || Number(this.intergralModal.tableSkuData[i][j].valueName) < Number(minIntergral.integralCost)) {
// console.log('1-1');
minIntergral = Object.assign({}, minIntergral, {
integralCost: this.intergralModal.tableSkuData[i][j].valueName,
cashCost: this.intergralModal.tableSkuData[i][Number(j) + 1].valueName || '0'
});
}
if (Number(this.intergralModal.tableSkuData[i][j].valueName) == Number(minIntergral.integralCost)) {
// console.log('1-2');
minIntergral = Object.assign({}, minIntergral, {
integralCost: this.intergralModal.tableSkuData[i][j].valueName,
cashCost: this.intergralModal.tableSkuData[i][Number(j) + 1].valueName >= 0 ? (minIntergral.cashCost > this.intergralModal.tableSkuData[i][Number(j) + 1].valueName ? this.intergralModal.tableSkuData[i][Number(j) + 1].valueName : minIntergral.cashCost) : '0'
});
}
}
this.giftProSkuIntegral = minIntergral.integralCost;
this.giftProSkuCash = minIntergral.cashCost;
}
}
}
}
};
......
......@@ -18,8 +18,8 @@
<div class="section-content">
<h3>选择卡券</h3>
<el-form-item label="选择卡券" required v-show="mallProId === '-1'">
<el-button plain @click="showCard" :disabled="cardList.length >= 10">添加卡券</el-button>
<span style="font-size: 12px;color: rgb(144, 147, 153);margin-left:10px;">支持选择兑换券</span>
<el-button plain @click="showCard" :disabled="cardList.length >= addCardMax">添加卡券</el-button>
<span style="font-size: 12px;color: rgb(144, 147, 153);margin-left:10px;">支持选择兑换券,最多支持添加{{ addCardMax }}张卡券</span>
</el-form-item>
<div class="alert-content" v-if="couponStatus">
<el-alert title="原卡券已被删除,请及时下线卡券,否则用户将无法兑换" type="warning"> </el-alert>
......@@ -344,6 +344,7 @@ export default {
}
};
return {
addCardMax: 15, // 添加卡券的上限数量
ladder: [],
isDifferentialPricing: '',
ladderPriceList: [],
......@@ -934,6 +935,7 @@ export default {
},
// 显示卡券弹窗
showCard() {
if (this.cardList.length >= this.addCardMax) return;
this.showCardDialog = true;
},
// 子组件触发方法
......
......@@ -76,17 +76,19 @@
</thead>
<tbody>
<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">
<!-- {{ item1[7] }} -->
<span v-if="item1.length - index2 < 7">
<el-input size="small" v-model.trim="item2.valueName" @blur="skuInput(item1, item2, index1, index2)" @input="setSkuValueName"></el-input>
</span>
<template v-for="(item2, index2) in item1">
<td :key="index2" style="width:120px" v-if="item1.length - index2 > 1">
<!-- {{ item1[7] }} -->
<span v-if="item1.length - index2 < 7">
<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>{{ item2.valueName ? item2.valueName : '' }}</span>
</td>
<!-- 最后一列存的skuId -->
<td v-else style="color:red;display:none">{{ item2.valueName }}</td>
<!-- <span v-else-if="item1.length === index2 + 1" style="color:red">{{ item2.valueName ? item2.valueName : '' }}</span> -->
<span v-else>{{ item2.valueName ? item2.valueName : '' }}</span>
</td>
<!-- 最后一列存的skuId -->
<td v-else :key="index2" style="color:red;display:none">{{ item2.valueName }}</td>
</template>
</tr>
</tbody>
</table>
......@@ -142,7 +144,11 @@ export default {
searchStandard: '',
searchStandardValue: '',
// isStdImg: false
warnStatus: false
warnStatus: false,
minIntergral: {
integralCost: '',
cashCost: ''
}
};
},
created() {
......@@ -547,10 +553,41 @@ export default {
},
//sku库存相加得spu库存
addStock() {
console.log(1);
let temSum = 0;
let minIntergral = { integralCost: '', cashCost: '' };
for (let i in this.skuList) {
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 || '0' });
this.$emit('changeMinIntegral', minIntergral);
}
}
if (this.skuList[i].length - j == 4) {
if (this.skuList[i][j].valueName !== '') temSum += Number(this.skuList[i][j].valueName);
}
......
......@@ -9,10 +9,10 @@
<el-breadcrumb-item>积分商城</el-breadcrumb-item>
<el-breadcrumb-item>商品</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>
<h3>
<span>{{ giftId === '-1' ? '新建' : '编辑' }}礼品</span>
<span>{{ giftId === '-1' ? '新建' : '编辑' }}{{ giftType === 1 ? '实物' : '虚拟' }}礼品</span>
</h3>
</div>
<div class="section" v-loading="submitLoading">
......@@ -26,20 +26,22 @@
</el-form-item>
<el-form-item label="礼品主图" required>
<div class="upload-list-box">
<div style="display: inline-block;vertical-align: top;margin-right:5px;height:104px;">
<div v-for="(item, index) in giftForm.images" :key="index" class="img-box">
<img width="100%" :src="item.imageUrl" alt />
<i class="el-icon-arrow-left" @click="moveLeft(index)" v-show="index !== 0"></i>
<i class="el-icon-arrow-right" @click="moveRight(index)" v-show="index + 1 !== giftForm.images.length"></i>
<i class="el-icon-delete" @click="deteletDialogImageUrl(index)"></i>
<i class="el-icon-zoom-in" @click="enlargeDialogImageUrl(index)"></i>
<div class="dialog-img"></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;">
<div class="drag-box-wrap">
<draggable :list="giftForm.images" class="list-group" ghost-class="ghost" @start="dragging = true" @end="dragging = false">
<div v-for="(item, index) in giftForm.images" :key="index" class="img-box">
<img width="100%" :src="item.imageUrl" alt />
<!-- <i class="el-icon-arrow-left" @click="moveLeft(index)" v-show="index !== 0"></i>
<i class="el-icon-arrow-right" @click="moveRight(index)" v-show="index + 1 !== giftForm.images.length"></i> -->
<i class="el-icon-delete" @click="deteletDialogImageUrl(index)"></i>
<i class="el-icon-zoom-in" @click="enlargeDialogImageUrl(index)"></i>
<div class="dialog-img"></div>
</div>
</draggable>
<el-upload ref="giftFormUpload" :limit="5" :on-remove="handleRemove" multiple :file-list="giftFormFileList" :action="uploadAction" :headers="headersUpload" list-type="picture-card" :on-preview="handlePictureCardPreview" :on-exceed="handlePictrueExceed" :before-upload="beforeUpload" :on-success="uploadSuccess" with-credentials :show-file-list="false" v-show="uploadStatus">
<i class="el-icon-plus"></i>
</el-upload>
</div>
<p style="font-size: 12px; color: rgb(144, 147, 153);line-height:18px;margin-top:10px;">图片宽度≥700px,≤1500px,图片宽高比1:1,单张图片大小不超过 2 MB,至少上传1张,最多可上传 5 张。</p>
<p style="font-size: 12px; color: rgb(144, 147, 153);line-height:18px;margin-top:10px;">图片建议尺寸 800*800px,格式 jpg/png/gif,大小 1M 以内,你可以拖拽图片调整顺序,最多上传 5 张。</p>
<el-dialog :visible.sync="dialogVisibleImg">
<img width="100%" :src="dialogEnlargeImageUrl" alt />
</el-dialog>
......@@ -64,7 +66,7 @@
<div class="section-content">
<h3>销售信息</h3>
<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 label="礼品编码">
<table class="spu-table">
......@@ -80,18 +82,23 @@
<tbody>
<tr>
<td style="width:120px">
<!-- 礼品编码 -->
<el-input size="small" v-model.trim="giftForm.proCode" placeholder="请输入内容" @input="limitProCode" @blur="limitProCodeType"></el-input>
</td>
<td style="width:120px">
<!-- 积分 -->
<el-input size="small" v-model.trim="giftForm.integralCost" placeholder="请输入内容" @blur="limitCostType"></el-input>
</td>
<td style="width:120px">
<!-- 现金 -->
<el-input size="small" v-model.trim="giftForm.cashCost" placeholder="请输入内容" @blur="limitCash"></el-input>
</td>
<td style="width:120px">
<!-- 库存 -->
<el-input size="small" v-model.trim="giftForm.virtualStock" placeholder="请输入内容" :disabled="stockDisabled" @blur="limitStock"></el-input>
</td>
<td style="width:120px">
<!-- 礼品条形码 -->
<el-input size="small" v-model.trim="giftForm.proCodeQuery" placeholder="请输入内容" @input="limintProCodeQuery" @blur="limitproCodeQueryType"></el-input>
</td>
</tr>
......@@ -409,6 +416,7 @@ import addSku from './addSku';
import Treeselect from '@riophae/vue-treeselect';
import '@riophae/vue-treeselect/dist/vue-treeselect.css';
import pickUpStore from '../../../components/store/store';
import draggable from 'vuedraggable';
export default {
data() {
const validateTime = (rule, value, callback) => {
......@@ -450,7 +458,7 @@ export default {
getHours: getInputVal.getHours,
fixedWidth: document.documentElement.clientWidth - 200,
projectName: 'integral-mall',
giftType: '', //礼品类型
giftType: '', //礼品类型 实物是1虚拟是0
mallProId: '', //礼品id
giftId: '', //礼品Id
linkIndex: 0,
......@@ -514,8 +522,8 @@ export default {
refundType: [{ required: true, message: '请选择售后方式', trigger: 'change' }]
},
refundTypeStatus: false,
uploadAction: window.location.origin + '/api-plug/upload-img?requestProject=integral-mall',
// uploadAction: 'http://gicdev.demogic.com/api-plug/upload-img?requestProject=integral-mall',
// uploadAction: window.location.origin + '/api-plug/upload-img?requestProject=integral-mall',
uploadAction: 'http://gicdev.demogic.com/api-plug/upload-img?requestProject=integral-mall',
headersUpload: {
sign: ''
},
......@@ -600,7 +608,9 @@ export default {
isEdit: false,
isCorrect: true, // 校验阶梯价的验证是否可以保存阶梯价
enterpriseId: '', // 商户id
specialOrder: false // 是否定制
specialOrder: false, // 是否定制
dragging: false,
giftFormFileList: []
};
},
// watch: {
......@@ -1088,16 +1098,19 @@ export default {
this.giftForm.proReferId = res.data.result.proReferId;
this.creatorId = res.data.result.creatorId;
this.refash = !this.refash;
let giftFormFileList = [];
this.giftForm.images = [];
if (res.data.result.images) {
//主图
for (let item of res.data.result.images) {
this.giftForm.images.push({
giftFormFileList.push({
imageUrl: item.imageUrl,
imageCode: item.imageFieldCode
});
}
}
this.giftForm.images = [].concat(giftFormFileList);
this.giftFormFileList = [].concat(giftFormFileList);
if (this.giftForm.images.length >= 5) {
this.uploadStatus = false;
} else {
......@@ -1500,7 +1513,13 @@ export default {
storeIds: val.storeIds || []
};
},
// 图片上传
// 图片上传超出数量限制
handlePictrueExceed(files, fileList) {
if (5 - this.giftForm.images.length - files.length < 0) {
this.$message.warning('最多上传5张商品主图');
this.$refs['giftFormUpload'].abort();
}
},
// 上传图片前
beforeUpload(file) {
if (this.giftForm.images === null) {
......@@ -1510,8 +1529,8 @@ export default {
this.$message.warning('最多上传5张商品主图');
return false;
}
if (file.size > 2 * 1024 * 1024) {
this.$message.error('请上传小于2MB的图片');
if (file.size > 1024 * 1024) {
this.$message.error('请上传小于1MB的图片');
return false;
}
/*eslint-disable*/
......@@ -1530,12 +1549,6 @@ export default {
reader.onload = function(event) {
let image = new Image();
image.onload = function() {
let width = this.width;
let height = this.height;
if (width < 700 || width > 1500 || width / height != 1) {
that.$message.error('请上传正确的图片尺寸');
reject();
}
resolve();
};
image.src = event.target.result;
......@@ -1556,7 +1569,7 @@ export default {
imageCode: response.result[0].imageFiledCode
});
this.$message.success('上传成功');
if (this.giftForm.images.length === 5) {
if (this.giftForm.images.length >= 5) {
this.uploadStatus = false;
} else {
this.uploadStatus = true;
......@@ -1569,20 +1582,16 @@ export default {
deteletDialogImageUrl(index) {
this.uploadStatus = true;
this.giftForm.images.splice(index, 1);
this.$refs['giftFormUpload'].handleRemove()
},
handleRemove(file, fileList) {
this.giftFormFileList=[].concat(fileList)
},
// 放大
enlargeDialogImageUrl(index) {
this.dialogEnlargeImageUrl = this.giftForm.images[index].imageUrl;
this.dialogVisibleImg = true;
},
// 左移一位
moveLeft(index) {
this.swapArray(this.giftForm.images, index, index - 1);
},
//右移一位
moveRight(index) {
this.swapArray(this.giftForm.images, index, index + 1);
},
//两个数据条换位置
swapArray(arr, index1, index2) {
arr[index1] = arr.splice(index2, 1, arr[index1])[0];
......@@ -1790,6 +1799,10 @@ export default {
this.isStdImg = val;
this.IsAgreeUploadStatus = val;
},
changeMinIntegral(val) {
this.giftForm.integralCost=val.integralCost||'';
this.giftForm.cashCost=val.cashCost||'';
},
//处理sku
handleSku() {
let skuArr = copy(this.skuList);
......@@ -2301,7 +2314,8 @@ export default {
tinymceEdit,
addSku,
importCoupon,
pickUpStore
pickUpStore,
draggable
}
};
</script>
......@@ -2380,6 +2394,10 @@ export default {
color: #fff;
z-index: 2;
}
.drag-box-wrap{
display: flex;
text-align: center;
}
.el-icon-zoom-in {
position: absolute;
left: 30px;
......
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