This commit is contained in:
wtq
2025-12-16 10:37:42 +08:00
parent cba285c943
commit a5b303c73c
8 changed files with 189 additions and 185 deletions

View File

@@ -144,80 +144,80 @@ function useGlobalFunc() {
success?: Function
}
function appWxLogin(options: appWxLoginType) {
uni.getProvider({
service: 'share',
success: function (res) {
// res.provider[0] === 'weixin' ? 微信已经安装 : 微信尚未安装
if(res.provider[0] == 'weixin'){
// 微信开放平台的应用标识
// 预登录
let weixinService: AnyObject
plus.oauth.getServices((services) => {
if (services && services.length) {
for (var i = 0, len = services.length; i < len; i++) {
if (services[i].id === 'weixin') {
weixinService = services[i]
break
}
}
// 如果没有获取到微信服务,则退出授权
if (!weixinService) {
return uni.jxAlert({
title: '登录失败',
content: '请先下载微信',
})
}
// uni.getProvider({
// service: 'share',
// success: function (res) {
// // res.provider[0] === 'weixin' ? 微信已经安装 : 微信尚未安装
// if(res.provider[0] == 'weixin'){
// // 微信开放平台的应用标识
// // 预登录
// let weixinService: AnyObject
// plus.oauth.getServices((services) => {
// if (services && services.length) {
// for (var i = 0, len = services.length; i < len; i++) {
// if (services[i].id === 'weixin') {
// weixinService = services[i]
// break
// }
// }
// // 如果没有获取到微信服务,则退出授权
// if (!weixinService) {
// return uni.jxAlert({
// title: '登录失败',
// content: '请先下载微信',
// })
// }
// 进行微信授权,拿到 code
weixinService.authorize(async (event: AnyObject) => {
//此处获取code的关键
let data = {
authType: "weixinapp",
authSecret: event.code,
}
// event.code 发给后端验证,验证成功后处理业务
let res = await login.applets_login(data)
console.log('ZSW-res', res);
if (res.code == 0) {
// 第一次登录绑定手机号码
if (res.data.tokenType == 2) {
options.bangding && options.bangding(res.data.token)
}
// // 进行微信授权,拿到 code
// weixinService.authorize(async (event: AnyObject) => {
// //此处获取code的关键
// let data = {
// authType: "weixinapp",
// authSecret: event.code,
// }
// // event.code 发给后端验证,验证成功后处理业务
// let res = await login.applets_login(data)
// console.log('ZSW-res', res);
// if (res.code == 0) {
// // 第一次登录绑定手机号码
// if (res.data.tokenType == 2) {
// options.bangding && options.bangding(res.data.token)
// }
// 登录成功
if (res.data.tokenType != 2) {
options.success && options.success(res.data)
}
} else {
if ((res.desc).indexOf('row') == -1) {
uni.jxAlert({
title: '提示',
content: `登录失败:${res.desc || res.data}`
})
} else {
uni.jxAlert({
title: '提示',
content: `登录失败:对不起该账号未绑定门店,请联系官方客服进行绑定!`
})
}
// // 登录成功
// if (res.data.tokenType != 2) {
// options.success && options.success(res.data)
// }
// } else {
// if ((res.desc).indexOf('row') == -1) {
// uni.jxAlert({
// title: '提示',
// content: `登录失败:${res.desc || res.data}`
// })
// } else {
// uni.jxAlert({
// title: '提示',
// content: `登录失败:对不起该账号未绑定门店,请联系官方客服进行绑定!`
// })
// }
}
})
} else {
uni.jxAlert({
title: '提示',
content: '本机不支持微信登录',
})
}
})
}else{
uni.jxAlert({
title: '提示',
content: '请先下载微信',
})
}
}
})
// }
// })
// } else {
// uni.jxAlert({
// title: '提示',
// content: '本机不支持微信登录',
// })
// }
// })
// }else{
// uni.jxAlert({
// title: '提示',
// content: '请先下载微信',
// })
// }
// }
// })
// if (plus.runtime.isApplicationExist({ pname: 'com.tencent.mm', action: 'weixin://' })) { // 判断用户是否安装了微信
// // 微信开放平台的应用标识
@@ -375,42 +375,42 @@ function useGlobalFunc() {
* @param {string} [id] 小程序原始ID
*/
function openWeixin(url: string, id = 'gh_e9161397303e') {
uni.getProvider({
service: 'share',
success: function (res) {
// res.provider[0] === 'weixin' ? 微信已经安装 : 微信尚未安装
// isInstallWx.value = res.provider[0] == 'weixin' ? true : false
if(res.provider[0] == 'weixin'){
// 跳转到微信小程序进行物料申请
plus.share.getServices(function (res) {
var sweixin = null;
for (var i = 0; i < res.length; i++) {
var t: AnyObject = res[i];
if (t.id == 'weixin') {
sweixin = t;
}
}
if (sweixin) {
sweixin.launchMiniProgram({
id: id, //这里写你的小程序原始id以gh开头
type: 0, //这里是不同的环境( 0-正式版; 1-测试版; 2-体验版。 默认值为0。
path: url, //这里是指 定页的路径,如需传参直接字符串拼接(首页可以省略)
});
}
}, function (res) {
uni.jxAlert({
title: '提示',
content: '打开小程序失败',
})
});
}else{
uni.jxAlert({
title: '温馨提示',
content: '请先下载微信',
})
}
}
})
// uni.getProvider({
// service: 'share',
// success: function (res) {
// // res.provider[0] === 'weixin' ? 微信已经安装 : 微信尚未安装
// // isInstallWx.value = res.provider[0] == 'weixin' ? true : false
// if(res.provider[0] == 'weixin'){
// // 跳转到微信小程序进行物料申请
// plus.share.getServices(function (res) {
// var sweixin = null;
// for (var i = 0; i < res.length; i++) {
// var t: AnyObject = res[i];
// if (t.id == 'weixin') {
// sweixin = t;
// }
// }
// if (sweixin) {
// sweixin.launchMiniProgram({
// id: id, //这里写你的小程序原始id以gh开头
// type: 0, //这里是不同的环境( 0-正式版; 1-测试版; 2-体验版。 默认值为0。
// path: url, //这里是指 定页的路径,如需传参直接字符串拼接(首页可以省略)
// });
// }
// }, function (res) {
// uni.jxAlert({
// title: '提示',
// content: '打开小程序失败',
// })
// });
// }else{
// uni.jxAlert({
// title: '温馨提示',
// content: '请先下载微信',
// })
// }
// }
// })
// if (plus.runtime.isApplicationExist({ pname: 'com.tencent.mm', action: 'weixin://' })) { // 判断用户是否安装了微信
// // 跳转到微信小程序进行物料申请
// plus.share.getServices(function (res) {

View File

@@ -239,17 +239,17 @@
"navigationBarTitleText": "扫码进店"
}
},
{
"path": "enterGroupChat/enterGroupChat",
"style": {
"navigationBarTitleText": "进入群聊",
"mp-weixin": {
"usingComponents": {
"cell": "plugin://chatGroupPlugin/cell"
}
}
}
},
// {
// "path": "enterGroupChat/enterGroupChat",
// "style": {
// "navigationBarTitleText": "进入群聊",
// "mp-weixin": {
// "usingComponents": {
// "cell": "plugin://chatGroupPlugin/cell"
// }
// }
// }
// },
{
"path": "message/message",
"style": {
@@ -274,12 +274,12 @@
"navigationBarTitleText": "设置"
}
},
{
"path": "printerSetUp/printerSetUp",
"style": {
"navigationBarTitleText": "蓝牙打印机设置"
}
},
// {
// "path": "printerSetUp/printerSetUp",
// "style": {
// "navigationBarTitleText": "蓝牙打印机设置"
// }
// },
{
"path": "businessLicense/businessLicense",
"style": {

View File

@@ -18,9 +18,9 @@ function options() {
/**
* 进入群聊
*/
function getGroupChat() {
openWeixin('subPages/merchantChild/enterGroupChat/enterGroupChat')
}
// function getGroupChat() {
// openWeixin('subPages/merchantChild/enterGroupChat/enterGroupChat')
// }
/**
* 注册时间
@@ -38,48 +38,49 @@ function options() {
}
/**
* 物料申请
*/
function moveToWM() {
let tel = store.state.storeInfo.allStoreInfo.marketManPhone ? store.state.storeInfo.allStoreInfo.marketManPhone : "18048531223"
if (getStorage('terrace') != 'jxcs') {
// 果园禁止物料跳转
uni.jxAlert({
title: '物料申请',
content: `非常抱歉,无法进入物料商城,请联系运营${tel}`
})
return
} else {
if (store.state.storeInfo.allStoreInfo.packageSwitch === 1) {
uni.jxAlert({
title: '物料申请',
content: `非常抱歉,无法进入物料商城,请联系运营${tel}`
})
return
}
}
// /**
// * 物料申请
// */
// function moveToWM() {
// let tel = store.state.storeInfo.allStoreInfo.marketManPhone ? store.state.storeInfo.allStoreInfo.marketManPhone : "18048531223"
// if (getStorage('terrace') != 'jxcs') {
// // 果园禁止物料跳转
// uni.jxAlert({
// title: '物料申请',
// content: `非常抱歉,无法进入物料商城,请联系运营${tel}`
// })
// return
// } else {
// if (store.state.storeInfo.allStoreInfo.packageSwitch === 1) {
// uni.jxAlert({
// title: '物料申请',
// content: `非常抱歉,无法进入物料商城,请联系运营${tel}`
// })
// return
// }
// }
if (store.state.storeInfo.storeStatus === -2) {
uni.jxAlert({
title: '物料申请',
content: '门店已被禁用,请联系运营'
})
}
openWeixin(`pages/index/index?storeID=666666&fromStoreID=${getStorage('storeID')}&storeType=c4`, 'gh_0d7e2243b51f')
}
// if (store.state.storeInfo.storeStatus === -2) {
// uni.jxAlert({
// title: '物料申请',
// content: '门店已被禁用,请联系运营'
// })
// }
// openWeixin(`pages/index/index?storeID=666666&fromStoreID=${getStorage('storeID')}&storeType=c4`, 'gh_0d7e2243b51f')
// }
/**
* 查询是否有新账单
*/
const isInstallWx = ref<boolean>(false) // 是否安装微信
onLoad(async () => {
uni.getProvider({
service: 'share',
success: function (res) {
// res.provider[0] === 'weixin' ? 微信已经安装 : 微信尚未安装
isInstallWx.value = res.provider[0] == 'weixin' ? true : false
}})
// uni.getProvider({
// service: 'share',
// success: function (res) {
// // res.provider[0] === 'weixin' ? 微信已经安装 : 微信尚未安装
// isInstallWx.value = res.provider[0] == 'weixin' ? true : false
// }})
// if (plus.runtime.isApplicationExist({ pname: 'com.tencent.mm', action: 'weixin://' })) {
// isInstallWx.value = true
// } else {
@@ -261,9 +262,9 @@ function options() {
return {
getGroupChat, // 跳转加入群聊
// getGroupChat, // 跳转加入群聊
getSelfInfo, // 获取门店来京西的时间
moveToWM, // 物料申请
// moveToWM, // 物料申请
newBillShow, // 是否有新账单
billList, // 账单列表
msgCount, // 是否有信息

View File

@@ -99,12 +99,13 @@
</template>
<script lang="ts" setup>
import { store } from '@/store';
import options from './options'
import { computed, ref } from 'vue'
const {
getGroupChat, // 跳转加入群聊
// getGroupChat, // 跳转加入群聊
getSelfInfo, // 获取门店来京西的时间
moveToWM, // 物料申请
// moveToWM, // 物料申请
newBillShow, // 是否有新订单
msgCount, // 是否有信息
billList, // 账单列表
@@ -276,9 +277,9 @@ const newGrindListData: AnyObject = computed(() => {
function grindData(title: number) {
switch (title) {
case 1:
getGroupChat() // 加入群聊
break
// case 1:
// getGroupChat() // 加入群聊
// break
case 2:
uni.navigateTo({
url: '/subPages/merchantChild/businessLicense/businessLicense',
@@ -305,7 +306,7 @@ function grindData(title: number) {
}) // 消息通知
break
case 7:
moveToWM()
// moveToWM()
break
case 8:
uni.navigateTo({

View File

@@ -50,13 +50,13 @@ const deliveryList = ref<Array<AnyObject>>([])
*/
const isInstallWx = ref<boolean>(false)
onShow(() => {
uni.getProvider({
service: 'share',
success: function (res) {
// res.provider[0] === 'weixin' ? 微信已经安装 : 微信尚未安装
isInstallWx.value = res.provider[0] == 'weixin' ? true : false
}
})
// uni.getProvider({
// service: 'share',
// success: function (res) {
// // res.provider[0] === 'weixin' ? 微信已经安装 : 微信尚未安装
// isInstallWx.value = res.provider[0] == 'weixin' ? true : false
// }
// })
// if (
// plus.runtime.isApplicationExist({

View File

@@ -431,12 +431,12 @@ function setUp() {
}
/**
* 蓝牙打印机设置
*/
function bluetoothPrinterSetUp() {
uni.navigateTo({ url: '/subPages/merchantChild/printerSetUp/printerSetUp' })
}
// /**
// * 蓝牙打印机设置
// */
// function bluetoothPrinterSetUp() {
// uni.navigateTo({ url: '/subPages/merchantChild/printerSetUp/printerSetUp' })
// }
/**
@@ -554,7 +554,7 @@ function setUp() {
copyRightFn, // 京西协议
// printerName, // 绑定的打印机品牌
// bindPrinter, // 绑定打印机
bluetoothPrinterSetUp, // 蓝牙打印机设置
// bluetoothPrinterSetUp, // 蓝牙打印机设置
switchUpc, // 是否打印Upc
newPrinterName, // 当前绑定打印机设备
DeletePrinterSeq, // 清空打印队列

View File

@@ -246,7 +246,7 @@ const {
copyRightFn, // 京西协议
// printerName, // 绑定的打印机品牌
// bindPrinter, // 绑定打印机
bluetoothPrinterSetUp, // 蓝牙打印机设置
// bluetoothPrinterSetUp, // 蓝牙打印机设置
switchUpc, // 是否打印Upc
newPrinterName, // 当前绑定打印机名字
DeletePrinterSeq, // 清空打印队列

View File

@@ -16,6 +16,8 @@ class Bluetooth {
}
//初始化蓝牙模块,检查蓝牙是否已打开
openBluetoothAdapter() {
return
return new Promise((resolve, reject) => {
uni.openBluetoothAdapter({
success: res => {