Commit 52b6f970 by 张权

定向礼包第一轮bug修复

1 parent fc0b8c62
......@@ -125,7 +125,8 @@ const toVoidGift = params => {
url: 'rop-scrm-coupon/router',
method: 'POST',
data: params,
sign: true
sign: true,
returnAll: true
})
}
......
......@@ -19,7 +19,7 @@
<p class="edit-title">{{ title }}</p>
<glsx-combi-form class="edit-form-container m-r-20" ref="editFormRef" :isEdit="isEdit" :labelWidth="labelWidth" defaultWidth="415px" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<div slot="remarkName" class="edit-tips m-t-8">可根据备注名称进行查找,仅作内部查看,不展示给客户</div>
<el-button slot="selectGiftBtn" class="default-blue-btn" @click="handleGiftAdd">选择礼包内容</el-button>
<el-button slot="selectGiftBtn" :disabled="routeInfo.receivedStock" class="default-blue-btn" @click="handleGiftAdd">选择礼包内容</el-button>
<div slot="couponListBlock" class="gift-block" :style="{ 'margin-left': labelWidth }" v-show="editForm.couponList && editForm.couponList.length != 0">
<div class="gift-title">
预估成本:
......@@ -35,44 +35,44 @@
<span :class="['circle', subItem.status == '3' ? ' grey' : '']"></span>
<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" style="color: #C6C6C6;" @click="handleGiftDelete(item, subIndex)"></i>
<i :style="{ cursor: routeInfo.receivedStock ? 'not-allowed' : 'pointer' }" class="el-icon-delete" style="color: #C6C6C6;" @click="handleGiftDelete(item, subIndex)"></i>
</div>
</div>
</div>
</div>
</div>
<div class="stock" slot="stockNumInput">
<el-input @input="resetStock" v-model="editForm.stock"></el-input>
<el-input :disabled="routeInfo.receivedStock" @input="resetStock" v-model="editForm.stock"></el-input>
<span class="approval-tip" style="margin-left:8px;">每个用户根据领取规则限领一次礼包</span>
</div>
<div class="approval" slot="approvalSlot">
<el-radio v-model="editForm.approveFlag" :label="1">赠送前需审批</el-radio>
<el-radio :disabled="routeInfo.receivedStock" v-model="editForm.approveFlag" :label="1">赠送前需审批</el-radio>
<p class="approval-tip" style="margin-bottom:12px;">员工在赠送时需提交赠送申请,审批通过后才可赠送</p>
<el-radio v-model="editForm.approveFlag" :label="2">无需审批</el-radio>
<el-radio :disabled="routeInfo.receivedStock" v-model="editForm.approveFlag" :label="2">无需审批</el-radio>
<p class="approval-tip">无需审批,可直接赠送给客户</p>
</div>
<div v-if="editForm.receiveRule === 1" class="telArea" slot="configSlot">
<label class="receiving" for="">领取条件:</label>
<el-radio-group :disabled="routeInfo.id && routeInfo.receivedStock" @change="resetTextArea" v-model="receiveWay">
<el-radio-group @change="resetTextArea" v-model="receiveWay">
<el-radio :label="1">指定手机号</el-radio>
<el-radio :label="2">指定车架号后6位</el-radio>
</el-radio-group>
<div style="margin-left:70px;width: calc(100% - 70px);">
<el-input :disabled="routeInfo.id && routeInfo.receivedStock" @blur="formatPhone" type="textarea" v-model="phone" :placeholder="placeholder"></el-input>
<el-input @blur="formatPhone" type="textarea" v-model="phone" :placeholder="placeholder"></el-input>
<span class="approval-tip" style="margin-left:0;">客户需准确输入该{{ receiveWay == 1 ? '手机号码' : '车架号后6位' }}才能成功领取</span>
<div>
<div :class="['tel-item', item.valid ? '' : 'valid-tel']" v-for="(item, index) in phoneList" :key="index">
{{ item.tel }}
<i :style="{ cursor: routeInfo.id && routeInfo.receivedStock ? 'not-allowed' : 'pointer' }" class="el-icon-close" @click="delPhone(item.tel)"></i>
<i style="cursor:pointer" class="el-icon-close" @click="delPhone(item.tel)"></i>
</div>
</div>
</div>
</div>
<!-- <div slot="receiveDetails" class="edit-tips m-t-8">客户需要输入该{{ editForm.receiveWay == '1' ? '手机号' : '车架号后6位' }}才能成功领取</div> -->
<el-button slot="selectStaffBtn" class="el-icon-plus" @click="handleSelectStaff">选择员工</el-button>
<el-button slot="selectStaffBtn" :disabled="routeInfo.receivedStock" class="el-icon-plus" @click="handleSelectStaff">选择员工</el-button>
<div slot="staffListBlock" class="sale-select" :style="{ 'margin-left': labelWidth }" v-show="editForm.staffList && editForm.staffList.length != 0">
<div :key="key" class="el-input-tag input-tag-wrapper">
<el-tag effect="plain" type="info" v-for="(tag, idx) in editForm.staffList" :key="idx" closable :disable-transitions="false" @close="handleStaffRemove(tag, idx)">
<el-tag effect="plain" type="info" v-for="(tag, idx) in editForm.staffList" :key="idx" :closable="!routeInfo.receivedStock" :disable-transitions="false" @close="handleStaffRemove(tag, idx)">
<i class="el-icon-user-solid"></i>
{{ tag.staffName }}
</el-tag>
......@@ -136,6 +136,7 @@ export default {
editStatus: false,
labelWidth: '144px',
receiveWay: 1,
curStock: 0,
editForm: {
name: '',
remarkName: '',
......@@ -188,7 +189,21 @@ export default {
// receiveWay: [{ required: true, message: '请选择领取条件', trigger: 'change' }],
staffList: [{ required: true, message: '请选择发放员工', trigger: 'change' }],
couponList: [{ required: true, message: '请选择礼包', trigger: 'change' }],
stock: [{ required: true, message: '请输入库存数量', trigger: 'change' }],
stock: [
{
required: true,
validator: (rule, value, callback) => {
if (!value) {
return callback(new Error('请输入库存数量'))
} else if (this.routeInfo.id && +this.curStock > +value) {
return callback(new Error('二次编辑,库存数量不能减少'))
} else {
return callback()
}
},
trigger: 'change'
}
],
approveFlag: [{ required: true, message: '请选择审批要求', trigger: 'change' }],
receiveRule: [{ required: true, message: '请选择领取规则设置', trigger: 'change' }]
// receiveDetails: [
......@@ -216,6 +231,7 @@ export default {
{
label: '礼包名称',
name: 'name',
isDisabled: false,
type: 'input',
maxlength: 15
},
......@@ -223,6 +239,7 @@ export default {
label: '备注名称',
name: 'remarkName',
type: 'input',
isDisabled: false,
maxlength: 30,
suffixSlot: 'remarkName',
placeholder: '可按车主姓名+手机号形式备注'
......@@ -371,8 +388,14 @@ export default {
this.title = this.titleObj[this.routeInfo.addOrEdit]
this.routeInfo.addOrEdit == 'add' ? '' : this.getInfo()
if (this.routeInfo.id && this.routeInfo.receivedStock) {
let targetItem = this.editFormData.find(item => item.name == 'receiveRule')
targetItem && (targetItem.isDisabled = true)
// let targetItem = this.editFormData.find(item => item.name == 'receiveRule')
// targetItem && (targetItem.isDisabled = true)
let arr = ['name','remarkName','receiveRule']
this.editFormData.map(item =>{
if(arr.includes(item.name)){
item.isDisabled = true
}
})
}
},
......@@ -385,7 +408,6 @@ export default {
this.editForm.stock = e.replace(/^(0+)|[^\d]+/g, '')
},
delPhone(val) {
if (this.routeInfo.id && this.routeInfo.receivedStock) return
let phone = this.phone.replace(new RegExp('[\n]*' + val + '[\n]*', 'g'), '\n')
phone = phone.replace(/^[\n]+/, '')
this.phone = phone
......@@ -422,6 +444,7 @@ export default {
res.data.updatedDate = dayjs(res.data.updatedDate).format('YYYY-MM-DD HH:mm:ss')
this.approvalStatus = res.data.approveStatus - 1
this.editForm = res.data
this.curStock = res.data.stock
this.receiveWay = res.data.receiveWay || 1
if (res.data && res.data.receiveDetails) {
this.phone = res.data.receiveDetails.replaceAll(',', '\n')
......@@ -522,6 +545,7 @@ export default {
},
handleGiftDelete(attr, idx) {
if(this.routeInfo.receivedStock) return;
this.couponObj[attr].list.splice(idx, 1)
this.recoveryTotalPrice()
this.recoveryGiftList()
......
......@@ -38,10 +38,14 @@
</div>
</div>
</div>
<div slot="approveFlagBlock">
{{ editForm.approveFlag == 1 ? '赠送前需审批' : '无需审批' }}
</div>
<div slot="receiveDetails">
<span style="border: 1px dashed #333;">{{ editForm.receiveWay == '1' ? '指定手机号' : '指定车架号后6位' }}:</span>
<div class="phone-wrap">
<span class="phone" v-for="(item,id) in receiveDetailList" :key="id">{{item}}</span>
<span v-if="editForm.receiveRule != 1">{{ editForm.receiveRule == 2 ? '员工赠送时指定' : '直接领取' }}</span>
<span v-if="editForm.receiveRule == 1" style="border: 1px dashed #333;">{{ editForm.receiveWay == '1' ? '指定手机号' : '指定车架号后6位' }}:</span>
<div v-if="editForm.receiveRule == 1" class="phone-wrap">
<span class="phone" v-for="(item, id) in receiveDetailList" :key="id">{{ item }}</span>
</div>
</div>
<div slot="staffListBlock" class="sale-select" v-show="editForm.staffList && editForm.staffList.length != 0">
......@@ -86,7 +90,7 @@ export default {
footerWidth: '0',
loading: false,
editChildRef: 'editChildRef',
receiveDetailList:[],
receiveDetailList: [],
routeInfo: {
// add-新增;edit-编辑;detail-详情
addOrEdit: 'add',
......@@ -143,7 +147,9 @@ export default {
remarkName: [{ required: true, message: '请输入备注名称', trigger: 'change' }],
couponList: [{ required: true, message: '请选择礼包', trigger: 'change' }],
receiveWay: [{ required: true, message: '请选择领取条件', trigger: 'change' }],
staffList: [{ required: true, message: '请选择发放员工', trigger: 'change' }]
staffList: [{ required: true, message: '请选择发放员工', trigger: 'change' }],
approveFlag: [{ required: true, message: '请选择审批要求', trigger: 'change' }],
stock: [{ required: true, message: '请选择库存数量', trigger: 'change' }]
},
isEdit: true,
editFormData: [
......@@ -163,6 +169,16 @@ export default {
addHtml: 'couponListBlock'
},
{
label: '库存数量',
name: 'stock',
type: 'showTxt'
},
{
label: '审批要求',
name: 'approveFlag',
addHtml: 'approveFlagBlock'
},
{
label: '领取条件',
name: 'receiveWay',
addHtml: 'receiveDetails'
......@@ -202,7 +218,7 @@ export default {
res.data.updatedDate = dayjs(res.data.updatedDate).format('YYYY-MM-DD HH:mm:ss')
this.editForm = res.data
let arr = []
res.data.receiveDetails && (arr=res.data.receiveDetails.split(','))
res.data.receiveDetails && (arr = res.data.receiveDetails.split(','))
this.receiveDetailList = [...arr]
this.approvalStatus = res.data.approveStatus - 1
this.recoveryCoupon()
......@@ -314,17 +330,17 @@ export default {
}
}
}
.phone-wrap{
.phone-wrap {
width: 878px;
background-color: #F9F9F9;
background-color: #f9f9f9;
padding: 5px 10px;
line-height: 14px;
font-size: 14px;
box-sizing: border-box;
margin-top: 5px;
.phone{
.phone {
display: inline-block;
margin:5px 16px 5px 0;
margin: 5px 16px 5px 0;
border: 1px dashed #333;
}
}
......
......@@ -63,9 +63,6 @@ export default {
name: row => {
return '编辑'
},
condition: row => {
return !row.scope.receivedStock
},
attrs: {
type: 'text',
fn: '编辑'
......
......@@ -32,19 +32,18 @@
<GLTable ref="giftListRef" :hasNum="false" :hasPage="false" :noDataImg="url" :tableParams="giftParams" :tableData="scope.scope | filterTable" @setTableFinishFun="setGiftTableFinishFun"></GLTable>
</div>
<div class="table-btns" slot="auth-button" slot-scope="scope">
<el-button :disabled="scope.scope.receiveStatus == 2" type="text" @click="toVoid(scope.scope)">作废</el-button>
<el-button :disabled="scope.scope.receiveStatus == 2" type="text" @click="handleCancel(scope.scope)">作废</el-button>
</div>
</GLTable>
<!-- 表格区域 end -->
</div>
<glsx-dialog showClose class="void-dialog" title="作废确认" :isVisible.sync="voidDialogVisibity" width="720px" @confirmDialog="handleVoidConfirm" @closeDialog="handleVoidClose">
<div class="wrap">
<p class="dialog-tip">请先和客户沟通在确认,避免引起客诉,作废后客户将不可使用该礼包下所有优惠卷</p>
<div style="display:flex;">
<label class="label" for="">作废原因:</label>
<el-input type="textarea" v-model="reason" maxlength="50" placeholder="请输入作废原因"></el-input>
</div>
</div>
<glsx-dialog title="作废确认" :isVisible.sync="isCancelVisible" @confirmDialog="handleCancelConfirm" @closeDialog="handleCancelClose">
<p>请先和客户沟通再确认,避免引起客诉,作废后客户将不可使用该礼包下所有优惠卷</p>
<el-form ref="cancelRef" label-width="100px" :rules="cancelRules" :model="cancelForm">
<el-form-item label="作废原因" prop="cancelReason" class="m-t-20">
<el-input :size="size" type="textarea" v-model="cancelForm.cancelReason" placeholder="请输入作废原因" maxlength="50" rows="3" show-word-limit></el-input>
</el-form-item>
</el-form>
</glsx-dialog>
</div>
</template>
......@@ -78,7 +77,26 @@ export default {
url: url,
curId: '',
reason: '',
voidDialogVisibity: false,
cancelForm: {
userDirectionalGiftId: '',
cancelReason: ''
},
cancelRules: {
cancelReason: [
{
required: true,
validator: (rule, value, callback) => {
if (!value || (value && !value.trim())) {
return callback(new Error('请输入作废原因'))
} else {
return callback()
}
},
trigger: 'change'
}
]
},
isCancelVisible: false,
searchForm: {
nickName: '',
wechatUserFlag: '',
......@@ -213,8 +231,8 @@ export default {
tableParams: {
listName: 'list',
tableOption: {
width:100,
align:'center'
width: 100,
align: 'center'
},
tableColumns: [
{
......@@ -255,17 +273,17 @@ export default {
{
label: '礼包名称',
width: '200',
width: 200,
addHtml: 'directionalGiftName'
},
{
label: '礼包备注名称',
prop: 'directionalGiftRemarkName',
width: '200'
width: 150
},
{
label: '预估成本/元',
width: 200,
width: 150,
prop: 'anticipatedCost',
formatter: cellValue => {
return cellValue.anticipatedCost / 100
......@@ -273,7 +291,7 @@ export default {
},
{
// label: '已核销成本/元',
width: 200,
width: 150,
prop: 'verificationAnticipatedCost',
// sortable: true,
renderHeader: h => {
......@@ -290,6 +308,7 @@ export default {
},
{
label: '发放员工',
width: 120,
formatter: cellValue => {
return cellValue.staffList[0].staffName
}
......@@ -323,30 +342,28 @@ export default {
// })
// },
// 查看
handleVoidClose() {
this.voidDialogVisibity = false
this.curId = ''
this.reason = ''
},
handleVoidConfirm() {
if (!this.reason.trim()) {
return this.$message({
message: '请输入作废原因!',
type: 'error',
customClass: 'myMessage'
})
handleCancelClose() {
this.cancelVisibleChange()
this.cancelForm = {
userCouponId: '',
cancelReason: ''
}
this.$apis.giftBag.toVoidGift({ userDirectionalGiftId: this.curId, cancelReason: this.reason }).then(res => {
if (res) {
this.handleVoidClose()
this.$message({
message: '操作成功',
type: 'success'
},
handleCancelConfirm() {
this.$refs.cancelRef.validate(valid => {
if (valid) {
this.$apis.giftBag.toVoidGift(this.cancelForm).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
this.handleCancelClose()
this.handleSearch()
}
})
this.$refs.receivedGiftListRef.refreshTable()
}
})
this.handleVoidClose()
},
handleDetail(row) {
this.$router.push({
......@@ -356,9 +373,15 @@ export default {
}
})
},
toVoid(row) {
this.curId = row.id
this.voidDialogVisibity = true
handleCancel(row) {
this.cancelForm.userDirectionalGiftId = row.id
this.cancelVisibleChange()
},
cancelVisibleChange() {
this.$refs.cancelRef && this.$refs.cancelRef.clearValidate()
this.isCancelVisible = !this.isCancelVisible
},
getParams() {
var params = JSON.parse(JSON.stringify(this.searchForm))
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!