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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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