Commit 6f47f1f5 by 前端

Merge branch 'zhangquan_dev_v2.0.0' into 'master'

封版 zhangquan_dev_2.0.0 ---> master

See merge request !1
2 parents 97f63eed eb911c42
......@@ -11,6 +11,23 @@ export default {
data
})
},
/** 获取审批中列表 */
getInApproveGiftList (data) {
data.method = 'scrm.api.coupon.weChat.directional.gift.approve.in.list'
data.pageSize = pageSize
return window.$HTTP({
url,
data
})
},
/** 获取审批中列表 */
toApproveById (data) {
data.method = 'scrm.api.coupon.directional.gift.commit.approve'
return window.$HTTP({
url,
data
})
},
/** 根据id删除定向礼包 */
deleteGift (data) {
data.method = 'scrm.api.coupon.directional.gift.delete'
......
......@@ -225,6 +225,14 @@ const WxConfig = {
})
},
onHistoryBack () {
return new Promise(resolve => {
wx.onHistoryBack(function(res){
resolve(res)
})
})
},
/**获取本地图片接口 */
getLocalImgData (localId) {
return new Promise((resolve, reject) => {
......@@ -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
......@@ -58,6 +58,9 @@ export default {
click (tabIndex) {
this.tabIndex = tabIndex
this.$emit('change', tabIndex)
},
handleChange(id){
this.tabIndex = id
}
}
}
......
......@@ -38,7 +38,7 @@ Vue.prototype.to = function (name, params) {
import VConsole from 'vconsole'
const isMock = ['prod'].includes(process.env.NODE_ENV)
const isMock = ['prod','production'].includes(process.env.NODE_ENV)
fetchConfig(!isMock).then(res => {
// 从配置服务器获取动态配置
// 设置 js中可以访问 $cdn
......
export const setApproveParam = res =>{
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`
})
const param = {
"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==null ? '': giveReason ,
},
]
}
}
console.log(param,'param')
return param;
}
\ No newline at end of file
......@@ -131,8 +131,9 @@
<script type='text/ecmascript-6'>
import GiftModal from './GiftModal.vue'
import { giftApi } from '@/api'
import { giftApi, wxConfig} from '@/api'
import { discountTypeMixin } from '@/mixins'
import { setApproveParam } from '@/mixins/giftMixin'
export default {
name: '',
components: { GiftModal },
......@@ -161,6 +162,7 @@ export default {
this.id = id
}
else this.flag = true
wxConfig.init(['thirdPartyOpenPage','onHistoryBack'])
},
methods: {
input (i, e) {
......@@ -283,12 +285,25 @@ export default {
couponCreateRequests,
receiveDetails: obj.receiveWay == 1 ? obj.phone : obj.vin
}
if (id) params.id = id
if (id){
params.id = id
}
params.requestSource = 2
this.showLoading('提交中...')
giftApi.createOrupdataGift(params).then(res => {
this.hideLoading()
this.$route.params.giftToast = `${id ? '修改' : '创建'}成功`
this.$router.back()
if(res.approveFlag ===2){
wxConfig.thirdPartyOpenPage(setApproveParam(res))
.then((resp) => {
console.log(resp,'已发起审批')
setTimeout(()=>{
this.$router.replace({ name: 'gift.detail', query: {id:res.directionalGiftId,approveStatus:999}})
},500)
})
}else{
this.$route.params.giftToast = `${id ? '修改' : '创建'}成功`
this.$router.back()
}
})
}
}
......
......@@ -90,32 +90,87 @@
{{obj.giveReason || '-'}}
</div>
</div>
<template v-if="obj.receivedFlag == 1">
<!-- <template v-if="obj.receivedFlag == 1 && approveStatus!=1">
<div
style="z-index:4;"
class="btn text-center x-center"
@click="changeGift"
>修改</div>
</template>
</template> -->
<div class="box merchant-box" v-if="isShowApprovalDetail">
<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) ? '5px':'12px'}" class="merchant-item">
<div class="fake-img" v-if="pItem.items.itemList.length<2 || sonId===0">
<img v-if="pItem.avtive" src="../../assets/images/icon/active_avatar.png" alt="">
<img v-else src="../../assets/images/icon/unactive_avatar.png" alt="">
</div>
<div class="real-img" :style="{'margin-left' : (pItem.items.itemList.length>1 && sonId>0) ? '42px':'12px' }">
<img v-if="sonItem.itemStatus ===0" src="../../assets/images/icon/more_avatar.png" alt="">
<img v-else-if="sonItem.itemImage" :src="sonItem.itemImage" 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 class="info-area">
<div class="info">
<span class="name-status">
<span class="name">{{setName(sonItem.itemName)}}</span>
<span class="status" :class="setStatusClass(sonItem.itemStatus)">{{setApprovalStatus(sonItem.itemStatus)}}</span>
</span>
<span class="date">{{dateFormat(sonItem.itemOpTime,'YYYY/MM/DD HH:mm')}}</span>
</div>
<div class="remark">{{ sonItem.itemSpeech || '' }}</div>
</div>
</div>
</div>
</div>
</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>
</template>
<script type='text/ecmascript-6'>
import { giftApi } from '@/api'
function appendZero(int) {
if (int < 10) {
return '0' + `${int}`
} else {
return int
}
}
import { giftApi,wxConfig } from '@/api'
import { discountTypeMixin } from '@/mixins'
import { setApproveParam } from '@/mixins/giftMixin'
export default {
name: '',
mixins: [discountTypeMixin],
data () {
return {
infoList:[],
flag: false,
obj: {},
total: 0
total: 0,
lineHeight:0,
approveStatus: 0,
isShowApprovalDetail: true
}
},
mounted () {
const {approveStatus} = this.getQuery()
this.approveStatus = approveStatus
this.showLoading()
this.getDetail()
wxConfig.init(['thirdPartyOpenPage'])
},
methods: {
setCouponData (res) {
......@@ -144,11 +199,97 @@ export default {
res = this.setCouponData(res)
this.flag = true
this.obj = res
if(res.approveUserInfo==null && res.weChatOpenApprovalDataResponse==null){
this.isShowApprovalDetail = false
}
if(res?.weChatOpenApprovalDataResponse!=null){
if(res?.weChatOpenApprovalDataResponse?.data?.approvalNodes?.approvalNodeList){
this.infoList = res.weChatOpenApprovalDataResponse.data.approvalNodes.approvalNodeList
let avtiveFlag = true
this.infoList.forEach(element => {
if(avtiveFlag){
element.avtive = true
if(element.nodeStatus ===1 || element.nodeStatus ===3) avtiveFlag =false;
}else{
element.avtive = false
}
if(element.nodeType==2){
element.items.itemList.unshift({
"itemName":"",
"itemParty":"",
"itemImage":"http://wework.qpic.cn/bizmail/FruicVOxjeICicwecCNuv4BGgI7ia2c9icZHgeo86Z3e36FPApcJrX6BZg/0",
"itemUserId":"依次审批",
"itemStatus": 0,
"itemSpeech": '',
"itemOpTime": ''
})
}
});
}
}else if(res.approveUserInfo!=null){
const {name:itemName, image:itemImage, status:itemStatus, opTime:itemOpTime} = res.approveUserInfo
const targetObj = {
nodeType:'1',
nodeStatus: itemStatus,
avtive:true,
items:{itemList:[{itemName, itemImage, itemStatus,itemOpTime: parseInt(parseInt(itemOpTime)/1000)}]}
}
this.infoList.push(targetObj)
}
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(){
let { id } = this.getQuery()
giftApi.toApproveById({id}).then(res => {
if(res.approveFlag ===2){
wxConfig.thirdPartyOpenPage(setApproveParam(res))
.then((resp) => {
console.log(resp,'已发起审批')
})
}else{
this.showToast('礼包已提交审批,请勿重复提交!')
}
})
},
changeGift () {
let { id } = this.getQuery()
this.$router.replace({ name: 'gift.create', query: { id } })
},
setApprovalStatus(id){
// 1-审批中;2-已同意;3-已驳回;4-已转审
return {0:'依次审批',1:'审批中',2:'审批同意',3:'已驳回',4:'已转审'}[id]
},
setName(name){
if(!name) return '';
return name.length>4 ? name.slice(0,4) + '...' : name
},
setStatusClass(id){
return {0:'moreApproval',1:'inApproval',2:'',3:'turnDown',4:'turnApproval'}[id]
},
dateFormat(dateTime, format = 'YYYY-MM-DD') {
if(!dateTime) 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 +297,127 @@ export default {
<style scoped lang='scss'>
@import '@/assets/css/gift-detail.scss';
.submit-btn{
z-index: 3;
position: fixed;
bottom: 16px;
left: 0;
width: 100%;
justify-content: space-around;
height: auto;
display: flex;
.white{
background-color: #fff;
color: #323233;
border: 1px solid #DCDEE0;
}
div{
width: 160px;
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: 36px;
height: 36px;
}
}
.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;
height: 18px;
line-height: 18px;
.name-status{
display: flex;
align-items: center;
.name{
font-size: 14px;
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: 12px;
color: #9B9B9B;
line-height: 18px;
}
}
}
}
</style>
\ No newline at end of file
<template>
<div class="index">
<search-box
<search-box class="search"
@search="search"
:keyword="name"
:showDropdown="false"
......@@ -9,6 +9,7 @@
<tab
:list="tab"
@change="change"
ref="myTab"
/>
<template v-if="flag">
<template v-if="list.length">
......@@ -35,12 +36,10 @@
</div>
<div class="info">
<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
class="qr-text"
@click.stop="createQr(i)"
>领取二维码</div>
</div>
<template #right>
<van-button
......@@ -53,7 +52,7 @@
</template>
</van-swipe-cell>
</template>
<template v-else>
<template v-if="tabIndex == 1">
<div class="user-box flex">
<div class="icon">
<img
......@@ -81,6 +80,28 @@
</div>
<div class="time flex">{{new Date(i.receivedDate).format('yyyy-MM-dd hh:mm:ss')}}</div>
</template>
<template v-if="tabIndex == 2">
<van-swipe-cell>
<div class="title flex">
<span>{{i.name}}</span>
<span v-if="i.approveStatus==5" class="approve-btn" @click.stop="toAppprove(i)">
发起审批
</span>
</div>
<div class="content">
<div class="text item-flex"><span class="nowrap">备注名称:</span><div>{{i.remarkName}}</div></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 v-if="i.approveStatus==1 || i.approveStatus==3" class="text item-flex">
<span class="nowrap">审批状态:</span>
<div>
<span :style="{color: i.approveStatus==1 ? '#3975C6':'#F1515C','margin-right':'5px'}">{{i.approveStatus==1 ? '审批中' : '已驳回'}}</span>({{i.approveBy}})
</div>
</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>
</template>
</scroll-view>
......@@ -122,11 +143,12 @@
<script type='text/ecmascript-6'>
import { giftApi, wxConfig } from '@/api'
import { setApproveParam } from '@/mixins/giftMixin'
export default {
name: '',
data () {
return {
tab: ['待领取', '已领取'],
tab: ['待领取', '已领取', '审批中'],
name: '',
flag: false,
tabIndex: 0,
......@@ -140,37 +162,62 @@ export default {
},
beforeRouteEnter (to, from, next) {
let { params: { giftToast } } = from
const { query: { approveStatus } } = from
next(vm =>{
if (giftToast) vm.giftToast = giftToast
if (giftToast) vm.giftToast = giftToast;
if(approveStatus) {
vm.handleChangeTab(2)
vm.change(2)
}
})
},
mounted () {
this.getList('inApprove')
let { giftToast } = this
if (giftToast) {
this.showToast(giftToast, () => {
this.getList()
})
} else this.getList()
wxConfig.init(['shareAppMessage'])
wxConfig.init(['shareAppMessage','thirdPartyOpenPage'])
},
methods: {
getList () {
toAppprove({id}){
giftApi.toApproveById({id}).then(res => {
if(res.approveFlag ===2){
wxConfig.thirdPartyOpenPage(setApproveParam(res))
.then((resp) => {
console.log(resp,'已发起审批')
})
}else{
this.showToast('礼包已提交审批,请勿重复提交!')
}
})
},
handleChangeTab(id){
this.$refs.myTab.handleChange(id)
},
getList (type) {
let { uuid } = this.getLocalStorage('dj_scrm_userInfo')
let { pageNum, tabIndex, list, name, giftToast } = this
if (giftToast) this.giftToast = ''
this.showLoading()
giftApi.getGiftList({
const apiFunc = (type==='inApprove'|| tabIndex === 2) ? giftApi.getInApproveGiftList : giftApi.getGiftList
apiFunc({
pageNum,
name,
receivedFlag: tabIndex == 0 ? 1 : 2,
receivedFlag: (type==='inApprove'|| tabIndex === 2) ? '' : (tabIndex == 0 ? 1 : 2),
staffUUID: uuid
}).then(res => {
this.hideLoading()
this.flag = true
this.list = list.concat(res.list)
this.total = res.total
console.log(res)
if(type==='inApprove'){
this.$set(this.tab,2,`审批中(${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})`);
}
})
},
search (e) {
......@@ -211,8 +258,14 @@ export default {
this.pageNum = pageNum + 1
this.getList()
},
jump ({ id }) {
this.$router.push({ name: 'gift.detail', query: { id } })
jump (item) {
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) {
let { merchantId, sapCode } = this.getLocalStorage('dj_scrm_userInfo')
......@@ -234,7 +287,6 @@ export default {
appId
})
.then(link => {
console.log(link)
wxConfig
.shareAppMessage({
title: e.name,
......@@ -273,6 +325,11 @@ export default {
</script>
<style scoped lang='scss'>
/deep/ .search{
.van-icon{
color: #CDD1D4;
}
}
.list-box {
height: calc(100vh - 100px);
.item {
......@@ -323,18 +380,39 @@ export default {
.info {
font-size: 12px;
color: #999999;
position: relative;
.text {
line-height: 16px;
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 {
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;
}
}
.qr-text {
font-size: 12px;
right: 10px;
bottom: 16px;
color: #3975c6;
position: absolute;
}
}
}
}
......@@ -387,6 +465,57 @@ export default {
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);
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 {
padding: 10px 16px 16px;
.item-flex{
display: flex;
.nowrap{
white-space: nowrap;
}
.text-overflow{
white-space:nowrap;
text-overflow:ellipsis;
-o-text-overflow:ellipsis;
overflow:hidden;
}
}
.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 {
position: fixed;
bottom: 40px;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!