Commit 71f28655 by xinla

--no commit message

1 parent 4a89aaec
......@@ -123,6 +123,22 @@ export function receiveRedPacket(params) {
}
/**
* 校验客户是否已领取过红包
* @param {*}
{
"orderNo": "1494182309006471169", // 订单id
"openId": "76", // 客户公众号id
}
* @returns 返回true的时候客户已领取过红包,false客户未领取红包
*/
export function getReceiveStatus(params) {
return request({
url: service + '/checkRecevieRedEnvelopes',
params,
})
}
/**
* 红包领取列表
* @param {*}
{
......
<script>
import { receiveRedPacket, getReceiveList, getRedPacketInfo } from '@/api/redPacket.js'
import {
receiveRedPacket,
getReceiveList,
getRedPacketInfo,
getReceiveStatus,
} from '@/api/redPacket.js'
import { param2Obj, getWxCode } from '@/utils/index.js'
export default {
name: '',
......@@ -50,6 +55,7 @@ export default {
if (openId) {
this.openId = openId
this.getRedPacketInfo()
this.getReceiveStatus()
} else {
this.$toast.clear()
}
......@@ -65,8 +71,15 @@ export default {
Object.assign(query, hash)
this.redPacket = query
Object.assign(this.redPacket, data)
this.$toast.clear()
})
},
getReceiveStatus() {
let form = {
orderNo: this.redPacket.orderId, // 订单id
openId: this.openId, // 客户公众号id
}
getReceiveStatus(form).then(({ data }) => {
data && this.getReceiveList(true)
})
},
receive() {
......@@ -85,33 +98,46 @@ export default {
chatId: this.redPacket.chatId, // 客户企微id
externalUserid: this.redPacket.externalUserid, // 客户企微id
}
receiveRedPacket(form)
.then((data) => {
if (data.code === 200) {
return getReceiveList(form)
} else {
this.errorMsg = data.msg
this.$toast.clear()
return Promise.reject()
}
receiveRedPacket(form).then((data) => {
if (data.code === 200) {
return this.getReceiveList()
} else {
this.errorMsg = data.msg
this.$toast.clear()
// return Promise.reject()
}
})
},
getReceiveList(isOpened) {
let form = {
orderNo: this.redPacket.orderId, // 订单id
openId: this.openId, // 客户公众号id
appId: window.CONFIG.appId, // 微信公众号id
chatId: this.redPacket.chatId, // 客户群企微id
externalUserid: this.redPacket.externalUserid, // 客户企微id
}
getReceiveList(form).then(({ data }) => {
data.currentAcceptMoney /= 100
data.totalMoney /= 100
data.accpectMoney /= 100
data.accpestCustomerList.forEach((element) => {
element.accpectMoney /= 100
})
.then(({ data }) => {
data.currentAcceptMoney /= 100
data.totalMoney /= 100
data.accpectMoney /= 100
data.accpestCustomerList.forEach((element) => {
element.accpectMoney /= 100
})
this.$toast.clear()
if (isOpened) {
this.opened = true
Object.assign(this.redPacket, data)
} else {
this.$refs.audio.play()
this.$toast.clear()
this.animate = true
setTimeout(() => {
this.opened = true
Object.assign(this.redPacket, data)
}, 1500)
})
}
})
},
dateFormat(value) {
return value.substring(0, 19).replace(/[T]/g, ' ')
},
......
# 测试环境配置
ENV = 'test'
# 打包环境变量
NODE_ENV = 'production'
# 运行环境变量
VUE_APP_ENV = 'test'
# 基础api
VUE_APP_DOMAIN = 'http://demo.linkwechat.cn'
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!