Commit 31ce98f4 by xinla

--no commit message

1 parent 21fc1735
const config = { const config = {
/** appId: 'wx863c031a74f589a0', // 微信公众号id
* @description token在Cookie中存储的天数,默认1天 cookieExpires: 1, //token在Cookie中存储的天数,默认1天
*/ homeName: 'home', //默认打开的首页的路由name值,默认为home
cookieExpires: 1, services = {
/**
* @description 默认打开的首页的路由name值,默认为home
*/
homeName: 'home',
}
config.services = {
wecom: '/wecom', wecom: '/wecom',
}
} }
export default config export default config
...@@ -56,7 +56,7 @@ export function getQueryValue(name) { ...@@ -56,7 +56,7 @@ export function getQueryValue(name) {
return '' return ''
} }
export function getWxCode() { export async function getWxCode() {
let userinfo = localStorage.getItem('userinfo') let userinfo = localStorage.getItem('userinfo')
//取缓存中的用户信息 //取缓存中的用户信息
if (userinfo) { if (userinfo) {
...@@ -86,13 +86,12 @@ export function getWxCode() { ...@@ -86,13 +86,12 @@ export function getWxCode() {
// window.location.href = // window.location.href =
// `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${encodeURIComponent(local)}&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect`; // `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${encodeURIComponent(local)}&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect`;
} }
// getUserOpenid(code) let { data } = getUserOpenid(code)
// .then(({ data }) => { if (data && data.openId) {
// if (data && data.openId) { localStorage.setItem('userinfo', JSON.stringify(data))
// localStorage.setItem('userinfo', JSON.stringify(data)) return data.openId
// return getWechatUserInfo(data.openId) // return getWechatUserInfo(data.openId)
// } }
// })
// .then(({ data }) => { // .then(({ data }) => {
// let unionId = data.unionId // let unionId = data.unionId
// }) // })
......
...@@ -27,7 +27,7 @@ export default { ...@@ -27,7 +27,7 @@ export default {
methods: { methods: {
getWxCode() { getWxCode() {
try { try {
let appid = 'wx863c031a74f589a0' // 公众号appid let appid = window.CONFIG.appId // 公众号appid
// let appid = 'wx8bfe6bc2ca5c45ae' // 公众号appid // let appid = 'wx8bfe6bc2ca5c45ae' // 公众号appid
alert(2) alert(2)
let code = getQueryValue('code') //是否存在code let code = getQueryValue('code') //是否存在code
......
<script> <script>
import { import { getList } from '@/api/redPacket.js'
getList,
sendCustomerPersonalRedPacket,
sendCustomerEnterpriseRedPacket,
sendCustomerGroupPersonalRedPacket,
sendCustomerGroupEnterpriseRedPacket,
} from '@/api/redPacket.js'
import { obj2query, param2Obj } from '@/utils/index.js' import { obj2query, param2Obj } from '@/utils/index.js'
export default { export default {
name: '', name: '',
...@@ -85,6 +79,7 @@ export default { ...@@ -85,6 +79,7 @@ export default {
wx.invoke('getCurExternalContact', {}, (res) => { wx.invoke('getCurExternalContact', {}, (res) => {
if (res.err_msg == 'getCurExternalContact:ok') { if (res.err_msg == 'getCurExternalContact:ok') {
that.form.externalUserid = res.userId //返回当前外部联系人userId that.form.externalUserid = res.userId //返回当前外部联系人userId
that.form.chatId = res.chatId //返回当前客户群的群聊ID
} else { } else {
//错误处理 //错误处理
that.$dialog({ message: '进入失败:' + JSON.stringify(res) }) that.$dialog({ message: '进入失败:' + JSON.stringify(res) })
...@@ -129,8 +124,8 @@ export default { ...@@ -129,8 +124,8 @@ export default {
this.loadFail = true this.loadFail = true
}) })
}, },
showDialog(type, row) { showDialog(type, row = {}) {
this.form = Object.assign({ redEnvelopeAmount: row.money }, row || {}) this.form = { redEnvelopeAmount: row.money, redenvelopesId: row.id }
this.redPacketType = type this.redPacketType = type
this.visible = true this.visible = true
}, },
...@@ -142,14 +137,13 @@ export default { ...@@ -142,14 +137,13 @@ export default {
let mes = {} let mes = {}
try { try {
let form = Object.assign({}, this.form) let form = Object.assign({}, this.form)
form.sendUserId = this.userId
// 单位换算 元转分 // 单位换算 元转分
form.redEnvelopeAmount *= 100 form.redEnvelopeAmount *= 100
let query = param2Obj(window.location.search) let query = param2Obj(window.location.search)
let hash = param2Obj(window.location.hash) let hash = param2Obj(window.location.hash)
Object.assign( Object.assign(
form, form,
{ sceneType: this.sceneType, redPacketType: this.redPacketType }, { sendUserId: this.userId, sceneType: this.sceneType, redPacketType: this.redPacketType },
query, query,
hash hash
) )
......
...@@ -16,6 +16,12 @@ export default { ...@@ -16,6 +16,12 @@ export default {
list: [], list: [],
opened: false, opened: false,
redPacket: {}, redPacket: {},
form: {
orderNo: '', // 订单id
openId: '', // 客户公众号id
appId: window.CONFIG.appId, // 微信公众号id
externalUserid: '', // 客户企微id
},
} }
}, },
computed: {}, computed: {},
...@@ -27,31 +33,31 @@ export default { ...@@ -27,31 +33,31 @@ export default {
mounted() {}, mounted() {},
methods: { methods: {
init() { init() {
getWxCode() getWxCode().then((openId) => (this.form.openId = openId))
}, },
sendRedPacket() { sendRedPacket() {
this.$toast.loading({ this.$toast.loading({
duration: 0, duration: 0,
forbidClick: true, forbidClick: true,
}) })
let form = {}
let query = param2Obj(window.location.search) let query = param2Obj(window.location.search)
let hash = param2Obj(window.location.hash) let hash = param2Obj(window.location.hash)
Object.assign(form, query, hash) Object.assign(query, hash)
this.redPacket = form this.redPacket = query
this.form.externalUserid = query.externalUserid
let request = '' let request = ''
if (form.sceneType == 1) { if (query.sceneType == 1) {
request = { request = {
personal: sendCustomerPersonalRedPacket, personal: sendCustomerPersonalRedPacket,
enterprise: sendCustomerEnterpriseRedPacket, enterprise: sendCustomerEnterpriseRedPacket,
}[form.redPacketType] }[query.redPacketType]
} else { } else {
request = { request = {
personal: sendCustomerGroupPersonalRedPacket, personal: sendCustomerGroupPersonalRedPacket,
enterprise: sendCustomerGroupEnterpriseRedPacket, enterprise: sendCustomerGroupEnterpriseRedPacket,
}[form.redPacketType] }[query.redPacketType]
} }
request(form).then((res) => { request(query).then((res) => {
this.$toast.clear() this.$toast.clear()
}) })
}, },
......
...@@ -8,8 +8,8 @@ export function getUrlParam(name) { ...@@ -8,8 +8,8 @@ export function getUrlParam(name) {
return null return null
} }
export function getWxCode() { export function getWxCode() {
let appid = 'wx863c031a74f589a0' // 公众号appid // let appid = 'wx863c031a74f589a0' // 公众号appid
// let appid = 'wx8bfe6bc2ca5c45ae' // 公众号appid let appid = 'wx8bfe6bc2ca5c45ae' // 公众号appid
let code = getUrlParam('code') //是否存在code let code = getUrlParam('code') //是否存在code
let local = window.location.origin.includes('localhost') let local = window.location.origin.includes('localhost')
? 'http://h5.linkwechat.cn/test.html' ? 'http://h5.linkwechat.cn/test.html'
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!