Commit c78cb6a9 by 张权

2.0.0版本第一次提交

1 parent 9261a228
...@@ -11,6 +11,15 @@ export default { ...@@ -11,6 +11,15 @@ export default {
data data
}) })
}, },
getInApproveGiftList (data) {
data.method = 'scrm.api.coupon.weChat.directional.gift.approve.in.list'
data.pageSize = pageSize
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'
......
...@@ -225,6 +225,14 @@ const WxConfig = { ...@@ -225,6 +225,14 @@ const WxConfig = {
}) })
}, },
onHistoryBack () {
return new Promise(resolve => {
wx.onHistoryBack(function(res){
resolve(res)
})
})
},
/**获取本地图片接口 */ /**获取本地图片接口 */
getLocalImgData (localId) { getLocalImgData (localId) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
...@@ -355,7 +363,21 @@ const WxConfig = { ...@@ -355,7 +363,21 @@ const WxConfig = {
} }
}) })
}) })
} },
/**自建应用发起审批 */
thirdPartyOpenPage (params) {
console.log(params,'参数')
return new Promise(resolve => {
wx.invoke('thirdPartyOpenPage', params, function (res){
if (res && res.err_msg == 'thirdPartyOpenPage:ok') {
resolve(res,'回调')
}
})
})
},
} }
export default WxConfig export default WxConfig
...@@ -131,7 +131,7 @@ ...@@ -131,7 +131,7 @@
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import GiftModal from './GiftModal.vue' import GiftModal from './GiftModal.vue'
import { giftApi } from '@/api' import { giftApi, wxConfig} from '@/api'
import { discountTypeMixin } from '@/mixins' import { discountTypeMixin } from '@/mixins'
export default { export default {
name: '', name: '',
...@@ -161,6 +161,16 @@ export default { ...@@ -161,6 +161,16 @@ export default {
this.id = id this.id = id
} }
else this.flag = true else this.flag = true
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) {
...@@ -283,12 +293,64 @@ export default { ...@@ -283,12 +293,64 @@ export default {
couponCreateRequests, couponCreateRequests,
receiveDetails: obj.receiveWay == 1 ? obj.phone : obj.vin receiveDetails: obj.receiveWay == 1 ? obj.phone : obj.vin
} }
if (id) params.id = id if (id){
params.id = id
}
params.requestSource = 2
this.showLoading('提交中...') this.showLoading('提交中...')
giftApi.createOrupdataGift(params).then(res => { giftApi.createOrupdataGift(params).then(res => {
this.hideLoading() this.hideLoading()
this.$route.params.giftToast = `${id ? '修改' : '创建'}成功` console.log(res,'模板id')
this.$router.back() 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,'已发起审批')
setTimeout(()=>{
this.$router.back()
},2000)
})
}else{
this.$route.params.giftToast = `${id ? '修改' : '创建'}成功`
this.$router.back()
}
}) })
} }
} }
......
...@@ -96,11 +96,52 @@ ...@@ -96,11 +96,52 @@
@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">
<div class="title">审批流程</div>
<div class="connect" :style="{height: lineHeight+'px'}"></div>
<div v-for="(pItem, pId) in infoList" :key="pId" :id="'merchantItem'+pId">
<div v-for="(sonItem, sonId) in pItem.items.itemList" :key="sonId" :style="{'padding-bottom':(pItem.nodeType===2 && sonId===0) ? '10px':'20px'}" class="merchant-item">
<div class="fake-img" v-if="pItem.items.itemList.length<2 || sonId===0">
<img src="../../assets/images/test.jpg" alt="">
</div>
<div class="real-img" :style="{'margin-left' : (pItem.items.itemList.length>2 && sonId>0) ? '42px':'12px' }">
<img src="../../assets/images/test.jpg" alt="">
</div>
<div class="info-area">
<div class="info">
<span class="name-status">
<span class="name">{{sonItem.itemName}}</span>
<span class="status" :class="setStatusClass(sonItem.itemStatus)">{{setApprovalStatus(sonItem.itemStatus)}}</span>
</span>
<span class="date" v-if="!(pItem.nodeType===2 && sonId===0)">{{dateFormat(sonItem.itemOpTime,'YYYY/MM/DD HH:mm')}}</span>
</div>
<div class="remark">{{sonItem.itemStatus===3 ? sonItem.itemSpeech : ((sonItem.itemStatus===0 || sonItem.itemStatus===1) ? '' : '同意')}}</div>
</div>
</div>
</div>
</div>
</template> </template>
</div> </div>
</template> </template>
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
function appendZero(int) {
if (int < 10) {
return '0' + `${int}`
} else {
return int
}
}
import { giftApi } from '@/api' import { giftApi } from '@/api'
import { discountTypeMixin } from '@/mixins' import { discountTypeMixin } from '@/mixins'
export default { export default {
...@@ -108,15 +149,31 @@ export default { ...@@ -108,15 +149,31 @@ export default {
mixins: [discountTypeMixin], mixins: [discountTypeMixin],
data () { data () {
return { return {
infoList:[],
flag: false, flag: false,
obj: {}, obj: {},
total: 0 total: 0,
lineHeight:0,
approveStatus: 0,
} }
}, },
mounted () { mounted () {
const {approveStatus} = this.getQuery()
this.approveStatus = approveStatus
console.log(this.approveStatus,999)
this.showLoading() this.showLoading()
this.getDetail() this.getDetail()
}, },
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) {
let total = 0 let total = 0
...@@ -140,15 +197,69 @@ export default { ...@@ -140,15 +197,69 @@ 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
this.obj = res this.obj = res
console.log(1,res)
if(res?.weChatOpenApprovalDataResponse?.data?.approvalNodes?.approvalNodeList){
console.log(2)
this.infoList = res.weChatOpenApprovalDataResponse.data.approvalNodes.approvalNodeList
this.infoList.forEach(element => {
console.log(element)
if(element?.items?.itemList?.length && element.items.itemList.length>1){
element.items.itemList.unshift({
"itemName":"",
"itemParty":"",
"itemImage":"http://wework.qpic.cn/bizmail/FruicVOxjeICicwecCNuv4BGgI7ia2c9icZHgeo86Z3e36FPApcJrX6BZg/0",
"itemUserId":"依次审批",
"itemStatus": 0,
"itemSpeech": '',
"itemOpTime": ''
})
}
});
this.$nextTick(()=> {
this.infoList.forEach((item,index) => {
if(this.infoList.length!==index+1 && document.getElementById('merchantItem'+index).offsetHeight){
this.lineHeight += document.getElementById('merchantItem'+index).offsetHeight
}
})
})
}
}) })
}, },
pushApproval(){
console.log(this.obj)
},
changeGift () { changeGift () {
let { id } = this.getQuery() let { id } = this.getQuery()
this.$router.replace({ name: 'gift.create', query: { id } }) this.$router.replace({ name: 'gift.create', query: { id } })
},
setApprovalStatus(id){
// 1-审批中;2-已同意;3-已驳回;4-已转审
return {0:'依次审批',1:'审批中',2:'审批同意',3:'已驳回',4:'已转审'}[id]
},
setStatusClass(id){
return {0:'moreApproval',1:'inApproval',2:'',3:'turnDown',4:'turnApproval'}[id]
},
dateFormat(dateTime, format = 'YYYY-MM-DD') {
if(dateTime===0) return '';
const date = new Date(dateTime*1000)
const config = {
YYYY: date.getFullYear(),
MM: appendZero(date.getMonth() + 1), //getMonth() 方法根据本地时间返回指定日期的月份(从 0 到 11)
DD: appendZero(date.getDate()),
HH: appendZero(date.getHours()),
mm: appendZero(date.getMinutes()),
ss: appendZero(date.getSeconds())
}
for (const key in config) {
format = format.replace(key, config[key])
}
return format
} }
} }
} }
...@@ -156,4 +267,120 @@ export default { ...@@ -156,4 +267,120 @@ export default {
<style scoped lang='scss'> <style scoped lang='scss'>
@import '@/assets/css/gift-detail.scss'; @import '@/assets/css/gift-detail.scss';
.submit-btn{
z-index: 3;
position: fixed;
bottom: 16px;
width: 100%;
height: auto;
display: flex;
div{
width: 175px;
height: 36px;
background: #3975c6;
box-shadow: 0px 2px 4px 0px rgba(57, 117, 198, 0.2);
border-radius: 21px;
color: #fff;
font-size: 14px;
box-sizing: border-box;
transition: all .5s;
}
}
.merchant-box {
position:relative;
padding: 10px 16px;
height: auto;
.title{
height: 20px;
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #666666;
line-height: 20px;
margin-bottom: 10px;
}
.connect {
top: 62px;
left: 26px;
position:absolute;
width: 1px;
background-color: #ececec;
z-index: 1;
}
.merchant-item {
display: flex;
padding: 12px 0 20px;
box-sizing: border-box;
.fake-img{
z-index: 2;
img{
width: 20px;
height: 20px;
border-radius: 50%;
}
}
.real-img{
margin: 0 10px 0 12px;
img{
width: 50px;
height: 50px;
}
}
.info-area{
display: flex;
flex-direction: column;
flex: 1;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
.info{
display: flex;
justify-content: space-between;
align-items: center;
height: 25px;
.name-status{
display: flex;
align-items: center;
.name{
font-size: 17px;
color: #000000;
margin-right: 5px;
}
.status{
font-size: 12px;
color: #50A97F;
}
.moreApproval{
color: #3975C6;
width: 56px;
height: 16px;
background: rgba(57, 117, 198, 0.15);
border-radius: 4px;
font-size: 10px;
display: inline-block;
text-align: center;
line-height: 16px;
}
.inApproval{
color: #3975C6;
}
.turnDown{
color: #F1515C;
}
}
.date{
font-size: 11px;
color: #9B9B9B;
}
}
.remark{
font-size: 14px;
color: #9B9B9B;
line-height: 25px;
}
}
}
}
</style> </style>
\ No newline at end of file \ No newline at end of file
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
</template> </template>
</van-swipe-cell> </van-swipe-cell>
</template> </template>
<template v-else> <template v-if="tabIndex == 1">
<div class="user-box flex"> <div class="user-box flex">
<div class="icon"> <div class="icon">
<img <img
...@@ -81,6 +81,20 @@ ...@@ -81,6 +81,20 @@
</div> </div>
<div class="time flex">{{new Date(i.receivedDate).format('yyyy-MM-dd hh:mm:ss')}}</div> <div class="time flex">{{new Date(i.receivedDate).format('yyyy-MM-dd hh:mm:ss')}}</div>
</template> </template>
<template v-if="tabIndex == 2">
<van-swipe-cell>
<div class="title flex">
{{i.name}}
</div>
<div class="content">
<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 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 class="text item-flex" v-if="i.approveStatus==3"><span class="nowrap">驳回原因:</span><div style="color: #F1515C;">{{i.approveExplain}}</div></div>
</div>
</van-swipe-cell>
</template>
</div> </div>
</template> </template>
</scroll-view> </scroll-view>
...@@ -126,7 +140,7 @@ export default { ...@@ -126,7 +140,7 @@ export default {
name: '', name: '',
data () { data () {
return { return {
tab: ['待领取', '已领取'], tab: ['待领取', '已领取', '审批中'],
name: '', name: '',
flag: false, flag: false,
tabIndex: 0, tabIndex: 0,
...@@ -145,31 +159,37 @@ export default { ...@@ -145,31 +159,37 @@ export default {
}) })
}, },
mounted () { mounted () {
this.getList('inApprove')
let { giftToast } = this let { giftToast } = this
if (giftToast) { if (giftToast) {
this.showToast(giftToast, () => { this.showToast(giftToast, () => {
this.getList() this.getList()
}) })
} else this.getList() } else this.getList()
wxConfig.init(['shareAppMessage']) wxConfig.init(['shareAppMessage'])
}, },
methods: { methods: {
getList () { getList (type) {
let { uuid } = this.getLocalStorage('dj_scrm_userInfo') let { uuid } = this.getLocalStorage('dj_scrm_userInfo')
let { pageNum, tabIndex, list, name, giftToast } = this let { pageNum, tabIndex, list, name, giftToast } = this
if (giftToast) this.giftToast = '' if (giftToast) this.giftToast = ''
this.showLoading() this.showLoading()
giftApi.getGiftList({ const apiFunc = (type==='inApprove'|| tabIndex === 2) ? giftApi.getInApproveGiftList : giftApi.getGiftList
apiFunc({
pageNum, pageNum,
name, name,
receivedFlag: tabIndex == 0 ? 1 : 2, receivedFlag: (type==='inApprove'|| tabIndex === 2) ? '' : (tabIndex == 0 ? 1 : 2),
staffUUID: uuid staffUUID: uuid
}).then(res => { }).then(res => {
this.hideLoading() this.hideLoading()
this.flag = true if(type==='inApprove'){
this.list = list.concat(res.list) this.$set(this.tab,2,`审批中(${res.total})`);
this.total = res.total }else{
this.flag = true
this.list = list.concat(res.list)
this.total = res.total
if(tabIndex === 2) this.$set(this.tab,2,`审批中(${res.total})`);
}
console.log(res) console.log(res)
}) })
}, },
...@@ -211,8 +231,14 @@ export default { ...@@ -211,8 +231,14 @@ export default {
this.pageNum = pageNum + 1 this.pageNum = pageNum + 1
this.getList() this.getList()
}, },
jump ({ id }) { jump (item) {
this.$router.push({ name: 'gift.detail', query: { id } }) const params = {id : item.id}
if(this.tabIndex==2){
params.approveStatus = item.approveStatus
}else{
params.approveStatus = 0
}
this.$router.push({ name: 'gift.detail', query: params })
}, },
getMiniParams (e) { getMiniParams (e) {
let { merchantId, sapCode } = this.getLocalStorage('dj_scrm_userInfo') let { merchantId, sapCode } = this.getLocalStorage('dj_scrm_userInfo')
...@@ -387,6 +413,36 @@ export default { ...@@ -387,6 +413,36 @@ export default {
color: #999999; color: #999999;
} }
} }
.type-2{
.title {
min-height: 19px;
font-size: 14px;
font-weight: 500;
color: #282829;
padding: 16px 16px 10px;
border-bottom: 1px solid rgba(195, 195, 195, 0.3);
}
.content {
padding: 10px 16px 16px;
.item-flex{
display: flex;
.nowrap{
white-space: nowrap;
}
}
.text{
font-family: PingFangSC-Regular;
font-size: 12px;
color: #999999;
line-height: 16px;
font-weight: 400;
margin-bottom: 10px;
&:last-child{
margin-bottom: 0;
}
}
}
}
.btn { .btn {
position: fixed; position: fixed;
bottom: 40px; bottom: 40px;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!