Commit 7d088011 by 张权

bug:添加提交审批按钮

1 parent ff942401
...@@ -11,7 +11,7 @@ export default { ...@@ -11,7 +11,7 @@ export default {
data data
}) })
}, },
/** 获取审批中列表 */
getInApproveGiftList (data) { getInApproveGiftList (data) {
data.method = 'scrm.api.coupon.weChat.directional.gift.approve.in.list' data.method = 'scrm.api.coupon.weChat.directional.gift.approve.in.list'
data.pageSize = pageSize data.pageSize = pageSize
...@@ -20,6 +20,14 @@ export default { ...@@ -20,6 +20,14 @@ export default {
data data
}) })
}, },
/** 获取审批中列表 */
toApproveById (data) {
data.method = 'scrm.api.coupon.directional.gift.commit.approve'
return window.$HTTP({
url,
data
})
},
/** 根据id删除定向礼包 */ /** 根据id删除定向礼包 */
deleteGift (data) { deleteGift (data) {
data.method = 'scrm.api.coupon.directional.gift.delete' data.method = 'scrm.api.coupon.directional.gift.delete'
......
...@@ -162,15 +162,6 @@ export default { ...@@ -162,15 +162,6 @@ export default {
} }
else this.flag = true else this.flag = true
wxConfig.init(['thirdPartyOpenPage','onHistoryBack']) wxConfig.init(['thirdPartyOpenPage','onHistoryBack'])
},
beforeRouteEnter (to, from, next) {
console.log(to, from,888)
// let { params: { giftToast } } = from
// next(vm =>{
// if (giftToast) vm.giftToast = giftToast
// })
next()
}, },
methods: { methods: {
input (i, e) { input (i, e) {
...@@ -300,9 +291,8 @@ export default { ...@@ -300,9 +291,8 @@ export default {
this.showLoading('提交中...') this.showLoading('提交中...')
giftApi.createOrupdataGift(params).then(res => { giftApi.createOrupdataGift(params).then(res => {
this.hideLoading() this.hideLoading()
console.log(res,'模板id')
if(res.approveFlag ===2){ if(res.approveFlag ===2){
const {approveTemplateId, approveNo, name, remarkName, anticipatedCost, coupons, giveReason} = res const {approveTemplateId, approveNo, name, remarkName, anticipatedCost, coupons, giveReason, directionalGiftId} = res
let couponStr = '' let couponStr = ''
coupons.forEach(item => { coupons.forEach(item => {
couponStr = couponStr + `${item.couponName}x${item.couponAmount}, 预估成本${(item.couponAnticipatedCost*item.couponAmount/100).toFixed(2)}元\n` couponStr = couponStr + `${item.couponName}x${item.couponAmount}, 预估成本${(item.couponAnticipatedCost*item.couponAmount/100).toFixed(2)}元\n`
...@@ -344,9 +334,8 @@ export default { ...@@ -344,9 +334,8 @@ export default {
.then((resp) => { .then((resp) => {
console.log(resp,'已发起审批') console.log(resp,'已发起审批')
setTimeout(()=>{ setTimeout(()=>{
this.$route.params.fromWhere = 'create' this.$router.replace({ name: 'gift.detail', query: {id:directionalGiftId,approveStatus:999}})
this.$router.back() },500)
},2000)
}) })
}else{ }else{
this.$route.params.giftToast = `${id ? '修改' : '创建'}成功` this.$route.params.giftToast = `${id ? '修改' : '创建'}成功`
......
...@@ -90,23 +90,14 @@ ...@@ -90,23 +90,14 @@
{{obj.giveReason || '-'}} {{obj.giveReason || '-'}}
</div> </div>
</div> </div>
<template v-if="obj.receivedFlag == 1 && approveStatus!=1"> <!-- <template v-if="obj.receivedFlag == 1 && approveStatus!=1">
<div <div
style="z-index:4;" style="z-index:4;"
class="btn text-center x-center" class="btn text-center x-center"
@click="changeGift" @click="changeGift"
>修改</div> >修改</div>
</template> </template> -->
<!-- <div v-if="obj.receivedFlag == 1 && approveStatus != 1" class="submit-btn">
<div
class="text-center"
@click="changeGift"
>修改</div>
<div
class="text-center"
@click="pushApproval"
>提交审批</div>
</div> -->
<div class="box merchant-box" v-if="isShowApprovalDetail"> <div class="box merchant-box" v-if="isShowApprovalDetail">
<div class="title">审批流程</div> <div class="title">审批流程</div>
<div class="connect" :style="{height: lineHeight+'px'}"></div> <div class="connect" :style="{height: lineHeight+'px'}"></div>
...@@ -116,10 +107,11 @@ ...@@ -116,10 +107,11 @@
<img v-if="pItem.avtive" src="../../assets/images/icon/active_avatar.png" alt=""> <img v-if="pItem.avtive" src="../../assets/images/icon/active_avatar.png" alt="">
<img v-else src="../../assets/images/icon/unactive_avatar.png" alt=""> <img v-else src="../../assets/images/icon/unactive_avatar.png" alt="">
</div> </div>
<div class="real-img" :style="{'margin-left' : (pItem.items.itemList.length>2 && sonId>0) ? '42px':'12px' }"> <div class="real-img" :style="{'margin-left' : (pItem.items.itemList.length>1 && sonId>0) ? '42px':'12px' }">
<img v-if="sonItem.length>1 && sonId===0" src="../../assets/images/icon/more_avatar.png" alt=""> <img v-if="sonItem.itemStatus ===0" src="../../assets/images/icon/more_avatar.png" alt="">
<img v-else-if="sonItem.itemImage" :src="sonItem.itemImage" alt=""> <img v-else-if="sonItem.itemImage" :src="sonItem.itemImage" alt="">
<img v-else src="../../assets/images/icon/unactive_avatar.png" alt=""> <!-- <van-image width="50" height="" v-else-if="sonItem.itemImage" :src="sonItem.itemImage" ></van-image> -->
<img v-else src="../../assets/images/icon/default.png" alt="">
</div> </div>
<div class="info-area"> <div class="info-area">
<div class="info"> <div class="info">
...@@ -127,7 +119,7 @@ ...@@ -127,7 +119,7 @@
<span class="name">{{sonItem.itemName}}</span> <span class="name">{{sonItem.itemName}}</span>
<span class="status" :class="setStatusClass(sonItem.itemStatus)">{{setApprovalStatus(sonItem.itemStatus)}}</span> <span class="status" :class="setStatusClass(sonItem.itemStatus)">{{setApprovalStatus(sonItem.itemStatus)}}</span>
</span> </span>
<span class="date" v-if="!(pItem.nodeType===2 && sonId===0)">{{dateFormat(sonItem.itemOpTime,'YYYY/MM/DD HH:mm')}}</span> <span class="date">{{dateFormat(sonItem.itemOpTime,'YYYY/MM/DD HH:mm')}}</span>
</div> </div>
<div class="remark">{{ sonItem.itemSpeech || '' }}</div> <div class="remark">{{ sonItem.itemSpeech || '' }}</div>
</div> </div>
...@@ -135,6 +127,16 @@ ...@@ -135,6 +127,16 @@
</div> </div>
</div> </div>
</template> </template>
<div v-if="obj.receivedFlag == 1 && approveStatus != 1" class="submit-btn">
<div
:class="isShowApprovalDetail? '': 'white'" class="text-center sub-btn"
@click="changeGift"
>修改</div>
<div v-if="!isShowApprovalDetail"
class="text-center sub-btn"
@click="pushApproval"
>提交审批</div>
</div>
</div> </div>
</template> </template>
...@@ -146,7 +148,7 @@ function appendZero(int) { ...@@ -146,7 +148,7 @@ function appendZero(int) {
return int return int
} }
} }
import { giftApi } from '@/api' import { giftApi,wxConfig } from '@/api'
import { discountTypeMixin } from '@/mixins' import { discountTypeMixin } from '@/mixins'
export default { export default {
name: '', name: '',
...@@ -165,19 +167,9 @@ export default { ...@@ -165,19 +167,9 @@ export default {
mounted () { mounted () {
const {approveStatus} = this.getQuery() const {approveStatus} = this.getQuery()
this.approveStatus = approveStatus this.approveStatus = approveStatus
console.log(this.approveStatus,999)
this.showLoading() this.showLoading()
this.getDetail() this.getDetail()
}, wxConfig.init(['thirdPartyOpenPage'])
beforeRouteEnter (to, from, next) {
console.log(to, from, 1)
// let { params: { giftToast } } = from
// next(vm =>{
// if (giftToast) vm.giftToast = giftToast
// })
next(vm =>{
})
}, },
methods: { methods: {
setCouponData (res) { setCouponData (res) {
...@@ -202,7 +194,6 @@ export default { ...@@ -202,7 +194,6 @@ export default {
getDetail () { getDetail () {
let { id } = this.getQuery() let { id } = this.getQuery()
giftApi.getGiftDetail(id).then(res => { giftApi.getGiftDetail(id).then(res => {
console.log(res,'详情参数')
this.hideLoading() this.hideLoading()
res = this.setCouponData(res) res = this.setCouponData(res)
this.flag = true this.flag = true
...@@ -224,7 +215,7 @@ export default { ...@@ -224,7 +215,7 @@ export default {
if(element.nodeStatus ===2){ if(element.nodeStatus ===2){
element.avtive = true element.avtive = true
} }
if(element?.items?.itemList?.length && element.items.itemList.length>1){ if(element.nodeType==2){
element.items.itemList.unshift({ element.items.itemList.unshift({
"itemName":"", "itemName":"",
"itemParty":"", "itemParty":"",
...@@ -245,7 +236,6 @@ export default { ...@@ -245,7 +236,6 @@ export default {
avtive:true, avtive:true,
items:{itemList:[{itemName, itemImage, itemStatus,itemOpTime: parseInt(parseInt(itemOpTime)/1000)}]} items:{itemList:[{itemName, itemImage, itemStatus,itemOpTime: parseInt(parseInt(itemOpTime)/1000)}]}
} }
console.log(targetObj, typeof itemOpTime, itemOpTime)
this.infoList.push(targetObj) this.infoList.push(targetObj)
} }
this.$nextTick(()=> { this.$nextTick(()=> {
...@@ -259,7 +249,55 @@ export default { ...@@ -259,7 +249,55 @@ export default {
}) })
}, },
pushApproval(){ pushApproval(){
console.log(this.obj) let { id } = this.getQuery()
giftApi.toApproveById({id}).then(res => {
if(res.approveFlag ===2){
const {approveTemplateId, approveNo, name, remarkName, anticipatedCost, coupons, giveReason} = res
let couponStr = ''
coupons.forEach(item => {
couponStr = couponStr + `${item.couponName}x${item.couponAmount}, 预估成本${(item.couponAnticipatedCost*item.couponAmount/100).toFixed(2)}元\n`
})
wxConfig.thirdPartyOpenPage({
"oaType": "10001",
"templateId": approveTemplateId,
"thirdNo": approveNo,
"extData": {
'fieldList': [
{
'title': '礼包名称',
'type': 'text',
'value': name,
},
{
'title': '备注名称',
'type': 'text',
'value': remarkName,
},
{
'title': '预估成本',
'type': 'text',
'value': (anticipatedCost/100).toFixed(2) + '元',
},
{
'title': '礼包明细',
'type': 'text',
'value': couponStr,
},
{
'title': '赠送原因',
'type': 'text',
'value': giveReason,
},
]
}
})
.then((resp) => {
console.log(resp,'已发起审批')
})
}else{
this.showToast('礼包已提交审批,请勿重复提交!')
}
})
}, },
changeGift () { changeGift () {
let { id } = this.getQuery() let { id } = this.getQuery()
...@@ -273,7 +311,7 @@ export default { ...@@ -273,7 +311,7 @@ export default {
return {0:'moreApproval',1:'inApproval',2:'',3:'turnDown',4:'turnApproval'}[id] return {0:'moreApproval',1:'inApproval',2:'',3:'turnDown',4:'turnApproval'}[id]
}, },
dateFormat(dateTime, format = 'YYYY-MM-DD') { dateFormat(dateTime, format = 'YYYY-MM-DD') {
if(dateTime===0) return ''; if(!dateTime) return '';
const date = new Date(dateTime*1000) const date = new Date(dateTime*1000)
const config = { const config = {
YYYY: date.getFullYear(), YYYY: date.getFullYear(),
...@@ -298,11 +336,18 @@ export default { ...@@ -298,11 +336,18 @@ export default {
z-index: 3; z-index: 3;
position: fixed; position: fixed;
bottom: 16px; bottom: 16px;
left: 0;
width: 100%; width: 100%;
justify-content: space-around;
height: auto; height: auto;
display: flex; display: flex;
.white{
background-color: #fff;
color: #323233;
border: 1px solid #DCDEE0;
}
div{ div{
width: 175px; width: 160px;
height: 36px; height: 36px;
background: #3975c6; background: #3975c6;
box-shadow: 0px 2px 4px 0px rgba(57, 117, 198, 0.2); box-shadow: 0px 2px 4px 0px rgba(57, 117, 198, 0.2);
......
<template> <template>
<div class="index"> <div class="index">
<search-box <search-box class="search"
@search="search" @search="search"
:keyword="name" :keyword="name"
:showDropdown="false" :showDropdown="false"
...@@ -36,12 +36,10 @@ ...@@ -36,12 +36,10 @@
</div> </div>
<div class="info"> <div class="info">
<div class="text">指定领取{{i.receiveWay == 1?'手机号':'车架号'}}:{{i.receiveDetails}}</div> <div class="text">指定领取{{i.receiveWay == 1?'手机号':'车架号'}}:{{i.receiveDetails}}</div>
<div class="text">备注名称:{{i.remarkName}}</div> <div class="text-name"><span style="white-space:nowrap;">备注名称:</span><div class="remark">{{i.remarkName}}</div></div>
<div class="qr-text" @click.stop="createQr(i)">领取二维码</div>
</div> </div>
<div
class="qr-text"
@click.stop="createQr(i)"
>领取二维码</div>
</div> </div>
<template #right> <template #right>
<van-button <van-button
...@@ -85,11 +83,14 @@ ...@@ -85,11 +83,14 @@
<template v-if="tabIndex == 2"> <template v-if="tabIndex == 2">
<van-swipe-cell> <van-swipe-cell>
<div class="title flex"> <div class="title flex">
{{i.name}} <span>{{i.name}}</span>
<span v-if="i.approveStatus==5" class="approve-btn" @click.stop="toAppprove(i)">
发起审批
</span>
</div> </div>
<div class="content"> <div class="content">
<div class="text item-flex"><span class="nowrap">备注名称:</span><div>{{i.remarkName}}</div></div> <div class="text item-flex"><span class="nowrap">备注名称:</span><div>{{i.remarkName}}</div></div>
<div class="text">预估成本:{{(i.anticipatedCost/100).toFixed(2)}}元</div> <div class="text">预估成本:<span style="font-weight:600;">{{(i.anticipatedCost/100).toFixed(2)}}</span>元</div>
<div class="text item-flex"><span class="nowrap">赠送原因:</span><div>{{i.giveReason}}</div></div> <div class="text item-flex"><span class="nowrap">赠送原因:</span><div>{{i.giveReason}}</div></div>
<div v-if="i.approveStatus==1 || i.approveStatus==3" class="text">审批状态:<span :style="{color: i.approveStatus==1 ? '#3975C6':'#F1515C','margin-right':'5px'}">{{i.approveStatus==1 ? '审批中' : '已驳回'}}</span>({{i.approveBy}})</div> <div v-if="i.approveStatus==1 || i.approveStatus==3" class="text">审批状态:<span :style="{color: i.approveStatus==1 ? '#3975C6':'#F1515C','margin-right':'5px'}">{{i.approveStatus==1 ? '审批中' : '已驳回'}}</span>({{i.approveBy}})</div>
<div class="text item-flex" v-if="i.approveStatus==3"><span class="nowrap">驳回原因:</span><div style="color: #F1515C;">{{i.approveExplain}}</div></div> <div class="text item-flex" v-if="i.approveStatus==3"><span class="nowrap">驳回原因:</span><div style="color: #F1515C;">{{i.approveExplain}}</div></div>
...@@ -154,10 +155,11 @@ export default { ...@@ -154,10 +155,11 @@ export default {
} }
}, },
beforeRouteEnter (to, from, next) { beforeRouteEnter (to, from, next) {
let { params: { giftToast, fromWhere } } = from let { params: { giftToast } } = from
const { query: { approveStatus } } = from
next(vm =>{ next(vm =>{
if (giftToast) vm.giftToast = giftToast; if (giftToast) vm.giftToast = giftToast;
if(fromWhere==='create') { if(approveStatus) {
vm.handleChangeTab(2) vm.handleChangeTab(2)
vm.change(2) vm.change(2)
} }
...@@ -171,12 +173,61 @@ export default { ...@@ -171,12 +173,61 @@ export default {
this.getList() this.getList()
}) })
} else this.getList() } else this.getList()
wxConfig.init(['shareAppMessage']) wxConfig.init(['shareAppMessage','thirdPartyOpenPage'])
}, },
methods: { methods: {
toAppprove({id}){
giftApi.toApproveById({id}).then(res => {
if(res.approveFlag ===2){
const {approveTemplateId, approveNo, name, remarkName, anticipatedCost, coupons, giveReason} = res
let couponStr = ''
coupons.forEach(item => {
couponStr = couponStr + `${item.couponName}x${item.couponAmount}, 预估成本${(item.couponAnticipatedCost*item.couponAmount/100).toFixed(2)}元\n`
})
wxConfig.thirdPartyOpenPage({
"oaType": "10001",
"templateId": approveTemplateId,
"thirdNo": approveNo,
"extData": {
'fieldList': [
{
'title': '礼包名称',
'type': 'text',
'value': name,
},
{
'title': '备注名称',
'type': 'text',
'value': remarkName,
},
{
'title': '预估成本',
'type': 'text',
'value': (anticipatedCost/100).toFixed(2) + '元',
},
{
'title': '礼包明细',
'type': 'text',
'value': couponStr,
},
{
'title': '赠送原因',
'type': 'text',
'value': giveReason,
},
]
}
})
.then((resp) => {
console.log(resp,'已发起审批')
})
}else{
this.showToast('礼包已提交审批,请勿重复提交!')
}
})
},
handleChangeTab(id){ handleChangeTab(id){
this.$refs.myTab.handleChange(id) this.$refs.myTab.handleChange(id)
console.log(id,6666)
}, },
getList (type) { getList (type) {
let { uuid } = this.getLocalStorage('dj_scrm_userInfo') let { uuid } = this.getLocalStorage('dj_scrm_userInfo')
...@@ -199,7 +250,6 @@ export default { ...@@ -199,7 +250,6 @@ export default {
this.total = res.total this.total = res.total
if(tabIndex === 2) this.$set(this.tab,2,`审批中(${res.total})`); if(tabIndex === 2) this.$set(this.tab,2,`审批中(${res.total})`);
} }
console.log(res)
}) })
}, },
search (e) { search (e) {
...@@ -269,7 +319,6 @@ export default { ...@@ -269,7 +319,6 @@ export default {
appId appId
}) })
.then(link => { .then(link => {
console.log(link)
wxConfig wxConfig
.shareAppMessage({ .shareAppMessage({
title: e.name, title: e.name,
...@@ -308,6 +357,11 @@ export default { ...@@ -308,6 +357,11 @@ export default {
</script> </script>
<style scoped lang='scss'> <style scoped lang='scss'>
/deep/ .search{
.van-icon{
color: #CDD1D4;
}
}
.list-box { .list-box {
height: calc(100vh - 100px); height: calc(100vh - 100px);
.item { .item {
...@@ -358,19 +412,40 @@ export default { ...@@ -358,19 +412,40 @@ export default {
.info { .info {
font-size: 12px; font-size: 12px;
color: #999999; color: #999999;
position: relative;
.text { .text {
line-height: 16px; line-height: 16px;
margin-bottom: 8px; margin-bottom: 8px;
} }
.text-name{
line-height: 16px;
display: flex;
.remark{
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
}
} }
.qr-text { .qr-text {
font-size: 12px;
right: 10px;
bottom: 16px;
color: #3975c6;
position: absolute; position: absolute;
left: 0;
bottom: 0;
padding: 0 5px;
height: 22px;
background: rgba(57, 117, 198, 0.1);
border-radius: 11px;
width: 60px;
font-size: 12px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #3975C6;
text-align: center;
line-height: 22px;
} }
} }
}
} }
} }
.type-1 { .type-1 {
...@@ -430,6 +505,21 @@ export default { ...@@ -430,6 +505,21 @@ export default {
color: #282829; color: #282829;
padding: 16px 16px 10px; padding: 16px 16px 10px;
border-bottom: 1px solid rgba(195, 195, 195, 0.3); border-bottom: 1px solid rgba(195, 195, 195, 0.3);
justify-content: space-between;
.approve-btn{
width: 66px;
height: 24px;
background: #3975C6;
border-radius: 12px;
display: flex;
justify-content: center;
align-items: center;
border: 1px solid #3975C6;
font-size: 10px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #FFFFFF;
}
} }
.content { .content {
padding: 10px 16px 16px; padding: 10px 16px 16px;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!