Commit ffce70f9 by chenwq

新增礼包

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