Commit f99afae7 by wuwx

优惠券精确到时分秒,新建商品添加业务类型,新建商品关联优惠券

1 parent 550ea9b2
......@@ -97,4 +97,14 @@ const getGoodsCommentListApi = params => {
})
}
export default { getListApi, getProShareApi, topProApi, updateStatusProApi, deleteTakeProApi, getProInfoApi, insertOrUpdateProApi, updateTakeProApi, getGoodsCommentListApi }
\ No newline at end of file
const getBusinessTypeByIdApi = params => {
params.method = 'scrm.api.shopmall.goods.getBusinessTypeById'
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
data: params,
sign: true
})
}
export default {getBusinessTypeByIdApi, getListApi, getProShareApi, topProApi, updateStatusProApi, deleteTakeProApi, getProInfoApi, insertOrUpdateProApi, updateTakeProApi, getGoodsCommentListApi }
\ No newline at end of file
......@@ -18,9 +18,9 @@ module.exports = {
code_message_map: {}
},
request: {
baseURL: 'http://scrm.test.glsx.com.cn/',
// baseURL: 'http://scrm.test.glsx.com.cn/',
// baseURL: 'http://192.168.2.42:8064/',
// baseURL: 'http://scrm.dev.glsx.com.cn/',
baseURL: 'http://scrm.dev.glsx.com.cn/',
// 设置超时时间
timeout: 180000,
// 携带凭证
......
......@@ -21,9 +21,9 @@ export async function bootstrap({ history, common, messenger, globalState, route
Vue.prototype.$common = common
Vue.prototype.$message = message
Vue.prototype.$messageBox = messageBox
Vue.prototype.$http = new common.Http({ response, request, sign, secret, alert: message.error, headers: { token: globalState.session.token } })
Vue.prototype.$http2 = new common.Http({ response, request: request2, sign, secret, alert: message.error, headers: { token: globalState.session.token } })
Vue.prototype.$http_common = new common.Http({ response, signWay: "md5", request: request_common, sign: sign_common, secret, alert: ElementUI.Message.error, headers: { TGT: globalState.session.token } })
Vue.prototype.$http = new common.Http({ response, request, sign, secret, alert: message.error, headers: { token: 'scrm-base-dc073d36-45f8-48f4-ab10-dde84cacfed4-rop' } })
Vue.prototype.$http2 = new common.Http({ response, request: request2, sign, secret, alert: message.error, headers: { token: 'scrm-base-dc073d36-45f8-48f4-ab10-dde84cacfed4-rop' } })
Vue.prototype.$http_common = new common.Http({ response, signWay: "md5", request: request_common, sign: sign_common, secret, alert: ElementUI.Message.error, headers: { TGT: 'scrm-base-dc073d36-45f8-48f4-ab10-dde84cacfed4-rop' } })
// Vue.prototype.$setGlobalState = globalState.actions.setGlobalState
// Vue.use(GLButton, { permissions: globalState.permissions || ['1-1-1-1', '2-1-1-1', '3-1-1-1'] })
const routesData = common.utils.deepClone(globalState.routers)
......
......@@ -34,15 +34,16 @@
<el-radio v-model="editForm.useChannel" label="2" :disabled="apear != 'couponAdd'">到店核销</el-radio>
</template>
<template slot="directionalFlagHtml">
<el-radio v-model="editForm.directionalFlag" label="1" :disabled="apear != 'couponAdd'">否</el-radio>
<el-radio v-model="editForm.directionalFlag" label="2" :disabled="apear != 'couponAdd'">是</el-radio>
<el-radio v-model="editForm.directionalFlag" label="1" :disabled="apear != 'couponAdd'">所有客户可用</el-radio>
<el-radio v-model="editForm.directionalFlag" label="2" :disabled="apear != 'couponAdd'">定向礼包专用</el-radio>
<el-radio v-model="editForm.directionalFlag" label="3" :disabled="apear != 'couponAdd'">关联商品可用</el-radio>
</template>
<template slot="effectiveHtml">
<el-radio v-model="editForm.effectiveType" label="3" :disabled="apear != 'couponAdd'">无有效期</el-radio>
<br />
<el-form-item prop="effectiveTime" ref="effectiveTime" style="margin-top: 12px; display: block">
<el-radio v-model="editForm.effectiveType" label="2" :disabled="apear != 'couponAdd'">
<el-date-picker v-model="editForm.effectiveTime" type="datetimerange" style="width: 295px" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss" :picker-options="pickerOption" :default-time="defaultTime" :format="format" :disabled="editForm.effectiveType != 2 || apear != 'couponAdd'" clearable></el-date-picker>
<el-date-picker v-model="editForm.effectiveTime" type="datetimerange" style="width: 340px" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss" :picker-options="pickerOption" :default-time="defaultTime" :format="format" :disabled="editForm.effectiveType != 2 || apear != 'couponAdd'" clearable></el-date-picker>
</el-radio>
</el-form-item>
<el-form-item prop="effectiveDays" ref="effectiveDays">
......@@ -239,13 +240,6 @@ export default {
// index:4
},
{
label: '定向礼包专用',
name: 'directionalFlag',
addHtml: 'directionalFlagHtml',
isHide: false
// index:5
},
{
label: '适用商品',
name: 'goods',
addHtml: 'goodsHtml',
......@@ -273,6 +267,13 @@ export default {
// index:9
},
{
label: '使用规则',
name: 'directionalFlag',
addHtml: 'directionalFlagHtml',
isHide: false
// index:5
},
{
label: '使用说明',
name: 'useDescription',
addHtml: 'useDescriptionHtml'
......@@ -665,7 +666,7 @@ export default {
}
this.$apis.couponManage[method](params).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : '操作失败',
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
......
......@@ -52,7 +52,7 @@
<template slot="effectiveHtml">
<el-form-item prop="effectiveTime" ref="effectiveTime" style="margin-top: 12px; display: block">
<el-radio v-model="editForm.effectiveType" label="2" :disabled="apear != 'couponAdd'">
<el-date-picker v-model="editForm.effectiveTime" type="datetimerange" style="width: 295px" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss" :default-time="defaultTime" :format="format" :picker-options="pickerOption" :disabled="editForm.effectiveType != 2 || apear != 'couponAdd'" clearable></el-date-picker>
<el-date-picker v-model="editForm.effectiveTime" type="datetimerange" style="width: 340px" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss" :default-time="defaultTime" :format="format" :picker-options="pickerOption" :disabled="editForm.effectiveType != 2 || apear != 'couponAdd'" clearable></el-date-picker>
</el-radio>
</el-form-item>
<el-form-item prop="effectiveDays" ref="effectiveDays">
......
......@@ -31,7 +31,7 @@
<template slot="effectiveHtml">
<el-form-item prop="effectiveTime" ref="effectiveTime" style="margin-top: 12px; display: block">
<el-radio v-model="editForm.effectiveType" label="2" :disabled="apear != 'couponAdd'">
<el-date-picker v-model="editForm.effectiveTime" type="datetimerange" style="width: 295px" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss" :default-time="defaultTime" :format="format" :picker-options="pickerOption" :disabled="editForm.effectiveType != 2 || apear != 'couponAdd'" clearable></el-date-picker>
<el-date-picker v-model="editForm.effectiveTime" type="datetimerange" style="width: 340px" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss" :default-time="defaultTime" :format="format" :picker-options="pickerOption" :disabled="editForm.effectiveType != 2 || apear != 'couponAdd'" clearable></el-date-picker>
</el-radio>
</el-form-item>
<el-form-item prop="effectiveDays" ref="effectiveDays">
......
......@@ -105,6 +105,15 @@ export default {
optionId: 'confId',
optionLabel: 'confName',
optionsName: 'statusList'
},
{
label: '使用规则',
name: 'directionalFlag',
type: 'select',
optionList: [],
optionId: 'confId',
optionLabel: 'confName',
optionsName: 'directionalFlagList'
}
],
// 表格
......@@ -160,6 +169,14 @@ export default {
return useChannel
}
},
{
label: '使用规则',
name: 'directionalFlag',
width: '150px',
formatter: cellValue => {
return this.baseData.directionalFlagList.find(item => item.confId == cellValue.directionalFlag).confName
}
},
{
label: '优惠券状态',
name: 'status',
......@@ -190,6 +207,20 @@ export default {
// confName: '会员服务'
// }
],
directionalFlagList:[
{
confId: '1',
confName: '所有客户可用'
},
{
confId: '2',
confName: '定向礼包专用'
},
{
confId: '3',
confName: '关联商品可用'
}
],
statusList: [
{
confId: '1',
......@@ -380,7 +411,7 @@ export default {
couponName: '',
discountType: '',
status: '',
discountTypes: [2, 3, 4]
discountTypes: [2, 3, 4],
}
this.handleSearch()
},
......
......@@ -75,7 +75,7 @@ export default {
// 表格
searchForm: {
phone: '',
// isYes:''
wechatUserFlag:''
},
tableSearchForm: {},
// 搜索
......@@ -88,12 +88,12 @@ export default {
},
{
label:'是否加企微',
name:'isYes',
name:'wechatUserFlag',
type:'select',
optionList:[],
optionId: 'statusId',
optionLabel: 'statusName',
optionsName: 'isYesStatusList'
optionsName: 'wechatUserFlagList'
}
],
// 表格
......@@ -112,9 +112,9 @@ export default {
},
{
label: '是否加入企微',
prop: 'isYes',
prop: 'wechatUserFlag',
formatter: cellValue => {
return this.baseData.isYesStatusList.find(item => item.statusId == cellValue.isYes).statusName
return this.baseData.wechatUserFlagList.find(item => item.statusId == cellValue.wechatUserFlag).statusName
}
},
{
......@@ -153,9 +153,9 @@ export default {
confName: '已过期'
}
],
isYesStatusList: [
wechatUserFlagList: [
{
statusId: '0',
statusId: '2',
statusName: '是'
},
{
......@@ -288,7 +288,7 @@ export default {
handleReset() {
this.searchForm = {
phone: '',
isYes:''
wechatUserFlag:''
}
this.handleSearch()
},
......
......@@ -24,10 +24,8 @@
@handleImgDelete="handleFormImgDelete"
>
<template slot="businessType" slot-scope="scope">
<!-- {{ scope.scope }} -->
<!-- <div v-for="(item, idx) in scope.scope.optionList" :key="idx">{{item.confName}}</div> -->
<el-checkbox-group v-model="editForm.applicationType" @change="checkApplication">
<el-checkbox v-for="value in scope.scope.optionList" :key="value.confId" :label="value.confId">{{ value.confName }}</el-checkbox>
<el-checkbox-group v-model="editForm.businessType">
<el-checkbox :disabled="routeInfo.addOrEdit == 3" v-for="value in scope.scope.businessTypeList" :key="value.businessType" :label="value.businessType">{{ value.businessTypeName }}</el-checkbox>
</el-checkbox-group>
</template>
<template slot="describeBtn">
......@@ -98,6 +96,43 @@
</div>
</div>
</div>
<template slot="association">
<el-button type="text" @click="dialogTableVisible = true" v-if="routeInfo.addOrEdit !== 3">选择</el-button>
<el-dialog title="选择优惠券" v-if="dialogTableVisible" :visible.sync="dialogTableVisible">
<glsx-combi-form ref="showSearch" :formObj="searchForm" :formData="searchFormData">
<span slot="footer" class="footer-btns">
<el-button :size="size" type="primary" @click="handleSearch">查询</el-button>
</span>
</glsx-combi-form>
<GLTable ref="coupon" :hasNum="false" :getListApi="getListApi" :searchForm="associationTableSearchForm" :tableParams="associationTableParams" :pageConf="pageConf" :beforeSearchFn="associationBeforeSearchFn" @setTableFinishFun="setTableFinishFun">
<div slot="association" slot-scope="scope" class="association">
<el-radio :label="scope.scope.id" v-model="radio" @change.native="getCurrentRow()"></el-radio>
</div>
</GLTable>
<!-- 表格区域 end -->
<div class="associationBtn">
<el-button type="primary" @click="associationConfirm">确定</el-button>
<el-button type="default" @click="associationCancel">取消</el-button>
</div>
</el-dialog>
<div class="association-X" v-if="editForm.relatedCouponId">
<div class="associationRow">
<span class="associationLists">名称</span>
<span class="associationLists">优惠卷类型</span>
<span class="associationLists">使用途径</span>
<span class="associationLists" v-if="routeInfo.addOrEdit !== 3">操作</span>
</div>
<div class="associationRow">
<el-tooltip effect="dark" :content="editForm.relatedCouponName" placement="bottom">
<span class="associationLists">{{editForm.relatedCouponName}}</span>
</el-tooltip>
<span class="associationLists">{{editForm.relatedDiscountType}}</span>
<span class="associationLists">{{editForm.relatedUseChannel}}</span>
<span class="associationLists" v-if="routeInfo.addOrEdit !== 3"><el-button type="text" @click="del()">删除</el-button></span>
</div>
</div>
</template>
<template slot="proSpecsBtn">
<el-button :disabled="isDisabled" type="default" @click="handleSpecsEdit(1)">+添加规格项目</el-button>
</template>
......@@ -420,6 +455,98 @@ export default {
name: 'editProduct',
data() {
return {
dialogTableVisible: false,
radio:"",
templateSelection: [],
associationList:[],
relatedDiscountType:'',
// associationUseChannel:'',
// associationShow: false,
// 关联优惠券表格
searchForm: {
couponName: '',
directionalFlag:3,
status: 2,
discountTypes: [2, 3, 4]
},
associationTableSearchForm: {status:2,directionalFlag:3},
// 搜索
searchFormData: [
{
label: '名称',
name: 'couponName',
type: 'input',
maxlength: 20
},
],
getListApi: this.$apis.couponManage.getMerchantListApi,
associationTableParams: {
listName: 'list',
tableOption: false,
tableColumns: [
{
prop: 'association',
addHtml: 'association',
width:'100'
},
{
label:'序号',
prop:'num',
width:'100'
},
{
label: '名称',
prop: 'couponName',
line: 2
},
{
label: '优惠券类型',
prop: 'discountType',
formatter: cellValue => {
return this.associationBaseData.discountTypeList.find(item => item.confId == cellValue.discountType).confName
}
},
{
label: '使用途径',
prop: 'useChannel',
formatter: cellValue => {
var useChannel = ''
if (cellValue.useChannel) {
useChannel = this.associationBaseData.useChannelList.find(item => item.confId == cellValue.useChannel).confName
}
return useChannel
}
},
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
associationBaseData: {
// 1:满减券,2:折扣券,3:代金券,4:实物券 5:购车代金券 6:商品折扣券,7:会员服务
discountTypeList: [
{
confId: '2',
confName: '折扣券'
},
{
confId: '3',
confName: '代金券'
},
{
confId: '4',
confName: '兑换券'
}
],
useChannelList: [
{
confId: '1',
confName: '线上商品'
},
{
confId: '2',
confName: '到店核销'
}
]
},
size: 'small',
footerLeft: '0',
footerWidth: '0',
......@@ -489,6 +616,12 @@ export default {
spescInputVal: '',
// 表单
editForm: {
businessType: [],
businessTypeList:[],
relatedCouponName:'',
relatedDiscountType:'',
relatedUseChannel:'',
relatedCouponId:'',
goodsName: '',
goodsImage: '',
goodsDetailImageList: [],
......@@ -496,8 +629,7 @@ export default {
classifyIdList: [],
zoneId: '',
descImgList: [],
businessType:'',
applicationType: [],
// applicationType: [],
// 商品规格
// specificationDetailList: [],
retailPrice: '',
......@@ -594,20 +726,7 @@ export default {
optionId: 'confId',
optionLabel: 'confName',
isDisabled: false,
optionList: [
{
confId: 1,
confName: '123'
},
{
confId: 2,
confName: '456'
},
{
confId: 3,
confName: '789'
}
],
businessTypeList:[]
// handleRadioChange: val => {
// this.handleTypeChange(val)
// }
......@@ -655,7 +774,17 @@ export default {
label: '',
name: 'descImgList',
addHtml: 'descImgs'
}
},
{
label: '关联优惠券',
name: '',
addHtml: 'association'
},
// {
// label: '',
// name: '',
// addHtml: 'associationInput'
// }
]
},
{
......@@ -852,6 +981,8 @@ export default {
created() {
this.routeInfo = this.$route.query
this.businessGetBusinessTypeById();
},
mounted() {
......@@ -868,13 +999,45 @@ export default {
this.routeInfo.groupOrStore == 2 && this.storeNoExitAttr()
this.routeInfo.addOrEdit != 1 ? this.getInfo() : ''
this.routeInfo.addOrEdit == 3 && this.setAllDisabled()
this.getOptionsList('searchFormData')
},
methods: {
checkApplication(res1,res2,res3) {
console.log('res1',res1);
console.log('res2',res2);
console.log('res3',res3);
businessGetBusinessTypeById() {
this.$apis.proManage.getBusinessTypeByIdApi({}).then(
res => {
console.log('res',res);
var idx = this.externalFormList[0].editFormData.findIndex(subItem => subItem.name == 'businessType')
this.externalFormList[0].editFormData[idx].businessTypeList = res;
}
)
},
del(){
this.associationShow = false;
this.editForm.relatedCouponId = '';
this.editForm.relatedCouponName = '';
this.editForm.relatedDiscountType = '';
this.editForm.relatedUseChannel = '';
},
associationConfirm(){
this.dialogTableVisible = false;
this.associationShow = true;
this.editForm.relatedUseChannel = '';
this.editForm.relatedCouponId = this.associationList[0].id;
this.editForm.relatedCouponName = this.associationList[0].couponName;
this.editForm.relatedDiscountType = this.associationBaseData.discountTypeList.find(item => item.confId == this.associationList[0].discountType).confName;
this.editForm.relatedUseChannel = this.associationBaseData.useChannelList.find(item => item.confId == this.associationList[0].useChannel).confName;
},
associationCancel(){
this.dialogTableVisible = false;
},
getCurrentRow(){
//获取选中数据
// this.radio
let inx = this.templateSelection.findIndex(value => value.id == this.radio);
this.associationList.pop();
this.associationList.push(this.templateSelection[inx]);
console.log('this.associationList',this.associationList);
},
getBaseDate() {
return new Promise(resolve => {
......@@ -1222,7 +1385,15 @@ export default {
supplyPrice: res.supplyPrice ? (res.supplyPrice / 100).toFixed(2) : '',
describeTxt: '',
descImgList: [],
applicationType:[]
businessType:[]
}
this.editForm.businessType = this.editForm.businessTypeList.filter(item => item.isChoose == 1).map(item => item.businessType)
console.log(this.editForm)
if(res.relatedCoupon) {
this.editForm.relatedCouponId = res.relatedCoupon.id;
this.editForm.relatedCouponName = res.relatedCoupon.couponName;
this.editForm.relatedDiscountType = this.associationBaseData.discountTypeList.find(item => item.confId == res.relatedCoupon.discountType).confName;;
this.editForm.relatedUseChannel = this.associationBaseData.useChannelList.find(item => item.confId == res.relatedCoupon.useChannel).confName;
}
// 是否需要安装
this.editForm.install = this.editForm.install || 'Y'
......@@ -1327,6 +1498,7 @@ export default {
},
// 图片-描述-end
handleConfirm() {
console.log(this.editForm)
var isJump = false
this.submitted = true
for (var i = 0; i < this.externalFormList.length; i++) {
......@@ -1362,6 +1534,19 @@ export default {
if (this.routeInfo.addOrEdit == 2) {
params.id = this.routeInfo.id
}
// 业务类型
params.businessTypeList = params.businessType
if(!params.businessTypeList) {
delete params.businessTypeList
} else {
var idx = this.externalFormList[0].editFormData.findIndex(subItem => subItem.name == 'businessType')
var list = this.externalFormList[0].editFormData[idx].businessTypeList
params.businessTypeList = []
this.editForm.businessType.forEach(item => {
console.log(item)
params.businessTypeList.push(list.find(k => k.businessType == item))
})
}
// 描述
params.goodsDescList = []
this.editForm.descImgList.forEach(item => {
......@@ -1414,11 +1599,11 @@ export default {
deleteAttrList.forEach(item => {
delete params[item]
})
// console.log(params)
console.log(params)
this.$apis.proManage.insertOrUpdateProApi(params).then(res => {
console.log('res',res);
// console.log('res',res);
this.$message({
message: res.code == '0' ? '操作成功' : '操作失败',
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
......@@ -1444,7 +1629,38 @@ export default {
} else {
this.cancelJump()
}
}
},
getParams() {
var params = JSON.parse(JSON.stringify(this.searchForm))
return params
},
// 关联优惠券请求
associationBeforeSearchFn() {
return new Promise(resolve => {
this.associationTableSearchForm = this.getParams()
// delete this.tableSearchForm.createDate
resolve()
})
},
setTableFinishFun() {
let num = 0;
let pageSize = Number(this.$refs.coupon[0].page.pageSize);
let pageNum = Number(this.$refs.coupon[0].page.pageNum);
let sum = (pageSize*(pageNum - 1));
// console.log(pageSize,pageNum);
this.$refs.coupon[0].data.forEach(val => {
if(num <= pageSize) val.num = ++num;
if(pageNum > 1) val.num = ++sum;
})
// console.log('this.$refs.coupon',this.$refs.coupon[0])
//接收到的数据为空
this.templateSelection = this.$refs.coupon[0].data;
this.$refs.coupon[0].data.length ? (this.$refs.coupon[0].tableHeightValues = '') : this.$refs.coupon[0].setTableHeightFun()
},
handleSearch() {
this.$refs.coupon[0].refreshTable()
},
}
}
</script>
......@@ -1621,4 +1837,28 @@ export default {
background: #FFFFFF !important;
border: 1px solid #FFFFFF !important;
}
.edit-pro .association .el-radio__label {
display: none;
}
.edit-pro .associationBtn {
position: absolute;
right: 19px;
bottom: 26px;
}
.association-X {
width: 320px;
margin-left: -25px;
}
.association-X .associationRow {
display: flex;
/* justify-content:space-evenly; */
}
.association-X .associationRow .associationLists {
display: block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
flex: 1;
text-align: center;
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!