Commit dcf5a11e by crushh

Merge branch 'feature/hl-2月迭代' into dev

parents fab39824 ac15f071
......@@ -100,10 +100,10 @@ export default {
return year + '-' + month + '-' + date + ' ' + hour + ':' + minute + ':' + second;
},
uploadAction: function() {
let url = window.location.origin + '/api-plug/upload-img?requestProject=integral-mall';
uploadAction: function(src='/api-plug/upload-img?requestProject=integral-mall') {
let url = window.location.origin + src;
if (window.location.origin.indexOf('localhost') != -1) {
url = 'http://gicdev.demogic.com/api-plug/upload-img?requestProject=integral-mall';
url = `http://gicdev.demogic.com${src}`;
}
return url;
},
......
......@@ -332,11 +332,9 @@
<div>
<el-button
type="text"
@click="getLink(scope.row)"
v-if="scope.row.canEdit && $getButtonLimit($buttonCode.couponPromote)"
:limit-code="$buttonCode.couponPromote"
@click="goAdd(scope.row,'couponCopy')"
>
推广
复制
</el-button>
<el-button
type="text"
......@@ -362,12 +360,6 @@
>
上架
</el-button>
<!-- <el-button
type="text"
@click="goAdd(scope.row,'couponCopy')"
>
复制
</el-button> -->
<el-button
type="text"
@click="goAdd(scope.row,'couponEdit')"
......@@ -377,13 +369,16 @@
编辑
</el-button>
<el-dropdown
v-if="(scope.row.isDifferentialPricing || scope.row.canEdit)&& ($getButtonLimit($buttonCode.couponTieredPricing)|| $getButtonLimit($buttonCode.couponDelete) || $getButtonLimit($buttonCode.couponDetail) || $getButtonLimit($buttonCode.couponConversion))"
v-if="(scope.row.isDifferentialPricing || scope.row.canEdit)&& ($getButtonLimit($buttonCode.couponTieredPricing)||$getButtonLimit($buttonCode.couponPromote)|| $getButtonLimit($buttonCode.couponDelete) || $getButtonLimit($buttonCode.couponDetail) || $getButtonLimit($buttonCode.couponConversion))"
style="margin-left:20px;"
@command="command => handleCommand(command, scope.row, scope.$index)"
placement="bottom-start"
>
<span class="el-dropdown-link" style="color:#1890ff;cursor: pointer;"> <i class="el-icon-more" /> </span>
<el-dropdown-menu slot="dropdown" style="width:110px;">
<el-dropdown-item command="5" v-if="$getButtonLimit($buttonCode.couponPromote)" :limit-code="$buttonCode.couponPromote">
推广
</el-dropdown-item>
<el-dropdown-item command="0" v-if="$getButtonLimit($buttonCode.couponDetail)" :limit-code="$buttonCode.couponDetail">
查看详情
</el-dropdown-item>
......@@ -396,6 +391,9 @@
<el-dropdown-item command="3" v-if="scope.row.canEdit && $getButtonLimit($buttonCode.couponDelete)" :limit-code="$buttonCode.couponDelete">
删除
</el-dropdown-item>
<el-dropdown-item command="3" v-if="scope.row.canEdit && $getButtonLimit($buttonCode.couponDelete)" :limit-code="$buttonCode.couponDelete">
删除
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<!-- <el-popover placement="top" width="160" v-model="scope.row.visible2" style="margin-left:8px">
......@@ -676,6 +674,8 @@ export default {
.catch(() => {
});
} else if (command == 5) {
this.getLink(item);
}
},
// 跳转到兑换记录
......
......@@ -29,7 +29,7 @@
>
<div class="section-content">
<h3>选择卡券</h3>
<el-form-item label="选择卡券" required v-show="mallProId === '-1'">
<el-form-item label="选择卡券" required v-show="mallProId === '-1'||isCopy">
<el-button plain @click="showCard" :disabled="cardList.length >= addCardMax">
添加卡券
</el-button>
......@@ -91,13 +91,16 @@
</template>
</el-table-column>
<el-table-column label="库存" prop="couponStock" />
<el-table-column label="操作" v-show="mallProId === '-1'">
<el-table-column label="操作">
<template slot-scope="scope">
<dm-delete @confirm="deleteCard(scope.$index)" tips="确定删除该卡券吗?">
<dm-delete @confirm="deleteCard(scope.$index)" tips="确定删除该卡券吗?" v-if="mallProId === '-1' || isCopy">
<el-button type="text">
删除
</el-button>
</dm-delete>
<el-button type="text" v-else :disabled="true">
删除
</el-button>
</template>
</el-table-column>
<el-table-column label="卡券状态" v-if="mallProId !== '-1'">
......@@ -502,6 +505,7 @@
:cardLimit="cardLimit"
:cardType="cardType"
@selectCard="selectCard"
tableColumnType="checkbox"
ref="dmcard"
/>
</div>
......@@ -564,8 +568,7 @@ export default {
// 可传参数
projectName: 'integral-mall', // 当前项目名
showCardDialog: false,
// cardLimit: 3, //卡券限制类型 1-限制领取1张的卡券 2- 限制领取 1~100的卡券 3-限制领取&=100 的卡券
cardLimit: -1, // 卡券限制类型 1-限制领取1张的卡券 2- 限制领取 1~100的卡券 3-限制领取&=100 的卡券
cardLimit: -1, // 卡券限制类型 1-限制领取1张的卡券 2- 限制领取 1~100的卡券 3-限制领取>=100 的卡券
cardType: null, // 卡券类型集合(0:抵金券,1:折扣券,2:兑换券)null-为全部类型 逗号分隔
disabledList: [],
selectedData: {},
......@@ -660,6 +663,7 @@ export default {
},
uuid: '',
}, // 可见配置的数据源
isCopy: this.$route.meta.type == 'copy',
isNew: true, // 编辑旧商品时,是否确认转换为新数据格式
};
},
......@@ -1018,6 +1022,11 @@ export default {
} else if (useNewStoreWidget == 1) { // 使用卡券门店选择器
this.visibleData.uuid = storeWidgetId;
}
if (this.isCopy) { // 老数据复制时 使用上架规则那套新模式
this.isNew = true;
this.visibleData.uuid = '';
this.visibleData.useNewStoreWidget = 1;
}
console.log(this.visibleData);
this.visibleData = Object.assign({}, this.visibleData);
},
......@@ -1077,51 +1086,55 @@ export default {
this.showCardDialog = true;
},
// 子组件触发方法
selectCard (val) {
async selectCard (arr) {
console.log(arr);
if (arr.length + this.cardList.length > 15) {
this.$message.error(`最多支持添加15张卡券,目前一共选择${arr.length + this.cardList.length}张卡券`);
return;
}
this.showCardDialog = false;
// this.cardList = [];
if (val) {
if (arr.length) {
// 重复卡券去掉
if (
!this.cardList.find(row => {
return row.coupCardId === val.coupCardId;
})
) {
this.cardList.push(val);
this.cardCouponList.push({
proRefId: val.coupCardId,
proRefName: val.cardName,
integralCost: undefined,
cashCost: undefined,
});
this.limitTimesNumArr.push(val.cardLimit);
this.couponCardStockArr.push(val.couponStock);
} else {
this.$message.error('重复的卡券不允许');
return;
}
// this.limitTimes = val.cardLimit;
this.limitTimes = Math.min.apply(null, this.limitTimesNumArr);
this.limitTimesNum = Math.min.apply(null, this.limitTimesNumArr);
this.couponCardStock = Math.min.apply(null, this.couponCardStockArr);
this.couponForm.limitTimesStatus = true;
arr.forEach((val) => {
if (
!this.cardList.find(row => {
return row.coupCardId === val.coupCardId;
})
) {
this.cardList.push(val);
this.cardCouponList.push({
proRefId: val.coupCardId,
proRefName: val.cardName,
integralCost: undefined,
cashCost: undefined,
});
this.limitTimesNumArr.push(val.cardLimit);
this.couponCardStockArr.push(val.couponStock);
this.limitTimes = Math.min.apply(null, this.limitTimesNumArr);
this.limitTimesNum = Math.min.apply(null, this.limitTimesNumArr);
this.couponCardStock = Math.min.apply(null, this.couponCardStockArr);
this.couponForm.limitTimesStatus = true;
}
});
const params = {
coupCardId: val.coupCardId,
coupCardId: this.cardList.map(item => item.coupCardId).join(','),
proType: 1,
};
request.post('/api-integral-mall/get-integral-mall-CashCost', qs.stringify(params)).then(res => {
if (res.data.errorCode === 0) {
this.costValueArr.push(res.data.result.costValue);
// 计算数组的总和
const res = await request.post('/api-integral-mall/get-integral-mall-CashCost', qs.stringify(params));
if (res.data.errorCode === 0) {
if (res.data.result.costValue) {
const arr = res.data.result.costValue.split(',');
arr.forEach(item => {
this.costValueArr.push(Number(item));
});
const sum = this.costValueArr.reduce(function (prev, cur, index, array) {
return prev + cur;
});
this.costValue = sum;
} else {
this.$message.error(res.data.message);
}
});
} else {
this.$message.error(res.data.message);
}
}
},
deleteCard (index) {
......@@ -1332,7 +1345,7 @@ export default {
if (valid) {
let params = {
proName: this.cardList.length > 1 ? this.couponForm.proName : this.cardList[0].cardName,
integralMallProId: this.mallProId === '-1' ? '' : this.mallProId, // 礼品id
integralMallProId: this.isCopy ? '' : (this.mallProId === '-1' ? '' : this.mallProId), // 礼品id
proType: 1, // 优惠券
proReferId: proReferIdArr.join(','), // 卡券id
dataDialogueId: this.couponForm.dataDialogueId, // 数据对话id
......@@ -1399,11 +1412,11 @@ export default {
this.$router.push({
name: 'coupon',
});
this.submitLoading = false;
} else {
this.$message.error(res.data.message);
this.submitLoading = false;
}
}).finally(() => {
this.submitLoading = false;
});
},
goBack () {
......
......@@ -698,7 +698,7 @@
<el-button type="primary" @click="goDeliverSet">确 定</el-button>
</span>
</el-dialog>
<importCoupon :importCouponModal="importCouponModal" @getSuceessNum="getSuceessNum" />
<importCoupon :couponModal="importCouponModal" @getSuceessNum="getSuceessNum" />
</div>
</template>
......@@ -923,27 +923,32 @@ export default {
this.giftType = Number(this.$route.query.type); // 列表上实物是1虚拟是0
this.giftId = this.$route.query.giftId;
this.mallProId = this.$route.query.giftId;
if (this.isEdit || this.isInfo) {
this.giftForm.proReferId = this.$route.query.proReferId;
this.getInfo();
this.editChangeTypeStatus = true;
} else {
this.giftForm.proReferId = '';
this.getMemberGradeList(); // 会员等级列表
this.isNew = true;
}
this.getCategoryOptions(); // 分类数据
if (this.giftType === 1) {
if (this.giftType === 1) {
// 实物
this.giftForm.changeType = 2;
this.giftForm.changeType = 2;
} else if (this.giftType === 0) {
// 虚拟
this.getGiftId();
}
}
if (this.giftId !== '-1') {
if (this.isCopy) {
this.giftForm.proReferId = this.$route.query.proReferId;
this.getInfo();
this.editChangeTypeStatus = true;
}
if ((this.giftId == '-1' || this.isCopy) && this.giftType === 0) {
this.getGiftId();
this.editChangeTypeStatus = false;
if (this.giftType === 0) {
this.getGiftId();
}
}
this.getCategoryOptions(); // 分类数据
this.$nextTick(function () {
window.addEventListener('scroll', this.onScroll, true);
});
......@@ -1140,8 +1145,8 @@ export default {
proType: 1,
};
request.post('/api-integral-mall/get-integral-mall-CashCost', qs.stringify(params)).then(res => {
if (res.data.errorCode === 0) {
this.couponCostValue = res.data.result.costValue;
if (res.data.errorCode === 0 && res.data.result.costValue) {
this.couponCostValue = Number(res.data.result.costValue);
} else {
this.$message.error(res.data.message);
}
......@@ -1239,10 +1244,9 @@ export default {
this.giftForm.cashCost = data.cashCost; // 现金
this.giftForm.virtualStock = data.virtualStock; // 库存
this.currentStock = data.virtualStock;
if (this.isCopy) {
console.log('copy回显');
this.giftForm.virtualStock = ''; // 库存
this.currentStock = 0;
if (this.isCopy && data.giftType == 0 && data.changeType == 5) {
this.giftForm.virtualStock = ''; // 清空虚拟礼品库存
this.currentStock = '';
}
this.giftForm.proCodeQuery = data.proCodeQuery; // 条形码
this.giftForm.costValue = data.costValue; // 礼品成本
......@@ -1254,6 +1258,15 @@ export default {
this.isDifferentialPricing = this.giftForm.ladder[0];
}
if (this.isDifferentialPricing && data.gradeProSkus && data.gradeProSkus.length > 0) {
if (this.isCopy) { // 复制时重置阶梯价 giftProSkuId
data.gradeProSkus.forEach(item => {
if (item.skuList && item.skuList.length) {
item.skuList.forEach(it => {
it.giftProSkuId = '';
});
}
});
}
this.list3 = data.gradeProSkus; // 阶梯价详情
this.submitLadderList = data.gradeProSkus;
} else {
......@@ -1391,6 +1404,11 @@ export default {
}
}
if (data.skuJsonList) {
if (this.isCopy) { // 复制时重置规格 giftProSkuId
data.skuJsonList.forEach(item => {
item.giftProSkuId = '';
});
}
this.submitSkuJson = data.skuJsonList;
} else {
this.submitSkuJson = [];
......@@ -1434,8 +1452,6 @@ export default {
});
this.skuList.push(tem);
}
console.log('list', this.skuList);
this.handleSku();
}
if (data.giftType === 1) {
......@@ -1471,6 +1487,7 @@ export default {
}
}
}
console.log(this.giftForm.virtualStock);
}
}).finally(() => {
this.submitLoading = false;
......@@ -1494,9 +1511,6 @@ export default {
} else {
this.isNew = false;
}
if (this.isCopy) {
this.isNew = true;
}
if (useNewStoreWidget == 0) { // 使用老的门店控件 (兼容老数据)
const type = Number(showStore);
this.visibleData.sendChildData.storeType = type; // :0所有 1门店分组 2部分门店
......@@ -1509,6 +1523,11 @@ export default {
} else if (useNewStoreWidget == 1) { // 使用卡券门店选择器
this.visibleData.uuid = storeWidgetId;
}
if (this.isCopy) { // 老数据复制时 使用上架规则那套新模式
this.isNew = true;
this.visibleData.uuid = '';
this.visibleData.useNewStoreWidget = 1;
}
console.log(this.visibleData);
this.visibleData = Object.assign({}, this.visibleData);
},
......@@ -1663,7 +1682,6 @@ export default {
} else {
this.memberGradeList = [];
}
console.log(this.memberGradeList);
} else {
this.$message.error(res.data.message);
}
......@@ -1928,8 +1946,6 @@ export default {
return false;
}
this.skuList = val;
// console.log('skuList', this.skuList);
// return;
this.handleSku();
if (this.isDifferentialPricing) {
......@@ -2250,7 +2266,6 @@ export default {
virtualStock: this.isEdit ? this.giftForm.virtualStock - (this.currentStock || 0) : this.giftForm.virtualStock, //库存
timeZones: '', //部分时段
changeType: this.giftType === 0 ? String(this.giftForm.changeType) : this.giftForm.changeTypeList.join(','), //配送方式
// pickUpPoint:this.giftForm.pickUpPointType ===2?this.giftForm.pickUpPoint.join(','):'-1',//门店自提
refundType: this.giftForm.refundType, //售后
giftProStandardJson: this.giftProStandardJson ? JSON.stringify(this.giftProStandardJson) : '', //规格列表
skuJson: this.submitSkuJson.length ? JSON.stringify(this.submitSkuJson) : '', //sku数据
......@@ -2295,7 +2310,6 @@ export default {
}).then(() => {
this.submitLoading = true;
this.saveDeatail(params);
console.log('保存');
});
},
saveDeatail(params) {
......
......@@ -54,16 +54,19 @@
<script>
import errorList from '../../order/errorList';
import getInputVal from '@/utils/common.js';
export default {
props: {
importCouponModal: {
couponModal: {
type: Object,
default () {
return {};
},
},
},
data () {
return {
action: window.location.origin + '/api-integral-mall/upload-gift-card?requestProject=intergral-mall',
// action: 'http://gicdev.demogic.com/api-integral-mall/upload-gift-card?requestProject=intergral-mall',
action: getInputVal.uploadAction('/api-integral-mall/upload-gift-card?requestProject=intergral-mall'),
headersUpload: {
sign: '',
},
......@@ -81,8 +84,17 @@ export default {
list: [],
},
importMess: false,
importCouponModal: {},
};
},
watch: {
couponModal: {
handler (val) {
this.importCouponModal = val;
},
immediate: true,
},
},
methods: {
// 下载模板
downloadFile () {
......
......@@ -1661,7 +1661,6 @@ export default {
} else {
this.submitSkuJson = [];
}
// 获取头部
this.skuHeaderList = [];
......
......@@ -28,7 +28,7 @@
>
<el-form-item label="上架规则名称" prop="ruleTitle">
<el-input
maxlength="12"
maxlength="30"
show-word-limit
placeholder="请输入上架规则名称"
v-model="ruleForm.ruleTitle"
......@@ -39,7 +39,7 @@
</el-form-item>
<el-form-item label="上架规则名称备注" prop="ruleExplanation">
<el-input
maxlength="30"
maxlength="50"
show-word-limit
placeholder="请输入上架规则说明"
v-model="ruleForm.ruleExplanation"
......
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