修改:支持管理员扫描用户二维码进入兑换页面

This commit is contained in:
wuhui_zzw 2024-01-16 12:04:22 +08:00
parent c7be003e8c
commit eb5e0983e2
4 changed files with 173 additions and 17 deletions

View File

@ -12,8 +12,8 @@ export function onlinePaymentRecord(data) {
return request.get("onlinePayment/record",data);
}
// 提货处理 - 获取用户信息
export function pointUserInfo() {
return request.get("exchange/userHold");
export function pointUserInfo(data) {
return request.get("exchange/userHold",data);
}
// 提货处理 - 获取提货点信息
export function pointList(data) {
@ -27,6 +27,10 @@ export function confirmExchange(data) {
export function exchangeRecord(data) {
return request.get("exchange/exchangeRecord",data);
}
// 提货处理 - 获取消费者用户
export function consumeList(data) {
return request.get("exchange/consumeList",data);
}
// 站点管理 - 我的站点&兑换记录
export function siteManage(apiName ,data) {
// list=我的站点exchange_record=兑换记录
@ -36,3 +40,7 @@ export function siteManage(apiName ,data) {
export function getSiteQrCode(data) {
return request.get(`exchange/site_qr_code`,data);
}
// 用户兑换 - 获取二维码
export function getUserExchangeQrcode() {
return request.get(`exchange/user_qr_code`);
}

View File

@ -89,6 +89,7 @@
</view>
</navigator>
<view class="right-btn">
<view class="iconfont icon-erweima1" v-if="isLogin" @click="showQrCode()"></view>
<view class="iconfont icon-shezhi" v-if="isLogin" @click="goSetting()"></view>
<view class="btn" @click="authTo('/pages/chat/customer_list/index?type=0')" hover-class="none">
<view class="iconfont icon-xiaoxi"></view>
@ -205,6 +206,14 @@
</view>
<!--自定义底部tab栏-->
<customTab :newData="newData" :activeRouter="activeRouter"></customTab>
<!--二维码-->
<uni-popup ref="qrCodePopup" type="center">
<view class="qr-code-content">
<image class="image" :src="qrCode"></image>
<view class="close-qr-code" @click="$refs.qrCodePopup.open.close()">关闭</view>
</view>
</uni-popup>
</view>
</template>
<script>
@ -225,6 +234,8 @@
import { configMap } from '@/utils';
import Auth from '../../libs/wechat';
import { HTTP_REQUEST_URL } from '@/config/app';
import { getUserExchangeQrcode } from '@/api/exchange.js';
const app = getApp();
export default {
components: {
@ -323,11 +334,10 @@
newData: {},
activeRouter: '',
sysHeight: sysHeight,
currIndex: 0, //
swiperHeight: 0, // (px)
//
qrCode: '',
}
},
onLoad(options) {
@ -603,6 +613,22 @@
// if (res && res[0]) this.swiperHeight = res[0].height;
// });
},
//
showQrCode(){
let _this = this;
getUserExchangeQrcode().then(res => {
if(res.status == 200){
_this.qrCode = res.data.qr_code || ''
_this.$refs.qrCodePopup.open('center');
}
}).catch(err => {
this.$util.Tips({
title: err
});
});
},
},
onPullDownRefresh: function(){
@ -1185,4 +1211,22 @@
font-size: 24rpx;
}
}
.qr-code-content{
width: 80vw;
.image{
width: 80vw;
height: 80vw;
}
.close-qr-code{
position: fixed;
top: 35rpx;
right: 70rpx;
color: #FFFFFF;
border: 2rpx solid #FFFFFF;
height: 40rpx;
line-height: 36rpx;
padding: 0 20rpx;
border-radius: 50rpx;
}
}
</style>

View File

@ -10,7 +10,7 @@
{{ point_info.id > 0 ? '切换' : '选择' }}
</view>
</view>
<view class="right" @click="goMenuPage('/pages/users/online_payment/exchange/record')">兑换记录</view>
<!--<view class="right" @click="goMenuPage('/pages/users/online_payment/exchange/record')">兑换记录</view>-->
</view>
<view class="top" v-if="point_info.id > 0">
<view class="left">
@ -20,6 +20,14 @@
</view>
</view>
</view>
<view class="top">
<view class="left">
<view class="name">消费者{{ (consume_info.nickname || consume_info.real_name || consume_info.uid) || '请选择消费者' }}</view>
<view class="change-btn" @click="showConsumePopup" v-if="consume_search.default_consume_id <= 0">
{{ consume_info.uid > 0 ? '切换' : '选择' }}
</view>
</view>
</view>
<!-- 买单金额 -->
<view class="money">
<view class="top-bg-line"></view>
@ -96,18 +104,40 @@
</view>
</view>
</uni-popup>
<!--消费用户选择-->
<uni-popup ref="selectedConsume" type="center">
<view class="point-content">
<view class="search-content">
<input class="money-input" v-model="consume_search.search_text" type='text' placeholder="UID/用户昵称/真实姓名/电话" />
<view class="search-btn" @click="getConsumeList">搜索</view>
<view class="close-btn" @click="consumeClosePopup">取消</view>
</view>
<view class="point-list">
<view class="point-box" v-for="(item,index) in consume_list" :key="index">
<view class="left">
<image class="image" :src="item.avatar || '/static/images/f.png'"></image>
<view class="point-info">
<view class="point-name">{{ item.nickname || item.real_name }}</view>
<view class="point-address">UID{{ item.uid }}</view>
</view>
</view>
<view class="selected-btn" @click="selectedConsume(item)">选中</view>
</view>
</view>
</view>
</uni-popup>
</view>
</template>
<script>
import { pointList,pointUserInfo,confirmExchange } from '@/api/exchange.js';
import { pointList,pointUserInfo,confirmExchange,consumeList } from '@/api/exchange.js';
import {mapGetters} from "vuex";
import authorize from '@/components/Authorize';
import emptyPage from '@/components/emptyPage.vue';
import spread from "@/libs/spread";
import util from "../../../../utils/util";
const app = getApp();
export default {
@ -133,6 +163,13 @@ export default {
staff_info: {},
staff_list: {},
default_staff_id: 0,
//
consume_info: {},
consume_list: {},
consume_search: {
search_text: '',
default_consume_id: 0,
},
//
pay_info: {
total_money: 0.00,
@ -140,7 +177,6 @@ export default {
diff_money: 0.00,
diff_money_pay: 0.00,
},
};
},
computed: {
@ -150,7 +186,13 @@ export default {
if(options.scene){
var scene = this.$util.getUrlParams(decodeURIComponent(options.scene));
this.point_search.default_point_id = scene.point_id || 0;
this.consume_search.default_consume_id = scene.consume_uid || 0;
this.default_staff_id = scene.staff_uid || 0;
//
if(Number(this.consume_search.default_consume_id) > 0){
this.default_staff_id = this.userInfo.uid || 0;
this.point_search.uid = this.userInfo.uid || 0;
}
}
//
if (!this.isLogin) {
@ -191,6 +233,12 @@ export default {
}
},
deep: false
},
'consume_info.uid':{
handler() {
this.getUserInfo();
},
deep: false
}
},
methods: {
@ -217,7 +265,10 @@ export default {
//
getUserInfo(){
let _this = this;
pointUserInfo()
let params = {
consume_uid: _this.consume_info.uid
};
pointUserInfo(params)
.then(res => {
_this.pointUserInfo = res.data || {};
})
@ -243,7 +294,19 @@ export default {
pointList(this.point_search)
.then(res => {
_this.point_list = res.data || {};
if(_this.point_search.default_point_id > 0){
//
if(Object.values(_this.point_list).length <= 0){
this.$util.Tips({
title: '非操作员,无操作权限!',
},{tab:1,url:'/pages/user/index'});
return false;
}
// -
if(Object.values(_this.point_list).length == 1){
_this.selectedPoint(_this.point_list[0]);
}
//
else if(_this.point_search.default_point_id > 0){
_this.selectedPoint(_this.point_list[0]);
}
})
@ -262,13 +325,15 @@ export default {
//
if(Number(this.default_staff_id) > 0){
//
this.staff_info = item.user_list[this.default_staff_id];
this.selectedStaff(item.user_list[this.default_staff_id]);
// this.staff_info = item.user_list[this.default_staff_id];
}else if(Object.values(this.staff_list).length > 1){
//
this.showStaffPopup();
}else{
//
this.staff_info = this.staff_list[0];
// this.staff_info = this.staff_list[0];
this.selectedStaff(this.staff_list[0]);
}
},
// -
@ -283,6 +348,45 @@ export default {
selectedStaff(item){
this.staff_info = item;
this.staffClosePopup();
//
let consumeUid = this.consume_info.uid || 0;
if(consumeUid <= 0) this.showConsumePopup();
},
// -
showConsumePopup(){
if(Object.keys(this.consume_list).length <= 0) this.getConsumeList();
//
if(Number(this.consume_search.default_consume_id) <= 0) this.$refs.selectedConsume.open('center');
},
// -
consumeClosePopup(){
this.$refs.selectedConsume.close();
},
// -
getConsumeList(){
let _this = this;
consumeList(this.consume_search)
.then(res => {
_this.consume_list = res.data || {};
// -
if(Object.values(_this.consume_list).length == 1){
_this.selectedConsume(_this.consume_list[0]);
}
//
else if(_this.consume_search.default_consume_id > 0){
_this.selectedConsume(_this.consume_list[0]);
}
})
.catch(err => {
this.$util.Tips({
title: err
});
});
},
// -
selectedConsume(item){
this.consume_info = item;
this.consumeClosePopup();
},
//
confirmPayment(){
@ -290,6 +394,7 @@ export default {
let payInfo = Object.assign({},_this.pay_info);
payInfo.point_id = this.point_info.id;
payInfo.staff_uid = this.staff_info.uid;
payInfo.consume_uid = this.consume_info.uid;
uni.showLoading({
title: '处理中...',

View File

@ -14,7 +14,7 @@
<view class="title">{{item.title}}</view>
<view class="address">{{item.address}}</view>
</view>
<view class="right" @click="showQrCode(item)">兑换码</view>
<!--<view class="right" @click="showQrCode(item)">兑换码</view>-->
</view>
</view>
<!--兑换记录-->
@ -38,7 +38,7 @@
</view>
<!--授权登录-->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
<!--店铺选择-->
<!--二维码-->
<uni-popup ref="qrCodePopup" type="center">
<view class="qr-code-content">
<image class="image" :src="qrCode"></image>
@ -50,11 +50,10 @@
<script>
import { siteManage } from '@/api/exchange.js';
import { siteManage, getSiteQrCode } from '@/api/exchange.js';
import {mapGetters} from "vuex";
import authorize from '@/components/Authorize';
import emptyPage from '@/components/emptyPage.vue';
import {getSiteQrCode} from "../../../../api/exchange";
const app = getApp();
export default {