Merge remote-tracking branch 'origin/main'

main
zxf 1 week ago
commit 1babd09c72

@ -181,6 +181,33 @@ export function cancelBill(id) {
);
}
// 审核单据通过
export function auditBill(id) {
return request.get(
`autogencode/ckbill/auditBill/${id}`,
{},
{ useAdminUrl: true }
);
}
// 驳回单据
export function rejectBill(id) {
return request.get(
`autogencode/ckbill/rejectBill/${id}`,
{},
{ useAdminUrl: true }
);
}
// 撤销审核
export function cancelAuditBill(id) {
return request.get(
`autogencode/ckbill/cancelAuditBill/${id}`,
{},
{ useAdminUrl: true }
);
}
// 部门树
export function getDeptTree() {
return request.get(
@ -217,3 +244,12 @@ export function getAdminInfoByUid() {
);
}
// 绑定微信(对应后台 api/front/bindingWx
export function bindingWx(data) {
return request.post('bindingWx', data, { useAdminUrl: true });
}
// 解绑微信(对应后台 api/front/unbindWx
export function unbindWx(data) {
return request.post('unbindWx', data, { useAdminUrl: true });
}

@ -24,6 +24,19 @@ export function loginH5(data) {
return request.post("login", data, { noAuth : true });
}
/**
* 小程序公众号网页授权 code 换登录态后端待对接
* 约定 data{ token, uid } 已绑定直接登录{ needBind: true } 需使用账号密码绑定后再拿 token
*/
export function loginMpByGzhCode(code, spread_spid) {
void code;
void spread_spid;
// 对接后启用,并删除下方占位 reject
// return request.get('wechat/authorize/mp_gzh_login', { code, spread_spid: spread_spid || 0 }, { noAuth: true });
// 本地联调「需绑定」分支时可改为return Promise.resolve({ data: { needBind: true } });
return Promise.reject(new Error('MP_GZH_LOGIN_PENDING'));
}
/**
* h5用户手机号登录
* @param data object 用户手机号 也只能

@ -316,3 +316,35 @@ class AuthWechat {
export default new AuthWechat();
// #endif
/**
* 小程序内打开 web-view 完成公众号网页授权 H5 落地页通过 postMessage 回传 { code }
* redirect_uri / appid 请按实际公众号与业务域名配置
*/
export function wxGZHAuth() {
return new Promise((resolve, reject) => {
const redirectUri = encodeURIComponent('https://fzbfwy.com/login');
const url =
`https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx49d7d3aba9479a85&redirect_uri=${redirectUri}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`;
uni.navigateTo({
url: '/pages/webview/webview',
events: {
callbackData(data) {
// uni.navigateBack({ delta: 1 });
if (data && (data.code || typeof data === 'string')) {
resolve(typeof data === 'string' ? { code: data } : data);
} else {
reject(new Error('未获取到公众号授权 code'));
}
}
},
success(res) {
res.eventChannel.emit('acceptData', { url });
},
fail(err) {
reject(err || new Error('打开授权页失败'));
}
});
});
}

@ -968,6 +968,16 @@
"navigationBarTitleText": "精品推荐"
}
}]
},
{
"root": "pages/webview",
"name": "webview",
"pages": [{
"path": "webview",
"style": {
"navigationBarTitleText": "微信授权"
}
}]
}
],
"globalStyle": {

@ -20,7 +20,7 @@
</view>
<view class="form-item">
<text class="label">反馈图片</text>
<text class="label">处理图片</text>
<view class="upload-section">
<view class="upload-list">
<view
@ -67,7 +67,7 @@ export default {
open(item) {
this.currentItem = item;
this.form.handlerReslut = item.handlerReslut || '';
this.images = item.beforeProcessFiles && item.beforeProcessFiles.length ? [...item.beforeProcessFiles] : [];
this.images = item.afterProcessFiles && item.afterProcessFiles.length ? [...item.afterProcessFiles] : [];
this.$refs.popup.open();
},
close() {

@ -3,6 +3,14 @@
<template #top>
<!-- 顶部标签我要领用 / 领用记录 -->
<view class="tabs">
<view
class="tab"
v-if="checkPermi('material_collection_audit')"
:class="activeTab === 'allList' ? 'active' : ''"
@click="switchToAllList"
>
领用审核
</view>
<view
class="tab"
:class="activeTab === 'form' ? 'active' : ''"
@ -114,7 +122,7 @@
</uni-popup>
<!-- 列表区域 -->
<view class="tab-content" v-show="activeTab === 'list'">
<view class="tab-content" v-show="activeTab === 'allList' || activeTab === 'list'">
<view
class="record-card"
v-for="item in receiptRecords"
@ -153,18 +161,6 @@
{{ item.remark || '—' }}
</text>
</view>
<!-- <view class="row">
<text class="label">领用部门</text>
<text class="value">
{{ item.ckBillCargos && item.ckBillCargos.length > 0 ? (item.ckBillCargos[0].receiveDeptName || '—') : '—' }}
</text>
</view>
<view class="row">
<text class="label">领用人</text>
<text class="value">
{{ item.ckBillCargos && item.ckBillCargos.length > 0 ? (item.ckBillCargos[0].receiverName || '—') : '—' }}
</text>
</view> -->
<view class="row" v-if="item.ckBillCargos && item.ckBillCargos.length > 0">
<text class="label">领用物资</text>
<text class="value">
@ -175,7 +171,14 @@
</view>
</view>
<view class="card-footer">
<view class="card-footer" v-if="activeTab === 'allList'">
<view class="action-buttons" v-if="item.cancelStatus === '0' && item.billStatus === '0'">
<view class="action-btn approve-btn" v-if="item.auditStatus === '0'" @click="approveBill(item.id)"></view>
<view class="action-btn reject-btn" v-if="item.auditStatus === '0'" @click="handleRejectBill(item.id)"></view>
<view class="action-btn cancel-btn" v-if="item.auditStatus === '1'" @click="cancelAudit(item.id)"></view>
</view>
</view>
<view class="card-footer" v-else>
<view class="action-buttons">
<view class="action-btn cancel-btn" v-if="item.cancelStatus === '0' && item.billStatus === '0'" @click="cancelBill(item.id)"></view>
<view class="action-btn voucher-btn" v-if="item.auditStatus === '1' && item.billStatus === '0'" @click="viewVoucher(item)"></view>
@ -210,11 +213,13 @@
<script>
import uQRCode from '@/js_sdk/Sansnn-uQRCode/uqrcode.js';
import { listCkstock, quickOutBill, stockPageList, cancelBill } from '@/api/property.js';
import { listCkstock, quickOutBill, stockPageList, cancelBill, auditBill, rejectBill, cancelAuditBill } from '@/api/property.js';
import { checkPermi } from '@/utils/auth/permission.js';
export default {
data() {
return {
checkPermi,
activeTab: 'form',
receiptForm: {
purpose: '',
@ -238,7 +243,9 @@ export default {
};
},
onLoad() {
if (this.activeTab === 'list') {
if (checkPermi('material_collection_audit')) {
this.activeTab = 'allList';
} else if (this.activeTab === 'list') {
this.refreshList();
}
},
@ -260,9 +267,11 @@ export default {
methods: {
switchToList() {
this.activeTab = 'list';
if (!this.receiptRecords.length) {
this.$refs.paging.reload();
}
this.$refs.paging.reload();
},
switchToAllList() {
this.activeTab = 'allList';
this.$refs.paging.reload();
},
//
getMaterialsList() {
@ -418,6 +427,87 @@ export default {
const statusText = this.getStatusText(item);
return this.statusClassMap[statusText] || this.statusClassMap['__default__'];
},
//
approveBill(id) {
uni.showModal({
title: '审核确认',
content: '确定要审核通过此单据吗?',
confirmText: '确定',
cancelText: '取消',
success: (res) => {
if (res.confirm) {
auditBill(id).then(response => {
if (response.code === 200) {
uni.showToast({
title: '审核通过成功',
icon: 'success'
});
this.$refs.paging.reload();
} else {
uni.showToast({
title: response.message || '审核通过失败',
icon: 'none'
});
}
});
}
}
});
},
//
handleRejectBill(id) {
uni.showModal({
title: '驳回确认',
content: '确定要驳回此单据吗?',
confirmText: '确定',
cancelText: '取消',
success: (res) => {
if (res.confirm) {
rejectBill(id).then(response => {
if (response.code === 200) {
uni.showToast({
title: '单据已驳回',
icon: 'success'
});
this.$refs.paging.reload();
} else {
uni.showToast({
title: response.message || '驳回失败',
icon: 'none'
});
}
});
}
}
});
},
//
cancelAudit(id) {
uni.showModal({
title: '撤销确认',
content: '确定要撤销此单据的审核吗?',
confirmText: '确定',
cancelText: '取消',
success: (res) => {
if (res.confirm) {
cancelAuditBill(id).then(response => {
if (response.code === 200) {
uni.showToast({
title: '撤销审核成功',
icon: 'success'
});
this.$refs.paging.reload();
} else {
uni.showToast({
title: response.message || '撤销审核失败',
icon: 'none'
});
}
});
}
}
});
},
//
cancelBill(id) {
uni.showModal({
@ -482,7 +572,11 @@ export default {
},
//
queryList(pageNo, pageSize) {
stockPageList({ page: pageNo, limit: pageSize, billType: 2 }).then(res => {
const params = { page: pageNo, limit: pageSize, billType: 2 };
if (this.activeTab === 'allList') {
params.uid = '';
}
stockPageList(params).then(res => {
if (res.code === 200) {
const list = res.data.list;
// completez-paging
@ -771,6 +865,16 @@ export default {
background-color: #409EFF;
color: #fff;
}
.approve-btn {
background-color: #52C41A;
color: #fff;
}
.reject-btn {
background-color: #FF4D4F;
color: #fff;
}
}
}
}

@ -48,6 +48,9 @@
</div>
<div class="logon" @click="loginMobile" v-if="current !== 0"></div>
<div class="logon" @click="submit" v-if="current === 0"></div>
<!-- #ifdef MP-WEIXIN -->
<div class="logon logon-wechat" v-if="current === 0" @click="goWechatLogin"></div>
<!-- #endif -->
<div class="tips">
<!-- <div v-if="current==0" @click="current = 1"></div> -->
<div v-if="current==1" @click="current = 0"></div>
@ -62,6 +65,7 @@
import {
loginH5,
loginMobile,
loginMpByGzhCode,
registerVerify,
register,
// getCodeApi,
@ -81,6 +85,11 @@
import {
VUE_APP_API_URL
} from "@/utils";
// #ifdef MP-WEIXIN
import {
wxGZHAuth
} from "@/libs/wechat";
// #endif
const BACK_URL = "login_back_url";
@ -106,7 +115,8 @@
appUserInfo: null, //
appleLoginStatus: false, //
appleUserInfo: null,
appleShow: false // ios13
appleShow: false, // ios13
pendingGzhCode: '' //
};
},
watch:{
@ -254,7 +264,7 @@
this.getUserInfo(res.data);
}
}).catch(res => {
that.$util.Tips({
this.$util.Tips({
title: res
});
});
@ -370,6 +380,60 @@
navTap: function(index) {
this.current = index;
},
// #ifdef MP-WEIXIN
async mpGzhWechatLogin() {
const that = this;
try {
uni.showLoading({
title: '授权中'
});
const auth = await wxGZHAuth();
const code = auth && auth.code ? auth.code : '';
if (!code) {
uni.hideLoading();
return that.$util.Tips({
title: '未获取到授权码'
});
}
const res = await loginMpByGzhCode(code, that.$Cache.get('spread'));
uni.hideLoading();
const d = res.data || {};
if (d.token) {
that.pendingGzhCode = '';
that.$store.commit('LOGIN', {
token: d.token
});
that.getUserInfo({
uid: d.uid
});
return;
}
if (d.needBind) {
that.pendingGzhCode = code;
uni.showModal({
title: '提示',
content: '当前微信未绑定账号,请使用账号密码完成绑定登录',
showCancel: false
});
return;
}
that.$util.Tips({
title: d.msg || '登录失败'
});
} catch (e) {
uni.hideLoading();
const msg = (e && e.message) || e || '授权失败';
if (msg === 'MP_GZH_LOGIN_PENDING') {
return that.$util.Tips({
title: '公众号登录接口待对接'
});
}
that.$util.Tips({
title: typeof msg === 'string' ? msg : '授权失败'
});
}
},
// #endif
async submit() {
let that = this;
if (!that.account) return that.$util.Tips({
@ -381,14 +445,20 @@
if (!that.password) return that.$util.Tips({
title: '请填写密码'
});
loginH5({
account: that.account,
password: that.password,
spread: that.$Cache.get("spread")
})
const loginPayload = {
account: that.account,
password: that.password,
spread: that.$Cache.get("spread")
};
// mp_gzh_oauth_code
if (that.pendingGzhCode) {
loginPayload.mp_gzh_oauth_code = that.pendingGzhCode;
}
loginH5(loginPayload)
.then(({
data
}) => {
that.pendingGzhCode = '';
this.$store.commit("LOGIN", {
'token': data.token
});
@ -400,7 +470,12 @@
});
});
},
getUserInfo(data){
goWechatLogin() {
uni.navigateTo({
url: "/pages/users/wechat_login/index"
});
},
getUserInfo(data){
this.$store.commit("SETUID", data.uid);
getUserInfo().then(res => {
this.$store.commit("UPDATE_USERINFO", res.data);
@ -423,9 +498,13 @@ getUserInfo(data){
if (!backUrl.startsWith('/')) {
backUrl = '/' + backUrl;
}
// uni.reLaunch({
// url: backUrl
// });
uni.reLaunch({
url: backUrl
url: "/pages/index/index"
});
})
}
}
@ -603,6 +682,11 @@ getUserInfo(data){
font-size: 30rpx;
}
.logon-wechat {
margin-top: 32rpx;
background-color: #07c160;
}
.tips {
margin: 30rpx;
text-align: center;

@ -0,0 +1,38 @@
<template>
<web-view :src="url" @message="handleMessage" @load="handleLoad" @error="handleError"></web-view>
</template>
<script>
export default {
data() {
return {
url: '',
}
},
onLoad() {
const eventChannel = this.getOpenerEventChannel();
eventChannel.on('acceptData', (data) => {
this.url = data.url;
});
},
methods: {
handleMessage(e) {
console.log(e.detail.data);
const data = e.detail.data || [];
const eventChannel = this.getOpenerEventChannel();
eventChannel.emit('callbackData', data[0] || {});
},
//
handleLoad(e) {
},
//
handleError(e) {
uni.showToast({ title: '加载失败', icon: 'none' });
}
}
}
</script>
<style>
</style>
Loading…
Cancel
Save