Commit ffce70f9 by chenwq

新增礼包

1 parent 29ca2eb0
......@@ -76,4 +76,26 @@ const exportGiftInfoApi = params => {
})
}
export default { getFollowerStaffListApi, getListApi, giftExportApi, deleteGiftApi, getGiftInfoApi,getReceivedGiftInfoApi,exportGiftInfoApi }
// 编辑-选择定向礼包列表
const getDirectionalGiftListApi = params => {
params.method = 'scrm.api.coupon.directional.gift.coupon.list'
return http({
url: 'rop-scrm-coupon/router',
method: 'GET',
data: params,
sign: true
})
}
const insertGiftApi = params => {
params.method = 'scrm.api.coupon.directional.gift.create'
return http({
url: 'rop-scrm-coupon/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
export default { getFollowerStaffListApi, getListApi, giftExportApi, deleteGiftApi, getGiftInfoApi, getReceivedGiftInfoApi, exportGiftInfoApi, getDirectionalGiftListApi, insertGiftApi }
......@@ -13,11 +13,11 @@ import { Http } from 'glsx-common'
let timeout = 30000 //超时时间
export const fetchConfig = function (isEnv = true) {
// console.log(1111111)
// if (isEnv) {
// let { request } = cfg
// Object.assign(request, { timeout })
// return Promise.resolve(cfg)
// }
if (isEnv) {
let { request } = cfg
Object.assign(request, { timeout })
return Promise.resolve(cfg)
}
//return window.fetch('https://', {}).then(res => res.json())
// request({ url: 'https://oss-config.test.glsx.com.cn/mock/5be17454f31545347559d499/config/oss_commodity_center', method: 'get' })
return new Http().get('https://oss-config.test.glsx.com.cn/mock/619c87331072f92988f05a29/marketing/config')
......
......@@ -18,7 +18,7 @@
<div class="gift-content">
<div class="gift-item" v-for="(subItem, subIndex) in couponObj[item].list" :key="subIndex">
<span :class="['circle', subItem.status == '3' ? ' grey' : '']"></span>
<p :class="['gift-info', subItem.status == '3' ? ' txt-grey' : '']">{{ subItem.couponName }} × {{ subItem.couponAmount }}</p>
<p :class="['gift-coupon-name', subItem.status == '3' ? ' txt-grey' : '']">{{ subItem.couponName }} × {{ subItem.couponAmount }}</p>
<p v-show="subItem.status == '3'" class="gift-tips">已失效</p>
<i class="el-icon-delete" @click="handleGiftDelete(item, subIndex)"></i>
</div>
......@@ -42,14 +42,14 @@
<el-button type="default" @click="handleCancel">取消</el-button>
<el-button type="primary" @click="handleConfirm">确定</el-button>
</div>
<select-gift-dialog></select-gift-dialog>
<select-gift-dialog v-if="isSelectGiftVisible" :isSelectGiftVisible="isSelectGiftVisible" :selectedGiftList="selectedGiftList" @handleGiftConfirm="handleGiftConfirm" @handleGiftClose="handleGiftClose"></select-gift-dialog>
<select-staff-dialog v-if="isMutiSelectVisible" :isMutiSelectVisible="isMutiSelectVisible" :searchForm="searchStaffForm" :selectedStaffList="selectedStaffList" @handleMutiSelectConfirm="handleMutiSelectConfirm" @handleMutiSelectClose="handleMutiSelectClose"></select-staff-dialog>
</div>
</template>
<script>
import selectStaffDialog from './selectStaffDialog.vue'
import selectGiftDialog from './selectStaffDialog.vue'
import selectGiftDialog from './selectGiftDialog.vue'
export default {
name: 'editGift',
data() {
......@@ -66,6 +66,9 @@ export default {
isMutiSelectVisible: false,
searchStaffForm: {},
selectedStaffList: [],
// 选择定向礼包弹窗
isSelectGiftVisible: false,
selectedGiftList: [],
editChildRef: 'editChildRef',
routeInfo: {
// add-新增;edit-编辑;detail-详情
......@@ -82,25 +85,26 @@ export default {
staffList: [],
// 优惠券类型(discountType) 1:满减券,2:折扣券,3:代金券,4:兑换券,5:购车代金券,6:商品折扣券,7:会员服务
// 优惠券状态(status):1:未生效,2:生效中,3:已失效
couponList: [{
discountType: 3,
couponName: '测试有效期查询券2',
couponAmount: '1',
couponAnticipatedCost: '10',
status: '2'
}, {
discountType: 3,
couponName: '7折代金券',
couponAmount: '1',
couponAnticipatedCost: '20',
status: '3'
}, {
discountType: 3,
couponName: '9.9折代金券',
couponAmount: '5',
couponAnticipatedCost: '15',
status: '2'
}]
couponList: []
// couponList: [{
// discountType: 3,
// couponName: '测试有效期查询券2',
// couponAmount: '1',
// couponAnticipatedCost: '10',
// status: '2'
// }, {
// discountType: 3,
// couponName: '7折代金券',
// couponAmount: '1',
// couponAnticipatedCost: '20',
// status: '3'
// }, {
// discountType: 3,
// couponName: '9.9折代金券',
// couponAmount: '5',
// couponAnticipatedCost: '15',
// status: '2'
// }]
},
totalEstimatedCost: '',
orderShow: ['service', 'cash', 'discount', 'exchange'],
......@@ -236,27 +240,13 @@ export default {
maxlength: 50,
width: '567px'
}
// {
// label: '礼包图片',
// name: 'zoneImg',
// type: 'upload',
// limitSize: 10,
// maxPhotoNum: 1,
// handleUpload: (e, file, targetItem) => {
// const imgFile = e.target.result
// const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1]
// this.$apis.common.uploadImgApi({ file: base64, fileType: 'image' }).then(res => {
// this.editForm[targetItem.name] = res
// this.$refs.editFormRef.$refs[this.editChildRef].validateField(targetItem.name)
// })
// }
// }
]
}
},
components: {
selectStaffDialog
selectStaffDialog,
selectGiftDialog
},
watch: {
......@@ -278,16 +268,20 @@ export default {
methods: {
getInfo() {
this.$apis.giftBag.getGiftInfoApi({ id: this.routeInfo.id }).then(res => {
this.editForm = res.data
this.editForm.receiveWay = this.editForm.receiveWay + ''
this.recoveryCoupon()
this.recoveryTotalPrice()
this.$nextTick(() => {
this.editStatus = false
this.$apis.giftBag
.getGiftInfoApi({ id: this.routeInfo.id })
.then(res => {
this.editForm = res.data
this.editForm.receiveWay = this.editForm.receiveWay + ''
this.recoveryCoupon()
this.recoveryTotalPrice()
this.$nextTick(() => {
this.editStatus = false
})
})
.finally(() => {
this.loading = false
})
})
},
recoveryCoupon() {
......@@ -297,7 +291,6 @@ export default {
this.editForm.couponList.forEach(item => {
this.couponObj[this.numToCoupon[item.discountType]].list.push(item)
})
// console.log(this.couponObj)
},
receiveWayChange(val) {
......@@ -309,21 +302,47 @@ export default {
// 计算预估成本
recoveryTotalPrice() {
this.totalEstimatedCost = 0
this.orderShow.forEach(itme => {
this.couponObj[itme].list.forEach(subItem => {
this.orderShow.forEach(item => {
this.couponObj[item].list.forEach(subItem => {
// 失效券不加入预估成本
if (subItem.status != '3') {
this.totalEstimatedCost = this.totalEstimatedCost + subItem.couponAnticipatedCost * subItem.couponAmount
}
})
})
this.totalEstimatedCost = (this.totalEstimatedCost / 100).toFixed(2)
},
// 礼包
recoveryGiftList() {
this.editForm.couponList = []
this.orderShow.forEach(item => {
this.couponObj[item].list.forEach(k => {
this.editForm.couponList.push(k)
})
})
},
handleGiftAdd() {
this.selectedGiftList = JSON.parse(JSON.stringify(this.couponObj))
this.handleGiftClose()
},
handleGiftAdd() { },
handleGiftConfirm(selectedData) {
this.handleGiftClose()
this.couponObj = selectedData
this.recoveryTotalPrice()
this.recoveryGiftList()
},
handleGiftClose() {
this.isSelectGiftVisible = !this.isSelectGiftVisible
},
handleGiftDelete(attr, idx) {
this.couponObj[attr].list.splice(idx, 1)
this.recoveryTotalPrice()
this.recoveryGiftList()
},
handleStaffRemove(val, idx) {
......@@ -351,7 +370,7 @@ export default {
this.editForm.staffList = []
selectedData.forEach(item => {
this.editForm.staffList.push({
staffId: item.userOneId,
staffUUID: item.userOneId,
staffName: item.staffName
})
})
......@@ -363,28 +382,29 @@ export default {
this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => {
if (valid) {
var params = this.$common.utils.deepClone(this.editForm)
params.staffCreateRequests = this.$common.utils.deepClone(params.staffList)
params.couponCreateRequests = this.$common.utils.deepClone(params.couponList)
delete params.staffList
delete params.couponList
if (this.routeInfo.addOrEdit == 'edit') {
params.id = this.routeInfo.id
}
console.log(params)
// if (this.routeInfo.addOrEdit == 'edit') {
// params.id = this.routeInfo.id
// }
// params.merchantList = []
// this.editForm.merchantList.forEach(item => {
// params.merchantList.push({
// merchantId: item.merchantNo,
// merchantName: item.merchantName,
// merchantAccountLevel: item.merchantAccountLevel
// })
// })
// console.log(params)
// this.$apis.zoneList.insertZoneApi(params).then(res => {
// this.$message({
// message: res.code == '0' ? '操作成功' : '操作失败',
// type: res.code == '0' ? 'success' : 'error'
// })
// if (res.code == '0') {
// this.cancelJump()
// }
// })
this.loading = true
this.$apis.giftBag
.insertGiftApi(params)
.then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
this.cancelJump()
}
})
.finally(() => {
this.loading = false
})
}
})
},
......@@ -449,7 +469,7 @@ export default {
.gift-item {
display: inline-block;
width: 50%;
.gift-info {
.gift-coupon-name {
display: inline-block;
margin: 0 5px 0 7px;
}
......
......@@ -155,14 +155,16 @@ export default {
methods: {
getInfo() {
this.$apis.giftBag.getGiftInfoApi({ id: this.routeInfo.id }).then(res => {
this.editForm = res.data
this.recoveryCoupon()
this.recoveryTotalPrice()
this.$nextTick(() => {
this.$apis.giftBag
.getGiftInfoApi({ id: this.routeInfo.id })
.then(res => {
this.editForm = res.data
this.recoveryCoupon()
this.recoveryTotalPrice()
})
.finally(() => {
this.loading = false
})
})
},
recoveryCoupon() {
......
......@@ -56,8 +56,8 @@ export default {
size: 'small',
url: url,
searchForm: {
orderCode: '',
commentStatus: '',
name: '',
staffName: '',
createDate: []
},
tableSearchForm: {},
......@@ -278,8 +278,8 @@ export default {
handleReset() {
this.searchForm = {
orderCode: '',
commentStatus: '',
name: '',
staffName: '',
createDate: []
}
this.handleSearch()
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!